willsonlincake 发表于 2022-4-10 16:27:49

Flutter iOS风格文本框

class MyPrefilledText extends StatefulWidget {
const MyPrefilledText({Key? key}) : super(key: key);

@override
State<MyPrefilledText> createState() => _MyPrefilledTextState();
}

class _MyPrefilledTextState extends State<MyPrefilledText> {
late TextEditingController _textController;

@override
void initState() {
    super.initState();
    _textController = TextEditingController(text: 'initial text');
}

@override
Widget build(BuildContext context) {
    return CupertinoTextField(controller: _textController);
}
}

willsonlincake 发表于 2022-4-10 16:28:03

https://api.flutter.dev/flutter/cupertino/CupertinoTextField-class.html
页: [1]
查看完整版本: Flutter iOS风格文本框