flutter_flow_theme.dart 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  1. // ignore_for_file: overridden_fields, annotate_overrides
  2. import 'package:flutter/material.dart';
  3. import 'package:google_fonts/google_fonts.dart';
  4. abstract class FlutterFlowTheme {
  5. static FlutterFlowTheme of(BuildContext context) {
  6. return LightModeTheme();
  7. }
  8. @Deprecated('Use primary instead')
  9. Color get primaryColor => primary;
  10. @Deprecated('Use secondary instead')
  11. Color get secondaryColor => secondary;
  12. @Deprecated('Use tertiary instead')
  13. Color get tertiaryColor => tertiary;
  14. late Color primary;
  15. late Color secondary;
  16. late Color tertiary;
  17. late Color alternate;
  18. late Color primaryText;
  19. late Color secondaryText;
  20. late Color primaryBackground;
  21. late Color secondaryBackground;
  22. late Color accent1;
  23. late Color accent2;
  24. late Color accent3;
  25. late Color accent4;
  26. late Color success;
  27. late Color warning;
  28. late Color error;
  29. late Color info;
  30. FFDesignTokens get designToken => FFDesignTokens(this);
  31. @Deprecated('Use displaySmallFamily instead')
  32. String get title1Family => displaySmallFamily;
  33. @Deprecated('Use displaySmall instead')
  34. TextStyle get title1 => typography.displaySmall;
  35. @Deprecated('Use headlineMediumFamily instead')
  36. String get title2Family => typography.headlineMediumFamily;
  37. @Deprecated('Use headlineMedium instead')
  38. TextStyle get title2 => typography.headlineMedium;
  39. @Deprecated('Use headlineSmallFamily instead')
  40. String get title3Family => typography.headlineSmallFamily;
  41. @Deprecated('Use headlineSmall instead')
  42. TextStyle get title3 => typography.headlineSmall;
  43. @Deprecated('Use titleMediumFamily instead')
  44. String get subtitle1Family => typography.titleMediumFamily;
  45. @Deprecated('Use titleMedium instead')
  46. TextStyle get subtitle1 => typography.titleMedium;
  47. @Deprecated('Use titleSmallFamily instead')
  48. String get subtitle2Family => typography.titleSmallFamily;
  49. @Deprecated('Use titleSmall instead')
  50. TextStyle get subtitle2 => typography.titleSmall;
  51. @Deprecated('Use bodyMediumFamily instead')
  52. String get bodyText1Family => typography.bodyMediumFamily;
  53. @Deprecated('Use bodyMedium instead')
  54. TextStyle get bodyText1 => typography.bodyMedium;
  55. @Deprecated('Use bodySmallFamily instead')
  56. String get bodyText2Family => typography.bodySmallFamily;
  57. @Deprecated('Use bodySmall instead')
  58. TextStyle get bodyText2 => typography.bodySmall;
  59. String get displayLargeFamily => typography.displayLargeFamily;
  60. bool get displayLargeIsCustom => typography.displayLargeIsCustom;
  61. TextStyle get displayLarge => typography.displayLarge;
  62. String get displayMediumFamily => typography.displayMediumFamily;
  63. bool get displayMediumIsCustom => typography.displayMediumIsCustom;
  64. TextStyle get displayMedium => typography.displayMedium;
  65. String get displaySmallFamily => typography.displaySmallFamily;
  66. bool get displaySmallIsCustom => typography.displaySmallIsCustom;
  67. TextStyle get displaySmall => typography.displaySmall;
  68. String get headlineLargeFamily => typography.headlineLargeFamily;
  69. bool get headlineLargeIsCustom => typography.headlineLargeIsCustom;
  70. TextStyle get headlineLarge => typography.headlineLarge;
  71. String get headlineMediumFamily => typography.headlineMediumFamily;
  72. bool get headlineMediumIsCustom => typography.headlineMediumIsCustom;
  73. TextStyle get headlineMedium => typography.headlineMedium;
  74. String get headlineSmallFamily => typography.headlineSmallFamily;
  75. bool get headlineSmallIsCustom => typography.headlineSmallIsCustom;
  76. TextStyle get headlineSmall => typography.headlineSmall;
  77. String get titleLargeFamily => typography.titleLargeFamily;
  78. bool get titleLargeIsCustom => typography.titleLargeIsCustom;
  79. TextStyle get titleLarge => typography.titleLarge;
  80. String get titleMediumFamily => typography.titleMediumFamily;
  81. bool get titleMediumIsCustom => typography.titleMediumIsCustom;
  82. TextStyle get titleMedium => typography.titleMedium;
  83. String get titleSmallFamily => typography.titleSmallFamily;
  84. bool get titleSmallIsCustom => typography.titleSmallIsCustom;
  85. TextStyle get titleSmall => typography.titleSmall;
  86. String get labelLargeFamily => typography.labelLargeFamily;
  87. bool get labelLargeIsCustom => typography.labelLargeIsCustom;
  88. TextStyle get labelLarge => typography.labelLarge;
  89. String get labelMediumFamily => typography.labelMediumFamily;
  90. bool get labelMediumIsCustom => typography.labelMediumIsCustom;
  91. TextStyle get labelMedium => typography.labelMedium;
  92. String get labelSmallFamily => typography.labelSmallFamily;
  93. bool get labelSmallIsCustom => typography.labelSmallIsCustom;
  94. TextStyle get labelSmall => typography.labelSmall;
  95. String get bodyLargeFamily => typography.bodyLargeFamily;
  96. bool get bodyLargeIsCustom => typography.bodyLargeIsCustom;
  97. TextStyle get bodyLarge => typography.bodyLarge;
  98. String get bodyMediumFamily => typography.bodyMediumFamily;
  99. bool get bodyMediumIsCustom => typography.bodyMediumIsCustom;
  100. TextStyle get bodyMedium => typography.bodyMedium;
  101. String get bodySmallFamily => typography.bodySmallFamily;
  102. bool get bodySmallIsCustom => typography.bodySmallIsCustom;
  103. TextStyle get bodySmall => typography.bodySmall;
  104. Typography get typography => ThemeTypography(this);
  105. }
  106. class LightModeTheme extends FlutterFlowTheme {
  107. @Deprecated('Use primary instead')
  108. Color get primaryColor => primary;
  109. @Deprecated('Use secondary instead')
  110. Color get secondaryColor => secondary;
  111. @Deprecated('Use tertiary instead')
  112. Color get tertiaryColor => tertiary;
  113. late Color primary = const Color(0xFF9A141D);
  114. late Color secondary = const Color(0xFFFF680D);
  115. late Color tertiary = const Color(0xFF09B34A);
  116. late Color alternate = const Color(0xFFEEEEEE);
  117. late Color primaryText = const Color(0xFF3E454C);
  118. late Color secondaryText = const Color(0xFF838A8F);
  119. late Color primaryBackground = const Color(0xFFF2F2F2);
  120. late Color secondaryBackground = const Color(0xFFFFFFFF);
  121. late Color accent1 = const Color(0x4C4B39EF);
  122. late Color accent2 = const Color(0x4D39D2C0);
  123. late Color accent3 = const Color(0x4DEE8B60);
  124. late Color accent4 = const Color(0xCCFFFFFF);
  125. late Color success = const Color(0xFF249689);
  126. late Color warning = const Color(0xFFF9CF58);
  127. late Color error = const Color(0xFFFF5963);
  128. late Color info = const Color(0xFFFFFFFF);
  129. }
  130. abstract class Typography {
  131. String get displayLargeFamily;
  132. bool get displayLargeIsCustom;
  133. TextStyle get displayLarge;
  134. String get displayMediumFamily;
  135. bool get displayMediumIsCustom;
  136. TextStyle get displayMedium;
  137. String get displaySmallFamily;
  138. bool get displaySmallIsCustom;
  139. TextStyle get displaySmall;
  140. String get headlineLargeFamily;
  141. bool get headlineLargeIsCustom;
  142. TextStyle get headlineLarge;
  143. String get headlineMediumFamily;
  144. bool get headlineMediumIsCustom;
  145. TextStyle get headlineMedium;
  146. String get headlineSmallFamily;
  147. bool get headlineSmallIsCustom;
  148. TextStyle get headlineSmall;
  149. String get titleLargeFamily;
  150. bool get titleLargeIsCustom;
  151. TextStyle get titleLarge;
  152. String get titleMediumFamily;
  153. bool get titleMediumIsCustom;
  154. TextStyle get titleMedium;
  155. String get titleSmallFamily;
  156. bool get titleSmallIsCustom;
  157. TextStyle get titleSmall;
  158. String get labelLargeFamily;
  159. bool get labelLargeIsCustom;
  160. TextStyle get labelLarge;
  161. String get labelMediumFamily;
  162. bool get labelMediumIsCustom;
  163. TextStyle get labelMedium;
  164. String get labelSmallFamily;
  165. bool get labelSmallIsCustom;
  166. TextStyle get labelSmall;
  167. String get bodyLargeFamily;
  168. bool get bodyLargeIsCustom;
  169. TextStyle get bodyLarge;
  170. String get bodyMediumFamily;
  171. bool get bodyMediumIsCustom;
  172. TextStyle get bodyMedium;
  173. String get bodySmallFamily;
  174. bool get bodySmallIsCustom;
  175. TextStyle get bodySmall;
  176. }
  177. class ThemeTypography extends Typography {
  178. ThemeTypography(this.theme);
  179. final FlutterFlowTheme theme;
  180. String get displayLargeFamily => 'Roboto';
  181. bool get displayLargeIsCustom => false;
  182. TextStyle get displayLarge => GoogleFonts.roboto(
  183. color: theme.primaryText,
  184. fontWeight: FontWeight.w600,
  185. fontSize: 64.0,
  186. );
  187. String get displayMediumFamily => 'Roboto';
  188. bool get displayMediumIsCustom => false;
  189. TextStyle get displayMedium => GoogleFonts.roboto(
  190. color: theme.primaryText,
  191. fontWeight: FontWeight.w600,
  192. fontSize: 44.0,
  193. );
  194. String get displaySmallFamily => 'Roboto';
  195. bool get displaySmallIsCustom => false;
  196. TextStyle get displaySmall => GoogleFonts.roboto(
  197. color: theme.primaryText,
  198. fontWeight: FontWeight.w600,
  199. fontSize: 36.0,
  200. );
  201. String get headlineLargeFamily => 'Roboto';
  202. bool get headlineLargeIsCustom => false;
  203. TextStyle get headlineLarge => GoogleFonts.roboto(
  204. color: theme.primaryText,
  205. fontWeight: FontWeight.w600,
  206. fontSize: 32.0,
  207. );
  208. String get headlineMediumFamily => 'Roboto';
  209. bool get headlineMediumIsCustom => false;
  210. TextStyle get headlineMedium => GoogleFonts.roboto(
  211. color: theme.primaryText,
  212. fontWeight: FontWeight.w600,
  213. fontSize: 28.0,
  214. );
  215. String get headlineSmallFamily => 'Roboto';
  216. bool get headlineSmallIsCustom => false;
  217. TextStyle get headlineSmall => GoogleFonts.roboto(
  218. color: theme.primaryText,
  219. fontWeight: FontWeight.w600,
  220. fontSize: 24.0,
  221. );
  222. String get titleLargeFamily => 'Roboto';
  223. bool get titleLargeIsCustom => false;
  224. TextStyle get titleLarge => GoogleFonts.roboto(
  225. color: theme.primaryText,
  226. fontWeight: FontWeight.w600,
  227. fontSize: 20.0,
  228. );
  229. String get titleMediumFamily => 'Roboto';
  230. bool get titleMediumIsCustom => false;
  231. TextStyle get titleMedium => GoogleFonts.roboto(
  232. color: theme.primaryText,
  233. fontWeight: FontWeight.w600,
  234. fontSize: 18.0,
  235. );
  236. String get titleSmallFamily => 'Roboto';
  237. bool get titleSmallIsCustom => false;
  238. TextStyle get titleSmall => GoogleFonts.roboto(
  239. color: theme.primaryText,
  240. fontWeight: FontWeight.w600,
  241. fontSize: 16.0,
  242. );
  243. String get labelLargeFamily => 'Roboto';
  244. bool get labelLargeIsCustom => false;
  245. TextStyle get labelLarge => GoogleFonts.roboto(
  246. color: theme.secondaryText,
  247. fontWeight: FontWeight.normal,
  248. fontSize: 16.0,
  249. );
  250. String get labelMediumFamily => 'Roboto';
  251. bool get labelMediumIsCustom => false;
  252. TextStyle get labelMedium => GoogleFonts.roboto(
  253. color: theme.secondaryText,
  254. fontWeight: FontWeight.normal,
  255. fontSize: 14.0,
  256. );
  257. String get labelSmallFamily => 'Roboto';
  258. bool get labelSmallIsCustom => false;
  259. TextStyle get labelSmall => GoogleFonts.roboto(
  260. color: theme.secondaryText,
  261. fontWeight: FontWeight.normal,
  262. fontSize: 12.0,
  263. );
  264. String get bodyLargeFamily => 'Roboto';
  265. bool get bodyLargeIsCustom => false;
  266. TextStyle get bodyLarge => GoogleFonts.roboto(
  267. color: theme.primaryText,
  268. fontWeight: FontWeight.normal,
  269. fontSize: 16.0,
  270. );
  271. String get bodyMediumFamily => 'Roboto';
  272. bool get bodyMediumIsCustom => false;
  273. TextStyle get bodyMedium => GoogleFonts.roboto(
  274. color: theme.primaryText,
  275. fontWeight: FontWeight.normal,
  276. fontSize: 14.0,
  277. );
  278. String get bodySmallFamily => 'Roboto';
  279. bool get bodySmallIsCustom => false;
  280. TextStyle get bodySmall => GoogleFonts.roboto(
  281. color: theme.primaryText,
  282. fontWeight: FontWeight.normal,
  283. fontSize: 12.0,
  284. );
  285. }
  286. class FFDesignTokens {
  287. const FFDesignTokens(this.theme);
  288. final FlutterFlowTheme theme;
  289. FFSpacing get spacing => const FFSpacing();
  290. FFRadius get radius => const FFRadius();
  291. FFShadows get shadow => FFShadows(theme);
  292. }
  293. class FFSpacing {
  294. const FFSpacing();
  295. double get xs => 4.0;
  296. double get sm => 8.0;
  297. double get md => 16.0;
  298. double get lg => 24.0;
  299. double get xl => 32.0;
  300. }
  301. class FFRadius {
  302. const FFRadius();
  303. double get sm => 8.0;
  304. double get md => 16.0;
  305. double get lg => 24.0;
  306. double get full => 9999.0;
  307. }
  308. class FFShadows {
  309. const FFShadows(this.theme);
  310. final FlutterFlowTheme theme;
  311. BoxShadow get sm => const BoxShadow(
  312. blurRadius: 3.0,
  313. color: const Color(0x1A000000),
  314. offset: const Offset(0.0, 1.0),
  315. spreadRadius: 0.0);
  316. BoxShadow get md => const BoxShadow(
  317. blurRadius: 6.0,
  318. color: const Color(0x1A000000),
  319. offset: const Offset(0.0, 3.0),
  320. spreadRadius: 0.0);
  321. BoxShadow get lg => const BoxShadow(
  322. blurRadius: 15.0,
  323. color: const Color(0x1A000000),
  324. offset: const Offset(0.0, 8.0),
  325. spreadRadius: 0.0);
  326. BoxShadow get xl => const BoxShadow(
  327. blurRadius: 25.0,
  328. color: const Color(0x1A000000),
  329. offset: const Offset(0.0, 16.0),
  330. spreadRadius: 0.0);
  331. }
  332. extension TextStyleHelper on TextStyle {
  333. TextStyle override({
  334. TextStyle? font,
  335. String? fontFamily,
  336. Color? color,
  337. double? fontSize,
  338. FontWeight? fontWeight,
  339. double? letterSpacing,
  340. FontStyle? fontStyle,
  341. bool useGoogleFonts = false,
  342. TextDecoration? decoration,
  343. double? lineHeight,
  344. List<Shadow>? shadows,
  345. String? package,
  346. }) {
  347. if (useGoogleFonts && fontFamily != null && fontFamily.isNotEmpty) {
  348. font = GoogleFonts.getFont(fontFamily,
  349. fontWeight: fontWeight ?? this.fontWeight,
  350. fontStyle: fontStyle ?? this.fontStyle);
  351. }
  352. return font != null
  353. ? font.copyWith(
  354. color: color ?? this.color,
  355. fontSize: fontSize ?? this.fontSize,
  356. letterSpacing: letterSpacing ?? this.letterSpacing,
  357. fontWeight: fontWeight ?? this.fontWeight,
  358. fontStyle: fontStyle ?? this.fontStyle,
  359. decoration: decoration,
  360. height: lineHeight,
  361. shadows: shadows,
  362. )
  363. : copyWith(
  364. fontFamily: fontFamily,
  365. package: package,
  366. color: color,
  367. fontSize: fontSize,
  368. letterSpacing: letterSpacing,
  369. fontWeight: fontWeight,
  370. fontStyle: fontStyle,
  371. decoration: decoration,
  372. height: lineHeight,
  373. shadows: shadows,
  374. );
  375. }
  376. }