This repository was archived by the owner on Apr 3, 2025. It is now read-only.
File tree 10 files changed +24
-21
lines changed
external_modules/routes/external_modules
settings/routes/configuration_search/pages
10 files changed +24
-21
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ class LunaRouter {
24
24
/// Calls `defineAllRoutes()` on all module routers that implement [LunaModuleRouter] .
25
25
void initialize () {
26
26
router.notFoundHandler = Handler (
27
- handlerFunc: (context, params) => const InvalidRoutePage (),
27
+ handlerFunc: (context, params) => InvalidRoutePage (),
28
28
);
29
29
router.define (
30
30
'/' ,
Original file line number Diff line number Diff line change @@ -27,13 +27,13 @@ class _State extends State<_Widget> with LunaScrollControllerMixin {
27
27
return LunaScaffold (
28
28
scaffoldKey: _scaffoldKey,
29
29
module: LunaModule .EXTERNAL_MODULES ,
30
- appBar: _appBar () as PreferredSizeWidget ? ,
30
+ appBar: _appBar (),
31
31
drawer: _drawer (),
32
32
body: _body (),
33
33
);
34
34
}
35
35
36
- Widget _appBar () {
36
+ PreferredSizeWidget _appBar () {
37
37
return LunaAppBar (
38
38
useDrawer: true ,
39
39
title: LunaModule .EXTERNAL_MODULES .title,
Original file line number Diff line number Diff line change @@ -101,7 +101,7 @@ class _State extends State<_Widget> with LunaLoadCallbackMixin {
101
101
@override
102
102
Widget build (BuildContext context) {
103
103
if (widget.movieId <= 0 )
104
- return const InvalidRoutePage (
104
+ return InvalidRoutePage (
105
105
title: 'Movie Details' ,
106
106
message: 'Movie Not Found' ,
107
107
);
Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ class _State extends State<_Widget> with LunaScrollControllerMixin {
65
65
@override
66
66
Widget build (BuildContext context) {
67
67
if (widget.movieId <= 0 ) {
68
- return const InvalidRoutePage (
68
+ return InvalidRoutePage (
69
69
title: 'Releases' ,
70
70
message: 'Movie Not Found' ,
71
71
);
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ class _State extends State<_Widget> with LunaScrollControllerMixin {
50
50
Widget build (BuildContext context) {
51
51
_arguments = ModalRoute .of (context)! .settings.arguments as _Arguments ? ;
52
52
if (_arguments == null ) {
53
- return const InvalidRoutePage (
53
+ return InvalidRoutePage (
54
54
title: 'Custom Headers' ,
55
55
message: 'Indexer Not Found' ,
56
56
);
Original file line number Diff line number Diff line change @@ -54,10 +54,10 @@ class _State extends State<_Widget> with LunaScrollControllerMixin {
54
54
@override
55
55
Widget build (BuildContext context) {
56
56
if (widget.indexerId < 0 )
57
- return const InvalidRoutePage (
57
+ return InvalidRoutePage (
58
58
title: 'Edit Indexer' , message: 'Indexer Not Found' );
59
59
if (! LunaBox .indexers.contains (widget.indexerId))
60
- return const InvalidRoutePage (
60
+ return InvalidRoutePage (
61
61
title: 'Edit Indexer' , message: 'Indexer Not Found' );
62
62
return LunaScaffold (
63
63
scaffoldKey: _scaffoldKey,
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ class _State extends State<_Widget> with LunaScrollControllerMixin {
54
54
@override
55
55
Widget build (BuildContext context) {
56
56
if (widget.indexerId < 0 || ! LunaBox .indexers.contains (widget.indexerId)) {
57
- return const InvalidRoutePage (
57
+ return InvalidRoutePage (
58
58
title: 'Custom Headers' ,
59
59
message: 'Indexer Not Found' ,
60
60
);
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ class _State extends State<_Widget> {
35
35
scaffoldKey: _scaffoldKey,
36
36
module: LunaModule .TAUTULLI ,
37
37
drawer: _drawer (),
38
- appBar: _appBar () as PreferredSizeWidget ? ,
38
+ appBar: _appBar (),
39
39
bottomNavigationBar: _bottomNavigationBar (),
40
40
body: _body (),
41
41
);
@@ -49,7 +49,7 @@ class _State extends State<_Widget> {
49
49
return null ;
50
50
}
51
51
52
- Widget _appBar () {
52
+ PreferredSizeWidget _appBar () {
53
53
List <String > profiles = LunaBox .profiles.keys.fold ([], (value, element) {
54
54
if (LunaBox .profiles.read (element)? .tautulliEnabled ?? false )
55
55
value.add (element);
Original file line number Diff line number Diff line change @@ -2,10 +2,11 @@ import 'package:flutter/material.dart';
2
2
import 'package:lunasea/core.dart' ;
3
3
4
4
class InvalidRoutePage extends StatelessWidget {
5
+ final _scaffoldKey = GlobalKey <ScaffoldState >();
5
6
final String ? title;
6
7
final String ? message;
7
8
8
- const InvalidRoutePage ({
9
+ InvalidRoutePage ({
9
10
Key ? key,
10
11
this .title,
11
12
this .message,
@@ -14,6 +15,7 @@ class InvalidRoutePage extends StatelessWidget {
14
15
@override
15
16
Widget build (BuildContext context) {
16
17
return LunaScaffold (
18
+ scaffoldKey: _scaffoldKey,
17
19
appBar: LunaAppBar (
18
20
title: title ?? 'LunaSea' ,
19
21
scrollControllers: const [],
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import 'package:lunasea/modules.dart';
4
4
import 'package:lunasea/system/platform.dart' ;
5
5
6
6
class LunaScaffold extends StatelessWidget {
7
- final GlobalKey <ScaffoldState >? scaffoldKey;
7
+ final GlobalKey <ScaffoldState > scaffoldKey;
8
8
final LunaModule ? module;
9
9
final PreferredSizeWidget ? appBar;
10
10
final Widget ? body;
@@ -19,7 +19,7 @@ class LunaScaffold extends StatelessWidget {
19
19
20
20
// ignore: use_key_in_widget_constructors
21
21
const LunaScaffold ({
22
- this .scaffoldKey,
22
+ required this .scaffoldKey,
23
23
this .module,
24
24
this .appBar,
25
25
this .body,
@@ -33,15 +33,16 @@ class LunaScaffold extends StatelessWidget {
33
33
34
34
@override
35
35
Widget build (BuildContext context) {
36
- final state = scaffoldKey? .currentState;
37
- final hasDrawer = state? .hasDrawer ?? false ;
38
-
39
- if (hasDrawer && LunaPlatform .isAndroid) {
36
+ if (LunaPlatform .isAndroid) {
40
37
return WillPopScope (
41
38
onWillPop: () async {
42
- if (state! .isDrawerOpen) return true ;
43
- state.openDrawer ();
44
- return false ;
39
+ final state = scaffoldKey.currentState;
40
+ if (state? .hasDrawer ?? false ) {
41
+ if (state! .isDrawerOpen) return true ;
42
+ state.openDrawer ();
43
+ return false ;
44
+ }
45
+ return true ;
45
46
},
46
47
child: scaffold,
47
48
);
You can’t perform that action at this time.
0 commit comments