diff --git a/lib/pages/battery_detail_page.dart b/lib/pages/battery_detail_page.dart index 2821214..34460af 100644 --- a/lib/pages/battery_detail_page.dart +++ b/lib/pages/battery_detail_page.dart @@ -224,8 +224,10 @@ class _BatteryDetailPageState extends State { ), if (_isEditing) ...[ const SizedBox(height: 15), - Row( - mainAxisAlignment: MainAxisAlignment.center, + Wrap( + alignment: WrapAlignment.center, + spacing: 10.0, + runSpacing: 10.0, children: [ ElevatedButton.icon( onPressed: () => _pickImage(ImageSource.camera), @@ -233,17 +235,16 @@ class _BatteryDetailPageState extends State { label: Text(l10n.takePhoto), style: ElevatedButton.styleFrom( backgroundColor: Colors.blueGrey[700], - foregroundColor: Colors.white, // Texte en blanc + foregroundColor: Colors.white, ), ), - const SizedBox(width: 10), ElevatedButton.icon( onPressed: () => _pickImage(ImageSource.gallery), icon: const Icon(Icons.photo_library), label: Text(l10n.chooseFromGallery), style: ElevatedButton.styleFrom( backgroundColor: Colors.blueGrey[700], - foregroundColor: Colors.white, // Texte en blanc + foregroundColor: Colors.white, ), ), ], @@ -325,13 +326,13 @@ class _BatteryDetailPageState extends State { child: ElevatedButton( onPressed: _saveBattery, style: Theme.of(context).elevatedButtonTheme.style?.copyWith( - padding: MaterialStateProperty.all( - const EdgeInsets.symmetric(horizontal: 40, vertical: 15)), - shape: MaterialStateProperty.all(RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - )), - foregroundColor: MaterialStateProperty.all(Colors.white), // Texte en blanc pour le bouton Save Changes - ), + padding: MaterialStateProperty.all( + const EdgeInsets.symmetric(horizontal: 40, vertical: 15)), + shape: MaterialStateProperty.all(RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + )), + foregroundColor: MaterialStateProperty.all(Colors.white), + ), child: Text( l10n.saveChanges, style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold), @@ -366,7 +367,7 @@ class _BatteryDetailPageState extends State { child: ListTile( contentPadding: const EdgeInsets.symmetric( horizontal: 20, vertical: 12), - leading: Icon(Icons.flight_takeoff, + leading: const Icon(Icons.flight_takeoff, color: Colors.orangeAccent, size: 32), title: Text( '${flight.name} - ${flightDate.toLocal().toString().split(' ')[0]}', diff --git a/lib/pages/drone_detail_page.dart b/lib/pages/drone_detail_page.dart index 86711a5..b21e72f 100644 --- a/lib/pages/drone_detail_page.dart +++ b/lib/pages/drone_detail_page.dart @@ -222,8 +222,10 @@ class _DroneDetailPageState extends State { ), if (_isEditing) ...[ const SizedBox(height: 15), - Row( - mainAxisAlignment: MainAxisAlignment.center, + Wrap( + alignment: WrapAlignment.center, + spacing: 10.0, + runSpacing: 10.0, children: [ ElevatedButton.icon( onPressed: () => _pickImage(ImageSource.camera), @@ -231,17 +233,16 @@ class _DroneDetailPageState extends State { label: Text(l10n.takePhoto), style: ElevatedButton.styleFrom( backgroundColor: Colors.blueGrey[700], - foregroundColor: Colors.white, // Texte en blanc + foregroundColor: Colors.white, ), ), - const SizedBox(width: 10), ElevatedButton.icon( onPressed: () => _pickImage(ImageSource.gallery), icon: const Icon(Icons.photo_library), label: Text(l10n.chooseFromGallery), style: ElevatedButton.styleFrom( backgroundColor: Colors.blueGrey[700], - foregroundColor: Colors.white, // Texte en blanc + foregroundColor: Colors.white, ), ), ], @@ -279,13 +280,13 @@ class _DroneDetailPageState extends State { child: ElevatedButton( onPressed: _saveDrone, style: Theme.of(context).elevatedButtonTheme.style?.copyWith( - padding: MaterialStateProperty.all( - const EdgeInsets.symmetric(horizontal: 40, vertical: 15)), - shape: MaterialStateProperty.all(RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - )), - foregroundColor: MaterialStateProperty.all(Colors.white), // Texte en blanc pour le bouton Save Changes - ), + padding: MaterialStateProperty.all( + const EdgeInsets.symmetric(horizontal: 40, vertical: 15)), + shape: MaterialStateProperty.all(RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + )), + foregroundColor: MaterialStateProperty.all(Colors.white), + ), child: Text( l10n.saveChanges, style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold), diff --git a/lib/pages/new_battery_page.dart b/lib/pages/new_battery_page.dart index 96c1513..621d188 100644 --- a/lib/pages/new_battery_page.dart +++ b/lib/pages/new_battery_page.dart @@ -107,8 +107,10 @@ class _NewBatteryPageState extends State { Text(l10n.batteryImage, style: Theme.of(context).textTheme.titleSmall), const SizedBox(height: 15), - Row( - mainAxisAlignment: MainAxisAlignment.center, + Wrap( + alignment: WrapAlignment.center, + spacing: 10.0, + runSpacing: 10.0, children: [ ElevatedButton.icon( onPressed: () => _pickImage(ImageSource.camera), @@ -116,17 +118,16 @@ class _NewBatteryPageState extends State { label: Text(l10n.takePhoto), style: ElevatedButton.styleFrom( backgroundColor: Colors.blueGrey[700], - foregroundColor: Colors.white, // Set text color to white + foregroundColor: Colors.white, ), ), - const SizedBox(width: 10), ElevatedButton.icon( onPressed: () => _pickImage(ImageSource.gallery), icon: const Icon(Icons.photo_library), label: Text(l10n.chooseFromGallery), style: ElevatedButton.styleFrom( backgroundColor: Colors.blueGrey[700], - foregroundColor: Colors.white, // Set text color to white + foregroundColor: Colors.white, ), ), ], @@ -211,7 +212,7 @@ class _NewBatteryPageState extends State { shape: MaterialStateProperty.all(RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), )), - foregroundColor: MaterialStateProperty.all(Colors.white), // Set text color to white + foregroundColor: MaterialStateProperty.all(Colors.white), ), child: Text( l10n.saveBattery, diff --git a/lib/pages/new_drone_page.dart b/lib/pages/new_drone_page.dart index 72552fc..5220714 100644 --- a/lib/pages/new_drone_page.dart +++ b/lib/pages/new_drone_page.dart @@ -101,8 +101,10 @@ class _NewDronePageState extends State { Text(l10n.droneImage, style: Theme.of(context).textTheme.titleSmall), const SizedBox(height: 15), - Row( - mainAxisAlignment: MainAxisAlignment.center, + Wrap( + alignment: WrapAlignment.center, + spacing: 10.0, + runSpacing: 10.0, children: [ ElevatedButton.icon( onPressed: () => _pickImage(ImageSource.camera), @@ -110,17 +112,16 @@ class _NewDronePageState extends State { label: Text(l10n.takePhoto), style: ElevatedButton.styleFrom( backgroundColor: Colors.blueGrey[700], - foregroundColor: Colors.white, // Set text color to white + foregroundColor: Colors.white, ), ), - const SizedBox(width: 10), ElevatedButton.icon( onPressed: () => _pickImage(ImageSource.gallery), icon: const Icon(Icons.photo_library), label: Text(l10n.chooseFromGallery), style: ElevatedButton.styleFrom( backgroundColor: Colors.blueGrey[700], - foregroundColor: Colors.white, // Set text color to white + foregroundColor: Colors.white, ), ), ], @@ -159,7 +160,7 @@ class _NewDronePageState extends State { shape: MaterialStateProperty.all(RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), )), - foregroundColor: MaterialStateProperty.all(Colors.white), // Set text color to white + foregroundColor: MaterialStateProperty.all(Colors.white), ), child: Text( l10n.saveDrone, diff --git a/lib/pages/new_flight_page.dart b/lib/pages/new_flight_page.dart index 6f05d74..400999e 100644 --- a/lib/pages/new_flight_page.dart +++ b/lib/pages/new_flight_page.dart @@ -27,7 +27,7 @@ class _NewFlightPageState extends State { bool isFlightActive = false; Stopwatch stopwatch = Stopwatch(); Timer? timer; - String formattedTime = '00:00:00'; + String formattedTime = '00:00'; int? flightStartTime; bool useGpsLocation = false; @@ -226,7 +226,7 @@ class _NewFlightPageState extends State { setState(() { isFlightActive = false; stopwatch.reset(); - formattedTime = '00:00:00'; + formattedTime = '00:00'; selectedDrone = null; selectedBattery = null; currentPosition = null; @@ -243,10 +243,16 @@ class _NewFlightPageState extends State { String _formatDuration(Duration duration) { String twoDigits(int n) => n.toString().padLeft(2, '0'); - String hours = twoDigits(duration.inHours); - String minutes = twoDigits(duration.inMinutes.remainder(60)); - String seconds = twoDigits(duration.inSeconds.remainder(60)); - return '$hours:$minutes:$seconds'; + if (duration.inHours > 0) { + String hours = twoDigits(duration.inHours); + String minutes = twoDigits(duration.inMinutes.remainder(60)); + String seconds = twoDigits(duration.inSeconds.remainder(60)); + return '$hours:$minutes:$seconds'; + } else { + String minutes = twoDigits(duration.inMinutes.remainder(60)); + String seconds = twoDigits(duration.inSeconds.remainder(60)); + return '$minutes:$seconds'; + } } @override @@ -312,7 +318,7 @@ class _NewFlightPageState extends State { items: drones.map>((Drone drone) { return DropdownMenuItem( value: drone, - child: Text(drone.name, style: Theme.of(context).textTheme.titleMedium!.copyWith(color: Colors.white)), // Texte blanc + child: Text(drone.name, style: Theme.of(context).textTheme.titleMedium!.copyWith(color: Colors.white)), ); }).toList(), ), @@ -368,7 +374,7 @@ class _NewFlightPageState extends State { items: batteries.map>((Battery battery) { return DropdownMenuItem( value: battery, - child: Text('${battery.name} (${battery.voltage}V)', style: Theme.of(context).textTheme.titleMedium!.copyWith(color: Colors.white)), // Texte blanc + child: Text('${battery.name} (${battery.voltage}V)', style: Theme.of(context).textTheme.titleMedium!.copyWith(color: Colors.white)), ); }).toList(), ), @@ -482,10 +488,10 @@ class _NewFlightPageState extends State { child: isFlightActive ? ElevatedButton.icon( onPressed: _stopFlight, - icon: const Icon(Icons.stop, size: 30, color: Colors.white), // Icône blanche + icon: const Icon(Icons.stop, size: 30, color: Colors.white), label: Text( l10n.stopFlight, - style: const TextStyle(fontSize: 22, fontWeight: FontWeight.bold, color: Colors.white), // Texte blanc + style: const TextStyle(fontSize: 22, fontWeight: FontWeight.bold, color: Colors.white), ), style: ElevatedButton.styleFrom( backgroundColor: Colors.redAccent, @@ -508,10 +514,10 @@ class _NewFlightPageState extends State { ) : ElevatedButton.icon( onPressed: _startFlight, - icon: const Icon(Icons.flight_takeoff, size: 30, color: Colors.white), // Icône blanche + icon: const Icon(Icons.flight_takeoff, size: 30, color: Colors.white), label: Text( l10n.startFlight, - style: const TextStyle(fontSize: 22, fontWeight: FontWeight.bold, color: Colors.white), // Texte blanc + style: const TextStyle(fontSize: 22, fontWeight: FontWeight.bold, color: Colors.white), ), style: ElevatedButton.styleFrom( backgroundColor: colorProvider.accentColor,