From 3d2696fac431fa1aa7f10f3d56cc7a106c5df45c Mon Sep 17 00:00:00 2001 From: Matthias Ngeo Date: Thu, 12 Dec 2024 11:29:05 +0800 Subject: [PATCH] Upgrade to 3.27 --- .flutter-plugins | 6 +++ .flutter-plugins-dependencies | 1 + forui/example/android/app/build.gradle | 1 - forui/lib/src/foundation/util.dart | 47 ------------------- forui/lib/src/theme/color_scheme.dart | 4 +- .../src/widgets/accordion/accordion_item.dart | 4 +- forui/lib/src/widgets/card/card_content.dart | 7 +-- .../lib/src/widgets/header/nested_header.dart | 2 +- forui/lib/src/widgets/header/root_header.dart | 2 +- .../line_calendar/line_calendar_item.dart | 7 +-- forui/lib/src/widgets/sheet/modal_sheet.dart | 4 +- forui/lib/src/widgets/switch.dart | 4 +- .../src/widgets/text_field/text_field.dart | 2 +- forui/lib/src/widgets/tile/tile_content.dart | 7 ++- forui/tool/fetch_arb_files.dart | 3 +- 15 files changed, 25 insertions(+), 76 deletions(-) create mode 100644 .flutter-plugins create mode 100644 .flutter-plugins-dependencies delete mode 100644 forui/lib/src/foundation/util.dart diff --git a/.flutter-plugins b/.flutter-plugins new file mode 100644 index 000000000..d9c904cff --- /dev/null +++ b/.flutter-plugins @@ -0,0 +1,6 @@ +# This is a generated file; do not edit or check into version control. +path_provider=/Users/matthias/.pub-cache/hosted/pub.dev/path_provider-2.1.5/ +path_provider_android=/Users/matthias/.pub-cache/hosted/pub.dev/path_provider_android-2.2.15/ +path_provider_foundation=/Users/matthias/.pub-cache/hosted/pub.dev/path_provider_foundation-2.4.1/ +path_provider_linux=/Users/matthias/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/ +path_provider_windows=/Users/matthias/.pub-cache/hosted/pub.dev/path_provider_windows-2.3.0/ diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies new file mode 100644 index 000000000..9bed339c4 --- /dev/null +++ b/.flutter-plugins-dependencies @@ -0,0 +1 @@ +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"path_provider_foundation","path":"/Users/matthias/.pub-cache/hosted/pub.dev/path_provider_foundation-2.4.1/","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"android":[{"name":"path_provider_android","path":"/Users/matthias/.pub-cache/hosted/pub.dev/path_provider_android-2.2.15/","native_build":true,"dependencies":[]}],"macos":[{"name":"path_provider_foundation","path":"/Users/matthias/.pub-cache/hosted/pub.dev/path_provider_foundation-2.4.1/","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/Users/matthias/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/","native_build":false,"dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"/Users/matthias/.pub-cache/hosted/pub.dev/path_provider_windows-2.3.0/","native_build":false,"dependencies":[]}],"web":[]},"dependencyGraph":[{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2024-12-12 11:12:38.176563","version":"3.27.0","swift_package_manager_enabled":false} \ No newline at end of file diff --git a/forui/example/android/app/build.gradle b/forui/example/android/app/build.gradle index eae2929e5..346fa31e2 100644 --- a/forui/example/android/app/build.gradle +++ b/forui/example/android/app/build.gradle @@ -40,7 +40,6 @@ android { } defaultConfig { - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.foruslabs.forui.example" // You can update the following values to match your application needs. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. diff --git a/forui/lib/src/foundation/util.dart b/forui/lib/src/foundation/util.dart deleted file mode 100644 index 03416e5fe..000000000 --- a/forui/lib/src/foundation/util.dart +++ /dev/null @@ -1,47 +0,0 @@ -import 'package:flutter/widgets.dart'; - -// TODO: Remove this function once DefaultTextStyle.merge(...) exposes TextHeightBehavior? textHeightBehavior. - -/// Creates a default text style that overrides the text styles in scope at -/// this point in the widget tree. -/// -/// The given [style] is merged with the [style] from the default text style -/// for the [BuildContext] where the widget is inserted, and any of the other -/// arguments that are not null replace the corresponding properties on that -/// same default text style. -/// -/// This constructor cannot be used to override the [maxLines] property of the -/// ancestor with the value null, since null here is used to mean "defer to -/// ancestor". To replace a non-null [maxLines] from an ancestor with the null -/// value (to remove the restriction on number of lines), manually obtain the -/// ambient [DefaultTextStyle] using [DefaultTextStyle.of], then create a new -/// [DefaultTextStyle] using the [DefaultTextStyle.new] constructor directly. -/// See the source below for an example of how to do this (since that's -/// essentially what this constructor does). -Widget merge({ - required Widget child, - Key? key, - TextStyle? style, - TextAlign? textAlign, - bool? softWrap, - TextOverflow? overflow, - int? maxLines, - TextWidthBasis? textWidthBasis, - TextHeightBehavior? textHeightBehavior, -}) => - Builder( - builder: (context) { - final DefaultTextStyle parent = DefaultTextStyle.of(context); - return DefaultTextStyle( - key: key, - style: parent.style.merge(style), - textAlign: textAlign ?? parent.textAlign, - softWrap: softWrap ?? parent.softWrap, - overflow: overflow ?? parent.overflow, - maxLines: maxLines ?? parent.maxLines, - textWidthBasis: textWidthBasis ?? parent.textWidthBasis, - textHeightBehavior: textHeightBehavior ?? parent.textHeightBehavior, - child: child, - ); - }, - ); diff --git a/forui/lib/src/theme/color_scheme.dart b/forui/lib/src/theme/color_scheme.dart index c66112239..4427b4352 100644 --- a/forui/lib/src/theme/color_scheme.dart +++ b/forui/lib/src/theme/color_scheme.dart @@ -142,7 +142,7 @@ final class FColorScheme with Diagnosticable { /// /// [FColorScheme.background] is used if [background] is not given. Color hover(Color foreground, [Color? background]) => Color.alphaBlend( - foreground.withOpacity(enabledHoveredOpacity), + foreground.withValues(alpha: enabledHoveredOpacity), background ?? this.background, ); @@ -150,7 +150,7 @@ final class FColorScheme with Diagnosticable { /// /// [FColorScheme.background] is used if [background] is not given. Color disable(Color foreground, [Color? background]) => Color.alphaBlend( - foreground.withOpacity(disabledOpacity), + foreground.withValues(alpha: disabledOpacity), background ?? this.background, ); diff --git a/forui/lib/src/widgets/accordion/accordion_item.dart b/forui/lib/src/widgets/accordion/accordion_item.dart index 7cdf5a9b9..cc3c399ce 100644 --- a/forui/lib/src/widgets/accordion/accordion_item.dart +++ b/forui/lib/src/widgets/accordion/accordion_item.dart @@ -5,7 +5,6 @@ import 'package:flutter/rendering.dart'; import 'package:flutter/widgets.dart'; import 'package:forui/forui.dart'; -import 'package:forui/src/foundation/util.dart'; import 'package:forui/src/widgets/accordion/accordion.dart'; /// An interactive heading that reveals a section of content. @@ -124,8 +123,7 @@ class _FAccordionItemState extends State with TickerProviderStat child: Row( children: [ Expanded( - child: merge( - // TODO: replace with DefaultTextStyle.merge when textHeightBehavior has been added. + child: DefaultTextStyle.merge( textHeightBehavior: const TextHeightBehavior( applyHeightToFirstAscent: false, applyHeightToLastDescent: false, diff --git a/forui/lib/src/widgets/card/card_content.dart b/forui/lib/src/widgets/card/card_content.dart index aa34196b1..32626e747 100644 --- a/forui/lib/src/widgets/card/card_content.dart +++ b/forui/lib/src/widgets/card/card_content.dart @@ -4,7 +4,6 @@ import 'package:flutter/widgets.dart'; import 'package:meta/meta.dart'; import 'package:forui/forui.dart'; -import 'package:forui/src/foundation/util.dart'; @internal class Content extends StatelessWidget { @@ -39,8 +38,7 @@ class Content extends StatelessWidget { ), if ((title != null || subtitle != null || child != null) && image != null) const SizedBox(height: 10), if (title != null) - // TODO: replace with DefaultTextStyle.merge when textHeightBehavior has been added. - merge( + DefaultTextStyle.merge( textHeightBehavior: const TextHeightBehavior( applyHeightToFirstAscent: false, applyHeightToLastDescent: false, @@ -49,8 +47,7 @@ class Content extends StatelessWidget { child: title!, ), if (subtitle != null) - // TODO: replace with DefaultTextStyle.merge when textHeightBehavior has been added. - merge( + DefaultTextStyle.merge( textHeightBehavior: const TextHeightBehavior( applyHeightToFirstAscent: false, applyHeightToLastDescent: false, diff --git a/forui/lib/src/widgets/header/nested_header.dart b/forui/lib/src/widgets/header/nested_header.dart index 223c74c58..c9873a808 100644 --- a/forui/lib/src/widgets/header/nested_header.dart +++ b/forui/lib/src/widgets/header/nested_header.dart @@ -9,7 +9,7 @@ part of 'header.dart'; /// * https://forui.dev/docs/navigation/header for working examples. /// * [FNestedHeaderStyle] for customizing a header's appearance. final class _FNestedHeader extends FHeader { - /// The style. Defaults to [FThemeData.headerStyle.nestedStyle]. + /// The style. final FNestedHeaderStyle? style; /// The title, aligned to the center. diff --git a/forui/lib/src/widgets/header/root_header.dart b/forui/lib/src/widgets/header/root_header.dart index e15c4cf22..91fd16adb 100644 --- a/forui/lib/src/widgets/header/root_header.dart +++ b/forui/lib/src/widgets/header/root_header.dart @@ -9,7 +9,7 @@ part of 'header.dart'; /// * https://forui.dev/docs/navigation/header for working examples. /// * [FRootHeaderStyle] for customizing a header's appearance. final class _FRootHeader extends FHeader { - /// The header's style. Defaults to [FThemeData.headerStyle.rootStyle]. + /// The header's style. final FRootHeaderStyle? style; /// The title, aligned to the left in LTR locales. diff --git a/forui/lib/src/widgets/line_calendar/line_calendar_item.dart b/forui/lib/src/widgets/line_calendar/line_calendar_item.dart index ae5eb007f..7d65ed6c7 100644 --- a/forui/lib/src/widgets/line_calendar/line_calendar_item.dart +++ b/forui/lib/src/widgets/line_calendar/line_calendar_item.dart @@ -5,7 +5,6 @@ import 'package:flutter/widgets.dart'; import 'package:meta/meta.dart'; import 'package:forui/forui.dart'; -import 'package:forui/src/foundation/util.dart'; /// The state of a line calendar item used to build a line calendar item. typedef FLineCalendarItemData = ({ @@ -134,8 +133,7 @@ class ItemContent extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, mainAxisSize: MainAxisSize.min, children: [ - // TODO: replace with DefaultTextStyle.merge when textHeightBehavior has been added. - merge( + DefaultTextStyle.merge( textHeightBehavior: const TextHeightBehavior( applyHeightToFirstAscent: false, applyHeightToLastDescent: false, @@ -144,8 +142,7 @@ class ItemContent extends StatelessWidget { child: Text(localizations.day(date)), ), SizedBox(height: style.itemContentSpacing), - // TODO: replace with DefaultTextStyle.merge when textHeightBehavior has been added. - merge( + DefaultTextStyle.merge( textHeightBehavior: const TextHeightBehavior( applyHeightToFirstAscent: false, applyHeightToLastDescent: false, diff --git a/forui/lib/src/widgets/sheet/modal_sheet.dart b/forui/lib/src/widgets/sheet/modal_sheet.dart index 48891d05b..65e13ddd0 100644 --- a/forui/lib/src/widgets/sheet/modal_sheet.dart +++ b/forui/lib/src/widgets/sheet/modal_sheet.dart @@ -241,11 +241,11 @@ class FModalSheetRoute extends PopupRoute { @override Widget buildModalBarrier() { - if (barrierColor.alpha != 0 && !offstage) { + if (barrierColor.a != 0 && !offstage) { // changedInternalState is called if barrierColor or offstage updates final color = animation!.drive( ColorTween( - begin: barrierColor.withOpacity(0.0), + begin: barrierColor.withValues(alpha: 0.0), end: barrierColor, // changedInternalState is called if barrierColor updates ).chain(CurveTween(curve: barrierCurve)), // changedInternalState is called if barrierCurve updates ); diff --git a/forui/lib/src/widgets/switch.dart b/forui/lib/src/widgets/switch.dart index 233b5f067..634750618 100644 --- a/forui/lib/src/widgets/switch.dart +++ b/forui/lib/src/widgets/switch.dart @@ -140,8 +140,8 @@ class FSwitch extends StatelessWidget { onChange?.call(value); }, applyTheme: false, - activeColor: switchStyle.checkedColor, - trackColor: switchStyle.uncheckedColor, + activeTrackColor: switchStyle.checkedColor, + inactiveTrackColor: switchStyle.uncheckedColor, thumbColor: switchStyle.thumbColor, focusColor: style.focusColor, autofocus: autofocus, diff --git a/forui/lib/src/widgets/text_field/text_field.dart b/forui/lib/src/widgets/text_field/text_field.dart index 1b591f1ed..84f6328fd 100644 --- a/forui/lib/src/widgets/text_field/text_field.dart +++ b/forui/lib/src/widgets/text_field/text_field.dart @@ -767,7 +767,7 @@ final class FTextField extends StatelessWidget { data: Theme.of(context).copyWith( textSelectionTheme: TextSelectionThemeData( cursorColor: style.cursorColor, - selectionColor: style.cursorColor.withOpacity(0.4), + selectionColor: style.cursorColor.withValues(alpha: 0.4), selectionHandleColor: style.cursorColor, ), cupertinoOverrideTheme: CupertinoThemeData( diff --git a/forui/lib/src/widgets/tile/tile_content.dart b/forui/lib/src/widgets/tile/tile_content.dart index 4f0e90720..6e0605263 100644 --- a/forui/lib/src/widgets/tile/tile_content.dart +++ b/forui/lib/src/widgets/tile/tile_content.dart @@ -5,7 +5,6 @@ import 'package:flutter/widgets.dart'; import 'package:meta/meta.dart'; import 'package:forui/forui.dart'; -import 'package:forui/src/foundation/util.dart'; import 'package:forui/src/widgets/tile/tile_group.dart'; import 'package:forui/src/widgets/tile/tile_render_object.dart'; @@ -74,7 +73,7 @@ class FTileContent extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: [ - merge( + DefaultTextStyle.merge( style: style.titleTextStyle, textHeightBehavior: const TextHeightBehavior( applyHeightToFirstAscent: false, @@ -86,7 +85,7 @@ class FTileContent extends StatelessWidget { if (subtitle case final subtitle?) Padding( padding: EdgeInsets.only(top: contentStyle.titleSpacing), - child: merge( + child: DefaultTextStyle.merge( style: style.subtitleTextStyle, textHeightBehavior: const TextHeightBehavior( applyHeightToFirstAscent: false, @@ -100,7 +99,7 @@ class FTileContent extends StatelessWidget { ), ), if (details case final details?) - merge( + DefaultTextStyle.merge( style: style.detailsTextStyle, textHeightBehavior: const TextHeightBehavior( applyHeightToFirstAscent: false, diff --git a/forui/tool/fetch_arb_files.dart b/forui/tool/fetch_arb_files.dart index ac930eca3..b113dbb94 100644 --- a/forui/tool/fetch_arb_files.dart +++ b/forui/tool/fetch_arb_files.dart @@ -2,7 +2,6 @@ import 'dart:convert'; import 'dart:io'; -import 'package:collection/collection.dart'; import 'package:http/http.dart' as http; final pattern = RegExp(r'(widgets|material)_([\w_]+)\.arb'); @@ -21,7 +20,7 @@ Future main() async { (json.decode(response.body) as List) .map((file) => file['name'] as String) .map((file) => pattern.firstMatch(file)?.group(2)) - .whereNotNull() + .nonNulls .map((locale) => File('lib/l10n/f_$locale.arb')) .where((arb) => !arb.existsSync()) .forEach(