feat : Add Event details view with first informations
This commit is contained in:
@@ -5,7 +5,8 @@ import 'package:bahla_front/ui/views/startup/startup_view.dart';
|
||||
import 'package:stacked/stacked_annotations.dart';
|
||||
import 'package:stacked_services/stacked_services.dart';
|
||||
import 'package:bahla_front/ui/views/main/main_view.dart';
|
||||
import 'package:bahla_front/ui/views/home/home_view.dart';
|
||||
import 'package:bahla_front/ui/views/event_details/event_details_view.dart';
|
||||
import 'package:bahla_front/ui/views/event_details/event_details_view.dart';
|
||||
// @stacked-import
|
||||
|
||||
@StackedApp(
|
||||
@@ -14,6 +15,8 @@ import 'package:bahla_front/ui/views/home/home_view.dart';
|
||||
MaterialRoute(page: StartupView),
|
||||
MaterialRoute(page: MainView),
|
||||
MaterialRoute(page: HomeView),
|
||||
MaterialRoute(page: EventDetailsView),
|
||||
MaterialRoute(page: EventDetailsView),
|
||||
// @stacked-route
|
||||
],
|
||||
dependencies: [
|
||||
|
||||
@@ -5,35 +5,35 @@
|
||||
// **************************************************************************
|
||||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'package:bahla_front/ui/views/event_details/event_details_view.dart'
|
||||
as _i5;
|
||||
import 'package:bahla_front/ui/views/home/home_view.dart' as _i2;
|
||||
import 'package:bahla_front/ui/views/main/main_view.dart' as _i4;
|
||||
import 'package:bahla_front/ui/views/startup/startup_view.dart' as _i3;
|
||||
import 'package:flutter/material.dart' as _i5;
|
||||
import 'package:flutter/material.dart' as _i6;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:stacked/stacked.dart' as _i1;
|
||||
import 'package:stacked_services/stacked_services.dart' as _i6;
|
||||
import 'package:stacked_services/stacked_services.dart' as _i7;
|
||||
|
||||
class Routes {
|
||||
|
||||
static const startupView = '/startup-view';
|
||||
|
||||
static const mainView = '/main-view';
|
||||
|
||||
static const homeView = '/home-view';
|
||||
|
||||
static const eventDetailsView = '/event-details-view';
|
||||
|
||||
static const all = <String>{
|
||||
homeView,
|
||||
startupView,
|
||||
mainView,
|
||||
eventDetailsView,
|
||||
};
|
||||
}
|
||||
|
||||
class StackedRouter extends _i1.RouterBase {
|
||||
final _routes = <_i1.RouteDef>[
|
||||
_i1.RouteDef(
|
||||
Routes.homeView,
|
||||
page: _i2.HomeView,
|
||||
),
|
||||
_i1.RouteDef(
|
||||
Routes.startupView,
|
||||
page: _i3.StartupView,
|
||||
@@ -46,27 +46,39 @@ class StackedRouter extends _i1.RouterBase {
|
||||
Routes.homeView,
|
||||
page: _i2.HomeView,
|
||||
),
|
||||
_i1.RouteDef(
|
||||
Routes.eventDetailsView,
|
||||
page: _i5.EventDetailsView,
|
||||
),
|
||||
];
|
||||
|
||||
final _pagesMap = <Type, _i1.StackedRouteFactory>{
|
||||
_i2.HomeView: (data) {
|
||||
return _i5.MaterialPageRoute<dynamic>(
|
||||
return _i6.MaterialPageRoute<dynamic>(
|
||||
builder: (context) => const _i2.HomeView(),
|
||||
settings: data,
|
||||
);
|
||||
},
|
||||
_i3.StartupView: (data) {
|
||||
return _i5.MaterialPageRoute<dynamic>(
|
||||
return _i6.MaterialPageRoute<dynamic>(
|
||||
builder: (context) => const _i3.StartupView(),
|
||||
settings: data,
|
||||
);
|
||||
},
|
||||
_i4.MainView: (data) {
|
||||
return _i5.MaterialPageRoute<dynamic>(
|
||||
return _i6.MaterialPageRoute<dynamic>(
|
||||
builder: (context) => const _i4.MainView(),
|
||||
settings: data,
|
||||
);
|
||||
},
|
||||
_i5.EventDetailsView: (data) {
|
||||
final args = data.getArgs<EventDetailsViewArguments>(nullOk: false);
|
||||
return _i6.MaterialPageRoute<dynamic>(
|
||||
builder: (context) =>
|
||||
_i5.EventDetailsView(key: args.key, eventId: args.eventId),
|
||||
settings: data,
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
@override
|
||||
@@ -76,21 +88,34 @@ class StackedRouter extends _i1.RouterBase {
|
||||
Map<Type, _i1.StackedRouteFactory> get pagesMap => _pagesMap;
|
||||
}
|
||||
|
||||
extension NavigatorStateExtension on _i6.NavigationService {
|
||||
Future<dynamic> navigateToHomeView([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
]) async {
|
||||
return navigateTo<dynamic>(Routes.homeView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
class EventDetailsViewArguments {
|
||||
const EventDetailsViewArguments({
|
||||
this.key,
|
||||
required this.eventId,
|
||||
});
|
||||
|
||||
final _i6.Key? key;
|
||||
|
||||
final int eventId;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return '{"key": "$key", "eventId": "$eventId"}';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(covariant EventDetailsViewArguments other) {
|
||||
if (identical(this, other)) return true;
|
||||
return other.key == key && other.eventId == eventId;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode {
|
||||
return key.hashCode ^ eventId.hashCode;
|
||||
}
|
||||
}
|
||||
|
||||
extension NavigatorStateExtension on _i7.NavigationService {
|
||||
Future<dynamic> navigateToStartupView([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
@@ -119,14 +144,31 @@ extension NavigatorStateExtension on _i6.NavigationService {
|
||||
transition: transition);
|
||||
}
|
||||
|
||||
Future<dynamic> replaceWithHomeView([
|
||||
Future<dynamic> navigateToHomeView([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
]) async {
|
||||
return replaceWith<dynamic>(Routes.homeView,
|
||||
return navigateTo<dynamic>(Routes.homeView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
|
||||
Future<dynamic> navigateToEventDetailsView({
|
||||
_i6.Key? key,
|
||||
required int eventId,
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
}) async {
|
||||
return navigateTo<dynamic>(Routes.eventDetailsView,
|
||||
arguments: EventDetailsViewArguments(key: key, eventId: eventId),
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
@@ -160,4 +202,35 @@ extension NavigatorStateExtension on _i6.NavigationService {
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
|
||||
Future<dynamic> replaceWithHomeView([
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
]) async {
|
||||
return replaceWith<dynamic>(Routes.homeView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
|
||||
Future<dynamic> replaceWithEventDetailsView({
|
||||
_i6.Key? key,
|
||||
required int eventId,
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
}) async {
|
||||
return replaceWith<dynamic>(Routes.eventDetailsView,
|
||||
arguments: EventDetailsViewArguments(key: key, eventId: eventId),
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,53 +38,87 @@ class MainApp extends StatelessWidget {
|
||||
onPrimary: Colors.white,
|
||||
onSecondary: Colors.white,
|
||||
onBackground: Colors.white,
|
||||
onSurface: Colors.white,
|
||||
onSurface: Colors.black,
|
||||
onPrimaryContainer: Colors.black,
|
||||
onSecondaryContainer: Colors.black,
|
||||
onTertiaryContainer: Colors.black,
|
||||
surfaceBright: Colors.black,
|
||||
),
|
||||
iconTheme: const IconThemeData(
|
||||
color: Colors.white,
|
||||
),
|
||||
textTheme: TextTheme(
|
||||
displayLarge: GoogleFonts.firaSans(
|
||||
fontSize: 96, fontWeight: FontWeight.normal, color: Colors.white),
|
||||
fontSize: 96,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.white),
|
||||
displayMedium: GoogleFonts.firaSans(
|
||||
fontSize: 60, fontWeight: FontWeight.normal, color: Colors.white),
|
||||
fontSize: 60,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.white),
|
||||
displaySmall: GoogleFonts.firaSans(
|
||||
fontSize: 48, fontWeight: FontWeight.normal, color: Colors.white),
|
||||
fontSize: 48,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.white),
|
||||
headlineLarge: GoogleFonts.firaSans(
|
||||
fontSize: 40, fontWeight: FontWeight.normal, color: Colors.white),
|
||||
fontSize: 40,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.white),
|
||||
headlineMedium: GoogleFonts.firaSans(
|
||||
fontSize: 34, fontWeight: FontWeight.normal, color: Colors.white),
|
||||
fontSize: 34,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.white),
|
||||
headlineSmall: GoogleFonts.firaSans(
|
||||
fontSize: 24, fontWeight: FontWeight.normal, color: Colors.white),
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.white),
|
||||
titleLarge: GoogleFonts.firaSans(
|
||||
fontSize: 20, fontWeight: FontWeight.normal, color: Colors.white),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.white),
|
||||
titleMedium: GoogleFonts.firaSans(
|
||||
fontSize: 16, fontWeight: FontWeight.normal, color: Colors.white),
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.white),
|
||||
titleSmall: GoogleFonts.firaSans(
|
||||
fontSize: 14, fontWeight: FontWeight.normal, color: Colors.white),
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.white),
|
||||
bodyLarge: GoogleFonts.firaSans(
|
||||
fontSize: 20, fontWeight: FontWeight.normal, color: Colors.white),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.white),
|
||||
bodyMedium: GoogleFonts.firaSans(
|
||||
fontSize: 16, fontWeight: FontWeight.normal, color: Colors.white),
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.white),
|
||||
bodySmall: GoogleFonts.firaSans(
|
||||
fontSize: 14, fontWeight: FontWeight.normal, color: Colors.white),
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.white),
|
||||
labelLarge: GoogleFonts.firaSans(
|
||||
fontSize: 14, fontWeight: FontWeight.normal, color: Colors.white),
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.white),
|
||||
labelMedium: GoogleFonts.firaSans(
|
||||
fontSize: 12, fontWeight: FontWeight.normal, color: Colors.white),
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.white),
|
||||
labelSmall: GoogleFonts.firaSans(
|
||||
fontSize: 10, fontWeight: FontWeight.normal, color: Colors.white),
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.white),
|
||||
)),
|
||||
localizationsDelegates: const [
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
],
|
||||
supportedLocales: const [
|
||||
Locale('en'),
|
||||
Locale('fr'),
|
||||
Locale('ch'),
|
||||
],
|
||||
localizationsDelegates: const [
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
],
|
||||
supportedLocales: const [
|
||||
Locale('en'),
|
||||
Locale('fr'),
|
||||
Locale('ch'),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
141
lib/ui/views/event_details/event_details_view.dart
Normal file
141
lib/ui/views/event_details/event_details_view.dart
Normal file
@@ -0,0 +1,141 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
|
||||
import 'event_details_viewmodel.dart';
|
||||
|
||||
class EventDetailsView extends StackedView<EventDetailsViewModel> {
|
||||
final int eventId;
|
||||
const EventDetailsView({Key? key, required this.eventId}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget builder(
|
||||
BuildContext context,
|
||||
EventDetailsViewModel viewModel,
|
||||
Widget? child,
|
||||
) {
|
||||
return Scaffold(
|
||||
backgroundColor: Theme.of(context).colorScheme.background,
|
||||
body: Column(
|
||||
children: [
|
||||
Container(
|
||||
width: double.infinity,
|
||||
height: MediaQuery.of(context).size.width * 9 / 16,
|
||||
child: const Image(
|
||||
image: AssetImage('assets/images/Affiche.jpg'),
|
||||
fit: BoxFit.cover,
|
||||
alignment: Alignment.center,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
color: Colors.white,
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Titre de l'événement
|
||||
Text(
|
||||
'Disc\'Octonelle 2',
|
||||
style: TextStyle(
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// Date
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.calendar_today,
|
||||
size: 20,
|
||||
color: Colors.grey[600],
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Text(
|
||||
'29.04.2023',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// Lieu
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.location_on,
|
||||
size: 20,
|
||||
color: Colors.grey[600],
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Anim-Halle',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'En Bas-les-Barres 6',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.grey[600],
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'2316 Les Ponts-de-martel',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.grey[600],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// Organisation
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 20,
|
||||
height: 20,
|
||||
child: Icon(
|
||||
Icons.groups,
|
||||
size: 20,
|
||||
color: Colors.grey[600],
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Text(
|
||||
'L\'Octonelle',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
EventDetailsViewModel viewModelBuilder(
|
||||
BuildContext context,
|
||||
) =>
|
||||
EventDetailsViewModel();
|
||||
}
|
||||
3
lib/ui/views/event_details/event_details_viewmodel.dart
Normal file
3
lib/ui/views/event_details/event_details_viewmodel.dart
Normal file
@@ -0,0 +1,3 @@
|
||||
import 'package:stacked/stacked.dart';
|
||||
|
||||
class EventDetailsViewModel extends BaseViewModel {}
|
||||
@@ -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