feat: implement theme customizer

This commit is contained in:
Lucas.Xu 2022-09-15 21:27:49 +08:00
commit a908340e8b

View file

@ -0,0 +1,257 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'intl/messages_all.dart';
// **************************************************************************
// Generator: Flutter Intl IDE plugin
// Made by Localizely
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, lines_longer_than_80_chars
// ignore_for_file: join_return_with_assignment, prefer_final_in_for_each
// ignore_for_file: avoid_redundant_argument_values, avoid_escaping_inner_quotes
class AppFlowyEditorLocalizations {
AppFlowyEditorLocalizations();
static AppFlowyEditorLocalizations? _current;
static AppFlowyEditorLocalizations get current {
assert(_current != null,
'No instance of AppFlowyEditorLocalizations was loaded. Try to initialize the AppFlowyEditorLocalizations delegate before accessing AppFlowyEditorLocalizations.current.');
return _current!;
}
static const AppLocalizationDelegate delegate = AppLocalizationDelegate();
static Future<AppFlowyEditorLocalizations> load(Locale locale) {
final name = (locale.countryCode?.isEmpty ?? false)
? locale.languageCode
: locale.toString();
final localeName = Intl.canonicalizedLocale(name);
return initializeMessages(localeName).then((_) {
Intl.defaultLocale = localeName;
final instance = AppFlowyEditorLocalizations();
AppFlowyEditorLocalizations._current = instance;
return instance;
});
}
static AppFlowyEditorLocalizations of(BuildContext context) {
final instance = AppFlowyEditorLocalizations.maybeOf(context);
assert(instance != null,
'No instance of AppFlowyEditorLocalizations present in the widget tree. Did you add AppFlowyEditorLocalizations.delegate in localizationsDelegates?');
return instance!;
}
static AppFlowyEditorLocalizations? maybeOf(BuildContext context) {
return Localizations.of<AppFlowyEditorLocalizations>(
context, AppFlowyEditorLocalizations);
}
/// `Bold`
String get bold {
return Intl.message(
'Bold',
name: 'bold',
desc: '',
args: [],
);
}
/// `Bulleted List`
String get bulletedList {
return Intl.message(
'Bulleted List',
name: 'bulletedList',
desc: '',
args: [],
);
}
/// `Checkbox`
String get checkbox {
return Intl.message(
'Checkbox',
name: 'checkbox',
desc: '',
args: [],
);
}
/// `Embed Code`
String get embedCode {
return Intl.message(
'Embed Code',
name: 'embedCode',
desc: '',
args: [],
);
}
/// `H1`
String get heading1 {
return Intl.message(
'H1',
name: 'heading1',
desc: '',
args: [],
);
}
/// `H2`
String get heading2 {
return Intl.message(
'H2',
name: 'heading2',
desc: '',
args: [],
);
}
/// `H3`
String get heading3 {
return Intl.message(
'H3',
name: 'heading3',
desc: '',
args: [],
);
}
/// `Highlight`
String get highlight {
return Intl.message(
'Highlight',
name: 'highlight',
desc: '',
args: [],
);
}
/// `Image`
String get image {
return Intl.message(
'Image',
name: 'image',
desc: '',
args: [],
);
}
/// `Italic`
String get italic {
return Intl.message(
'Italic',
name: 'italic',
desc: '',
args: [],
);
}
/// `Link`
String get link {
return Intl.message(
'Link',
name: 'link',
desc: '',
args: [],
);
}
/// `Numbered List`
String get numberedList {
return Intl.message(
'Numbered List',
name: 'numberedList',
desc: '',
args: [],
);
}
/// `Quote`
String get quote {
return Intl.message(
'Quote',
name: 'quote',
desc: '',
args: [],
);
}
/// `Strikethrough`
String get strikethrough {
return Intl.message(
'Strikethrough',
name: 'strikethrough',
desc: '',
args: [],
);
}
/// `Text`
String get text {
return Intl.message(
'Text',
name: 'text',
desc: '',
args: [],
);
}
/// `Underline`
String get underline {
return Intl.message(
'Underline',
name: 'underline',
desc: '',
args: [],
);
}
}
class AppLocalizationDelegate
extends LocalizationsDelegate<AppFlowyEditorLocalizations> {
const AppLocalizationDelegate();
List<Locale> get supportedLocales {
return const <Locale>[
Locale.fromSubtags(languageCode: 'en'),
Locale.fromSubtags(languageCode: 'ca'),
Locale.fromSubtags(languageCode: 'de', countryCode: 'DE'),
Locale.fromSubtags(languageCode: 'es', countryCode: 'VE'),
Locale.fromSubtags(languageCode: 'fr', countryCode: 'CA'),
Locale.fromSubtags(languageCode: 'fr', countryCode: 'FR'),
Locale.fromSubtags(languageCode: 'hu', countryCode: 'HU'),
Locale.fromSubtags(languageCode: 'id', countryCode: 'ID'),
Locale.fromSubtags(languageCode: 'it', countryCode: 'IT'),
Locale.fromSubtags(languageCode: 'ja', countryCode: 'JP'),
Locale.fromSubtags(languageCode: 'pl', countryCode: 'PL'),
Locale.fromSubtags(languageCode: 'pt', countryCode: 'BR'),
Locale.fromSubtags(languageCode: 'pt', countryCode: 'PT'),
Locale.fromSubtags(languageCode: 'ru', countryCode: 'RU'),
Locale.fromSubtags(languageCode: 'tr', countryCode: 'TR'),
Locale.fromSubtags(languageCode: 'zh', countryCode: 'CN'),
Locale.fromSubtags(languageCode: 'zh', countryCode: 'TW'),
];
}
@override
bool isSupported(Locale locale) => _isSupported(locale);
@override
Future<AppFlowyEditorLocalizations> load(Locale locale) =>
AppFlowyEditorLocalizations.load(locale);
@override
bool shouldReload(AppLocalizationDelegate old) => false;
bool _isSupported(Locale locale) {
for (var supportedLocale in supportedLocales) {
if (supportedLocale.languageCode == locale.languageCode) {
return true;
}
}
return false;
}
}