mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-28 09:47:35 +08:00
TodoEditor: Add a 'Add Item' button at the bottom
This commit is contained in:
@ -56,10 +56,14 @@ class TodoEditorState extends State<TodoEditor> implements EditorState {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var todoItemTiles = <TodoItemTile>[];
|
||||
var todoItemTiles = <Widget>[];
|
||||
todos.forEach((TodoItem todo) {
|
||||
todoItemTiles.add(_buildTile(todo));
|
||||
});
|
||||
todoItemTiles.add(AddTodoItemButton(
|
||||
key: UniqueKey(),
|
||||
onPressed: () {},
|
||||
));
|
||||
|
||||
print("Building " + todos.toString());
|
||||
Widget todoList = ReorderableListView(
|
||||
@ -221,6 +225,32 @@ class _TodoItemTileState extends State<TodoItemTile> {
|
||||
}
|
||||
}
|
||||
|
||||
class AddTodoItemButton extends StatelessWidget {
|
||||
final Function onPressed;
|
||||
|
||||
AddTodoItemButton({Key key, @required this.onPressed}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var style = Theme.of(context).textTheme.subhead;
|
||||
|
||||
return ListTile(
|
||||
dense: true,
|
||||
leading: Row(
|
||||
children: <Widget>[
|
||||
Container(height: 24.0, width: 24.0),
|
||||
IconButton(
|
||||
icon: Icon(Icons.add),
|
||||
onPressed: () {},
|
||||
)
|
||||
],
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
),
|
||||
title: Text("Add Item", style: style),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: The body needs to be scrollable
|
||||
// FIXME: Add a new todo button
|
||||
// FIXME: Fix padding issue with todo items
|
||||
|
Reference in New Issue
Block a user