From ff8dd55d183c7c1c64cdd49ab23fc47c1530ce5c Mon Sep 17 00:00:00 2001 From: Alexandertp Date: Mon, 9 Sep 2024 16:45:16 +0200 Subject: [PATCH] Add message when attempting to create review without login --- Mobile/lib/reviewlist.dart | 6 ++++++ Mobile/pubspec.lock | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Mobile/lib/reviewlist.dart b/Mobile/lib/reviewlist.dart index 6c21f05..9577349 100644 --- a/Mobile/lib/reviewlist.dart +++ b/Mobile/lib/reviewlist.dart @@ -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 { )), 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); }, diff --git a/Mobile/pubspec.lock b/Mobile/pubspec.lock index a5843ce..a246c0b 100644 --- a/Mobile/pubspec.lock +++ b/Mobile/pubspec.lock @@ -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"