Add drone logo + change color off battery + drone + flight logo
This commit is contained in:
@ -16,7 +16,7 @@ import 'package:rtime/pages/flight_detail_page.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:rtime/providers/color_provider.dart';
|
||||
import 'package:rtime/widgets/page_transition_animations.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart'; // <-- Ajoutez cet import pour SvgPicture
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
|
||||
class HomePage extends StatefulWidget {
|
||||
const HomePage({super.key});
|
||||
@ -65,14 +65,13 @@ class _HomePageState extends State<HomePage> {
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
// Nouveau: Ajoutez le SvgPicture ici
|
||||
SvgPicture.asset(
|
||||
'assets/images/rtimelogo.svg', // Chemin vers votre SVG
|
||||
height: 48, // Ajustez la taille selon vos préférences
|
||||
width: 48, // Ajustez la taille selon vos préférences
|
||||
colorFilter: ColorFilter.mode(customAccentColor, BlendMode.srcIn), // Appliquez la couleur d'accentuation
|
||||
'assets/images/rtimelogo.svg',
|
||||
height: 48,
|
||||
width: 48,
|
||||
colorFilter: ColorFilter.mode(customAccentColor, BlendMode.srcIn),
|
||||
),
|
||||
const SizedBox(width: 8), // Petit espace entre le logo et le titre
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
l10n.appTitle,
|
||||
style: TextStyle(
|
||||
@ -82,7 +81,7 @@ class _HomePageState extends State<HomePage> {
|
||||
fontFamily: 'Montserrat',
|
||||
),
|
||||
),
|
||||
const Spacer(), // Cela poussera l'icône de réglages à l'extrémité
|
||||
const Spacer(),
|
||||
IconButton(
|
||||
icon:
|
||||
const Icon(Icons.settings, size: 30, color: Colors.white70),
|
||||
@ -136,7 +135,7 @@ class _HomePageState extends State<HomePage> {
|
||||
const SizedBox(height: 10),
|
||||
Text(l10n.addDrone,
|
||||
textAlign: TextAlign.center,
|
||||
style: Theme.of(context).textTheme.titleSmall!.copyWith(color: Colors.white)), // Texte blanc
|
||||
style: Theme.of(context).textTheme.titleSmall!.copyWith(color: Colors.white)),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -170,7 +169,7 @@ class _HomePageState extends State<HomePage> {
|
||||
const SizedBox(height: 10),
|
||||
Text(l10n.addDrone,
|
||||
textAlign: TextAlign.center,
|
||||
style: Theme.of(context).textTheme.titleSmall!.copyWith(color: Colors.white)), // Texte blanc
|
||||
style: Theme.of(context).textTheme.titleSmall!.copyWith(color: Colors.white)),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -238,7 +237,7 @@ class _HomePageState extends State<HomePage> {
|
||||
const SizedBox(height: 10),
|
||||
Text(l10n.addBattery,
|
||||
textAlign: TextAlign.center,
|
||||
style: Theme.of(context).textTheme.titleSmall!.copyWith(color: Colors.white)), // Texte blanc
|
||||
style: Theme.of(context).textTheme.titleSmall!.copyWith(color: Colors.white)),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -272,7 +271,7 @@ class _HomePageState extends State<HomePage> {
|
||||
const SizedBox(height: 10),
|
||||
Text(l10n.addBattery,
|
||||
textAlign: TextAlign.center,
|
||||
style: Theme.of(context).textTheme.titleSmall!.copyWith(color: Colors.white)), // Texte blanc
|
||||
style: Theme.of(context).textTheme.titleSmall!.copyWith(color: Colors.white)),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -340,7 +339,8 @@ class _HomePageState extends State<HomePage> {
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 20, vertical: 12),
|
||||
leading: Icon(Icons.flight_takeoff,
|
||||
color: Colors.orangeAccent, size: 32),
|
||||
color: customAccentColor, // Use the user's accent color here
|
||||
size: 32),
|
||||
title: Text(
|
||||
'${flight.name} - ${DateTime.fromMillisecondsSinceEpoch(flight.startTimestamp * 1000).toLocal().toString().split(' ')[0]}',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
@ -375,9 +375,9 @@ class _HomePageState extends State<HomePage> {
|
||||
},
|
||||
label: Text(
|
||||
l10n.newFlight,
|
||||
style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold, color: Colors.white), // Texte blanc
|
||||
style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold, color: Colors.white),
|
||||
),
|
||||
icon: const Icon(Icons.add_to_photos, size: 28, color: Colors.white), // Icône blanche
|
||||
icon: const Icon(Icons.add_to_photos, size: 28, color: Colors.white),
|
||||
),
|
||||
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
|
||||
);
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rtime/models/battery.dart';
|
||||
import 'package:rtime/images_manager.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:rtime/providers/color_provider.dart';
|
||||
|
||||
class BatteryCard extends StatelessWidget {
|
||||
final Battery battery;
|
||||
@ -14,10 +17,13 @@ class BatteryCard extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final BorderRadius cardBorderRadius =
|
||||
Theme.of(context).cardTheme.shape is RoundedRectangleBorder
|
||||
? (Theme.of(context).cardTheme.shape as RoundedRectangleBorder).borderRadius as BorderRadius
|
||||
: BorderRadius.circular(12);
|
||||
final colorProvider = Provider.of<ColorProvider>(context);
|
||||
final accentColor = colorProvider.accentColor;
|
||||
|
||||
final ShapeBorder? cardShape = Theme.of(context).cardTheme.shape;
|
||||
final BorderRadius cardBorderRadius = (cardShape is RoundedRectangleBorder)
|
||||
? (cardShape).borderRadius as BorderRadius
|
||||
: BorderRadius.circular(12);
|
||||
|
||||
return Card(
|
||||
margin: const EdgeInsets.only(right: 16),
|
||||
@ -34,23 +40,21 @@ class BatteryCard extends StatelessWidget {
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
SizedBox(
|
||||
width: 80,
|
||||
height: 80,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).brightness == Brightness.dark
|
||||
? Colors.blueGrey[700]
|
||||
: Colors.grey[200],
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: battery.imageUuid != null && battery.imageUuid!.isNotEmpty
|
||||
? FutureBuilder<Image?>(
|
||||
future: ImagesManager.instance.loadImage(battery.imageUuid!),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
return const Center(child: CircularProgressIndicator(color: Colors.tealAccent));
|
||||
return Center(child: CircularProgressIndicator(color: accentColor));
|
||||
} else if (snapshot.hasError || !snapshot.hasData || snapshot.data == null) {
|
||||
return Icon(Icons.broken_image, size: 50, color: Colors.blueGrey[400]);
|
||||
return Icon(
|
||||
Icons.battery_charging_full,
|
||||
size: 80,
|
||||
color: accentColor,
|
||||
);
|
||||
} else {
|
||||
return ClipRRect(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
@ -59,7 +63,11 @@ class BatteryCard extends StatelessWidget {
|
||||
}
|
||||
},
|
||||
)
|
||||
: Icon(Icons.battery_charging_full, size: 50, color: Theme.of(context).brightness == Brightness.dark ? Colors.tealAccent : Colors.green.shade400),
|
||||
: Icon(
|
||||
Icons.battery_charging_full,
|
||||
size: 80,
|
||||
color: accentColor,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Text(
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rtime/models/drone.dart';
|
||||
import 'package:rtime/images_manager.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:rtime/providers/color_provider.dart';
|
||||
|
||||
class DroneCard extends StatelessWidget {
|
||||
final Drone drone;
|
||||
@ -14,6 +17,8 @@ class DroneCard extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colorProvider = Provider.of<ColorProvider>(context);
|
||||
final accentColor = colorProvider.accentColor;
|
||||
|
||||
final BorderRadius cardBorderRadius =
|
||||
Theme.of(context).cardTheme.shape is RoundedRectangleBorder
|
||||
@ -22,10 +27,8 @@ class DroneCard extends StatelessWidget {
|
||||
|
||||
return Card(
|
||||
margin: const EdgeInsets.only(right: 16),
|
||||
|
||||
child: InkWell(
|
||||
onTap: onTap,
|
||||
|
||||
borderRadius: cardBorderRadius,
|
||||
child: ClipRRect(
|
||||
borderRadius: cardBorderRadius,
|
||||
@ -36,23 +39,22 @@ class DroneCard extends StatelessWidget {
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
SizedBox(
|
||||
width: 80,
|
||||
height: 80,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).brightness == Brightness.dark
|
||||
? Colors.blueGrey[700]
|
||||
: Colors.grey[200],
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: drone.imageUuid != null && drone.imageUuid!.isNotEmpty
|
||||
? FutureBuilder<Image?>(
|
||||
future: ImagesManager.instance.loadImage(drone.imageUuid!),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
return const Center(child: CircularProgressIndicator(color: Colors.lightBlueAccent));
|
||||
return Center(child: CircularProgressIndicator(color: accentColor));
|
||||
} else if (snapshot.hasError || !snapshot.hasData || snapshot.data == null) {
|
||||
return Icon(Icons.broken_image, size: 50, color: Colors.blueGrey[400]);
|
||||
return SvgPicture.asset(
|
||||
'assets/images/drone.svg',
|
||||
width: 50,
|
||||
height: 50,
|
||||
colorFilter: ColorFilter.mode(accentColor, BlendMode.srcIn),
|
||||
);
|
||||
} else {
|
||||
return ClipRRect(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
@ -61,7 +63,12 @@ class DroneCard extends StatelessWidget {
|
||||
}
|
||||
},
|
||||
)
|
||||
: Icon(Icons.airplanemode_active, size: 50, color: Theme.of(context).brightness == Brightness.dark ? Colors.lightBlueAccent : Colors.blue.shade400),
|
||||
: SvgPicture.asset(
|
||||
'assets/images/drone.svg',
|
||||
width: 50,
|
||||
height: 50,
|
||||
colorFilter: ColorFilter.mode(accentColor, BlendMode.srcIn),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Text(
|
||||
|
||||
Reference in New Issue
Block a user