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/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(),
],
),
),
),
);

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
void _saveTopEntries() {
if (!settings.initialized) return;
final stopwatch = Stopwatch()..start();
final screenSize = window.physicalSize / window.devicePixelRatio;
var tileExtent = settings.getTileExtent(CollectionPage.routeName);

View file

@ -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<SettingsPage> 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<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?>(
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<MultiPageConductor>().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<MultiPageConductor>().getController(mainEntry),
builder: (pageEntry) => _buildContent(pageEntry: pageEntry),
)
: _buildContent();
},
);
},