added padding to views
This commit is contained in:
@@ -80,7 +80,9 @@ class _TaskEditPageState extends State<TaskEditPage> {
|
||||
horizontal: MediaQuery.of(context).size.width * 0.05,
|
||||
),
|
||||
child: Column(
|
||||
spacing: 12,
|
||||
children: [
|
||||
SizedBox(height: 6),
|
||||
TextFormField(
|
||||
autofocus: true,
|
||||
controller: titleController,
|
||||
|
||||
@@ -23,10 +23,15 @@ class _TaskOverviewPageState extends State<TaskOverviewPage> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(),
|
||||
body: ReorderableListView.builder(
|
||||
itemBuilder: itemBuilder,
|
||||
itemCount: tasks.length,
|
||||
onReorderItem: context.controller<TaskController>().reorderTask,
|
||||
body: Padding(
|
||||
padding: EdgeInsetsGeometry.symmetric(
|
||||
horizontal: MediaQuery.of(context).size.width * 0.05,
|
||||
),
|
||||
child: ReorderableListView.builder(
|
||||
itemBuilder: itemBuilder,
|
||||
itemCount: tasks.length,
|
||||
onReorderItem: context.controller<TaskController>().reorderTask,
|
||||
),
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: onCreateTaskTapped,
|
||||
@@ -38,27 +43,31 @@ class _TaskOverviewPageState extends State<TaskOverviewPage> {
|
||||
Widget itemBuilder(BuildContext context, int index) {
|
||||
final task = tasks.elementAt(index);
|
||||
|
||||
return TaskDismissible(
|
||||
return Padding(
|
||||
key: Key(task.id),
|
||||
onDismissedRight: () =>
|
||||
context.controller<TaskController>().deleteTask(task),
|
||||
child: ListTile(
|
||||
title: Text(task.title),
|
||||
subtitle: task.description.isNotEmpty ? Text(task.description) : null,
|
||||
trailing: Checkbox(
|
||||
value: task.isCompleted,
|
||||
onChanged: (isCompleted) => context
|
||||
.controller<TaskController>()
|
||||
.saveTask(task.copyWith(isCompleted: isCompleted)),
|
||||
padding: const EdgeInsets.only(bottom: 12),
|
||||
child: TaskDismissible(
|
||||
key: Key(task.id),
|
||||
onDismissedRight: () =>
|
||||
context.controller<TaskController>().deleteTask(task),
|
||||
child: ListTile(
|
||||
title: Text(task.title),
|
||||
subtitle: task.description.isNotEmpty ? Text(task.description) : null,
|
||||
trailing: Checkbox(
|
||||
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