From 3a8f34856c2b805c25e3d90ccd8e48134a54e813 Mon Sep 17 00:00:00 2001 From: Rakesh Bohara Date: Mon, 17 Jul 2023 10:47:39 +0545 Subject: [PATCH] feat: allow user to enable/disable back button when loading --- example/pubspec.yaml | 2 +- lib/src/easy_loading.dart | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 2125937..46a8f7b 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -24,7 +24,7 @@ dependencies: # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. - cupertino_icons: ^0.1.2 + cupertino_icons: ^1.0.1 dev_dependencies: flutter_test: diff --git a/lib/src/easy_loading.dart b/lib/src/easy_loading.dart index 1193f48..ba2a992 100644 --- a/lib/src/easy_loading.dart +++ b/lib/src/easy_loading.dart @@ -25,13 +25,13 @@ import 'dart:math'; import 'package:flutter/material.dart'; +import './animations/animation.dart'; +import './theme.dart'; import './widgets/container.dart'; -import './widgets/progress.dart'; import './widgets/indicator.dart'; -import './widgets/overlay_entry.dart'; import './widgets/loading.dart'; -import './animations/animation.dart'; -import './theme.dart'; +import './widgets/overlay_entry.dart'; +import './widgets/progress.dart'; /// loading style enum EasyLoadingStyle { @@ -251,6 +251,7 @@ class EasyLoading { Widget? indicator, EasyLoadingMaskType? maskType, bool? dismissOnTap, + bool? disableBackWhileLoading, }) { Widget w = indicator ?? (_instance.indicatorWidget ?? LoadingIndicator()); return _instance._show( @@ -258,6 +259,7 @@ class EasyLoading { maskType: maskType, dismissOnTap: dismissOnTap, w: w, + disableBackWhileLoading: disableBackWhileLoading, ); } @@ -420,6 +422,7 @@ class EasyLoading { EasyLoadingMaskType? maskType, bool? dismissOnTap, EasyLoadingToastPosition? toastPosition, + bool? disableBackWhileLoading, }) async { assert( overlayEntry != null, @@ -472,6 +475,7 @@ class EasyLoading { maskType: maskType, dismissOnTap: dismissOnTap, completer: completer, + disableBackWhileLoading: disableBackWhileLoading ?? false, ); completer.future.whenComplete(() { _callback(EasyLoadingStatus.show);