mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
![]() This PR fixes #92525 and introduces the following changes according to [latest iOS HIG](https://developer.apple.com/design/human-interface-guidelines/buttons#iOS-iPadOS): - `CupertinoButton` now has a `size` property (type `enum CupertinoButtonSize`, values sm/md/lg, default `lg`) that allows the devs to apply new iOS 15+ button styles - Previously `CupertinoButton` had a larger padding when no background color was specified. With the new HIG, that is no longer the case - `CupertinoButton` now has a `.tinted` constructor that renders a translucent background (transparency % is brightness-dependent) and uses a different foreground color compared to `.filled` - `CupertinoButton` now uses the `actionTextStyle` TextStyle from the given theme - `CupertinoButton`'s child IconTheme's size will always be x1.2 the given TextStyle's size - `CupertinoTextThemeData` now has a `actionSmallTextStyle` property to use with small buttons (including a default `_kDefaultActionSmallTextStyle` TextStyle) Preview & example:  > **NOTE**: there is a discrepancy in dark mode button foreground color between the default CupertinoTheme and the HIG. A separate issue will be opened for this. ~EDIT: issue reported here https://github.com/flutter/flutter/issues/152846~ EDIT2: fixed by #153039 !  ## Example ```dart import 'package:flutter/cupertino.dart'; const Widget body = Row( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Icon( CupertinoIcons.play_fill, ), Text("Play"), ], ); void main() => runApp( CupertinoApp( home: Container( child: Wrap( direction: Axis.horizontal, children: <Widget>[ // header Text(''), Text('Plain'), Text('Grey'), Text('Tinted'), Text('Filled'), // small Text('Small'), CupertinoButton( child: body, onPressed: () {}, size: CupertinoButtonSize.small, ), CupertinoButton.tinted( child: body, onPressed: () {}, size: CupertinoButtonSize.small, color: CupertinoColors.systemGrey, ), CupertinoButton.tinted( child: body, onPressed: () {}, size: CupertinoButtonSize.small, ), CupertinoButton.filled( child: body, onPressed: () {}, size: CupertinoButtonSize.small, ), // medium Text('Medium'), CupertinoButton( child: body, onPressed: () {}, size: CupertinoButtonSize.medium, ), CupertinoButton.tinted( child: body, onPressed: () {}, size: CupertinoButtonSize.medium, color: CupertinoColors.systemGrey, ), CupertinoButton.tinted( child: body, onPressed: () {}, size: CupertinoButtonSize.medium, ), CupertinoButton.filled( child: body, onPressed: () {}, size: CupertinoButtonSize.medium, ), // large Text('Large'), CupertinoButton( child: body, onPressed: () {}, size: CupertinoButtonSize.large, ), CupertinoButton.tinted( child: body, onPressed: () {}, color: CupertinoColors.systemGrey, size: CupertinoButtonSize.large, ), CupertinoButton.tinted( child: body, onPressed: () {}, size: CupertinoButtonSize.large, ), CupertinoButton.filled( child: body, onPressed: () {}, size: CupertinoButtonSize.large, ), ].map((Widget w) => SizedBox(width: 110, height: 70, child: Center(child: w))).toList(), ), ) ), ); ``` *List which issues are fixed by this PR. You must list at least one issue. An issue is not required if the PR fixes something trivial like a typo.* *If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].* |
||
---|---|---|
.. | ||
about | ||
action_buttons | ||
action_chip | ||
animated_icon | ||
app | ||
app_bar | ||
autocomplete | ||
badge | ||
banner | ||
bottom_app_bar | ||
bottom_navigation_bar | ||
bottom_sheet | ||
button_style | ||
button_style_button | ||
card | ||
carousel | ||
checkbox | ||
checkbox_list_tile | ||
chip | ||
choice_chip | ||
color_scheme | ||
context_menu | ||
data_table | ||
date_picker | ||
dialog | ||
divider | ||
drawer | ||
dropdown | ||
dropdown_menu | ||
elevated_button | ||
expansion_panel | ||
expansion_tile | ||
filled_button | ||
filter_chip | ||
flexible_space_bar | ||
floating_action_button | ||
floating_action_button_location | ||
icon_button | ||
ink | ||
ink_well | ||
input_chip | ||
input_decorator | ||
list_tile | ||
material_state | ||
menu_anchor | ||
navigation_bar | ||
navigation_drawer | ||
navigation_rail | ||
outlined_button | ||
page_transitions_theme | ||
paginated_data_table | ||
platform_menu_bar | ||
popup_menu | ||
progress_indicator | ||
radio | ||
radio_list_tile | ||
range_slider | ||
refresh_indicator | ||
reorderable_list | ||
scaffold | ||
scrollbar | ||
search_anchor | ||
segmented_button | ||
selectable_region | ||
selection_area | ||
selection_container | ||
slider | ||
snack_bar | ||
stepper | ||
switch | ||
switch_list_tile | ||
tab_controller | ||
tabs | ||
text_button | ||
text_field | ||
text_form_field | ||
theme | ||
theme_data | ||
time_picker | ||
toggle_buttons | ||
tooltip |