Skip to content

Commit

Permalink
fix: restoring branch
Browse files Browse the repository at this point in the history
  • Loading branch information
feduke-nukem committed Apr 4, 2023
1 parent 3dcffd5 commit 03f4f57
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 6 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## [3.0.6] - 2022.08.13

* fixed [#178](https://github.com/nslogx/flutter_easyloading/issues/178)
* fixed [#178](https://github.com/nslogx/flutter_easyloading/issues/114)

## [3.0.5] - 2022.05.23

* 🎉 It's support flutter 3.0 and previous version now
Expand Down Expand Up @@ -108,4 +113,4 @@

## [0.0.1] - 2019.12.23

* init
* init
4 changes: 3 additions & 1 deletion README-zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ EasyLoading.instance

感谢 [flutter_spinkit](https://github.com/jogboms/flutter_spinkit) ❤️

感谢 [back_button_interceptor](https://github.com/marcglasberg/back_button_interceptor) ❤️

感谢 [JetBrains Open Source](https://www.jetbrains.com/community/opensource/#support) 提供支持

[<img src="https://raw.githubusercontent.com/nslogx/flutter_easyloading/master/images/jetbrains.png" width=200 height=112/>](https://www.jetbrains.com/?from=FlutterEasyLoading)
[<img src="https://raw.githubusercontent.com/nslogx/flutter_easyloading/master/images/jetbrains.png" width=200 height=112/>](https://www.jetbrains.com/?from=FlutterEasyLoading)
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@ example: 👉 [Custom Animation](https://github.com/nslogx/flutter_easyloading/b

Thanks to [flutter_spinkit](https://github.com/jogboms/flutter_spinkit) ❤️

Thanks to [back_button_interceptor](https://github.com/marcglasberg/back_button_interceptor) ❤️

Supported by [JetBrains Open Source](https://www.jetbrains.com/community/opensource/#support)

[<img src="https://raw.githubusercontent.com/nslogx/flutter_easyloading/master/images/jetbrains.png" width=200 height=112/>](https://www.jetbrains.com/?from=FlutterEasyLoading)

30 changes: 29 additions & 1 deletion lib/src/easy_loading.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import 'dart:async';
import 'dart:math';

import 'package:flutter/material.dart';
import 'package:back_button_interceptor/back_button_interceptor.dart';

import './widgets/container.dart';
import './widgets/progress.dart';
Expand Down Expand Up @@ -253,6 +254,13 @@ class EasyLoading {
bool? dismissOnTap,
}) {
Widget w = indicator ?? (_instance.indicatorWidget ?? LoadingIndicator());

final isIgnoringBackButton = !EasyLoadingTheme.ignoring(maskType);

if (isIgnoringBackButton) {
BackButtonInterceptor.add(_backButtonInterceptor);
}

return _instance._show(
status: status,
maskType: maskType,
Expand Down Expand Up @@ -287,6 +295,12 @@ class EasyLoading {
key: _progressKey,
value: value,
);
final isIgnoringBackButton = !EasyLoadingTheme.ignoring(maskType);

if (isIgnoringBackButton) {
BackButtonInterceptor.add(_backButtonInterceptor);
}

_instance._show(
status: status,
maskType: maskType,
Expand Down Expand Up @@ -390,7 +404,15 @@ class EasyLoading {
}) {
// cancel timer
_instance._cancelTimer();
return _instance._dismiss(animation);
return _instance._dismiss(animation).whenComplete(
() {
final isIgnoringBackButton = !EasyLoadingTheme.ignoring(null);

if (!isIgnoringBackButton) return;

BackButtonInterceptor.remove(_backButtonInterceptor);
},
);
}

/// add loading status callback
Expand Down Expand Up @@ -520,4 +542,10 @@ class EasyLoading {
_timer?.cancel();
_timer = null;
}

static bool _backButtonInterceptor(
bool stopDefaultButtonEvent,
RouteInfo routeInfo,
) =>
true;
}
5 changes: 3 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
name: flutter_easyloading
description: A clean and lightweight loading/toast widget for Flutter, Easy to use without context, Support iOS、Android and Web
version: 3.0.5
version: 3.0.6
homepage: https://github.com/nslogx/flutter_easyloading

environment:
sdk: ">=2.12.0 <3.0.0"

dependencies:
back_button_interceptor: ^6.0.1
flutter:
sdk: flutter

Expand All @@ -16,4 +17,4 @@ dev_dependencies:
flutter_test:
sdk: flutter

flutter:
flutter:

0 comments on commit 03f4f57

Please sign in to comment.