Use a different toast library on iOS
This commit is contained in:
parent
7f0deae679
commit
0b71e19962
4 changed files with 41 additions and 8 deletions
|
@ -3,6 +3,7 @@ import 'dart:async';
|
||||||
import 'package:background_fetch/background_fetch.dart';
|
import 'package:background_fetch/background_fetch.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||||
import 'package:in_app_purchase/in_app_purchase.dart';
|
import 'package:in_app_purchase/in_app_purchase.dart';
|
||||||
import 'package:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
import 'package:photos/core/constants.dart';
|
import 'package:photos/core/constants.dart';
|
||||||
|
@ -227,6 +228,7 @@ class EnteApp extends StatelessWidget with WidgetsBindingObserver {
|
||||||
theme: themeData,
|
theme: themeData,
|
||||||
home: _homeWidget,
|
home: _homeWidget,
|
||||||
debugShowCheckedModeBanner: false,
|
debugShowCheckedModeBanner: false,
|
||||||
|
builder: EasyLoading.init(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,29 @@
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||||
import 'package:fluttertoast/fluttertoast.dart';
|
import 'package:fluttertoast/fluttertoast.dart';
|
||||||
|
|
||||||
Future<void> showToast(String message, {toastLength: Toast.LENGTH_LONG}) {
|
Future<void> showToast(String message, {toastLength: Toast.LENGTH_LONG}) {
|
||||||
return Fluttertoast.showToast(
|
if (Platform.isAndroid) {
|
||||||
msg: message,
|
return Fluttertoast.showToast(
|
||||||
toastLength: toastLength,
|
msg: message,
|
||||||
gravity: ToastGravity.BOTTOM,
|
toastLength: toastLength,
|
||||||
timeInSecForIosWeb: 1,
|
gravity: ToastGravity.BOTTOM,
|
||||||
backgroundColor: Colors.blueGrey[900],
|
timeInSecForIosWeb: 1,
|
||||||
textColor: Colors.white,
|
backgroundColor: Colors.blueGrey[900],
|
||||||
fontSize: 16.0);
|
textColor: Colors.white,
|
||||||
|
fontSize: 16.0);
|
||||||
|
} else {
|
||||||
|
EasyLoading.instance
|
||||||
|
..backgroundColor = Colors.blueGrey[900]
|
||||||
|
..indicatorColor = Colors.blueGrey[900]
|
||||||
|
..textColor = Colors.white
|
||||||
|
..loadingStyle = EasyLoadingStyle.custom;
|
||||||
|
return EasyLoading.showToast(
|
||||||
|
message,
|
||||||
|
duration: Duration(seconds: (toastLength == Toast.LENGTH_LONG ? 4 : 3)),
|
||||||
|
toastPosition: EasyLoadingToastPosition.bottom,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
14
pubspec.lock
14
pubspec.lock
|
@ -260,6 +260,13 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.1.0"
|
version: "3.1.0"
|
||||||
|
flutter_easyloading:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: flutter_easyloading
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "3.0.0"
|
||||||
flutter_email_sender:
|
flutter_email_sender:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -344,6 +351,13 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.2.0"
|
version: "0.2.0"
|
||||||
|
flutter_spinkit:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: flutter_spinkit
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "5.0.0"
|
||||||
flutter_test:
|
flutter_test:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description: flutter
|
description: flutter
|
||||||
|
|
|
@ -91,6 +91,7 @@ dependencies:
|
||||||
pinput: ^1.2.0
|
pinput: ^1.2.0
|
||||||
intl: ^0.17.0
|
intl: ^0.17.0
|
||||||
confetti: ^0.5.5
|
confetti: ^0.5.5
|
||||||
|
flutter_easyloading: ^3.0.0
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|
Loading…
Reference in a new issue