settings/about use nav bar area

This commit is contained in:
Thibault Deckers 2022-03-18 10:22:49 +09:00
parent d3ed1a0d8e
commit ac21238ab4
4 changed files with 92 additions and 73 deletions

View file

@ -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/bug_report.dart';
import 'package:aves/widgets/about/credits.dart'; import 'package:aves/widgets/about/credits.dart';
import 'package:aves/widgets/about/licenses.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/extensions/build_context.dart';
import 'package:aves/widgets/common/providers/media_query_data_provider.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class AboutPage extends StatelessWidget { class AboutPage extends StatelessWidget {
@ -12,30 +14,36 @@ class AboutPage extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return MediaQueryDataProvider(
appBar: AppBar( child: Scaffold(
title: Text(context.l10n.aboutPageTitle), appBar: AppBar(
), title: Text(context.l10n.aboutPageTitle),
body: SafeArea( ),
child: CustomScrollView( body: GestureAreaProtectorStack(
slivers: [ child: SafeArea(
SliverPadding( bottom: false,
padding: const EdgeInsets.only(top: 16), child: CustomScrollView(
sliver: SliverList( slivers: [
delegate: SliverChildListDelegate( SliverPadding(
const [ padding: const EdgeInsets.only(top: 16),
AppReference(), sliver: SliverList(
Divider(), delegate: SliverChildListDelegate(
BugReport(), const [
Divider(), AppReference(),
AboutCredits(), Divider(),
Divider(), BugReport(),
], Divider(),
AboutCredits(),
Divider(),
],
),
),
), ),
), const Licenses(),
const BottomPaddingSliver(),
],
), ),
const Licenses(), ),
],
), ),
), ),
); );

View file

@ -200,6 +200,8 @@ class _AvesAppState extends State<AvesApp> with WidgetsBindingObserver {
// save IDs of entries visible at the top of the collection page with current layout settings // save IDs of entries visible at the top of the collection page with current layout settings
void _saveTopEntries() { void _saveTopEntries() {
if (!settings.initialized) return;
final stopwatch = Stopwatch()..start(); final stopwatch = Stopwatch()..start();
final screenSize = window.physicalSize / window.devicePixelRatio; final screenSize = window.physicalSize / window.devicePixelRatio;
var tileExtent = settings.getTileExtent(CollectionPage.routeName); var tileExtent = settings.getTileExtent(CollectionPage.routeName);

View file

@ -1,4 +1,5 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:math';
import 'dart:typed_data'; import 'dart:typed_data';
import 'package:aves/model/actions/settings_actions.dart'; 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/durations.dart';
import 'package:aves/theme/icons.dart'; import 'package:aves/theme/icons.dart';
import 'package:aves/widgets/common/action_mixins/feedback.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/basic/menu.dart';
import 'package:aves/widgets/common/extensions/build_context.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/common/providers/media_query_data_provider.dart';
import 'package:aves/widgets/settings/accessibility/accessibility.dart'; import 'package:aves/widgets/settings/accessibility/accessibility.dart';
import 'package:aves/widgets/settings/app_export/items.dart'; import 'package:aves/widgets/settings/app_export/items.dart';
@ -72,38 +75,45 @@ class _SettingsPageState extends State<SettingsPage> with FeedbackMixin {
), ),
], ],
), ),
body: Theme( body: GestureAreaProtectorStack(
data: theme.copyWith(
textTheme: theme.textTheme.copyWith(
// dense style font for tile subtitles, without modifying title font
bodyText2: const TextStyle(fontSize: 12),
),
),
child: SafeArea( child: SafeArea(
child: AnimationLimiter( bottom: false,
child: ListView( child: Theme(
padding: const EdgeInsets.all(8), data: theme.copyWith(
children: AnimationConfiguration.toStaggeredList( textTheme: theme.textTheme.copyWith(
duration: durations.staggeredAnimation, // dense style font for tile subtitles, without modifying title font
delay: durations.staggeredAnimationDelay * timeDilation, bodyText2: const TextStyle(fontSize: 12),
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),
],
), ),
), ),
child: AnimationLimiter(
child: Selector<MediaQueryData, double>(
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),
],
),
);
}),
),
), ),
), ),
), ),

View file

@ -57,30 +57,29 @@ class _InfoPageState extends State<InfoPage> {
return ValueListenableBuilder<AvesEntry?>( return ValueListenableBuilder<AvesEntry?>(
valueListenable: widget.entryNotifier, valueListenable: widget.entryNotifier,
builder: (context, mainEntry, child) { builder: (context, mainEntry, child) {
if (mainEntry != null) { if (mainEntry == null) return const SizedBox();
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 mainEntry.isBurst Widget _buildContent({AvesEntry? pageEntry}) {
? PageEntryBuilder( final targetEntry = pageEntry ?? mainEntry;
multiPageController: context.read<MultiPageConductor>().getController(mainEntry), return EmbeddedDataOpener(
builder: (pageEntry) => _buildContent(pageEntry: pageEntry), entry: targetEntry,
) child: _InfoPageContent(
: _buildContent(); 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<MultiPageConductor>().getController(mainEntry),
builder: (pageEntry) => _buildContent(pageEntry: pageEntry),
)
: _buildContent();
}, },
); );
}, },