feat : Change second row on right column to stacked in the bottom + Tap options
This commit is contained in:
@@ -35,38 +35,45 @@ class MainApp extends StatelessWidget {
|
||||
primary: const Color.fromARGB(255, 64, 175, 255),
|
||||
secondary: const Color.fromARGB(255, 255, 139, 6),
|
||||
background: const Color.fromARGB(255, 15, 14, 23),
|
||||
onPrimary: Colors.white,
|
||||
onSecondary: Colors.white,
|
||||
onBackground: Colors.white,
|
||||
onSurface: Colors.white,
|
||||
),
|
||||
iconTheme: const IconThemeData(
|
||||
color: Colors.white,
|
||||
),
|
||||
textTheme: TextTheme(
|
||||
displayLarge: GoogleFonts.firaSans(
|
||||
fontSize: 96, fontWeight: FontWeight.normal),
|
||||
fontSize: 96, fontWeight: FontWeight.normal, color: Colors.white),
|
||||
displayMedium: GoogleFonts.firaSans(
|
||||
fontSize: 60, fontWeight: FontWeight.normal),
|
||||
fontSize: 60, fontWeight: FontWeight.normal, color: Colors.white),
|
||||
displaySmall: GoogleFonts.firaSans(
|
||||
fontSize: 48, fontWeight: FontWeight.normal),
|
||||
fontSize: 48, fontWeight: FontWeight.normal, color: Colors.white),
|
||||
headlineLarge: GoogleFonts.firaSans(
|
||||
fontSize: 40, fontWeight: FontWeight.normal),
|
||||
fontSize: 40, fontWeight: FontWeight.normal, color: Colors.white),
|
||||
headlineMedium: GoogleFonts.firaSans(
|
||||
fontSize: 34, fontWeight: FontWeight.normal),
|
||||
fontSize: 34, fontWeight: FontWeight.normal, color: Colors.white),
|
||||
headlineSmall: GoogleFonts.firaSans(
|
||||
fontSize: 24, fontWeight: FontWeight.normal),
|
||||
fontSize: 24, fontWeight: FontWeight.normal, color: Colors.white),
|
||||
titleLarge: GoogleFonts.firaSans(
|
||||
fontSize: 20, fontWeight: FontWeight.normal),
|
||||
fontSize: 20, fontWeight: FontWeight.normal, color: Colors.white),
|
||||
titleMedium: GoogleFonts.firaSans(
|
||||
fontSize: 16, fontWeight: FontWeight.normal),
|
||||
fontSize: 16, fontWeight: FontWeight.normal, color: Colors.white),
|
||||
titleSmall: GoogleFonts.firaSans(
|
||||
fontSize: 14, fontWeight: FontWeight.normal),
|
||||
fontSize: 14, fontWeight: FontWeight.normal, color: Colors.white),
|
||||
bodyLarge: GoogleFonts.firaSans(
|
||||
fontSize: 20, fontWeight: FontWeight.normal),
|
||||
fontSize: 20, fontWeight: FontWeight.normal, color: Colors.white),
|
||||
bodyMedium: GoogleFonts.firaSans(
|
||||
fontSize: 16, fontWeight: FontWeight.normal),
|
||||
fontSize: 16, fontWeight: FontWeight.normal, color: Colors.white),
|
||||
bodySmall: GoogleFonts.firaSans(
|
||||
fontSize: 14, fontWeight: FontWeight.normal),
|
||||
fontSize: 14, fontWeight: FontWeight.normal, color: Colors.white),
|
||||
labelLarge: GoogleFonts.firaSans(
|
||||
fontSize: 14, fontWeight: FontWeight.normal),
|
||||
fontSize: 14, fontWeight: FontWeight.normal, color: Colors.white),
|
||||
labelMedium: GoogleFonts.firaSans(
|
||||
fontSize: 12, fontWeight: FontWeight.normal),
|
||||
fontSize: 12, fontWeight: FontWeight.normal, color: Colors.white),
|
||||
labelSmall: GoogleFonts.firaSans(
|
||||
fontSize: 10, fontWeight: FontWeight.normal),
|
||||
fontSize: 10, fontWeight: FontWeight.normal, color: Colors.white),
|
||||
)),
|
||||
localizationsDelegates: const [
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
|
||||
@@ -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> {
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user