Add list support
This commit is contained in:
parent
733b0e6ae2
commit
0155bcdf15
BIN
assets/graphics/hypnotize.png
Normal file
BIN
assets/graphics/hypnotize.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 61 KiB |
|
@ -77,6 +77,13 @@ class HomePageState extends State<HomePage> {
|
||||||
new UserAccountsDrawerHeader(
|
new UserAccountsDrawerHeader(
|
||||||
accountEmail: const Text('jonas@try.vikunja.io'),
|
accountEmail: const Text('jonas@try.vikunja.io'),
|
||||||
accountName: const Text('Jonas Franz'),
|
accountName: const Text('Jonas Franz'),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
image: DecorationImage(
|
||||||
|
image: AssetImage("assets/graphics/hypnotize.png"),
|
||||||
|
repeat: ImageRepeat.repeat,
|
||||||
|
colorFilter: ColorFilter.mode(Theme.of(context).primaryColor, BlendMode.multiply)
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
new Expanded(
|
new Expanded(
|
||||||
child: ListView(
|
child: ListView(
|
||||||
|
|
|
@ -10,17 +10,66 @@ class ListPage extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ListPageState extends State<ListPage> {
|
class _ListPageState extends State<ListPage> {
|
||||||
|
Map<String, bool> items = {
|
||||||
|
"Butter": true,
|
||||||
|
"Milch": false
|
||||||
|
};
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: new Text(widget.listName),
|
title: new Text(widget.listName),
|
||||||
),
|
),
|
||||||
body: Center(
|
body: ListView(
|
||||||
child: RaisedButton(
|
padding: EdgeInsets.symmetric(vertical: 8.0),
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
children: ListTile.divideTiles(context: context,
|
||||||
child: const Text("Go back")),
|
tiles: items.map((item, checked) =>
|
||||||
|
MapEntry(item, CheckboxListTile(
|
||||||
|
title: Text(item),
|
||||||
|
controlAffinity: ListTileControlAffinity.leading,
|
||||||
|
value: checked,
|
||||||
|
onChanged: (bool value) => setState(() => items[item] = value),
|
||||||
|
))
|
||||||
|
).values
|
||||||
|
).toList(),
|
||||||
),
|
),
|
||||||
|
floatingActionButton: FloatingActionButton(onPressed: () => _addItem(), child: Icon(Icons.add)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_addItem() {
|
||||||
|
var textController = new TextEditingController();
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
child: new AlertDialog(
|
||||||
|
contentPadding: const EdgeInsets.all(16.0),
|
||||||
|
content: new Row(children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: new TextField(
|
||||||
|
autofocus: true,
|
||||||
|
decoration: new InputDecoration(
|
||||||
|
labelText: 'List Item',
|
||||||
|
hintText: 'eg. Milk'),
|
||||||
|
controller: textController,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
actions: <Widget>[
|
||||||
|
new FlatButton(
|
||||||
|
child: const Text('CANCEL'),
|
||||||
|
onPressed: () => Navigator.pop(context),
|
||||||
|
),
|
||||||
|
new FlatButton(
|
||||||
|
child: const Text('ADD'),
|
||||||
|
onPressed: () {
|
||||||
|
if (textController.text.isNotEmpty)
|
||||||
|
setState(() => items[textController.text] = false);
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,6 +78,7 @@ flutter:
|
||||||
# see https://flutter.io/custom-fonts/#from-packages
|
# see https://flutter.io/custom-fonts/#from-packages
|
||||||
assets:
|
assets:
|
||||||
- assets/graphics/background.jpg
|
- assets/graphics/background.jpg
|
||||||
|
- assets/graphics/hypnotize.png
|
||||||
fonts:
|
fonts:
|
||||||
- family: Quicksand
|
- family: Quicksand
|
||||||
fonts:
|
fonts:
|
||||||
|
|
Reference in New Issue
Block a user