Fix selecting something in timeline reset the scroll position

This commit is contained in:
Ming Ming 2024-12-11 00:40:24 +08:00
parent 35212e0a1c
commit 0ded662de5

View file

@ -181,15 +181,17 @@ class _WrappedHomePhotosState extends State<_WrappedHomePhotos> {
child: _BlocSelector( child: _BlocSelector(
selector: (state) => state.selectedItems.isEmpty, selector: (state) => state.selectedItems.isEmpty,
builder: (context, isSelectedEmpty) => isSelectedEmpty builder: (context, isSelectedEmpty) => isSelectedEmpty
? const DoubleTapExitContainer( ? DoubleTapExitContainer(
child: _BodyView(), child: _BodyView(
key: _bodyKey,
),
) )
: PopScope( : PopScope(
canPop: false, canPop: false,
onPopInvoked: (_) { onPopInvoked: (_) {
context.addEvent(const _SetSelectedItems(items: {})); context.addEvent(const _SetSelectedItems(items: {}));
}, },
child: const _BodyView(), child: _BodyView(key: _bodyKey),
), ),
), ),
), ),
@ -197,11 +199,12 @@ class _WrappedHomePhotosState extends State<_WrappedHomePhotos> {
} }
final _key = GlobalKey(); final _key = GlobalKey();
final _bodyKey = GlobalKey();
bool? _isVisible; bool? _isVisible;
} }
class _BodyView extends StatelessWidget { class _BodyView extends StatelessWidget {
const _BodyView(); const _BodyView({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {