diff --git a/flutter3.27.2.patch b/flutter3.27.2.patch new file mode 100644 index 0000000000..cbe27fde58 --- /dev/null +++ b/flutter3.27.2.patch @@ -0,0 +1,399 @@ +diff --git a/packages/flutter/lib/src/cupertino/dialog.dart b/packages/flutter/lib/src/cupertino/dialog.dart +index 56c0749386..0ca9673558 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 c8c7d3b2f3..fc53df7563 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 2392098ed6..d680f5950b 100644 +--- a/packages/flutter/lib/src/material/chip.dart ++++ b/packages/flutter/lib/src/material/chip.dart +@@ -2339,7 +2339,7 @@ class _UnconstrainedInkSplashFactory extends InteractiveInkFeatureFactory { + required TextDirection textDirection, + bool containedInkWell = false, + RectCallback? rectCallback, +- BorderRadius? borderRadius, ++ BorderRadiusGeometry? borderRadius, + ShapeBorder? customBorder, + double? radius, + VoidCallback? onRemoved, +@@ -2350,7 +2350,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 a44ad58e14..bd92bbb8fc 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, +@@ -73,7 +73,7 @@ class InkHighlight extends InteractiveInkFeature { + + final BoxShape _shape; + final double? _radius; +- final BorderRadius _borderRadius; ++ final BorderRadiusGeometry? _borderRadius; + final RectCallback? _rectCallback; + final TextDirection _textDirection; + +@@ -118,10 +118,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 ec20813520..112d9ec200 100644 +--- a/packages/flutter/lib/src/painting/gradient.dart ++++ b/packages/flutter/lib/src/painting/gradient.dart +@@ -227,7 +227,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. + /// +@@ -434,7 +434,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), +@@ -722,7 +722,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, +@@ -1008,7 +1008,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, _impliedStops(), tileMode, +diff --git a/packages/flutter/lib/src/painting/text_style.dart b/packages/flutter/lib/src/painting/text_style.dart +index 945e035f02..b884c80cad 100644 +--- a/packages/flutter/lib/src/painting/text_style.dart ++++ b/packages/flutter/lib/src/painting/text_style.dart +@@ -30,6 +30,11 @@ const String _kColorForegroundWarning = 'Cannot provide both a color and a foreg + 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; + +@@ -601,7 +606,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 0d1ec5bb5e..4d8f06bb4a 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 8ae6ec3baf..222a45d28a 100644 +--- a/packages/flutter_tools/lib/src/commands/build.dart ++++ b/packages/flutter_tools/lib/src/commands/build.dart +@@ -123,6 +123,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 ca34ad7305..0c02605be1 100644 +--- a/packages/flutter_tools/lib/src/commands/build_apk.dart ++++ b/packages/flutter_tools/lib/src/commands/build_apk.dart +@@ -129,6 +129,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 d0a6188293..a81b8f8333 100644 +--- a/packages/flutter_tools/lib/src/commands/build_appbundle.dart ++++ b/packages/flutter_tools/lib/src/commands/build_appbundle.dart +@@ -134,6 +134,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 3401776c52..5c287d55a0 100644 +--- a/packages/flutter_tools/lib/src/commands/build_ios.dart ++++ b/packages/flutter_tools/lib/src/commands/build_ios.dart +@@ -671,6 +671,8 @@ 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 537714826f..c45a71bea0 100644 +--- a/packages/flutter_tools/lib/src/flutter_manifest.dart ++++ b/packages/flutter_tools/lib/src/flutter_manifest.dart +@@ -543,6 +543,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 80b414ece2..e631ec9143 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'; +@@ -379,6 +380,12 @@ class HotRunner extends ResidentRunner { + ); + } + ++ 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); + +@@ -762,6 +769,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. diff --git a/packages/flutter/lib/src/cupertino/dialog.dart b/packages/flutter/lib/src/cupertino/dialog.dart index ccb068e870..54e82973df 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 2bbe2bab48..d20e552b91 100644 --- a/packages/flutter/lib/src/material/chip.dart +++ b/packages/flutter/lib/src/material/chip.dart @@ -2366,7 +2366,7 @@ class _UnconstrainedInkSplashFactory extends InteractiveInkFeatureFactory { required TextDirection textDirection, bool containedInkWell = false, RectCallback? rectCallback, - BorderRadius? borderRadius, + BorderRadiusGeometry? borderRadius, ShapeBorder? customBorder, double? radius, VoidCallback? onRemoved, @@ -2377,7 +2377,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..aacbc4dd4c 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 4fdeb11d04..e50f350cf0 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 0be2726cd4..c0a51587af 100644 --- a/packages/flutter_tools/lib/src/commands/build.dart +++ b/packages/flutter_tools/lib/src/commands/build.dart @@ -8,6 +8,8 @@ import '../android/android_sdk.dart'; import '../base/file_system.dart'; import '../base/logger.dart'; import '../base/os.dart'; +import '../base/process.dart'; +import '../build_info.dart'; import '../build_system/build_system.dart'; import '../commands/build_linux.dart'; import '../commands/build_macos.dart'; @@ -96,4 +98,13 @@ abstract class BuildSubCommand extends FlutterCommand { /// Whether this command is supported and should be shown. 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(); + } } diff --git a/packages/flutter_tools/lib/src/commands/build_apk.dart b/packages/flutter_tools/lib/src/commands/build_apk.dart index 656bb2b166..41e0a2b9d7 100644 --- a/packages/flutter_tools/lib/src/commands/build_apk.dart +++ b/packages/flutter_tools/lib/src/commands/build_apk.dart @@ -125,6 +125,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 938bd290fc..c4c0ff0828 100644 --- a/packages/flutter_tools/lib/src/commands/build_appbundle.dart +++ b/packages/flutter_tools/lib/src/commands/build_appbundle.dart @@ -114,6 +114,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 8d1e2eca9d..fa1ef99192 100644 --- a/packages/flutter_tools/lib/src/commands/build_ios.dart +++ b/packages/flutter_tools/lib/src/commands/build_ios.dart @@ -723,8 +723,9 @@ abstract class _BuildIOSSubCommand extends BuildSubCommand { @override Future runCommand() async { - defaultBuildMode = - environmentType == EnvironmentType.simulator ? BuildMode.debug : BuildMode.release; + await super.runCommand(); + + defaultBuildMode = environmentType == EnvironmentType.simulator ? BuildMode.debug : BuildMode.release; final BuildInfo buildInfo = await cachedBuildInfo; if (!supported) { diff --git a/packages/flutter_tools/lib/src/flutter_manifest.dart b/packages/flutter_tools/lib/src/flutter_manifest.dart index 0fe600cc3a..57772e8c46 100644 --- a/packages/flutter_tools/lib/src/flutter_manifest.dart +++ b/packages/flutter_tools/lib/src/flutter_manifest.dart @@ -608,6 +608,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 dcabe91249..bade762bd5 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'; @@ -383,6 +384,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); @@ -780,6 +787,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.