diff --git a/examples/mirai_gallery/assets/fonts/Handjet/Handjet-Bold.ttf b/examples/mirai_gallery/assets/fonts/Handjet/Handjet-Bold.ttf new file mode 100644 index 00000000..a18a412a Binary files /dev/null and b/examples/mirai_gallery/assets/fonts/Handjet/Handjet-Bold.ttf differ diff --git a/examples/mirai_gallery/assets/fonts/Handjet/Handjet-Medium.ttf b/examples/mirai_gallery/assets/fonts/Handjet/Handjet-Medium.ttf new file mode 100644 index 00000000..33a7cf49 Binary files /dev/null and b/examples/mirai_gallery/assets/fonts/Handjet/Handjet-Medium.ttf differ diff --git a/examples/mirai_gallery/assets/fonts/Handjet/Handjet-Regular.ttf b/examples/mirai_gallery/assets/fonts/Handjet/Handjet-Regular.ttf new file mode 100644 index 00000000..c7033870 Binary files /dev/null and b/examples/mirai_gallery/assets/fonts/Handjet/Handjet-Regular.ttf differ diff --git a/examples/mirai_gallery/assets/json/example_light_theme.json b/examples/mirai_gallery/assets/json/example_light_theme.json index 48a2ca08..5cb79b8e 100644 --- a/examples/mirai_gallery/assets/json/example_light_theme.json +++ b/examples/mirai_gallery/assets/json/example_light_theme.json @@ -1,6 +1,7 @@ { "brightness": "light", "disabledColor": "#60FEF7FF", + "fontFamily": "Handjet", "colorScheme": { "brightness": "light", "primary": "#6750a4", diff --git a/examples/mirai_gallery/ios/Podfile b/examples/mirai_gallery/ios/Podfile new file mode 100644 index 00000000..fdcc671e --- /dev/null +++ b/examples/mirai_gallery/ios/Podfile @@ -0,0 +1,44 @@ +# Uncomment this line to define a global platform for your project +# platform :ios, '11.0' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" + end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_ios_podfile_setup + +target 'Runner' do + use_frameworks! + use_modular_headers! + + flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) + target 'RunnerTests' do + inherit! :search_paths + end +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_ios_build_settings(target) + end +end diff --git a/examples/mirai_gallery/lib/main.dart b/examples/mirai_gallery/lib/main.dart index 7d6046ac..c6cffc09 100644 --- a/examples/mirai_gallery/lib/main.dart +++ b/examples/mirai_gallery/lib/main.dart @@ -5,13 +5,13 @@ import 'package:mirai_gallery/app/details/details_screen.dart'; import 'package:mirai_gallery/app/example/example_screen_parser.dart'; import 'package:mirai_gallery/app/home/home_screen.dart'; import 'package:mirai_gallery/app_theme/app_theme_cubit.dart'; -import 'package:mirai_webview/mirai_webview.dart'; +// import 'package:mirai_webview/mirai_webview.dart'; void main() async { await Mirai.initialize( parsers: const [ ExampleScreenParser(), - MiraiWebViewParser(), + // MiraiWebViewParser(), ], ); diff --git a/examples/mirai_gallery/macos/Podfile b/examples/mirai_gallery/macos/Podfile new file mode 100644 index 00000000..c795730d --- /dev/null +++ b/examples/mirai_gallery/macos/Podfile @@ -0,0 +1,43 @@ +platform :osx, '10.14' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" + end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_macos_podfile_setup + +target 'Runner' do + use_frameworks! + use_modular_headers! + + flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) + target 'RunnerTests' do + inherit! :search_paths + end +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_macos_build_settings(target) + end +end diff --git a/examples/mirai_gallery/pubspec.lock b/examples/mirai_gallery/pubspec.lock index d529c345..a9d93cba 100644 --- a/examples/mirai_gallery/pubspec.lock +++ b/examples/mirai_gallery/pubspec.lock @@ -77,10 +77,10 @@ packages: dependency: transitive description: name: build_resolvers - sha256: a7417cc44d9edb3f2c8760000270c99dba8c72ff66d0146772b8326565780745 + sha256: d912852cce27c9e80a93603db721c267716894462e7033165178b91138587972 url: "https://pub.dev" source: hosted - version: "2.3.1" + version: "2.3.2" build_runner: dependency: "direct dev" description: @@ -390,19 +390,10 @@ packages: mirai: dependency: "direct main" description: - name: mirai - sha256: "6b947ccd7e5c25704b96ade9f6805b085825eba1d50d9f434d146274992af74a" - url: "https://pub.dev" - source: hosted + path: "../../packages/mirai" + relative: true + source: path version: "0.5.0" - mirai_webview: - dependency: "direct main" - description: - name: mirai_webview - sha256: "59af9ac35ef0779667269a5a0e39d5745879c7a2ab9ec802794f9a6dc997beda" - url: "https://pub.dev" - source: hosted - version: "0.0.1" nested: dependency: transitive description: @@ -427,14 +418,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.8.3" - plugin_platform_interface: - dependency: transitive - description: - name: plugin_platform_interface - sha256: da3fdfeccc4d4ff2da8f8c556704c08f912542c5fb3cf2233ed75372384a034d - url: "https://pub.dev" - source: hosted - version: "2.1.6" pool: dependency: transitive description: @@ -608,38 +591,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.4.0" - webview_flutter: - dependency: transitive - description: - name: webview_flutter - sha256: "82f6787d5df55907aa01e49bd9644f4ed1cc82af7a8257dd9947815959d2e755" - url: "https://pub.dev" - source: hosted - version: "4.2.4" - webview_flutter_android: - dependency: transitive - description: - name: webview_flutter_android - sha256: "0d8f5ac96a155e672129bf94c7abf625de01241d44d269dbaff083f1b4deb1aa" - url: "https://pub.dev" - source: hosted - version: "3.9.5" - webview_flutter_platform_interface: - dependency: transitive - description: - name: webview_flutter_platform_interface - sha256: "6d9213c65f1060116757a7c473247c60f3f7f332cac33dc417c9e362a9a13e4f" - url: "https://pub.dev" - source: hosted - version: "2.6.0" - webview_flutter_wkwebview: - dependency: transitive - description: - name: webview_flutter_wkwebview - sha256: d2f7241849582da80b79acb03bb936422412ce5c0c79fb5f6a1de5421a5aecc4 - url: "https://pub.dev" - source: hosted - version: "3.7.4" yaml: dependency: transitive description: @@ -649,5 +600,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.1.0 <4.0.0" - flutter: ">=3.7.0" + dart: ">=3.1.0-185.0.dev <4.0.0" + flutter: ">=1.17.0" diff --git a/examples/mirai_gallery/pubspec.yaml b/examples/mirai_gallery/pubspec.yaml index 492f24e1..0b855fc8 100644 --- a/examples/mirai_gallery/pubspec.yaml +++ b/examples/mirai_gallery/pubspec.yaml @@ -37,8 +37,9 @@ dependencies: freezed_annotation: ^2.4.1 json_annotation: ^4.8.1 flutter_bloc: ^8.1.3 - mirai: ^0.5.0 - mirai_webview: ^0.0.1 + mirai: + path: ../../packages/mirai + # mirai_webview: ^0.0.1 dev_dependencies: flutter_test: @@ -63,3 +64,10 @@ flutter: assets: - assets/images/ - assets/json/ + + fonts: + - family: Handjet + fonts: + - asset: assets/fonts/Handjet/Handjet-Bold.ttf + - asset: assets/fonts/Handjet/Handjet-Medium.ttf + - asset: assets/fonts/Handjet/Handjet-Regular.ttf diff --git a/packages/mirai/lib/src/parsers/mirai_text_style/mirai_text_style.dart b/packages/mirai/lib/src/parsers/mirai_text_style/mirai_text_style.dart index 2bddd158..449f0120 100644 --- a/packages/mirai/lib/src/parsers/mirai_text_style/mirai_text_style.dart +++ b/packages/mirai/lib/src/parsers/mirai_text_style/mirai_text_style.dart @@ -15,6 +15,8 @@ class MiraiTextStyle with _$MiraiTextStyle { double? fontSize, MiraiFontWeight? fontWeight, FontStyle? fontStyle, + String? fontFamily, + List? fontFamilyFallback, double? letterSpacing, double? wordSpacing, TextBaseline? textBaseline, @@ -34,6 +36,8 @@ extension MiraiTextStyleParser on MiraiTextStyle { fontSize: fontSize, fontWeight: fontWeight?.value, fontStyle: fontStyle, + fontFamily: fontFamily, + fontFamilyFallback: fontFamilyFallback, letterSpacing: letterSpacing, wordSpacing: wordSpacing, textBaseline: textBaseline, diff --git a/packages/mirai/lib/src/parsers/mirai_text_style/mirai_text_style.freezed.dart b/packages/mirai/lib/src/parsers/mirai_text_style/mirai_text_style.freezed.dart index 32a1f994..8aba930b 100644 --- a/packages/mirai/lib/src/parsers/mirai_text_style/mirai_text_style.freezed.dart +++ b/packages/mirai/lib/src/parsers/mirai_text_style/mirai_text_style.freezed.dart @@ -26,6 +26,8 @@ mixin _$MiraiTextStyle { double? get fontSize => throw _privateConstructorUsedError; MiraiFontWeight? get fontWeight => throw _privateConstructorUsedError; FontStyle? get fontStyle => throw _privateConstructorUsedError; + String? get fontFamily => throw _privateConstructorUsedError; + List? get fontFamilyFallback => throw _privateConstructorUsedError; double? get letterSpacing => throw _privateConstructorUsedError; double? get wordSpacing => throw _privateConstructorUsedError; TextBaseline? get textBaseline => throw _privateConstructorUsedError; @@ -50,6 +52,8 @@ abstract class $MiraiTextStyleCopyWith<$Res> { double? fontSize, MiraiFontWeight? fontWeight, FontStyle? fontStyle, + String? fontFamily, + List? fontFamilyFallback, double? letterSpacing, double? wordSpacing, TextBaseline? textBaseline, @@ -75,6 +79,8 @@ class _$MiraiTextStyleCopyWithImpl<$Res, $Val extends MiraiTextStyle> Object? fontSize = freezed, Object? fontWeight = freezed, Object? fontStyle = freezed, + Object? fontFamily = freezed, + Object? fontFamilyFallback = freezed, Object? letterSpacing = freezed, Object? wordSpacing = freezed, Object? textBaseline = freezed, @@ -105,6 +111,14 @@ class _$MiraiTextStyleCopyWithImpl<$Res, $Val extends MiraiTextStyle> ? _value.fontStyle : fontStyle // ignore: cast_nullable_to_non_nullable as FontStyle?, + fontFamily: freezed == fontFamily + ? _value.fontFamily + : fontFamily // ignore: cast_nullable_to_non_nullable + as String?, + fontFamilyFallback: freezed == fontFamilyFallback + ? _value.fontFamilyFallback + : fontFamilyFallback // ignore: cast_nullable_to_non_nullable + as List?, letterSpacing: freezed == letterSpacing ? _value.letterSpacing : letterSpacing // ignore: cast_nullable_to_non_nullable @@ -140,6 +154,8 @@ abstract class _$$_MiraiTextStyleCopyWith<$Res> double? fontSize, MiraiFontWeight? fontWeight, FontStyle? fontStyle, + String? fontFamily, + List? fontFamilyFallback, double? letterSpacing, double? wordSpacing, TextBaseline? textBaseline, @@ -163,6 +179,8 @@ class __$$_MiraiTextStyleCopyWithImpl<$Res> Object? fontSize = freezed, Object? fontWeight = freezed, Object? fontStyle = freezed, + Object? fontFamily = freezed, + Object? fontFamilyFallback = freezed, Object? letterSpacing = freezed, Object? wordSpacing = freezed, Object? textBaseline = freezed, @@ -193,6 +211,14 @@ class __$$_MiraiTextStyleCopyWithImpl<$Res> ? _value.fontStyle : fontStyle // ignore: cast_nullable_to_non_nullable as FontStyle?, + fontFamily: freezed == fontFamily + ? _value.fontFamily + : fontFamily // ignore: cast_nullable_to_non_nullable + as String?, + fontFamilyFallback: freezed == fontFamilyFallback + ? _value._fontFamilyFallback + : fontFamilyFallback // ignore: cast_nullable_to_non_nullable + as List?, letterSpacing: freezed == letterSpacing ? _value.letterSpacing : letterSpacing // ignore: cast_nullable_to_non_nullable @@ -223,10 +249,13 @@ class _$_MiraiTextStyle implements _MiraiTextStyle { this.fontSize, this.fontWeight, this.fontStyle, + this.fontFamily, + final List? fontFamilyFallback, this.letterSpacing, this.wordSpacing, this.textBaseline, - this.height}); + this.height}) + : _fontFamilyFallback = fontFamilyFallback; factory _$_MiraiTextStyle.fromJson(Map json) => _$$_MiraiTextStyleFromJson(json); @@ -244,6 +273,19 @@ class _$_MiraiTextStyle implements _MiraiTextStyle { final MiraiFontWeight? fontWeight; @override final FontStyle? fontStyle; + @override + final String? fontFamily; + final List? _fontFamilyFallback; + @override + List? get fontFamilyFallback { + final value = _fontFamilyFallback; + if (value == null) return null; + if (_fontFamilyFallback is EqualUnmodifiableListView) + return _fontFamilyFallback; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + @override final double? letterSpacing; @override @@ -255,7 +297,7 @@ class _$_MiraiTextStyle implements _MiraiTextStyle { @override String toString() { - return 'MiraiTextStyle(inherit: $inherit, color: $color, backgroundColor: $backgroundColor, fontSize: $fontSize, fontWeight: $fontWeight, fontStyle: $fontStyle, letterSpacing: $letterSpacing, wordSpacing: $wordSpacing, textBaseline: $textBaseline, height: $height)'; + return 'MiraiTextStyle(inherit: $inherit, color: $color, backgroundColor: $backgroundColor, fontSize: $fontSize, fontWeight: $fontWeight, fontStyle: $fontStyle, fontFamily: $fontFamily, fontFamilyFallback: $fontFamilyFallback, letterSpacing: $letterSpacing, wordSpacing: $wordSpacing, textBaseline: $textBaseline, height: $height)'; } @override @@ -273,6 +315,10 @@ class _$_MiraiTextStyle implements _MiraiTextStyle { other.fontWeight == fontWeight) && (identical(other.fontStyle, fontStyle) || other.fontStyle == fontStyle) && + (identical(other.fontFamily, fontFamily) || + other.fontFamily == fontFamily) && + const DeepCollectionEquality() + .equals(other._fontFamilyFallback, _fontFamilyFallback) && (identical(other.letterSpacing, letterSpacing) || other.letterSpacing == letterSpacing) && (identical(other.wordSpacing, wordSpacing) || @@ -292,6 +338,8 @@ class _$_MiraiTextStyle implements _MiraiTextStyle { fontSize, fontWeight, fontStyle, + fontFamily, + const DeepCollectionEquality().hash(_fontFamilyFallback), letterSpacing, wordSpacing, textBaseline, @@ -319,6 +367,8 @@ abstract class _MiraiTextStyle implements MiraiTextStyle { final double? fontSize, final MiraiFontWeight? fontWeight, final FontStyle? fontStyle, + final String? fontFamily, + final List? fontFamilyFallback, final double? letterSpacing, final double? wordSpacing, final TextBaseline? textBaseline, @@ -340,6 +390,10 @@ abstract class _MiraiTextStyle implements MiraiTextStyle { @override FontStyle? get fontStyle; @override + String? get fontFamily; + @override + List? get fontFamilyFallback; + @override double? get letterSpacing; @override double? get wordSpacing; diff --git a/packages/mirai/lib/src/parsers/mirai_text_style/mirai_text_style.g.dart b/packages/mirai/lib/src/parsers/mirai_text_style/mirai_text_style.g.dart index 8b59a89d..7a797c3e 100644 --- a/packages/mirai/lib/src/parsers/mirai_text_style/mirai_text_style.g.dart +++ b/packages/mirai/lib/src/parsers/mirai_text_style/mirai_text_style.g.dart @@ -15,6 +15,10 @@ _$_MiraiTextStyle _$$_MiraiTextStyleFromJson(Map json) => fontWeight: $enumDecodeNullable(_$MiraiFontWeightEnumMap, json['fontWeight']), fontStyle: $enumDecodeNullable(_$FontStyleEnumMap, json['fontStyle']), + fontFamily: json['fontFamily'] as String?, + fontFamilyFallback: (json['fontFamilyFallback'] as List?) + ?.map((e) => e as String) + .toList(), letterSpacing: (json['letterSpacing'] as num?)?.toDouble(), wordSpacing: (json['wordSpacing'] as num?)?.toDouble(), textBaseline: @@ -30,6 +34,8 @@ Map _$$_MiraiTextStyleToJson(_$_MiraiTextStyle instance) => 'fontSize': instance.fontSize, 'fontWeight': _$MiraiFontWeightEnumMap[instance.fontWeight], 'fontStyle': _$FontStyleEnumMap[instance.fontStyle], + 'fontFamily': instance.fontFamily, + 'fontFamilyFallback': instance.fontFamilyFallback, 'letterSpacing': instance.letterSpacing, 'wordSpacing': instance.wordSpacing, 'textBaseline': _$TextBaselineEnumMap[instance.textBaseline], diff --git a/packages/mirai/lib/src/parsers/mirai_theme/mirai_theme.dart b/packages/mirai/lib/src/parsers/mirai_theme/mirai_theme.dart index 19b3922a..ef947c64 100644 --- a/packages/mirai/lib/src/parsers/mirai_theme/mirai_theme.dart +++ b/packages/mirai/lib/src/parsers/mirai_theme/mirai_theme.dart @@ -48,6 +48,8 @@ class MiraiTheme with _$MiraiTheme { String? shadowColor, String? splashColor, String? unselectedWidgetColor, + String? fontFamily, + List? fontFamilyFallback, MiraiAppBarTheme? appBarTheme, MiraiButtonStyle? elevatedButtonTheme, MiraiButtonStyle? outlinedButtonTheme, @@ -96,6 +98,8 @@ extension MiraiThemeParser on MiraiTheme { shadowColor: shadowColor.toColor, splashColor: splashColor.toColor, unselectedWidgetColor: unselectedWidgetColor.toColor, + fontFamily: fontFamily, + fontFamilyFallback: fontFamilyFallback, primarySwatch: primarySwatch?.parse, appBarTheme: appBarTheme?.parse, elevatedButtonTheme: diff --git a/packages/mirai/lib/src/parsers/mirai_theme/mirai_theme.freezed.dart b/packages/mirai/lib/src/parsers/mirai_theme/mirai_theme.freezed.dart index e8c35e69..4e35f8b0 100644 --- a/packages/mirai/lib/src/parsers/mirai_theme/mirai_theme.freezed.dart +++ b/packages/mirai/lib/src/parsers/mirai_theme/mirai_theme.freezed.dart @@ -46,6 +46,8 @@ mixin _$MiraiTheme { String? get shadowColor => throw _privateConstructorUsedError; String? get splashColor => throw _privateConstructorUsedError; String? get unselectedWidgetColor => throw _privateConstructorUsedError; + String? get fontFamily => throw _privateConstructorUsedError; + List? get fontFamilyFallback => throw _privateConstructorUsedError; MiraiAppBarTheme? get appBarTheme => throw _privateConstructorUsedError; MiraiButtonStyle? get elevatedButtonTheme => throw _privateConstructorUsedError; @@ -110,6 +112,8 @@ abstract class $MiraiThemeCopyWith<$Res> { String? shadowColor, String? splashColor, String? unselectedWidgetColor, + String? fontFamily, + List? fontFamilyFallback, MiraiAppBarTheme? appBarTheme, MiraiButtonStyle? elevatedButtonTheme, MiraiButtonStyle? outlinedButtonTheme, @@ -187,6 +191,8 @@ class _$MiraiThemeCopyWithImpl<$Res, $Val extends MiraiTheme> Object? shadowColor = freezed, Object? splashColor = freezed, Object? unselectedWidgetColor = freezed, + Object? fontFamily = freezed, + Object? fontFamilyFallback = freezed, Object? appBarTheme = freezed, Object? elevatedButtonTheme = freezed, Object? outlinedButtonTheme = freezed, @@ -305,6 +311,14 @@ class _$MiraiThemeCopyWithImpl<$Res, $Val extends MiraiTheme> ? _value.unselectedWidgetColor : unselectedWidgetColor // ignore: cast_nullable_to_non_nullable as String?, + fontFamily: freezed == fontFamily + ? _value.fontFamily + : fontFamily // ignore: cast_nullable_to_non_nullable + as String?, + fontFamilyFallback: freezed == fontFamilyFallback + ? _value.fontFamilyFallback + : fontFamilyFallback // ignore: cast_nullable_to_non_nullable + as List?, appBarTheme: freezed == appBarTheme ? _value.appBarTheme : appBarTheme // ignore: cast_nullable_to_non_nullable @@ -645,6 +659,8 @@ abstract class _$$_MiraiThemeCopyWith<$Res> String? shadowColor, String? splashColor, String? unselectedWidgetColor, + String? fontFamily, + List? fontFamilyFallback, MiraiAppBarTheme? appBarTheme, MiraiButtonStyle? elevatedButtonTheme, MiraiButtonStyle? outlinedButtonTheme, @@ -739,6 +755,8 @@ class __$$_MiraiThemeCopyWithImpl<$Res> Object? shadowColor = freezed, Object? splashColor = freezed, Object? unselectedWidgetColor = freezed, + Object? fontFamily = freezed, + Object? fontFamilyFallback = freezed, Object? appBarTheme = freezed, Object? elevatedButtonTheme = freezed, Object? outlinedButtonTheme = freezed, @@ -857,6 +875,14 @@ class __$$_MiraiThemeCopyWithImpl<$Res> ? _value.unselectedWidgetColor : unselectedWidgetColor // ignore: cast_nullable_to_non_nullable as String?, + fontFamily: freezed == fontFamily + ? _value.fontFamily + : fontFamily // ignore: cast_nullable_to_non_nullable + as String?, + fontFamilyFallback: freezed == fontFamilyFallback + ? _value._fontFamilyFallback + : fontFamilyFallback // ignore: cast_nullable_to_non_nullable + as List?, appBarTheme: freezed == appBarTheme ? _value.appBarTheme : appBarTheme // ignore: cast_nullable_to_non_nullable @@ -954,6 +980,8 @@ class _$_MiraiTheme implements _MiraiTheme { this.shadowColor, this.splashColor, this.unselectedWidgetColor, + this.fontFamily, + final List? fontFamilyFallback, this.appBarTheme, this.elevatedButtonTheme, this.outlinedButtonTheme, @@ -969,7 +997,8 @@ class _$_MiraiTheme implements _MiraiTheme { this.cardTheme, this.listTileTheme, this.navigationBarTheme, - this.tabBarTheme}); + this.tabBarTheme}) + : _fontFamilyFallback = fontFamilyFallback; factory _$_MiraiTheme.fromJson(Map json) => _$$_MiraiThemeFromJson(json); @@ -1024,6 +1053,19 @@ class _$_MiraiTheme implements _MiraiTheme { final String? splashColor; @override final String? unselectedWidgetColor; + @override + final String? fontFamily; + final List? _fontFamilyFallback; + @override + List? get fontFamilyFallback { + final value = _fontFamilyFallback; + if (value == null) return null; + if (_fontFamilyFallback is EqualUnmodifiableListView) + return _fontFamilyFallback; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + @override final MiraiAppBarTheme? appBarTheme; @override @@ -1059,7 +1101,7 @@ class _$_MiraiTheme implements _MiraiTheme { @override String toString() { - return 'MiraiTheme(applyElevationOverlayColor: $applyElevationOverlayColor, inputDecorationTheme: $inputDecorationTheme, useMaterial3: $useMaterial3, brightness: $brightness, canvasColor: $canvasColor, cardColor: $cardColor, colorScheme: $colorScheme, colorSchemeSeed: $colorSchemeSeed, dialogBackgroundColor: $dialogBackgroundColor, disabledColor: $disabledColor, dividerColor: $dividerColor, focusColor: $focusColor, highlightColor: $highlightColor, hintColor: $hintColor, hoverColor: $hoverColor, indicatorColor: $indicatorColor, primaryColor: $primaryColor, primaryColorDark: $primaryColorDark, primaryColorLight: $primaryColorLight, primarySwatch: $primarySwatch, scaffoldBackgroundColor: $scaffoldBackgroundColor, secondaryHeaderColor: $secondaryHeaderColor, shadowColor: $shadowColor, splashColor: $splashColor, unselectedWidgetColor: $unselectedWidgetColor, appBarTheme: $appBarTheme, elevatedButtonTheme: $elevatedButtonTheme, outlinedButtonTheme: $outlinedButtonTheme, iconButtonTheme: $iconButtonTheme, iconTheme: $iconTheme, primaryIconTheme: $primaryIconTheme, dialogTheme: $dialogTheme, floatingActionButtonTheme: $floatingActionButtonTheme, textButtonTheme: $textButtonTheme, bottomAppBarTheme: $bottomAppBarTheme, bottomNavigationBarTheme: $bottomNavigationBarTheme, bottomSheetTheme: $bottomSheetTheme, cardTheme: $cardTheme, listTileTheme: $listTileTheme, navigationBarTheme: $navigationBarTheme, tabBarTheme: $tabBarTheme)'; + return 'MiraiTheme(applyElevationOverlayColor: $applyElevationOverlayColor, inputDecorationTheme: $inputDecorationTheme, useMaterial3: $useMaterial3, brightness: $brightness, canvasColor: $canvasColor, cardColor: $cardColor, colorScheme: $colorScheme, colorSchemeSeed: $colorSchemeSeed, dialogBackgroundColor: $dialogBackgroundColor, disabledColor: $disabledColor, dividerColor: $dividerColor, focusColor: $focusColor, highlightColor: $highlightColor, hintColor: $hintColor, hoverColor: $hoverColor, indicatorColor: $indicatorColor, primaryColor: $primaryColor, primaryColorDark: $primaryColorDark, primaryColorLight: $primaryColorLight, primarySwatch: $primarySwatch, scaffoldBackgroundColor: $scaffoldBackgroundColor, secondaryHeaderColor: $secondaryHeaderColor, shadowColor: $shadowColor, splashColor: $splashColor, unselectedWidgetColor: $unselectedWidgetColor, fontFamily: $fontFamily, fontFamilyFallback: $fontFamilyFallback, appBarTheme: $appBarTheme, elevatedButtonTheme: $elevatedButtonTheme, outlinedButtonTheme: $outlinedButtonTheme, iconButtonTheme: $iconButtonTheme, iconTheme: $iconTheme, primaryIconTheme: $primaryIconTheme, dialogTheme: $dialogTheme, floatingActionButtonTheme: $floatingActionButtonTheme, textButtonTheme: $textButtonTheme, bottomAppBarTheme: $bottomAppBarTheme, bottomNavigationBarTheme: $bottomNavigationBarTheme, bottomSheetTheme: $bottomSheetTheme, cardTheme: $cardTheme, listTileTheme: $listTileTheme, navigationBarTheme: $navigationBarTheme, tabBarTheme: $tabBarTheme)'; } @override @@ -1118,6 +1160,10 @@ class _$_MiraiTheme implements _MiraiTheme { other.splashColor == splashColor) && (identical(other.unselectedWidgetColor, unselectedWidgetColor) || other.unselectedWidgetColor == unselectedWidgetColor) && + (identical(other.fontFamily, fontFamily) || + other.fontFamily == fontFamily) && + const DeepCollectionEquality() + .equals(other._fontFamilyFallback, _fontFamilyFallback) && (identical(other.appBarTheme, appBarTheme) || other.appBarTheme == appBarTheme) && (identical(other.elevatedButtonTheme, elevatedButtonTheme) || @@ -1128,10 +1174,8 @@ class _$_MiraiTheme implements _MiraiTheme { other.iconButtonTheme == iconButtonTheme) && (identical(other.iconTheme, iconTheme) || other.iconTheme == iconTheme) && - (identical(other.primaryIconTheme, primaryIconTheme) || - other.primaryIconTheme == primaryIconTheme) && - (identical(other.dialogTheme, dialogTheme) || - other.dialogTheme == dialogTheme) && + (identical(other.primaryIconTheme, primaryIconTheme) || other.primaryIconTheme == primaryIconTheme) && + (identical(other.dialogTheme, dialogTheme) || other.dialogTheme == dialogTheme) && (identical(other.floatingActionButtonTheme, floatingActionButtonTheme) || other.floatingActionButtonTheme == floatingActionButtonTheme) && (identical(other.textButtonTheme, textButtonTheme) || other.textButtonTheme == textButtonTheme) && (identical(other.bottomAppBarTheme, bottomAppBarTheme) || other.bottomAppBarTheme == bottomAppBarTheme) && @@ -1172,6 +1216,8 @@ class _$_MiraiTheme implements _MiraiTheme { shadowColor, splashColor, unselectedWidgetColor, + fontFamily, + const DeepCollectionEquality().hash(_fontFamilyFallback), appBarTheme, elevatedButtonTheme, outlinedButtonTheme, @@ -1231,6 +1277,8 @@ abstract class _MiraiTheme implements MiraiTheme { final String? shadowColor, final String? splashColor, final String? unselectedWidgetColor, + final String? fontFamily, + final List? fontFamilyFallback, final MiraiAppBarTheme? appBarTheme, final MiraiButtonStyle? elevatedButtonTheme, final MiraiButtonStyle? outlinedButtonTheme, @@ -1302,6 +1350,10 @@ abstract class _MiraiTheme implements MiraiTheme { @override String? get unselectedWidgetColor; @override + String? get fontFamily; + @override + List? get fontFamilyFallback; + @override MiraiAppBarTheme? get appBarTheme; @override MiraiButtonStyle? get elevatedButtonTheme; diff --git a/packages/mirai/lib/src/parsers/mirai_theme/mirai_theme.g.dart b/packages/mirai/lib/src/parsers/mirai_theme/mirai_theme.g.dart index 724366e6..43106812 100644 --- a/packages/mirai/lib/src/parsers/mirai_theme/mirai_theme.g.dart +++ b/packages/mirai/lib/src/parsers/mirai_theme/mirai_theme.g.dart @@ -42,6 +42,10 @@ _$_MiraiTheme _$$_MiraiThemeFromJson(Map json) => shadowColor: json['shadowColor'] as String?, splashColor: json['splashColor'] as String?, unselectedWidgetColor: json['unselectedWidgetColor'] as String?, + fontFamily: json['fontFamily'] as String?, + fontFamilyFallback: (json['fontFamilyFallback'] as List?) + ?.map((e) => e as String) + .toList(), appBarTheme: json['appBarTheme'] == null ? null : MiraiAppBarTheme.fromJson( @@ -135,6 +139,8 @@ Map _$$_MiraiThemeToJson(_$_MiraiTheme instance) => 'shadowColor': instance.shadowColor, 'splashColor': instance.splashColor, 'unselectedWidgetColor': instance.unselectedWidgetColor, + 'fontFamily': instance.fontFamily, + 'fontFamilyFallback': instance.fontFamilyFallback, 'appBarTheme': instance.appBarTheme, 'elevatedButtonTheme': instance.elevatedButtonTheme, 'outlinedButtonTheme': instance.outlinedButtonTheme, diff --git a/packages/mirai_webview/.flutter-plugins b/packages/mirai_webview/.flutter-plugins index 5b460ff2..29fa8d2a 100644 --- a/packages/mirai_webview/.flutter-plugins +++ b/packages/mirai_webview/.flutter-plugins @@ -1,4 +1,4 @@ # This is a generated file; do not edit or check into version control. -webview_flutter=/Users/divyanshu.bhargava/.pub-cache/hosted/pub.dev/webview_flutter-4.2.4/ -webview_flutter_android=/Users/divyanshu.bhargava/.pub-cache/hosted/pub.dev/webview_flutter_android-3.9.5/ -webview_flutter_wkwebview=/Users/divyanshu.bhargava/.pub-cache/hosted/pub.dev/webview_flutter_wkwebview-3.7.4/ +webview_flutter=/Users/asim.khan/.pub-cache/hosted/pub.dev/webview_flutter-4.2.4/ +webview_flutter_android=/Users/asim.khan/.pub-cache/hosted/pub.dev/webview_flutter_android-3.10.0/ +webview_flutter_wkwebview=/Users/asim.khan/.pub-cache/hosted/pub.dev/webview_flutter_wkwebview-3.7.4/ diff --git a/packages/mirai_webview/.flutter-plugins-dependencies b/packages/mirai_webview/.flutter-plugins-dependencies index 9e520ea7..d45059c0 100644 --- a/packages/mirai_webview/.flutter-plugins-dependencies +++ b/packages/mirai_webview/.flutter-plugins-dependencies @@ -1 +1 @@ -{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"webview_flutter_wkwebview","path":"/Users/divyanshu.bhargava/.pub-cache/hosted/pub.dev/webview_flutter_wkwebview-3.7.4/","native_build":true,"dependencies":[]}],"android":[{"name":"webview_flutter_android","path":"/Users/divyanshu.bhargava/.pub-cache/hosted/pub.dev/webview_flutter_android-3.9.5/","native_build":true,"dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"webview_flutter","dependencies":["webview_flutter_android","webview_flutter_wkwebview"]},{"name":"webview_flutter_android","dependencies":[]},{"name":"webview_flutter_wkwebview","dependencies":[]}],"date_created":"2023-09-08 18:55:04.433441","version":"3.13.2"} \ No newline at end of file +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"webview_flutter_wkwebview","path":"/Users/asim.khan/.pub-cache/hosted/pub.dev/webview_flutter_wkwebview-3.7.4/","native_build":true,"dependencies":[]}],"android":[{"name":"webview_flutter_android","path":"/Users/asim.khan/.pub-cache/hosted/pub.dev/webview_flutter_android-3.10.0/","native_build":true,"dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"webview_flutter","dependencies":["webview_flutter_android","webview_flutter_wkwebview"]},{"name":"webview_flutter_android","dependencies":[]},{"name":"webview_flutter_wkwebview","dependencies":[]}],"date_created":"2023-09-13 15:09:12.252350","version":"3.13.0"} \ No newline at end of file