67 lines
2.4 KiB
Dart
67 lines
2.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:intl/date_symbol_data_local.dart';
|
|
import 'package:intl/intl_standalone.dart';
|
|
import 'package:nextcloud_reminder/homescreen.dart';
|
|
|
|
|
|
void main() {
|
|
findSystemLocale().then((value) =>
|
|
initializeDateFormatting(value).then((_) =>
|
|
runApp(const TodoTxtReminderApp())
|
|
));
|
|
}
|
|
|
|
class TodoTxtReminderApp extends StatelessWidget {
|
|
const TodoTxtReminderApp({super.key});
|
|
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);
|
|
}
|
|
|
|
// This widget is the root of your application.
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
const inputDecorationTheme = InputDecorationTheme(border: OutlineInputBorder(), focusColor: secondaryColor);
|
|
|
|
return MaterialApp(
|
|
title: 'Nextcloud Reminder',
|
|
theme: ThemeData(
|
|
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))
|
|
),
|
|
),
|
|
themeMode: ThemeMode.system,
|
|
home: const HomeWidget(title: 'todo.txt reminder'),
|
|
);
|
|
}
|
|
}
|