feat : Add Event details view with first informations
This commit is contained in:
@@ -6,7 +6,6 @@ import 'home_viewmodel.dart';
|
||||
|
||||
class HomeView extends StackedView<HomeViewModel> {
|
||||
const HomeView({Key? key}) : super(key: key);
|
||||
|
||||
|
||||
@override
|
||||
Widget builder(
|
||||
@@ -28,8 +27,7 @@ class HomeView extends StackedView<HomeViewModel> {
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child:
|
||||
IntrinsicHeight(
|
||||
child: IntrinsicHeight(
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
@@ -45,88 +43,99 @@ class HomeView extends StackedView<HomeViewModel> {
|
||||
bottomLeft: Radius.circular(8),
|
||||
),
|
||||
image: DecorationImage(
|
||||
image: AssetImage(viewModel.events[index].picture),
|
||||
image:
|
||||
AssetImage(viewModel.events[index].picture),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child:
|
||||
Container(
|
||||
margin: const EdgeInsets.all(8),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
viewModel.events[index].date != null
|
||||
? DateFormat.yMMMMd(Localizations.localeOf(context).toString())
|
||||
.format(viewModel.events[index].date!)
|
||||
: 'No date',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
Text(
|
||||
viewModel.events[index].name,
|
||||
style: Theme.of(context).textTheme.headlineMedium,
|
||||
),
|
||||
],
|
||||
),
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
viewModel.events[index].isFavorite
|
||||
? Icons.favorite
|
||||
: Icons.favorite_border,
|
||||
color: viewModel.events[index].isFavorite
|
||||
? Colors.red
|
||||
: null,
|
||||
child: Container(
|
||||
margin: const EdgeInsets.all(8),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
viewModel.events[index].date != null
|
||||
? DateFormat.yMMMMd(
|
||||
Localizations.localeOf(
|
||||
context)
|
||||
.toString())
|
||||
.format(
|
||||
viewModel.events[index].date!)
|
||||
: 'No date',
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.titleMedium,
|
||||
),
|
||||
iconSize: 35,
|
||||
onPressed: () {
|
||||
viewModel.toggleFavorite(index);
|
||||
},
|
||||
Text(
|
||||
viewModel.events[index].name,
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.headlineMedium,
|
||||
),
|
||||
],
|
||||
),
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
viewModel.events[index].isFavorite
|
||||
? Icons.favorite
|
||||
: Icons.favorite_border,
|
||||
color: viewModel.events[index].isFavorite
|
||||
? Colors.red
|
||||
: null,
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
viewModel.events[index].organizer,
|
||||
style: Theme.of(context).textTheme.bodyLarge,
|
||||
),
|
||||
Text(
|
||||
viewModel.events[index].place ?? 'No place',
|
||||
style: Theme.of(context).textTheme.bodyMedium,
|
||||
),
|
||||
],
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.place),
|
||||
iconSize: 35,
|
||||
onPressed: () {
|
||||
// Handle favorite action
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
iconSize: 35,
|
||||
onPressed: () {
|
||||
viewModel.toggleFavorite(index);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
viewModel.events[index].organizer,
|
||||
style:
|
||||
Theme.of(context).textTheme.bodyLarge,
|
||||
),
|
||||
Text(
|
||||
viewModel.events[index].place ??
|
||||
'No place',
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.bodyMedium,
|
||||
),
|
||||
],
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.place),
|
||||
iconSize: 35,
|
||||
onPressed: () {
|
||||
// Handle favorite action
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -134,8 +143,8 @@ class HomeView extends StackedView<HomeViewModel> {
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import 'package:bahla_front/app/app.locator.dart';
|
||||
import 'package:bahla_front/app/app.router.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
import 'package:stacked_services/stacked_services.dart';
|
||||
|
||||
class HomeViewModel extends BaseViewModel {
|
||||
final _navigationService = locator<NavigationService>();
|
||||
|
||||
List<String> items = List<String>.generate(100, (i) => 'Item $i');
|
||||
|
||||
@@ -36,8 +40,9 @@ class HomeViewModel extends BaseViewModel {
|
||||
// Gérer le clic sur l'événement
|
||||
print('Event tapped: ${events[index].name}');
|
||||
// Ici vous pouvez naviguer vers une page de détails, etc.
|
||||
}
|
||||
|
||||
_navigationService.navigateToEventDetailsView(eventId: index);
|
||||
}
|
||||
}
|
||||
|
||||
class Event {
|
||||
@@ -61,4 +66,4 @@ class Event {
|
||||
String toString() {
|
||||
return 'Event{name: $name, picture: $picture}';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user