Compare commits
1 Commits
5ef22c7b50
..
v0.1.2
| Author | SHA1 | Date | |
|---|---|---|---|
| 392ec22dcd |
@@ -1,37 +0,0 @@
|
|||||||
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,6 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'app_theme.dart';
|
|
||||||
import 'model/repositories/local_repository.dart';
|
import 'model/repositories/local_repository.dart';
|
||||||
import 'pages/task_edit_page.dart';
|
import 'pages/task_edit_page.dart';
|
||||||
import 'pages/task_overview_page.dart';
|
import 'pages/task_overview_page.dart';
|
||||||
@@ -34,8 +33,6 @@ class MainApp extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
theme: AppTheme.lightTheme,
|
|
||||||
darkTheme: AppTheme.darkTheme,
|
|
||||||
routes: {
|
routes: {
|
||||||
TaskOverviewPage.routeName: (context) => TaskOverviewPage(),
|
TaskOverviewPage.routeName: (context) => TaskOverviewPage(),
|
||||||
TaskEditPage.routeName: (context) => TaskEditPage(),
|
TaskEditPage.routeName: (context) => TaskEditPage(),
|
||||||
|
|||||||
@@ -80,9 +80,7 @@ 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,16 +22,11 @@ class _TaskOverviewPageState extends State<TaskOverviewPage> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(title: Text('Hallo Yannick')),
|
appBar: AppBar(),
|
||||||
body: Padding(
|
body: ReorderableListView.builder(
|
||||||
padding: EdgeInsetsGeometry.symmetric(
|
itemBuilder: itemBuilder,
|
||||||
horizontal: MediaQuery.of(context).size.width * 0.05,
|
itemCount: tasks.length,
|
||||||
),
|
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,
|
||||||
@@ -43,31 +38,27 @@ 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 Padding(
|
return TaskDismissible(
|
||||||
key: Key(task.id),
|
key: Key(task.id),
|
||||||
padding: const EdgeInsets.only(bottom: 12),
|
onDismissedRight: () =>
|
||||||
child: TaskDismissible(
|
context.controller<TaskController>().deleteTask(task),
|
||||||
key: Key(task.id),
|
child: ListTile(
|
||||||
onDismissedRight: () =>
|
title: Text(task.title),
|
||||||
context.controller<TaskController>().deleteTask(task),
|
subtitle: task.description.isNotEmpty ? Text(task.description) : null,
|
||||||
child: ListTile(
|
trailing: Checkbox(
|
||||||
title: Text(task.title),
|
value: task.isCompleted,
|
||||||
subtitle: task.description.isNotEmpty ? Text(task.description) : null,
|
onChanged: (isCompleted) => context
|
||||||
trailing: Checkbox(
|
.controller<TaskController>()
|
||||||
value: task.isCompleted,
|
.saveTask(task.copyWith(isCompleted: 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),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,10 +16,7 @@ class TaskDismissible extends StatelessWidget {
|
|||||||
key: key!,
|
key: key!,
|
||||||
direction: DismissDirection.startToEnd,
|
direction: DismissDirection.startToEnd,
|
||||||
background: Container(
|
background: Container(
|
||||||
decoration: BoxDecoration(
|
color: Theme.of(context).colorScheme.error,
|
||||||
borderRadius: BorderRadius.circular(12),
|
|
||||||
color: Theme.of(context).colorScheme.error,
|
|
||||||
),
|
|
||||||
child: Align(
|
child: Align(
|
||||||
alignment: AlignmentGeometry.centerLeft,
|
alignment: AlignmentGeometry.centerLeft,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
|
|||||||
Reference in New Issue
Block a user