From 4a8b42b6b04c1c0c326762e6c612447304c08a7b Mon Sep 17 00:00:00 2001 From: Ahmed Elsayed Date: Sun, 16 Mar 2025 05:15:56 +0200 Subject: [PATCH 01/10] Update ci workflow to run on stable and master --- .github/workflows/build.yml | 10 +++++++--- pubspec.yaml | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 182b874..f0ff1f8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,15 +13,19 @@ jobs: build: name: Run flutter test and analyze runs-on: ubuntu-latest + strategy: + matrix: + channel: + - stable + - master steps: - name: Checkout repository uses: actions/checkout@v4 - name: Setup Flutter environment - uses: subosito/flutter-action@v2 + uses: subosito/flutter-action@v2.7.1 with: - channel: stable - flutter-version-file: pubspec.yaml # path to pubspec.yaml + channel: ${{ matrix.channel }} - name: Set environment paths run: | diff --git a/pubspec.yaml b/pubspec.yaml index 18699f5..2d70d2b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ publish_to: "none" environment: sdk: ">=3.2.0 <4.0.0" - flutter: 3.16.0 + flutter: ">=3.16.0" dev_dependencies: flutter_lints: ^4.0.0 From fbba886641c2b902b20bc88e3788dc47c808120c Mon Sep 17 00:00:00 2001 From: Ahmed Elsayed Date: Sun, 16 Mar 2025 05:35:26 +0200 Subject: [PATCH 02/10] Bump melos version --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 2d70d2b..c64eaeb 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -7,4 +7,4 @@ environment: dev_dependencies: flutter_lints: ^4.0.0 - melos: ^6.0.0 + melos: ^6.3.2 From 5d663dcfcf12413f323f0bc9aa88b0022ff47d20 Mon Sep 17 00:00:00 2001 From: Ahmed Elsayed Date: Sun, 16 Mar 2025 05:48:13 +0200 Subject: [PATCH 03/10] Temporarily Ignore master channel --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f0ff1f8..2329cb9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,7 +17,8 @@ jobs: matrix: channel: - stable - - master + # We'll add master after migrating to Melos 7.x.x and flutter workspaces + # - master steps: - name: Checkout repository uses: actions/checkout@v4 From 2a219c01d59106de3225bbaa02c22e16bc55ed83 Mon Sep 17 00:00:00 2001 From: Ahmed Elsayed Date: Sun, 16 Mar 2025 05:58:17 +0200 Subject: [PATCH 04/10] Remove deprecated package_api_docs rule --- analysis_options.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index c815239..1b253f5 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -119,7 +119,6 @@ linter: # - one_member_abstracts # too many false positives - only_throw_errors # this does get disabled in a few places where we have legacy code that uses strings et al - overridden_fields - - package_api_docs - package_names - package_prefixed_library_names # - parameter_assignments # we do this commonly From 670c2c84aab31a537727738ed1c324501fce5238 Mon Sep 17 00:00:00 2001 From: Ahmed Elsayed Date: Sun, 16 Mar 2025 05:58:45 +0200 Subject: [PATCH 05/10] Remove deprecated unsafe_html rule --- analysis_options.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index 1b253f5..2477a9b 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -201,7 +201,6 @@ linter: - unnecessary_this - unnecessary_to_list_in_spreads - unrelated_type_equality_checks - - unsafe_html - use_build_context_synchronously # - use_colored_box # not yet tested # - use_decorated_box # not yet tested From 8877f2c73fcc2133ef7ecf38b009f83fc4a8a1aa Mon Sep 17 00:00:00 2001 From: Ahmed Elsayed Date: Sun, 16 Mar 2025 06:21:39 +0200 Subject: [PATCH 06/10] Update SDK constraints --- melos.yaml | 4 ++-- packages/dropdown_button2/pubspec.yaml | 4 ++-- packages/dropdown_button2_test/pubspec.yaml | 4 ++-- pubspec.yaml | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/melos.yaml b/melos.yaml index 50f847f..11b854d 100644 --- a/melos.yaml +++ b/melos.yaml @@ -13,8 +13,8 @@ command: {new_package_versions} bootstrap: environment: - sdk: ">=3.2.0 <4.0.0" - flutter: ">=3.16.0" + sdk: ">=3.4.0 <4.0.0" + flutter: ">=3.22.0" scripts: lint:all: diff --git a/packages/dropdown_button2/pubspec.yaml b/packages/dropdown_button2/pubspec.yaml index abca238..73626d9 100644 --- a/packages/dropdown_button2/pubspec.yaml +++ b/packages/dropdown_button2/pubspec.yaml @@ -5,8 +5,8 @@ repository: https://github.com/AhmedLSayed9/dropdown_button2 issue_tracker: https://github.com/AhmedLSayed9/dropdown_button2/issues environment: - sdk: ">=3.2.0 <4.0.0" - flutter: ">=3.16.0" + sdk: ">=3.4.0 <4.0.0" + flutter: ">=3.22.0" dependencies: flutter: diff --git a/packages/dropdown_button2_test/pubspec.yaml b/packages/dropdown_button2_test/pubspec.yaml index 4dc811b..5f3f60d 100644 --- a/packages/dropdown_button2_test/pubspec.yaml +++ b/packages/dropdown_button2_test/pubspec.yaml @@ -2,8 +2,8 @@ name: dropdown_button2_test publish_to: none environment: - sdk: ">=3.2.0 <4.0.0" - flutter: ">=3.16.0" + sdk: ">=3.4.0 <4.0.0" + flutter: ">=3.22.0" dependencies: flutter: diff --git a/pubspec.yaml b/pubspec.yaml index c64eaeb..7b637a6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,8 +2,8 @@ name: dropdown_button2_workspace publish_to: "none" environment: - sdk: ">=3.2.0 <4.0.0" - flutter: ">=3.16.0" + sdk: ">=3.4.0 <4.0.0" + flutter: ">=3.22.0" dev_dependencies: flutter_lints: ^4.0.0 From ab1bbae59c5de5d2e94ea03988ccd45198a78c99 Mon Sep 17 00:00:00 2001 From: Ahmed Elsayed Date: Sun, 16 Mar 2025 06:25:37 +0200 Subject: [PATCH 07/10] Replace deprecated `MaterialStateProperty` with `WidgetStateProperty` --- README.md | 12 ++++++------ .../example/custom_dropdown_button2.dart | 4 ++-- packages/dropdown_button2/example/example.dart | 4 ++-- .../dropdown_button2/lib/src/button_style_data.dart | 6 +++--- .../dropdown_button2/lib/src/dropdown_button2.dart | 2 +- .../lib/src/dropdown_style_data.dart | 6 +++--- .../lib/src/few_styling_example.dart | 4 ++-- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index a4c99f2..53969c8 100644 --- a/README.md +++ b/README.md @@ -103,7 +103,7 @@ customize to your needs. | [padding](https://pub.dev/documentation/dropdown_button2/latest/dropdown_button2/ButtonStyleData/padding.html) | The inner padding of the Button | EdgeInsetsGeometry | No | | [decoration](https://pub.dev/documentation/dropdown_button2/latest/dropdown_button2/ButtonStyleData/decoration.html) | The decoration of the Button | BoxDecoration | No | | [elevation](https://pub.dev/documentation/dropdown_button2/latest/dropdown_button2/ButtonStyleData/elevation.html) | The elevation of the Button | int | No | -| [overlayColor](https://pub.dev/documentation/dropdown_button2/latest/dropdown_button2/ButtonStyleData/overlayColor.html) | Defines the ink response focus, hover, and splash colors for the button | MaterialStateProperty | No | +| [overlayColor](https://pub.dev/documentation/dropdown_button2/latest/dropdown_button2/ButtonStyleData/overlayColor.html) | Defines the ink response focus, hover, and splash colors for the button | WidgetStateProperty | No | #### Subclass IconStyleData: @@ -141,7 +141,7 @@ customize to your needs. | [padding](https://pub.dev/documentation/dropdown_button2/latest/dropdown_button2/MenuItemStyleData/padding.html) | The padding of menu items | EdgeInsetsGeometry | No | | [useDecorationHorizontalPadding](https://pub.dev/documentation/dropdown_button2/latest/dropdown_button2/MenuItemStyleData/useDecorationHorizontalPadding.html) | Determine whether to use the horizontal padding from "decoration.contentPadding" for menu items when using `DropdownButtonFormField2` | bool | No | | [borderRadius](https://pub.dev/documentation/dropdown_button2/latest/dropdown_button2/MenuItemStyleData/borderRadius.html) | The border radius of the menu item | BorderRadius | No | -| [overlayColor](https://pub.dev/documentation/dropdown_button2/latest/dropdown_button2/MenuItemStyleData/overlayColor.html) | Defines the ink response focus, hover, and splash colors for the items | MaterialStateProperty | No | +| [overlayColor](https://pub.dev/documentation/dropdown_button2/latest/dropdown_button2/MenuItemStyleData/overlayColor.html) | Defines the ink response focus, hover, and splash colors for the items | WidgetStateProperty | No | | [selectedMenuItemBuilder](https://pub.dev/documentation/dropdown_button2/latest/dropdown_button2/MenuItemStyleData/selectedMenuItemBuilder.html) | A builder to customize the selected menu item | SelectedMenuItemBuilder | No | #### Subclass DropdownSearchData: @@ -334,8 +334,8 @@ Widget build(BuildContext context) { offset: const Offset(-20, 0), scrollbarTheme: ScrollbarThemeData( radius: const Radius.circular(40), - thickness: MaterialStateProperty.all(6), - thumbVisibility: MaterialStateProperty.all(true), + thickness: WidgetStateProperty.all(6), + thumbVisibility: WidgetStateProperty.all(true), ), ), menuItemStyleData: const MenuItemStyleData( @@ -1151,10 +1151,10 @@ class CustomDropdownButton2 extends StatelessWidget { scrollbarTheme: ScrollbarThemeData( radius: scrollbarRadius ?? const Radius.circular(40), thickness: scrollbarThickness != null - ? MaterialStateProperty.all(scrollbarThickness!) + ? WidgetStateProperty.all(scrollbarThickness!) : null, thumbVisibility: scrollbarAlwaysShow != null - ? MaterialStateProperty.all(scrollbarAlwaysShow!) + ? WidgetStateProperty.all(scrollbarAlwaysShow!) : null, ), ), diff --git a/packages/dropdown_button2/example/custom_dropdown_button2.dart b/packages/dropdown_button2/example/custom_dropdown_button2.dart index 06fe032..d01916f 100644 --- a/packages/dropdown_button2/example/custom_dropdown_button2.dart +++ b/packages/dropdown_button2/example/custom_dropdown_button2.dart @@ -131,10 +131,10 @@ class CustomDropdownButton2 extends StatelessWidget { scrollbarTheme: ScrollbarThemeData( radius: scrollbarRadius ?? const Radius.circular(40), thickness: scrollbarThickness != null - ? MaterialStateProperty.all(scrollbarThickness!) + ? WidgetStateProperty.all(scrollbarThickness!) : null, thumbVisibility: scrollbarAlwaysShow != null - ? MaterialStateProperty.all(scrollbarAlwaysShow!) + ? WidgetStateProperty.all(scrollbarAlwaysShow!) : null, ), ), diff --git a/packages/dropdown_button2/example/example.dart b/packages/dropdown_button2/example/example.dart index 7c543eb..0cab4dc 100644 --- a/packages/dropdown_button2/example/example.dart +++ b/packages/dropdown_button2/example/example.dart @@ -117,8 +117,8 @@ class _MyHomePageState extends State { offset: const Offset(-20, 0), scrollbarTheme: ScrollbarThemeData( radius: const Radius.circular(40), - thickness: MaterialStateProperty.all(6), - thumbVisibility: MaterialStateProperty.all(true), + thickness: WidgetStateProperty.all(6), + thumbVisibility: WidgetStateProperty.all(true), ), ), menuItemStyleData: const MenuItemStyleData( diff --git a/packages/dropdown_button2/lib/src/button_style_data.dart b/packages/dropdown_button2/lib/src/button_style_data.dart index 9cf1b59..4f0f1e3 100644 --- a/packages/dropdown_button2/lib/src/button_style_data.dart +++ b/packages/dropdown_button2/lib/src/button_style_data.dart @@ -50,7 +50,7 @@ class ButtonStyleData extends _ButtonStyleDataBase { /// [splashColor]. If non-null, it is resolved against one of /// [MaterialState.focused], [MaterialState.hovered], and /// [MaterialState.pressed]. It's convenient to use when the parent - /// widget can pass along its own MaterialStateProperty value for + /// widget can pass along its own WidgetStateProperty value for /// the overlay color. /// /// [MaterialState.pressed] triggers a ripple (an ink splash), per @@ -67,7 +67,7 @@ class ButtonStyleData extends _ButtonStyleDataBase { /// * The Material Design specification for overlay colors and how they /// match a component's state: /// . - final MaterialStateProperty? overlayColor; + final WidgetStateProperty? overlayColor; /// Create a clone of the current [ButtonStyleData] but with the provided /// parameters overridden. @@ -78,7 +78,7 @@ class ButtonStyleData extends _ButtonStyleDataBase { BoxDecoration? decoration, BoxDecoration? foregroundDecoration, int? elevation, - MaterialStateProperty? overlayColor, + WidgetStateProperty? overlayColor, }) { return ButtonStyleData( height: height ?? this.height, diff --git a/packages/dropdown_button2/lib/src/dropdown_button2.dart b/packages/dropdown_button2/lib/src/dropdown_button2.dart index 5957935..92cfb06 100644 --- a/packages/dropdown_button2/lib/src/dropdown_button2.dart +++ b/packages/dropdown_button2/lib/src/dropdown_button2.dart @@ -877,7 +877,7 @@ class _DropdownButton2State extends State> } final MouseCursor effectiveMouseCursor = - MaterialStateProperty.resolveAs( + WidgetStateProperty.resolveAs( MaterialStateMouseCursor.clickable, { if (!_enabled) MaterialState.disabled, diff --git a/packages/dropdown_button2/lib/src/dropdown_style_data.dart b/packages/dropdown_button2/lib/src/dropdown_style_data.dart index 6be70a6..633798f 100644 --- a/packages/dropdown_button2/lib/src/dropdown_style_data.dart +++ b/packages/dropdown_button2/lib/src/dropdown_style_data.dart @@ -182,7 +182,7 @@ class MenuItemStyleData { /// [splashColor]. If non-null, it is resolved against one of /// [MaterialState.focused], [MaterialState.hovered], and /// [MaterialState.pressed]. It's convenient to use when the parent - /// widget can pass along its own MaterialStateProperty value for + /// widget can pass along its own WidgetStateProperty value for /// the overlay color. /// /// [MaterialState.pressed] triggers a ripple (an ink splash), per @@ -199,7 +199,7 @@ class MenuItemStyleData { /// * The Material Design specification for overlay colors and how they /// match a component's state: /// . - final MaterialStateProperty? overlayColor; + final WidgetStateProperty? overlayColor; /// A builder to customize the selected menu item. /// @@ -222,7 +222,7 @@ class MenuItemStyleData { MenuItemStyleData copyWith({ EdgeInsetsGeometry? padding, BorderRadius? borderRadius, - MaterialStateProperty? overlayColor, + WidgetStateProperty? overlayColor, SelectedMenuItemBuilder? selectedMenuItemBuilder, }) { return MenuItemStyleData( diff --git a/packages/dropdown_button2_test/lib/src/few_styling_example.dart b/packages/dropdown_button2_test/lib/src/few_styling_example.dart index 488c185..6736edb 100644 --- a/packages/dropdown_button2_test/lib/src/few_styling_example.dart +++ b/packages/dropdown_button2_test/lib/src/few_styling_example.dart @@ -101,8 +101,8 @@ class _FewStylingExampleState extends State { offset: const Offset(-20, 0), scrollbarTheme: ScrollbarThemeData( radius: const Radius.circular(40), - thickness: MaterialStateProperty.all(6), - thumbVisibility: MaterialStateProperty.all(true), + thickness: WidgetStateProperty.all(6), + thumbVisibility: WidgetStateProperty.all(true), ), ), menuItemStyleData: const MenuItemStyleData( From f704f2a19780007b23ddc2437ec66e89bb4694ed Mon Sep 17 00:00:00 2001 From: Ahmed Elsayed Date: Sun, 16 Mar 2025 06:26:36 +0200 Subject: [PATCH 08/10] Replace deprecated `MaterialState` with `WidgetState` --- packages/dropdown_button2/lib/src/button_style_data.dart | 6 +++--- packages/dropdown_button2/lib/src/dropdown_button2.dart | 6 +++--- packages/dropdown_button2/lib/src/dropdown_menu.dart | 6 +++--- packages/dropdown_button2/lib/src/dropdown_style_data.dart | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/dropdown_button2/lib/src/button_style_data.dart b/packages/dropdown_button2/lib/src/button_style_data.dart index 4f0f1e3..1e814d9 100644 --- a/packages/dropdown_button2/lib/src/button_style_data.dart +++ b/packages/dropdown_button2/lib/src/button_style_data.dart @@ -48,12 +48,12 @@ class ButtonStyleData extends _ButtonStyleDataBase { /// This default null property can be used as an alternative to /// [focusColor], [hoverColor], [highlightColor], and /// [splashColor]. If non-null, it is resolved against one of - /// [MaterialState.focused], [MaterialState.hovered], and - /// [MaterialState.pressed]. It's convenient to use when the parent + /// [WidgetState.focused], [WidgetState.hovered], and + /// [WidgetState.pressed]. It's convenient to use when the parent /// widget can pass along its own WidgetStateProperty value for /// the overlay color. /// - /// [MaterialState.pressed] triggers a ripple (an ink splash), per + /// [WidgetState.pressed] triggers a ripple (an ink splash), per /// the current Material Design spec. The [overlayColor] doesn't map /// a state to [highlightColor] because a separate highlight is not /// used by the current design guidelines. See diff --git a/packages/dropdown_button2/lib/src/dropdown_button2.dart b/packages/dropdown_button2/lib/src/dropdown_button2.dart index 92cfb06..7003046 100644 --- a/packages/dropdown_button2/lib/src/dropdown_button2.dart +++ b/packages/dropdown_button2/lib/src/dropdown_button2.dart @@ -878,9 +878,9 @@ class _DropdownButton2State extends State> final MouseCursor effectiveMouseCursor = WidgetStateProperty.resolveAs( - MaterialStateMouseCursor.clickable, - { - if (!_enabled) MaterialState.disabled, + WidgetStateMouseCursor.clickable, + { + if (!_enabled) WidgetState.disabled, }, ); diff --git a/packages/dropdown_button2/lib/src/dropdown_menu.dart b/packages/dropdown_button2/lib/src/dropdown_menu.dart index 12e3441..6a6964c 100644 --- a/packages/dropdown_button2/lib/src/dropdown_menu.dart +++ b/packages/dropdown_button2/lib/src/dropdown_menu.dart @@ -116,9 +116,9 @@ class _DropdownMenuState extends State<_DropdownMenu> { super.dispose(); } - final _states = { - MaterialState.dragged, - MaterialState.hovered, + final _states = { + WidgetState.dragged, + WidgetState.hovered, }; bool get _isIOS => Theme.of(context).platform == TargetPlatform.iOS; diff --git a/packages/dropdown_button2/lib/src/dropdown_style_data.dart b/packages/dropdown_button2/lib/src/dropdown_style_data.dart index 633798f..9d2b7c0 100644 --- a/packages/dropdown_button2/lib/src/dropdown_style_data.dart +++ b/packages/dropdown_button2/lib/src/dropdown_style_data.dart @@ -180,12 +180,12 @@ class MenuItemStyleData { /// This default null property can be used as an alternative to /// [focusColor], [hoverColor], [highlightColor], and /// [splashColor]. If non-null, it is resolved against one of - /// [MaterialState.focused], [MaterialState.hovered], and - /// [MaterialState.pressed]. It's convenient to use when the parent + /// [WidgetState.focused], [WidgetState.hovered], and + /// [WidgetState.pressed]. It's convenient to use when the parent /// widget can pass along its own WidgetStateProperty value for /// the overlay color. /// - /// [MaterialState.pressed] triggers a ripple (an ink splash), per + /// [WidgetState.pressed] triggers a ripple (an ink splash), per /// the current Material Design spec. The [overlayColor] doesn't map /// a state to [highlightColor] because a separate highlight is not /// used by the current design guidelines. See From e314f81a5f807c574dd9e3d9b8e79c693c600966 Mon Sep 17 00:00:00 2001 From: Ahmed Elsayed Date: Sun, 16 Mar 2025 06:27:29 +0200 Subject: [PATCH 09/10] Replace deprecated `withOpacity` with `withValues` --- packages/dropdown_button2/lib/src/dropdown_route.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/dropdown_button2/lib/src/dropdown_route.dart b/packages/dropdown_button2/lib/src/dropdown_route.dart index 53f8cb1..af409f0 100644 --- a/packages/dropdown_button2/lib/src/dropdown_route.dart +++ b/packages/dropdown_button2/lib/src/dropdown_route.dart @@ -490,7 +490,7 @@ class _CustomModalBarrierState extends State<_CustomModalBarrier> { super.initState(); color = widget.animation!.drive( ColorTween( - begin: widget.barrierColor?.withOpacity(0.0), + begin: widget.barrierColor?.withValues(alpha: 0.0), end: widget.barrierColor, ).chain(CurveTween(curve: widget.barrierCurve)), ); From 8fd31095eb252e66b838b0095ab44edb745e65be Mon Sep 17 00:00:00 2001 From: Ahmed Elsayed Date: Sun, 16 Mar 2025 06:28:36 +0200 Subject: [PATCH 10/10] Update Changelog --- packages/dropdown_button2/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/dropdown_button2/CHANGELOG.md b/packages/dropdown_button2/CHANGELOG.md index fdf2222..072b233 100644 --- a/packages/dropdown_button2/CHANGELOG.md +++ b/packages/dropdown_button2/CHANGELOG.md @@ -11,6 +11,7 @@ - Support helperStyle/helperMaxLines/errorMaxLines for DropdownButtonFormField2. - Add `MenuItemStyleData.useDecorationHorizontalPadding`, used to determine whether to use the horizontal padding from "decoration.contentPadding" for menu items when using `DropdownButtonFormField2`. - Use decoration hint text as the default value for dropdown button hints [Flutter core]. +- Update SDK constraints: ">=3.4.0 <4.0.0" ## 3.0.0-beta.21