2023-01-07 17:15:32 +00:00
|
|
|
import 'package:flutter/material.dart';
|
2023-01-13 21:39:05 +00:00
|
|
|
import 'package:intl/date_symbol_data_local.dart';
|
|
|
|
import 'package:intl/intl_standalone.dart';
|
2023-01-08 21:34:24 +00:00
|
|
|
import 'package:nextcloud_reminder/homescreen.dart';
|
|
|
|
|
2023-01-07 17:15:32 +00:00
|
|
|
|
|
|
|
void main() {
|
2023-01-13 21:39:05 +00:00
|
|
|
findSystemLocale().then((value) =>
|
|
|
|
initializeDateFormatting(value).then((_) =>
|
|
|
|
runApp(const TodoTxtReminderApp())
|
|
|
|
));
|
2023-01-07 17:15:32 +00:00
|
|
|
}
|
|
|
|
|
2023-01-08 21:34:24 +00:00
|
|
|
class TodoTxtReminderApp extends StatelessWidget {
|
|
|
|
const TodoTxtReminderApp({super.key});
|
2023-01-13 21:39:05 +00:00
|
|
|
static const primaryColor = Colors.pink;
|
|
|
|
static const secondaryColor = Colors.amber;
|
|
|
|
|
|
|
|
getInteractColor(Color a, Color b) {
|
|
|
|
return (Set<MaterialState> states) {
|
|
|
|
const Set<MaterialState> interactiveStates = <MaterialState>{
|
|
|
|
MaterialState.pressed,
|
|
|
|
MaterialState.hovered,
|
|
|
|
MaterialState.focused,
|
|
|
|
};
|
|
|
|
if (states.any(interactiveStates.contains)) {
|
|
|
|
return b;
|
|
|
|
}
|
|
|
|
return a;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
Color getColor(Set<MaterialState> states) {
|
|
|
|
return getInteractColor(primaryColor, secondaryColor)(states);
|
|
|
|
}
|
2023-01-07 17:15:32 +00:00
|
|
|
|
|
|
|
// This widget is the root of your application.
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2023-01-13 21:39:05 +00:00
|
|
|
const inputDecorationTheme = InputDecorationTheme(border: OutlineInputBorder(), focusColor: secondaryColor);
|
|
|
|
|
2023-01-07 17:15:32 +00:00
|
|
|
return MaterialApp(
|
2023-01-08 21:34:24 +00:00
|
|
|
title: 'Nextcloud Reminder',
|
2023-01-07 17:15:32 +00:00
|
|
|
theme: ThemeData(
|
2023-01-13 21:39:05 +00:00
|
|
|
brightness: Brightness.light,
|
|
|
|
colorScheme: ThemeData.light().colorScheme.copyWith(primary: primaryColor, secondary: secondaryColor, background: primaryColor.shade50),
|
|
|
|
inputDecorationTheme: inputDecorationTheme,
|
|
|
|
checkboxTheme: ThemeData.light().checkboxTheme.copyWith(
|
|
|
|
fillColor: MaterialStateProperty.resolveWith(getColor),
|
|
|
|
checkColor: MaterialStateProperty.resolveWith(getInteractColor(Colors.white,Colors.black))
|
|
|
|
),
|
|
|
|
),
|
|
|
|
darkTheme: ThemeData(
|
|
|
|
brightness: Brightness.dark,
|
|
|
|
colorScheme: ThemeData.dark().colorScheme.copyWith(primary: primaryColor, secondary: secondaryColor, background: primaryColor.shade500.withAlpha(32)),
|
|
|
|
inputDecorationTheme: inputDecorationTheme,
|
|
|
|
checkboxTheme: ThemeData.dark().checkboxTheme.copyWith(
|
|
|
|
fillColor: MaterialStateProperty.resolveWith(getColor),
|
|
|
|
checkColor: MaterialStateProperty.resolveWith(getInteractColor(Colors.white,Colors.black))
|
|
|
|
),
|
2023-01-07 17:15:32 +00:00
|
|
|
),
|
2023-01-13 21:39:05 +00:00
|
|
|
themeMode: ThemeMode.system,
|
2023-01-08 21:34:24 +00:00
|
|
|
home: const HomeWidget(title: 'todo.txt reminder'),
|
2023-01-07 17:15:32 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|