Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
f4a64ef0
Unverified
Commit
f4a64ef0
authored
Aug 16, 2022
by
Taha Tesser
Committed by
GitHub
Aug 16, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix `CupertinoListTile``s onTap with delay throws exception (#109038)
parent
3bc49103
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
1 deletion
+43
-1
list_tile.dart
packages/flutter/lib/src/cupertino/list_tile.dart
+3
-1
list_tile_test.dart
packages/flutter/test/cupertino/list_tile_test.dart
+40
-0
No files found.
packages/flutter/lib/src/cupertino/list_tile.dart
View file @
f4a64ef0
...
@@ -385,7 +385,9 @@ class _CupertinoListTileState extends State<CupertinoListTile> {
...
@@ -385,7 +385,9 @@ class _CupertinoListTileState extends State<CupertinoListTile> {
onTapCancel:
()
=>
setState
(()
{
_tapped
=
false
;
}),
onTapCancel:
()
=>
setState
(()
{
_tapped
=
false
;
}),
onTap:
()
async
{
onTap:
()
async
{
await
widget
.
onTap
!();
await
widget
.
onTap
!();
setState
(()
{
_tapped
=
false
;
});
if
(
mounted
)
{
setState
(()
{
_tapped
=
false
;
});
}
},
},
behavior:
HitTestBehavior
.
opaque
,
behavior:
HitTestBehavior
.
opaque
,
child:
child
,
child:
child
,
...
...
packages/flutter/test/cupertino/list_tile_test.dart
View file @
f4a64ef0
...
@@ -479,4 +479,44 @@ void main() {
...
@@ -479,4 +479,44 @@ void main() {
expect
(
foundInfo
.
dx
>
foundTrailing
.
dx
,
isTrue
);
expect
(
foundInfo
.
dx
>
foundTrailing
.
dx
,
isTrue
);
});
});
});
});
testWidgets
(
'onTap with delay does not throw an exception'
,
(
WidgetTester
tester
)
async
{
const
Widget
title
=
Text
(
'CupertinoListTile'
);
bool
showTile
=
true
;
Future
<
void
>
onTap
()
async
{
showTile
=
false
;
await
Future
<
void
>.
delayed
(
const
Duration
(
seconds:
1
),
()
=>
showTile
=
true
,
);
}
Widget
buildCupertinoListTile
()
{
return
CupertinoApp
(
home:
CupertinoPageScaffold
(
child:
Center
(
child:
Column
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
<
Widget
>[
if
(
showTile
)
CupertinoListTile
(
onTap:
onTap
,
title:
title
,
),
],
),
),
),
);
}
await
tester
.
pumpWidget
(
buildCupertinoListTile
());
expect
(
showTile
,
isTrue
);
await
tester
.
tap
(
find
.
byType
(
CupertinoListTile
));
expect
(
showTile
,
isFalse
);
await
tester
.
pumpWidget
(
buildCupertinoListTile
());
await
tester
.
pumpAndSettle
(
const
Duration
(
seconds:
5
));
expect
(
tester
.
takeException
(),
null
);
});
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment