feat(garage): show real motorcycle photos on garage cards
This commit is contained in:
parent
4ed4a24813
commit
aae1b5fca1
|
|
@ -6,6 +6,7 @@ import '../../database/database.dart';
|
||||||
import '../../models/motorcycle_models.dart';
|
import '../../models/motorcycle_models.dart';
|
||||||
import '../../core/theme/evolution_theme_config.dart';
|
import '../../core/theme/evolution_theme_config.dart';
|
||||||
import 'garage_providers.dart';
|
import 'garage_providers.dart';
|
||||||
|
import 'widgets/motorcycle_photo.dart';
|
||||||
|
|
||||||
class GarageScreen extends ConsumerWidget {
|
class GarageScreen extends ConsumerWidget {
|
||||||
const GarageScreen({super.key});
|
const GarageScreen({super.key});
|
||||||
|
|
@ -39,15 +40,12 @@ class GarageScreen extends ConsumerWidget {
|
||||||
loading: () => const Center(child: CircularProgressIndicator()),
|
loading: () => const Center(child: CircularProgressIndicator()),
|
||||||
error: (err, stack) => Center(child: Text('Error loading garage: $err')),
|
error: (err, stack) => Center(child: Text('Error loading garage: $err')),
|
||||||
data: (bikes) {
|
data: (bikes) {
|
||||||
if (bikes.isEmpty) {
|
if (bikes.isEmpty) return _buildEmptyState(context);
|
||||||
return _buildEmptyState(context);
|
|
||||||
}
|
|
||||||
return ListView.builder(
|
return ListView.builder(
|
||||||
padding: const EdgeInsets.all(16.0),
|
padding: const EdgeInsets.all(16.0),
|
||||||
itemCount: bikes.length,
|
itemCount: bikes.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
final bike = bikes[index];
|
return _buildMotorcycleCard(context, ref, bikes[index], themeMode);
|
||||||
return _buildMotorcycleCard(context, ref, bike, themeMode);
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
@ -112,7 +110,6 @@ class GarageScreen extends ConsumerWidget {
|
||||||
final displayName = bike.nickname != null && bike.nickname!.isNotEmpty
|
final displayName = bike.nickname != null && bike.nickname!.isNotEmpty
|
||||||
? '${bike.nickname} (${bike.year} ${bike.makeName} ${bike.modelName})'
|
? '${bike.nickname} (${bike.year} ${bike.makeName} ${bike.modelName})'
|
||||||
: '${bike.year} ${bike.makeName} ${bike.modelName}';
|
: '${bike.year} ${bike.makeName} ${bike.modelName}';
|
||||||
|
|
||||||
final isEvolution = themeMode == DashboardThemeMode.evolution;
|
final isEvolution = themeMode == DashboardThemeMode.evolution;
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
|
|
@ -133,23 +130,21 @@ class GarageScreen extends ConsumerWidget {
|
||||||
borderRadius: BorderRadius.circular(isEvolution ? 14 : 12),
|
borderRadius: BorderRadius.circular(isEvolution ? 14 : 12),
|
||||||
onTap: () => context.push('/garage/${bike.id}'),
|
onTap: () => context.push('/garage/${bike.id}'),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(16.0),
|
padding: const EdgeInsets.all(12.0),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
MotorcyclePhoto(
|
||||||
|
year: bike.year,
|
||||||
|
make: bike.makeName,
|
||||||
|
model: bike.modelName,
|
||||||
|
height: 190,
|
||||||
|
borderRadius: BorderRadius.circular(isEvolution ? 10 : 8),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 14),
|
||||||
Row(
|
Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Container(
|
|
||||||
padding: const EdgeInsets.all(12),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: isEvolution ? const Color(0xFF141414) : Colors.white10,
|
|
||||||
borderRadius: BorderRadius.circular(10),
|
|
||||||
border: isEvolution ? Border.all(color: const Color(0xFF222222)) : null,
|
|
||||||
),
|
|
||||||
child: const Icon(Icons.two_wheeler, size: 36, color: Color(0xFF00E5FF)),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 16),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
|
@ -205,7 +200,7 @@ class GarageScreen extends ConsumerWidget {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 12),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue