diff --git a/Mobile/lib/createreview.dart b/Mobile/lib/createreview.dart index b944fd2..c784de2 100644 --- a/Mobile/lib/createreview.dart +++ b/Mobile/lib/createreview.dart @@ -1,3 +1,5 @@ +import 'dart:convert'; + import 'package:flutter/material.dart'; import 'package:mobile/base/sidemenu.dart'; import 'models.dart'; @@ -91,5 +93,13 @@ class _CreateReviewState extends State { 'lat': place!.point.latitude, 'lng': place!.point.longitude, }); + + if (response == null || !mounted) return; + + final review = Review.fromJson(jsonDecode(response)); + + ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text('Review submitted'))); + + Navigator.pop(context, review); } } \ No newline at end of file diff --git a/Mobile/lib/reviewlist.dart b/Mobile/lib/reviewlist.dart index 29f791f..bd0313b 100644 --- a/Mobile/lib/reviewlist.dart +++ b/Mobile/lib/reviewlist.dart @@ -61,7 +61,10 @@ class _ReviewListState extends State { ), )), floatingActionButton: FloatingActionButton( - onPressed: () => Navigator.pushNamed(context, '/create-review', arguments: place), + onPressed: () async { + final review = await Navigator.pushNamed(context, '/create-review', arguments: place) as Review?; + if (review != null) reviews.add(review); + }, backgroundColor: Colors.blue, focusColor: Colors.blueGrey, tooltip: "Write a Review",