From ac21238ab48ac55352f324586660ed9db31abe00 Mon Sep 17 00:00:00 2001 From: Thibault Deckers Date: Fri, 18 Mar 2022 10:22:49 +0900 Subject: [PATCH] settings/about use nav bar area --- lib/widgets/about/about_page.dart | 52 +++++++++++-------- lib/widgets/aves_app.dart | 2 + lib/widgets/settings/settings_page.dart | 68 ++++++++++++++----------- lib/widgets/viewer/info/info_page.dart | 43 ++++++++-------- 4 files changed, 92 insertions(+), 73 deletions(-) diff --git a/lib/widgets/about/about_page.dart b/lib/widgets/about/about_page.dart index f87841ab4..3e69444b5 100644 --- a/lib/widgets/about/about_page.dart +++ b/lib/widgets/about/about_page.dart @@ -2,7 +2,9 @@ import 'package:aves/widgets/about/app_ref.dart'; import 'package:aves/widgets/about/bug_report.dart'; import 'package:aves/widgets/about/credits.dart'; import 'package:aves/widgets/about/licenses.dart'; +import 'package:aves/widgets/common/basic/insets.dart'; import 'package:aves/widgets/common/extensions/build_context.dart'; +import 'package:aves/widgets/common/providers/media_query_data_provider.dart'; import 'package:flutter/material.dart'; class AboutPage extends StatelessWidget { @@ -12,30 +14,36 @@ class AboutPage extends StatelessWidget { @override Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: Text(context.l10n.aboutPageTitle), - ), - body: SafeArea( - child: CustomScrollView( - slivers: [ - SliverPadding( - padding: const EdgeInsets.only(top: 16), - sliver: SliverList( - delegate: SliverChildListDelegate( - const [ - AppReference(), - Divider(), - BugReport(), - Divider(), - AboutCredits(), - Divider(), - ], + return MediaQueryDataProvider( + child: Scaffold( + appBar: AppBar( + title: Text(context.l10n.aboutPageTitle), + ), + body: GestureAreaProtectorStack( + child: SafeArea( + bottom: false, + child: CustomScrollView( + slivers: [ + SliverPadding( + padding: const EdgeInsets.only(top: 16), + sliver: SliverList( + delegate: SliverChildListDelegate( + const [ + AppReference(), + Divider(), + BugReport(), + Divider(), + AboutCredits(), + Divider(), + ], + ), + ), ), - ), + const Licenses(), + const BottomPaddingSliver(), + ], ), - const Licenses(), - ], + ), ), ), ); diff --git a/lib/widgets/aves_app.dart b/lib/widgets/aves_app.dart index d310b4728..fb17893f5 100644 --- a/lib/widgets/aves_app.dart +++ b/lib/widgets/aves_app.dart @@ -200,6 +200,8 @@ class _AvesAppState extends State with WidgetsBindingObserver { // save IDs of entries visible at the top of the collection page with current layout settings void _saveTopEntries() { + if (!settings.initialized) return; + final stopwatch = Stopwatch()..start(); final screenSize = window.physicalSize / window.devicePixelRatio; var tileExtent = settings.getTileExtent(CollectionPage.routeName); diff --git a/lib/widgets/settings/settings_page.dart b/lib/widgets/settings/settings_page.dart index 989888248..405d9ebe7 100644 --- a/lib/widgets/settings/settings_page.dart +++ b/lib/widgets/settings/settings_page.dart @@ -1,4 +1,5 @@ import 'dart:convert'; +import 'dart:math'; import 'dart:typed_data'; import 'package:aves/model/actions/settings_actions.dart'; @@ -8,8 +9,10 @@ import 'package:aves/services/common/services.dart'; import 'package:aves/theme/durations.dart'; import 'package:aves/theme/icons.dart'; import 'package:aves/widgets/common/action_mixins/feedback.dart'; +import 'package:aves/widgets/common/basic/insets.dart'; import 'package:aves/widgets/common/basic/menu.dart'; import 'package:aves/widgets/common/extensions/build_context.dart'; +import 'package:aves/widgets/common/extensions/media_query.dart'; import 'package:aves/widgets/common/providers/media_query_data_provider.dart'; import 'package:aves/widgets/settings/accessibility/accessibility.dart'; import 'package:aves/widgets/settings/app_export/items.dart'; @@ -72,38 +75,45 @@ class _SettingsPageState extends State with FeedbackMixin { ), ], ), - body: Theme( - data: theme.copyWith( - textTheme: theme.textTheme.copyWith( - // dense style font for tile subtitles, without modifying title font - bodyText2: const TextStyle(fontSize: 12), - ), - ), + body: GestureAreaProtectorStack( child: SafeArea( - child: AnimationLimiter( - child: ListView( - padding: const EdgeInsets.all(8), - children: AnimationConfiguration.toStaggeredList( - duration: durations.staggeredAnimation, - delay: durations.staggeredAnimationDelay * timeDilation, - childAnimationBuilder: (child) => SlideAnimation( - verticalOffset: 50.0, - child: FadeInAnimation( - child: child, - ), - ), - children: [ - NavigationSection(expandedNotifier: _expandedNotifier), - ThumbnailsSection(expandedNotifier: _expandedNotifier), - ViewerSection(expandedNotifier: _expandedNotifier), - VideoSection(expandedNotifier: _expandedNotifier), - PrivacySection(expandedNotifier: _expandedNotifier), - AccessibilitySection(expandedNotifier: _expandedNotifier), - DisplaySection(expandedNotifier: _expandedNotifier), - LanguageSection(expandedNotifier: _expandedNotifier), - ], + bottom: false, + child: Theme( + data: theme.copyWith( + textTheme: theme.textTheme.copyWith( + // dense style font for tile subtitles, without modifying title font + bodyText2: const TextStyle(fontSize: 12), ), ), + child: AnimationLimiter( + child: Selector( + selector: (context, mq) => max(mq.effectiveBottomPadding, mq.systemGestureInsets.bottom), + builder: (context, mqPaddingBottom, child) { + return ListView( + padding: const EdgeInsets.all(8) + EdgeInsets.only(bottom: mqPaddingBottom), + children: AnimationConfiguration.toStaggeredList( + duration: durations.staggeredAnimation, + delay: durations.staggeredAnimationDelay * timeDilation, + childAnimationBuilder: (child) => SlideAnimation( + verticalOffset: 50.0, + child: FadeInAnimation( + child: child, + ), + ), + children: [ + NavigationSection(expandedNotifier: _expandedNotifier), + ThumbnailsSection(expandedNotifier: _expandedNotifier), + ViewerSection(expandedNotifier: _expandedNotifier), + VideoSection(expandedNotifier: _expandedNotifier), + PrivacySection(expandedNotifier: _expandedNotifier), + AccessibilitySection(expandedNotifier: _expandedNotifier), + DisplaySection(expandedNotifier: _expandedNotifier), + LanguageSection(expandedNotifier: _expandedNotifier), + ], + ), + ); + }), + ), ), ), ), diff --git a/lib/widgets/viewer/info/info_page.dart b/lib/widgets/viewer/info/info_page.dart index 79f789b8a..5dc154de2 100644 --- a/lib/widgets/viewer/info/info_page.dart +++ b/lib/widgets/viewer/info/info_page.dart @@ -57,30 +57,29 @@ class _InfoPageState extends State { return ValueListenableBuilder( valueListenable: widget.entryNotifier, builder: (context, mainEntry, child) { - if (mainEntry != null) { - Widget _buildContent({AvesEntry? pageEntry}) { - final targetEntry = pageEntry ?? mainEntry; - return EmbeddedDataOpener( - entry: targetEntry, - child: _InfoPageContent( - collection: widget.collection, - entry: targetEntry, - isScrollingNotifier: widget.isScrollingNotifier, - scrollController: _scrollController, - split: mqWidth > splitScreenWidthThreshold, - goToViewer: _goToViewer, - ), - ); - } + if (mainEntry == null) return const SizedBox(); - return mainEntry.isBurst - ? PageEntryBuilder( - multiPageController: context.read().getController(mainEntry), - builder: (pageEntry) => _buildContent(pageEntry: pageEntry), - ) - : _buildContent(); + Widget _buildContent({AvesEntry? pageEntry}) { + final targetEntry = pageEntry ?? mainEntry; + return EmbeddedDataOpener( + entry: targetEntry, + child: _InfoPageContent( + collection: widget.collection, + entry: targetEntry, + isScrollingNotifier: widget.isScrollingNotifier, + scrollController: _scrollController, + split: mqWidth > splitScreenWidthThreshold, + goToViewer: _goToViewer, + ), + ); } - return const SizedBox(); + + return mainEntry.isBurst + ? PageEntryBuilder( + multiPageController: context.read().getController(mainEntry), + builder: (pageEntry) => _buildContent(pageEntry: pageEntry), + ) + : _buildContent(); }, ); },