diff --git a/flutter/lib/core/ui/app_shell.dart b/flutter/lib/core/ui/app_shell.dart index 4d37c22d..5fee1077 100644 --- a/flutter/lib/core/ui/app_shell.dart +++ b/flutter/lib/core/ui/app_shell.dart @@ -111,13 +111,6 @@ class AppShell extends ConsumerWidget { !location.startsWith('/recipes/'); final isImportRoute = location == '/import'; - Future logout() async { - await ref.read(authStateProvider.notifier).logout(); - if (context.mounted) { - context.go('/login'); - } - } - Widget shell = Scaffold( appBar: AppBar( title: Text(selectedDestination.title), diff --git a/flutter/lib/core/ui/category_then_product_picker.dart b/flutter/lib/core/ui/category_then_product_picker.dart index 06544430..f77dac47 100644 --- a/flutter/lib/core/ui/category_then_product_picker.dart +++ b/flutter/lib/core/ui/category_then_product_picker.dart @@ -35,14 +35,6 @@ class CategoryThenProductPicker { } return ids; } - - /// Hittar en nod med givet id djupet i trädet. - static AdminCategoryNode? _findNode(List 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; } diff --git a/flutter/lib/core/ui/product_picker_field.dart b/flutter/lib/core/ui/product_picker_field.dart index de106a40..4c32309e 100644 --- a/flutter/lib/core/ui/product_picker_field.dart +++ b/flutter/lib/core/ui/product_picker_field.dart @@ -105,7 +105,8 @@ class ProductPickerField extends StatelessWidget { onChanged?.call(null); 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. diff --git a/flutter/lib/features/admin/presentation/admin_aliases_panel.dart b/flutter/lib/features/admin/presentation/admin_aliases_panel.dart index f166ad11..d537d251 100644 --- a/flutter/lib/features/admin/presentation/admin_aliases_panel.dart +++ b/flutter/lib/features/admin/presentation/admin_aliases_panel.dart @@ -231,7 +231,7 @@ class _AdminAliasesPanelState extends ConsumerState { const SizedBox(width: 8), Expanded( child: DropdownButtonFormField( - value: _selectedProductId, + initialValue: _selectedProductId, decoration: const InputDecoration( labelText: 'Produkt', border: OutlineInputBorder(), diff --git a/flutter/lib/features/import/presentation/receipt_import_tab.dart b/flutter/lib/features/import/presentation/receipt_import_tab.dart index f5f95609..4d4a845d 100644 --- a/flutter/lib/features/import/presentation/receipt_import_tab.dart +++ b/flutter/lib/features/import/presentation/receipt_import_tab.dart @@ -667,7 +667,7 @@ class _ReceiptImportTabState extends ConsumerState { decoration: BoxDecoration( color: bg, borderRadius: BorderRadius.circular(999), - border: Border.all(color: fg.withOpacity(0.3)), + border: Border.all(color: fg.withValues(alpha: 0.3)), ), child: Text( label, @@ -987,7 +987,7 @@ class _ReceiptImportResultRow extends ConsumerWidget { Icon(Icons.kitchen_outlined, size: 12, color: Colors.blue.shade700), const SizedBox(width: 3), 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), ), ]), diff --git a/flutter/lib/features/profile/presentation/profile_screen.dart b/flutter/lib/features/profile/presentation/profile_screen.dart index 613212b6..d4c3053f 100644 --- a/flutter/lib/features/profile/presentation/profile_screen.dart +++ b/flutter/lib/features/profile/presentation/profile_screen.dart @@ -286,7 +286,7 @@ class _ProfileScreenState extends ConsumerState { MaterialPageRoute(builder: (_) => const UserAliasesScreen()), ), 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), SizedBox( diff --git a/flutter/lib/features/profile/presentation/user_aliases_screen.dart b/flutter/lib/features/profile/presentation/user_aliases_screen.dart index e0a5e90a..59cea791 100644 --- a/flutter/lib/features/profile/presentation/user_aliases_screen.dart +++ b/flutter/lib/features/profile/presentation/user_aliases_screen.dart @@ -2,8 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import '../../admin/data/admin_repository.dart'; -import '../../admin/domain/receipt_alias.dart'; -import '../../auth/data/auth_providers.dart'; +import '../../admin/domain/receipt_alias.dart';} class UserAliasesScreen extends ConsumerStatefulWidget { const UserAliasesScreen({super.key});