bugfix: make sure System UI is visible when navigating to filtered collection from Info
This commit is contained in:
parent
53dfe85e07
commit
7580988747
2 changed files with 44 additions and 26 deletions
|
@ -2,9 +2,11 @@ import 'dart:io';
|
||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:aves/model/collection_lens.dart';
|
import 'package:aves/model/collection_lens.dart';
|
||||||
|
import 'package:aves/model/filters/filters.dart';
|
||||||
import 'package:aves/model/image_entry.dart';
|
import 'package:aves/model/image_entry.dart';
|
||||||
import 'package:aves/utils/change_notifier.dart';
|
import 'package:aves/utils/change_notifier.dart';
|
||||||
import 'package:aves/utils/constants.dart';
|
import 'package:aves/utils/constants.dart';
|
||||||
|
import 'package:aves/widgets/album/collection_page.dart';
|
||||||
import 'package:aves/widgets/common/image_providers/thumbnail_provider.dart';
|
import 'package:aves/widgets/common/image_providers/thumbnail_provider.dart';
|
||||||
import 'package:aves/widgets/common/image_providers/uri_image_provider.dart';
|
import 'package:aves/widgets/common/image_providers/uri_image_provider.dart';
|
||||||
import 'package:aves/widgets/fullscreen/fullscreen_action_delegate.dart';
|
import 'package:aves/widgets/fullscreen/fullscreen_action_delegate.dart';
|
||||||
|
@ -207,6 +209,11 @@ class FullscreenBodyState extends State<FullscreenBody> with SingleTickerProvide
|
||||||
_onLeave();
|
_onLeave();
|
||||||
return SynchronousFuture(true);
|
return SynchronousFuture(true);
|
||||||
},
|
},
|
||||||
|
child: NotificationListener(
|
||||||
|
onNotification: (notification) {
|
||||||
|
if (notification is FilterNotification) _goToCollection(notification.filter);
|
||||||
|
return false;
|
||||||
|
},
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
FullscreenVerticalPageView(
|
FullscreenVerticalPageView(
|
||||||
|
@ -224,6 +231,7 @@ class FullscreenBodyState extends State<FullscreenBody> with SingleTickerProvide
|
||||||
bottomOverlay,
|
bottomOverlay,
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,6 +239,17 @@ class FullscreenBodyState extends State<FullscreenBody> with SingleTickerProvide
|
||||||
_verticalScrollNotifier.notifyListeners();
|
_verticalScrollNotifier.notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _goToCollection(CollectionFilter filter) {
|
||||||
|
_showSystemUI();
|
||||||
|
Navigator.pushAndRemoveUntil(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => CollectionPage(collection.derive(filter)),
|
||||||
|
),
|
||||||
|
(route) => false,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> _goToVerticalPage(int page) {
|
Future<void> _goToVerticalPage(int page) {
|
||||||
return _verticalPager.animateToPage(
|
return _verticalPager.animateToPage(
|
||||||
page,
|
page,
|
||||||
|
@ -275,9 +294,9 @@ class FullscreenBodyState extends State<FullscreenBody> with SingleTickerProvide
|
||||||
|
|
||||||
// system UI
|
// system UI
|
||||||
|
|
||||||
void _showSystemUI() => SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values);
|
static void _showSystemUI() => SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values);
|
||||||
|
|
||||||
void _hideSystemUI() => SystemChrome.setEnabledSystemUIOverlays([]);
|
static void _hideSystemUI() => SystemChrome.setEnabledSystemUIOverlays([]);
|
||||||
|
|
||||||
// overlay
|
// overlay
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import 'package:aves/model/collection_lens.dart';
|
import 'package:aves/model/collection_lens.dart';
|
||||||
import 'package:aves/model/filters/filters.dart';
|
import 'package:aves/model/filters/filters.dart';
|
||||||
import 'package:aves/model/image_entry.dart';
|
import 'package:aves/model/image_entry.dart';
|
||||||
import 'package:aves/widgets/album/collection_page.dart';
|
|
||||||
import 'package:aves/widgets/common/aves_filter_chip.dart';
|
import 'package:aves/widgets/common/aves_filter_chip.dart';
|
||||||
import 'package:aves/widgets/common/data_providers/media_query_data_provider.dart';
|
import 'package:aves/widgets/common/data_providers/media_query_data_provider.dart';
|
||||||
import 'package:aves/widgets/fullscreen/info/basic_section.dart';
|
import 'package:aves/widgets/fullscreen/info/basic_section.dart';
|
||||||
|
@ -155,13 +154,7 @@ class InfoPageState extends State<InfoPage> {
|
||||||
|
|
||||||
void _goToCollection(CollectionFilter filter) {
|
void _goToCollection(CollectionFilter filter) {
|
||||||
if (collection == null) return;
|
if (collection == null) return;
|
||||||
Navigator.pushAndRemoveUntil(
|
FilterNotification(filter).dispatch(context);
|
||||||
context,
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (context) => CollectionPage(collection.derive(filter)),
|
|
||||||
),
|
|
||||||
(route) => false,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,3 +221,9 @@ class InfoRowGroup extends StatelessWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class BackUpNotification extends Notification {}
|
class BackUpNotification extends Notification {}
|
||||||
|
|
||||||
|
class FilterNotification extends Notification {
|
||||||
|
final CollectionFilter filter;
|
||||||
|
|
||||||
|
const FilterNotification(this.filter);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue