immich_app_theme.dart 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. import 'package:flutter/material.dart';
  2. import 'package:hooks_riverpod/hooks_riverpod.dart';
  3. import 'package:immich_mobile/constants/immich_colors.dart';
  4. import 'package:immich_mobile/modules/settings/providers/app_settings.provider.dart';
  5. import 'package:immich_mobile/modules/settings/services/app_settings.service.dart';
  6. final immichThemeProvider = StateProvider<ThemeMode>((ref) {
  7. var themeMode = ref
  8. .watch(appSettingsServiceProvider)
  9. .getSetting(AppSettingsEnum.themeMode);
  10. debugPrint("Current themeMode $themeMode");
  11. if (themeMode == "light") {
  12. return ThemeMode.light;
  13. } else if (themeMode == "dark") {
  14. return ThemeMode.dark;
  15. } else {
  16. return ThemeMode.system;
  17. }
  18. });
  19. final ThemeData base = ThemeData(
  20. chipTheme: const ChipThemeData(
  21. side: BorderSide.none,
  22. ),
  23. sliderTheme: const SliderThemeData(
  24. thumbShape: RoundSliderThumbShape(enabledThumbRadius: 7),
  25. trackHeight: 2.0,
  26. ),
  27. );
  28. final ThemeData immichLightTheme = ThemeData(
  29. useMaterial3: true,
  30. brightness: Brightness.light,
  31. primarySwatch: Colors.indigo,
  32. primaryColor: Colors.indigo,
  33. hintColor: Colors.indigo,
  34. focusColor: Colors.indigo,
  35. splashColor: Colors.indigo.withOpacity(0.15),
  36. fontFamily: 'Overpass',
  37. scaffoldBackgroundColor: immichBackgroundColor,
  38. snackBarTheme: const SnackBarThemeData(
  39. contentTextStyle: TextStyle(
  40. fontFamily: 'Overpass',
  41. color: Colors.indigo,
  42. fontWeight: FontWeight.bold,
  43. ),
  44. backgroundColor: Colors.white,
  45. ),
  46. appBarTheme: const AppBarTheme(
  47. titleTextStyle: TextStyle(
  48. fontFamily: 'Overpass',
  49. color: Colors.indigo,
  50. fontWeight: FontWeight.bold,
  51. fontSize: 18,
  52. ),
  53. backgroundColor: immichBackgroundColor,
  54. foregroundColor: Colors.indigo,
  55. elevation: 0,
  56. scrolledUnderElevation: 0,
  57. centerTitle: true,
  58. ),
  59. bottomNavigationBarTheme: const BottomNavigationBarThemeData(
  60. type: BottomNavigationBarType.fixed,
  61. backgroundColor: immichBackgroundColor,
  62. selectedItemColor: Colors.indigo,
  63. ),
  64. cardTheme: const CardTheme(
  65. surfaceTintColor: Colors.transparent,
  66. ),
  67. drawerTheme: const DrawerThemeData(
  68. backgroundColor: immichBackgroundColor,
  69. ),
  70. textTheme: const TextTheme(
  71. displayLarge: TextStyle(
  72. fontSize: 26,
  73. fontWeight: FontWeight.bold,
  74. color: Colors.indigo,
  75. ),
  76. displayMedium: TextStyle(
  77. fontSize: 14,
  78. fontWeight: FontWeight.bold,
  79. color: Colors.black87,
  80. ),
  81. displaySmall: TextStyle(
  82. fontSize: 12,
  83. fontWeight: FontWeight.bold,
  84. color: Colors.indigo,
  85. ),
  86. titleSmall: TextStyle(
  87. fontSize: 16.0,
  88. fontWeight: FontWeight.bold,
  89. ),
  90. titleMedium: TextStyle(
  91. fontSize: 18.0,
  92. fontWeight: FontWeight.bold,
  93. ),
  94. titleLarge: TextStyle(
  95. fontSize: 26.0,
  96. fontWeight: FontWeight.bold,
  97. ),
  98. ),
  99. elevatedButtonTheme: ElevatedButtonThemeData(
  100. style: ElevatedButton.styleFrom(
  101. backgroundColor: Colors.indigo,
  102. foregroundColor: Colors.white,
  103. ),
  104. ),
  105. chipTheme: base.chipTheme,
  106. sliderTheme: base.sliderTheme,
  107. popupMenuTheme: const PopupMenuThemeData(
  108. shape: RoundedRectangleBorder(
  109. borderRadius: BorderRadius.all(Radius.circular(10)),
  110. ),
  111. surfaceTintColor: Colors.transparent,
  112. color: Colors.white,
  113. ),
  114. navigationBarTheme: NavigationBarThemeData(
  115. indicatorColor: Colors.indigo.withOpacity(0.15),
  116. iconTheme: MaterialStatePropertyAll(
  117. IconThemeData(color: Colors.grey[700]),
  118. ),
  119. backgroundColor: immichBackgroundColor,
  120. surfaceTintColor: Colors.transparent,
  121. labelTextStyle: MaterialStatePropertyAll(
  122. TextStyle(
  123. fontSize: 13,
  124. fontWeight: FontWeight.w500,
  125. color: Colors.grey[800],
  126. ),
  127. ),
  128. ),
  129. dialogTheme: const DialogTheme(
  130. surfaceTintColor: Colors.transparent,
  131. ),
  132. inputDecorationTheme: const InputDecorationTheme(
  133. focusedBorder: OutlineInputBorder(
  134. borderSide: BorderSide(
  135. color: Colors.indigo,
  136. ),
  137. ),
  138. labelStyle: TextStyle(
  139. color: Colors.indigo,
  140. ),
  141. hintStyle: TextStyle(
  142. fontSize: 14.0,
  143. fontWeight: FontWeight.normal,
  144. ),
  145. ),
  146. textSelectionTheme: const TextSelectionThemeData(
  147. cursorColor: Colors.indigo,
  148. ),
  149. );
  150. final ThemeData immichDarkTheme = ThemeData(
  151. useMaterial3: true,
  152. brightness: Brightness.dark,
  153. primarySwatch: Colors.indigo,
  154. primaryColor: immichDarkThemePrimaryColor,
  155. scaffoldBackgroundColor: immichDarkBackgroundColor,
  156. hintColor: Colors.grey[600],
  157. fontFamily: 'Overpass',
  158. snackBarTheme: SnackBarThemeData(
  159. contentTextStyle: const TextStyle(
  160. fontFamily: 'Overpass',
  161. color: immichDarkThemePrimaryColor,
  162. fontWeight: FontWeight.bold,
  163. ),
  164. backgroundColor: Colors.grey[900],
  165. ),
  166. textButtonTheme: TextButtonThemeData(
  167. style: TextButton.styleFrom(
  168. foregroundColor: immichDarkThemePrimaryColor,
  169. ),
  170. ),
  171. appBarTheme: const AppBarTheme(
  172. titleTextStyle: TextStyle(
  173. fontFamily: 'Overpass',
  174. color: immichDarkThemePrimaryColor,
  175. fontWeight: FontWeight.bold,
  176. fontSize: 18,
  177. ),
  178. backgroundColor: Color.fromARGB(255, 32, 33, 35),
  179. foregroundColor: immichDarkThemePrimaryColor,
  180. elevation: 0,
  181. scrolledUnderElevation: 0,
  182. centerTitle: true,
  183. ),
  184. bottomNavigationBarTheme: const BottomNavigationBarThemeData(
  185. type: BottomNavigationBarType.fixed,
  186. backgroundColor: Color.fromARGB(255, 35, 36, 37),
  187. selectedItemColor: immichDarkThemePrimaryColor,
  188. ),
  189. drawerTheme: DrawerThemeData(
  190. backgroundColor: immichDarkBackgroundColor,
  191. scrimColor: Colors.white.withOpacity(0.1),
  192. ),
  193. textTheme: const TextTheme(
  194. displayLarge: TextStyle(
  195. fontSize: 26,
  196. fontWeight: FontWeight.bold,
  197. color: Color.fromARGB(255, 255, 255, 255),
  198. ),
  199. displayMedium: TextStyle(
  200. fontSize: 14,
  201. fontWeight: FontWeight.bold,
  202. color: Color.fromARGB(255, 255, 255, 255),
  203. ),
  204. displaySmall: TextStyle(
  205. fontSize: 12,
  206. fontWeight: FontWeight.bold,
  207. color: immichDarkThemePrimaryColor,
  208. ),
  209. titleSmall: TextStyle(
  210. fontSize: 16.0,
  211. fontWeight: FontWeight.bold,
  212. ),
  213. titleMedium: TextStyle(
  214. fontSize: 18.0,
  215. fontWeight: FontWeight.bold,
  216. ),
  217. titleLarge: TextStyle(
  218. fontSize: 26.0,
  219. fontWeight: FontWeight.bold,
  220. ),
  221. ),
  222. cardColor: Colors.grey[900],
  223. elevatedButtonTheme: ElevatedButtonThemeData(
  224. style: ElevatedButton.styleFrom(
  225. foregroundColor: Colors.black87,
  226. backgroundColor: immichDarkThemePrimaryColor,
  227. ),
  228. ),
  229. chipTheme: base.chipTheme,
  230. sliderTheme: base.sliderTheme,
  231. popupMenuTheme: const PopupMenuThemeData(
  232. shape: RoundedRectangleBorder(
  233. borderRadius: BorderRadius.all(Radius.circular(10)),
  234. ),
  235. surfaceTintColor: Colors.transparent,
  236. ),
  237. navigationBarTheme: NavigationBarThemeData(
  238. indicatorColor: immichDarkThemePrimaryColor.withOpacity(0.4),
  239. iconTheme: MaterialStatePropertyAll(
  240. IconThemeData(color: Colors.grey[500]),
  241. ),
  242. backgroundColor: Colors.grey[900],
  243. surfaceTintColor: Colors.transparent,
  244. labelTextStyle: MaterialStatePropertyAll(
  245. TextStyle(
  246. fontSize: 13,
  247. fontWeight: FontWeight.w500,
  248. color: Colors.grey[300],
  249. ),
  250. ),
  251. ),
  252. dialogTheme: const DialogTheme(
  253. surfaceTintColor: Colors.transparent,
  254. ),
  255. inputDecorationTheme: const InputDecorationTheme(
  256. focusedBorder: OutlineInputBorder(
  257. borderSide: BorderSide(
  258. color: immichDarkThemePrimaryColor,
  259. ),
  260. ),
  261. labelStyle: TextStyle(
  262. color: immichDarkThemePrimaryColor,
  263. ),
  264. hintStyle: TextStyle(
  265. fontSize: 14.0,
  266. fontWeight: FontWeight.normal,
  267. ),
  268. ),
  269. textSelectionTheme: const TextSelectionThemeData(
  270. cursorColor: immichDarkThemePrimaryColor,
  271. ),
  272. );