44 lines
1.3 KiB
Dart
44 lines
1.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
class MediumSizedContainer extends StatefulWidget {
|
|
|
|
const MediumSizedContainer({super.key, bool isItVeryLargeScreen = false});
|
|
|
|
@override
|
|
State<StatefulWidget> createState() => MediumSizedContainerState();
|
|
}
|
|
|
|
class MediumSizedContainerState extends State<StatefulWidget> {
|
|
int _selectedIndex = 0;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return NavigationRail(
|
|
selectedIndex: 0,
|
|
destinations: getDestinations<NavigationRailDestination>(
|
|
(selectedIcon, regularIcon, label) => NavigationRailDestination(
|
|
selectedIcon: selectedIcon,
|
|
icon: regularIcon,
|
|
label: Text(label))),
|
|
extended: true,);
|
|
}
|
|
}
|
|
|
|
typedef ItemCreator<T> = T Function(Icon selectedIcon, Icon icon, String label);
|
|
|
|
List<T> getDestinations<T>(ItemCreator<T> creator) {
|
|
T overview = creator(
|
|
const Icon(Icons.timer), const Icon(Icons.timer_outlined), 'Timers');
|
|
|
|
T triggers = creator(const Icon(Icons.alarm_add),
|
|
const Icon(Icons.alarm_add_outlined), 'Triggers');
|
|
|
|
T logs = creator(const Icon(Icons.assignment),
|
|
const Icon(Icons.assignment_outlined), 'Logs');
|
|
|
|
T settings = creator(const Icon(Icons.settings),
|
|
const Icon(Icons.settings_outlined), 'Settings');
|
|
|
|
return [overview, triggers, logs, settings];
|
|
}
|