feat : Change second row on right column to stacked in the bottom + Tap options

This commit is contained in:
Yaël Perret
2025-07-11 11:23:19 +02:00
parent 9a328ec9d8
commit 5cbed8e6cd
38 changed files with 131 additions and 104 deletions

View File

@@ -19,13 +19,16 @@ class HomeView extends StackedView<HomeViewModel> {
body: ListView.builder(
itemCount: viewModel.events.length,
itemBuilder: (context, index) {
return Container(
margin: const EdgeInsets.all(8),
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.primary,
borderRadius: BorderRadius.circular(8),
),
child:
return InkWell(
onTap: () => viewModel.onEventTap(index),
borderRadius: BorderRadius.circular(8),
child: Container(
margin: const EdgeInsets.all(8),
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.primary,
borderRadius: BorderRadius.circular(8),
),
child:
IntrinsicHeight(
child: Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
@@ -56,7 +59,8 @@ class HomeView extends StackedView<HomeViewModel> {
margin: const EdgeInsets.all(8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
@@ -79,15 +83,24 @@ class HomeView extends StackedView<HomeViewModel> {
],
),
IconButton(
icon: const Icon(Icons.favorite_border),
icon: Icon(
viewModel.events[index].isFavorite
? Icons.favorite
: Icons.favorite_border,
color: viewModel.events[index].isFavorite
? Colors.red
: null,
),
iconSize: 35,
onPressed: () {
// Handle more options
viewModel.toggleFavorite(index);
},
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
@@ -104,13 +117,13 @@ class HomeView extends StackedView<HomeViewModel> {
),
IconButton(
icon: const Icon(Icons.place),
iconSize: 35,
onPressed: () {
// Handle favorite action
},
),
],
),
const SizedBox(height: 8),
],
),
),
@@ -118,6 +131,7 @@ class HomeView extends StackedView<HomeViewModel> {
],
),
),
),
);
},
),

View File

@@ -27,6 +27,17 @@ class HomeViewModel extends BaseViewModel {
),
];
void toggleFavorite(int index) {
events[index].isFavorite = !events[index].isFavorite;
notifyListeners();
}
void onEventTap(int index) {
// 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.
}
}
class Event {
@@ -35,6 +46,7 @@ class Event {
String organizer = 'Organizer';
String? place;
DateTime? date;
bool isFavorite;
Event({
required this.name,
@@ -42,6 +54,7 @@ class Event {
required this.organizer,
this.date,
this.place,
this.isFavorite = false,
});
@override