theme.dart 777 B

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