Revert "if chains → switch expressions" (#148556)

Reverts flutter/flutter#147793

Introduced https://github.com/flutter/flutter/issues/148548.
This commit is contained in:
Zachary Anderson
2024-05-17 10:27:02 -07:00
committed by GitHub
parent 3695802295
commit 597462a3c4
33 changed files with 297 additions and 194 deletions

View File

@@ -123,10 +123,13 @@ class _SnackBarExampleState extends State<SnackBarExample> {
const Text('Multi Line Text'),
Switch(
value: _multiLine,
onChanged: switch (_snackBarBehavior) {
SnackBarBehavior.fixed || null => null,
SnackBarBehavior.floating => (bool value) => setState(() { _multiLine = !_multiLine; }),
},
onChanged: _snackBarBehavior == SnackBarBehavior.fixed
? null
: (bool value) {
setState(() {
_multiLine = !_multiLine;
});
},
),
],
),
@@ -136,10 +139,13 @@ class _SnackBarExampleState extends State<SnackBarExample> {
value: _sliderValue,
divisions: 20,
label: _sliderValue.toStringAsFixed(2),
onChanged: switch (_snackBarBehavior) {
SnackBarBehavior.fixed || null => null,
SnackBarBehavior.floating => (double value) => setState(() { _sliderValue = value; }),
},
onChanged: _snackBarBehavior == SnackBarBehavior.fixed
? null
: (double value) {
setState(() {
_sliderValue = value;
});
},
),
]),
const SizedBox(height: 16.0),