Skip to content

Commit

Permalink
Bug fix & Un-display end carpools
Browse files Browse the repository at this point in the history
  • Loading branch information
Staler2019 committed May 30, 2023
1 parent 7106c99 commit e489f8f
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 37 deletions.
6 changes: 3 additions & 3 deletions lib/view/dashboard_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class _DashboardViewState extends State<DashboardView> {
@override
Widget build(BuildContext context) {
return Consumer<UserViewModel>(
builder: (context, model, child) =>
builder: (context, model, child) =>
model.isJoinCarpoolRoom ? ChangeNotifierProvider<CarpoolCardViewModel>(
create: (context) => CarpoolCardViewModel(carModel: model.currentCarModel!)..loadDate(),
child: const ShowCurrentCarpoolView()
Expand All @@ -29,7 +29,7 @@ class _DashboardViewState extends State<DashboardView> {
title: const Text('NCUBER'),
automaticallyImplyLeading: false,
),
floatingActionButton: model.isJoinCarpoolRoom ? null :
floatingActionButton: model.isJoinCarpoolRoom ? null :
FloatingActionButton.extended(
label: const Text('發起共乘'),
icon: const Icon(Icons.add),
Expand All @@ -38,7 +38,7 @@ class _DashboardViewState extends State<DashboardView> {
},
),
// TODO: check if person have join cardpool show carpool otherwise show dashboard
body: const DashboardNcUber()
body: const DashboardNcUber()
),
);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/view_model/carpool_card_view_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class CarpoolCardViewModel extends ChangeNotifier {
List<String> get personStuIds => carModel.personStuIds;

DateTime get carpoolStartTime => carModel.startTime!;
DateTime get expectedArrivedTime => carModel.startTime!.add(mapRoute?.duration ?? Duration.zero);
DateTime get expectedArrivedTime => carModel.endTime ?? carModel.startTime!.add(mapRoute?.duration ?? Duration.zero);

MapRoute? mapRoute = MapRoute(duration: const Duration(seconds: 0), distance: 0, points: []);

Expand Down
9 changes: 8 additions & 1 deletion lib/view_model/show_all_carpool_view_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@ class ShowAllCarPooViewModel extends ChangeNotifier {
isLoading = true;
notifyListeners();
// fetch data from repo
allCarpoolData = await reqLastNumsOfCarModel();
// allCarpoolData = await reqLastNumsOfCarModel();
var tmpAllCarpoolDataList = await reqLastNumsOfCarModel();
allCarpoolData = [];
for (var carpool in tmpAllCarpoolDataList) {
if (carpool.status!.statusName != '已結束') {
allCarpoolData?.add(carpool);
}
}
// if no data use fake data to demo
// if (allCarpoolData!.isEmpty) {
// // implement code here
Expand Down
56 changes: 24 additions & 32 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -182,22 +182,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.3"
flutter_datetime_picker_bdaya:
dependency: transitive
description:
name: flutter_datetime_picker_bdaya
sha256: "137ac5f6c967c4fa9a029e6d8599ec3b301480b7269b92e6938607f1ab2e8288"
url: "https://pub.dev"
source: hosted
version: "2.0.0"
flutter_form_builder:
dependency: transitive
description:
name: flutter_form_builder
sha256: "9551c7379adc01a3a3a1100057396407c9534ea8adc937d14a0edd96fcd9e1dc"
sha256: "9b098f6a5f8a6381016a5fe9cdccc900683917d1fb930e1c6c6c051ca0f01f08"
url: "https://pub.dev"
source: hosted
version: "7.8.0"
version: "9.0.0"
flutter_keyboard_visibility:
dependency: transitive
description:
Expand Down Expand Up @@ -303,10 +295,10 @@ packages:
dependency: transitive
description:
name: flutter_typeahead
sha256: "5af4f54a3f051ff3b549b8f2b952e5ad3e5f60ee4717fd27406d1c64d3e24edd"
sha256: f31211a8536f87908c3dcbdb88666e2f4d77f5f06c2b3a48eaad5599969ff32d
url: "https://pub.dev"
source: hosted
version: "4.5.0"
version: "4.6.0"
flutter_web_plugins:
dependency: transitive
description: flutter
Expand All @@ -316,10 +308,10 @@ packages:
dependency: transitive
description:
name: form_builder_extra_fields
sha256: "4b8daec47fc9a2a281d61ac9ece4d67157a2302f2999ec544632c7bd0cc3ddd6"
sha256: "00a36223ca1a46b62c54dd02fec5e160577dee5919b1f934d769256b69995da6"
url: "https://pub.dev"
source: hosted
version: "8.5.0"
version: "10.0.0"
freezed_annotation:
dependency: transitive
description:
Expand Down Expand Up @@ -440,14 +432,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.5.0+0"
google_maps_webservice:
google_maps_webapi:
dependency: transitive
description:
name: google_maps_webservice
sha256: d0ae4e4508afd74a3f051565261a3cdbae59db29448f9b6e6beb5674545e1eb7
name: google_maps_webapi
sha256: "347bf3be27042ecc484cae376d861cdec10b4bdaccd2a8f5d0b51d738dd88332"
url: "https://pub.dev"
source: hosted
version: "0.0.20-nullsafety.5"
version: "0.0.21"
google_maps_webservice_ex:
dependency: "direct main"
description:
Expand Down Expand Up @@ -492,10 +484,10 @@ packages:
dependency: "direct main"
description:
name: intl
sha256: "910f85bce16fb5c6f614e117efa303e85a1731bb0081edf3604a2ae6e9a3cc91"
sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d"
url: "https://pub.dev"
source: hosted
version: "0.17.0"
version: "0.18.1"
js:
dependency: transitive
description:
Expand Down Expand Up @@ -524,10 +516,10 @@ packages:
dependency: transitive
description:
name: lints
sha256: "5e4a9cd06d447758280a8ac2405101e0e2094d2a1dbdd3756aec3fe7775ba593"
sha256: "6b0206b0bf4f04961fc5438198ccb3a885685cd67d4d4a32cc20ad7f8adbe015"
url: "https://pub.dev"
source: hosted
version: "2.0.1"
version: "2.1.0"
location:
dependency: "direct main"
description:
Expand Down Expand Up @@ -564,18 +556,18 @@ packages:
dependency: "direct main"
description:
name: map_location_picker
sha256: cf2aef76b2a68140fa550d40cf9162fc648c26da1c9e3505df1f026d301a4a67
sha256: f855657aaedd6fb3a744888a16edc273e5e827c88b563209ea2d569f327b8b43
url: "https://pub.dev"
source: hosted
version: "1.1.0"
version: "1.2.0"
matcher:
dependency: transitive
description:
name: matcher
sha256: c94db23593b89766cda57aab9ac311e3616cf87c6fa4e9749df032f66f30dcb8
sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb"
url: "https://pub.dev"
source: hosted
version: "0.12.14"
version: "0.12.15"
material_color_utilities:
dependency: transitive
description:
Expand All @@ -588,10 +580,10 @@ packages:
dependency: transitive
description:
name: meta
sha256: "12307e7f0605ce3da64cf0db90e5fcab0869f3ca03f76be6bb2991ce0a55e82b"
sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
url: "https://pub.dev"
source: hosted
version: "1.9.0"
version: "1.9.1"
nested:
dependency: transitive
description:
Expand Down Expand Up @@ -761,10 +753,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: "6182294da5abf431177fccc1ee02401f6df30f766bc6130a0852c6b6d7ee6b2d"
sha256: eb6ac1540b26de412b3403a163d919ba86f6a973fe6cc50ae3541b80092fdcfb
url: "https://pub.dev"
source: hosted
version: "0.4.18"
version: "0.5.1"
typed_data:
dependency: transitive
description:
Expand Down Expand Up @@ -822,5 +814,5 @@ packages:
source: hosted
version: "3.1.2"
sdks:
dart: ">=2.19.2 <3.0.0"
flutter: ">=3.7.0"
dart: ">=3.0.0 <4.0.0"
flutter: ">=3.10.0"

0 comments on commit e489f8f

Please sign in to comment.