2022-09-26 13:51:18 +02:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
2022-10-26 14:26:09 +02:00
|
|
|
import 'package:adguard_home_manager/constants/adguard_green_color.dart';
|
2022-09-26 13:51:18 +02:00
|
|
|
|
|
|
|
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,
|
2022-09-26 13:51:18 +02:00
|
|
|
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(
|
|
|
|
indicatorColor: dynamicColorScheme != null ? dynamicColorScheme.primaryContainer : adguardGreenColor,
|
|
|
|
),
|
2022-09-26 13:51:18 +02:00
|
|
|
floatingActionButtonTheme: FloatingActionButtonThemeData(
|
|
|
|
foregroundColor: Colors.white,
|
2022-10-26 14:26:09 +02:00
|
|
|
backgroundColor: dynamicColorScheme != null ? dynamicColorScheme.primary : adguardGreenColor
|
2022-09-26 13:51:18 +02:00
|
|
|
),
|
|
|
|
textButtonTheme: TextButtonThemeData(
|
|
|
|
style: ButtonStyle(
|
|
|
|
foregroundColor: MaterialStateProperty.all(
|
2022-10-26 14:26:09 +02:00
|
|
|
dynamicColorScheme != null ? dynamicColorScheme.primary : adguardGreenColor
|
2022-09-26 13:51:18 +02:00
|
|
|
),
|
|
|
|
overlayColor: MaterialStateProperty.all(
|
2022-10-26 14:26:09 +02:00
|
|
|
dynamicColorScheme != null ? dynamicColorScheme.primary.withOpacity(0.1) : adguardGreenColor.withOpacity(0.1)
|
2022-09-26 13:51:18 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
dividerColor: Colors.black12,
|
|
|
|
listTileTheme: const ListTileThemeData(
|
2022-10-21 11:26:14 +02:00
|
|
|
tileColor: Colors.transparent,
|
|
|
|
iconColor: Color.fromRGBO(138, 138, 138, 1),
|
2022-09-26 13:51:18 +02:00
|
|
|
),
|
|
|
|
checkboxTheme: CheckboxThemeData(
|
|
|
|
checkColor: MaterialStateProperty.all(Colors.white),
|
|
|
|
fillColor: MaterialStateProperty.all(
|
2022-10-26 14:26:09 +02:00
|
|
|
dynamicColorScheme != null ? dynamicColorScheme.primary : adguardGreenColor
|
2022-09-26 13:51:18 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
tabBarTheme: TabBarTheme(
|
|
|
|
unselectedLabelColor: Colors.black,
|
2022-10-26 14:26:09 +02:00
|
|
|
labelColor: dynamicColorScheme != null ? dynamicColorScheme.primary : adguardGreenColor,
|
2022-09-26 13:51:18 +02:00
|
|
|
indicator: UnderlineTabIndicator(
|
|
|
|
borderSide: BorderSide(
|
2022-10-26 14:26:09 +02:00
|
|
|
color: dynamicColorScheme != null ? dynamicColorScheme.primary : adguardGreenColor,
|
2022-09-26 13:51:18 +02:00
|
|
|
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
|
|
|
),
|
|
|
|
),
|
2022-09-26 13:51:18 +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(
|
2022-09-26 13:51:18 +02:00
|
|
|
brightness: Brightness.dark
|
|
|
|
),
|
2022-10-26 14:26:09 +02:00
|
|
|
primaryColor: dynamicColorScheme != null ? dynamicColorScheme.primary : adguardGreenColor,
|
2022-09-26 13:51:18 +02:00
|
|
|
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-10-26 14:45:02 +02:00
|
|
|
indicatorColor: dynamicColorScheme != null ? dynamicColorScheme.primaryContainer : adguardGreenColor,
|
2022-09-26 13:51:18 +02:00
|
|
|
),
|
|
|
|
snackBarTheme: SnackBarThemeData(
|
|
|
|
contentTextStyle: const TextStyle(
|
|
|
|
color: Colors.white
|
|
|
|
),
|
|
|
|
behavior: SnackBarBehavior.floating,
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
borderRadius: BorderRadius.circular(5)
|
|
|
|
),
|
|
|
|
elevation: 4,
|
|
|
|
),
|
|
|
|
floatingActionButtonTheme: FloatingActionButtonThemeData(
|
|
|
|
foregroundColor: Colors.white,
|
2022-10-26 14:26:09 +02:00
|
|
|
backgroundColor: dynamicColorScheme != null ? dynamicColorScheme.primary : adguardGreenColor
|
2022-09-26 13:51:18 +02:00
|
|
|
),
|
|
|
|
textButtonTheme: TextButtonThemeData(
|
|
|
|
style: ButtonStyle(
|
|
|
|
foregroundColor: MaterialStateProperty.all(
|
2022-10-26 14:26:09 +02:00
|
|
|
dynamicColorScheme != null ? dynamicColorScheme.primary : adguardGreenColor
|
2022-09-26 13:51:18 +02:00
|
|
|
),
|
|
|
|
overlayColor: MaterialStateProperty.all(
|
2022-10-26 14:26:09 +02:00
|
|
|
dynamicColorScheme != null ? dynamicColorScheme.primary.withOpacity(0.1) : adguardGreenColor.withOpacity(0.1)
|
2022-09-26 13:51:18 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
brightness: Brightness.dark,
|
|
|
|
textTheme: const TextTheme(
|
|
|
|
bodyText1: TextStyle(
|
|
|
|
color: Colors.white70
|
|
|
|
),
|
|
|
|
bodyText2: TextStyle(
|
|
|
|
color: Colors.white
|
|
|
|
),
|
|
|
|
),
|
|
|
|
dividerColor: Colors.white12,
|
2022-10-21 11:26:14 +02:00
|
|
|
listTileTheme: const ListTileThemeData(
|
|
|
|
tileColor: Colors.transparent,
|
|
|
|
iconColor: Color.fromRGBO(187, 187, 187, 1),
|
2022-09-26 13:51:18 +02:00
|
|
|
),
|
|
|
|
checkboxTheme: CheckboxThemeData(
|
|
|
|
checkColor: MaterialStateProperty.all(Colors.white),
|
|
|
|
fillColor: MaterialStateProperty.all(
|
2022-10-26 14:26:09 +02:00
|
|
|
dynamicColorScheme != null ? dynamicColorScheme.primary : adguardGreenColor
|
2022-09-26 13:51:18 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
tabBarTheme: TabBarTheme(
|
|
|
|
unselectedLabelColor: Colors.white,
|
2022-10-26 14:26:09 +02:00
|
|
|
labelColor: dynamicColorScheme != null ? dynamicColorScheme.primary : adguardGreenColor,
|
2022-09-26 13:51:18 +02:00
|
|
|
indicator: UnderlineTabIndicator(
|
|
|
|
borderSide: BorderSide(
|
2022-10-26 14:26:09 +02:00
|
|
|
color: dynamicColorScheme != null ? dynamicColorScheme.primary : adguardGreenColor,
|
2022-09-26 13:51:18 +02:00
|
|
|
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
|
|
|
),
|
|
|
|
),
|
2022-09-26 13:51:18 +02:00
|
|
|
androidOverscrollIndicator: AndroidOverscrollIndicator.stretch
|
|
|
|
);
|
|
|
|
|
2022-10-26 14:26:09 +02:00
|
|
|
ThemeData lightThemeOldVersions(MaterialColor primaryColor) => ThemeData(
|
2022-09-26 13:51:18 +02:00
|
|
|
useMaterial3: true,
|
2022-09-28 02:51:55 +02:00
|
|
|
primaryColor: primaryColor,
|
|
|
|
appBarTheme: AppBarTheme(
|
2022-09-26 13:51:18 +02:00
|
|
|
color: Colors.white,
|
|
|
|
foregroundColor: Colors.black,
|
2022-09-28 02:51:55 +02:00
|
|
|
elevation: 0,
|
|
|
|
surfaceTintColor: primaryColor
|
2022-09-26 13:51:18 +02:00
|
|
|
),
|
|
|
|
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
|
|
|
|
),
|
|
|
|
),
|
2022-09-28 02:51:55 +02:00
|
|
|
floatingActionButtonTheme: FloatingActionButtonThemeData(
|
2022-09-26 13:51:18 +02:00
|
|
|
foregroundColor: Colors.white,
|
2022-09-28 02:51:55 +02:00
|
|
|
backgroundColor: primaryColor
|
2022-09-26 13:51:18 +02:00
|
|
|
),
|
|
|
|
textButtonTheme: TextButtonThemeData(
|
|
|
|
style: ButtonStyle(
|
2022-09-28 02:51:55 +02:00
|
|
|
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-09-28 02:51:55 +02:00
|
|
|
navigationBarTheme: NavigationBarThemeData(
|
|
|
|
surfaceTintColor: primaryColor,
|
|
|
|
indicatorColor: primaryColor
|
|
|
|
),
|
|
|
|
inputDecorationTheme: InputDecorationTheme(
|
|
|
|
floatingLabelStyle: TextStyle(
|
|
|
|
color: primaryColor
|
2022-09-26 13:51:18 +02:00
|
|
|
),
|
2022-09-28 02:51:55 +02:00
|
|
|
iconColor: Colors.grey,
|
|
|
|
focusedBorder: OutlineInputBorder(
|
|
|
|
borderRadius: BorderRadius.circular(10),
|
|
|
|
borderSide: BorderSide(
|
|
|
|
color: primaryColor,
|
|
|
|
width: 2
|
|
|
|
)
|
|
|
|
)
|
|
|
|
),
|
|
|
|
textSelectionTheme: TextSelectionThemeData(
|
|
|
|
cursorColor: primaryColor
|
2022-09-26 13:51:18 +02:00
|
|
|
),
|
|
|
|
dividerColor: Colors.black12,
|
|
|
|
listTileTheme: const ListTileThemeData(
|
2022-10-21 11:26:14 +02:00
|
|
|
tileColor: Colors.transparent,
|
|
|
|
iconColor: Color.fromRGBO(138, 138, 138, 1),
|
2022-09-26 13:51:18 +02:00
|
|
|
),
|
|
|
|
checkboxTheme: CheckboxThemeData(
|
|
|
|
checkColor: MaterialStateProperty.all(Colors.white),
|
2022-09-28 02:51:55 +02:00
|
|
|
fillColor: MaterialStateProperty.all(primaryColor),
|
2022-09-26 13:51:18 +02:00
|
|
|
),
|
2022-09-28 02:51:55 +02:00
|
|
|
tabBarTheme: TabBarTheme(
|
2022-09-26 13:51:18 +02:00
|
|
|
unselectedLabelColor: Colors.black,
|
2022-09-28 02:51:55 +02:00
|
|
|
labelColor: primaryColor,
|
2022-09-26 13:51:18 +02:00
|
|
|
indicator: UnderlineTabIndicator(
|
|
|
|
borderSide: BorderSide(
|
2022-09-28 02:51:55 +02:00
|
|
|
color: primaryColor,
|
2022-09-26 13:51:18 +02:00
|
|
|
width: 2
|
|
|
|
)
|
|
|
|
)
|
|
|
|
),
|
2022-09-28 02:51:55 +02:00
|
|
|
progressIndicatorTheme: ProgressIndicatorThemeData(
|
|
|
|
color: primaryColor
|
|
|
|
),
|
|
|
|
indicatorColor: primaryColor,
|
2022-10-02 05:32:24 +02:00
|
|
|
radioTheme: RadioThemeData(
|
|
|
|
fillColor: MaterialStateProperty.all(primaryColor),
|
|
|
|
),
|
2022-09-26 13:51:18 +02:00
|
|
|
androidOverscrollIndicator: AndroidOverscrollIndicator.stretch,
|
|
|
|
);
|
|
|
|
|
2022-10-26 14:26:09 +02:00
|
|
|
ThemeData darkThemeOldVersions(MaterialColor primaryColor) => ThemeData(
|
2022-09-26 13:51:18 +02:00
|
|
|
useMaterial3: true,
|
2022-09-28 02:51:55 +02:00
|
|
|
primaryColor: primaryColor,
|
2022-09-26 13:51:18 +02:00
|
|
|
scaffoldBackgroundColor: const Color.fromRGBO(18, 18, 18, 1),
|
2022-09-28 02:51:55 +02:00
|
|
|
navigationBarTheme: NavigationBarThemeData(
|
|
|
|
indicatorColor: primaryColor,
|
|
|
|
surfaceTintColor: primaryColor
|
2022-09-26 13:51:18 +02:00
|
|
|
),
|
|
|
|
dialogTheme: DialogTheme(
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
borderRadius: BorderRadius.circular(30)
|
|
|
|
)
|
|
|
|
),
|
2022-09-28 02:51:55 +02:00
|
|
|
appBarTheme: AppBarTheme(
|
2022-10-26 14:26:09 +02:00
|
|
|
color: Color.fromRGBO(18, 18, 18, 1),
|
2022-09-26 13:51:18 +02:00
|
|
|
foregroundColor: Colors.white,
|
2022-09-28 02:51:55 +02:00
|
|
|
elevation: 0,
|
|
|
|
surfaceTintColor: primaryColor
|
2022-09-26 13:51:18 +02:00
|
|
|
),
|
|
|
|
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,
|
|
|
|
),
|
2022-09-28 02:51:55 +02:00
|
|
|
floatingActionButtonTheme: FloatingActionButtonThemeData(
|
2022-09-26 13:51:18 +02:00
|
|
|
foregroundColor: Colors.white,
|
2022-09-28 02:51:55 +02:00
|
|
|
backgroundColor: primaryColor
|
2022-09-26 13:51:18 +02:00
|
|
|
),
|
|
|
|
textButtonTheme: TextButtonThemeData(
|
|
|
|
style: ButtonStyle(
|
2022-09-28 02:51:55 +02:00
|
|
|
foregroundColor: MaterialStateProperty.all(primaryColor),
|
|
|
|
overlayColor: MaterialStateProperty.all(primaryColor.withOpacity(0.1))
|
2022-09-26 13:51:18 +02:00
|
|
|
),
|
|
|
|
),
|
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-09-28 02:51:55 +02:00
|
|
|
inputDecorationTheme: InputDecorationTheme(
|
|
|
|
floatingLabelStyle: TextStyle(
|
|
|
|
color: primaryColor
|
|
|
|
),
|
|
|
|
iconColor: Colors.grey,
|
|
|
|
focusedBorder: OutlineInputBorder(
|
|
|
|
borderRadius: BorderRadius.circular(10),
|
|
|
|
borderSide: BorderSide(
|
|
|
|
color: primaryColor,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
),
|
|
|
|
textSelectionTheme: TextSelectionThemeData(
|
|
|
|
cursorColor: primaryColor
|
|
|
|
),
|
2022-09-26 13:51:18 +02:00
|
|
|
brightness: Brightness.dark,
|
|
|
|
textTheme: const TextTheme(
|
|
|
|
bodyText1: TextStyle(
|
|
|
|
color: Colors.white70
|
|
|
|
),
|
|
|
|
bodyText2: TextStyle(
|
|
|
|
color: Colors.white
|
|
|
|
),
|
|
|
|
),
|
|
|
|
dividerColor: Colors.white12,
|
2022-10-21 11:26:14 +02:00
|
|
|
listTileTheme: const ListTileThemeData(
|
|
|
|
tileColor: Colors.transparent,
|
|
|
|
iconColor: Color.fromRGBO(187, 187, 187, 1),
|
2022-09-26 13:51:18 +02:00
|
|
|
),
|
|
|
|
checkboxTheme: CheckboxThemeData(
|
|
|
|
checkColor: MaterialStateProperty.all(Colors.white),
|
|
|
|
fillColor: MaterialStateProperty.all(Colors.blue),
|
|
|
|
),
|
2022-09-28 02:51:55 +02:00
|
|
|
tabBarTheme: TabBarTheme(
|
2022-09-26 13:51:18 +02:00
|
|
|
unselectedLabelColor: Colors.white,
|
2022-09-28 02:51:55 +02:00
|
|
|
labelColor: primaryColor,
|
2022-09-26 13:51:18 +02:00
|
|
|
indicator: UnderlineTabIndicator(
|
|
|
|
borderSide: BorderSide(
|
2022-09-28 02:51:55 +02:00
|
|
|
color: primaryColor,
|
2022-09-26 13:51:18 +02:00
|
|
|
width: 2
|
|
|
|
)
|
|
|
|
)
|
|
|
|
),
|
2022-09-28 02:51:55 +02:00
|
|
|
progressIndicatorTheme: ProgressIndicatorThemeData(
|
|
|
|
color: primaryColor
|
|
|
|
),
|
|
|
|
indicatorColor: primaryColor,
|
2022-10-02 05:32:24 +02:00
|
|
|
radioTheme: RadioThemeData(
|
|
|
|
fillColor: MaterialStateProperty.all(primaryColor),
|
|
|
|
),
|
2022-09-26 13:51:18 +02:00
|
|
|
androidOverscrollIndicator: AndroidOverscrollIndicator.stretch
|
|
|
|
);
|