Compare commits
4 Commits
77a524f3ec
...
v0.1.3
| Author | SHA1 | Date | |
|---|---|---|---|
| 81222de7fe | |||
| 6dc7161b41 | |||
| f1756b30d1 | |||
| 392ec22dcd |
@@ -80,7 +80,9 @@ class _TaskEditPageState extends State<TaskEditPage> {
|
|||||||
horizontal: MediaQuery.of(context).size.width * 0.05,
|
horizontal: MediaQuery.of(context).size.width * 0.05,
|
||||||
),
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
|
spacing: 12,
|
||||||
children: [
|
children: [
|
||||||
|
SizedBox(height: 6),
|
||||||
TextFormField(
|
TextFormField(
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
controller: titleController,
|
controller: titleController,
|
||||||
|
|||||||
@@ -22,11 +22,16 @@ class _TaskOverviewPageState extends State<TaskOverviewPage> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(),
|
appBar: AppBar(title: Text('Hallo Yannick')),
|
||||||
body: ReorderableListView.builder(
|
body: Padding(
|
||||||
itemBuilder: itemBuilder,
|
padding: EdgeInsetsGeometry.symmetric(
|
||||||
itemCount: tasks.length,
|
horizontal: MediaQuery.of(context).size.width * 0.05,
|
||||||
onReorderItem: context.controller<TaskController>().reorderTask,
|
),
|
||||||
|
child: ReorderableListView.builder(
|
||||||
|
itemBuilder: itemBuilder,
|
||||||
|
itemCount: tasks.length,
|
||||||
|
onReorderItem: context.controller<TaskController>().reorderTask,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
floatingActionButton: FloatingActionButton(
|
floatingActionButton: FloatingActionButton(
|
||||||
onPressed: onCreateTaskTapped,
|
onPressed: onCreateTaskTapped,
|
||||||
@@ -38,27 +43,31 @@ class _TaskOverviewPageState extends State<TaskOverviewPage> {
|
|||||||
Widget itemBuilder(BuildContext context, int index) {
|
Widget itemBuilder(BuildContext context, int index) {
|
||||||
final task = tasks.elementAt(index);
|
final task = tasks.elementAt(index);
|
||||||
|
|
||||||
return TaskDismissible(
|
return Padding(
|
||||||
key: Key(task.id),
|
key: Key(task.id),
|
||||||
onDismissedRight: () =>
|
padding: const EdgeInsets.only(bottom: 12),
|
||||||
context.controller<TaskController>().deleteTask(task),
|
child: TaskDismissible(
|
||||||
child: ListTile(
|
key: Key(task.id),
|
||||||
title: Text(task.title),
|
onDismissedRight: () =>
|
||||||
subtitle: task.description.isNotEmpty ? Text(task.description) : null,
|
context.controller<TaskController>().deleteTask(task),
|
||||||
trailing: Checkbox(
|
child: ListTile(
|
||||||
value: task.isCompleted,
|
title: Text(task.title),
|
||||||
onChanged: (isCompleted) => context
|
subtitle: task.description.isNotEmpty ? Text(task.description) : null,
|
||||||
.controller<TaskController>()
|
trailing: Checkbox(
|
||||||
.saveTask(task.copyWith(isCompleted: isCompleted)),
|
value: task.isCompleted,
|
||||||
|
onChanged: (isCompleted) => context
|
||||||
|
.controller<TaskController>()
|
||||||
|
.saveTask(task.copyWith(isCompleted: isCompleted)),
|
||||||
|
),
|
||||||
|
onTap: () async {
|
||||||
|
final result = await onTaskTapped(task);
|
||||||
|
if (result != null && context.mounted) {
|
||||||
|
context.controller<TaskController>().saveTask(
|
||||||
|
result.toTask(id: task.id),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
),
|
),
|
||||||
onTap: () async {
|
|
||||||
final result = await onTaskTapped(task);
|
|
||||||
if (result != null && context.mounted) {
|
|
||||||
context.controller<TaskController>().saveTask(
|
|
||||||
result.toTask(id: task.id),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user