mirror of
https://github.com/revanced/revanced-manager.git
synced 2025-06-12 20:57:36 +02:00
refactor: PopScope Migration (#1674)
Co-authored-by: Benjamin Halko <benjaminhalko@hotmail.com>
This commit is contained in:
@ -16,12 +16,15 @@ class InstallerView extends StatelessWidget {
|
||||
return ViewModelBuilder<InstallerViewModel>.reactive(
|
||||
onViewModelReady: (model) => model.initialize(context),
|
||||
viewModelBuilder: () => InstallerViewModel(),
|
||||
builder: (context, model, child) => WillPopScope(
|
||||
/*
|
||||
TODO(any): migrate to [PopScope],
|
||||
we've tried to migrate it two times but
|
||||
reverted it because we couldn't exit out of the screen.
|
||||
*/
|
||||
builder: (context, model, child) => PopScope(
|
||||
canPop: !model.isPatching,
|
||||
onPopInvoked: (bool didPop) {
|
||||
if (didPop) {
|
||||
model.onPop();
|
||||
} else {
|
||||
model.onPopAttempt(context);
|
||||
}
|
||||
},
|
||||
child: SafeArea(
|
||||
top: false,
|
||||
bottom: model.isPatching,
|
||||
@ -83,7 +86,7 @@ class InstallerView extends StatelessWidget {
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
onBackButtonPressed: () => model.onWillPop(context),
|
||||
onBackButtonPressed: () => Navigator.maybePop(context),
|
||||
bottom: PreferredSize(
|
||||
preferredSize: const Size(double.infinity, 1.0),
|
||||
child: GradientProgressIndicator(progress: model.progress),
|
||||
@ -111,7 +114,6 @@ class InstallerView extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
onWillPop: () => model.onWillPop(context),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user