Skip to content

Commit de1c0e4

Browse files
committed
remove semantics and update locators in demo-app with valueKey
1 parent c927678 commit de1c0e4

File tree

4 files changed

+8
-18
lines changed

4 files changed

+8
-18
lines changed

demo-app/lib/screens/double_and_long_tap_screen.dart

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,8 @@ class _LongPressScreenState extends State<LongPressScreen> {
139139
),
140140
Padding(
141141
padding: const EdgeInsets.all(18.0),
142-
child: Semantics(
143-
label: "long_press_button",
144-
explicitChildNodes: true,
145-
container: true,
146142
child: InkWell(
143+
key: const ValueKey("long_press_button"),
147144
onLongPress: () async {
148145
await _showLongPressPopup();
149146
},
@@ -160,7 +157,6 @@ class _LongPressScreenState extends State<LongPressScreen> {
160157
),
161158
),
162159
),
163-
),
164160
)
165161
],
166162
),

demo-app/lib/screens/drag_and_drop_screen.dart

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ class _DragAndDropScreenState extends State<DragAndDropScreen> {
4747
width: 100.0,
4848
color: Colors.cyan,
4949
child: const Center(
50+
key: ValueKey("drop_zone"),
5051
child: Text('Drop here'),
5152
),
5253
);
@@ -80,11 +81,8 @@ class _DragAndDropScreenState extends State<DragAndDropScreen> {
8081
curve: Curves.fastOutSlowIn,
8182
child: GestureDetector(
8283
onTap: () {},
83-
child: Semantics(
84-
label: "drag_me",
85-
explicitChildNodes: true,
86-
container: true,
8784
child: Draggable<int>(
85+
key: const ValueKey("drag_me"),
8886
onDragStarted: () {},
8987
onDragUpdate: (details) => {
9088
setState(() {
@@ -123,7 +121,6 @@ class _DragAndDropScreenState extends State<DragAndDropScreen> {
123121
),
124122
),
125123
),
126-
),
127124
),
128125
),
129126
],

demo-app/lib/screens/lazy_loading.dart

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,17 @@ class _LazyLoadingScreenState extends State<LazyLoadingScreen> {
4444
// textField: true,
4545
explicitChildNodes: true,
4646
container: true,
47-
child: const Text("Hello world"),
47+
child: const Text("Hello world",
48+
key: ValueKey("message_field")),
4849
)
4950
],
5051
const SizedBox(
5152
height: 30,
5253
),
5354
Padding(
5455
padding: const EdgeInsets.all(18.0),
55-
child: Semantics(
56-
label: "toggle_button",
57-
explicitChildNodes: true,
58-
container: true,
59-
child: InkWell(
56+
child: InkWell(
57+
key: const ValueKey("toggle_button"),
6058
onTap: !isLoading
6159
? () async {
6260
toggleMessage();
@@ -74,7 +72,6 @@ class _LazyLoadingScreenState extends State<LazyLoadingScreen> {
7472
)),
7573
),
7674
),
77-
),
7875
),
7976
const SizedBox(
8077
height: 100,

demo-app/lib/screens/login_screen.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,10 @@ class _LoginScreenState extends State<LoginScreen> {
7979
width: double.infinity,
8080
child: Semantics(
8181
label: "login_button",
82-
key: const Key("login_button"),
8382
explicitChildNodes: true,
8483
container: true,
8584
child: ElevatedButton(
85+
key: const ValueKey("LoginButton"),
8686
onPressed: () {
8787
_validateCredentials();
8888
},

0 commit comments

Comments
 (0)