Unverified Commit a5299065 authored by Mehmet Fidanboylu's avatar Mehmet Fidanboylu Committed by GitHub

Allow option switches to have keys in Gallery (#20740)

* Allow option switches to have keys

* Review comments
parent f688b0d5
...@@ -115,11 +115,13 @@ class _OptionsItem extends StatelessWidget { ...@@ -115,11 +115,13 @@ class _OptionsItem extends StatelessWidget {
} }
class _BooleanItem extends StatelessWidget { class _BooleanItem extends StatelessWidget {
const _BooleanItem(this.title, this.value, this.onChanged); const _BooleanItem(this.title, this.value, this.onChanged, { this.switchKey });
final String title; final String title;
final bool value; final bool value;
final ValueChanged<bool> onChanged; final ValueChanged<bool> onChanged;
// [switchKey] is used for accessing the switch from driver tests.
final Key switchKey;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -129,6 +131,7 @@ class _BooleanItem extends StatelessWidget { ...@@ -129,6 +131,7 @@ class _BooleanItem extends StatelessWidget {
children: <Widget>[ children: <Widget>[
new Expanded(child: new Text(title)), new Expanded(child: new Text(title)),
new Switch( new Switch(
key: switchKey,
value: value, value: value,
onChanged: onChanged, onChanged: onChanged,
activeColor: const Color(0xFF39CEFD), activeColor: const Color(0xFF39CEFD),
...@@ -217,6 +220,7 @@ class _ThemeItem extends StatelessWidget { ...@@ -217,6 +220,7 @@ class _ThemeItem extends StatelessWidget {
), ),
); );
}, },
switchKey: const Key('dark_theme'),
); );
} }
} }
...@@ -285,6 +289,7 @@ class _TextDirectionItem extends StatelessWidget { ...@@ -285,6 +289,7 @@ class _TextDirectionItem extends StatelessWidget {
), ),
); );
}, },
switchKey: const Key('text_direction'),
); );
} }
} }
...@@ -307,6 +312,7 @@ class _TimeDilationItem extends StatelessWidget { ...@@ -307,6 +312,7 @@ class _TimeDilationItem extends StatelessWidget {
), ),
); );
}, },
switchKey: const Key('slow_motion'),
); );
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment