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

This commit is contained in:
Darren Austin
2021-06-10 17:43:24 -07:00
committed by GitHub
parent 0347c533f1
commit 144e21b3cb
2 changed files with 15 additions and 1 deletions

View File

@@ -421,7 +421,6 @@ class _ReorderableListViewState extends State<ReorderableListView> {
if (widget.buildDefaultDragHandles) {
switch (Theme.of(context).platform) {
case TargetPlatform.fuchsia:
case TargetPlatform.linux:
case TargetPlatform.windows:
case TargetPlatform.macOS:
@@ -470,6 +469,7 @@ class _ReorderableListViewState extends State<ReorderableListView> {
case TargetPlatform.iOS:
case TargetPlatform.android:
case TargetPlatform.fuchsia:
return ReorderableDelayedDragStartListener(
key: itemGlobalKey,
index: index,

View File

@@ -1366,6 +1366,20 @@ void main() {
});
// 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 {
await tester.pumpWidget(build(platform: TargetPlatform.macOS));
final Finder listView = find.byType(ReorderableListView);