feat : Add Event details view with first informations

This commit is contained in:
Yaël Perret
2025-07-15 21:32:32 +02:00
parent 5cbed8e6cd
commit 2cb2133208
13 changed files with 1307 additions and 3024 deletions

View File

@@ -11,7 +11,7 @@
"name": "_macros",
"rootUri": "file:///D:/SDK/flutter/bin/cache/dart-sdk/pkg/_macros",
"packageUri": "lib/",
"languageVersion": "3.4"
"languageVersion": "3.5"
},
{
"name": "analyzer",
@@ -27,7 +27,7 @@
},
{
"name": "async",
"rootUri": "file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/async-2.12.0",
"rootUri": "file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/async-2.13.0",
"packageUri": "lib/",
"languageVersion": "3.4"
},
@@ -135,7 +135,7 @@
},
{
"name": "fake_async",
"rootUri": "file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/fake_async-1.3.2",
"rootUri": "file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/fake_async-1.3.3",
"packageUri": "lib/",
"languageVersion": "3.3"
},
@@ -249,9 +249,9 @@
},
{
"name": "intl",
"rootUri": "file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/intl-0.19.0",
"rootUri": "file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/intl-0.20.2",
"packageUri": "lib/",
"languageVersion": "3.0"
"languageVersion": "3.3"
},
{
"name": "io",
@@ -273,7 +273,7 @@
},
{
"name": "leak_tracker",
"rootUri": "file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/leak_tracker-10.0.8",
"rootUri": "file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/leak_tracker-10.0.9",
"packageUri": "lib/",
"languageVersion": "3.2"
},
@@ -585,7 +585,7 @@
},
{
"name": "vm_service",
"rootUri": "file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/vm_service-14.3.1",
"rootUri": "file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/vm_service-15.0.0",
"packageUri": "lib/",
"languageVersion": "3.3"
},
@@ -638,10 +638,9 @@
"languageVersion": "3.0"
}
],
"generated": "2025-05-24T07:54:19.586866Z",
"generator": "pub",
"generatorVersion": "3.7.2",
"generatorVersion": "3.8.1",
"flutterRoot": "file:///D:/SDK/flutter",
"flutterVersion": "3.29.3",
"flutterVersion": "3.32.6",
"pubCache": "file:///C:/Users/Yael/AppData/Local/Pub/Cache"
}

View File

@@ -12,8 +12,8 @@ file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/args-2.6.0/
file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/args-2.6.0/lib/
async
3.4
file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/async-2.12.0/
file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/async-2.12.0/lib/
file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/async-2.13.0/
file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/async-2.13.0/lib/
boolean_selector
3.1
file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/boolean_selector-2.1.2/
@@ -84,8 +84,8 @@ file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/dart_style-2.3.7/
file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/dart_style-2.3.7/lib/
fake_async
3.3
file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/fake_async-1.3.2/
file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/fake_async-1.3.2/lib/
file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/fake_async-1.3.3/
file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/fake_async-1.3.3/lib/
ffi
3.3
file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/ffi-2.1.3/
@@ -147,9 +147,9 @@ http_parser
file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/http_parser-4.0.2/
file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/http_parser-4.0.2/lib/
intl
3.0
file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/intl-0.19.0/
file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/intl-0.19.0/lib/
3.3
file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/intl-0.20.2/
file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/intl-0.20.2/lib/
io
2.12
file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/io-1.0.4/
@@ -164,8 +164,8 @@ file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/json_annotation-4.9
file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/json_annotation-4.9.0/lib/
leak_tracker
3.2
file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/leak_tracker-10.0.8/
file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/leak_tracker-10.0.8/lib/
file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/leak_tracker-10.0.9/
file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/leak_tracker-10.0.9/lib/
leak_tracker_flutter_testing
3.2
file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/leak_tracker_flutter_testing-3.0.9/
@@ -368,8 +368,8 @@ file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/vector_math-2.1.4/
file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/vector_math-2.1.4/lib/
vm_service
3.3
file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/vm_service-14.3.1/
file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/vm_service-14.3.1/lib/
file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/vm_service-15.0.0/
file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/vm_service-15.0.0/lib/
watcher
3.0
file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/watcher-1.1.0/
@@ -399,7 +399,7 @@ yaml
file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/yaml-3.1.2/
file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/yaml-3.1.2/lib/
_macros
3.4
3.5
file:///D:/SDK/flutter/bin/cache/dart-sdk/pkg/_macros/
file:///D:/SDK/flutter/bin/cache/dart-sdk/pkg/_macros/lib/
sky_engine

View File

@@ -1 +1 @@
3.29.3
3.32.6

File diff suppressed because it is too large Load Diff

View File

@@ -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: [

View File

@@ -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);
}
}

View File

@@ -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'),
],
);
}
}

View 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();
}

View File

@@ -0,0 +1,3 @@
import 'package:stacked/stacked.dart';
class EventDetailsViewModel extends BaseViewModel {}

View File

@@ -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

View File

@@ -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}';
}
}
}

View File

@@ -34,10 +34,10 @@ packages:
dependency: transitive
description:
name: async
sha256: d2872f9c19731c2e5f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63
sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb"
url: "https://pub.dev"
source: hosted
version: "2.12.0"
version: "2.13.0"
boolean_selector:
dependency: transitive
description:
@@ -178,10 +178,10 @@ packages:
dependency: transitive
description:
name: fake_async
sha256: "6a95e56b2449df2273fd8c45a662d6947ce1ebb7aafe80e550a3f68297f3cacc"
sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44"
url: "https://pub.dev"
source: hosted
version: "1.3.2"
version: "1.3.3"
ffi:
dependency: transitive
description:
@@ -321,10 +321,10 @@ packages:
dependency: "direct main"
description:
name: intl
sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf
sha256: "3df61194eb431efc39c4ceba583b95633a403f46c9fd341e550ce0bfa50e9aa5"
url: "https://pub.dev"
source: hosted
version: "0.19.0"
version: "0.20.2"
io:
dependency: transitive
description:
@@ -353,10 +353,10 @@ packages:
dependency: transitive
description:
name: leak_tracker
sha256: c35baad643ba394b40aac41080300150a4f08fd0fd6a10378f8f7c6bc161acec
sha256: "6bb818ecbdffe216e81182c2f0714a2e62b593f4a4f13098713ff1685dfb6ab0"
url: "https://pub.dev"
source: hosted
version: "10.0.8"
version: "10.0.9"
leak_tracker_flutter_testing:
dependency: transitive
description:
@@ -766,10 +766,10 @@ packages:
dependency: transitive
description:
name: vm_service
sha256: "0968250880a6c5fe7edc067ed0a13d4bae1577fe2771dcf3010d52c4a9d3ca14"
sha256: ddfa8d30d89985b96407efce8acbdd124701f96741f2d981ca860662f1c0dc02
url: "https://pub.dev"
source: hosted
version: "14.3.1"
version: "15.0.0"
watcher:
dependency: transitive
description:

View File

@@ -0,0 +1,11 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:bahla_front/app/app.locator.dart';
import '../helpers/test_helpers.dart';
void main() {
group('EventDetailsViewModel Tests -', () {
setUp(() => registerServices());
tearDown(() => locator.reset());
});
}