feat: add rows count (broken), fix: bug with low stock items

This commit is contained in:
2026-08-02 23:23:28 +02:00
parent f5b2041612
commit 6060ca2713
19 changed files with 373 additions and 41 deletions
+50 -8
View File
@@ -1,3 +1,4 @@
import 'dart:async';
import 'dart:io';
import 'package:flutter/material.dart';
@@ -22,7 +23,7 @@ class SettingsScreenView extends StatefulWidget {
class _SettingsScreenViewState extends State<SettingsScreenView> {
String _appVersion = '';
int _versionTaps = 0;
Timer? _versionHoldTimer;
@override
void initState() {
@@ -41,13 +42,23 @@ class _SettingsScreenViewState extends State<SettingsScreenView> {
return info.version;
}
void _onVersionTap() {
_versionTaps++;
void _startVersionHold() {
_versionHoldTimer?.cancel();
_versionHoldTimer = Timer(const Duration(seconds: 3), () {
_versionHoldTimer = null;
if (mounted) context.push('/dev');
});
}
if (_versionTaps >= 7) {
_versionTaps = 0;
context.push('/dev');
}
void _cancelVersionHold() {
_versionHoldTimer?.cancel();
_versionHoldTimer = null;
}
@override
void dispose() {
_cancelVersionHold();
super.dispose();
}
Future<void> _loadVersion() async {
@@ -277,6 +288,35 @@ class _SettingsScreenViewState extends State<SettingsScreenView> {
}
},
),
_SettingsTile(
icon: Icons.grid_view_rounded,
title: l10n.productGridRows,
subtitle: l10n.rowsCount(settings.barGridRows),
onTap: () async {
final selected = await showModalBottomSheet<int>(
context: context,
builder: (context) => SafeArea(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
for (final rows in [2, 3, 4, 5, 6])
RadioListTile<int>(
value: rows,
groupValue: settings.barGridRows,
title: Text(l10n.rowsCount(rows)),
onChanged: (value) =>
Navigator.pop(context, value),
),
],
),
),
);
if (selected != null) {
await settingsViewModel.updateBarGridRows(selected);
}
},
),
_SettingsTile(
icon: Icons.brightness_6_rounded,
title: l10n.theme,
@@ -334,7 +374,9 @@ class _SettingsScreenViewState extends State<SettingsScreenView> {
),
const SizedBox(height: 40),
GestureDetector(
onTap: _onVersionTap,
onTapDown: (_) => _startVersionHold(),
onTapUp: (_) => _cancelVersionHold(),
onTapCancel: _cancelVersionHold,
child: Center(
child: Text(
l10n.version(_appVersion),