Skip to content

Commit 98962be

Browse files
author
Maxence COEUR
committed
fix flutter analyse
1 parent e1a8f53 commit 98962be

22 files changed

Lines changed: 87 additions & 115 deletions

‎lib/core/api_client.dart‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class ApiClient {
99
late Dio _dio;
1010

1111
// Configuration de base
12-
static const String baseUrl = AppConfig.apiUrl + "/api";
12+
static const String baseUrl = "${AppConfig.apiUrl}/api";
1313
static const String apiVersion = "1.0";
1414

1515
ApiClient() {

‎lib/core/notification_service.dart‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ class NotificationService {
180180
'/DeviceToken',
181181
data: {'deviceToken': token, 'devicePlatform': _devicePlatform},
182182
);
183-
} on DioError catch (error) {
183+
} on DioException catch (error) {
184184
AppLogger.debug(
185185
'Erreur enregistrement token FCM',
186186
error.response?.data ?? error.message,

‎lib/core/widgets/async_state_widgets.dart‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ class AppSettingTile extends StatelessWidget {
144144
margin: const EdgeInsets.only(bottom: 12),
145145
shape: RoundedRectangleBorder(
146146
borderRadius: BorderRadius.circular(16),
147-
side: BorderSide(color: colors.outlineVariant.withOpacity(0.5)),
147+
side: BorderSide(color: colors.outlineVariant.withValues(alpha: 0.5)),
148148
),
149149
child: ListTile(
150150
onTap: onTap,

‎lib/features/auth/presentation/registration_tunnel/registration_stepper_screen.dart‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import '../../../../core/logging/app_logger.dart';
1818
import '../../../restaurant/data/models/restaurant_in.dart';
1919
import '../../../restaurant/data/models/restaurant_out.dart';
2020
import '../../../restaurant/domain/repositories/restaurant_repository.dart';
21-
import '../../../table/data/models/table_entity_in.dart';
2221
import '../../../table/data/models/table_entity_out.dart';
2322
import '../../../user/data/models/user_in.dart';
2423

@@ -293,7 +292,7 @@ class _RegistrationStepperScreenState extends State<RegistrationStepperScreen> {
293292
preferredSize: const Size.fromHeight(6.0),
294293
child: LinearProgressIndicator(
295294
value: progress,
296-
backgroundColor: colors.surfaceVariant,
295+
backgroundColor: colors.surfaceContainerHighest,
297296
valueColor: AlwaysStoppedAnimation<Color>(colors.primary),
298297
),
299298
),
@@ -312,7 +311,7 @@ class _RegistrationStepperScreenState extends State<RegistrationStepperScreen> {
312311
// Overlay de chargement
313312
if (_isLoading)
314313
Container(
315-
color: Colors.black.withOpacity(0.3),
314+
color: Colors.black.withValues(alpha: 0.3),
316315
child: const Center(
317316
child: Card(
318317
child: Padding(

‎lib/features/auth/presentation/registration_tunnel/step/step6_error_screen.dart‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class _Step6ErrorScreenState extends State<Step6ErrorScreen> with SingleTickerPr
5959
child: Container(
6060
padding: const EdgeInsets.all(20),
6161
decoration: BoxDecoration(
62-
color: colors.error.withOpacity(0.1),
62+
color: colors.error.withValues(alpha: 0.1),
6363
shape: BoxShape.circle,
6464
),
6565
child: Icon(

‎lib/features/auth/presentation/registration_tunnel/step/step6_success_screen.dart‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class _Step6SuccessScreenState extends State<Step6SuccessScreen> {
5252
Container(
5353
padding: const EdgeInsets.all(20),
5454
decoration: BoxDecoration(
55-
color: Colors.green.withOpacity(0.1),
55+
color: Colors.green.withValues(alpha: 0.1),
5656
shape: BoxShape.circle,
5757
),
5858
child: const Icon(

‎lib/features/daily_activity/presentation/hourly_activity_page.dart‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ class _HourlyActivityPageState extends State<HourlyActivityPage> {
102102
final activity = DailyActivityIn(
103103
restaurantId: widget.restaurantId,
104104
dayOfWeek: _selectedDay!,
105-
startTime: "${finalOpening}:00", // Format HH:mm:ss pour l'API
106-
endTime: "${finalClosing}:00",
105+
startTime: "$finalOpening:00", // Format HH:mm:ss pour l'API
106+
endTime: "$finalClosing:00",
107107
);
108108

109109
await _repo.create(activity);
@@ -172,7 +172,7 @@ class _HourlyActivityPageState extends State<HourlyActivityPage> {
172172
),
173173
const SizedBox(height: 12),
174174
DropdownButtonFormField<int>(
175-
value: _selectedDay,
175+
initialValue: _selectedDay,
176176
items: List.generate(7, (index) {
177177
return DropdownMenuItem(
178178
value: index + 1,

‎lib/features/home/presentation/pages/account_page.dart‎

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,15 @@ class _AccountPageState extends State<AccountPage> {
5656
end: Alignment.bottomRight,
5757
colors: [
5858
colors.primary,
59-
colors.primary.withOpacity(0.8),
59+
colors.primary.withValues(alpha: 0.8),
6060
],
6161
),
6262
),
6363
child: Column(
6464
children: [
6565
CircleAvatar(
6666
radius: 50,
67-
backgroundColor: colors.onPrimary.withOpacity(0.2),
67+
backgroundColor: colors.onPrimary.withValues(alpha: 0.2),
6868
child: Text(
6969
"${_currentUser.firstName[0].toUpperCase()}${_currentUser.lastName[0].toUpperCase()}",
7070
style: textTheme.headlineMedium?.copyWith(
@@ -85,16 +85,16 @@ class _AccountPageState extends State<AccountPage> {
8585
Text(
8686
_currentUser.email,
8787
style: textTheme.bodyMedium?.copyWith(
88-
color: colors.onPrimary.withOpacity(0.8),
88+
color: colors.onPrimary.withValues(alpha: 0.8),
8989
),
9090
),
9191
const SizedBox(height: 12),
9292
Container(
9393
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4),
9494
decoration: BoxDecoration(
95-
color: colors.onPrimary.withOpacity(0.15),
95+
color: colors.onPrimary.withValues(alpha: 0.15),
9696
borderRadius: BorderRadius.circular(20),
97-
border: Border.all(color: colors.onPrimary.withOpacity(0.3)),
97+
border: Border.all(color: colors.onPrimary.withValues(alpha: 0.3)),
9898
),
9999
child: Text(
100100
_currentUser.accountType == 0 ? "Compte Client" : "Compte Restaurateur",
@@ -192,7 +192,7 @@ class _AccountPageState extends State<AccountPage> {
192192
elevation: 0,
193193
shape: RoundedRectangleBorder(
194194
borderRadius: BorderRadius.circular(16),
195-
side: BorderSide(color: Theme.of(context).colorScheme.outlineVariant.withOpacity(0.5)),
195+
side: BorderSide(color: Theme.of(context).colorScheme.outlineVariant.withValues(alpha: 0.5)),
196196
),
197197
color: Theme.of(context).colorScheme.surfaceContainerLow,
198198
child: Column(children: children),
@@ -228,7 +228,7 @@ class _AccountPageState extends State<AccountPage> {
228228
height: 1,
229229
indent: 56,
230230
endIndent: 16,
231-
color: colors.outlineVariant.withOpacity(0.3),
231+
color: colors.outlineVariant.withValues(alpha: 0.3),
232232
),
233233
],
234234
);
@@ -253,9 +253,11 @@ class _AccountPageState extends State<AccountPage> {
253253
onNext: (updatedUser) async {
254254
try {
255255
await userRepo.updateProfile(updatedUser);
256+
if (!context.mounted) return;
256257
Navigator.pop(context);
257258
_refreshProfile();
258259
} catch (e) {
260+
if (!context.mounted) return;
259261
ScaffoldMessenger.of(context).showSnackBar(
260262
SnackBar(content: Text('Erreur: $e')),
261263
);
@@ -277,13 +279,15 @@ class _AccountPageState extends State<AccountPage> {
277279
onConfirm: (oldPwd, newPwd) async {
278280
try {
279281
final success = await userRepo.changePassword(oldPwd, newPwd);
282+
if (!context.mounted) return;
280283
if (success) {
281284
Navigator.pop(context);
282285
ScaffoldMessenger.of(context).showSnackBar(
283286
const SnackBar(content: Text('Mot de passe mis à jour !')),
284287
);
285288
}
286289
} catch (e) {
290+
if (!context.mounted) return;
287291
ScaffoldMessenger.of(context).showSnackBar(
288292
SnackBar(content: Text('Erreur: $e')),
289293
);
@@ -324,8 +328,8 @@ class _AccountPageState extends State<AccountPage> {
324328
void _showDeleteAccountDialog(BuildContext context) {
325329
showDialog(
326330
context: context,
327-
builder: (BuildContext context) {
328-
final colors = Theme.of(context).colorScheme;
331+
builder: (BuildContext dialogContext) {
332+
final colors = Theme.of(dialogContext).colorScheme;
329333
return AlertDialog(
330334
title: const Text("Supprimer le compte"),
331335
content: const Text(
@@ -334,20 +338,22 @@ class _AccountPageState extends State<AccountPage> {
334338
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
335339
actions: [
336340
TextButton(
337-
onPressed: () => Navigator.pop(context),
341+
onPressed: () => Navigator.pop(dialogContext),
338342
child: const Text("Annuler"),
339343
),
340344
FilledButton(
341345
onPressed: () async {
342346
try {
343347
final success = await userRepo.deleteAccount();
348+
if (!dialogContext.mounted) return;
344349
if (success) {
345-
Navigator.pop(context);
350+
Navigator.pop(dialogContext);
346351
widget.onLogout();
347352
}
348353
} catch (e) {
349-
Navigator.pop(context);
350-
ScaffoldMessenger.of(context).showSnackBar(
354+
if (!dialogContext.mounted) return;
355+
Navigator.pop(dialogContext);
356+
ScaffoldMessenger.of(dialogContext).showSnackBar(
351357
SnackBar(content: Text('Erreur: $e')),
352358
);
353359
}

‎lib/features/home/presentation/pages/maps_page.dart‎

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import 'dart:async';
2-
import 'dart:developer';
32

43
import 'package:flutter/material.dart';
54
import 'package:google_maps_flutter/google_maps_flutter.dart';
@@ -30,13 +29,10 @@ class _MapsPageState extends State<MapsPage> {
3029
bool _isInitializing = true;
3130
LatLng _mapCenter = const LatLng(48.8566, 2.3522);
3231
LatLng? _lastSearchCenter;
33-
GoogleMapController? _controller;
3432
StreamSubscription<Position>? _positionStream;
3533
bool _userMovedMap = false;
3634
static const double _searchDistanceThreshold = 500; // meters
3735

38-
String _statusMessage = 'Demande d\'autorisation de localisation...';
39-
4036
bool _loading = false;
4137
String? _error;
4238
List<RestaurantOut> _restaurants = [];
@@ -66,8 +62,10 @@ class _MapsPageState extends State<MapsPage> {
6662

6763
// 2. Tente de récupérer la position
6864
final pos = await Geolocator.getCurrentPosition(
69-
desiredAccuracy: LocationAccuracy.high,
70-
timeLimit: const Duration(seconds: 7),
65+
locationSettings: const LocationSettings(
66+
accuracy: LocationAccuracy.high,
67+
timeLimit: Duration(seconds: 7),
68+
),
7169
);
7270

7371
_mapCenter = LatLng(pos.latitude, pos.longitude);
@@ -215,7 +213,7 @@ class _MapsPageState extends State<MapsPage> {
215213
children: [
216214
Expanded(
217215
child: DropdownButtonFormField<String>(
218-
value: _selectedCuisine,
216+
initialValue: _selectedCuisine,
219217
decoration: const InputDecoration(
220218
labelText: 'Cuisine',
221219
border: OutlineInputBorder(),
@@ -232,7 +230,7 @@ class _MapsPageState extends State<MapsPage> {
232230
const SizedBox(width: 8),
233231
Expanded(
234232
child: DropdownButtonFormField<String>(
235-
value: _selectedPayment,
233+
initialValue: _selectedPayment,
236234
decoration: const InputDecoration(
237235
labelText: 'Payment',
238236
border: OutlineInputBorder(),
@@ -304,7 +302,6 @@ class _MapsPageState extends State<MapsPage> {
304302
),
305303
myLocationEnabled: true,
306304
myLocationButtonEnabled: true,
307-
onMapCreated: (c) => _controller = c,
308305
onCameraMove: _onCameraMove,
309306
onCameraIdle: _onCameraIdle,
310307
markers: _markers,

‎lib/features/home/presentation/pages/restaurant_page.dart‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ class _TabButton extends StatelessWidget {
310310
FilledButton(
311311
onPressed: () => onChanged(index),
312312
style: FilledButton.styleFrom(
313-
backgroundColor: isSelected ? colors.primary : colors.surfaceVariant,
313+
backgroundColor: isSelected ? colors.primary : colors.surfaceContainerHighest,
314314
foregroundColor: isSelected ? colors.onPrimary : colors.onSurfaceVariant,
315315
),
316316
child: Text(label),
@@ -594,9 +594,9 @@ class _TableBadge extends StatelessWidget {
594594
return Container(
595595
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
596596
decoration: BoxDecoration(
597-
color: color.withOpacity(0.1),
597+
color: color.withValues(alpha: 0.1),
598598
borderRadius: BorderRadius.circular(8),
599-
border: Border.all(color: color.withOpacity(0.5)),
599+
border: Border.all(color: color.withValues(alpha: 0.5)),
600600
),
601601
child: Row(
602602
mainAxisSize: MainAxisSize.min,
@@ -765,7 +765,7 @@ class _MenuView extends StatelessWidget {
765765
elevation: 0,
766766
shape: RoundedRectangleBorder(
767767
borderRadius: BorderRadius.circular(16),
768-
side: BorderSide(color: colors.outlineVariant.withOpacity(0.5)),
768+
side: BorderSide(color: colors.outlineVariant.withValues(alpha: 0.5)),
769769
),
770770
child: Column(
771771
crossAxisAlignment: CrossAxisAlignment.start,
@@ -775,7 +775,7 @@ class _MenuView extends StatelessWidget {
775775
borderRadius: const BorderRadius.vertical(top: Radius.circular(16)),
776776
child: Container(
777777
width: double.infinity,
778-
color: colors.secondaryContainer.withOpacity(0.3),
778+
color: colors.secondaryContainer.withValues(alpha: 0.3),
779779
child: const Icon(Icons.restaurant_menu, size: 40),
780780
),
781781
),

0 commit comments

Comments
 (0)