【发布时间】:2019-08-04 13:30:30
【问题描述】:
我正在尝试设置一个待办事项列表,但我的结束标签下不断出现这些红线
所以我正在制作一个待办事项列表并基本设置好所有内容,但底部的结束标签一直在它们下面有红线
这是我第一次使用堆栈,如果我是白痴,请原谅我
我尝试过切换它们
import 'package:flutter/material.dart';
void main() {
runApp(new MyApp(
title: new Text("My App"), someText: new Text("Some Text..."),));
}
class MyApp extends StatefulWidget {
MyApp({this.title, this.someText});
final Widget title, someText;
@override
MyAppState createState() => new MyAppState();
}
class MyAppState extends State<MyApp> {
TextEditingController eCtrl = new TextEditingController();
bool showDialog = false;
List<bool> textChkBox = [];
List<String> textlist = [];
Widget build (BuildContext ctxt) {
return new MaterialApp (
home: new Scaffold (
appBar: new AppBar(
title: widget.title,
actions: <Widget>[
new IconButton(
icon: new Icon (Icons.add_comment),
onPressed: () {
setState(() {
showDialog = true;
});
}
),
new IconButton(
icon: new Icon (Icons.remove),
onPressed: () {
setState(() {});
}
),
],
),
body: new Column(
children: <Widget>[
new Text("Hello Flutter"),
showDialog == true ?
new AlertDialog(
title: new Text("Alert Dialog"),
content: new TextField
(
controller: eCtrl,
decoration: new InputDecoration.collapsed(
hintText: "ADD XYZ"),
maxLines: 3,
onSubmitted: (String text) {
},
),
actions: <Widget>[
new FlatButton (
onPressed: () {
setState(() {
showDialog = false;
textlist.add(eCtrl.text);
textChkBox.add(false);
eCtrl.clear();
});
},
child: new Text("OK")
)
],
) : new Text(""),
new Flexible(
child: new ListView.builder(
itemCount: textlist.length,
itemBuilder: (BuildContext ctxt, int index) {
return new Row(
children: <Widget>[
new Checkbox(
value: textChkBox[index],
onChanged: (bool newValue) {
textChkBox[index] = newValue;
setState(() {});
},
),
new Text(textlist[index])
]
);
}
)
)
],
)
}
【问题讨论】:
标签: flutter floating-action-button