auto-claude: subtask-6-1 - Run flutter analyze to ensure no errors or warnings
Fixed all 39 analyzer issues: - Removed unused import (animation_system.dart in collapsible_routes_sidebar.dart) - Removed unused element (_buildActionButton in dark_mode_map.dart) - Fixed unnecessary non-null assertions on AppLocalizations.of(context) - Removed unnecessary type checks in providers.dart - Used super parameters for key in navigation_tc_dialog.dart and status_colors.dart - Replaced print statements with debugPrint in providers.dart and logging_interceptor.dart Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
c53f4a3b2f
commit
6986a12b91
@ -3,23 +3,23 @@
|
||||
"spec": "001-normalize-code-update-packages-widgetify-component",
|
||||
"state": "building",
|
||||
"subtasks": {
|
||||
"completed": 10,
|
||||
"completed": 11,
|
||||
"total": 14,
|
||||
"in_progress": 1,
|
||||
"failed": 0
|
||||
},
|
||||
"phase": {
|
||||
"current": "Unlock Orientation",
|
||||
"current": "Cleanup and Verification",
|
||||
"id": null,
|
||||
"total": 1
|
||||
"total": 3
|
||||
},
|
||||
"workers": {
|
||||
"active": 0,
|
||||
"max": 1
|
||||
},
|
||||
"session": {
|
||||
"number": 11,
|
||||
"number": 12,
|
||||
"started_at": "2026-01-20T11:20:56.182893"
|
||||
},
|
||||
"last_update": "2026-01-20T11:46:27.066658"
|
||||
"last_update": "2026-01-20T11:47:55.069999"
|
||||
}
|
||||
@ -4,7 +4,6 @@ import '../l10n/app_localizations.dart';
|
||||
import '../models/delivery_route.dart';
|
||||
import '../theme/spacing_system.dart';
|
||||
import '../theme/size_system.dart';
|
||||
import '../theme/animation_system.dart';
|
||||
import '../theme/color_system.dart';
|
||||
import '../utils/breakpoints.dart';
|
||||
import '../providers/providers.dart';
|
||||
@ -73,7 +72,7 @@ class _CollapsibleRoutesSidebarState extends ConsumerState<CollapsibleRoutesSide
|
||||
final isMobile = context.isMobile;
|
||||
final isDarkMode = Theme.of(context).brightness == Brightness.dark;
|
||||
final isExpanded = ref.watch(collapseStateProvider);
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
final l10n = AppLocalizations.of(context);
|
||||
|
||||
// On mobile, always show as collapsible
|
||||
if (isMobile) {
|
||||
|
||||
@ -738,60 +738,4 @@ class _DarkModeMapComponentState extends State<DarkModeMapComponent> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildActionButton({
|
||||
required String label,
|
||||
required IconData icon,
|
||||
required VoidCallback? onPressed,
|
||||
required Color color,
|
||||
}) {
|
||||
final isDisabled = onPressed == null;
|
||||
final buttonColor = isDisabled ? color.withValues(alpha: 0.5) : color;
|
||||
|
||||
return Container(
|
||||
margin: const EdgeInsets.only(bottom: 8),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withValues(alpha: 0.3),
|
||||
blurRadius: 4,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Material(
|
||||
color: buttonColor,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
child: InkWell(
|
||||
onTap: onPressed,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12,
|
||||
vertical: 8,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(
|
||||
icon,
|
||||
color: Colors.white,
|
||||
size: 18,
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
label,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ class _DeliveryListItemState extends State<DeliveryListItem>
|
||||
Widget build(BuildContext context) {
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
final statusColor = _getStatusColor(widget.delivery);
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
final l10n = AppLocalizations.of(context);
|
||||
|
||||
// Collapsed view: Show only the badge
|
||||
if (widget.isCollapsed) {
|
||||
|
||||
@ -6,10 +6,10 @@ class NavigationTermsAndConditionsDialog extends StatelessWidget {
|
||||
final VoidCallback? onDecline;
|
||||
|
||||
const NavigationTermsAndConditionsDialog({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.onAccept,
|
||||
this.onDecline,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@ -80,7 +80,7 @@ class _RouteListItemState extends State<RouteListItem>
|
||||
Widget build(BuildContext context) {
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
final statusColor = _getStatusColor(widget.route);
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
final l10n = AppLocalizations.of(context);
|
||||
|
||||
// Collapsed view: Show only the badge
|
||||
if (widget.isCollapsed) {
|
||||
|
||||
@ -88,7 +88,7 @@ class _DeliveriesPageState extends ConsumerState<DeliveriesPage> {
|
||||
final deliveriesData = ref.watch(deliveriesProvider(widget.routeFragmentId));
|
||||
final tokenAsync = ref.watch(authTokenProvider);
|
||||
final token = tokenAsync.hasValue ? tokenAsync.value : null;
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
final l10n = AppLocalizations.of(context);
|
||||
|
||||
// When embedded in sidebar, show only the delivery list with back button
|
||||
// This is a responsive sidebar that collapses like routes
|
||||
@ -300,7 +300,7 @@ class _DeliveriesPageState extends ConsumerState<DeliveriesPage> {
|
||||
}
|
||||
|
||||
if (token == null) {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
final l10n = AppLocalizations.of(context);
|
||||
ToastHelper.showError(context, l10n.authenticationRequired);
|
||||
return;
|
||||
}
|
||||
@ -322,7 +322,7 @@ class _DeliveriesPageState extends ConsumerState<DeliveriesPage> {
|
||||
);
|
||||
result.when(
|
||||
success: (_) {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
final l10n = AppLocalizations.of(context);
|
||||
// ignore: unused_result
|
||||
ref.refresh(deliveriesProvider(widget.routeFragmentId));
|
||||
// ignore: unused_result
|
||||
@ -330,7 +330,7 @@ class _DeliveriesPageState extends ConsumerState<DeliveriesPage> {
|
||||
ToastHelper.showSuccess(context, l10n.deliverySuccessful);
|
||||
},
|
||||
onError: (error) {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
final l10n = AppLocalizations.of(context);
|
||||
ToastHelper.showError(context, l10n.error(error.message));
|
||||
},
|
||||
);
|
||||
@ -343,7 +343,6 @@ class _DeliveriesPageState extends ConsumerState<DeliveriesPage> {
|
||||
);
|
||||
result.when(
|
||||
success: (_) {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
// ignore: unused_result
|
||||
ref.refresh(deliveriesProvider(widget.routeFragmentId));
|
||||
// ignore: unused_result
|
||||
@ -351,7 +350,7 @@ class _DeliveriesPageState extends ConsumerState<DeliveriesPage> {
|
||||
ToastHelper.showSuccess(context, 'Delivery marked as uncompleted');
|
||||
},
|
||||
onError: (error) {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
final l10n = AppLocalizations.of(context);
|
||||
ToastHelper.showError(context, l10n.error(error.message));
|
||||
},
|
||||
);
|
||||
@ -386,7 +385,7 @@ class _DeliveriesPageState extends ConsumerState<DeliveriesPage> {
|
||||
String? token,
|
||||
) async {
|
||||
if (token == null) {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
final l10n = AppLocalizations.of(context);
|
||||
ToastHelper.showError(context, l10n.authenticationRequired);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
Text(
|
||||
AppLocalizations.of(context)!.appTitle,
|
||||
AppLocalizations.of(context).appTitle,
|
||||
textAlign: TextAlign.center,
|
||||
style: Theme.of(context).textTheme.displayMedium?.copyWith(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
@ -88,7 +88,7 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
AppLocalizations.of(context)!.appDescription,
|
||||
AppLocalizations.of(context).appDescription,
|
||||
textAlign: TextAlign.center,
|
||||
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
@ -98,8 +98,8 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
||||
TextFormField(
|
||||
controller: _usernameController,
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context)!.username,
|
||||
hintText: AppLocalizations.of(context)!.usernameHint,
|
||||
labelText: AppLocalizations.of(context).username,
|
||||
hintText: AppLocalizations.of(context).usernameHint,
|
||||
prefixIcon: const Icon(Icons.person),
|
||||
border: const OutlineInputBorder(),
|
||||
),
|
||||
@ -107,7 +107,7 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
||||
enabled: !_isLoading,
|
||||
validator: (value) {
|
||||
if (value == null || value.trim().isEmpty) {
|
||||
return AppLocalizations.of(context)!.usernameRequired;
|
||||
return AppLocalizations.of(context).usernameRequired;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
@ -116,8 +116,8 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
||||
TextFormField(
|
||||
controller: _passwordController,
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context)!.password,
|
||||
hintText: AppLocalizations.of(context)!.passwordHint,
|
||||
labelText: AppLocalizations.of(context).password,
|
||||
hintText: AppLocalizations.of(context).passwordHint,
|
||||
prefixIcon: const Icon(Icons.lock),
|
||||
border: const OutlineInputBorder(),
|
||||
suffixIcon: IconButton(
|
||||
@ -137,7 +137,7 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
||||
onFieldSubmitted: (_) => _handleLogin(),
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return AppLocalizations.of(context)!.passwordRequired;
|
||||
return AppLocalizations.of(context).passwordRequired;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
@ -159,7 +159,7 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
||||
),
|
||||
),
|
||||
)
|
||||
: Text(AppLocalizations.of(context)!.loginButton),
|
||||
: Text(AppLocalizations.of(context).loginButton),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@ -11,7 +11,7 @@ class SettingsPage extends ConsumerWidget {
|
||||
final userProfile = ref.watch(userProfileProvider);
|
||||
final languageAsync = ref.watch(languageProvider);
|
||||
final themeMode = ref.watch(themeModeProvider);
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
final l10n = AppLocalizations.of(context);
|
||||
|
||||
final language = languageAsync.maybeWhen(
|
||||
data: (value) => value,
|
||||
|
||||
@ -57,12 +57,10 @@ final deliveryRoutesProvider = FutureProvider<List<DeliveryRoute>>((ref) async {
|
||||
query: _EmptyQuery(),
|
||||
fromJson: (json) {
|
||||
// API returns data wrapped in object with "data" field
|
||||
if (json is Map<String, dynamic>) {
|
||||
final data = json['data'];
|
||||
if (data is List<dynamic>) {
|
||||
return data.map((r) => DeliveryRoute.fromJson(r as Map<String, dynamic>)).toList();
|
||||
}
|
||||
}
|
||||
return [];
|
||||
},
|
||||
);
|
||||
@ -88,21 +86,19 @@ final deliveriesProvider = FutureProvider.family<List<Delivery>, int>((ref, rout
|
||||
query: _DeliveriesQuery(routeFragmentId: routeFragmentId),
|
||||
fromJson: (json) {
|
||||
// API returns data wrapped in object with "data" field
|
||||
if (json is Map<String, dynamic>) {
|
||||
final data = json['data'];
|
||||
if (data is List<dynamic>) {
|
||||
return data.map((d) => Delivery.fromJson(d as Map<String, dynamic>)).toList();
|
||||
}
|
||||
}
|
||||
return [];
|
||||
},
|
||||
);
|
||||
|
||||
// Log error if API call failed
|
||||
result.whenError((error) {
|
||||
print('ERROR fetching deliveries for route $routeFragmentId: ${error.message}');
|
||||
debugPrint('ERROR fetching deliveries for route $routeFragmentId: ${error.message}');
|
||||
if (error.originalException != null) {
|
||||
print('Original exception: ${error.originalException}');
|
||||
debugPrint('Original exception: ${error.originalException}');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -194,12 +194,12 @@ class StatusBadgeWidget extends StatelessWidget {
|
||||
final double fontSize;
|
||||
|
||||
const StatusBadgeWidget({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.status,
|
||||
this.showIcon = true,
|
||||
this.showLabel = true,
|
||||
this.fontSize = 12,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -242,11 +242,11 @@ class StatusAccentBar extends StatelessWidget {
|
||||
final double height;
|
||||
|
||||
const StatusAccentBar({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.status,
|
||||
this.width = 4,
|
||||
this.height = 60,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@ -1,26 +1,27 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:http_interceptor/http_interceptor.dart';
|
||||
|
||||
class LoggingInterceptor implements InterceptorContract {
|
||||
@override
|
||||
Future<BaseRequest> interceptRequest({required BaseRequest request}) async {
|
||||
print('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
|
||||
print('📤 REQUEST: ${request.method} ${request.url}');
|
||||
print('Headers: ${request.headers}');
|
||||
debugPrint('----------------------------------------------------');
|
||||
debugPrint('REQUEST: ${request.method} ${request.url}');
|
||||
debugPrint('Headers: ${request.headers}');
|
||||
if (request is Request) {
|
||||
print('Body: ${request.body}');
|
||||
debugPrint('Body: ${request.body}');
|
||||
}
|
||||
print('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
|
||||
debugPrint('----------------------------------------------------');
|
||||
return request;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<BaseResponse> interceptResponse({required BaseResponse response}) async {
|
||||
print('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
|
||||
print('📥 RESPONSE: ${response.statusCode} ${response.request?.url}');
|
||||
debugPrint('----------------------------------------------------');
|
||||
debugPrint('RESPONSE: ${response.statusCode} ${response.request?.url}');
|
||||
if (response is Response) {
|
||||
print('Body: ${response.body}');
|
||||
debugPrint('Body: ${response.body}');
|
||||
}
|
||||
print('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
|
||||
debugPrint('----------------------------------------------------');
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user