tv: safe area, app bar leading
This commit is contained in:
parent
b343e32db0
commit
665a79c488
17 changed files with 213 additions and 125 deletions
|
@ -47,7 +47,6 @@ class AboutPage extends StatelessWidget {
|
||||||
);
|
);
|
||||||
|
|
||||||
if (settings.useTvLayout) {
|
if (settings.useTvLayout) {
|
||||||
final isRtl = context.isRtl;
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: AvesPopScope(
|
body: AvesPopScope(
|
||||||
handlers: const [TvNavigationPopHandler.pop],
|
handlers: const [TvNavigationPopHandler.pop],
|
||||||
|
@ -57,9 +56,8 @@ class AboutPage extends StatelessWidget {
|
||||||
controller: context.read<TvRailController>(),
|
controller: context.read<TvRailController>(),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: SafeArea(
|
child: DirectionalSafeArea(
|
||||||
left: isRtl,
|
start: false,
|
||||||
right: !isRtl,
|
|
||||||
child: body,
|
child: body,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -136,11 +136,7 @@ class _AvesAppState extends State<AvesApp> with WidgetsBindingObserver {
|
||||||
final Set<String> _changedUris = {};
|
final Set<String> _changedUris = {};
|
||||||
Size? _screenSize;
|
Size? _screenSize;
|
||||||
|
|
||||||
// Flutter has various page transition implementations for Android:
|
final ValueNotifier<PageTransitionsBuilder> _pageTransitionsBuilderNotifier = ValueNotifier(defaultPageTransitionsBuilder);
|
||||||
// - `FadeUpwardsPageTransitionsBuilder` on Oreo / API 27 and below
|
|
||||||
// - `OpenUpwardsPageTransitionsBuilder` on Pie / API 28
|
|
||||||
// - `ZoomPageTransitionsBuilder` on Android 10 / API 29 and above (default in Flutter v3.0.0)
|
|
||||||
final ValueNotifier<PageTransitionsBuilder> _pageTransitionsBuilderNotifier = ValueNotifier(const FadeUpwardsPageTransitionsBuilder());
|
|
||||||
final ValueNotifier<TvMediaQueryModifier?> _tvMediaQueryModifierNotifier = ValueNotifier(null);
|
final ValueNotifier<TvMediaQueryModifier?> _tvMediaQueryModifierNotifier = ValueNotifier(null);
|
||||||
final ValueNotifier<AppMode> _appModeNotifier = ValueNotifier(AppMode.main);
|
final ValueNotifier<AppMode> _appModeNotifier = ValueNotifier(AppMode.main);
|
||||||
|
|
||||||
|
@ -152,6 +148,12 @@ class _AvesAppState extends State<AvesApp> with WidgetsBindingObserver {
|
||||||
final EventChannel _analysisCompletionChannel = const OptionalEventChannel('deckers.thibault/aves/analysis_events');
|
final EventChannel _analysisCompletionChannel = const OptionalEventChannel('deckers.thibault/aves/analysis_events');
|
||||||
final EventChannel _errorChannel = const OptionalEventChannel('deckers.thibault/aves/error');
|
final EventChannel _errorChannel = const OptionalEventChannel('deckers.thibault/aves/error');
|
||||||
|
|
||||||
|
// Flutter has various page transition implementations for Android:
|
||||||
|
// - `FadeUpwardsPageTransitionsBuilder` on Oreo / API 27 and below
|
||||||
|
// - `OpenUpwardsPageTransitionsBuilder` on Pie / API 28
|
||||||
|
// - `ZoomPageTransitionsBuilder` on Android 10 / API 29 and above (default in Flutter v3.0.0)
|
||||||
|
static const defaultPageTransitionsBuilder = FadeUpwardsPageTransitionsBuilder();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
@ -420,7 +422,19 @@ class _AvesAppState extends State<AvesApp> with WidgetsBindingObserver {
|
||||||
await settings.init(monitorPlatformSettings: true);
|
await settings.init(monitorPlatformSettings: true);
|
||||||
settings.isRotationLocked = await windowService.isRotationLocked();
|
settings.isRotationLocked = await windowService.isRotationLocked();
|
||||||
settings.areAnimationsRemoved = await AccessibilityService.areAnimationsRemoved();
|
settings.areAnimationsRemoved = await AccessibilityService.areAnimationsRemoved();
|
||||||
|
await _onTvLayoutChanged();
|
||||||
|
_monitorSettings();
|
||||||
|
|
||||||
|
FijkLog.setLevel(FijkLogLevel.Warn);
|
||||||
|
unawaited(_setupErrorReporting());
|
||||||
|
|
||||||
|
debugPrint('App setup in ${stopwatch.elapsed.inMilliseconds}ms');
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _onTvLayoutChanged() async {
|
||||||
if (settings.useTvLayout) {
|
if (settings.useTvLayout) {
|
||||||
|
settings.applyTvSettings();
|
||||||
|
|
||||||
_pageTransitionsBuilderNotifier.value = const TvPageTransitionsBuilder();
|
_pageTransitionsBuilderNotifier.value = const TvPageTransitionsBuilder();
|
||||||
_tvMediaQueryModifierNotifier.value = (mq) => mq.copyWith(
|
_tvMediaQueryModifierNotifier.value = (mq) => mq.copyWith(
|
||||||
textScaleFactor: 1.1,
|
textScaleFactor: 1.1,
|
||||||
|
@ -429,13 +443,11 @@ class _AvesAppState extends State<AvesApp> with WidgetsBindingObserver {
|
||||||
if (settings.forceTvLayout) {
|
if (settings.forceTvLayout) {
|
||||||
await windowService.requestOrientation(Orientation.landscape);
|
await windowService.requestOrientation(Orientation.landscape);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
_pageTransitionsBuilderNotifier.value = defaultPageTransitionsBuilder;
|
||||||
|
_tvMediaQueryModifierNotifier.value = null;
|
||||||
|
await windowService.requestOrientation(null);
|
||||||
}
|
}
|
||||||
_monitorSettings();
|
|
||||||
|
|
||||||
FijkLog.setLevel(FijkLogLevel.Warn);
|
|
||||||
unawaited(_setupErrorReporting());
|
|
||||||
|
|
||||||
debugPrint('App setup in ${stopwatch.elapsed.inMilliseconds}ms');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _monitorSettings() {
|
void _monitorSettings() {
|
||||||
|
@ -457,22 +469,26 @@ class _AvesAppState extends State<AvesApp> with WidgetsBindingObserver {
|
||||||
}
|
}
|
||||||
|
|
||||||
void applyForceTvLayout() {
|
void applyForceTvLayout() {
|
||||||
settings.applyTvSettings();
|
_onTvLayoutChanged();
|
||||||
windowService.requestOrientation(settings.forceTvLayout ? Orientation.landscape : null);
|
unawaited(AvesApp.navigatorKey.currentState!.pushAndRemoveUntil(
|
||||||
AvesApp.navigatorKey.currentState!.pushAndRemoveUntil(
|
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
settings: const RouteSettings(name: HomePage.routeName),
|
settings: const RouteSettings(name: HomePage.routeName),
|
||||||
builder: (_) => _getFirstPage(),
|
builder: (_) => _getFirstPage(),
|
||||||
),
|
),
|
||||||
(route) => false,
|
(route) => false,
|
||||||
);
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
settings.updateStream.where((event) => event.key == Settings.isInstalledAppAccessAllowedKey).listen((_) => applyIsInstalledAppAccessAllowed());
|
final settingStream = settings.updateStream;
|
||||||
settings.updateStream.where((event) => event.key == Settings.displayRefreshRateModeKey).listen((_) => applyDisplayRefreshRateMode());
|
// app
|
||||||
settings.updateStream.where((event) => event.key == Settings.keepScreenOnKey).listen((_) => applyKeepScreenOn());
|
settingStream.where((event) => event.key == Settings.isInstalledAppAccessAllowedKey).listen((_) => applyIsInstalledAppAccessAllowed());
|
||||||
settings.updateStream.where((event) => event.key == Settings.platformAccelerometerRotationKey).listen((_) => applyIsRotationLocked());
|
// display
|
||||||
settings.updateStream.where((event) => event.key == Settings.forceTvLayoutKey).listen((_) => applyForceTvLayout());
|
settingStream.where((event) => event.key == Settings.displayRefreshRateModeKey).listen((_) => applyDisplayRefreshRateMode());
|
||||||
|
settingStream.where((event) => event.key == Settings.forceTvLayoutKey).listen((_) => applyForceTvLayout());
|
||||||
|
// navigation
|
||||||
|
settingStream.where((event) => event.key == Settings.keepScreenOnKey).listen((_) => applyKeepScreenOn());
|
||||||
|
// platform settings
|
||||||
|
settingStream.where((event) => event.key == Settings.platformAccelerometerRotationKey).listen((_) => applyIsRotationLocked());
|
||||||
|
|
||||||
applyDisplayRefreshRateMode();
|
applyDisplayRefreshRateMode();
|
||||||
applyKeepScreenOn();
|
applyKeepScreenOn();
|
||||||
|
|
|
@ -82,6 +82,7 @@ class _CollectionPageState extends State<CollectionPage> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final useTvLayout = settings.useTvLayout;
|
||||||
final liveFilter = _collection.filters.firstWhereOrNull((v) => v is QueryFilter && v.live) as QueryFilter?;
|
final liveFilter = _collection.filters.firstWhereOrNull((v) => v is QueryFilter && v.live) as QueryFilter?;
|
||||||
return SelectionProvider<AvesEntry>(
|
return SelectionProvider<AvesEntry>(
|
||||||
child: Selector<Selection<AvesEntry>, bool>(
|
child: Selector<Selection<AvesEntry>, bool>(
|
||||||
|
@ -104,11 +105,12 @@ class _CollectionPageState extends State<CollectionPage> {
|
||||||
TvNavigationPopHandler.pop,
|
TvNavigationPopHandler.pop,
|
||||||
_doubleBackPopHandler.pop,
|
_doubleBackPopHandler.pop,
|
||||||
],
|
],
|
||||||
child: const GestureAreaProtectorStack(
|
child: GestureAreaProtectorStack(
|
||||||
child: SafeArea(
|
child: DirectionalSafeArea(
|
||||||
|
start: !useTvLayout,
|
||||||
top: false,
|
top: false,
|
||||||
bottom: false,
|
bottom: false,
|
||||||
child: CollectionGrid(
|
child: const CollectionGrid(
|
||||||
// key is expected by test driver
|
// key is expected by test driver
|
||||||
key: Key('collection-grid'),
|
key: Key('collection-grid'),
|
||||||
settingsRouteKey: CollectionPage.routeName,
|
settingsRouteKey: CollectionPage.routeName,
|
||||||
|
@ -121,7 +123,7 @@ class _CollectionPageState extends State<CollectionPage> {
|
||||||
);
|
);
|
||||||
|
|
||||||
Widget page;
|
Widget page;
|
||||||
if (settings.useTvLayout) {
|
if (useTvLayout) {
|
||||||
page = Scaffold(
|
page = Scaffold(
|
||||||
body: Row(
|
body: Row(
|
||||||
children: [
|
children: [
|
||||||
|
|
|
@ -2,6 +2,7 @@ import 'dart:math';
|
||||||
|
|
||||||
import 'package:aves/model/settings/settings.dart';
|
import 'package:aves/model/settings/settings.dart';
|
||||||
import 'package:aves/widgets/aves_app.dart';
|
import 'package:aves/widgets/aves_app.dart';
|
||||||
|
import 'package:aves/widgets/common/extensions/build_context.dart';
|
||||||
import 'package:aves/widgets/common/extensions/media_query.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/common/tile_extent_controller.dart';
|
import 'package:aves/widgets/common/tile_extent_controller.dart';
|
||||||
|
@ -188,3 +189,35 @@ extension ExtraMediaQueryData on MediaQueryData {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class DirectionalSafeArea extends StatelessWidget {
|
||||||
|
final bool start, top, end, bottom;
|
||||||
|
final EdgeInsets minimum;
|
||||||
|
final bool maintainBottomViewPadding;
|
||||||
|
final Widget child;
|
||||||
|
|
||||||
|
const DirectionalSafeArea({
|
||||||
|
super.key,
|
||||||
|
this.start = true,
|
||||||
|
this.top = true,
|
||||||
|
this.end = true,
|
||||||
|
this.bottom = true,
|
||||||
|
this.minimum = EdgeInsets.zero,
|
||||||
|
this.maintainBottomViewPadding = false,
|
||||||
|
required this.child,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final isRtl = context.isRtl;
|
||||||
|
return SafeArea(
|
||||||
|
left: isRtl ? end : start,
|
||||||
|
top: top,
|
||||||
|
right: isRtl ? start : end,
|
||||||
|
bottom: bottom,
|
||||||
|
minimum: minimum,
|
||||||
|
maintainBottomViewPadding: maintainBottomViewPadding,
|
||||||
|
child: child,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ import 'package:aves/model/settings/settings.dart';
|
||||||
import 'package:aves/theme/colors.dart';
|
import 'package:aves/theme/colors.dart';
|
||||||
import 'package:aves/theme/durations.dart';
|
import 'package:aves/theme/durations.dart';
|
||||||
import 'package:aves/widgets/aves_app.dart';
|
import 'package:aves/widgets/aves_app.dart';
|
||||||
|
import 'package:aves/widgets/common/basic/insets.dart';
|
||||||
import 'package:aves/widgets/common/fx/blurred.dart';
|
import 'package:aves/widgets/common/fx/blurred.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
@ -32,12 +33,14 @@ class AvesAppBar extends StatelessWidget {
|
||||||
return Selector<MediaQueryData, double>(
|
return Selector<MediaQueryData, double>(
|
||||||
selector: (context, mq) => mq.padding.top,
|
selector: (context, mq) => mq.padding.top,
|
||||||
builder: (context, mqPaddingTop, child) {
|
builder: (context, mqPaddingTop, child) {
|
||||||
|
final useTvLayout = settings.useTvLayout;
|
||||||
return SliverPersistentHeader(
|
return SliverPersistentHeader(
|
||||||
floating: !settings.useTvLayout,
|
floating: !useTvLayout,
|
||||||
pinned: false,
|
pinned: false,
|
||||||
delegate: _SliverAppBarDelegate(
|
delegate: _SliverAppBarDelegate(
|
||||||
height: mqPaddingTop + appBarHeightForContentHeight(contentHeight),
|
height: mqPaddingTop + appBarHeightForContentHeight(contentHeight),
|
||||||
child: SafeArea(
|
child: DirectionalSafeArea(
|
||||||
|
start: !useTvLayout,
|
||||||
bottom: false,
|
bottom: false,
|
||||||
child: AvesFloatingBar(
|
child: AvesFloatingBar(
|
||||||
builder: (context, backgroundColor, child) => Material(
|
builder: (context, backgroundColor, child) => Material(
|
||||||
|
|
|
@ -77,10 +77,12 @@ class FilterGridPage<T extends CollectionFilter> extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final useTvLayout = settings.useTvLayout;
|
||||||
final body = QueryProvider(
|
final body = QueryProvider(
|
||||||
initialQuery: null,
|
initialQuery: null,
|
||||||
child: GestureAreaProtectorStack(
|
child: GestureAreaProtectorStack(
|
||||||
child: SafeArea(
|
child: DirectionalSafeArea(
|
||||||
|
start: !useTvLayout,
|
||||||
top: false,
|
top: false,
|
||||||
bottom: false,
|
bottom: false,
|
||||||
child: Selector<MediaQueryData, double>(
|
child: Selector<MediaQueryData, double>(
|
||||||
|
@ -112,7 +114,7 @@ class FilterGridPage<T extends CollectionFilter> extends StatelessWidget {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (settings.useTvLayout) {
|
if (useTvLayout) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: Row(
|
body: Row(
|
||||||
children: [
|
children: [
|
||||||
|
|
|
@ -9,6 +9,7 @@ import 'package:aves/model/source/collection_lens.dart';
|
||||||
import 'package:aves/model/source/collection_source.dart';
|
import 'package:aves/model/source/collection_source.dart';
|
||||||
import 'package:aves/widgets/about/about_page.dart';
|
import 'package:aves/widgets/about/about_page.dart';
|
||||||
import 'package:aves/widgets/collection/collection_page.dart';
|
import 'package:aves/widgets/collection/collection_page.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/identity/aves_logo.dart';
|
import 'package:aves/widgets/common/identity/aves_logo.dart';
|
||||||
import 'package:aves/widgets/debug/app_debug_page.dart';
|
import 'package:aves/widgets/debug/app_debug_page.dart';
|
||||||
|
@ -32,6 +33,8 @@ class TvRail extends StatefulWidget {
|
||||||
final CollectionLens? currentCollection;
|
final CollectionLens? currentCollection;
|
||||||
final TvRailController controller;
|
final TvRailController controller;
|
||||||
|
|
||||||
|
static const double minExtendedWidth = 256;
|
||||||
|
|
||||||
const TvRail({
|
const TvRail({
|
||||||
super.key,
|
super.key,
|
||||||
required this.controller,
|
required this.controller,
|
||||||
|
@ -44,6 +47,7 @@ class TvRail extends StatefulWidget {
|
||||||
|
|
||||||
class _TvRailState extends State<TvRail> {
|
class _TvRailState extends State<TvRail> {
|
||||||
late final ScrollController _scrollController;
|
late final ScrollController _scrollController;
|
||||||
|
final ValueNotifier<bool> _extendedNotifier = ValueNotifier(true);
|
||||||
final FocusNode _focusNode = FocusNode();
|
final FocusNode _focusNode = FocusNode();
|
||||||
|
|
||||||
TvRailController get controller => widget.controller;
|
TvRailController get controller => widget.controller;
|
||||||
|
@ -64,72 +68,82 @@ class _TvRailState extends State<TvRail> {
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_scrollController.removeListener(_onScrollChanged);
|
_scrollController.removeListener(_onScrollChanged);
|
||||||
_scrollController.dispose();
|
_scrollController.dispose();
|
||||||
|
_extendedNotifier.dispose();
|
||||||
_focusNode.dispose();
|
_focusNode.dispose();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final header = Row(
|
|
||||||
children: [
|
|
||||||
const AvesLogo(size: 48),
|
|
||||||
const SizedBox(width: 16),
|
|
||||||
Text(
|
|
||||||
context.l10n.appName,
|
|
||||||
style: const TextStyle(
|
|
||||||
color: Colors.white,
|
|
||||||
fontSize: 32,
|
|
||||||
fontWeight: FontWeight.w300,
|
|
||||||
letterSpacing: 1.0,
|
|
||||||
fontFeatures: [FontFeature.enable('smcp')],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
|
|
||||||
final navEntries = _getNavEntries(context);
|
final navEntries = _getNavEntries(context);
|
||||||
|
return DirectionalSafeArea(
|
||||||
|
end: false,
|
||||||
|
child: ValueListenableBuilder<bool>(
|
||||||
|
valueListenable: _extendedNotifier,
|
||||||
|
builder: (context, extended, child) {
|
||||||
|
const logo = AvesLogo(size: 48);
|
||||||
|
final header = extended
|
||||||
|
? Row(
|
||||||
|
children: [
|
||||||
|
logo,
|
||||||
|
const SizedBox(width: 16),
|
||||||
|
Text(
|
||||||
|
context.l10n.appName,
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 32,
|
||||||
|
fontWeight: FontWeight.w300,
|
||||||
|
letterSpacing: 1.0,
|
||||||
|
fontFeatures: [FontFeature.enable('smcp')],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: logo;
|
||||||
|
|
||||||
final rail = Focus(
|
final rail = Focus(
|
||||||
focusNode: _focusNode,
|
focusNode: _focusNode,
|
||||||
skipTraversal: true,
|
skipTraversal: true,
|
||||||
child: NavigationRail(
|
child: NavigationRail(
|
||||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||||
extended: true,
|
extended: extended,
|
||||||
destinations: navEntries
|
destinations: navEntries
|
||||||
.map((v) => NavigationRailDestination(
|
.map((v) => NavigationRailDestination(
|
||||||
icon: v.icon,
|
icon: v.icon,
|
||||||
label: v.label,
|
label: v.label,
|
||||||
))
|
))
|
||||||
.toList(),
|
.toList(),
|
||||||
selectedIndex: max(0, navEntries.indexWhere(((v) => v.isSelected))),
|
selectedIndex: max(0, navEntries.indexWhere(((v) => v.isSelected))),
|
||||||
onDestinationSelected: (index) {
|
onDestinationSelected: (index) {
|
||||||
controller.focusedIndex = index;
|
controller.focusedIndex = index;
|
||||||
navEntries[index].onSelection();
|
navEntries[index].onSelection();
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
return SafeArea(
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
const SizedBox(height: 8),
|
|
||||||
header,
|
|
||||||
const SizedBox(height: 4),
|
|
||||||
Expanded(
|
|
||||||
child: LayoutBuilder(
|
|
||||||
builder: (context, constraints) {
|
|
||||||
return SingleChildScrollView(
|
|
||||||
controller: _scrollController,
|
|
||||||
child: ConstrainedBox(
|
|
||||||
constraints: BoxConstraints(minHeight: constraints.maxHeight),
|
|
||||||
child: IntrinsicHeight(child: rail),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
minExtendedWidth: TvRail.minExtendedWidth,
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
],
|
|
||||||
|
return Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
header,
|
||||||
|
const SizedBox(height: 4),
|
||||||
|
Expanded(
|
||||||
|
child: LayoutBuilder(
|
||||||
|
builder: (context, constraints) {
|
||||||
|
return SingleChildScrollView(
|
||||||
|
controller: _scrollController,
|
||||||
|
child: ConstrainedBox(
|
||||||
|
constraints: BoxConstraints(minHeight: constraints.maxHeight),
|
||||||
|
child: IntrinsicHeight(child: rail),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,29 +113,31 @@ class SettingsTileDisplayForceTvLayout extends SettingsTile {
|
||||||
Widget build(BuildContext context) => SettingsSwitchListTile(
|
Widget build(BuildContext context) => SettingsSwitchListTile(
|
||||||
selector: (context, s) => s.forceTvLayout,
|
selector: (context, s) => s.forceTvLayout,
|
||||||
onChanged: (v) async {
|
onChanged: (v) async {
|
||||||
final confirmed = await showDialog<bool>(
|
if (v) {
|
||||||
context: context,
|
final confirmed = await showDialog<bool>(
|
||||||
builder: (context) {
|
context: context,
|
||||||
final l10n = context.l10n;
|
builder: (context) {
|
||||||
return AvesDialog(
|
final l10n = context.l10n;
|
||||||
content: Text([
|
return AvesDialog(
|
||||||
l10n.settingsModificationWarningDialogMessage,
|
content: Text([
|
||||||
l10n.genericDangerWarningDialogMessage,
|
l10n.settingsModificationWarningDialogMessage,
|
||||||
].join('\n\n')),
|
l10n.genericDangerWarningDialogMessage,
|
||||||
actions: [
|
].join('\n\n')),
|
||||||
TextButton(
|
actions: [
|
||||||
onPressed: () => Navigator.pop(context),
|
TextButton(
|
||||||
child: Text(MaterialLocalizations.of(context).cancelButtonLabel),
|
onPressed: () => Navigator.pop(context),
|
||||||
),
|
child: Text(MaterialLocalizations.of(context).cancelButtonLabel),
|
||||||
TextButton(
|
),
|
||||||
onPressed: () => Navigator.pop(context, true),
|
TextButton(
|
||||||
child: Text(l10n.applyButtonLabel),
|
onPressed: () => Navigator.pop(context, true),
|
||||||
),
|
child: Text(l10n.applyButtonLabel),
|
||||||
],
|
),
|
||||||
);
|
],
|
||||||
},
|
);
|
||||||
);
|
},
|
||||||
if (confirmed == null || !confirmed) return;
|
);
|
||||||
|
if (confirmed == null || !confirmed) return;
|
||||||
|
}
|
||||||
|
|
||||||
settings.forceTvLayout = v;
|
settings.forceTvLayout = v;
|
||||||
},
|
},
|
||||||
|
|
|
@ -30,8 +30,10 @@ class _LocaleSelectionPageState extends State<LocaleSelectionPage> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final useTvLayout = settings.useTvLayout;
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
|
automaticallyImplyLeading: !useTvLayout,
|
||||||
title: Text(context.l10n.settingsLanguagePageTitle),
|
title: Text(context.l10n.settingsLanguagePageTitle),
|
||||||
),
|
),
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
|
@ -41,10 +43,11 @@ class _LocaleSelectionPageState extends State<LocaleSelectionPage> {
|
||||||
final upQuery = query.toUpperCase().trim();
|
final upQuery = query.toUpperCase().trim();
|
||||||
return ListView(
|
return ListView(
|
||||||
children: [
|
children: [
|
||||||
QueryBar(
|
if (!useTvLayout)
|
||||||
queryNotifier: _queryNotifier,
|
QueryBar(
|
||||||
leadingPadding: const EdgeInsetsDirectional.only(start: 24, end: 8),
|
queryNotifier: _queryNotifier,
|
||||||
),
|
leadingPadding: const EdgeInsetsDirectional.only(start: 24, end: 8),
|
||||||
|
),
|
||||||
..._getLocaleOptions(context).entries.where((kv) {
|
..._getLocaleOptions(context).entries.where((kv) {
|
||||||
if (upQuery.isEmpty) return true;
|
if (upQuery.isEmpty) return true;
|
||||||
final title = kv.value;
|
final title = kv.value;
|
||||||
|
|
|
@ -93,6 +93,7 @@ class _NavigationDrawerEditorPageState extends State<NavigationDrawerEditorPage>
|
||||||
length: tabs.length,
|
length: tabs.length,
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
|
automaticallyImplyLeading: !settings.useTvLayout,
|
||||||
title: Text(l10n.settingsNavigationDrawerEditorPageTitle),
|
title: Text(l10n.settingsNavigationDrawerEditorPageTitle),
|
||||||
bottom: TabBar(
|
bottom: TabBar(
|
||||||
tabs: tabs.map((t) => t.item1).toList(),
|
tabs: tabs.map((t) => t.item1).toList(),
|
||||||
|
|
|
@ -150,11 +150,13 @@ class _FilePickerPageState extends State<FilePickerPage> {
|
||||||
return Drawer(
|
return Drawer(
|
||||||
child: ListView(
|
child: ListView(
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
SafeArea(
|
||||||
padding: const EdgeInsets.all(16),
|
child: Padding(
|
||||||
child: Text(
|
padding: const EdgeInsets.all(16),
|
||||||
context.l10n.filePickerOpenFrom,
|
child: Text(
|
||||||
style: Theme.of(context).textTheme.headlineSmall,
|
context.l10n.filePickerOpenFrom,
|
||||||
|
style: Theme.of(context).textTheme.headlineSmall,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
...volumes.map((v) {
|
...volumes.map((v) {
|
||||||
|
|
|
@ -36,6 +36,7 @@ class HiddenItemsPage extends StatelessWidget {
|
||||||
length: tabs.length,
|
length: tabs.length,
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
|
automaticallyImplyLeading: !settings.useTvLayout,
|
||||||
title: Text(l10n.settingsHiddenItemsPageTitle),
|
title: Text(l10n.settingsHiddenItemsPageTitle),
|
||||||
bottom: TabBar(
|
bottom: TabBar(
|
||||||
tabs: tabs.map((t) => t.item1).toList(),
|
tabs: tabs.map((t) => t.item1).toList(),
|
||||||
|
|
|
@ -106,6 +106,7 @@ class _SettingsPageState extends State<SettingsPage> with FeedbackMixin {
|
||||||
.toList(),
|
.toList(),
|
||||||
selectedIndex: selectedIndex,
|
selectedIndex: selectedIndex,
|
||||||
onDestinationSelected: (index) => _tvSelectedIndexNotifier.value = index,
|
onDestinationSelected: (index) => _tvSelectedIndexNotifier.value = index,
|
||||||
|
minExtendedWidth: TvRail.minExtendedWidth,
|
||||||
);
|
);
|
||||||
return LayoutBuilder(
|
return LayoutBuilder(
|
||||||
builder: (context, constraints) {
|
builder: (context, constraints) {
|
||||||
|
@ -118,8 +119,13 @@ class _SettingsPageState extends State<SettingsPage> with FeedbackMixin {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: _SettingsSectionBody(
|
child: MediaQuery.removePadding(
|
||||||
loader: Future.value(sections[selectedIndex].tiles(context)),
|
context: context,
|
||||||
|
removeLeft: !context.isRtl,
|
||||||
|
removeRight: context.isRtl,
|
||||||
|
child: _SettingsSectionBody(
|
||||||
|
loader: Future.value(sections[selectedIndex].tiles(context)),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
|
@ -19,6 +19,7 @@ class ThumbnailOverlayPage extends StatelessWidget {
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
|
automaticallyImplyLeading: !settings.useTvLayout,
|
||||||
title: Text(context.l10n.settingsThumbnailOverlayPageTitle),
|
title: Text(context.l10n.settingsThumbnailOverlayPageTitle),
|
||||||
),
|
),
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
|
|
|
@ -18,6 +18,7 @@ class SubtitleThemePage extends StatelessWidget {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
|
automaticallyImplyLeading: !settings.useTvLayout,
|
||||||
title: Text(context.l10n.settingsSubtitleThemePageTitle),
|
title: Text(context.l10n.settingsSubtitleThemePageTitle),
|
||||||
),
|
),
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
|
|
|
@ -12,14 +12,16 @@ class ViewerOverlayPage extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final useTvLayout = settings.useTvLayout;
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
|
automaticallyImplyLeading: !useTvLayout,
|
||||||
title: Text(context.l10n.settingsViewerOverlayPageTitle),
|
title: Text(context.l10n.settingsViewerOverlayPageTitle),
|
||||||
),
|
),
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
child: ListView(
|
child: ListView(
|
||||||
children: [
|
children: [
|
||||||
if (!settings.useTvLayout)
|
if (!useTvLayout)
|
||||||
SettingsSwitchListTile(
|
SettingsSwitchListTile(
|
||||||
selector: (context, s) => s.showOverlayOnOpening,
|
selector: (context, s) => s.showOverlayOnOpening,
|
||||||
onChanged: (v) => settings.showOverlayOnOpening = v,
|
onChanged: (v) => settings.showOverlayOnOpening = v,
|
||||||
|
@ -67,13 +69,13 @@ class ViewerOverlayPage extends StatelessWidget {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
if (!settings.useTvLayout)
|
if (!useTvLayout)
|
||||||
SettingsSwitchListTile(
|
SettingsSwitchListTile(
|
||||||
selector: (context, s) => s.showOverlayMinimap,
|
selector: (context, s) => s.showOverlayMinimap,
|
||||||
onChanged: (v) => settings.showOverlayMinimap = v,
|
onChanged: (v) => settings.showOverlayMinimap = v,
|
||||||
title: context.l10n.settingsViewerShowMinimap,
|
title: context.l10n.settingsViewerShowMinimap,
|
||||||
),
|
),
|
||||||
if (!settings.useTvLayout)
|
if (!useTvLayout)
|
||||||
SettingsSwitchListTile(
|
SettingsSwitchListTile(
|
||||||
selector: (context, s) => s.showOverlayThumbnailPreview,
|
selector: (context, s) => s.showOverlayThumbnailPreview,
|
||||||
onChanged: (v) => settings.showOverlayThumbnailPreview = v,
|
onChanged: (v) => settings.showOverlayThumbnailPreview = v,
|
||||||
|
|
|
@ -16,6 +16,7 @@ class ViewerSlideshowPage extends StatelessWidget {
|
||||||
final l10n = context.l10n;
|
final l10n = context.l10n;
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
|
automaticallyImplyLeading: !settings.useTvLayout,
|
||||||
title: Text(l10n.settingsViewerSlideshowPageTitle),
|
title: Text(l10n.settingsViewerSlideshowPageTitle),
|
||||||
),
|
),
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
|
|
Loading…
Reference in a new issue