feat: add admin page

This commit is contained in:
2026-08-07 03:09:59 +02:00
parent 2c734493cf
commit 1dd7e69aa8
19 changed files with 891 additions and 65 deletions
+39 -39
View File
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:kooltab2/viewmodels/admin_pin_view_model.dart';
import 'package:kooltab2/viewmodels/pin_lock_view_model.dart';
import 'package:kooltab2/viewmodels/product_list_view_model.dart';
import 'package:kooltab2/views/dialogs/close_tab_dialog.dart';
@@ -52,9 +53,9 @@ class _BarScreenViewState extends State<BarScreenView> {
title: Text(l10n.barTabs),
actions: [
IconButton(
tooltip: l10n.manageProducts,
onPressed: () => context.push('/products'),
icon: const Icon(Icons.inventory_2_outlined),
tooltip: l10n.admin,
onPressed: () => context.push('/admin'),
icon: const Icon(Icons.admin_panel_settings_outlined),
),
const SizedBox(width: 6),
IconButton(
@@ -80,6 +81,7 @@ class _BarScreenViewState extends State<BarScreenView> {
tooltip: l10n.logout,
onPressed: () {
Provider.of<PinLockViewModel>(context, listen: false).lock();
Provider.of<AdminPinViewModel>(context, listen: false).lock();
},
icon: const Icon(Icons.logout),
),
@@ -230,9 +232,9 @@ class _ProductGrid extends StatelessWidget {
),
const SizedBox(height: 20),
FilledButton.icon(
onPressed: () => context.push('/products/new'),
icon: const Icon(Icons.add),
label: Text(l10n.addProduct),
onPressed: () => context.push('/admin'),
icon: const Icon(Icons.admin_panel_settings_outlined),
label: Text(l10n.admin),
),
],
),
@@ -323,8 +325,6 @@ class _ProductGrid extends StatelessWidget {
product: product,
enabled: hasSelectedTab,
onTap: () => onProductTap(product),
onLongPress: () =>
context.push('/products/${product.id}/edit'),
);
},
);
@@ -440,37 +440,37 @@ class _TabPanelState extends State<_TabPanel> {
],
),
const SizedBox(height: 18),
Row(
children: [
Text(
l10n.openTabs.toUpperCase(),
style: Theme.of(context).textTheme.bodySmall?.copyWith(
fontWeight: FontWeight.w700,
letterSpacing: 0.8,
),
),
const SizedBox(width: 8),
Container(
padding: const EdgeInsets.symmetric(
horizontal: 8,
vertical: 2,
),
decoration: BoxDecoration(
color: scheme.onSurface.withValues(alpha: 0.06),
borderRadius: BorderRadius.circular(999),
),
child: Text(
'${filteredTabs.length}',
style: Theme.of(context).textTheme.bodySmall?.copyWith(
fontWeight: FontWeight.w700,
),
),
),
],
),
//
// const SizedBox(height: 18),
//
// Row(
// children: [
// Text(
// l10n.openTabs.toUpperCase(),
// style: Theme.of(context).textTheme.bodySmall?.copyWith(
// fontWeight: FontWeight.w700,
// letterSpacing: 0.8,
// ),
// ),
// const SizedBox(width: 8),
// Container(
// padding: const EdgeInsets.symmetric(
// horizontal: 8,
// vertical: 2,
// ),
// decoration: BoxDecoration(
// color: scheme.onSurface.withValues(alpha: 0.06),
// borderRadius: BorderRadius.circular(999),
// ),
// child: Text(
// '${filteredTabs.length}',
// style: Theme.of(context).textTheme.bodySmall?.copyWith(
// fontWeight: FontWeight.w700,
// ),
// ),
// ),
// ],
// ),
const SizedBox(height: 8),
SizedBox(