Rectify some issues (right pixel overlap)

This commit is contained in:
2025-07-09 20:34:19 +02:00
parent e1684285a2
commit b835603a7c
5 changed files with 59 additions and 49 deletions

View File

@ -224,8 +224,10 @@ class _BatteryDetailPageState extends State<BatteryDetailPage> {
),
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<BatteryDetailPage> {
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<BatteryDetailPage> {
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<BatteryDetailPage> {
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]}',

View File

@ -222,8 +222,10 @@ class _DroneDetailPageState extends State<DroneDetailPage> {
),
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<DroneDetailPage> {
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<DroneDetailPage> {
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),

View File

@ -107,8 +107,10 @@ class _NewBatteryPageState extends State<NewBatteryPage> {
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<NewBatteryPage> {
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<NewBatteryPage> {
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,

View File

@ -101,8 +101,10 @@ class _NewDronePageState extends State<NewDronePage> {
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<NewDronePage> {
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<NewDronePage> {
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,

View File

@ -27,7 +27,7 @@ class _NewFlightPageState extends State<NewFlightPage> {
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<NewFlightPage> {
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<NewFlightPage> {
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<NewFlightPage> {
items: drones.map<DropdownMenuItem<Drone>>((Drone drone) {
return DropdownMenuItem<Drone>(
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<NewFlightPage> {
items: batteries.map<DropdownMenuItem<Battery>>((Battery battery) {
return DropdownMenuItem<Battery>(
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<NewFlightPage> {
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<NewFlightPage> {
)
: 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,