fix: material & samsung pop app on back button from list

This commit is contained in:
zlshames
2024-11-07 14:12:47 -05:00
parent a981bb2947
commit d248e764ed
2 changed files with 10 additions and 2 deletions

View File

@ -8,6 +8,7 @@ import 'package:bluebubbles/app/wrappers/scrollbar_wrapper.dart';
import 'package:bluebubbles/app/wrappers/theme_switcher.dart';
import 'package:bluebubbles/services/services.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_acrylic/flutter_acrylic.dart';
import 'package:get/get.dart';
@ -43,7 +44,7 @@ class _MaterialConversationListState extends OptimizedState<MaterialConversation
Widget build(BuildContext context) {
return PopScope(
canPop: false,
onPopInvoked: (bool didPop) async {
onPopInvokedWithResult: <T>(bool didPop, T? other) {
if (didPop) return;
if (controller.selectedChats.isNotEmpty) {
controller.clearSelectedChats();
@ -51,6 +52,9 @@ class _MaterialConversationListState extends OptimizedState<MaterialConversation
} else if (controller.showArchivedChats || controller.showUnknownSenders) {
// Pop the current page
Navigator.of(context).pop();
} else {
// Pop the app to exit the app
SystemNavigator.pop();
}
},
child: Container(

View File

@ -11,6 +11,7 @@ import 'package:bluebubbles/app/wrappers/theme_switcher.dart';
import 'package:bluebubbles/services/services.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_acrylic/flutter_acrylic.dart';
import 'package:get/get.dart';
@ -46,7 +47,7 @@ class _SamsungConversationListState extends OptimizedState<SamsungConversationLi
Widget build(BuildContext context) {
return PopScope(
canPop: false,
onPopInvoked: (bool didPop) async {
onPopInvokedWithResult: <T>(bool didPop, T? other) {
if (didPop) return;
if (controller.selectedChats.isNotEmpty) {
controller.clearSelectedChats();
@ -54,6 +55,9 @@ class _SamsungConversationListState extends OptimizedState<SamsungConversationLi
} else if (controller.showArchivedChats || controller.showUnknownSenders) {
// Pop the current page
Navigator.of(context).pop();
} else {
// Pop the app to exit the app
SystemNavigator.pop();
}
},
child: Scaffold(