diff --git a/CHANGELOG.md b/CHANGELOG.md index 657c21f66..5082b8f88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ * fix: `ProgressRing` and `ProgressBar` now fit correctly the parent bounds ([#942](https://github.com/bdlukaa/fluent_ui/issues/942)) * fix: `TabView` buttons was only rendered on hover. Now the buttons (add and scroll buttons) are always rendered. * fix: `ComboboxItem` correctly apply foreground color. Added `ComboboxItem.enabled` ([#949](https://github.com/bdlukaa/fluent_ui/issues/949)) +* Add a support for Cupertino Loclizations from GlobalCupertinoLocalizations, this can help fix some errors when using offical adaptive widgets and other cupertino widgets +* Upgrade the `scroll_pos` dependecy to the latest version which is 0.5.0 ## 4.7.6 diff --git a/lib/src/app.dart b/lib/src/app.dart index 220f7053d..1291871eb 100644 --- a/lib/src/app.dart +++ b/lib/src/app.dart @@ -1,6 +1,11 @@ import 'package:fluent_ui/fluent_ui.dart'; +import 'package:flutter/cupertino.dart' show CupertinoScrollbar; import 'package:flutter/material.dart' as m; -import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_localizations/flutter_localizations.dart' + show + GlobalMaterialLocalizations, + GlobalWidgetsLocalizations, + GlobalCupertinoLocalizations; /// An application that uses fluent design. /// @@ -379,17 +384,27 @@ class _FluentAppState extends State { _heroController = HeroController(); } - // Combine the Localizations for Material with the ones contributed - // by the localizationsDelegates parameter, if any. Only the first delegate - // of a particular LocalizationsDelegate.type is loaded so the - // localizationsDelegate parameter can be used to override - // _FluentLocalizationsDelegate. + /// Combine the Localizations for Material, Cupertino with the ones contributed + /// by the localizationsDelegates parameter, if any. Only the first delegate + /// of a particular LocalizationsDelegate.type is loaded so the + /// localizationsDelegate parameter can be used to override + /// _FluentLocalizationsDelegate. + /// + /// The default value for the localizationsDelegates + /// ``` + /// FluentLocalizations.delegate, + /// DefaultMaterialLocalizations.delegate, + /// DefaultCupertinoLocalizations.delegate, + /// DefaultWidgetsLocalizations.delegate + /// ``` Iterable> get _localizationsDelegates sync* { - if (widget.localizationsDelegates != null) { - yield* widget.localizationsDelegates!; + final localizationsDelegates = widget.localizationsDelegates; + if (localizationsDelegates != null) { + yield* localizationsDelegates; } yield FluentLocalizations.delegate; yield GlobalMaterialLocalizations.delegate; + yield GlobalCupertinoLocalizations.delegate; yield GlobalWidgetsLocalizations.delegate; } @@ -558,6 +573,9 @@ class _FluentAppState extends State { /// See also: /// /// * [ScrollBehavior], the default scrolling behavior extended by this class. +/// By default we will use [CupertinoScrollbar] for iOS and macOS platforms +/// for windows and Linux [Scrollbar] +/// for Android and Fuchsia we will return the child class FluentScrollBehavior extends ScrollBehavior { /// Creates a FluentScrollBehavior that decorates [Scrollable]s with /// [Scrollbar]s based on the current platform and provided [ScrollableDetails]. @@ -572,8 +590,13 @@ class FluentScrollBehavior extends ScrollBehavior { return child; case Axis.vertical: switch (getPlatform(context)) { - case TargetPlatform.linux: case TargetPlatform.macOS: + case TargetPlatform.iOS: + return CupertinoScrollbar( + controller: details.controller, + child: child, + ); + case TargetPlatform.linux: case TargetPlatform.windows: return Scrollbar( controller: details.controller, @@ -581,7 +604,6 @@ class FluentScrollBehavior extends ScrollBehavior { ); case TargetPlatform.android: case TargetPlatform.fuchsia: - case TargetPlatform.iOS: return child; } } diff --git a/pubspec.yaml b/pubspec.yaml index 3c5f4250f..c6393ad46 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -28,7 +28,7 @@ dependencies: scroll_pos: '>=0.5.0 < 1.0.0' # Used on icon generator - recase: ^4.0.0 + recase: ^4.1.0 # Used on NumberBox math_expressions: ^2.4.0