Unverified Commit 144e21b3 authored by Darren Austin's avatar Darren Austin Committed by GitHub

ReorderableListView should treat fuchsia as a mobile platform. (#84393)

parent 0347c533
...@@ -421,7 +421,6 @@ class _ReorderableListViewState extends State<ReorderableListView> { ...@@ -421,7 +421,6 @@ class _ReorderableListViewState extends State<ReorderableListView> {
if (widget.buildDefaultDragHandles) { if (widget.buildDefaultDragHandles) {
switch (Theme.of(context).platform) { switch (Theme.of(context).platform) {
case TargetPlatform.fuchsia:
case TargetPlatform.linux: case TargetPlatform.linux:
case TargetPlatform.windows: case TargetPlatform.windows:
case TargetPlatform.macOS: case TargetPlatform.macOS:
...@@ -470,6 +469,7 @@ class _ReorderableListViewState extends State<ReorderableListView> { ...@@ -470,6 +469,7 @@ class _ReorderableListViewState extends State<ReorderableListView> {
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.android: case TargetPlatform.android:
case TargetPlatform.fuchsia:
return ReorderableDelayedDragStartListener( return ReorderableDelayedDragStartListener(
key: itemGlobalKey, key: itemGlobalKey,
index: index, index: index,
......
...@@ -1366,6 +1366,20 @@ void main() { ...@@ -1366,6 +1366,20 @@ void main() {
}); });
// TODO(djshuckerow): figure out how to write a test for scrolling the list. // TODO(djshuckerow): figure out how to write a test for scrolling the list.
testWidgets('ReorderableListView on desktop platforms should have drag handles', (WidgetTester tester) async {
await tester.pumpWidget(build());
// All four items should have drag handles and not delayed listeners.
expect(find.byIcon(Icons.drag_handle), findsNWidgets(4));
expect(find.byType(ReorderableDelayedDragStartListener), findsNothing);
}, variant: TargetPlatformVariant.desktop());
testWidgets('ReorderableListView on mobile platforms should not have drag handles', (WidgetTester tester) async {
await tester.pumpWidget(build());
// All four items should have delayed listeners and not drag handles.
expect(find.byType(ReorderableDelayedDragStartListener), findsNWidgets(4));
expect(find.byIcon(Icons.drag_handle), findsNothing);
}, variant: TargetPlatformVariant.mobile());
testWidgets('Vertical list renders drag handle in correct position', (WidgetTester tester) async { testWidgets('Vertical list renders drag handle in correct position', (WidgetTester tester) async {
await tester.pumpWidget(build(platform: TargetPlatform.macOS)); await tester.pumpWidget(build(platform: TargetPlatform.macOS));
final Finder listView = find.byType(ReorderableListView); final Finder listView = find.byType(ReorderableListView);
......
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