fix riverpod lifecycle issues
This commit is contained in:
@@ -23,7 +23,7 @@ import 'package:weblibre/features/geckoview/features/browser/domain/entities/she
|
|||||||
|
|
||||||
part 'bottom_sheet.g.dart';
|
part 'bottom_sheet.g.dart';
|
||||||
|
|
||||||
@Riverpod()
|
@Riverpod(keepAlive: true)
|
||||||
class BottomSheetController extends _$BottomSheetController {
|
class BottomSheetController extends _$BottomSheetController {
|
||||||
@override
|
@override
|
||||||
Sheet? build() {
|
Sheet? build() {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ final class BottomSheetControllerProvider
|
|||||||
argument: null,
|
argument: null,
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'bottomSheetControllerProvider',
|
name: r'bottomSheetControllerProvider',
|
||||||
isAutoDispose: true,
|
isAutoDispose: false,
|
||||||
dependencies: null,
|
dependencies: null,
|
||||||
$allTransitiveDependencies: null,
|
$allTransitiveDependencies: null,
|
||||||
);
|
);
|
||||||
@@ -42,7 +42,7 @@ final class BottomSheetControllerProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
String _$bottomSheetControllerHash() =>
|
String _$bottomSheetControllerHash() =>
|
||||||
r'0b0ea53a96b80b8c1cba79b1d5913274b7127d5b';
|
r'94b9467731de45d4edd24028d76279e17fc26d02';
|
||||||
|
|
||||||
abstract class _$BottomSheetController extends $Notifier<Sheet?> {
|
abstract class _$BottomSheetController extends $Notifier<Sheet?> {
|
||||||
Sheet? build();
|
Sheet? build();
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import 'package:riverpod_annotation/riverpod_annotation.dart';
|
|||||||
|
|
||||||
part 'overlay.g.dart';
|
part 'overlay.g.dart';
|
||||||
|
|
||||||
@Riverpod()
|
@Riverpod(keepAlive: true)
|
||||||
class OverlayController extends _$OverlayController {
|
class OverlayController extends _$OverlayController {
|
||||||
@override
|
@override
|
||||||
WidgetBuilder? build() {
|
WidgetBuilder? build() {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ final class OverlayControllerProvider
|
|||||||
argument: null,
|
argument: null,
|
||||||
retry: null,
|
retry: null,
|
||||||
name: r'overlayControllerProvider',
|
name: r'overlayControllerProvider',
|
||||||
isAutoDispose: true,
|
isAutoDispose: false,
|
||||||
dependencies: null,
|
dependencies: null,
|
||||||
$allTransitiveDependencies: null,
|
$allTransitiveDependencies: null,
|
||||||
);
|
);
|
||||||
@@ -41,7 +41,7 @@ final class OverlayControllerProvider
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String _$overlayControllerHash() => r'7b7885e07ae557c14199b6942b5d6392592ab747';
|
String _$overlayControllerHash() => r'd0cd7c4cf867397f10f801ec2f7733be56520fb3';
|
||||||
|
|
||||||
abstract class _$OverlayController extends $Notifier<WidgetBuilder?> {
|
abstract class _$OverlayController extends $Notifier<WidgetBuilder?> {
|
||||||
WidgetBuilder? build();
|
WidgetBuilder? build();
|
||||||
|
|||||||
@@ -107,7 +107,10 @@ class BrowserScreen extends HookConsumerWidget {
|
|||||||
|
|
||||||
final sheetController = useRef<PersistentBottomSheetController?>(null);
|
final sheetController = useRef<PersistentBottomSheetController?>(null);
|
||||||
|
|
||||||
return PopScope(
|
return TickerMode(
|
||||||
|
//Lets not pause riverpod subscriptions for nnow
|
||||||
|
enabled: true,
|
||||||
|
child: PopScope(
|
||||||
//We need this for BackButtonListener to work downstream
|
//We need this for BackButtonListener to work downstream
|
||||||
//No direct pop result will be handled here
|
//No direct pop result will be handled here
|
||||||
canPop: false,
|
canPop: false,
|
||||||
@@ -171,7 +174,9 @@ class BrowserScreen extends HookConsumerWidget {
|
|||||||
);
|
);
|
||||||
|
|
||||||
ref.listen(
|
ref.listen(
|
||||||
tabStateProvider(tabId).select((value) => value?.historyState),
|
tabStateProvider(
|
||||||
|
tabId,
|
||||||
|
).select((value) => value?.historyState),
|
||||||
(previous, next) {
|
(previous, next) {
|
||||||
if (next != null && previous != null) {
|
if (next != null && previous != null) {
|
||||||
if (previous != next) {
|
if (previous != next) {
|
||||||
@@ -303,7 +308,9 @@ class BrowserScreen extends HookConsumerWidget {
|
|||||||
lastBackButtonPress.value = null;
|
lastBackButtonPress.value = null;
|
||||||
|
|
||||||
await ref
|
await ref
|
||||||
.read(readerableScreenControllerProvider.notifier)
|
.read(
|
||||||
|
readerableScreenControllerProvider.notifier,
|
||||||
|
)
|
||||||
.toggleReaderView(false);
|
.toggleReaderView(false);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -389,7 +396,8 @@ class BrowserScreen extends HookConsumerWidget {
|
|||||||
final relativeSafeArea = MediaQuery.of(
|
final relativeSafeArea = MediaQuery.of(
|
||||||
context,
|
context,
|
||||||
).relativeSafeArea();
|
).relativeSafeArea();
|
||||||
sheetController.value = Scaffold.of(context).showBottomSheet((
|
sheetController
|
||||||
|
.value = Scaffold.of(context).showBottomSheet((
|
||||||
context,
|
context,
|
||||||
) {
|
) {
|
||||||
bool dismissOnThreshold(
|
bool dismissOnThreshold(
|
||||||
@@ -410,7 +418,9 @@ class BrowserScreen extends HookConsumerWidget {
|
|||||||
NotificationListener<DraggableScrollableNotification>(
|
NotificationListener<DraggableScrollableNotification>(
|
||||||
key: ValueKey(next),
|
key: ValueKey(next),
|
||||||
onNotification: dismissOnThreshold,
|
onNotification: dismissOnThreshold,
|
||||||
child: _ViewTabsSheet(maxChildSize: relativeSafeArea),
|
child: _ViewTabsSheet(
|
||||||
|
maxChildSize: relativeSafeArea,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
final EditUrlSheet parameter =>
|
final EditUrlSheet parameter =>
|
||||||
NotificationListener<DraggableScrollableNotification>(
|
NotificationListener<DraggableScrollableNotification>(
|
||||||
@@ -434,6 +444,7 @@ class BrowserScreen extends HookConsumerWidget {
|
|||||||
floatingActionButton: ReaderAppearanceButton(),
|
floatingActionButton: ReaderAppearanceButton(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user