Change toast

This commit is contained in:
problematicconsumer
2023-11-09 16:28:43 +03:30
parent 38f48e07d5
commit c1491ffe0b
5 changed files with 75 additions and 48 deletions

View File

@@ -4,9 +4,6 @@ PODS:
- Flutter (1.0.0) - Flutter (1.0.0)
- flutter_native_splash (0.0.1): - flutter_native_splash (0.0.1):
- Flutter - Flutter
- fluttertoast (0.0.2):
- Flutter
- Toast
- GoogleDataTransport (9.2.5): - GoogleDataTransport (9.2.5):
- GoogleUtilities/Environment (~> 7.7) - GoogleUtilities/Environment (~> 7.7)
- nanopb (< 2.30910.0, >= 2.30908.0) - nanopb (< 2.30910.0, >= 2.30908.0)
@@ -98,7 +95,6 @@ PODS:
- sqlite3/fts5 - sqlite3/fts5
- sqlite3/perf-threadsafe - sqlite3/perf-threadsafe
- sqlite3/rtree - sqlite3/rtree
- Toast (4.0.0)
- url_launcher_ios (0.0.1): - url_launcher_ios (0.0.1):
- Flutter - Flutter
@@ -106,7 +102,6 @@ DEPENDENCIES:
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`) - device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
- Flutter (from `Flutter`) - Flutter (from `Flutter`)
- flutter_native_splash (from `.symlinks/plugins/flutter_native_splash/ios`) - flutter_native_splash (from `.symlinks/plugins/flutter_native_splash/ios`)
- fluttertoast (from `.symlinks/plugins/fluttertoast/ios`)
- mobile_scanner (from `.symlinks/plugins/mobile_scanner/ios`) - mobile_scanner (from `.symlinks/plugins/mobile_scanner/ios`)
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`) - package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`) - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
@@ -134,7 +129,6 @@ SPEC REPOS:
- Sentry - Sentry
- SentryPrivate - SentryPrivate
- sqlite3 - sqlite3
- Toast
EXTERNAL SOURCES: EXTERNAL SOURCES:
device_info_plus: device_info_plus:
@@ -143,8 +137,6 @@ EXTERNAL SOURCES:
:path: Flutter :path: Flutter
flutter_native_splash: flutter_native_splash:
:path: ".symlinks/plugins/flutter_native_splash/ios" :path: ".symlinks/plugins/flutter_native_splash/ios"
fluttertoast:
:path: ".symlinks/plugins/fluttertoast/ios"
mobile_scanner: mobile_scanner:
:path: ".symlinks/plugins/mobile_scanner/ios" :path: ".symlinks/plugins/mobile_scanner/ios"
package_info_plus: package_info_plus:
@@ -168,7 +160,6 @@ SPEC CHECKSUMS:
device_info_plus: c6fb39579d0f423935b0c9ce7ee2f44b71b9fce6 device_info_plus: c6fb39579d0f423935b0c9ce7ee2f44b71b9fce6
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
flutter_native_splash: 52501b97d1c0a5f898d687f1646226c1f93c56ef flutter_native_splash: 52501b97d1c0a5f898d687f1646226c1f93c56ef
fluttertoast: 31b00dabfa7fb7bacd9e7dbee580d7a2ff4bf265
GoogleDataTransport: 54dee9d48d14580407f8f5fbf2f496e92437a2f2 GoogleDataTransport: 54dee9d48d14580407f8f5fbf2f496e92437a2f2
GoogleMLKit: 2bd0dc6253c4d4f227aad460f69215a504b2980e GoogleMLKit: 2bd0dc6253c4d4f227aad460f69215a504b2980e
GoogleToolboxForMac: 8bef7c7c5cf7291c687cf5354f39f9db6399ad34 GoogleToolboxForMac: 8bef7c7c5cf7291c687cf5354f39f9db6399ad34
@@ -192,7 +183,6 @@ SPEC CHECKSUMS:
shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126 shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
sqlite3: 6e2d4a4879854d0ec86b476bf3c3e30870bac273 sqlite3: 6e2d4a4879854d0ec86b476bf3c3e30870bac273
sqlite3_flutter_libs: eb769059df0356dc52ddda040f09cacc9391a7cf sqlite3_flutter_libs: eb769059df0356dc52ddda040f09cacc9391a7cf
Toast: 91b396c56ee72a5790816f40d3a94dd357abc196
url_launcher_ios: 68d46cc9766d0c41dbdc884310529557e3cd7a86 url_launcher_ios: 68d46cc9766d0c41dbdc884310529557e3cd7a86
PODFILE CHECKSUM: dc959e9c395cfc0ed667b3f83251a823e01b945a PODFILE CHECKSUM: dc959e9c395cfc0ed667b3f83251a823e01b945a

View File

@@ -1,4 +1,5 @@
// import 'package:accessibility_tools/accessibility_tools.dart'; import 'package:accessibility_tools/accessibility_tools.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:hiddify/core/core_providers.dart'; import 'package:hiddify/core/core_providers.dart';
@@ -11,6 +12,8 @@ import 'package:hiddify/utils/utils.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:upgrader/upgrader.dart'; import 'package:upgrader/upgrader.dart';
bool _debugAccessibility = false;
class AppView extends HookConsumerWidget with PresLogger { class AppView extends HookConsumerWidget with PresLogger {
const AppView({super.key}); const AppView({super.key});
@@ -25,13 +28,6 @@ class AppView extends HookConsumerWidget with PresLogger {
final upgrader = ref.watch(upgraderProvider); final upgrader = ref.watch(upgraderProvider);
return MaterialApp.router( return MaterialApp.router(
// builder: (context, child) {
// return AccessibilityTools(
// checkFontOverflows: true,
// child: child,
// );
// },
// showSemanticsDebugger: true,
routerConfig: router, routerConfig: router,
locale: locale, locale: locale,
supportedLocales: AppLocaleUtils.supportedLocales, supportedLocales: AppLocaleUtils.supportedLocales,
@@ -41,20 +37,20 @@ class AppView extends HookConsumerWidget with PresLogger {
theme: theme.light(), theme: theme.light(),
darkTheme: theme.dark(), darkTheme: theme.dark(),
title: Constants.appName, title: Constants.appName,
// https://github.com/ponnamkarthik/FlutterToast/issues/393 builder: (context, child) {
builder: (context, child) => Overlay( child = UpgradeAlert(
initialEntries: [
if (child != null) ...[
OverlayEntry(
builder: (context) => UpgradeAlert(
upgrader: upgrader, upgrader: upgrader,
navigatorKey: router.routerDelegate.navigatorKey, navigatorKey: router.routerDelegate.navigatorKey,
child: child ?? const SizedBox(),
);
if (kDebugMode && _debugAccessibility) {
return AccessibilityTools(
checkFontOverflows: true,
child: child, child: child,
), );
), }
], return child;
], },
),
); );
} }
} }

View File

@@ -1,5 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart'; import 'package:toastification/toastification.dart';
class CustomAlertDialog extends StatelessWidget { class CustomAlertDialog extends StatelessWidget {
const CustomAlertDialog({ const CustomAlertDialog({
@@ -49,7 +49,17 @@ class CustomAlertDialog extends StatelessWidget {
} }
} }
enum AlertType { info, error, success } enum AlertType {
info,
error,
success;
ToastificationType get _toastificationType => switch (this) {
success => ToastificationType.success,
error => ToastificationType.error,
info => ToastificationType.info,
};
}
class CustomToast extends StatelessWidget { class CustomToast extends StatelessWidget {
const CustomToast( const CustomToast(
@@ -105,11 +115,18 @@ class CustomToast extends StatelessWidget {
} }
void show(BuildContext context) { void show(BuildContext context) {
final fToast = FToast().init(context); toastification.show(
fToast.showToast( context: context,
child: this, title: message,
gravity: ToastGravity.BOTTOM, type: type._toastificationType,
toastDuration: duration, alignment: Alignment.bottomLeft,
autoCloseDuration: duration,
style: ToastificationStyle.fillColored,
pauseOnHover: true,
showProgressBar: false,
dragToClose: true,
closeOnClick: true,
closeButtonShowType: CloseButtonShowType.onHover,
); );
} }
} }

View File

@@ -353,6 +353,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.13.1" version: "2.13.1"
equatable:
dependency: transitive
description:
name: equatable
sha256: c2b87cb7756efdf69892005af546c56c0b5037f54d2a88269b4f347a505e3ca2
url: "https://pub.dev"
source: hosted
version: "2.0.5"
fake_async: fake_async:
dependency: transitive dependency: transitive
description: description:
@@ -509,14 +517,6 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
fluttertoast:
dependency: "direct main"
description:
name: fluttertoast
sha256: "69a5c4fcfe9a163bc927ff386c0dedd62575913bba942d0ce80c1fd092885255"
url: "https://pub.dev"
source: hosted
version: "8.2.3"
fpdart: fpdart:
dependency: "direct main" dependency: "direct main"
description: description:
@@ -661,6 +661,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.5" version: "2.1.5"
iconsax_flutter:
dependency: transitive
description:
name: iconsax_flutter
sha256: "95b65699da8ea98f87c5d232f06b0debaaf1ec1332b697e4d90969ec9a93037d"
url: "https://pub.dev"
source: hosted
version: "1.0.0"
image: image:
dependency: transitive dependency: transitive
description: description:
@@ -909,6 +917,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.2.1" version: "2.2.1"
pausable_timer:
dependency: transitive
description:
name: pausable_timer
sha256: "35b1f77eb2fb0f42e823360321fbed9b9a8b1c7043a07a58aeda17d01f84659a"
url: "https://pub.dev"
source: hosted
version: "2.0.0+1"
percent_indicator: percent_indicator:
dependency: "direct main" dependency: "direct main"
description: description:
@@ -1394,6 +1410,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.0.1" version: "2.0.1"
toastification:
dependency: "direct main"
description:
name: toastification
sha256: "14e7f9178db0393df00509cd921de3d3db310d06c7c122e873f31d3c8d18cf4e"
url: "https://pub.dev"
source: hosted
version: "1.1.0"
tray_manager: tray_manager:
dependency: "direct main" dependency: "direct main"
description: description:

View File

@@ -62,11 +62,11 @@ dependencies:
flutter_svg: ^2.0.9 flutter_svg: ^2.0.9
gap: ^3.0.1 gap: ^3.0.1
percent_indicator: ^4.2.3 percent_indicator: ^4.2.3
fluttertoast: ^8.2.3
sliver_tools: ^0.2.12 sliver_tools: ^0.2.12
flutter_adaptive_scaffold: ^0.1.7+1 flutter_adaptive_scaffold: ^0.1.7+1
humanizer: ^2.2.0 humanizer: ^2.2.0
upgrader: ^8.2.0 upgrader: ^8.2.0
toastification: ^1.1.0
dev_dependencies: dev_dependencies:
flutter_test: flutter_test: