我不明白为什么TextField文本和蓝线之间的底部有空间。
这是我的代码:
Future<Null> _selectNoteType (BuildContext context) async {
switch (await showDialog<Null>(
context: context,
builder: (BuildContext context) {
return new SimpleDialog(
title: const Text('Select Note Type'),
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left: 8.0, right: 8.0),
child: new TextField(
keyboardType: TextInputType.text,
maxLines: 1,
style: new TextStyle(
color: Colors.black,
fontSize: 20.0
),
),
),
new SimpleDialogOption(
onPressed: () {},
child: const Text('Text')
),
new SimpleDialogOption(
onPressed: () {},
child: const Text('Checklist')
),
],
);
}
)) {}
}
Run Code Online (Sandbox Code Playgroud) 所以,我想尝试在Flutter. 我经历了所有的步骤就和成功启用了桌面支持Flutter使用flutter config --enable-linux-desktop在master channel。
现在每次我创建一个新的项目Flutter,它会自动建立必要的文件Linux Desktop。
我试过运行flutter config --disable-linux-desktop,但没有这样的命令。如何禁用桌面支持?
PS:我不想切换到,stable channel因为我也想为Web.
我在模拟器上运行应用程序时遇到未知异常:
The _ScaffoldLayout custom multichild layout delegate forgot to lay out the following child:
Run Code Online (Sandbox Code Playgroud)
我正在使用Flutter 1.0.0和Dart 2.1.0
我试图查找Google,但找不到解决方案。
这是我的代码:
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Text Input Example"),
),
body: Column(
children: <Widget>[
Align(
alignment: Alignment.bottomCenter,
child: Flexible(
child: TextField(
style: TextStyle(
color: Colors.black,
fontSize: 16.0
),
),
),
)
],
),
);
}
Run Code Online (Sandbox Code Playgroud) 问题:
当按下登录按钮时,会显示一个进度指示器。但是,完成后,键盘会自动弹出,即使它没有提前显示。
我的想法:
我认为,因为最后一个焦点是在 上TextField,所以当前的焦点会在该过程之后切换回它。
我的代码在做什么:
按下登录按钮时,它会触发showDialog方法。之后,它等待 ( await) 进程完成。之后,Navigator.pop(context)被调用所以Dialog可以被销毁。
这就是键盘再次出现的时候。
视觉:
我只想在屏幕上拖动小部件,而不是拖放。
但是,每当我离开它并再次开始拖动时,它就会开始从开始的位置开始拖动。就好像它是一样reset。
我的猜测是 build 被一次又一次地调用,所以它会自动使用original position values. 我该如何解决?代码应该是什么?
换句话说,position就是设置为结束(100, 100)之后DragEvent。然后下一个拖动开始位置,(100, 100)而不是小部件被放置到的最后位置。
我也尝试过这个GlobalPosition,但得到了相同的结果。这是我的代码:
class HomePage extends StatefulWidget {
@override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
double x1 = 100.0;
double x2 = 200.0;
double y1 = 100.0;
double y2 = 200.0;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: true,
title: Text('Drag widget on screen'),
),
body: Stack(
children: [
Positioned( …Run Code Online (Sandbox Code Playgroud) dart flutter flutter-positioned flutter-state flutter-android