theme.dart 831 B

123456789101112131415161718192021222324252627282930
  1. import 'package:flowy_infra/colorscheme/colorscheme.dart';
  2. import 'package:flutter/material.dart';
  3. class BuiltInTheme {
  4. static const String defaultTheme = 'Default';
  5. static const String dandelion = 'Dandelion';
  6. static const String lavender = 'Lavender';
  7. }
  8. class AppTheme {
  9. // metadata member
  10. final String themeName;
  11. final FlowyColorScheme lightTheme;
  12. final FlowyColorScheme darkTheme;
  13. // static final Map<String, dynamic> _cachedJsonData = {};
  14. const AppTheme({
  15. required this.themeName,
  16. required this.lightTheme,
  17. required this.darkTheme,
  18. });
  19. factory AppTheme.fromName(String themeName) {
  20. return AppTheme(
  21. themeName: themeName,
  22. lightTheme: FlowyColorScheme.builtIn(themeName, Brightness.light),
  23. darkTheme: FlowyColorScheme.builtIn(themeName, Brightness.dark),
  24. );
  25. }
  26. }