feat: remove unused methods and improve widget styling in various screens
Test Suite / test (24.15.0) (push) Has been cancelled

This commit is contained in:
Nils-Johan Gynther
2026-05-08 15:28:54 +02:00
parent 5019bf6acf
commit 84dbe8490d
7 changed files with 7 additions and 22 deletions
-7
View File
@@ -111,13 +111,6 @@ class AppShell extends ConsumerWidget {
!location.startsWith('/recipes/'); !location.startsWith('/recipes/');
final isImportRoute = location == '/import'; final isImportRoute = location == '/import';
Future<void> logout() async {
await ref.read(authStateProvider.notifier).logout();
if (context.mounted) {
context.go('/login');
}
}
Widget shell = Scaffold( Widget shell = Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text(selectedDestination.title), title: Text(selectedDestination.title),
@@ -35,14 +35,6 @@ class CategoryThenProductPicker {
} }
return ids; return ids;
} }
/// Hittar en nod med givet id djupet i trädet.
static AdminCategoryNode? _findNode(List<AdminCategoryNode> nodes, int id) {
for (final node in nodes) {
if (node.id == id) return node;
final found = _findNode(node.children, id);
if (found != null) return found;
}
return null; return null;
} }
@@ -105,7 +105,8 @@ class ProductPickerField extends StatelessWidget {
onChanged?.call(null); onChanged?.call(null);
return; return;
} }
if (result is int) onChanged?.call(result); if (result is! int) return;
onChanged?.call(result);
} }
/// Öppnar produktväljarens bottenark utan att binda den till en specifik widget-instans. /// Öppnar produktväljarens bottenark utan att binda den till en specifik widget-instans.
@@ -231,7 +231,7 @@ class _AdminAliasesPanelState extends ConsumerState<AdminAliasesPanel> {
const SizedBox(width: 8), const SizedBox(width: 8),
Expanded( Expanded(
child: DropdownButtonFormField<int>( child: DropdownButtonFormField<int>(
value: _selectedProductId, initialValue: _selectedProductId,
decoration: const InputDecoration( decoration: const InputDecoration(
labelText: 'Produkt', labelText: 'Produkt',
border: OutlineInputBorder(), border: OutlineInputBorder(),
@@ -667,7 +667,7 @@ class _ReceiptImportTabState extends ConsumerState<ReceiptImportTab> {
decoration: BoxDecoration( decoration: BoxDecoration(
color: bg, color: bg,
borderRadius: BorderRadius.circular(999), borderRadius: BorderRadius.circular(999),
border: Border.all(color: fg.withOpacity(0.3)), border: Border.all(color: fg.withValues(alpha: 0.3)),
), ),
child: Text( child: Text(
label, label,
@@ -987,7 +987,7 @@ class _ReceiptImportResultRow extends ConsumerWidget {
Icon(Icons.kitchen_outlined, size: 12, color: Colors.blue.shade700), Icon(Icons.kitchen_outlined, size: 12, color: Colors.blue.shade700),
const SizedBox(width: 3), const SizedBox(width: 3),
Text( Text(
'I lager: ${existingInv.quantity} ${existingInv.unit} → blir ${(existingInv.quantity + (convertedPreviewQty ?? 0)).toStringAsFixed(existingInv.quantity % 1 == 0 ? 0 : 2)} ${existingInv.unit}', 'I lager: ${existingInv.quantity} ${existingInv.unit} → blir ${(existingInv.quantity + convertedPreviewQty!).toStringAsFixed(existingInv.quantity % 1 == 0 ? 0 : 2)} ${existingInv.unit}',
style: theme.textTheme.bodySmall?.copyWith(color: Colors.blue.shade700), style: theme.textTheme.bodySmall?.copyWith(color: Colors.blue.shade700),
), ),
]), ]),
@@ -286,7 +286,7 @@ class _ProfileScreenState extends ConsumerState<ProfileScreen> {
MaterialPageRoute(builder: (_) => const UserAliasesScreen()), MaterialPageRoute(builder: (_) => const UserAliasesScreen()),
), ),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
tileColor: Theme.of(context).colorScheme.surfaceContainerHighest.withOpacity(0.4), tileColor: Theme.of(context).colorScheme.surfaceContainerHighest.withValues(alpha: 0.4),
), ),
const SizedBox(height: 24), const SizedBox(height: 24),
SizedBox( SizedBox(
@@ -2,8 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../../admin/data/admin_repository.dart'; import '../../admin/data/admin_repository.dart';
import '../../admin/domain/receipt_alias.dart'; import '../../admin/domain/receipt_alias.dart';}
import '../../auth/data/auth_providers.dart';
class UserAliasesScreen extends ConsumerStatefulWidget { class UserAliasesScreen extends ConsumerStatefulWidget {
const UserAliasesScreen({super.key}); const UserAliasesScreen({super.key});