Compare commits
2 Commits
8fc0a6ff86
...
d88b32d8f2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d88b32d8f2 | ||
|
|
93a54ae19b |
@@ -265,6 +265,12 @@
|
|||||||
"packageUri": "lib/",
|
"packageUri": "lib/",
|
||||||
"languageVersion": "3.9"
|
"languageVersion": "3.9"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "json_serializable",
|
||||||
|
"rootUri": "file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/json_serializable-6.13.2",
|
||||||
|
"packageUri": "lib/",
|
||||||
|
"languageVersion": "3.9"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "leak_tracker",
|
"name": "leak_tracker",
|
||||||
"rootUri": "file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/leak_tracker-11.0.2",
|
"rootUri": "file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/leak_tracker-11.0.2",
|
||||||
@@ -481,6 +487,12 @@
|
|||||||
"packageUri": "lib/",
|
"packageUri": "lib/",
|
||||||
"languageVersion": "3.9"
|
"languageVersion": "3.9"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "source_helper",
|
||||||
|
"rootUri": "file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/source_helper-1.3.12",
|
||||||
|
"packageUri": "lib/",
|
||||||
|
"languageVersion": "3.9"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "source_span",
|
"name": "source_span",
|
||||||
"rootUri": "file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/source_span-1.10.2",
|
"rootUri": "file:///C:/Users/Yael/AppData/Local/Pub/Cache/hosted/pub.dev/source_span-1.10.2",
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// dart format width=80
|
||||||
|
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
// StackedBottomsheetGenerator
|
// StackedBottomsheetGenerator
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// dart format width=80
|
||||||
|
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
// StackedDialogGenerator
|
// StackedDialogGenerator
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// dart format width=80
|
||||||
|
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
// StackedLocatorGenerator
|
// StackedLocatorGenerator
|
||||||
@@ -13,10 +14,8 @@ import 'package:stacked_shared/stacked_shared.dart';
|
|||||||
|
|
||||||
final locator = StackedLocator.instance;
|
final locator = StackedLocator.instance;
|
||||||
|
|
||||||
Future<void> setupLocator({
|
Future<void> setupLocator(
|
||||||
String? environment,
|
{String? environment, EnvironmentFilter? environmentFilter}) async {
|
||||||
EnvironmentFilter? environmentFilter,
|
|
||||||
}) async {
|
|
||||||
// Register environments
|
// Register environments
|
||||||
locator.registerEnvironment(
|
locator.registerEnvironment(
|
||||||
environment: environment, environmentFilter: environmentFilter);
|
environment: environment, environmentFilter: environmentFilter);
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// dart format width=80
|
||||||
|
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
// StackedNavigatorGenerator
|
// StackedNavigatorGenerator
|
||||||
@@ -16,6 +17,8 @@ import 'package:stacked/stacked.dart' as _i1;
|
|||||||
import 'package:stacked_services/stacked_services.dart' as _i7;
|
import 'package:stacked_services/stacked_services.dart' as _i7;
|
||||||
|
|
||||||
class Routes {
|
class Routes {
|
||||||
|
static const homeView = '/home-view';
|
||||||
|
|
||||||
static const startupView = '/startup-view';
|
static const startupView = '/startup-view';
|
||||||
|
|
||||||
static const mainView = '/main-view';
|
static const mainView = '/main-view';
|
||||||
@@ -24,6 +27,8 @@ class Routes {
|
|||||||
|
|
||||||
static const eventDetailsView = '/event-details-view';
|
static const eventDetailsView = '/event-details-view';
|
||||||
|
|
||||||
|
static const eventDetailsView = '/event-details-view';
|
||||||
|
|
||||||
static const all = <String>{
|
static const all = <String>{
|
||||||
homeView,
|
homeView,
|
||||||
startupView,
|
startupView,
|
||||||
@@ -34,6 +39,10 @@ class Routes {
|
|||||||
|
|
||||||
class StackedRouter extends _i1.RouterBase {
|
class StackedRouter extends _i1.RouterBase {
|
||||||
final _routes = <_i1.RouteDef>[
|
final _routes = <_i1.RouteDef>[
|
||||||
|
_i1.RouteDef(
|
||||||
|
Routes.homeView,
|
||||||
|
page: _i2.HomeView,
|
||||||
|
),
|
||||||
_i1.RouteDef(
|
_i1.RouteDef(
|
||||||
Routes.startupView,
|
Routes.startupView,
|
||||||
page: _i3.StartupView,
|
page: _i3.StartupView,
|
||||||
@@ -50,24 +59,37 @@ class StackedRouter extends _i1.RouterBase {
|
|||||||
Routes.eventDetailsView,
|
Routes.eventDetailsView,
|
||||||
page: _i5.EventDetailsView,
|
page: _i5.EventDetailsView,
|
||||||
),
|
),
|
||||||
|
_i1.RouteDef(
|
||||||
|
Routes.eventDetailsView,
|
||||||
|
page: _i5.EventDetailsView,
|
||||||
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
final _pagesMap = <Type, _i1.StackedRouteFactory>{
|
final _pagesMap = <Type, _i1.StackedRouteFactory>{
|
||||||
_i2.HomeView: (data) {
|
_i2.HomeView: (data) {
|
||||||
|
final args = data.getArgs<HomeViewArguments>(
|
||||||
|
orElse: () => const HomeViewArguments(),
|
||||||
|
);
|
||||||
return _i6.MaterialPageRoute<dynamic>(
|
return _i6.MaterialPageRoute<dynamic>(
|
||||||
builder: (context) => const _i2.HomeView(),
|
builder: (context) => _i2.HomeView(key: args.key),
|
||||||
settings: data,
|
settings: data,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
_i3.StartupView: (data) {
|
_i3.StartupView: (data) {
|
||||||
|
final args = data.getArgs<StartupViewArguments>(
|
||||||
|
orElse: () => const StartupViewArguments(),
|
||||||
|
);
|
||||||
return _i6.MaterialPageRoute<dynamic>(
|
return _i6.MaterialPageRoute<dynamic>(
|
||||||
builder: (context) => const _i3.StartupView(),
|
builder: (context) => _i3.StartupView(key: args.key),
|
||||||
settings: data,
|
settings: data,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
_i4.MainView: (data) {
|
_i4.MainView: (data) {
|
||||||
|
final args = data.getArgs<MainViewArguments>(
|
||||||
|
orElse: () => const MainViewArguments(),
|
||||||
|
);
|
||||||
return _i6.MaterialPageRoute<dynamic>(
|
return _i6.MaterialPageRoute<dynamic>(
|
||||||
builder: (context) => const _i4.MainView(),
|
builder: (context) => _i4.MainView(key: args.key),
|
||||||
settings: data,
|
settings: data,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@@ -88,6 +110,72 @@ class StackedRouter extends _i1.RouterBase {
|
|||||||
Map<Type, _i1.StackedRouteFactory> get pagesMap => _pagesMap;
|
Map<Type, _i1.StackedRouteFactory> get pagesMap => _pagesMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class HomeViewArguments {
|
||||||
|
const HomeViewArguments({this.key});
|
||||||
|
|
||||||
|
final _i6.Key? key;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return '{"key": "$key"}';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(covariant HomeViewArguments other) {
|
||||||
|
if (identical(this, other)) return true;
|
||||||
|
return other.key == key;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode {
|
||||||
|
return key.hashCode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class StartupViewArguments {
|
||||||
|
const StartupViewArguments({this.key});
|
||||||
|
|
||||||
|
final _i6.Key? key;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return '{"key": "$key"}';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(covariant StartupViewArguments other) {
|
||||||
|
if (identical(this, other)) return true;
|
||||||
|
return other.key == key;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode {
|
||||||
|
return key.hashCode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class MainViewArguments {
|
||||||
|
const MainViewArguments({this.key});
|
||||||
|
|
||||||
|
final _i6.Key? key;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return '{"key": "$key"}';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(covariant MainViewArguments other) {
|
||||||
|
if (identical(this, other)) return true;
|
||||||
|
return other.key == key;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode {
|
||||||
|
return key.hashCode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class EventDetailsViewArguments {
|
class EventDetailsViewArguments {
|
||||||
const EventDetailsViewArguments({
|
const EventDetailsViewArguments({
|
||||||
this.key,
|
this.key,
|
||||||
@@ -116,42 +204,64 @@ class EventDetailsViewArguments {
|
|||||||
}
|
}
|
||||||
|
|
||||||
extension NavigatorStateExtension on _i7.NavigationService {
|
extension NavigatorStateExtension on _i7.NavigationService {
|
||||||
Future<dynamic> navigateToStartupView([
|
Future<dynamic> navigateToHomeView({
|
||||||
|
_i6.Key? key,
|
||||||
int? routerId,
|
int? routerId,
|
||||||
bool preventDuplicates = true,
|
bool preventDuplicates = true,
|
||||||
Map<String, String>? parameters,
|
Map<String, String>? parameters,
|
||||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||||
transition,
|
transition,
|
||||||
]) async {
|
}) async {
|
||||||
return navigateTo<dynamic>(Routes.startupView,
|
|
||||||
id: routerId,
|
|
||||||
preventDuplicates: preventDuplicates,
|
|
||||||
parameters: parameters,
|
|
||||||
transition: transition);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<dynamic> navigateToMainView([
|
|
||||||
int? routerId,
|
|
||||||
bool preventDuplicates = true,
|
|
||||||
Map<String, String>? parameters,
|
|
||||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
|
||||||
transition,
|
|
||||||
]) async {
|
|
||||||
return navigateTo<dynamic>(Routes.mainView,
|
|
||||||
id: routerId,
|
|
||||||
preventDuplicates: preventDuplicates,
|
|
||||||
parameters: parameters,
|
|
||||||
transition: transition);
|
|
||||||
}
|
|
||||||
|
|
||||||
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,
|
return navigateTo<dynamic>(Routes.homeView,
|
||||||
|
arguments: HomeViewArguments(key: key),
|
||||||
|
id: routerId,
|
||||||
|
preventDuplicates: preventDuplicates,
|
||||||
|
parameters: parameters,
|
||||||
|
transition: transition);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<dynamic> navigateToStartupView({
|
||||||
|
_i6.Key? key,
|
||||||
|
int? routerId,
|
||||||
|
bool preventDuplicates = true,
|
||||||
|
Map<String, String>? parameters,
|
||||||
|
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||||
|
transition,
|
||||||
|
}) async {
|
||||||
|
return navigateTo<dynamic>(Routes.startupView,
|
||||||
|
arguments: StartupViewArguments(key: key),
|
||||||
|
id: routerId,
|
||||||
|
preventDuplicates: preventDuplicates,
|
||||||
|
parameters: parameters,
|
||||||
|
transition: transition);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<dynamic> navigateToMainView({
|
||||||
|
_i6.Key? key,
|
||||||
|
int? routerId,
|
||||||
|
bool preventDuplicates = true,
|
||||||
|
Map<String, String>? parameters,
|
||||||
|
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||||
|
transition,
|
||||||
|
}) async {
|
||||||
|
return navigateTo<dynamic>(Routes.mainView,
|
||||||
|
arguments: MainViewArguments(key: key),
|
||||||
|
id: routerId,
|
||||||
|
preventDuplicates: preventDuplicates,
|
||||||
|
parameters: parameters,
|
||||||
|
transition: transition);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<dynamic> navigateToHomeView({
|
||||||
|
_i6.Key? key,
|
||||||
|
int? routerId,
|
||||||
|
bool preventDuplicates = true,
|
||||||
|
Map<String, String>? parameters,
|
||||||
|
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||||
|
transition,
|
||||||
|
}) async {
|
||||||
|
return navigateTo<dynamic>(Routes.homeView,
|
||||||
|
arguments: HomeViewArguments(key: key),
|
||||||
id: routerId,
|
id: routerId,
|
||||||
preventDuplicates: preventDuplicates,
|
preventDuplicates: preventDuplicates,
|
||||||
parameters: parameters,
|
parameters: parameters,
|
||||||
@@ -175,42 +285,98 @@ extension NavigatorStateExtension on _i7.NavigationService {
|
|||||||
transition: transition);
|
transition: transition);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> replaceWithStartupView([
|
Future<dynamic> navigateToEventDetailsView({
|
||||||
|
_i6.Key? key,
|
||||||
|
required int eventId,
|
||||||
int? routerId,
|
int? routerId,
|
||||||
bool preventDuplicates = true,
|
bool preventDuplicates = true,
|
||||||
Map<String, String>? parameters,
|
Map<String, String>? parameters,
|
||||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||||
transition,
|
transition,
|
||||||
]) async {
|
}) async {
|
||||||
return replaceWith<dynamic>(Routes.startupView,
|
return navigateTo<dynamic>(Routes.eventDetailsView,
|
||||||
|
arguments: EventDetailsViewArguments(key: key, eventId: eventId),
|
||||||
id: routerId,
|
id: routerId,
|
||||||
preventDuplicates: preventDuplicates,
|
preventDuplicates: preventDuplicates,
|
||||||
parameters: parameters,
|
parameters: parameters,
|
||||||
transition: transition);
|
transition: transition);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> replaceWithMainView([
|
Future<dynamic> replaceWithHomeView({
|
||||||
|
_i6.Key? key,
|
||||||
int? routerId,
|
int? routerId,
|
||||||
bool preventDuplicates = true,
|
bool preventDuplicates = true,
|
||||||
Map<String, String>? parameters,
|
Map<String, String>? parameters,
|
||||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||||
transition,
|
transition,
|
||||||
]) async {
|
}) async {
|
||||||
return replaceWith<dynamic>(Routes.mainView,
|
|
||||||
id: routerId,
|
|
||||||
preventDuplicates: preventDuplicates,
|
|
||||||
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,
|
return replaceWith<dynamic>(Routes.homeView,
|
||||||
|
arguments: HomeViewArguments(key: key),
|
||||||
|
id: routerId,
|
||||||
|
preventDuplicates: preventDuplicates,
|
||||||
|
parameters: parameters,
|
||||||
|
transition: transition);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<dynamic> replaceWithStartupView({
|
||||||
|
_i6.Key? key,
|
||||||
|
int? routerId,
|
||||||
|
bool preventDuplicates = true,
|
||||||
|
Map<String, String>? parameters,
|
||||||
|
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||||
|
transition,
|
||||||
|
}) async {
|
||||||
|
return replaceWith<dynamic>(Routes.startupView,
|
||||||
|
arguments: StartupViewArguments(key: key),
|
||||||
|
id: routerId,
|
||||||
|
preventDuplicates: preventDuplicates,
|
||||||
|
parameters: parameters,
|
||||||
|
transition: transition);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<dynamic> replaceWithMainView({
|
||||||
|
_i6.Key? key,
|
||||||
|
int? routerId,
|
||||||
|
bool preventDuplicates = true,
|
||||||
|
Map<String, String>? parameters,
|
||||||
|
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||||
|
transition,
|
||||||
|
}) async {
|
||||||
|
return replaceWith<dynamic>(Routes.mainView,
|
||||||
|
arguments: MainViewArguments(key: key),
|
||||||
|
id: routerId,
|
||||||
|
preventDuplicates: preventDuplicates,
|
||||||
|
parameters: parameters,
|
||||||
|
transition: transition);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<dynamic> replaceWithHomeView({
|
||||||
|
_i6.Key? key,
|
||||||
|
int? routerId,
|
||||||
|
bool preventDuplicates = true,
|
||||||
|
Map<String, String>? parameters,
|
||||||
|
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||||
|
transition,
|
||||||
|
}) async {
|
||||||
|
return replaceWith<dynamic>(Routes.homeView,
|
||||||
|
arguments: HomeViewArguments(key: key),
|
||||||
|
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,
|
id: routerId,
|
||||||
preventDuplicates: preventDuplicates,
|
preventDuplicates: preventDuplicates,
|
||||||
parameters: parameters,
|
parameters: parameters,
|
||||||
|
|||||||
30
lib/models/event.dart
Normal file
30
lib/models/event.dart
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
import 'package:json_annotation/json_annotation.dart';
|
||||||
|
|
||||||
|
part 'event.g.dart';
|
||||||
|
|
||||||
|
@JsonSerializable()
|
||||||
|
class Event {
|
||||||
|
String name;
|
||||||
|
String picture;
|
||||||
|
String organizer = 'Organizer';
|
||||||
|
String? place;
|
||||||
|
DateTime? date;
|
||||||
|
bool isFavorite;
|
||||||
|
|
||||||
|
Event({
|
||||||
|
required this.name,
|
||||||
|
required this.picture,
|
||||||
|
required this.organizer,
|
||||||
|
this.date,
|
||||||
|
this.place,
|
||||||
|
this.isFavorite = false,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'Event{name: $name, picture: $picture}';
|
||||||
|
}
|
||||||
|
|
||||||
|
factory Event.fromJson(Map<String, dynamic> json) => _$EventFromJson(json);
|
||||||
|
Map<String, dynamic> toJson() => _$EventToJson(this);
|
||||||
|
}
|
||||||
26
lib/models/event.g.dart
Normal file
26
lib/models/event.g.dart
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'event.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// JsonSerializableGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
Event _$EventFromJson(Map<String, dynamic> json) => Event(
|
||||||
|
name: json['name'] as String,
|
||||||
|
picture: json['picture'] as String,
|
||||||
|
organizer: json['organizer'] as String,
|
||||||
|
date:
|
||||||
|
json['date'] == null ? null : DateTime.parse(json['date'] as String),
|
||||||
|
place: json['place'] as String?,
|
||||||
|
isFavorite: json['isFavorite'] as bool? ?? false,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$EventToJson(Event instance) => <String, dynamic>{
|
||||||
|
'name': instance.name,
|
||||||
|
'picture': instance.picture,
|
||||||
|
'organizer': instance.organizer,
|
||||||
|
'place': instance.place,
|
||||||
|
'date': instance.date?.toIso8601String(),
|
||||||
|
'isFavorite': instance.isFavorite,
|
||||||
|
};
|
||||||
33
lib/models/post.dart
Normal file
33
lib/models/post.dart
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
import 'package:json_annotation/json_annotation.dart';
|
||||||
|
|
||||||
|
part 'post.g.dart';
|
||||||
|
|
||||||
|
@JsonSerializable()
|
||||||
|
class Post {
|
||||||
|
final String title;
|
||||||
|
final String content;
|
||||||
|
final String authorName;
|
||||||
|
final String authorImageUrl;
|
||||||
|
final DateTime publishDate;
|
||||||
|
final List<String>? imageUrls;
|
||||||
|
final int likesCount;
|
||||||
|
final int commentsCount;
|
||||||
|
final int sharesCount;
|
||||||
|
final double? aspectRatio; // Nouveau paramètre pour le ratio (largeur/hauteur)
|
||||||
|
|
||||||
|
Post({
|
||||||
|
required this.title,
|
||||||
|
required this.content,
|
||||||
|
required this.authorName,
|
||||||
|
required this.authorImageUrl,
|
||||||
|
required this.publishDate,
|
||||||
|
this.imageUrls,
|
||||||
|
this.likesCount = 0,
|
||||||
|
this.commentsCount = 0,
|
||||||
|
this.sharesCount = 0,
|
||||||
|
this.aspectRatio,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory Post.fromJson(Map<String, dynamic> json) => _$PostFromJson(json);
|
||||||
|
Map<String, dynamic> toJson() => _$PostToJson(this);
|
||||||
|
}
|
||||||
35
lib/models/post.g.dart
Normal file
35
lib/models/post.g.dart
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'post.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// JsonSerializableGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
Post _$PostFromJson(Map<String, dynamic> json) => Post(
|
||||||
|
title: json['title'] as String,
|
||||||
|
content: json['content'] as String,
|
||||||
|
authorName: json['authorName'] as String,
|
||||||
|
authorImageUrl: json['authorImageUrl'] as String,
|
||||||
|
publishDate: DateTime.parse(json['publishDate'] as String),
|
||||||
|
imageUrls: (json['imageUrls'] as List<dynamic>?)
|
||||||
|
?.map((e) => e as String)
|
||||||
|
.toList(),
|
||||||
|
likesCount: (json['likesCount'] as num?)?.toInt() ?? 0,
|
||||||
|
commentsCount: (json['commentsCount'] as num?)?.toInt() ?? 0,
|
||||||
|
sharesCount: (json['sharesCount'] as num?)?.toInt() ?? 0,
|
||||||
|
aspectRatio: (json['aspectRatio'] as num?)?.toDouble(),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$PostToJson(Post instance) => <String, dynamic>{
|
||||||
|
'title': instance.title,
|
||||||
|
'content': instance.content,
|
||||||
|
'authorName': instance.authorName,
|
||||||
|
'authorImageUrl': instance.authorImageUrl,
|
||||||
|
'publishDate': instance.publishDate.toIso8601String(),
|
||||||
|
'imageUrls': instance.imageUrls,
|
||||||
|
'likesCount': instance.likesCount,
|
||||||
|
'commentsCount': instance.commentsCount,
|
||||||
|
'sharesCount': instance.sharesCount,
|
||||||
|
'aspectRatio': instance.aspectRatio,
|
||||||
|
};
|
||||||
@@ -230,11 +230,36 @@ class _PostCardWidgetState extends State<PostCardWidget> {
|
|||||||
void showCommentSheet() {
|
void showCommentSheet() {
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
|
isScrollControlled: true,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return Container(
|
return FractionallySizedBox(
|
||||||
height: 1000,
|
heightFactor: 0.9,
|
||||||
child: Center(
|
child: Container(
|
||||||
child: Text('Section des commentaires'),
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: 40,
|
||||||
|
height: 4,
|
||||||
|
margin: const EdgeInsets.only(bottom: 16.0),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.grey[300],
|
||||||
|
borderRadius: BorderRadius.circular(2),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
'Section des commentaires (à implémenter)',
|
||||||
|
style: Theme.of(context).textTheme.headlineMedium?.copyWith(
|
||||||
|
color: Colors.grey[600],
|
||||||
|
),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import 'package:bahla_front/app/app.locator.dart';
|
|||||||
import 'package:bahla_front/app/app.router.dart';
|
import 'package:bahla_front/app/app.router.dart';
|
||||||
import 'package:stacked/stacked.dart';
|
import 'package:stacked/stacked.dart';
|
||||||
import 'package:stacked_services/stacked_services.dart';
|
import 'package:stacked_services/stacked_services.dart';
|
||||||
|
import '../../../models/event.dart';
|
||||||
|
|
||||||
class HomeViewModel extends BaseViewModel {
|
class HomeViewModel extends BaseViewModel {
|
||||||
final _navigationService = locator<NavigationService>();
|
final _navigationService = locator<NavigationService>();
|
||||||
@@ -45,25 +46,4 @@ class HomeViewModel extends BaseViewModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Event {
|
|
||||||
String name;
|
|
||||||
String picture;
|
|
||||||
String organizer = 'Organizer';
|
|
||||||
String? place;
|
|
||||||
DateTime? date;
|
|
||||||
bool isFavorite;
|
|
||||||
|
|
||||||
Event({
|
|
||||||
required this.name,
|
|
||||||
required this.picture,
|
|
||||||
required this.organizer,
|
|
||||||
this.date,
|
|
||||||
this.place,
|
|
||||||
this.isFavorite = false,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'Event{name: $name, picture: $picture}';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
18
pubspec.lock
18
pubspec.lock
@@ -337,13 +337,21 @@ packages:
|
|||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.1"
|
version: "1.0.1"
|
||||||
json_annotation:
|
json_annotation:
|
||||||
dependency: transitive
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: json_annotation
|
name: json_annotation
|
||||||
sha256: cb09e7dac6210041fad964ed7fbee004f14258b4eca4040f72d1234062ace4c8
|
sha256: cb09e7dac6210041fad964ed7fbee004f14258b4eca4040f72d1234062ace4c8
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.11.0"
|
version: "4.11.0"
|
||||||
|
json_serializable:
|
||||||
|
dependency: "direct dev"
|
||||||
|
description:
|
||||||
|
name: json_serializable
|
||||||
|
sha256: "2c15e78e1cc6e62aadecf59f81566fd56829713d96a8c4177699e2b2e17f20db"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "6.13.2"
|
||||||
leak_tracker:
|
leak_tracker:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -629,6 +637,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.2.3"
|
version: "4.2.3"
|
||||||
|
source_helper:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: source_helper
|
||||||
|
sha256: "4227d54ceefd0bb8ca4c8fcb96e1719dc53f1ee1b6e2ca9d7a6069da160e4eae"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.3.12"
|
||||||
source_span:
|
source_span:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -13,18 +13,20 @@ dependencies:
|
|||||||
sdk: flutter
|
sdk: flutter
|
||||||
flutter_svg: ^2.0.11
|
flutter_svg: ^2.0.11
|
||||||
google_fonts: ^8.1.0
|
google_fonts: ^8.1.0
|
||||||
http: ^1.2.2
|
http: ^1.6.0
|
||||||
intl: any
|
intl: any
|
||||||
|
json_annotation: ^4.11.0
|
||||||
stacked: ^3.4.0
|
stacked: ^3.4.0
|
||||||
stacked_services: ^1.1.0
|
stacked_services: ^1.1.0
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
build_runner: ^2.4.5
|
build_runner: ^2.15.0
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
flutter_lints: ^6.0.0
|
flutter_lints: ^6.0.0
|
||||||
mockito: ^5.4.1
|
mockito: ^5.4.1
|
||||||
stacked_generator: ^2.0.3
|
stacked_generator: ^2.0.3
|
||||||
|
json_serializable: ^6.13.2
|
||||||
|
|
||||||
flutter:
|
flutter:
|
||||||
uses-material-design: true
|
uses-material-design: true
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// Mocks generated by Mockito 5.4.4 from annotations
|
// Mocks generated by Mockito 5.4.6 from annotations
|
||||||
// in bahla_front/test/helpers/test_helpers.dart.
|
// in bahla_front/test/helpers/test_helpers.dart.
|
||||||
// Do not manually edit this file.
|
// Do not manually edit this file.
|
||||||
|
|
||||||
@@ -19,10 +19,12 @@ import 'package:stacked_services/stacked_services.dart' as _i2;
|
|||||||
// ignore_for_file: deprecated_member_use_from_same_package
|
// ignore_for_file: deprecated_member_use_from_same_package
|
||||||
// ignore_for_file: implementation_imports
|
// ignore_for_file: implementation_imports
|
||||||
// ignore_for_file: invalid_use_of_visible_for_testing_member
|
// ignore_for_file: invalid_use_of_visible_for_testing_member
|
||||||
|
// ignore_for_file: must_be_immutable
|
||||||
// ignore_for_file: prefer_const_constructors
|
// ignore_for_file: prefer_const_constructors
|
||||||
// ignore_for_file: unnecessary_parenthesis
|
// ignore_for_file: unnecessary_parenthesis
|
||||||
// ignore_for_file: camel_case_types
|
// ignore_for_file: camel_case_types
|
||||||
// ignore_for_file: subtype_of_sealed_class
|
// ignore_for_file: subtype_of_sealed_class
|
||||||
|
// ignore_for_file: invalid_use_of_internal_member
|
||||||
|
|
||||||
/// A class which mocks [NavigationService].
|
/// A class which mocks [NavigationService].
|
||||||
///
|
///
|
||||||
@@ -95,7 +97,7 @@ class MockNavigationService extends _i1.Mock implements _i2.NavigationService {
|
|||||||
_i5.Future<T?>? navigateWithTransition<T>(
|
_i5.Future<T?>? navigateWithTransition<T>(
|
||||||
_i4.Widget? page, {
|
_i4.Widget? page, {
|
||||||
bool? opaque,
|
bool? opaque,
|
||||||
String? transition = r'',
|
String? transition = '',
|
||||||
Duration? duration,
|
Duration? duration,
|
||||||
bool? popGesture,
|
bool? popGesture,
|
||||||
int? id,
|
int? id,
|
||||||
@@ -131,7 +133,7 @@ class MockNavigationService extends _i1.Mock implements _i2.NavigationService {
|
|||||||
_i5.Future<T?>? replaceWithTransition<T>(
|
_i5.Future<T?>? replaceWithTransition<T>(
|
||||||
_i4.Widget? page, {
|
_i4.Widget? page, {
|
||||||
bool? opaque,
|
bool? opaque,
|
||||||
String? transition = r'',
|
String? transition = '',
|
||||||
Duration? duration,
|
Duration? duration,
|
||||||
bool? popGesture,
|
bool? popGesture,
|
||||||
int? id,
|
int? id,
|
||||||
@@ -404,7 +406,7 @@ class MockBottomSheetService extends _i1.Mock
|
|||||||
_i5.Future<_i2.SheetResponse<dynamic>?> showBottomSheet({
|
_i5.Future<_i2.SheetResponse<dynamic>?> showBottomSheet({
|
||||||
required String? title,
|
required String? title,
|
||||||
String? description,
|
String? description,
|
||||||
String? confirmButtonTitle = r'Ok',
|
String? confirmButtonTitle = 'Ok',
|
||||||
String? cancelButtonTitle,
|
String? cancelButtonTitle,
|
||||||
bool? enableDrag = true,
|
bool? enableDrag = true,
|
||||||
bool? barrierDismissible = true,
|
bool? barrierDismissible = true,
|
||||||
@@ -457,7 +459,7 @@ class MockBottomSheetService extends _i1.Mock
|
|||||||
double? elevation = 1.0,
|
double? elevation = 1.0,
|
||||||
bool? barrierDismissible = true,
|
bool? barrierDismissible = true,
|
||||||
bool? isScrollControlled = false,
|
bool? isScrollControlled = false,
|
||||||
String? barrierLabel = r'',
|
String? barrierLabel = '',
|
||||||
dynamic customData,
|
dynamic customData,
|
||||||
R? data,
|
R? data,
|
||||||
bool? enableDrag = true,
|
bool? enableDrag = true,
|
||||||
@@ -554,9 +556,11 @@ class MockDialogService extends _i1.Mock implements _i2.DialogService {
|
|||||||
String? description,
|
String? description,
|
||||||
String? cancelTitle,
|
String? cancelTitle,
|
||||||
_i6.Color? cancelTitleColor,
|
_i6.Color? cancelTitleColor,
|
||||||
String? buttonTitle = r'Ok',
|
String? buttonTitle = 'Ok',
|
||||||
_i6.Color? buttonTitleColor,
|
_i6.Color? buttonTitleColor,
|
||||||
bool? barrierDismissible = false,
|
bool? barrierDismissible = false,
|
||||||
|
_i4.RouteSettings? routeSettings,
|
||||||
|
_i4.GlobalKey<_i4.NavigatorState>? navigatorKey,
|
||||||
_i2.DialogPlatform? dialogPlatform,
|
_i2.DialogPlatform? dialogPlatform,
|
||||||
}) =>
|
}) =>
|
||||||
(super.noSuchMethod(
|
(super.noSuchMethod(
|
||||||
@@ -571,6 +575,8 @@ class MockDialogService extends _i1.Mock implements _i2.DialogService {
|
|||||||
#buttonTitle: buttonTitle,
|
#buttonTitle: buttonTitle,
|
||||||
#buttonTitleColor: buttonTitleColor,
|
#buttonTitleColor: buttonTitleColor,
|
||||||
#barrierDismissible: barrierDismissible,
|
#barrierDismissible: barrierDismissible,
|
||||||
|
#routeSettings: routeSettings,
|
||||||
|
#navigatorKey: navigatorKey,
|
||||||
#dialogPlatform: dialogPlatform,
|
#dialogPlatform: dialogPlatform,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -595,8 +601,11 @@ class MockDialogService extends _i1.Mock implements _i2.DialogService {
|
|||||||
bool? takesInput = false,
|
bool? takesInput = false,
|
||||||
_i6.Color? barrierColor = const _i6.Color(2315255808),
|
_i6.Color? barrierColor = const _i6.Color(2315255808),
|
||||||
bool? barrierDismissible = false,
|
bool? barrierDismissible = false,
|
||||||
String? barrierLabel = r'',
|
String? barrierLabel = '',
|
||||||
bool? useSafeArea = true,
|
bool? useSafeArea = true,
|
||||||
|
_i4.RouteSettings? routeSettings,
|
||||||
|
_i4.GlobalKey<_i4.NavigatorState>? navigatorKey,
|
||||||
|
_i4.RouteTransitionsBuilder? transitionBuilder,
|
||||||
dynamic customData,
|
dynamic customData,
|
||||||
R? data,
|
R? data,
|
||||||
}) =>
|
}) =>
|
||||||
@@ -621,6 +630,9 @@ class MockDialogService extends _i1.Mock implements _i2.DialogService {
|
|||||||
#barrierDismissible: barrierDismissible,
|
#barrierDismissible: barrierDismissible,
|
||||||
#barrierLabel: barrierLabel,
|
#barrierLabel: barrierLabel,
|
||||||
#useSafeArea: useSafeArea,
|
#useSafeArea: useSafeArea,
|
||||||
|
#routeSettings: routeSettings,
|
||||||
|
#navigatorKey: navigatorKey,
|
||||||
|
#transitionBuilder: transitionBuilder,
|
||||||
#customData: customData,
|
#customData: customData,
|
||||||
#data: data,
|
#data: data,
|
||||||
},
|
},
|
||||||
@@ -633,11 +645,12 @@ class MockDialogService extends _i1.Mock implements _i2.DialogService {
|
|||||||
_i5.Future<_i2.DialogResponse<dynamic>?> showConfirmationDialog({
|
_i5.Future<_i2.DialogResponse<dynamic>?> showConfirmationDialog({
|
||||||
String? title,
|
String? title,
|
||||||
String? description,
|
String? description,
|
||||||
String? cancelTitle = r'Cancel',
|
String? cancelTitle = 'Cancel',
|
||||||
_i6.Color? cancelTitleColor,
|
_i6.Color? cancelTitleColor,
|
||||||
String? confirmationTitle = r'Ok',
|
String? confirmationTitle = 'Ok',
|
||||||
_i6.Color? confirmationTitleColor,
|
_i6.Color? confirmationTitleColor,
|
||||||
bool? barrierDismissible = false,
|
bool? barrierDismissible = false,
|
||||||
|
_i4.RouteSettings? routeSettings,
|
||||||
_i2.DialogPlatform? dialogPlatform,
|
_i2.DialogPlatform? dialogPlatform,
|
||||||
}) =>
|
}) =>
|
||||||
(super.noSuchMethod(
|
(super.noSuchMethod(
|
||||||
@@ -652,6 +665,7 @@ class MockDialogService extends _i1.Mock implements _i2.DialogService {
|
|||||||
#confirmationTitle: confirmationTitle,
|
#confirmationTitle: confirmationTitle,
|
||||||
#confirmationTitleColor: confirmationTitleColor,
|
#confirmationTitleColor: confirmationTitleColor,
|
||||||
#barrierDismissible: barrierDismissible,
|
#barrierDismissible: barrierDismissible,
|
||||||
|
#routeSettings: routeSettings,
|
||||||
#dialogPlatform: dialogPlatform,
|
#dialogPlatform: dialogPlatform,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user