build method
- @override
- BuildContext context,
- ViewsSidebarModel model
override
Builds the UI according to the state in model
.
Implementation
@override
Widget build(BuildContext context, ViewsSidebarModel model) => ListView(
children: [
ExpansionTile(
title: const Text("Presets"),
children: [
ReorderableListView(
shrinkWrap: true,
onReorder: models.views.swapPresets,
children: [
for (final preset in models.settings.dashboard.presets) ListTile(
key: ValueKey(preset.name),
title: Text(preset.name),
onTap: () => models.views.loadPreset(preset),
leading: IconButton(
onPressed: () => _deletePreset(context, preset),
icon: const Icon(Icons.remove_circle),
splashColor: Colors.blueGrey,
color: Colors.red,
),
),
],
),
ListTile(
title: const Text("Save current layout"),
onTap: () => _savePreset(context),
trailing: const Icon(Icons.save),
),
],
),
ExpansionTile(
title: const Text("Cameras"),
children: [
for (final view in DashboardView.cameraViews)
_buildDraggable(view, dragIcon: const Icon(Icons.camera_alt)),
],
),
ExpansionTile(
title: const Text("Controls"),
children: [
for (final view in DashboardView.uiViews) _buildDraggable(view),
],
),
_buildDraggable(DashboardView.blank),
],
);