Fix linting issues and code quality improvements
Resolve 62 linting issues identified by flutter analyze, reducing total issues from 79 to 17. All critical warnings addressed. Changes: - Replace deprecated withOpacity() with withValues(alpha:) (25 instances) - Remove unused imports from 9 files - Remove unused variables and fields (6 instances) - Fix Riverpod 3.0 state access violations in settings_page - Remove unnecessary null-aware operators in navigation_page (6 instances) - Fix unnecessary type casts in providers (4 instances) - Remove unused methods: _getDarkMapStyle, _showPermissionDialog - Simplify hover state management by removing unused _isHovered fields Remaining 17 issues are info-level style suggestions and defensive programming patterns that don't impact functionality. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -4,7 +4,6 @@ import 'package:google_navigation_flutter/google_navigation_flutter.dart';
|
||||
import 'package:planb_logistic/l10n/app_localizations.dart';
|
||||
import '../models/delivery.dart';
|
||||
import '../services/location_permission_service.dart';
|
||||
import '../components/navigation_tc_dialog.dart';
|
||||
|
||||
class NavigationPage extends ConsumerStatefulWidget {
|
||||
final Delivery delivery;
|
||||
@@ -139,38 +138,6 @@ class _NavigationPageState extends ConsumerState<NavigationPage> {
|
||||
}
|
||||
}
|
||||
|
||||
void _showPermissionDialog() {
|
||||
final l10n = AppLocalizations.of(context);
|
||||
|
||||
showDialog(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (context) => AlertDialog(
|
||||
title: Text(l10n?.locationPermissionRequired ?? 'Location Permission'),
|
||||
content: Text(
|
||||
l10n?.locationPermissionMessage ??
|
||||
'This app requires location permission to navigate to deliveries.',
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
widget.onNavigationCancelled?.call();
|
||||
},
|
||||
child: Text(l10n?.cancel ?? 'Cancel'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
_requestLocationPermission();
|
||||
},
|
||||
child: Text(l10n?.requestPermission ?? 'Request Permission'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _requestLocationPermission() async {
|
||||
final result = await _permissionService.requestLocationPermission();
|
||||
|
||||
@@ -206,22 +173,19 @@ class _NavigationPageState extends ConsumerState<NavigationPage> {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: Text(l10n?.permissionPermanentlyDenied ?? 'Permission Required'),
|
||||
content: Text(
|
||||
l10n?.openSettingsMessage ??
|
||||
'Location permission is permanently denied. Please enable it in app settings.',
|
||||
),
|
||||
title: Text(l10n.permissionPermanentlyDenied),
|
||||
content: Text(l10n.openSettingsMessage),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: Text(l10n?.cancel ?? 'Cancel'),
|
||||
child: Text(l10n.cancel),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
_permissionService.openAppSettings();
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: Text(l10n?.openSettings ?? 'Open Settings'),
|
||||
child: Text(l10n.openSettings),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -389,7 +353,7 @@ class _NavigationPageState extends ConsumerState<NavigationPage> {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(
|
||||
'${l10n?.navigatingTo ?? 'Navigating to'}: ${widget.delivery.name}',
|
||||
'${l10n.navigatingTo}: ${widget.delivery.name}',
|
||||
),
|
||||
elevation: 0,
|
||||
),
|
||||
@@ -417,10 +381,7 @@ class _NavigationPageState extends ConsumerState<NavigationPage> {
|
||||
children: [
|
||||
const CircularProgressIndicator(),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
l10n?.initializingNavigation ??
|
||||
'Initializing navigation...',
|
||||
),
|
||||
Text(l10n.initializingNavigation),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user