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

@@ -209,11 +209,13 @@ class ListItem extends StatelessWidget {
}
String _convertCountToStr(int count) {
return switch (count) {
< 10000 => count.toString(),
< 100000 => '${(count / 10000).toStringAsPrecision(2)}w',
_ => '${(count / 10000).floor()}w',
};
if (count < 10000) {
return count.toString();
} else if (count < 100000) {
return '${(count / 10000).toStringAsPrecision(2)}w';
} else {
return '${(count / 10000).floor()}w';
}
}
Widget _buildUserInfo() {

View File

@@ -31,11 +31,13 @@ class BenchBuildMaterialCheckbox extends WidgetBuildRecorder {
}
Row _buildRow() {
_isChecked = switch (_isChecked) {
null => true,
true => false,
false => null,
};
if (_isChecked == null) {
_isChecked = true;
} else if (_isChecked!) {
_isChecked = false;
} else {
_isChecked = null;
}
return Row(
children: List<Widget>.generate(10, (int i) {