forked from eatvio/eatvio_app
Merge remote-tracking branch 'upstream/main'
This commit is contained in:
@@ -65,7 +65,7 @@ class AppRouter {
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: '/auth-screen',
|
||||
name: 'authScreen',
|
||||
name: 'authScreen',
|
||||
builder: (context, state) => const AuthScreen(),
|
||||
routes: [
|
||||
GoRoute(
|
||||
|
||||
@@ -167,7 +167,7 @@ Future<void> init() async {
|
||||
sl.registerLazySingleton(
|
||||
() => Dio(
|
||||
BaseOptions(
|
||||
baseUrl: baseUrl,
|
||||
baseUrl: baseUrl,
|
||||
headers: {
|
||||
'accept': 'application/json',
|
||||
'content-type': 'application/json',
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
|
||||
abstract class TokenStorage {
|
||||
|
||||
static Future<bool> haveTokenInStorage() async {
|
||||
try {
|
||||
if (await FlutterSecureStorage().read(key: 'token') == null) {
|
||||
return false;
|
||||
} else {
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} catch (e) {
|
||||
@@ -17,7 +16,7 @@ abstract class TokenStorage {
|
||||
static Future<String?> getTokenFromStorage() async => await FlutterSecureStorage().read(key: 'token');
|
||||
|
||||
static saveTokenInStorage(String token) async {
|
||||
await FlutterSecureStorage().write(key: 'token', value: token);
|
||||
await FlutterSecureStorage().write(key: 'token', value: token);
|
||||
}
|
||||
|
||||
static Future<void> removeTokenInStorage() async => (await FlutterSecureStorage().delete(key: 'token'));
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:fluttertoast/fluttertoast.dart';
|
||||
|
||||
const int _toastDuration = 2;
|
||||
@@ -19,10 +20,10 @@ void showErrorToast(String message) {
|
||||
Fluttertoast.showToast(
|
||||
msg: message,
|
||||
toastLength: Toast.LENGTH_LONG,
|
||||
gravity: ToastGravity.TOP,
|
||||
gravity: ToastGravity.CENTER,
|
||||
timeInSecForIosWeb: _toastDuration,
|
||||
backgroundColor: appTheme.whiteA700,
|
||||
textColor: appTheme.gray,
|
||||
backgroundColor: appTheme.red,
|
||||
textColor: Colors.white,
|
||||
fontSize: 16.0,
|
||||
);
|
||||
}
|
||||
@@ -31,7 +32,7 @@ void showSuccessToast(String message) {
|
||||
Fluttertoast.showToast(
|
||||
msg: message,
|
||||
toastLength: Toast.LENGTH_SHORT,
|
||||
gravity: ToastGravity.TOP,
|
||||
gravity: ToastGravity.CENTER,
|
||||
timeInSecForIosWeb: _toastDuration,
|
||||
backgroundColor: appTheme.greenA70001,
|
||||
textColor: appTheme.whiteA700,
|
||||
|
||||
Reference in New Issue
Block a user