45 lines
1.3 KiB
Dart
45 lines
1.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
|
|
/// The modules a cashier needs. Deliberately excludes analytics — this
|
|
/// terminal is for billing, not back-office reporting.
|
|
enum PosModule {
|
|
pos('Point of Sale', 'POS', Icons.point_of_sale_rounded, NavSection.billing),
|
|
customers('Customers', 'Customers', Icons.people_alt_rounded,
|
|
NavSection.billing),
|
|
|
|
productImport('Product Import', 'Product Import',
|
|
Icons.cloud_download_rounded, NavSection.catalogue),
|
|
promos('Promotions', 'Promo', Icons.sell_rounded, NavSection.catalogue),
|
|
|
|
events('Events', 'Events', Icons.sync_rounded, NavSection.session),
|
|
settings('Settings', 'Settings', Icons.settings_rounded, NavSection.session);
|
|
|
|
const PosModule(this.title, this.label, this.icon, this.section);
|
|
|
|
/// Long form, shown in the page header.
|
|
final String title;
|
|
|
|
/// Short form, shown in the sidebar.
|
|
final String label;
|
|
|
|
final IconData icon;
|
|
final NavSection section;
|
|
}
|
|
|
|
/// Groups the navigation into labelled blocks.
|
|
enum NavSection {
|
|
billing('Billing'),
|
|
catalogue('Catalogue'),
|
|
session('Session');
|
|
|
|
const NavSection(this.label);
|
|
|
|
final String label;
|
|
|
|
List<PosModule> get modules =>
|
|
PosModule.values.where((m) => m.section == this).toList();
|
|
}
|
|
|
|
final activeModuleProvider = StateProvider<PosModule>((ref) => PosModule.pos);
|