forked from fossasia/magic-epaper-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshow_layer_manager_dialog.dart
More file actions
30 lines (29 loc) · 921 Bytes
/
show_layer_manager_dialog.dart
File metadata and controls
30 lines (29 loc) · 921 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import 'package:flutter/material.dart';
import 'package:magic_epaper_app/draw_canvas/models/overlay_item.dart';
Widget buildLayerManagerDialog({
required List<OverlayItem> items,
required void Function(int oldIndex, int newIndex) onReorder,
required void Function(void Function()) setModalState,
}) {
return ReorderableListView(
onReorder: (oldIndex, newIndex) {
onReorder(oldIndex, newIndex);
setModalState(() {});
},
children: [
for (int i = 0; i < items.length; i++)
ListTile(
key: ValueKey(items[i].id),
title: Text(
items[i].type == 'text'
? items[i].text ?? 'Text Layer'
: items[i].label ?? 'Image Layer',
),
leading: Icon(
items[i].type == 'text' ? Icons.text_fields : Icons.image,
),
trailing: const Icon(Icons.drag_handle),
),
],
);
}