diff --git a/packages/flutter/lib/src/cupertino/dialog.dart b/packages/flutter/lib/src/cupertino/dialog.dart index 1d71ebeaab..3f503375e0 100644 --- a/packages/flutter/lib/src/cupertino/dialog.dart +++ b/packages/flutter/lib/src/cupertino/dialog.dart @@ -31,7 +31,7 @@ import 'theme.dart'; // Apple Design Resources(https://developer.apple.com/design/resources/). // However the values are not exactly the same as native, so eyeballing is needed. const TextStyle _kCupertinoDialogTitleStyle = TextStyle( - fontFamily: 'CupertinoSystemText', + fontFamily: 'PingFang SC', inherit: false, fontSize: 17.0, fontWeight: FontWeight.w600, @@ -41,7 +41,7 @@ const TextStyle _kCupertinoDialogTitleStyle = TextStyle( ); const TextStyle _kCupertinoDialogContentStyle = TextStyle( - fontFamily: 'CupertinoSystemText', + fontFamily: 'PingFang SC', inherit: false, fontSize: 13.0, fontWeight: FontWeight.w400, @@ -51,7 +51,7 @@ const TextStyle _kCupertinoDialogContentStyle = TextStyle( ); const TextStyle _kCupertinoDialogActionStyle = TextStyle( - fontFamily: 'CupertinoSystemText', + fontFamily: 'PingFang SC', inherit: false, fontSize: 16.8, fontWeight: FontWeight.w400, @@ -61,7 +61,7 @@ const TextStyle _kCupertinoDialogActionStyle = TextStyle( // CupertinoActionSheet-specific text styles. const TextStyle _kActionSheetActionStyle = TextStyle( // The fontSize and fontWeight may be adjusted when the text is rendered. - fontFamily: 'CupertinoSystemDisplay', + fontFamily: 'PingFang SC', inherit: false, fontSize: 17.0, fontWeight: FontWeight.w400, @@ -69,7 +69,7 @@ const TextStyle _kActionSheetActionStyle = TextStyle( ); const TextStyle _kActionSheetContentStyle = TextStyle( - fontFamily: 'CupertinoSystemText', + fontFamily: 'PingFang SC', inherit: false, fontSize: 13.0, fontWeight: FontWeight.w400, diff --git a/packages/flutter/lib/src/cupertino/text_theme.dart b/packages/flutter/lib/src/cupertino/text_theme.dart index 6640c56ec7..6ff3beab05 100644 --- a/packages/flutter/lib/src/cupertino/text_theme.dart +++ b/packages/flutter/lib/src/cupertino/text_theme.dart @@ -18,7 +18,7 @@ import 'colors.dart'; // Values derived from https://developer.apple.com/design/resources/. const TextStyle _kDefaultTextStyle = TextStyle( inherit: false, - fontFamily: 'CupertinoSystemText', + fontFamily: 'PingFang SC', fontSize: 17.0, letterSpacing: -0.41, color: CupertinoColors.label, @@ -33,7 +33,7 @@ const TextStyle _kDefaultTextStyle = TextStyle( // See [iOS 17 + iPadOS 17 UI Kit](https://www.figma.com/community/file/1248375255495415511) for details. const TextStyle _kDefaultActionTextStyle = TextStyle( inherit: false, - fontFamily: 'CupertinoSystemText', + fontFamily: 'PingFang SC', fontSize: 17.0, letterSpacing: -0.41, color: CupertinoColors.activeBlue, @@ -48,7 +48,7 @@ const TextStyle _kDefaultActionTextStyle = TextStyle( // See [iOS 17 + iPadOS 17 UI Kit](https://www.figma.com/community/file/1248375255495415511) for details. const TextStyle _kDefaultActionSmallTextStyle = TextStyle( inherit: false, - fontFamily: 'CupertinoSystemText', + fontFamily: 'PingFang SC', fontSize: 15.0, letterSpacing: -0.23, color: CupertinoColors.activeBlue, @@ -62,7 +62,7 @@ const TextStyle _kDefaultActionSmallTextStyle = TextStyle( // Values derived from https://developer.apple.com/design/resources/. const TextStyle _kDefaultTabLabelTextStyle = TextStyle( inherit: false, - fontFamily: 'CupertinoSystemText', + fontFamily: 'PingFang SC', fontSize: 10.0, fontWeight: FontWeight.w500, letterSpacing: -0.24, @@ -71,7 +71,7 @@ const TextStyle _kDefaultTabLabelTextStyle = TextStyle( const TextStyle _kDefaultMiddleTitleTextStyle = TextStyle( inherit: false, - fontFamily: 'CupertinoSystemText', + fontFamily: 'PingFang SC', fontSize: 17.0, fontWeight: FontWeight.w600, letterSpacing: -0.41, @@ -80,7 +80,7 @@ const TextStyle _kDefaultMiddleTitleTextStyle = TextStyle( const TextStyle _kDefaultLargeTitleTextStyle = TextStyle( inherit: false, - fontFamily: 'CupertinoSystemDisplay', + fontFamily: 'PingFang SC', fontSize: 34.0, fontWeight: FontWeight.w700, letterSpacing: 0.38, diff --git a/packages/flutter/lib/src/material/chip.dart b/packages/flutter/lib/src/material/chip.dart index b606e4721e..d9a5a3286f 100644 --- a/packages/flutter/lib/src/material/chip.dart +++ b/packages/flutter/lib/src/material/chip.dart @@ -2356,7 +2356,7 @@ class _UnconstrainedInkSplashFactory extends InteractiveInkFeatureFactory { required TextDirection textDirection, bool containedInkWell = false, RectCallback? rectCallback, - BorderRadius? borderRadius, + BorderRadiusGeometry? borderRadius, ShapeBorder? customBorder, double? radius, VoidCallback? onRemoved, @@ -2367,7 +2367,7 @@ class _UnconstrainedInkSplashFactory extends InteractiveInkFeatureFactory { position: position, color: color, rectCallback: rectCallback, - borderRadius: borderRadius, + borderRadius: borderRadius?.resolve(textDirection), customBorder: customBorder, radius: radius, onRemoved: onRemoved, diff --git a/packages/flutter/lib/src/material/ink_highlight.dart b/packages/flutter/lib/src/material/ink_highlight.dart index ac4f1bd380..ca80631a5f 100644 --- a/packages/flutter/lib/src/material/ink_highlight.dart +++ b/packages/flutter/lib/src/material/ink_highlight.dart @@ -48,7 +48,7 @@ class InkHighlight extends InteractiveInkFeature { required TextDirection textDirection, BoxShape shape = BoxShape.rectangle, double? radius, - BorderRadius? borderRadius, + BorderRadiusGeometry? borderRadius, super.customBorder, RectCallback? rectCallback, super.onRemoved, @@ -71,7 +71,7 @@ class InkHighlight extends InteractiveInkFeature { final BoxShape _shape; final double? _radius; - final BorderRadius _borderRadius; + final BorderRadiusGeometry? _borderRadius; final RectCallback? _rectCallback; final TextDirection _textDirection; @@ -116,12 +116,22 @@ class InkHighlight extends InteractiveInkFeature { canvas.drawCircle(rect.center, _radius ?? Material.defaultSplashRadius, paint); case BoxShape.rectangle: if (_borderRadius != BorderRadius.zero) { + Radius tl=Radius.zero, tr=Radius.zero, bl=Radius.zero, br=Radius.zero; + if (_borderRadius is BorderRadiusDirectional) { + tl = (_borderRadius as BorderRadiusDirectional).topStart; + tr = (_borderRadius as BorderRadiusDirectional).topEnd; + bl = (_borderRadius as BorderRadiusDirectional).bottomStart; + br = (_borderRadius as BorderRadiusDirectional).bottomEnd; + } else if (_borderRadius is BorderRadius) { + tl = (_borderRadius as BorderRadius).topLeft; + tr = (_borderRadius as BorderRadius).topRight; + bl = (_borderRadius as BorderRadius).bottomLeft; + br = (_borderRadius as BorderRadius).bottomRight; + } final RRect clipRRect = RRect.fromRectAndCorners( rect, - topLeft: _borderRadius.topLeft, - topRight: _borderRadius.topRight, - bottomLeft: _borderRadius.bottomLeft, - bottomRight: _borderRadius.bottomRight, + topLeft: tl, topRight: tr, + bottomLeft: bl, bottomRight: br, ); canvas.drawRRect(clipRRect, paint); } else { diff --git a/packages/flutter/lib/src/painting/gradient.dart b/packages/flutter/lib/src/painting/gradient.dart index 52a3aa7606..0d2d646eaa 100644 --- a/packages/flutter/lib/src/painting/gradient.dart +++ b/packages/flutter/lib/src/painting/gradient.dart @@ -223,7 +223,7 @@ abstract class Gradient { /// The shader's transform will be resolved from the [transform] of this /// gradient. @factory - Shader createShader(Rect rect, {TextDirection? textDirection}); + Shader createShader(Rect rect, { TextDirection? textDirection = TextDirection.ltr}); /// Returns a new gradient with its properties scaled by the given factor. /// @@ -430,7 +430,7 @@ class LinearGradient extends Gradient { final TileMode tileMode; @override - Shader createShader(Rect rect, {TextDirection? textDirection}) { + Shader createShader(Rect rect, {TextDirection? textDirection = TextDirection.ltr}) { return ui.Gradient.linear( begin.resolve(textDirection).withinRect(rect), end.resolve(textDirection).withinRect(rect), @@ -719,7 +719,7 @@ class RadialGradient extends Gradient { final double focalRadius; @override - Shader createShader(Rect rect, {TextDirection? textDirection}) { + Shader createShader(Rect rect, {TextDirection? textDirection = TextDirection.ltr}) { return ui.Gradient.radial( center.resolve(textDirection).withinRect(rect), radius * rect.shortestSide, @@ -1005,7 +1005,7 @@ class SweepGradient extends Gradient { final TileMode tileMode; @override - Shader createShader(Rect rect, {TextDirection? textDirection}) { + Shader createShader(Rect rect, {TextDirection? textDirection = TextDirection.ltr}) { return ui.Gradient.sweep( center.resolve(textDirection).withinRect(rect), colors, diff --git a/packages/flutter/lib/src/painting/text_style.dart b/packages/flutter/lib/src/painting/text_style.dart index a76b643cdb..1393373578 100644 --- a/packages/flutter/lib/src/painting/text_style.dart +++ b/packages/flutter/lib/src/painting/text_style.dart @@ -28,6 +28,11 @@ const String _kColorBackgroundWarning = 'Cannot provide both a backgroundColor and a background\n' 'The backgroundColor argument is just a shorthand for "background: Paint()..color = color".'; +List? _sFontFamilyFallback = []; +void TextStyleSetFontFamilyFallback(List? fontFamilyFallback) { + _sFontFamilyFallback = fontFamilyFallback; +} + // Examples can assume: // late BuildContext context; @@ -598,10 +603,10 @@ class TextStyle with Diagnosticable { /// prefixed with 'packages/package_name/' (e.g. 'packages/cool_fonts/Roboto'). /// The package name should be provided by the `package` argument in the /// constructor. - List? get fontFamilyFallback => - _package == null - ? _fontFamilyFallback - : _fontFamilyFallback?.map((String str) => 'packages/$_package/$str').toList(); + List? get fontFamilyFallback { + List? fallbackFontFamily = _package == null ? _fontFamilyFallback : _fontFamilyFallback?.map((String str) => 'packages/$_package/$str').toList(); + return fallbackFontFamily ?? _sFontFamilyFallback; + } final List? _fontFamilyFallback; // This is stored in order to prefix the fontFamilies in _fontFamilyFallback diff --git a/packages/flutter_tools/lib/src/build_info.dart b/packages/flutter_tools/lib/src/build_info.dart index 88f46b73e2..69c5b5f97c 100644 --- a/packages/flutter_tools/lib/src/build_info.dart +++ b/packages/flutter_tools/lib/src/build_info.dart @@ -12,12 +12,39 @@ import 'base/file_system.dart'; import 'base/logger.dart'; import 'base/os.dart'; import 'base/utils.dart'; +import 'base/process.dart'; import 'convert.dart'; import 'globals.dart' as globals; +import 'package:path/path.dart' as p; /// Whether icon font subsetting is enabled by default. const bool kIconTreeShakerEnabledDefault = true; + +Future executePrebuildScript({bool fullRestart = true}) async { + final String intlToolPath = p.join(globals.fs.currentDirectory.path, 'tools', 'intl_cli', 'intl_cli'); + if (globals.fs.file(intlToolPath).existsSync()){ + final List extraArgs = fullRestart ? ['-c'] : []; + final RunResult ret = await globals.processUtils.run( + [intlToolPath, '-p', globals.fs.currentDirectory.path, ...extraArgs], + workingDirectory: globals.fs.currentDirectory.path, + ); + return ret; + } + + final String prebuildScriptPath = p.join(globals.fs.currentDirectory.path, 'banban_base','prebuild.py'); + final File scriptFile = globals.fs.file(prebuildScriptPath); + if (scriptFile.existsSync()) { + final RunResult ret = await globals.processUtils.run( + ['python3', prebuildScriptPath], + workingDirectory: globals.fs.currentDirectory.path, + ); + return ret; + } + + return null; +} + /// Information about a build to be performed or used. class BuildInfo { const BuildInfo( diff --git a/packages/flutter_tools/lib/src/commands/build.dart b/packages/flutter_tools/lib/src/commands/build.dart index f6cc6092c1..39004e7124 100644 --- a/packages/flutter_tools/lib/src/commands/build.dart +++ b/packages/flutter_tools/lib/src/commands/build.dart @@ -116,6 +116,15 @@ abstract class BuildSubCommand extends FlutterCommand { bool get supported => true; + @override + Future runCommand() async { + final RunResult? ret = await executePrebuildScript(fullRestart: false); + if ((ret?.exitCode ?? 0) != 0) { + return FlutterCommandResult.fail(); + } + return FlutterCommandResult.success(); + } + /// Display a message describing the current null safety runtime mode /// that was selected. /// diff --git a/packages/flutter_tools/lib/src/commands/build_apk.dart b/packages/flutter_tools/lib/src/commands/build_apk.dart index a8a48b410f..96f9747d17 100644 --- a/packages/flutter_tools/lib/src/commands/build_apk.dart +++ b/packages/flutter_tools/lib/src/commands/build_apk.dart @@ -137,6 +137,7 @@ class BuildApkCommand extends BuildSubCommand { @override Future runCommand() async { + await super.runCommand(); if (globals.androidSdk == null) { exitWithNoSdkMessage(); } diff --git a/packages/flutter_tools/lib/src/commands/build_appbundle.dart b/packages/flutter_tools/lib/src/commands/build_appbundle.dart index 6efb317e73..cd6cfe8666 100644 --- a/packages/flutter_tools/lib/src/commands/build_appbundle.dart +++ b/packages/flutter_tools/lib/src/commands/build_appbundle.dart @@ -138,6 +138,8 @@ class BuildAppBundleCommand extends BuildSubCommand { @override Future runCommand() async { + await super.runCommand(); + if (globals.androidSdk == null) { exitWithNoSdkMessage(); } diff --git a/packages/flutter_tools/lib/src/commands/build_ios.dart b/packages/flutter_tools/lib/src/commands/build_ios.dart index 5d4928c7ac..741b25408d 100644 --- a/packages/flutter_tools/lib/src/commands/build_ios.dart +++ b/packages/flutter_tools/lib/src/commands/build_ios.dart @@ -726,6 +726,7 @@ abstract class _BuildIOSSubCommand extends BuildSubCommand { @override Future runCommand() async { + await super.runCommand(); defaultBuildMode = environmentType == EnvironmentType.simulator ? BuildMode.debug : BuildMode.release; final BuildInfo buildInfo = await cachedBuildInfo; diff --git a/packages/flutter_tools/lib/src/flutter_manifest.dart b/packages/flutter_tools/lib/src/flutter_manifest.dart index ae655e768e..44877d3ca9 100644 --- a/packages/flutter_tools/lib/src/flutter_manifest.dart +++ b/packages/flutter_tools/lib/src/flutter_manifest.dart @@ -629,6 +629,8 @@ void _validateFlutter(YamlMap? yaml, List errors) { errors.addAll(pluginErrors); case 'generate': break; + case 'assets-filter': + break; case 'deferred-components': _validateDeferredComponents(kvp, errors); case 'disable-swift-package-manager': diff --git a/packages/flutter_tools/lib/src/run_hot.dart b/packages/flutter_tools/lib/src/run_hot.dart index 011c6e5d73..c0d6a5bac5 100644 --- a/packages/flutter_tools/lib/src/run_hot.dart +++ b/packages/flutter_tools/lib/src/run_hot.dart @@ -14,6 +14,7 @@ import 'base/context.dart'; import 'base/file_system.dart'; import 'base/logger.dart'; import 'base/platform.dart'; +import 'base/process.dart'; import 'base/utils.dart'; import 'build_info.dart'; import 'compile.dart'; @@ -382,6 +383,12 @@ class HotRunner extends ResidentRunner { final Uri? nativeAssetsYaml = _nativeAssetsYamlFile != null ? globals.fs.path.toUri(_nativeAssetsYamlFile) : null; + final RunResult? ret = await executePrebuildScript(fullRestart: false); + if ((ret?.exitCode ?? 0) != 0) { + globals.printError('Prebuild script execution failed in run() !!! $ret'); + return 1; + } + final Stopwatch appStartedTimer = Stopwatch()..start(); final File mainFile = globals.fs.file(mainPath); @@ -771,6 +778,14 @@ class HotRunner extends ResidentRunner { return OperationResult(1, 'Device initialization has not completed.'); } await _calculateTargetPlatform(); + + final RunResult? ret = await executePrebuildScript(fullRestart: false); + if ((ret?.exitCode ?? 0) != 0) { + const String errorMsg = 'Prebuild script execution failed in restart() !!!'; + globals.printError(errorMsg); + return OperationResult(1, errorMsg); + } + final Stopwatch timer = Stopwatch()..start(); // Run source generation if needed.