Show newly submitted reviews on reviews list
Co-authored-by: Reimar <mail@reim.ar>
This commit is contained in:
parent
e03131a8aa
commit
0dcfb2ea1e
@ -1,3 +1,5 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:mobile/base/sidemenu.dart';
|
import 'package:mobile/base/sidemenu.dart';
|
||||||
import 'models.dart';
|
import 'models.dart';
|
||||||
@ -91,5 +93,13 @@ class _CreateReviewState extends State<CreateReviewPage> {
|
|||||||
'lat': place!.point.latitude,
|
'lat': place!.point.latitude,
|
||||||
'lng': place!.point.longitude,
|
'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);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -61,7 +61,10 @@ class _ReviewListState extends State<ReviewListPage> {
|
|||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
floatingActionButton: FloatingActionButton(
|
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,
|
backgroundColor: Colors.blue,
|
||||||
focusColor: Colors.blueGrey,
|
focusColor: Colors.blueGrey,
|
||||||
tooltip: "Write a Review",
|
tooltip: "Write a Review",
|
||||||
|
Loading…
Reference in New Issue
Block a user