Add message when attempting to create review without login

This commit is contained in:
Alexandertp 2024-09-09 16:45:16 +02:00
parent c2257a1c9d
commit ff8dd55d18
2 changed files with 10 additions and 4 deletions

View File

@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:mobile/base/sidemenu.dart';
import 'models.dart';
import 'api.dart' as api;
class ReviewListPage extends StatefulWidget {
const ReviewListPage({super.key});
@ -69,6 +70,11 @@ class _ReviewListState extends State<ReviewListPage> {
)),
floatingActionButton: FloatingActionButton(
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?;
if (review != null) reviews.add(review);
},

View File

@ -308,10 +308,10 @@ packages:
dependency: transitive
description:
name: image_picker_android
sha256: c0a6763d50b354793d0192afd0a12560b823147d3ded7c6b77daf658fa05cc85
sha256: "8c5abf0dcc24fe6e8e0b4a5c0b51a5cf30cefdf6407a3213dae61edc75a70f56"
url: "https://pub.dev"
source: hosted
version: "0.8.12+13"
version: "0.8.12+12"
image_picker_for_web:
dependency: transitive
description:
@ -742,5 +742,5 @@ packages:
source: hosted
version: "1.0.4"
sdks:
dart: ">=3.5.0 <4.0.0"
flutter: ">=3.24.0"
dart: ">=3.4.0 <4.0.0"
flutter: ">=3.22.0"