feat : New listing + MainView
This commit is contained in:
@@ -1,36 +1,51 @@
|
||||
import 'package:bahla_front/app/app.bottomsheets.dart';
|
||||
import 'package:bahla_front/app/app.dialogs.dart';
|
||||
import 'package:bahla_front/app/app.locator.dart';
|
||||
import 'package:bahla_front/ui/common/app_strings.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
import 'package:stacked_services/stacked_services.dart';
|
||||
|
||||
class HomeViewModel extends BaseViewModel {
|
||||
final _dialogService = locator<DialogService>();
|
||||
final _bottomSheetService = locator<BottomSheetService>();
|
||||
|
||||
String get counterLabel => 'Counter is: $_counter';
|
||||
List<String> items = List<String>.generate(100, (i) => 'Item $i');
|
||||
|
||||
int _counter = 0;
|
||||
List<Event> events = [
|
||||
Event(
|
||||
name: 'Event 1',
|
||||
picture: 'images/Affiche.jpg',
|
||||
date: DateTime.now().add(Duration(days: 1)),
|
||||
organizer: 'Organizer 1',
|
||||
place: 'Place 1',
|
||||
),
|
||||
Event(
|
||||
name: 'Event 2',
|
||||
picture: 'images/Affiche.jpg',
|
||||
date: DateTime.now().add(Duration(days: 1)),
|
||||
organizer: 'Organizer 2',
|
||||
),
|
||||
Event(
|
||||
name: 'Event 3',
|
||||
picture: 'images/Affiche.jpg',
|
||||
date: DateTime.now().add(Duration(days: 1)),
|
||||
organizer: 'Organizer 3',
|
||||
place: 'Place 3',
|
||||
),
|
||||
];
|
||||
|
||||
void incrementCounter() {
|
||||
_counter++;
|
||||
rebuildUi();
|
||||
}
|
||||
|
||||
void showDialog() {
|
||||
_dialogService.showCustomDialog(
|
||||
variant: DialogType.infoAlert,
|
||||
title: 'Stacked Rocks!',
|
||||
description: 'Give stacked $_counter stars on Github',
|
||||
);
|
||||
}
|
||||
|
||||
void showBottomSheet() {
|
||||
_bottomSheetService.showCustomSheet(
|
||||
variant: BottomSheetType.notice,
|
||||
title: ksHomeBottomSheetTitle,
|
||||
description: ksHomeBottomSheetDescription,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class Event {
|
||||
String name;
|
||||
String picture;
|
||||
String organizer = 'Organizer';
|
||||
String? place;
|
||||
DateTime? date;
|
||||
|
||||
Event({
|
||||
required this.name,
|
||||
required this.picture,
|
||||
required this.organizer,
|
||||
this.date,
|
||||
this.place,
|
||||
});
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'Event{name: $name, picture: $picture}';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user