mirror of
https://github.com/jagandeepbrar/lunasea.git
synced 2026-08-31 04:32:32 +00:00
21 lines
581 B
Dart
21 lines
581 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
class LunaWillPopScope extends WillPopScope {
|
|
LunaWillPopScope({
|
|
Key? key,
|
|
required GlobalKey<ScaffoldState> scaffoldKey,
|
|
required Widget child,
|
|
}) : super(
|
|
key: key,
|
|
onWillPop: () async {
|
|
if (scaffoldKey.currentState?.hasDrawer ?? false) {
|
|
if (scaffoldKey.currentState?.isDrawerOpen ?? false) return true;
|
|
scaffoldKey.currentState?.openDrawer();
|
|
return false;
|
|
}
|
|
return true;
|
|
},
|
|
child: child,
|
|
);
|
|
}
|