Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,20 @@ jobs:
build:
name: Run flutter test and analyze
runs-on: ubuntu-latest
strategy:
matrix:
channel:
- stable
# We'll add master after migrating to Melos 7.x.x and flutter workspaces
# - 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: |
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<Color?> | 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<Color?> | No |

#### Subclass IconStyleData:

Expand Down Expand Up @@ -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<Color?> | 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<Color?> | 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:
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -1151,10 +1151,10 @@ class CustomDropdownButton2 extends StatelessWidget {
scrollbarTheme: ScrollbarThemeData(
radius: scrollbarRadius ?? const Radius.circular(40),
thickness: scrollbarThickness != null
? MaterialStateProperty.all<double>(scrollbarThickness!)
? WidgetStateProperty.all<double>(scrollbarThickness!)
: null,
thumbVisibility: scrollbarAlwaysShow != null
? MaterialStateProperty.all<bool>(scrollbarAlwaysShow!)
? WidgetStateProperty.all<bool>(scrollbarAlwaysShow!)
: null,
),
),
Expand Down
2 changes: 0 additions & 2 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -202,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
Expand Down
4 changes: 2 additions & 2 deletions melos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions packages/dropdown_button2/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@ class CustomDropdownButton2 extends StatelessWidget {
scrollbarTheme: ScrollbarThemeData(
radius: scrollbarRadius ?? const Radius.circular(40),
thickness: scrollbarThickness != null
? MaterialStateProperty.all<double>(scrollbarThickness!)
? WidgetStateProperty.all<double>(scrollbarThickness!)
: null,
thumbVisibility: scrollbarAlwaysShow != null
? MaterialStateProperty.all<bool>(scrollbarAlwaysShow!)
? WidgetStateProperty.all<bool>(scrollbarAlwaysShow!)
: null,
),
),
Expand Down
4 changes: 2 additions & 2 deletions packages/dropdown_button2/example/example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ class _MyHomePageState extends State<MyHomePage> {
offset: const Offset(-20, 0),
scrollbarTheme: ScrollbarThemeData(
radius: const Radius.circular(40),
thickness: MaterialStateProperty.all<double>(6),
thumbVisibility: MaterialStateProperty.all<bool>(true),
thickness: WidgetStateProperty.all<double>(6),
thumbVisibility: WidgetStateProperty.all<bool>(true),
),
),
menuItemStyleData: const MenuItemStyleData(
Expand Down
12 changes: 6 additions & 6 deletions packages/dropdown_button2/lib/src/button_style_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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
/// widget can pass along its own MaterialStateProperty value for
/// [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
Expand All @@ -67,7 +67,7 @@ class ButtonStyleData extends _ButtonStyleDataBase {
/// * The Material Design specification for overlay colors and how they
/// match a component's state:
/// <https://material.io/design/interaction/states.html#anatomy>.
final MaterialStateProperty<Color?>? overlayColor;
final WidgetStateProperty<Color?>? overlayColor;

/// Create a clone of the current [ButtonStyleData] but with the provided
/// parameters overridden.
Expand All @@ -78,7 +78,7 @@ class ButtonStyleData extends _ButtonStyleDataBase {
BoxDecoration? decoration,
BoxDecoration? foregroundDecoration,
int? elevation,
MaterialStateProperty<Color?>? overlayColor,
WidgetStateProperty<Color?>? overlayColor,
}) {
return ButtonStyleData(
height: height ?? this.height,
Expand Down
8 changes: 4 additions & 4 deletions packages/dropdown_button2/lib/src/dropdown_button2.dart
Original file line number Diff line number Diff line change
Expand Up @@ -877,10 +877,10 @@ class _DropdownButton2State<T> extends State<DropdownButton2<T>>
}

final MouseCursor effectiveMouseCursor =
MaterialStateProperty.resolveAs<MouseCursor>(
MaterialStateMouseCursor.clickable,
<MaterialState>{
if (!_enabled) MaterialState.disabled,
WidgetStateProperty.resolveAs<MouseCursor>(
WidgetStateMouseCursor.clickable,
<WidgetState>{
if (!_enabled) WidgetState.disabled,
},
);

Expand Down
6 changes: 3 additions & 3 deletions packages/dropdown_button2/lib/src/dropdown_menu.dart
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ class _DropdownMenuState<T> extends State<_DropdownMenu<T>> {
super.dispose();
}

final _states = <MaterialState>{
MaterialState.dragged,
MaterialState.hovered,
final _states = <WidgetState>{
WidgetState.dragged,
WidgetState.hovered,
};

bool get _isIOS => Theme.of(context).platform == TargetPlatform.iOS;
Expand Down
2 changes: 1 addition & 1 deletion packages/dropdown_button2/lib/src/dropdown_route.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
);
Expand Down
12 changes: 6 additions & 6 deletions packages/dropdown_button2/lib/src/dropdown_style_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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
/// widget can pass along its own MaterialStateProperty value for
/// [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
Expand All @@ -199,7 +199,7 @@ class MenuItemStyleData {
/// * The Material Design specification for overlay colors and how they
/// match a component's state:
/// <https://material.io/design/interaction/states.html#anatomy>.
final MaterialStateProperty<Color?>? overlayColor;
final WidgetStateProperty<Color?>? overlayColor;

/// A builder to customize the selected menu item.
///
Expand All @@ -222,7 +222,7 @@ class MenuItemStyleData {
MenuItemStyleData copyWith({
EdgeInsetsGeometry? padding,
BorderRadius? borderRadius,
MaterialStateProperty<Color?>? overlayColor,
WidgetStateProperty<Color?>? overlayColor,
SelectedMenuItemBuilder? selectedMenuItemBuilder,
}) {
return MenuItemStyleData(
Expand Down
4 changes: 2 additions & 2 deletions packages/dropdown_button2/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ class _FewStylingExampleState extends State<FewStylingExample> {
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(
Expand Down
4 changes: 2 additions & 2 deletions packages/dropdown_button2_test/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ 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
melos: ^6.0.0
melos: ^6.3.2
Loading