Migrate android_semantics_testing to null safety (#84136)

This commit is contained in:
Michael Goderbauer
2021-06-07 13:53:08 -07:00
committed by GitHub
parent 3858cc655c
commit 0d1a8a7798
10 changed files with 91 additions and 83 deletions

View File

@@ -9,7 +9,7 @@ export 'controls_constants.dart';
/// A test page with a checkbox, three radio buttons, and a switch.
class SelectionControlsPage extends StatefulWidget {
const SelectionControlsPage({Key key}) : super(key: key);
const SelectionControlsPage({Key? key}) : super(key: key);
@override
State<StatefulWidget> createState() => _SelectionControlsPageState();
@@ -28,15 +28,15 @@ class _SelectionControlsPageState extends State<SelectionControlsPage> {
bool _isLabeledOn = false;
int _radio = 0;
void _updateCheckbox(bool newValue) {
void _updateCheckbox(bool? newValue) {
setState(() {
_isChecked = newValue;
_isChecked = newValue!;
});
}
void _updateRadio(int newValue) {
void _updateRadio(int? newValue) {
setState(() {
_radio = newValue;
_radio = newValue!;
});
}

View File

@@ -9,7 +9,7 @@ export 'headings_constants.dart';
/// A test page with an app bar and some body text for testing heading flags.
class HeadingsPage extends StatelessWidget {
const HeadingsPage({Key key}) : super(key: key);
const HeadingsPage({Key? key}) : super(key: key);
static const ValueKey<String> _appBarTitleKey = ValueKey<String>(appBarTitleKeyValue);
static const ValueKey<String> _bodyTextKey = ValueKey<String>(bodyTextKeyValue);

View File

@@ -10,7 +10,7 @@ export 'popup_constants.dart';
/// A page with a popup menu, a dropdown menu, and a modal alert.
class PopupControlsPage extends StatefulWidget {
const PopupControlsPage({Key key}) : super(key: key);
const PopupControlsPage({Key? key}) : super(key: key);
@override
State<StatefulWidget> createState() => _PopupControlsPageState();
@@ -22,7 +22,7 @@ class _PopupControlsPageState extends State<PopupControlsPage> {
final Key alertKey = const ValueKey<String>(alertKeyValue);
String popupValue = popupItems.first;
String dropdownValue = popupItems.first;
String? dropdownValue = popupItems.first;
@override
Widget build(BuildContext context) {
@@ -60,7 +60,7 @@ class _PopupControlsPageState extends State<PopupControlsPage> {
child: Text(item),
);
}).toList(),
onChanged: (String value) {
onChanged: (String? value) {
setState(() {
dropdownValue = value;
});

View File

@@ -10,7 +10,7 @@ export 'text_field_constants.dart';
/// A page with a normal text field and a password field.
class TextFieldPage extends StatefulWidget {
const TextFieldPage({Key key}) : super(key: key);
const TextFieldPage({Key? key}) : super(key: key);
@override
State<StatefulWidget> createState() => _TextFieldPageState();