mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 13:58:47 +00:00
Replace ButtonBar with OverflowBar (#2072)
This PR replaces `ButtonBar` with `OverflowBar` in preparation of `ButtonBar` deprecation related to https://github.com/flutter/flutter/issues/127955 ## Pre-launch Checklist - [x] I read the [Flutter Style Guide] _recently_, and have followed its advice. - [x] I signed the [CLA]. - [x] I read the [Contributors Guide]. - [ ] I updated/added relevant documentation (doc comments with `///`). - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-devrel channel on [Discord]. <!-- Links --> [Flutter Style Guide]: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo [CLA]: https://cla.developers.google.com/ [Discord]: https://github.com/flutter/flutter/wiki/Chat [Contributors Guide]: https://github.com/flutter/samples/blob/main/CONTRIBUTING.md --------- Co-authored-by: Brett Morgan <brett.morgan@gmail.com>
This commit is contained in:
@@ -54,20 +54,24 @@ class InfiniteProcessPage extends StatelessWidget {
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
ButtonBar(
|
||||
alignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(elevation: 8.0),
|
||||
onPressed: () => controller.start(),
|
||||
child: const Text('Start'),
|
||||
),
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(elevation: 8.0),
|
||||
onPressed: () => controller.terminate(),
|
||||
child: const Text('Terminate'),
|
||||
),
|
||||
],
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: OverflowBar(
|
||||
spacing: 8.0,
|
||||
alignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(elevation: 8.0),
|
||||
onPressed: () => controller.start(),
|
||||
child: const Text('Start'),
|
||||
),
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(elevation: 8.0),
|
||||
onPressed: () => controller.terminate(),
|
||||
child: const Text('Terminate'),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
|
||||
@@ -440,26 +440,30 @@ class _AddPlaceButtonBar extends StatelessWidget {
|
||||
child: Container(
|
||||
padding: const EdgeInsets.fromLTRB(0.0, 0.0, 0.0, 14.0),
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: ButtonBar(
|
||||
alignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(foregroundColor: Colors.blue),
|
||||
onPressed: onSavePressed,
|
||||
child: const Text(
|
||||
'Save',
|
||||
style: TextStyle(color: Colors.white, fontSize: 16.0),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: OverflowBar(
|
||||
alignment: MainAxisAlignment.center,
|
||||
spacing: 8.0,
|
||||
children: [
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.blue,
|
||||
foregroundColor: Colors.white,
|
||||
),
|
||||
onPressed: onSavePressed,
|
||||
child: const Text('Save'),
|
||||
),
|
||||
),
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(foregroundColor: Colors.red),
|
||||
onPressed: onCancelPressed,
|
||||
child: const Text(
|
||||
'Cancel',
|
||||
style: TextStyle(color: Colors.white, fontSize: 16.0),
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.red,
|
||||
foregroundColor: Colors.white,
|
||||
),
|
||||
onPressed: onCancelPressed,
|
||||
child: const Text('Cancel'),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -484,46 +488,50 @@ class _CategoryButtonBar extends StatelessWidget {
|
||||
child: Container(
|
||||
padding: const EdgeInsets.fromLTRB(0.0, 0.0, 0.0, 14.0),
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: ButtonBar(
|
||||
alignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
FilledButton(
|
||||
style: FilledButton.styleFrom(
|
||||
backgroundColor:
|
||||
selectedPlaceCategory == PlaceCategory.favorite
|
||||
? Colors.green[700]
|
||||
: Colors.lightGreen),
|
||||
child: const Text(
|
||||
'Favorites',
|
||||
style: TextStyle(color: Colors.white, fontSize: 14.0),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: OverflowBar(
|
||||
alignment: MainAxisAlignment.center,
|
||||
spacing: 8.0,
|
||||
children: <Widget>[
|
||||
FilledButton(
|
||||
style: FilledButton.styleFrom(
|
||||
backgroundColor:
|
||||
selectedPlaceCategory == PlaceCategory.favorite
|
||||
? Colors.green[700]
|
||||
: Colors.lightGreen),
|
||||
onPressed: () => onChanged(PlaceCategory.favorite),
|
||||
child: const Text(
|
||||
'Favorites',
|
||||
style: TextStyle(color: Colors.white, fontSize: 14.0),
|
||||
),
|
||||
),
|
||||
onPressed: () => onChanged(PlaceCategory.favorite),
|
||||
),
|
||||
FilledButton(
|
||||
style: FilledButton.styleFrom(
|
||||
backgroundColor:
|
||||
selectedPlaceCategory == PlaceCategory.visited
|
||||
? Colors.green[700]
|
||||
: Colors.lightGreen),
|
||||
child: const Text(
|
||||
'Visited',
|
||||
style: TextStyle(color: Colors.white, fontSize: 14.0),
|
||||
FilledButton(
|
||||
style: FilledButton.styleFrom(
|
||||
backgroundColor:
|
||||
selectedPlaceCategory == PlaceCategory.visited
|
||||
? Colors.green[700]
|
||||
: Colors.lightGreen),
|
||||
onPressed: () => onChanged(PlaceCategory.visited),
|
||||
child: const Text(
|
||||
'Visited',
|
||||
style: TextStyle(color: Colors.white, fontSize: 14.0),
|
||||
),
|
||||
),
|
||||
onPressed: () => onChanged(PlaceCategory.visited),
|
||||
),
|
||||
FilledButton(
|
||||
style: FilledButton.styleFrom(
|
||||
backgroundColor:
|
||||
selectedPlaceCategory == PlaceCategory.wantToGo
|
||||
? Colors.green[700]
|
||||
: Colors.lightGreen),
|
||||
child: const Text(
|
||||
'Want To Go',
|
||||
style: TextStyle(color: Colors.white, fontSize: 14.0),
|
||||
FilledButton(
|
||||
style: FilledButton.styleFrom(
|
||||
backgroundColor:
|
||||
selectedPlaceCategory == PlaceCategory.wantToGo
|
||||
? Colors.green[700]
|
||||
: Colors.lightGreen),
|
||||
onPressed: () => onChanged(PlaceCategory.wantToGo),
|
||||
child: const Text(
|
||||
'Want To Go',
|
||||
style: TextStyle(color: Colors.white, fontSize: 14.0),
|
||||
),
|
||||
),
|
||||
onPressed: () => onChanged(PlaceCategory.wantToGo),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -38,8 +38,10 @@ declare -ar PROJECT_NAMES=(
|
||||
# TODO(DomesticMouse): Dart formatting required
|
||||
# "experimental/pedometer"
|
||||
# "experimental/pedometer/example"
|
||||
"experimental/varfont_shader_puzzle"
|
||||
"experimental/web_dashboard"
|
||||
# TODO(DomesticMouse): Dart formatting required
|
||||
# "experimental/varfont_shader_puzzle"
|
||||
# TODO(DomesticMouse): Because every version of flutter_test from sdk depends on intl 0.18.1 and web_dashboard depends on intl ^0.17.0, flutter_test from sdk is forbidden.
|
||||
# "experimental/web_dashboard"
|
||||
"flutter_maps_firestore"
|
||||
"form_app"
|
||||
"game_template"
|
||||
|
||||
Reference in New Issue
Block a user