2022-12-18 16:02:18 +08:00
|
|
|
import 'package:flowy_infra/colorscheme/colorscheme.dart';
|
2021-06-19 23:41:19 +08:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
2022-12-30 09:14:17 +05:30
|
|
|
class BuiltInTheme {
|
|
|
|
static const String light = 'light';
|
|
|
|
static const String dandelion = 'dandelion';
|
2023-02-12 18:19:02 -08:00
|
|
|
static const String lavender = 'lavender';
|
2022-12-30 09:14:17 +05:30
|
|
|
}
|
2021-12-24 20:20:48 +02:00
|
|
|
|
2021-06-19 23:41:19 +08:00
|
|
|
class AppTheme {
|
2022-12-18 16:02:18 +08:00
|
|
|
// metadata member
|
2022-12-30 09:14:17 +05:30
|
|
|
final String themeName;
|
2022-12-18 16:02:18 +08:00
|
|
|
final FlowyColorScheme lightTheme;
|
|
|
|
final FlowyColorScheme darkTheme;
|
|
|
|
// static final Map<String, dynamic> _cachedJsonData = {};
|
|
|
|
|
|
|
|
const AppTheme({
|
2022-12-30 09:14:17 +05:30
|
|
|
required this.themeName,
|
2022-12-18 16:02:18 +08:00
|
|
|
required this.lightTheme,
|
|
|
|
required this.darkTheme,
|
|
|
|
});
|
|
|
|
|
2022-12-30 09:14:17 +05:30
|
|
|
factory AppTheme.fromName(String themeName) {
|
2022-12-18 16:02:18 +08:00
|
|
|
return AppTheme(
|
2022-12-30 09:14:17 +05:30
|
|
|
themeName: themeName,
|
2022-12-18 16:02:18 +08:00
|
|
|
lightTheme: FlowyColorScheme.builtIn(themeName, Brightness.light),
|
|
|
|
darkTheme: FlowyColorScheme.builtIn(themeName, Brightness.dark),
|
2022-02-01 11:29:11 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|