Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 81222de7fe | |||
| 6dc7161b41 | |||
| f1756b30d1 | |||
| 77a524f3ec |
@@ -0,0 +1,37 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class AppTheme {
|
||||
AppTheme._();
|
||||
|
||||
static ThemeData get lightTheme => _baseTheme(
|
||||
colorScheme: ColorScheme.fromSeed(
|
||||
seedColor: Colors.indigo,
|
||||
brightness: Brightness.light,
|
||||
),
|
||||
);
|
||||
|
||||
static ThemeData get darkTheme => _baseTheme(
|
||||
colorScheme: ColorScheme.fromSeed(
|
||||
seedColor: Colors.indigo,
|
||||
brightness: Brightness.dark,
|
||||
),
|
||||
);
|
||||
|
||||
static ThemeData _baseTheme({required ColorScheme colorScheme}) {
|
||||
final theme = ThemeData(useMaterial3: true, colorScheme: colorScheme);
|
||||
final universalBorderRadius = BorderRadius.circular(12);
|
||||
|
||||
return theme.copyWith(
|
||||
inputDecorationTheme: InputDecorationTheme(
|
||||
border: OutlineInputBorder(borderRadius: universalBorderRadius),
|
||||
),
|
||||
|
||||
listTileTheme: ListTileThemeData(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: universalBorderRadius,
|
||||
side: BorderSide(color: colorScheme.secondaryContainer, width: 2),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'app_theme.dart';
|
||||
import 'model/repositories/local_repository.dart';
|
||||
import 'pages/task_edit_page.dart';
|
||||
import 'pages/task_overview_page.dart';
|
||||
@@ -33,6 +34,8 @@ class MainApp extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
theme: AppTheme.lightTheme,
|
||||
darkTheme: AppTheme.darkTheme,
|
||||
routes: {
|
||||
TaskOverviewPage.routeName: (context) => TaskOverviewPage(),
|
||||
TaskEditPage.routeName: (context) => TaskEditPage(),
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -22,12 +22,17 @@ class _TaskOverviewPageState extends State<TaskOverviewPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(),
|
||||
body: ReorderableListView.builder(
|
||||
appBar: AppBar(title: Text('Hallo Yannick')),
|
||||
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,
|
||||
child: Icon(Icons.add),
|
||||
@@ -38,7 +43,10 @@ class _TaskOverviewPageState extends State<TaskOverviewPage> {
|
||||
Widget itemBuilder(BuildContext context, int index) {
|
||||
final task = tasks.elementAt(index);
|
||||
|
||||
return TaskDismissible(
|
||||
return Padding(
|
||||
key: Key(task.id),
|
||||
padding: const EdgeInsets.only(bottom: 12),
|
||||
child: TaskDismissible(
|
||||
key: Key(task.id),
|
||||
onDismissedRight: () =>
|
||||
context.controller<TaskController>().deleteTask(task),
|
||||
@@ -60,6 +68,7 @@ class _TaskOverviewPageState extends State<TaskOverviewPage> {
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user