2024-11-18 15:19:07 +01:00
|
|
|
import 'package:ambito/src/packages/ambito_notifier/notifier/theme_manager.dart';
|
2024-11-07 05:52:03 +01:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:google_fonts/google_fonts.dart';
|
2024-11-18 09:15:00 +01:00
|
|
|
import 'package:screen_breakpoints/screen_breakpoints.dart';
|
|
|
|
|
|
|
|
import '../../../main.dart';
|
2024-11-07 05:52:03 +01:00
|
|
|
|
2024-11-09 22:03:03 +01:00
|
|
|
final orangeColors = {
|
|
|
|
'primary': const Color(0xffeebb4b),
|
|
|
|
'secondary': const Color(0xfff8e0aa),
|
|
|
|
'tertiary': const Color(0xfff3b25c),
|
|
|
|
'quarternary': const Color(0xffec863a),
|
|
|
|
};
|
|
|
|
|
|
|
|
final redColors = {
|
|
|
|
'primary': const Color(0xff96172f),
|
|
|
|
'secondary': const Color(0xffca414c),
|
|
|
|
'tertiary': const Color(0xffa83745),
|
|
|
|
'quarternary': const Color(0xff883443),
|
|
|
|
};
|
|
|
|
|
|
|
|
final greenColors = {
|
|
|
|
'primary': const Color(0xff88a44e),
|
|
|
|
'secondary': const Color(0xffd5d808),
|
|
|
|
'tertiary': const Color(0xffacc11e),
|
|
|
|
'quarternary': const Color(0xff3d693f),
|
|
|
|
};
|
|
|
|
|
2024-11-07 05:52:03 +01:00
|
|
|
final actionGroupColors = {
|
|
|
|
'Bauelemente': const Color(0xffFFD269).withOpacity(.4),
|
|
|
|
'Begrünung': const Color(0xff40DD74).withOpacity(.4),
|
|
|
|
'Bewirtschaftung': const Color(0xffBF72ED).withOpacity(.4),
|
|
|
|
'Nisthilfe': const Color(0xffDAE3FD).withOpacity(.4),
|
|
|
|
'Pflanzung': const Color(0xff40D6E9).withOpacity(.4),
|
|
|
|
'Sondermaßnahmen': const Color(0xff689EF1).withOpacity(.4),
|
|
|
|
};
|
|
|
|
|
|
|
|
final actionAreaColors = {
|
2024-11-09 22:03:03 +01:00
|
|
|
'Landschaft': const Color(0xffeebb4b).withOpacity(.3),
|
|
|
|
'Weinberg': const Color(0xff88a44e).withOpacity(.3),
|
|
|
|
'Betriebsfläche': const Color(0xff96172f).withOpacity(.3),
|
2024-11-07 05:52:03 +01:00
|
|
|
'Betriebsstätte': const Color(0xffCCCDCC).withOpacity(.6),
|
|
|
|
};
|
|
|
|
|
|
|
|
final actionAreaFGColors = {
|
|
|
|
'Landschaft': const Color(0xffec863a),
|
|
|
|
'Weinberg': const Color(0xff3d693f),
|
|
|
|
'Betriebsfläche': const Color(0xff883443),
|
|
|
|
'Betriebsstätte': const Color(0xff999999),
|
|
|
|
};
|
|
|
|
|
2024-11-18 09:15:00 +01:00
|
|
|
AmbitoTheme getTheme(BuildContext context) {
|
|
|
|
var breakpoint = context.breakpoint;
|
|
|
|
if (breakpoint >= myBreakpoints.lg) {
|
2024-11-18 15:19:07 +01:00
|
|
|
ThemeManager().setTheme(largeTheme);
|
2024-11-18 09:15:00 +01:00
|
|
|
return largeTheme;
|
|
|
|
}
|
|
|
|
if (breakpoint >= myBreakpoints.sm) {
|
2024-11-18 15:19:07 +01:00
|
|
|
ThemeManager().setTheme(smallTheme);
|
2024-11-18 09:15:00 +01:00
|
|
|
return mediumTheme;
|
|
|
|
}
|
2024-11-18 15:19:07 +01:00
|
|
|
ThemeManager().setTheme(mediumTheme);
|
2024-11-18 09:15:00 +01:00
|
|
|
return smallTheme;
|
|
|
|
}
|
|
|
|
|
|
|
|
abstract class AmbitoTheme {
|
2024-11-07 05:52:03 +01:00
|
|
|
static ThemeMode appThemeMode = ThemeMode.light;
|
|
|
|
|
|
|
|
ColorScheme get lightColorScheme => const ColorScheme(
|
|
|
|
brightness: Brightness.light,
|
|
|
|
primary: Color(0xFF60845E),
|
|
|
|
onPrimary: Color(0xFFFFFFFF),
|
|
|
|
primaryContainer: Color(0xFFDCE3C9),
|
|
|
|
onPrimaryContainer: Color(0xFF001E2D),
|
2024-11-19 17:02:35 +01:00
|
|
|
secondary: Color(0xff87A34E),
|
2024-11-07 05:52:03 +01:00
|
|
|
onSecondary: Color(0xFFFFFFFF),
|
|
|
|
secondaryContainer: Color(0xFFD2E5F4),
|
|
|
|
onSecondaryContainer: Color(0xFF0A1D28),
|
|
|
|
tertiary: Color(0xFFD9D9D9),
|
|
|
|
onTertiary: Color(0xFFFFFFFF),
|
|
|
|
tertiaryContainer: Color(0xFFB8F483),
|
|
|
|
onTertiaryContainer: Color(0xFF0D2000),
|
|
|
|
error: Color(0xFFBA1A1A),
|
|
|
|
errorContainer: Color(0xFFFFDAD6),
|
|
|
|
onError: Color(0xFFFFFFFF),
|
|
|
|
onErrorContainer: Color(0xFF410002),
|
|
|
|
surface: Color(0xFFffffff),
|
2024-11-09 22:03:03 +01:00
|
|
|
onSurface: Color(0xFF666666),
|
2024-11-07 05:52:03 +01:00
|
|
|
surfaceContainerHighest: Color(0xFFDDE3EA),
|
|
|
|
onSurfaceVariant: Color(0xFF41484D),
|
|
|
|
outline: Color(0xFF71787E),
|
|
|
|
onInverseSurface: Color(0xFFF0F1F3),
|
|
|
|
inverseSurface: Color(0xFF2E3133),
|
|
|
|
inversePrimary: Color(0xFF82CFFF),
|
|
|
|
shadow: Color(0xFF000000),
|
|
|
|
surfaceTint: Color(0xFF00658D),
|
|
|
|
outlineVariant: Color(0xFFC1C7CE),
|
|
|
|
scrim: Color(0xFF000000),
|
|
|
|
);
|
|
|
|
|
|
|
|
ColorScheme get darkColorScheme => const ColorScheme(
|
|
|
|
brightness: Brightness.dark,
|
|
|
|
primary: Color(0xFF82CFFF),
|
|
|
|
onPrimary: Color(0xFF00344B),
|
|
|
|
primaryContainer: Color(0xFF004C6B),
|
|
|
|
onPrimaryContainer: Color(0xFFC6E7FF),
|
|
|
|
secondary: Color(0xFFB6C9D8),
|
|
|
|
onSecondary: Color(0xFF21323E),
|
|
|
|
secondaryContainer: Color(0xFF374955),
|
|
|
|
onSecondaryContainer: Color(0xFFD2E5F4),
|
|
|
|
tertiary: Color(0xFF9DD76A),
|
|
|
|
onTertiary: Color(0xFF1A3700),
|
|
|
|
tertiaryContainer: Color(0xFF285000),
|
|
|
|
onTertiaryContainer: Color(0xFFB8F483),
|
|
|
|
error: Color(0xFFFFB4AB),
|
|
|
|
errorContainer: Color(0xFF93000A),
|
|
|
|
onError: Color(0xFF690005),
|
|
|
|
onErrorContainer: Color(0xFFFFDAD6),
|
|
|
|
surface: Color(0xFF191C1E),
|
|
|
|
onSurface: Color(0xFFE2E2E5),
|
|
|
|
surfaceContainerHighest: Color(0xFF41484D),
|
|
|
|
onSurfaceVariant: Color(0xFFC1C7CE),
|
|
|
|
outline: Color(0xFF8B9198),
|
|
|
|
onInverseSurface: Color(0xFF191C1E),
|
|
|
|
inverseSurface: Color(0xFFE2E2E5),
|
|
|
|
inversePrimary: Color(0xFF00658D),
|
|
|
|
shadow: Color(0xFF000000),
|
|
|
|
surfaceTint: Color(0xFF82CFFF),
|
|
|
|
outlineVariant: Color(0xFF41484D),
|
|
|
|
scrim: Color(0xFF000000),
|
|
|
|
);
|
|
|
|
|
|
|
|
TextStyle get defaultFont => GoogleFonts.roboto();
|
|
|
|
TextStyle get displayLarge => textTheme.displayLarge!;
|
|
|
|
TextStyle get displayMedium => textTheme.displayMedium!;
|
|
|
|
TextStyle get displaySmall => textTheme.displaySmall!;
|
|
|
|
TextStyle get headlineLarge => textTheme.headlineLarge!;
|
|
|
|
TextStyle get headlineMedium => textTheme.headlineMedium!;
|
|
|
|
TextStyle get headlineSmall => textTheme.headlineSmall!;
|
|
|
|
TextStyle get titleLarge => textTheme.titleLarge!;
|
|
|
|
TextStyle get titleMedium => textTheme.titleMedium!;
|
|
|
|
TextStyle get titleSmall => textTheme.titleSmall!;
|
|
|
|
TextStyle get labelLarge => textTheme.labelLarge!;
|
|
|
|
TextStyle get labelMedium => textTheme.labelMedium!;
|
|
|
|
TextStyle get labelSmall => textTheme.labelSmall!;
|
|
|
|
TextStyle get bodyLarge => textTheme.bodyLarge!;
|
|
|
|
TextStyle get bodyMedium => textTheme.bodyMedium!;
|
|
|
|
TextStyle get bodySmall => textTheme.bodySmall!;
|
|
|
|
|
|
|
|
TextTheme get textTheme => TextTheme(
|
|
|
|
displayLarge: GoogleFonts.openSans(
|
|
|
|
fontSize: 57,
|
|
|
|
height: 1.12,
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
letterSpacing: -.25),
|
|
|
|
displayMedium: GoogleFonts.openSans(
|
|
|
|
fontSize: 45,
|
|
|
|
height: 1.15,
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
letterSpacing: 0,
|
|
|
|
),
|
|
|
|
displaySmall: GoogleFonts.openSans(
|
|
|
|
fontSize: 36,
|
|
|
|
height: 1.22,
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
letterSpacing: 0,
|
|
|
|
),
|
|
|
|
headlineLarge: GoogleFonts.openSans(
|
|
|
|
fontSize: 44,
|
|
|
|
height: 1.25,
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
letterSpacing: 0,
|
|
|
|
),
|
|
|
|
headlineMedium: GoogleFonts.openSans(
|
|
|
|
fontSize: 28,
|
|
|
|
height: 1.29,
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
letterSpacing: 0,
|
|
|
|
),
|
|
|
|
headlineSmall: GoogleFonts.openSans(
|
|
|
|
fontSize: 24,
|
|
|
|
height: 1.33,
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
letterSpacing: 0,
|
|
|
|
),
|
|
|
|
titleLarge: GoogleFonts.openSans(
|
|
|
|
fontSize: 22,
|
|
|
|
height: 1.27,
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
letterSpacing: 0,
|
|
|
|
),
|
|
|
|
titleMedium: GoogleFonts.openSans(
|
|
|
|
fontSize: 16,
|
|
|
|
height: 1.5,
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
letterSpacing: 0.15,
|
|
|
|
),
|
|
|
|
titleSmall: GoogleFonts.openSans(
|
|
|
|
fontSize: 14,
|
|
|
|
height: 1.42,
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
letterSpacing: 0.1,
|
|
|
|
),
|
|
|
|
labelLarge: GoogleFonts.openSans(
|
|
|
|
fontSize: 14,
|
|
|
|
height: 1.42,
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
letterSpacing: 0.1,
|
|
|
|
),
|
|
|
|
labelMedium: GoogleFonts.openSans(
|
|
|
|
fontSize: 12,
|
|
|
|
height: 1.33,
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
letterSpacing: 0.15,
|
|
|
|
),
|
|
|
|
labelSmall: GoogleFonts.openSans(
|
|
|
|
fontSize: 11,
|
|
|
|
height: 1.45,
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
letterSpacing: 0.1,
|
|
|
|
),
|
|
|
|
bodyLarge: GoogleFonts.openSans(
|
|
|
|
fontSize: 16,
|
|
|
|
height: 1.5,
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
letterSpacing: 0.5,
|
|
|
|
),
|
|
|
|
bodyMedium: GoogleFonts.openSans(
|
|
|
|
fontSize: 14,
|
|
|
|
height: 1.42,
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
letterSpacing: 0.25,
|
|
|
|
),
|
|
|
|
bodySmall: GoogleFonts.openSans(
|
|
|
|
fontSize: 12,
|
|
|
|
height: 1.33,
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
letterSpacing: 0.4,
|
|
|
|
),
|
|
|
|
);
|
|
|
|
|
2024-11-09 22:03:03 +01:00
|
|
|
EdgeInsets get padding => const EdgeInsets.all(20);
|
|
|
|
EdgeInsets get paddingSmall => const EdgeInsets.all(10);
|
2024-11-07 05:52:03 +01:00
|
|
|
Widget get horizontalSpacer => const SizedBox(
|
2024-11-09 22:03:03 +01:00
|
|
|
width: 20,
|
|
|
|
);
|
|
|
|
Widget get horizontalSpacerMax => const SizedBox(
|
|
|
|
width: 40,
|
2024-11-07 05:52:03 +01:00
|
|
|
);
|
|
|
|
Widget get horizontalSpacerSmall => const SizedBox(
|
2024-11-09 22:03:03 +01:00
|
|
|
width: 10,
|
2024-11-07 05:52:03 +01:00
|
|
|
);
|
|
|
|
Widget get verticalSpacer => const SizedBox(
|
2024-11-09 22:03:03 +01:00
|
|
|
height: 20,
|
2024-11-07 05:52:03 +01:00
|
|
|
);
|
|
|
|
Widget get verticalSpacerSmall => const SizedBox(
|
2024-11-09 22:03:03 +01:00
|
|
|
height: 10,
|
2024-11-07 05:52:03 +01:00
|
|
|
);
|
|
|
|
Widget get verticalSpacerMax => const SizedBox(
|
2024-11-09 22:03:03 +01:00
|
|
|
height: 40,
|
2024-11-07 05:52:03 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
ThemeData get darkThemeData => ThemeData(
|
|
|
|
useMaterial3: true, colorScheme: darkColorScheme, textTheme: textTheme);
|
|
|
|
|
|
|
|
ThemeData get lightThemeData => ThemeData(
|
|
|
|
useMaterial3: true, colorScheme: lightColorScheme, textTheme: textTheme);
|
|
|
|
ThemeData get currentThemeData =>
|
|
|
|
(AmbitoTheme.appThemeMode == ThemeMode.light)
|
|
|
|
? lightThemeData
|
|
|
|
: darkThemeData;
|
|
|
|
|
|
|
|
ThemeMode get mode => AmbitoTheme.appThemeMode;
|
|
|
|
|
|
|
|
ColorScheme get currentColorScheme =>
|
|
|
|
(AmbitoTheme.appThemeMode == ThemeMode.light)
|
|
|
|
? lightColorScheme
|
|
|
|
: darkColorScheme;
|
|
|
|
}
|