Add message when attempting to create review without login
This commit is contained in:
parent
c2257a1c9d
commit
ff8dd55d18
@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart';
|
|||||||
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';
|
||||||
|
import 'api.dart' as api;
|
||||||
|
|
||||||
class ReviewListPage extends StatefulWidget {
|
class ReviewListPage extends StatefulWidget {
|
||||||
const ReviewListPage({super.key});
|
const ReviewListPage({super.key});
|
||||||
@ -69,6 +70,11 @@ class _ReviewListState extends State<ReviewListPage> {
|
|||||||
)),
|
)),
|
||||||
floatingActionButton: FloatingActionButton(
|
floatingActionButton: FloatingActionButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
|
if (!await api.isLoggedIn(context)) {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text("You must be logged in to do that")));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final review = await Navigator.pushNamed(context, '/create-review', arguments: place) as Review?;
|
final review = await Navigator.pushNamed(context, '/create-review', arguments: place) as Review?;
|
||||||
if (review != null) reviews.add(review);
|
if (review != null) reviews.add(review);
|
||||||
},
|
},
|
||||||
|
@ -308,10 +308,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: image_picker_android
|
name: image_picker_android
|
||||||
sha256: c0a6763d50b354793d0192afd0a12560b823147d3ded7c6b77daf658fa05cc85
|
sha256: "8c5abf0dcc24fe6e8e0b4a5c0b51a5cf30cefdf6407a3213dae61edc75a70f56"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.8.12+13"
|
version: "0.8.12+12"
|
||||||
image_picker_for_web:
|
image_picker_for_web:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -742,5 +742,5 @@ packages:
|
|||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.4"
|
version: "1.0.4"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=3.5.0 <4.0.0"
|
dart: ">=3.4.0 <4.0.0"
|
||||||
flutter: ">=3.24.0"
|
flutter: ">=3.22.0"
|
||||||
|
Loading…
Reference in New Issue
Block a user