feat: dynamic fetch google fonts

This commit is contained in:
Rongjian Zhang 2022-10-02 03:50:37 +08:00
parent 9e2850558d
commit 0e952a6ef7
21 changed files with 3 additions and 13 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -6,7 +6,6 @@ import 'package:git_touch/models/code.dart';
import 'package:git_touch/models/notification.dart'; import 'package:git_touch/models/notification.dart';
import 'package:git_touch/models/theme.dart'; import 'package:git_touch/models/theme.dart';
import 'package:git_touch/utils/utils.dart'; import 'package:git_touch/utils/utils.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:sentry_flutter/sentry_flutter.dart'; import 'package:sentry_flutter/sentry_flutter.dart';
@ -18,8 +17,6 @@ void main() async {
}, },
// Init your App. // Init your App.
appRunner: () async { appRunner: () async {
GoogleFonts.config.allowRuntimeFetching = false;
final notificationModel = NotificationModel(); final notificationModel = NotificationModel();
final themeModel = ThemeModel(); final themeModel = ThemeModel();
final authModel = AuthModel(); final authModel = AuthModel();

View File

@ -8,21 +8,15 @@ import 'package:shared_preferences/shared_preferences.dart';
class CodeModel with ChangeNotifier { class CodeModel with ChangeNotifier {
static var themes = themeMap.keys.toList(); static var themes = themeMap.keys.toList();
static const fontSizes = [12, 13, 14, 15, 16, 17, 18, 19, 20]; static const fontSizes = [12, 13, 14, 15, 16, 17, 18, 19, 20];
static const fontFamilies = [ static final fontFamilies = [
'System', 'System',
'JetBrains Mono', ...GoogleFonts.asMap().keys,
'Fira Code',
'Inconsolata',
'PT Mono',
'Source Code Pro',
'Ubuntu Mono',
// 'Cascadia Code', // TODO: https://github.com/google/fonts/issues/2179
]; ];
String _theme = 'vs'; String _theme = 'vs';
String _themeDark = 'vs2015'; String _themeDark = 'vs2015';
int _fontSize = 14; int _fontSize = 14;
String _fontFamily = 'JetBrains Mono'; String _fontFamily = 'System';
String get theme => _theme; String get theme => _theme;
String get themeDark => _themeDark; String get themeDark => _themeDark;

View File

@ -134,7 +134,6 @@ flutter:
# see https://flutter.dev/custom-fonts/#from-packages # see https://flutter.dev/custom-fonts/#from-packages
assets: assets:
- images/ - images/
- google_fonts/
flutter_intl: flutter_intl:
enabled: true enabled: true