【发布时间】:2019-11-27 05:33:37
【问题描述】:
我正在尝试在我的颤振应用程序中添加浮动操作按钮,由于只能实现一个孩子,我无法弄清楚我应该将浮动操作按钮的代码放在哪里。
我可以将它作为子项放在列中,但它不会出现在屏幕的左下角。我还尝试创建另一个类,然后将其放入脚手架小部件中,但我的 _favCity 将不包含在内
....
class _favCity extends State<favCity> {
String city1, city2;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Email Login"),
centerTitle: true,
),
backgroundColor: Colors.cyan,
body: Container(
margin: EdgeInsets.all(40.0),
color: Colors.brown,
child: Column(
children: <Widget>[
Container(
padding: EdgeInsets.all(10.0),
//color: Colors.white,
child: TextField(
decoration: new InputDecoration(
labelText: "Enter City 1",
fillColor: Colors.orange,
border: new OutlineInputBorder(
borderRadius: BorderRadius.circular(20.0),
),
),
onSubmitted: (String userInput) {
setState(() {
city1 = userInput;
});
},
),
),
Container(
padding: EdgeInsets.all(10.0),
// color: Colors.white,
child: TextField(
decoration: InputDecoration(
labelText: "Enter city 2",
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(20.0),
),
fillColor: Colors.orange,
),
onChanged: (String UserInput) {
setState(() {
city2 = UserInput;
});
},
),
),
Text("$city1 Is better than $city2"),
],
),
),
);
}
}
【问题讨论】: