adguard-home-manager/lib/config/theme.dart

359 lines
12 KiB
Dart
Raw Normal View History

import 'package:flutter/material.dart';
2022-10-26 14:26:09 +02:00
import 'package:adguard_home_manager/constants/adguard_green_color.dart';
ThemeData lightTheme(ColorScheme? dynamicColorScheme) => ThemeData(
useMaterial3: true,
2022-10-26 14:26:09 +02:00
colorScheme: dynamicColorScheme ?? ColorScheme.fromSwatch(primarySwatch: adguardGreenColor),
primaryColor: dynamicColorScheme != null ? dynamicColorScheme.primary : adguardGreenColor,
scaffoldBackgroundColor: dynamicColorScheme != null ? dynamicColorScheme.background : Colors.white,
snackBarTheme: SnackBarThemeData(
behavior: SnackBarBehavior.floating,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5)
),
elevation: 4,
),
brightness: Brightness.light,
dialogBackgroundColor: dynamicColorScheme != null ? dynamicColorScheme.surface : Colors.white,
textTheme: const TextTheme(
bodyText1: TextStyle(
color: Colors.black54
),
bodyText2: TextStyle(
color: Colors.black
),
),
2022-10-26 14:45:02 +02:00
navigationBarTheme: NavigationBarThemeData(
2022-11-04 22:56:00 +01:00
indicatorColor: dynamicColorScheme != null ? dynamicColorScheme.secondaryContainer : adguardGreenColor,
iconTheme: MaterialStateProperty.all(
IconThemeData(
color: dynamicColorScheme != null ? dynamicColorScheme.onSecondaryContainer : adguardGreenColor,
)
)
2022-10-26 14:45:02 +02:00
),
floatingActionButtonTheme: FloatingActionButtonThemeData(
2022-11-05 02:35:35 +01:00
foregroundColor: dynamicColorScheme != null ? dynamicColorScheme.onPrimaryContainer : Colors.white,
backgroundColor: dynamicColorScheme != null ? dynamicColorScheme.primaryContainer : adguardGreenColor
),
textButtonTheme: TextButtonThemeData(
style: ButtonStyle(
foregroundColor: MaterialStateProperty.all(
2022-10-26 14:26:09 +02:00
dynamicColorScheme != null ? dynamicColorScheme.primary : adguardGreenColor
),
overlayColor: MaterialStateProperty.all(
2022-10-26 14:26:09 +02:00
dynamicColorScheme != null ? dynamicColorScheme.primary.withOpacity(0.1) : adguardGreenColor.withOpacity(0.1)
),
),
),
dividerColor: Colors.black12,
2022-11-05 02:35:35 +01:00
listTileTheme: ListTileThemeData(
tileColor: Colors.transparent,
2022-11-05 02:35:35 +01:00
textColor: dynamicColorScheme != null ? dynamicColorScheme.onSurfaceVariant : const Color.fromRGBO(117, 117, 117, 1),
iconColor: dynamicColorScheme != null ? dynamicColorScheme.onSurfaceVariant : const Color.fromRGBO(117, 117, 117, 1),
),
checkboxTheme: CheckboxThemeData(
checkColor: MaterialStateProperty.all(Colors.white),
fillColor: MaterialStateProperty.all(
2022-10-26 14:26:09 +02:00
dynamicColorScheme != null ? dynamicColorScheme.primary : adguardGreenColor
),
),
tabBarTheme: TabBarTheme(
unselectedLabelColor: Colors.black,
2022-10-26 14:26:09 +02:00
labelColor: dynamicColorScheme != null ? dynamicColorScheme.primary : adguardGreenColor,
indicator: UnderlineTabIndicator(
borderSide: BorderSide(
2022-10-26 14:26:09 +02:00
color: dynamicColorScheme != null ? dynamicColorScheme.primary : adguardGreenColor,
width: 2
)
)
),
2022-10-02 05:32:24 +02:00
radioTheme: RadioThemeData(
fillColor: MaterialStateProperty.all(
2022-10-26 14:26:09 +02:00
dynamicColorScheme != null ? dynamicColorScheme.primary : adguardGreenColor
2022-10-02 05:32:24 +02:00
),
),
androidOverscrollIndicator: AndroidOverscrollIndicator.stretch,
);
ThemeData darkTheme(ColorScheme? dynamicColorScheme) => ThemeData(
useMaterial3: true,
2022-10-26 14:26:09 +02:00
colorScheme: dynamicColorScheme ?? ColorScheme.fromSwatch(primarySwatch: adguardGreenColor).copyWith(
brightness: Brightness.dark
),
2022-10-26 14:26:09 +02:00
primaryColor: dynamicColorScheme != null ? dynamicColorScheme.primary : adguardGreenColor,
scaffoldBackgroundColor: dynamicColorScheme != null ? dynamicColorScheme.background :const Color.fromRGBO(18, 18, 18, 1),
dialogBackgroundColor: dynamicColorScheme != null ? dynamicColorScheme.background : const Color.fromRGBO(44, 44, 44, 1),
navigationBarTheme: NavigationBarThemeData(
2022-11-04 22:56:00 +01:00
indicatorColor: dynamicColorScheme != null ? dynamicColorScheme.secondaryContainer : adguardGreenColor,
iconTheme: MaterialStateProperty.all(
IconThemeData(
color: dynamicColorScheme != null ? dynamicColorScheme.onSecondaryContainer : adguardGreenColor,
)
)
),
snackBarTheme: SnackBarThemeData(
contentTextStyle: const TextStyle(
color: Colors.white
),
behavior: SnackBarBehavior.floating,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5)
),
elevation: 4,
),
floatingActionButtonTheme: FloatingActionButtonThemeData(
2022-11-05 02:35:35 +01:00
foregroundColor: dynamicColorScheme != null ? dynamicColorScheme.onPrimaryContainer : Colors.white,
backgroundColor: dynamicColorScheme != null ? dynamicColorScheme.primaryContainer : adguardGreenColor
),
textButtonTheme: TextButtonThemeData(
style: ButtonStyle(
foregroundColor: MaterialStateProperty.all(
2022-10-26 14:26:09 +02:00
dynamicColorScheme != null ? dynamicColorScheme.primary : adguardGreenColor
),
overlayColor: MaterialStateProperty.all(
2022-10-26 14:26:09 +02:00
dynamicColorScheme != null ? dynamicColorScheme.primary.withOpacity(0.1) : adguardGreenColor.withOpacity(0.1)
),
),
),
brightness: Brightness.dark,
textTheme: const TextTheme(
bodyText1: TextStyle(
color: Colors.white70
),
bodyText2: TextStyle(
color: Colors.white
),
),
dividerColor: Colors.white12,
2022-11-05 02:35:35 +01:00
listTileTheme: ListTileThemeData(
tileColor: Colors.transparent,
2022-11-05 02:35:35 +01:00
textColor: dynamicColorScheme != null ? dynamicColorScheme.onSurfaceVariant : const Color.fromRGBO(187, 187, 187, 1),
iconColor: dynamicColorScheme != null ? dynamicColorScheme.onSurfaceVariant : const Color.fromRGBO(187, 187, 187, 1),
),
checkboxTheme: CheckboxThemeData(
2022-11-05 02:35:35 +01:00
checkColor: MaterialStateProperty.all(
dynamicColorScheme != null ? dynamicColorScheme.onPrimary : Colors.white
),
fillColor: MaterialStateProperty.all(
2022-11-05 02:35:35 +01:00
dynamicColorScheme != null ? dynamicColorScheme.onSurface : adguardGreenColor
),
),
tabBarTheme: TabBarTheme(
unselectedLabelColor: Colors.white,
2022-10-26 14:26:09 +02:00
labelColor: dynamicColorScheme != null ? dynamicColorScheme.primary : adguardGreenColor,
indicator: UnderlineTabIndicator(
borderSide: BorderSide(
2022-10-26 14:26:09 +02:00
color: dynamicColorScheme != null ? dynamicColorScheme.primary : adguardGreenColor,
width: 2
)
)
),
2022-10-02 05:32:24 +02:00
radioTheme: RadioThemeData(
fillColor: MaterialStateProperty.all(
2022-10-26 14:26:09 +02:00
dynamicColorScheme != null ? dynamicColorScheme.primary : adguardGreenColor
2022-10-02 05:32:24 +02:00
),
),
androidOverscrollIndicator: AndroidOverscrollIndicator.stretch
);
2022-10-26 14:26:09 +02:00
ThemeData lightThemeOldVersions(MaterialColor primaryColor) => ThemeData(
useMaterial3: true,
primaryColor: primaryColor,
appBarTheme: AppBarTheme(
color: Colors.white,
foregroundColor: Colors.black,
elevation: 0,
surfaceTintColor: primaryColor
),
snackBarTheme: SnackBarThemeData(
behavior: SnackBarBehavior.floating,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5)
),
elevation: 4,
),
brightness: Brightness.light,
scaffoldBackgroundColor: Colors.white,
dialogBackgroundColor: Colors.white,
textTheme: const TextTheme(
bodyText1: TextStyle(
color: Colors.black54
),
bodyText2: TextStyle(
color: Colors.black
),
),
floatingActionButtonTheme: FloatingActionButtonThemeData(
foregroundColor: Colors.white,
backgroundColor: primaryColor
),
textButtonTheme: TextButtonThemeData(
style: ButtonStyle(
foregroundColor: MaterialStateProperty.all(primaryColor),
overlayColor: MaterialStateProperty.all(primaryColor.withOpacity(0.1))
),
),
2022-10-10 02:08:21 +02:00
elevatedButtonTheme: ElevatedButtonThemeData(
style: ButtonStyle(
foregroundColor: MaterialStateProperty.all(primaryColor),
surfaceTintColor: MaterialStateProperty.all(primaryColor),
overlayColor: MaterialStateProperty.all(primaryColor.shade50),
)
),
2022-11-05 02:35:35 +01:00
cardTheme: CardTheme(
surfaceTintColor: primaryColor
),
navigationBarTheme: NavigationBarThemeData(
surfaceTintColor: primaryColor,
indicatorColor: primaryColor
),
inputDecorationTheme: InputDecorationTheme(
floatingLabelStyle: TextStyle(
color: primaryColor
),
iconColor: Colors.grey,
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: BorderSide(
color: primaryColor,
width: 2
)
)
),
textSelectionTheme: TextSelectionThemeData(
cursorColor: primaryColor
),
dividerColor: Colors.black12,
listTileTheme: const ListTileThemeData(
tileColor: Colors.transparent,
2022-11-05 02:35:35 +01:00
textColor: Color.fromRGBO(117, 117, 117, 1),
iconColor: Color.fromRGBO(117, 117, 117, 1),
),
checkboxTheme: CheckboxThemeData(
checkColor: MaterialStateProperty.all(Colors.white),
2022-11-05 02:35:35 +01:00
fillColor: MaterialStateProperty.all(primaryColor),
),
tabBarTheme: TabBarTheme(
unselectedLabelColor: Colors.black,
labelColor: primaryColor,
indicator: UnderlineTabIndicator(
borderSide: BorderSide(
color: primaryColor,
width: 2
)
)
),
progressIndicatorTheme: ProgressIndicatorThemeData(
color: primaryColor
),
indicatorColor: primaryColor,
2022-10-02 05:32:24 +02:00
radioTheme: RadioThemeData(
fillColor: MaterialStateProperty.all(primaryColor),
),
androidOverscrollIndicator: AndroidOverscrollIndicator.stretch,
);
2022-10-26 14:26:09 +02:00
ThemeData darkThemeOldVersions(MaterialColor primaryColor) => ThemeData(
useMaterial3: true,
primaryColor: primaryColor,
scaffoldBackgroundColor: const Color.fromRGBO(18, 18, 18, 1),
navigationBarTheme: NavigationBarThemeData(
indicatorColor: primaryColor,
surfaceTintColor: primaryColor
),
dialogTheme: DialogTheme(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30)
)
),
appBarTheme: AppBarTheme(
2022-11-05 02:35:35 +01:00
color: const Color.fromRGBO(18, 18, 18, 1),
foregroundColor: Colors.white,
elevation: 0,
surfaceTintColor: primaryColor
),
dialogBackgroundColor: const Color.fromRGBO(44, 44, 44, 1),
snackBarTheme: SnackBarThemeData(
contentTextStyle: const TextStyle(
color: Colors.white
),
behavior: SnackBarBehavior.floating,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5)
),
elevation: 4,
),
floatingActionButtonTheme: FloatingActionButtonThemeData(
foregroundColor: Colors.white,
backgroundColor: primaryColor
),
textButtonTheme: TextButtonThemeData(
style: ButtonStyle(
foregroundColor: MaterialStateProperty.all(primaryColor),
overlayColor: MaterialStateProperty.all(primaryColor.withOpacity(0.1))
),
),
2022-10-10 02:08:21 +02:00
elevatedButtonTheme: ElevatedButtonThemeData(
style: ButtonStyle(
foregroundColor: MaterialStateProperty.all(primaryColor),
surfaceTintColor: MaterialStateProperty.all(primaryColor),
overlayColor: MaterialStateProperty.all(primaryColor.shade50),
)
),
2022-11-05 02:35:35 +01:00
cardTheme: CardTheme(
surfaceTintColor: primaryColor
),
inputDecorationTheme: InputDecorationTheme(
floatingLabelStyle: TextStyle(
color: primaryColor
),
iconColor: Colors.grey,
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: BorderSide(
color: primaryColor,
)
)
),
2022-11-05 02:35:35 +01:00
checkboxTheme: CheckboxThemeData(
checkColor: MaterialStateProperty.all(Colors.white),
fillColor: MaterialStateProperty.all(primaryColor),
),
listTileTheme: const ListTileThemeData(
tileColor: Colors.transparent,
textColor: Color.fromRGBO(187, 187, 187, 1),
iconColor: Color.fromRGBO(187, 187, 187, 1),
),
textSelectionTheme: TextSelectionThemeData(
cursorColor: primaryColor
),
brightness: Brightness.dark,
textTheme: const TextTheme(
bodyText1: TextStyle(
color: Colors.white70
),
bodyText2: TextStyle(
color: Colors.white
),
),
dividerColor: Colors.white12,
tabBarTheme: TabBarTheme(
unselectedLabelColor: Colors.white,
labelColor: primaryColor,
indicator: UnderlineTabIndicator(
borderSide: BorderSide(
color: primaryColor,
width: 2
)
)
),
progressIndicatorTheme: ProgressIndicatorThemeData(
color: primaryColor
),
indicatorColor: primaryColor,
2022-10-02 05:32:24 +02:00
radioTheme: RadioThemeData(
fillColor: MaterialStateProperty.all(primaryColor),
),
androidOverscrollIndicator: AndroidOverscrollIndicator.stretch
);