-
Notifications
You must be signed in to change notification settings - Fork 222
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can disable Android back button when show loading? #203
Comments
Thanks for taking the time to open an issue. I will have a look and answer as soon as possible. |
Any solution for this...? |
Same problem. |
any updates?
|
Any solution ? |
Hello my friends you can make this solution: just wrap your scaffold with this widget and it will disable the back button import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
class OverlayLoadingPopScope extends StatefulWidget {
const OverlayLoadingPopScope({super.key, required this.child});
final Widget child;
@override
State<OverlayLoadingPopScope> createState() => _OverlayLoadingPopScopeState();
}
class _OverlayLoadingPopScopeState extends State<OverlayLoadingPopScope> {
late final ValueNotifier<bool> _loadingNotifier;
@override
void initState() {
super.initState();
_loadingNotifier = ValueNotifier<bool>(false);
EasyLoading.addStatusCallback(_statusCallback);
}
@override
void dispose() {
_loadingNotifier.dispose();
EasyLoading.removeCallback(_statusCallback);
super.dispose();
}
void _statusCallback(EasyLoadingStatus status) {
if (status == EasyLoadingStatus.show) {
_loadingNotifier.value = true;
} else {
_loadingNotifier.value = false;
}
}
@override
Widget build(BuildContext context) {
return ValueListenableBuilder<bool>(
valueListenable: _loadingNotifier,
builder: (context, isLoading, child) => PopScope(
canPop: isLoading == false,
child: child!,
),
child: widget.child,
);
}
} |
Anyone please response to him |
Not working |
Describe the bug
When show loading, app can back to previous screen by tap on back hardware button on Android.
Flutter/Dart info
`Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.3.9, on macOS 13.0.1 22A400 darwin-x64, locale en-VN)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
[✓] Xcode - develop for iOS and macOS (Xcode 14.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.3)
[✗] Cannot determine if IntelliJ is installed
✗ Directory listing failed
[✓] VS Code (version 1.73.1)
[✓] Connected device (5 available)
! Error: YenDang is busy: Fetching debug symbols for YenDang. Xcode will continue when YenDang is finished. (code -10)
! Error: Dang’s Apple Watch needs to connect to determine its availability. Check the connection between the device and its companion iPhone, and the connection between the iPhone and Xcode. Both devices may also need to be restarted and unlocked. (code 1)
[✓] HTTP Host Availability
! Doctor found issues in 1 category.
`
The text was updated successfully, but these errors were encountered: