feat : Add Event details view with first informations
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user