Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Added fontFamily and fontFamilyFallback support in MiraiTheme and MiraiTextStyle #205

Merged
merged 2 commits into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"brightness": "light",
"disabledColor": "#60FEF7FF",
"fontFamily": "Handjet",
"colorScheme": {
"brightness": "light",
"primary": "#6750a4",
Expand Down
44 changes: 44 additions & 0 deletions examples/mirai_gallery/ios/Podfile
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions examples/mirai_gallery/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
],
);

Expand Down
43 changes: 43 additions & 0 deletions examples/mirai_gallery/macos/Podfile
Original file line number Diff line number Diff line change
@@ -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
63 changes: 7 additions & 56 deletions examples/mirai_gallery/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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"
12 changes: 10 additions & 2 deletions examples/mirai_gallery/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class MiraiTextStyle with _$MiraiTextStyle {
double? fontSize,
MiraiFontWeight? fontWeight,
FontStyle? fontStyle,
String? fontFamily,
List<String>? fontFamilyFallback,
double? letterSpacing,
double? wordSpacing,
TextBaseline? textBaseline,
Expand All @@ -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,
Expand Down
Loading