Remove toast library that was blocking user interaction

This commit is contained in:
vishnukvmd 2022-11-12 00:46:02 +05:30
parent 9ce8059212
commit 1f20ba17f4
4 changed files with 12 additions and 48 deletions

View file

@ -13,7 +13,6 @@ import "package:ente_auth/onboarding/view/onboarding_page.dart";
import 'package:ente_auth/ui/home_page.dart';
import 'package:flutter/foundation.dart';
import "package:flutter/material.dart";
import 'package:flutter_easyloading/flutter_easyloading.dart';
import "package:flutter_localizations/flutter_localizations.dart";
class App extends StatefulWidget {
@ -62,7 +61,6 @@ class _AppState extends State<App> {
theme: lightTheme,
darkTheme: dartTheme,
debugShowCheckedModeBanner: false,
builder: EasyLoading.init(),
supportedLocales: AppLocalizations.supportedLocales,
localizationsDelegates: const [
AppLocalizations.delegate,
@ -80,7 +78,6 @@ class _AppState extends State<App> {
theme: lightThemeData,
darkTheme: darkThemeData,
debugShowCheckedModeBanner: false,
builder: EasyLoading.init(),
supportedLocales: AppLocalizations.supportedLocales,
localizationsDelegates: const [
AppLocalizations.delegate,

View file

@ -1,8 +1,5 @@
import 'dart:io';
import 'package:ente_auth/ente_theme_data.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:fluttertoast/fluttertoast.dart';
Future showToast(
@ -11,31 +8,16 @@ Future showToast(
toastLength = Toast.LENGTH_LONG,
iOSDismissOnTap = true,
}) async {
if (Platform.isAndroid) {
await Fluttertoast.cancel();
return Fluttertoast.showToast(
msg: message,
toastLength: toastLength,
gravity: ToastGravity.BOTTOM,
timeInSecForIosWeb: 1,
backgroundColor: Theme.of(context).colorScheme.toastBackgroundColor,
textColor: Theme.of(context).colorScheme.toastTextColor,
fontSize: 16.0,
);
} else {
EasyLoading.instance
..backgroundColor = Theme.of(context).colorScheme.toastBackgroundColor
..indicatorColor = Theme.of(context).colorScheme.toastBackgroundColor
..textColor = Theme.of(context).colorScheme.toastTextColor
..userInteractions = true
..loadingStyle = EasyLoadingStyle.custom;
return EasyLoading.showToast(
message,
duration: Duration(seconds: (toastLength == Toast.LENGTH_LONG ? 5 : 2)),
toastPosition: EasyLoadingToastPosition.bottom,
dismissOnTap: iOSDismissOnTap,
);
}
await Fluttertoast.cancel();
return Fluttertoast.showToast(
msg: message,
toastLength: toastLength,
gravity: ToastGravity.BOTTOM,
timeInSecForIosWeb: 1,
backgroundColor: Theme.of(context).colorScheme.toastBackgroundColor,
textColor: Theme.of(context).colorScheme.toastTextColor,
fontSize: 16.0,
);
}
Future<void> showShortToast(context, String message) {

View file

@ -384,13 +384,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "8.0.1"
flutter_easyloading:
dependency: "direct main"
description:
name: flutter_easyloading
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.5"
flutter_email_sender:
dependency: "direct main"
description:
@ -494,13 +487,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "6.2.0"
flutter_spinkit:
dependency: transitive
description:
name: flutter_spinkit
url: "https://pub.dartlang.org"
source: hosted
version: "5.1.0"
flutter_test:
dependency: "direct dev"
description: flutter
@ -524,7 +510,7 @@ packages:
name: fluttertoast
url: "https://pub.dartlang.org"
source: hosted
version: "8.0.9"
version: "8.1.1"
frontend_server_client:
dependency: transitive
description:

View file

@ -46,7 +46,7 @@ dependencies:
# sentry_flutter:
# path: thirdparty/sentry-dart/flutter
json_annotation: ^4.5.0
fluttertoast: ^8.0.6
fluttertoast: ^8.1.1
google_nav_bar: ^5.0.5 #supported
http: ^0.13.4
move_to_background: ^1.0.2
@ -58,7 +58,6 @@ dependencies:
share_plus: ^4.4.0
package_info_plus: ^1.0.1
shared_preferences: ^2.0.5
flutter_easyloading: ^3.0.5
uuid: ^3.0.4
url_launcher: ^6.1.5
logging: ^1.0.1