mirror of
https://github.com/jagandeepbrar/lunasea.git
synced 2026-08-31 12:42:34 +00:00
[TestFlight] v4.0.0+400005 (#248)
NEW - [Settings] Entirely revamped the settings page to allow for easier navigation for new users - [Search] Ability to set custom headers for individual indexers TWEAKS - [Settings] Split apart customization and configuration of modules, and add AppBar actions to allow quickly switching between customization and configuration FIXES - None
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
export 'core/api.dart';
|
||||
export 'core/constants.dart';
|
||||
export 'core/database.dart';
|
||||
export 'core/dialogs.dart';
|
||||
export 'core/state_global.dart';
|
||||
export 'core/state.dart';
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
class SettingsAPI {
|
||||
SettingsAPI._();
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/settings.dart';
|
||||
import 'package:lunasea/modules/settings/modules/donations_thankyou/route.dart';
|
||||
|
||||
class SettingsConstants {
|
||||
SettingsConstants._();
|
||||
@@ -14,4 +16,64 @@ class SettingsConstants {
|
||||
route: '/settings',
|
||||
color: Color(Constants.ACCENT_COLOR),
|
||||
);
|
||||
|
||||
// ignore: non_constant_identifier_names
|
||||
static final Map<String, WidgetBuilder> MODULE_ROUTES = <String, WidgetBuilder>{
|
||||
SettingsRoute.ROUTE_NAME: (context) => SettingsRoute(),
|
||||
// Customization
|
||||
SettingsCustomizationRoute.ROUTE_NAME: (context) => SettingsCustomizationRoute(),
|
||||
SettingsCustomizationAppearanceRoute.ROUTE_NAME: (context) => SettingsCustomizationAppearanceRoute(),
|
||||
SettingsCustomizationCalendarRoute.ROUTE_NAME: (context) => SettingsCustomizationCalendarRoute(),
|
||||
SettingsCustomizationDrawerRoute.ROUTE_NAME: (context) => SettingsCustomizationDrawerRoute(),
|
||||
SettingsCustomizationHomeRoute.ROUTE_NAME: (context) => SettingsCustomizationHomeRoute(),
|
||||
SettingsCustomizationLidarrRoute.ROUTE_NAME: (context) => SettingsCustomizationLidarrRoute(),
|
||||
SettingsCustomizationNZBGetRoute.ROUTE_NAME: (context) => SettingsCustomizationNZBGetRoute(),
|
||||
SettingsCustomizationQuickActionsRoute.ROUTE_NAME: (context) => SettingsCustomizationQuickActionsRoute(),
|
||||
SettingsCustomizationRadarrRoute.ROUTE_NAME: (context) => SettingsCustomizationRadarrRoute(),
|
||||
SettingsCustomizationSABnzbdRoute.ROUTE_NAME: (context) => SettingsCustomizationSABnzbdRoute(),
|
||||
SettingsCustomizationSearchRoute.ROUTE_NAME: (context) => SettingsCustomizationSearchRoute(),
|
||||
SettingsCustomizationSonarrRoute.ROUTE_NAME: (context) => SettingsCustomizationSonarrRoute(),
|
||||
SettingsCustomizationTautulliRoute.ROUTE_NAME: (context) => SettingsCustomizationTautulliRoute(),
|
||||
// Modules
|
||||
SettingsModulesRoute.ROUTE_NAME: (context) => SettingsModulesRoute(),
|
||||
// modules/Search
|
||||
SettingsModulesSearchRoute.ROUTE_NAME: (context) => SettingsModulesSearchRoute(),
|
||||
SettingsModulesSearchAddRoute.ROUTE_NAME: (context) => SettingsModulesSearchAddRoute(),
|
||||
SettingsModulesSearchEditRoute.ROUTE_NAME: (context) => SettingsModulesSearchEditRoute(),
|
||||
SettingsModulesSearchHeadersRoute.ROUTE_NAME: (context) => SettingsModulesSearchHeadersRoute(),
|
||||
// modules/Wake on LAN
|
||||
SettingsModulesWakeOnLANRoute.ROUTE_NAME: (context) => SettingsModulesWakeOnLANRoute(),
|
||||
// modules/Lidarr
|
||||
SettingsModulesLidarrRoute.ROUTE_NAME: (context) => SettingsModulesLidarrRoute(),
|
||||
SettingsModulesLidarrHeadersRoute.ROUTE_NAME: (context) => SettingsModulesLidarrHeadersRoute(),
|
||||
// modules/Radarr
|
||||
SettingsModulesRadarrRoute.ROUTE_NAME: (context) => SettingsModulesRadarrRoute(),
|
||||
SettingsModulesRadarrHeadersRoute.ROUTE_NAME: (context) => SettingsModulesRadarrHeadersRoute(),
|
||||
// modules/Sonarr
|
||||
SettingsModulesSonarrRoute.ROUTE_NAME: (context) => SettingsModulesSonarrRoute(),
|
||||
SettingsModulesSonarrHeadersRoute.ROUTE_NAME: (context) => SettingsModulesSonarrHeadersRoute(),
|
||||
// modules/NZBGet
|
||||
SettingsModulesNZBGetRoute.ROUTE_NAME: (context) => SettingsModulesNZBGetRoute(),
|
||||
SettingsModulesNZBGetHeadersRoute.ROUTE_NAME: (context) => SettingsModulesNZBGetHeadersRoute(),
|
||||
// modules/SABnzbd
|
||||
SettingsModulesSABnzbdRoute.ROUTE_NAME: (context) => SettingsModulesSABnzbdRoute(),
|
||||
SettingsModulesSABnzbdHeadersRoute.ROUTE_NAME: (context) => SettingsModulesSABnzbdHeadersRoute(),
|
||||
// modules/Tautulli
|
||||
SettingsModulesTautulliRoute.ROUTE_NAME: (context) => SettingsModulesTautulliRoute(),
|
||||
SettingsModulesTautulliHeadersRoute.ROUTE_NAME: (context) => SettingsModulesTautulliHeadersRoute(),
|
||||
// Profiles
|
||||
SettingsProfilesRoute.ROUTE_NAME: (context) => SettingsProfilesRoute(),
|
||||
// Backup & Restore
|
||||
SettingsBackupRestoreRoute.ROUTE_NAME: (context) => SettingsBackupRestoreRoute(),
|
||||
// Donations
|
||||
SettingsDonationsRoute.ROUTE_NAME: (context) => SettingsDonationsRoute(),
|
||||
SettingsDonationsThankYouRoute.ROUTE_NAME: (context) => SettingsDonationsThankYouRoute(),
|
||||
// Logs
|
||||
SettingsLogsRoute.ROUTE_NAME: (context) => SettingsLogsRoute(),
|
||||
SettingsLogsDetailsRoute.ROUTE_NAME: (context) => SettingsLogsDetailsRoute(),
|
||||
// Resources
|
||||
SettingsResourcesRoute.ROUTE_NAME: (context) => SettingsResourcesRoute(),
|
||||
// System
|
||||
SettingsSystemRoute.ROUTE_NAME: (context) => SettingsSystemRoute(),
|
||||
};
|
||||
}
|
||||
|
||||
25
lib/modules/settings/core/state.dart
Normal file
25
lib/modules/settings/core/state.dart
Normal file
@@ -0,0 +1,25 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
class SettingsState extends ChangeNotifier {
|
||||
SettingsState() {
|
||||
reset(initialize: true);
|
||||
}
|
||||
|
||||
/// Reset the state of Home back to the default
|
||||
///
|
||||
/// If `initialize` is true, resets everything.
|
||||
/// If false, the navigation index, etc. are not reset.
|
||||
void reset({ bool initialize = false }) {
|
||||
if(initialize) {
|
||||
_navigationIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int _navigationIndex;
|
||||
int get navigationIndex => _navigationIndex;
|
||||
set navigationIndex(int navigationIndex) {
|
||||
assert(navigationIndex != null);
|
||||
_navigationIndex = navigationIndex;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
class SettingsModel extends ChangeNotifier {
|
||||
int _navigationIndex = 0;
|
||||
int get navigationIndex => _navigationIndex;
|
||||
set navigationIndex(int navigationIndex) {
|
||||
assert(navigationIndex != null);
|
||||
_navigationIndex = navigationIndex;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
40
lib/modules/settings/modules.dart
Normal file
40
lib/modules/settings/modules.dart
Normal file
@@ -0,0 +1,40 @@
|
||||
export 'modules/backup_restore.dart';
|
||||
export 'modules/customization.dart';
|
||||
export 'modules/customization_appearance.dart';
|
||||
export 'modules/customization_calendar.dart';
|
||||
export 'modules/customization_drawer.dart';
|
||||
export 'modules/customization_home.dart';
|
||||
export 'modules/customization_lidarr.dart';
|
||||
export 'modules/customization_nzbget.dart';
|
||||
export 'modules/customization_quickactions.dart';
|
||||
export 'modules/customization_radarr.dart';
|
||||
export 'modules/customization_sabnzbd.dart';
|
||||
export 'modules/customization_search.dart';
|
||||
export 'modules/customization_sonarr.dart';
|
||||
export 'modules/customization_tautulli.dart';
|
||||
export 'modules/donations.dart';
|
||||
export 'modules/donations_thankyou.dart';
|
||||
export 'modules/logs.dart';
|
||||
export 'modules/logs_details.dart';
|
||||
export 'modules/modules.dart';
|
||||
export 'modules/modules_lidarr.dart';
|
||||
export 'modules/modules_lidarr_headers.dart';
|
||||
export 'modules/modules_nzbget.dart';
|
||||
export 'modules/modules_nzbget_headers.dart';
|
||||
export 'modules/modules_radarr.dart';
|
||||
export 'modules/modules_radarr_headers.dart';
|
||||
export 'modules/modules_sabnzbd.dart';
|
||||
export 'modules/modules_sabnzbd_headers.dart';
|
||||
export 'modules/modules_search.dart';
|
||||
export 'modules/modules_search_add.dart';
|
||||
export 'modules/modules_search_edit.dart';
|
||||
export 'modules/modules_search_headers.dart';
|
||||
export 'modules/modules_sonarr.dart';
|
||||
export 'modules/modules_sonarr_headers.dart';
|
||||
export 'modules/modules_tautulli.dart';
|
||||
export 'modules/modules_tautulli_headers.dart';
|
||||
export 'modules/modules_wakeonlan.dart';
|
||||
export 'modules/profiles.dart';
|
||||
export 'modules/resources.dart';
|
||||
export 'modules/settings.dart';
|
||||
export 'modules/system.dart';
|
||||
2
lib/modules/settings/modules/backup_restore.dart
Normal file
2
lib/modules/settings/modules/backup_restore.dart
Normal file
@@ -0,0 +1,2 @@
|
||||
export 'backup_restore/route.dart';
|
||||
export 'backup_restore/widgets.dart';
|
||||
30
lib/modules/settings/modules/backup_restore/route.dart
Normal file
30
lib/modules/settings/modules/backup_restore/route.dart
Normal file
@@ -0,0 +1,30 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/settings.dart';
|
||||
|
||||
class SettingsBackupRestoreRoute extends StatefulWidget {
|
||||
static const ROUTE_NAME = '/settings/backup_restore';
|
||||
|
||||
@override
|
||||
State<SettingsBackupRestoreRoute> createState() => _State();
|
||||
}
|
||||
|
||||
class _State extends State<SettingsBackupRestoreRoute> {
|
||||
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Scaffold(
|
||||
key: _scaffoldKey,
|
||||
appBar: _appBar,
|
||||
body: _body,
|
||||
);
|
||||
|
||||
Widget get _appBar => LSAppBar(title: 'Backup & Restore');
|
||||
|
||||
Widget get _body => LSListView(
|
||||
children: [
|
||||
SettingsBackupRestoreBackupTile(),
|
||||
SettingsBackupRestoreRestoreTile(),
|
||||
],
|
||||
);
|
||||
}
|
||||
2
lib/modules/settings/modules/backup_restore/widgets.dart
Normal file
2
lib/modules/settings/modules/backup_restore/widgets.dart
Normal file
@@ -0,0 +1,2 @@
|
||||
export 'widgets/backup_tile.dart';
|
||||
export 'widgets/restore_tile.dart';
|
||||
@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/settings.dart';
|
||||
|
||||
class SettingsGeneralConfigurationBackupTile extends StatelessWidget {
|
||||
class SettingsBackupRestoreBackupTile extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) => LSCardTile(
|
||||
title: LSTitle(text: 'Backup'),
|
||||
@@ -4,7 +4,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/settings.dart';
|
||||
|
||||
class SettingsGeneralConfigurationRestoreTile extends StatelessWidget {
|
||||
class SettingsBackupRestoreRestoreTile extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) => LSCardTile(
|
||||
title: LSTitle(text: 'Restore'),
|
||||
2
lib/modules/settings/modules/customization.dart
Normal file
2
lib/modules/settings/modules/customization.dart
Normal file
@@ -0,0 +1,2 @@
|
||||
export 'customization/route.dart';
|
||||
export 'customization/widgets.dart';
|
||||
125
lib/modules/settings/modules/customization/route.dart
Normal file
125
lib/modules/settings/modules/customization/route.dart
Normal file
@@ -0,0 +1,125 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/settings.dart';
|
||||
|
||||
class SettingsCustomizationRoute extends StatefulWidget {
|
||||
static const ROUTE_NAME = '/settings/customization';
|
||||
|
||||
SettingsCustomizationRoute({
|
||||
Key key,
|
||||
}): super(key: key);
|
||||
|
||||
@override
|
||||
State<SettingsCustomizationRoute> createState() => _State();
|
||||
}
|
||||
|
||||
class _State extends State<SettingsCustomizationRoute> with AutomaticKeepAliveClientMixin {
|
||||
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
|
||||
@override
|
||||
bool get wantKeepAlive => true;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
return Scaffold(
|
||||
key: _scaffoldKey,
|
||||
appBar: _appBar,
|
||||
body: _body,
|
||||
);
|
||||
}
|
||||
|
||||
Widget get _appBar => LSAppBar(title: 'Customization');
|
||||
|
||||
Widget get _body => LSListView(
|
||||
children: [
|
||||
..._general,
|
||||
LSDivider(),
|
||||
..._modules,
|
||||
],
|
||||
);
|
||||
|
||||
List<Widget> get _general => [
|
||||
LSCardTile(
|
||||
title: LSTitle(text: 'Appearance'),
|
||||
subtitle: LSSubtitle(text: 'Appearance Customizations'),
|
||||
trailing: LSIconButton(icon: Icons.brush),
|
||||
onTap: () async => Navigator.of(context).pushNamed(SettingsCustomizationAppearanceRoute.ROUTE_NAME),
|
||||
),
|
||||
LSCardTile(
|
||||
title: LSTitle(text: 'Drawer'),
|
||||
subtitle: LSSubtitle(text: 'Drawer Customizations'),
|
||||
trailing: LSIconButton(icon: Icons.dehaze),
|
||||
onTap: () async => Navigator.of(context).pushNamed(SettingsCustomizationDrawerRoute.ROUTE_NAME),
|
||||
),
|
||||
if(Platform.isIOS) SettingsCustomizationBrowserTile(),
|
||||
LSCardTile(
|
||||
title: LSTitle(text: 'Quick Actions'),
|
||||
subtitle: LSSubtitle(text: 'Quick Actions on the Home Screen'),
|
||||
trailing: LSIconButton(icon: Icons.rounded_corner),
|
||||
onTap: () async => Navigator.of(context).pushNamed(SettingsCustomizationQuickActionsRoute.ROUTE_NAME),
|
||||
),
|
||||
];
|
||||
|
||||
List<Widget> get _modules => [
|
||||
LSCardTile(
|
||||
title: LSTitle(text: 'Calendar'),
|
||||
subtitle: LSSubtitle(text: 'Calendar Customizations'),
|
||||
trailing: LSIconButton(icon: CustomIcons.calendar),
|
||||
onTap: () async => Navigator.of(context).pushNamed(SettingsCustomizationCalendarRoute.ROUTE_NAME),
|
||||
),
|
||||
LSCardTile(
|
||||
title: LSTitle(text: 'Home'),
|
||||
subtitle: LSSubtitle(text: 'Home Customizations'),
|
||||
trailing: LSIconButton(icon: CustomIcons.home),
|
||||
onTap: () async => Navigator.of(context).pushNamed(SettingsCustomizationHomeRoute.ROUTE_NAME),
|
||||
),
|
||||
LSCardTile(
|
||||
title: LSTitle(text: 'Search'),
|
||||
subtitle: LSSubtitle(text: 'Search Customizations'),
|
||||
trailing: LSIconButton(icon: Icons.search),
|
||||
onTap: () async => Navigator.of(context).pushNamed(SettingsCustomizationSearchRoute.ROUTE_NAME),
|
||||
),
|
||||
LSDivider(),
|
||||
LSCardTile(
|
||||
title: LSTitle(text: 'Lidarr'),
|
||||
subtitle: LSSubtitle(text: 'Lidarr Customizations'),
|
||||
trailing: LSIconButton(icon: CustomIcons.music),
|
||||
onTap: () async => Navigator.of(context).pushNamed(SettingsCustomizationLidarrRoute.ROUTE_NAME),
|
||||
),
|
||||
LSCardTile(
|
||||
title: LSTitle(text: 'Radarr'),
|
||||
subtitle: LSSubtitle(text: 'Radarr Customizations'),
|
||||
trailing: LSIconButton(icon: CustomIcons.movies),
|
||||
onTap: () async => Navigator.of(context).pushNamed(SettingsCustomizationRadarrRoute.ROUTE_NAME),
|
||||
),
|
||||
LSCardTile(
|
||||
title: LSTitle(text: 'Sonarr'),
|
||||
subtitle: LSSubtitle(text: 'Sonarr Customizations'),
|
||||
trailing: LSIconButton(icon: CustomIcons.television),
|
||||
onTap: () async => Navigator.of(context).pushNamed(SettingsCustomizationSonarrRoute.ROUTE_NAME),
|
||||
),
|
||||
LSDivider(),
|
||||
LSCardTile(
|
||||
title: LSTitle(text: 'NZBGet'),
|
||||
subtitle: LSSubtitle(text: 'NZBGet Customizations'),
|
||||
trailing: LSIconButton(icon: CustomIcons.nzbget),
|
||||
onTap: () async => Navigator.of(context).pushNamed(SettingsCustomizationNZBGetRoute.ROUTE_NAME),
|
||||
),
|
||||
LSCardTile(
|
||||
title: LSTitle(text: 'SABnzbd'),
|
||||
subtitle: LSSubtitle(text: 'SABnzbd Customizations'),
|
||||
trailing: LSIconButton(icon: CustomIcons.sabnzbd),
|
||||
onTap: () async => Navigator.of(context).pushNamed(SettingsCustomizationSABnzbdRoute.ROUTE_NAME),
|
||||
),
|
||||
LSDivider(),
|
||||
LSCardTile(
|
||||
title: LSTitle(text: 'Tautulli'),
|
||||
subtitle: LSSubtitle(text: 'Tautulli Customizations'),
|
||||
trailing: LSIconButton(icon: CustomIcons.tautulli),
|
||||
onTap: () async => Navigator.of(context).pushNamed(SettingsCustomizationTautulliRoute.ROUTE_NAME),
|
||||
),
|
||||
];
|
||||
}
|
||||
1
lib/modules/settings/modules/customization/widgets.dart
Normal file
1
lib/modules/settings/modules/customization/widgets.dart
Normal file
@@ -0,0 +1 @@
|
||||
export 'widgets/browser_tile.dart';
|
||||
@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/settings.dart';
|
||||
|
||||
class SettingsModulesLunaSeaBrowserTile extends StatelessWidget {
|
||||
class SettingsCustomizationBrowserTile extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) => ValueListenableBuilder(
|
||||
valueListenable: Database.lunaSeaBox.listenable(keys: [LunaSeaDatabaseValue.SELECTED_BROWSER.key]),
|
||||
@@ -20,4 +20,4 @@ class SettingsModulesLunaSeaBrowserTile extends StatelessWidget {
|
||||
List _values = await SettingsDialogs.changeBrowser(context);
|
||||
if(_values[0]) LunaSeaDatabaseValue.SELECTED_BROWSER.put(_values[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
export 'customization_appearance/route.dart';
|
||||
export 'customization_appearance/widgets.dart';
|
||||
@@ -0,0 +1,30 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/settings.dart';
|
||||
|
||||
class SettingsCustomizationAppearanceRoute extends StatefulWidget {
|
||||
static const ROUTE_NAME = '/settings/customization/appearance';
|
||||
|
||||
@override
|
||||
State<SettingsCustomizationAppearanceRoute> createState() => _State();
|
||||
}
|
||||
|
||||
class _State extends State<SettingsCustomizationAppearanceRoute> {
|
||||
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
@override
|
||||
Widget build(BuildContext context) => Scaffold(
|
||||
key: _scaffoldKey,
|
||||
appBar: _appBar,
|
||||
body: _body,
|
||||
);
|
||||
|
||||
Widget get _appBar => LSAppBar(title: 'Appearance');
|
||||
|
||||
Widget get _body => LSListView(
|
||||
children: [
|
||||
SettingsCustomizationAppearanceAMOLEDTile(),
|
||||
SettingsCustomizationAppearanceAMOLEDBorderTile(),
|
||||
SettingsCustomizationAppearance24HourTimeTile(),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export 'widgets/amoled_border_tile.dart';
|
||||
export 'widgets/amoled_tile.dart';
|
||||
export 'widgets/use_24h_time.dart';
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
|
||||
class SettingsModulesLunaSeaAMOLEDBorderTile extends StatelessWidget {
|
||||
class SettingsCustomizationAppearanceAMOLEDBorderTile extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) => ValueListenableBuilder(
|
||||
valueListenable: Database.lunaSeaBox.listenable(keys: [LunaSeaDatabaseValue.THEME_AMOLED_BORDER.key]),
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
|
||||
class SettingsModulesLunaSeaAMOLEDTile extends StatelessWidget {
|
||||
class SettingsCustomizationAppearanceAMOLEDTile extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) => ValueListenableBuilder(
|
||||
valueListenable: Database.lunaSeaBox.listenable(keys: [LunaSeaDatabaseValue.THEME_AMOLED.key]),
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
|
||||
class SettingsModulesLunaSeaUse24HourTimeTile extends StatelessWidget {
|
||||
class SettingsCustomizationAppearance24HourTimeTile extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) => ValueListenableBuilder(
|
||||
valueListenable: Database.lunaSeaBox.listenable(keys: [LunaSeaDatabaseValue.USE_24_HOUR_TIME.key]),
|
||||
2
lib/modules/settings/modules/customization_calendar.dart
Normal file
2
lib/modules/settings/modules/customization_calendar.dart
Normal file
@@ -0,0 +1,2 @@
|
||||
export 'customization_calendar/route.dart';
|
||||
export 'customization_calendar/widgets.dart';
|
||||
@@ -0,0 +1,34 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/settings.dart';
|
||||
|
||||
class SettingsCustomizationCalendarRoute extends StatefulWidget {
|
||||
static const ROUTE_NAME = '/settings/customization/calendar';
|
||||
|
||||
@override
|
||||
State<SettingsCustomizationCalendarRoute> createState() => _State();
|
||||
}
|
||||
|
||||
class _State extends State<SettingsCustomizationCalendarRoute> {
|
||||
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
@override
|
||||
Widget build(BuildContext context) => Scaffold(
|
||||
key: _scaffoldKey,
|
||||
appBar: _appBar,
|
||||
body: _body,
|
||||
);
|
||||
|
||||
Widget get _appBar => LSAppBar(title: 'Calendar');
|
||||
|
||||
Widget get _body => LSListView(
|
||||
children: [
|
||||
SettingsCustomizationCalendarStartingDateTile(),
|
||||
SettingsCustomizationCalendarStartingSizeTile(),
|
||||
SettingsCustomizationCalendarStartingTypeTile(),
|
||||
LSDivider(),
|
||||
SettingsCustomizationCalendarEnableLidarrTile(),
|
||||
SettingsCustomizationCalendarEnableRadarrTile(),
|
||||
SettingsCustomizationCalendarEnableSonarrTile(),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
export 'widgets/enable_lidarr_tile.dart';
|
||||
export 'widgets/enable_radarr_tile.dart';
|
||||
export 'widgets/enable_sonarr_tile.dart';
|
||||
export 'widgets/start_date_tile.dart';
|
||||
export 'widgets/start_size_tile.dart';
|
||||
export 'widgets/start_type_tile.dart';
|
||||
@@ -2,13 +2,13 @@ import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/home.dart';
|
||||
|
||||
class SettingsModulesCalendarEnableLidarrTile extends StatelessWidget {
|
||||
class SettingsCustomizationCalendarEnableLidarrTile extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) => ValueListenableBuilder(
|
||||
valueListenable: Database.lunaSeaBox.listenable(keys: [HomeDatabaseValue.CALENDAR_ENABLE_LIDARR.key]),
|
||||
builder: (context, box, widget) => LSCardTile(
|
||||
title: LSTitle(text: 'Lidarr in Calendar'),
|
||||
subtitle: LSSubtitle(text: 'Show Lidarr calendar entries'),
|
||||
title: LSTitle(text: 'Show Lidarr'),
|
||||
subtitle: LSSubtitle(text: 'Show Lidarr Calendar Entries'),
|
||||
trailing: Switch(
|
||||
value: HomeDatabaseValue.CALENDAR_ENABLE_LIDARR.data,
|
||||
onChanged: _changeState,
|
||||
@@ -2,13 +2,13 @@ import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/home.dart';
|
||||
|
||||
class SettingsModulesCalendarEnableRadarrTile extends StatelessWidget {
|
||||
class SettingsCustomizationCalendarEnableRadarrTile extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) => ValueListenableBuilder(
|
||||
valueListenable: Database.lunaSeaBox.listenable(keys: [HomeDatabaseValue.CALENDAR_ENABLE_RADARR.key]),
|
||||
builder: (context, box, widget) => LSCardTile(
|
||||
title: LSTitle(text: 'Radarr in Calendar'),
|
||||
subtitle: LSSubtitle(text: 'Show Radarr calendar entries'),
|
||||
title: LSTitle(text: 'Show Radarr'),
|
||||
subtitle: LSSubtitle(text: 'Show Radarr Calendar Entries'),
|
||||
trailing: Switch(
|
||||
value: HomeDatabaseValue.CALENDAR_ENABLE_RADARR.data,
|
||||
onChanged: _changeState,
|
||||
@@ -2,13 +2,13 @@ import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/home.dart';
|
||||
|
||||
class SettingsModulesCalendarEnableSonarrTile extends StatelessWidget {
|
||||
class SettingsCustomizationCalendarEnableSonarrTile extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) => ValueListenableBuilder(
|
||||
valueListenable: Database.lunaSeaBox.listenable(keys: [HomeDatabaseValue.CALENDAR_ENABLE_SONARR.key]),
|
||||
builder: (context, box, widget) => LSCardTile(
|
||||
title: LSTitle(text: 'Sonarr in Calendar'),
|
||||
subtitle: LSSubtitle(text: 'Show Sonarr calendar entries'),
|
||||
title: LSTitle(text: 'Show Sonarr'),
|
||||
subtitle: LSSubtitle(text: 'Show Sonarr Calendar Entries'),
|
||||
trailing: Switch(
|
||||
value: HomeDatabaseValue.CALENDAR_ENABLE_SONARR.data,
|
||||
onChanged: _changeState,
|
||||
@@ -3,7 +3,7 @@ import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/home.dart';
|
||||
import 'package:lunasea/modules/settings.dart';
|
||||
|
||||
class SettingsModulesHomeCalendarStartingDateTile extends StatelessWidget {
|
||||
class SettingsCustomizationCalendarStartingDateTile extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) => ValueListenableBuilder(
|
||||
valueListenable: Database.lunaSeaBox.listenable(keys: [HomeDatabaseValue.CALENDAR_STARTING_DAY.key]),
|
||||
@@ -3,7 +3,7 @@ import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/home.dart';
|
||||
import 'package:lunasea/modules/settings.dart';
|
||||
|
||||
class SettingsModulesHomeCalendarStartingSizeTile extends StatelessWidget {
|
||||
class SettingsCustomizationCalendarStartingSizeTile extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) => ValueListenableBuilder(
|
||||
valueListenable: Database.lunaSeaBox.listenable(keys: [HomeDatabaseValue.CALENDAR_STARTING_SIZE.key]),
|
||||
@@ -3,7 +3,7 @@ import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/home.dart';
|
||||
import 'package:lunasea/modules/settings.dart';
|
||||
|
||||
class SettingsModulesHomeCalendarStartingTypeTile extends StatelessWidget {
|
||||
class SettingsCustomizationCalendarStartingTypeTile extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) => ValueListenableBuilder(
|
||||
valueListenable: Database.lunaSeaBox.listenable(keys: [HomeDatabaseValue.CALENDAR_STARTING_TYPE.key]),
|
||||
2
lib/modules/settings/modules/customization_drawer.dart
Normal file
2
lib/modules/settings/modules/customization_drawer.dart
Normal file
@@ -0,0 +1,2 @@
|
||||
export 'customization_drawer/route.dart';
|
||||
export 'customization_drawer/widgets.dart';
|
||||
30
lib/modules/settings/modules/customization_drawer/route.dart
Normal file
30
lib/modules/settings/modules/customization_drawer/route.dart
Normal file
@@ -0,0 +1,30 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/settings.dart';
|
||||
|
||||
class SettingsCustomizationDrawerRoute extends StatefulWidget {
|
||||
static const ROUTE_NAME = '/settings/customization/drawer';
|
||||
|
||||
@override
|
||||
State<SettingsCustomizationDrawerRoute> createState() => _State();
|
||||
}
|
||||
|
||||
class _State extends State<SettingsCustomizationDrawerRoute> {
|
||||
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
@override
|
||||
Widget build(BuildContext context) => Scaffold(
|
||||
key: _scaffoldKey,
|
||||
appBar: _appBar,
|
||||
body: _body,
|
||||
);
|
||||
|
||||
Widget get _appBar => LSAppBar(title: 'Drawer');
|
||||
|
||||
Widget get _body => LSListView(
|
||||
children: [
|
||||
SettingsCustomizationDrawerExpandAutomationTile(),
|
||||
SettingsCustomizationDrawerExpandClientsTile(),
|
||||
SettingsCustomizationDrawerExpandMonitoringTile(),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export 'widgets/expand_automation_tile.dart';
|
||||
export 'widgets/expand_clients_tile.dart';
|
||||
export 'widgets/expand_monitoring_tile.dart';
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
|
||||
class SettingsDrawerExpandAutomationTile extends StatelessWidget {
|
||||
class SettingsCustomizationDrawerExpandAutomationTile extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) => ValueListenableBuilder(
|
||||
valueListenable: Database.lunaSeaBox.listenable(keys: [LunaSeaDatabaseValue.DRAWER_EXPAND_AUTOMATION.key]),
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
|
||||
class SettingsDrawerExpandClientsTile extends StatelessWidget {
|
||||
class SettingsCustomizationDrawerExpandClientsTile extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) => ValueListenableBuilder(
|
||||
valueListenable: Database.lunaSeaBox.listenable(keys: [LunaSeaDatabaseValue.DRAWER_EXPAND_CLIENTS.key]),
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
|
||||
class SettingsDrawerExpandMonitoringTile extends StatelessWidget {
|
||||
class SettingsCustomizationDrawerExpandMonitoringTile extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) => ValueListenableBuilder(
|
||||
valueListenable: Database.lunaSeaBox.listenable(keys: [LunaSeaDatabaseValue.DRAWER_EXPAND_MONITORING.key]),
|
||||
2
lib/modules/settings/modules/customization_home.dart
Normal file
2
lib/modules/settings/modules/customization_home.dart
Normal file
@@ -0,0 +1,2 @@
|
||||
export 'customization_home/route.dart';
|
||||
export 'customization_home/widgets.dart';
|
||||
29
lib/modules/settings/modules/customization_home/route.dart
Normal file
29
lib/modules/settings/modules/customization_home/route.dart
Normal file
@@ -0,0 +1,29 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/settings.dart';
|
||||
|
||||
class SettingsCustomizationHomeRoute extends StatefulWidget {
|
||||
static const ROUTE_NAME = '/settings/customization/home';
|
||||
|
||||
@override
|
||||
State<SettingsCustomizationHomeRoute> createState() => _State();
|
||||
}
|
||||
|
||||
class _State extends State<SettingsCustomizationHomeRoute> {
|
||||
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
@override
|
||||
Widget build(BuildContext context) => Scaffold(
|
||||
key: _scaffoldKey,
|
||||
appBar: _appBar,
|
||||
body: _body,
|
||||
);
|
||||
|
||||
Widget get _appBar => LSAppBar(title: 'Home');
|
||||
|
||||
Widget get _body => LSListView(
|
||||
children: [
|
||||
SettingsCustomizationHomeDefaultPageTile(),
|
||||
SettingsCustomizationHomeBrandColoursTile(),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
export 'widgets/brand_colours_tile.dart';
|
||||
export 'widgets/default_page_tile.dart';
|
||||
@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/home.dart';
|
||||
|
||||
class SettingsModulesHomeBrandColours extends StatelessWidget {
|
||||
class SettingsCustomizationHomeBrandColoursTile extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) => ValueListenableBuilder(
|
||||
valueListenable: Database.lunaSeaBox.listenable(keys: [HomeDatabaseValue.MODULES_BRAND_COLOURS.key]),
|
||||
@@ -2,16 +2,14 @@ import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/home.dart';
|
||||
|
||||
class SettingsModulesHomeDefaultPageTile extends StatelessWidget {
|
||||
class SettingsCustomizationHomeDefaultPageTile extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) => ValueListenableBuilder(
|
||||
valueListenable: Database.lunaSeaBox.listenable(keys: [HomeDatabaseValue.NAVIGATION_INDEX.key]),
|
||||
builder: (context, box, _) => LSCardTile(
|
||||
title: LSTitle(text: 'Default Page'),
|
||||
subtitle: LSSubtitle(
|
||||
text: HomeNavigationBar.titles[HomeDatabaseValue.NAVIGATION_INDEX.data],
|
||||
),
|
||||
trailing: LSIconButton(icon: Icons.arrow_forward_ios),
|
||||
subtitle: LSSubtitle(text: HomeNavigationBar.titles[HomeDatabaseValue.NAVIGATION_INDEX.data]),
|
||||
trailing: LSIconButton(icon: HomeNavigationBar.icons[HomeDatabaseValue.NAVIGATION_INDEX.data]),
|
||||
onTap: () async => _defaultPage(context),
|
||||
),
|
||||
);
|
||||
@@ -20,4 +18,4 @@ class SettingsModulesHomeDefaultPageTile extends StatelessWidget {
|
||||
List<dynamic> _values = await HomeDialogs.defaultPage(context);
|
||||
if(_values[0]) HomeDatabaseValue.NAVIGATION_INDEX.put(_values[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
lib/modules/settings/modules/customization_lidarr.dart
Normal file
2
lib/modules/settings/modules/customization_lidarr.dart
Normal file
@@ -0,0 +1,2 @@
|
||||
export 'customization_lidarr/route.dart';
|
||||
export 'customization_lidarr/widgets.dart';
|
||||
36
lib/modules/settings/modules/customization_lidarr/route.dart
Normal file
36
lib/modules/settings/modules/customization_lidarr/route.dart
Normal file
@@ -0,0 +1,36 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/settings.dart';
|
||||
|
||||
class SettingsCustomizationLidarrRoute extends StatefulWidget {
|
||||
static const ROUTE_NAME = '/settings/customization/lidarr';
|
||||
|
||||
@override
|
||||
State<SettingsCustomizationLidarrRoute> createState() => _State();
|
||||
}
|
||||
|
||||
class _State extends State<SettingsCustomizationLidarrRoute> {
|
||||
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
@override
|
||||
Widget build(BuildContext context) => Scaffold(
|
||||
key: _scaffoldKey,
|
||||
appBar: _appBar,
|
||||
body: _body,
|
||||
);
|
||||
|
||||
Widget get _appBar => LSAppBar(
|
||||
title: 'Lidarr',
|
||||
actions: [
|
||||
LSIconButton(
|
||||
icon: Icons.settings,
|
||||
onPressed: () async => Navigator.of(context).pushNamed(SettingsModulesLidarrRoute.ROUTE_NAME),
|
||||
),
|
||||
]
|
||||
);
|
||||
|
||||
Widget get _body => LSListView(
|
||||
children: [
|
||||
SettingsCustomizationLidarrDefaultPageTile(),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export 'widgets/default_page_tile.dart';
|
||||
@@ -0,0 +1,21 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/lidarr.dart';
|
||||
|
||||
class SettingsCustomizationLidarrDefaultPageTile extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) => ValueListenableBuilder(
|
||||
valueListenable: Database.lunaSeaBox.listenable(keys: [LidarrDatabaseValue.NAVIGATION_INDEX.key]),
|
||||
builder: (context, box, _) => LSCardTile(
|
||||
title: LSTitle(text: 'Default Page'),
|
||||
subtitle: LSSubtitle(text: LidarrNavigationBar.titles[LidarrDatabaseValue.NAVIGATION_INDEX.data]),
|
||||
trailing: LSIconButton(icon: LidarrNavigationBar.icons[LidarrDatabaseValue.NAVIGATION_INDEX.data]),
|
||||
onTap: () async => _defaultPage(context),
|
||||
),
|
||||
);
|
||||
|
||||
Future<void> _defaultPage(BuildContext context) async {
|
||||
List<dynamic> _values = await LidarrDialogs.defaultPage(context);
|
||||
if(_values[0]) LidarrDatabaseValue.NAVIGATION_INDEX.put(_values[1]);
|
||||
}
|
||||
}
|
||||
2
lib/modules/settings/modules/customization_nzbget.dart
Normal file
2
lib/modules/settings/modules/customization_nzbget.dart
Normal file
@@ -0,0 +1,2 @@
|
||||
export 'customization_nzbget/route.dart';
|
||||
export 'customization_nzbget/widgets.dart';
|
||||
36
lib/modules/settings/modules/customization_nzbget/route.dart
Normal file
36
lib/modules/settings/modules/customization_nzbget/route.dart
Normal file
@@ -0,0 +1,36 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/settings.dart';
|
||||
|
||||
class SettingsCustomizationNZBGetRoute extends StatefulWidget {
|
||||
static const ROUTE_NAME = '/settings/customization/nzbget';
|
||||
|
||||
@override
|
||||
State<SettingsCustomizationNZBGetRoute> createState() => _State();
|
||||
}
|
||||
|
||||
class _State extends State<SettingsCustomizationNZBGetRoute> {
|
||||
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
@override
|
||||
Widget build(BuildContext context) => Scaffold(
|
||||
key: _scaffoldKey,
|
||||
appBar: _appBar,
|
||||
body: _body,
|
||||
);
|
||||
|
||||
Widget get _appBar => LSAppBar(
|
||||
title: 'NZBGet',
|
||||
actions: [
|
||||
LSIconButton(
|
||||
icon: Icons.settings,
|
||||
onPressed: () async => Navigator.of(context).pushNamed(SettingsModulesNZBGetRoute.ROUTE_NAME),
|
||||
),
|
||||
]
|
||||
);
|
||||
|
||||
Widget get _body => LSListView(
|
||||
children: [
|
||||
SettingsCustomizationNZBGetDefaultPageTile(),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export 'widgets/default_page_tile.dart';
|
||||
@@ -0,0 +1,21 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/nzbget.dart';
|
||||
|
||||
class SettingsCustomizationNZBGetDefaultPageTile extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) => ValueListenableBuilder(
|
||||
valueListenable: Database.lunaSeaBox.listenable(keys: [NZBGetDatabaseValue.NAVIGATION_INDEX.key]),
|
||||
builder: (context, box, _) => LSCardTile(
|
||||
title: LSTitle(text: 'Default Page'),
|
||||
subtitle: LSSubtitle(text: NZBGetNavigationBar.titles[NZBGetDatabaseValue.NAVIGATION_INDEX.data]),
|
||||
trailing: LSIconButton(icon: NZBGetNavigationBar.icons[NZBGetDatabaseValue.NAVIGATION_INDEX.data]),
|
||||
onTap: () async => _defaultPage(context),
|
||||
),
|
||||
);
|
||||
|
||||
Future<void> _defaultPage(BuildContext context) async {
|
||||
List<dynamic> _values = await NZBGetDialogs.defaultPage(context);
|
||||
if(_values[0]) NZBGetDatabaseValue.NAVIGATION_INDEX.put(_values[1]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
export 'customization_quickactions/route.dart';
|
||||
export 'customization_quickactions/widgets.dart';
|
||||
@@ -0,0 +1,63 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/settings.dart';
|
||||
|
||||
class SettingsCustomizationQuickActionsRoute extends StatefulWidget {
|
||||
static const ROUTE_NAME = '/settings/customization/quick_actions';
|
||||
|
||||
@override
|
||||
State<SettingsCustomizationQuickActionsRoute> createState() => _State();
|
||||
}
|
||||
|
||||
class _State extends State<SettingsCustomizationQuickActionsRoute> {
|
||||
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Scaffold(
|
||||
key: _scaffoldKey,
|
||||
appBar: _appBar,
|
||||
body: _body,
|
||||
);
|
||||
|
||||
Widget get _appBar => LSAppBar(title: 'Quick Actions');
|
||||
|
||||
Widget get _body => LSListView(
|
||||
children: [
|
||||
LSHeader(
|
||||
text: 'Modules',
|
||||
subtitle: 'Only four quick actions will appear, and are added in the order below. Enabling more than four modules will have no effect.',
|
||||
),
|
||||
SettingsCustomizationQuickActionTile(
|
||||
title: 'Search',
|
||||
action: LunaSeaDatabaseValue.QUICK_ACTIONS_SEARCH,
|
||||
),
|
||||
LSDivider(),
|
||||
SettingsCustomizationQuickActionTile(
|
||||
title: 'Lidarr',
|
||||
action: LunaSeaDatabaseValue.QUICK_ACTIONS_LIDARR,
|
||||
),
|
||||
SettingsCustomizationQuickActionTile(
|
||||
title: 'Radarr',
|
||||
action: LunaSeaDatabaseValue.QUICK_ACTIONS_RADARR,
|
||||
),
|
||||
SettingsCustomizationQuickActionTile(
|
||||
title: 'Sonarr',
|
||||
action: LunaSeaDatabaseValue.QUICK_ACTIONS_SONARR,
|
||||
),
|
||||
LSDivider(),
|
||||
SettingsCustomizationQuickActionTile(
|
||||
title: 'NZBGet',
|
||||
action: LunaSeaDatabaseValue.QUICK_ACTIONS_NZBGET,
|
||||
),
|
||||
SettingsCustomizationQuickActionTile(
|
||||
title: 'SABnzbd',
|
||||
action: LunaSeaDatabaseValue.QUICK_ACTIONS_SABNZBD,
|
||||
),
|
||||
LSDivider(),
|
||||
SettingsCustomizationQuickActionTile(
|
||||
title: 'Tautulli',
|
||||
action: LunaSeaDatabaseValue.QUICK_ACTIONS_TAUTULLI,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export 'widgets/action_tile.dart';
|
||||
@@ -0,0 +1,28 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
|
||||
class SettingsCustomizationQuickActionTile extends StatelessWidget {
|
||||
final String title;
|
||||
final LunaSeaDatabaseValue action;
|
||||
|
||||
SettingsCustomizationQuickActionTile({
|
||||
Key key,
|
||||
@required this.title,
|
||||
@required this.action,
|
||||
}): super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => LSCardTile(
|
||||
title: LSTitle(text: title),
|
||||
trailing: ValueListenableBuilder(
|
||||
valueListenable: Database.lunaSeaBox.listenable(keys: [action.key]),
|
||||
builder: (context, box, _) => Switch(
|
||||
value: action.data,
|
||||
onChanged: (value) {
|
||||
action.put(value);
|
||||
HomescreenActions.setShortcutItems();
|
||||
}
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
2
lib/modules/settings/modules/customization_radarr.dart
Normal file
2
lib/modules/settings/modules/customization_radarr.dart
Normal file
@@ -0,0 +1,2 @@
|
||||
export 'customization_radarr/route.dart';
|
||||
export 'customization_radarr/widgets.dart';
|
||||
36
lib/modules/settings/modules/customization_radarr/route.dart
Normal file
36
lib/modules/settings/modules/customization_radarr/route.dart
Normal file
@@ -0,0 +1,36 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/settings.dart';
|
||||
|
||||
class SettingsCustomizationRadarrRoute extends StatefulWidget {
|
||||
static const ROUTE_NAME = '/settings/customization/radarr';
|
||||
|
||||
@override
|
||||
State<SettingsCustomizationRadarrRoute> createState() => _State();
|
||||
}
|
||||
|
||||
class _State extends State<SettingsCustomizationRadarrRoute> {
|
||||
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
@override
|
||||
Widget build(BuildContext context) => Scaffold(
|
||||
key: _scaffoldKey,
|
||||
appBar: _appBar,
|
||||
body: _body,
|
||||
);
|
||||
|
||||
Widget get _appBar => LSAppBar(
|
||||
title: 'Radarr',
|
||||
actions: [
|
||||
LSIconButton(
|
||||
icon: Icons.settings,
|
||||
onPressed: () async => Navigator.of(context).pushNamed(SettingsModulesRadarrRoute.ROUTE_NAME),
|
||||
),
|
||||
]
|
||||
);
|
||||
|
||||
Widget get _body => LSListView(
|
||||
children: [
|
||||
SettingsCustomizationRadarrDefaultPageTile(),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export 'widgets/default_page_tile.dart';
|
||||
@@ -0,0 +1,21 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/radarr.dart';
|
||||
|
||||
class SettingsCustomizationRadarrDefaultPageTile extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) => ValueListenableBuilder(
|
||||
valueListenable: Database.lunaSeaBox.listenable(keys: [RadarrDatabaseValue.NAVIGATION_INDEX.key]),
|
||||
builder: (context, box, _) => LSCardTile(
|
||||
title: LSTitle(text: 'Default Page'),
|
||||
subtitle: LSSubtitle(text: RadarrNavigationBar.titles[RadarrDatabaseValue.NAVIGATION_INDEX.data]),
|
||||
trailing: LSIconButton(icon: RadarrNavigationBar.icons[RadarrDatabaseValue.NAVIGATION_INDEX.data]),
|
||||
onTap: () async => _defaultPage(context),
|
||||
),
|
||||
);
|
||||
|
||||
Future<void> _defaultPage(BuildContext context) async {
|
||||
List<dynamic> _values = await RadarrDialogs.defaultPage(context);
|
||||
if(_values[0]) RadarrDatabaseValue.NAVIGATION_INDEX.put(_values[1]);
|
||||
}
|
||||
}
|
||||
2
lib/modules/settings/modules/customization_sabnzbd.dart
Normal file
2
lib/modules/settings/modules/customization_sabnzbd.dart
Normal file
@@ -0,0 +1,2 @@
|
||||
export 'customization_sabnzbd/route.dart';
|
||||
export 'customization_sabnzbd/widgets.dart';
|
||||
@@ -0,0 +1,36 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/settings.dart';
|
||||
|
||||
class SettingsCustomizationSABnzbdRoute extends StatefulWidget {
|
||||
static const ROUTE_NAME = '/settings/customization/sabnzbd';
|
||||
|
||||
@override
|
||||
State<SettingsCustomizationSABnzbdRoute> createState() => _State();
|
||||
}
|
||||
|
||||
class _State extends State<SettingsCustomizationSABnzbdRoute> {
|
||||
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
@override
|
||||
Widget build(BuildContext context) => Scaffold(
|
||||
key: _scaffoldKey,
|
||||
appBar: _appBar,
|
||||
body: _body,
|
||||
);
|
||||
|
||||
Widget get _appBar => LSAppBar(
|
||||
title: 'SABnzbd',
|
||||
actions: [
|
||||
LSIconButton(
|
||||
icon: Icons.settings,
|
||||
onPressed: () async => Navigator.of(context).pushNamed(SettingsModulesSABnzbdRoute.ROUTE_NAME),
|
||||
),
|
||||
]
|
||||
);
|
||||
|
||||
Widget get _body => LSListView(
|
||||
children: [
|
||||
SettingsCustomizationSABnzbdDefaultPageTile(),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export 'widgets/default_page_tile.dart';
|
||||
@@ -0,0 +1,21 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/sabnzbd.dart';
|
||||
|
||||
class SettingsCustomizationSABnzbdDefaultPageTile extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) => ValueListenableBuilder(
|
||||
valueListenable: Database.lunaSeaBox.listenable(keys: [SABnzbdDatabaseValue.NAVIGATION_INDEX.key]),
|
||||
builder: (context, box, _) => LSCardTile(
|
||||
title: LSTitle(text: 'Default Page'),
|
||||
subtitle: LSSubtitle(text: SABnzbdNavigationBar.titles[SABnzbdDatabaseValue.NAVIGATION_INDEX.data]),
|
||||
trailing: LSIconButton(icon: SABnzbdNavigationBar.icons[SABnzbdDatabaseValue.NAVIGATION_INDEX.data]),
|
||||
onTap: () async => _defaultPage(context),
|
||||
),
|
||||
);
|
||||
|
||||
Future<void> _defaultPage(BuildContext context) async {
|
||||
List<dynamic> _values = await SABnzbdDialogs.defaultPage(context);
|
||||
if(_values[0]) SABnzbdDatabaseValue.NAVIGATION_INDEX.put(_values[1]);
|
||||
}
|
||||
}
|
||||
2
lib/modules/settings/modules/customization_search.dart
Normal file
2
lib/modules/settings/modules/customization_search.dart
Normal file
@@ -0,0 +1,2 @@
|
||||
export 'customization_search/route.dart';
|
||||
export 'customization_search/widgets.dart';
|
||||
36
lib/modules/settings/modules/customization_search/route.dart
Normal file
36
lib/modules/settings/modules/customization_search/route.dart
Normal file
@@ -0,0 +1,36 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/settings.dart';
|
||||
|
||||
class SettingsCustomizationSearchRoute extends StatefulWidget {
|
||||
static const ROUTE_NAME = '/settings/customization/search';
|
||||
|
||||
@override
|
||||
State<SettingsCustomizationSearchRoute> createState() => _State();
|
||||
}
|
||||
|
||||
class _State extends State<SettingsCustomizationSearchRoute> {
|
||||
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
@override
|
||||
Widget build(BuildContext context) => Scaffold(
|
||||
key: _scaffoldKey,
|
||||
appBar: _appBar,
|
||||
body: _body,
|
||||
);
|
||||
|
||||
Widget get _appBar => LSAppBar(
|
||||
title: 'Search',
|
||||
actions: [
|
||||
LSIconButton(
|
||||
icon: Icons.settings,
|
||||
onPressed: () async => Navigator.of(context).pushNamed(SettingsModulesSearchRoute.ROUTE_NAME),
|
||||
),
|
||||
]
|
||||
);
|
||||
|
||||
Widget get _body => LSListView(
|
||||
children: [
|
||||
SettingsCustomizationSearchHideAdultCategoriesTile(),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export 'widgets/hide_adult_categories_tile.dart';
|
||||
@@ -0,0 +1,18 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/search.dart';
|
||||
|
||||
class SettingsCustomizationSearchHideAdultCategoriesTile extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) => ValueListenableBuilder(
|
||||
valueListenable: Database.lunaSeaBox.listenable(keys: [SearchDatabaseValue.HIDE_XXX.key]),
|
||||
builder: (context, box, widget) => LSCardTile(
|
||||
title: LSTitle(text: 'Hide Adult Categories'),
|
||||
subtitle: LSSubtitle(text: 'Hide Categories Containing Adult Content'),
|
||||
trailing: Switch(
|
||||
value: SearchDatabaseValue.HIDE_XXX.data,
|
||||
onChanged: (value) => SearchDatabaseValue.HIDE_XXX.put(value),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
2
lib/modules/settings/modules/customization_sonarr.dart
Normal file
2
lib/modules/settings/modules/customization_sonarr.dart
Normal file
@@ -0,0 +1,2 @@
|
||||
export 'customization_sonarr/route.dart';
|
||||
export 'customization_sonarr/widgets.dart';
|
||||
36
lib/modules/settings/modules/customization_sonarr/route.dart
Normal file
36
lib/modules/settings/modules/customization_sonarr/route.dart
Normal file
@@ -0,0 +1,36 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/settings.dart';
|
||||
|
||||
class SettingsCustomizationSonarrRoute extends StatefulWidget {
|
||||
static const ROUTE_NAME = '/settings/customization/sonarr';
|
||||
|
||||
@override
|
||||
State<SettingsCustomizationSonarrRoute> createState() => _State();
|
||||
}
|
||||
|
||||
class _State extends State<SettingsCustomizationSonarrRoute> {
|
||||
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
@override
|
||||
Widget build(BuildContext context) => Scaffold(
|
||||
key: _scaffoldKey,
|
||||
appBar: _appBar,
|
||||
body: _body,
|
||||
);
|
||||
|
||||
Widget get _appBar => LSAppBar(
|
||||
title: 'Sonarr',
|
||||
actions: [
|
||||
LSIconButton(
|
||||
icon: Icons.settings,
|
||||
onPressed: () async => Navigator.of(context).pushNamed(SettingsModulesSonarrRoute.ROUTE_NAME),
|
||||
),
|
||||
]
|
||||
);
|
||||
|
||||
Widget get _body => LSListView(
|
||||
children: [
|
||||
SettingsCustomizationSonarrDefaultPageTile(),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export 'widgets/default_page_tile.dart';
|
||||
@@ -0,0 +1,21 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/sonarr.dart';
|
||||
|
||||
class SettingsCustomizationSonarrDefaultPageTile extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) => ValueListenableBuilder(
|
||||
valueListenable: Database.lunaSeaBox.listenable(keys: [SonarrDatabaseValue.NAVIGATION_INDEX.key]),
|
||||
builder: (context, box, _) => LSCardTile(
|
||||
title: LSTitle(text: 'Default Page'),
|
||||
subtitle: LSSubtitle(text: SonarrNavigationBar.titles[SonarrDatabaseValue.NAVIGATION_INDEX.data]),
|
||||
trailing: LSIconButton(icon: SonarrNavigationBar.icons[SonarrDatabaseValue.NAVIGATION_INDEX.data]),
|
||||
onTap: () async => _defaultPage(context),
|
||||
),
|
||||
);
|
||||
|
||||
Future<void> _defaultPage(BuildContext context) async {
|
||||
List<dynamic> _values = await SonarrDialogs.defaultPage(context);
|
||||
if(_values[0]) SonarrDatabaseValue.NAVIGATION_INDEX.put(_values[1]);
|
||||
}
|
||||
}
|
||||
2
lib/modules/settings/modules/customization_tautulli.dart
Normal file
2
lib/modules/settings/modules/customization_tautulli.dart
Normal file
@@ -0,0 +1,2 @@
|
||||
export 'customization_tautulli/route.dart';
|
||||
export 'customization_tautulli/widgets.dart';
|
||||
@@ -0,0 +1,36 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/settings.dart';
|
||||
|
||||
class SettingsCustomizationTautulliRoute extends StatefulWidget {
|
||||
static const ROUTE_NAME = '/settings/customization/tautulli';
|
||||
|
||||
@override
|
||||
State<SettingsCustomizationTautulliRoute> createState() => _State();
|
||||
}
|
||||
|
||||
class _State extends State<SettingsCustomizationTautulliRoute> {
|
||||
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
@override
|
||||
Widget build(BuildContext context) => Scaffold(
|
||||
key: _scaffoldKey,
|
||||
appBar: _appBar,
|
||||
body: _body,
|
||||
);
|
||||
|
||||
Widget get _appBar => LSAppBar(
|
||||
title: 'Tautulli',
|
||||
actions: [
|
||||
LSIconButton(
|
||||
icon: Icons.settings,
|
||||
onPressed: () async => Navigator.of(context).pushNamed(SettingsModulesTautulliRoute.ROUTE_NAME),
|
||||
),
|
||||
]
|
||||
);
|
||||
|
||||
Widget get _body => LSListView(
|
||||
children: [
|
||||
SettingsCustomizationTautulliDefaultPageTile(),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export 'widgets/default_page_tile.dart';
|
||||
@@ -0,0 +1,21 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/tautulli.dart';
|
||||
|
||||
class SettingsCustomizationTautulliDefaultPageTile extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) => ValueListenableBuilder(
|
||||
valueListenable: Database.lunaSeaBox.listenable(keys: [TautulliDatabaseValue.NAVIGATION_INDEX.key]),
|
||||
builder: (context, box, _) => LSCardTile(
|
||||
title: LSTitle(text: 'Default Page'),
|
||||
subtitle: LSSubtitle(text: TautulliNavigationBar.titles[TautulliDatabaseValue.NAVIGATION_INDEX.data]),
|
||||
trailing: LSIconButton(icon: TautulliNavigationBar.icons[TautulliDatabaseValue.NAVIGATION_INDEX.data]),
|
||||
onTap: () async => _defaultPage(context),
|
||||
),
|
||||
);
|
||||
|
||||
Future<void> _defaultPage(BuildContext context) async {
|
||||
List<dynamic> _values = await TautulliDialogs.defaultPage(context);
|
||||
if(_values[0]) TautulliDatabaseValue.NAVIGATION_INDEX.put(_values[1]);
|
||||
}
|
||||
}
|
||||
2
lib/modules/settings/modules/donations.dart
Normal file
2
lib/modules/settings/modules/donations.dart
Normal file
@@ -0,0 +1,2 @@
|
||||
export 'donations/route.dart';
|
||||
export 'donations/widgets.dart';
|
||||
70
lib/modules/settings/modules/donations/route.dart
Normal file
70
lib/modules/settings/modules/donations/route.dart
Normal file
@@ -0,0 +1,70 @@
|
||||
import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:in_app_purchase/in_app_purchase.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/settings.dart';
|
||||
|
||||
class SettingsDonationsRoute extends StatefulWidget {
|
||||
static const ROUTE_NAME = '/settings/donations';
|
||||
|
||||
SettingsDonationsRoute({
|
||||
Key key,
|
||||
}): super(key: key);
|
||||
|
||||
@override
|
||||
State<SettingsDonationsRoute> createState() => _State();
|
||||
}
|
||||
|
||||
class _State extends State<SettingsDonationsRoute> {
|
||||
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
static StreamSubscription<List<PurchaseDetails>> purchaseStream;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
purchaseStream = InAppPurchases.connection.purchaseUpdatedStream.listen(_purchasedCallback);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
purchaseStream?.cancel();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
Future<void> _purchasedCallback(List<PurchaseDetails> purchases) async {
|
||||
for(var purchase in purchases) {
|
||||
if(purchase.pendingCompletePurchase) {
|
||||
switch(purchase.status) {
|
||||
case PurchaseStatus.error: _purchaseFailed(); break;
|
||||
case PurchaseStatus.purchased: _purchasedSuccess(); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void _purchasedSuccess() => Navigator.of(context).pushNamed(SettingsDonationsThankYouRoute.ROUTE_NAME);
|
||||
|
||||
void _purchaseFailed() => LSSnackBar(
|
||||
context: context,
|
||||
title: 'Transaction Failure',
|
||||
message: 'The transaction has failed, please try again',
|
||||
type: SNACKBAR_TYPE.failure,
|
||||
);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Scaffold(
|
||||
key: _scaffoldKey,
|
||||
appBar: _appBar,
|
||||
body: _body,
|
||||
);
|
||||
|
||||
Widget get _appBar => LSAppBar(title: 'Donations');
|
||||
|
||||
Widget get _body => InAppPurchases.available && InAppPurchases.products.length != 0
|
||||
? LSListViewBuilder(
|
||||
itemCount: InAppPurchases.products.length,
|
||||
itemBuilder: (context, index) => SettingsDonationsIAPTile(product: InAppPurchases.products[index]),
|
||||
)
|
||||
: LSGenericMessage(text: 'In-App Purchases Unavailable');
|
||||
}
|
||||
1
lib/modules/settings/modules/donations/widgets.dart
Normal file
1
lib/modules/settings/modules/donations/widgets.dart
Normal file
@@ -0,0 +1 @@
|
||||
export 'widgets/iap_tile.dart';
|
||||
25
lib/modules/settings/modules/donations/widgets/iap_tile.dart
Normal file
25
lib/modules/settings/modules/donations/widgets/iap_tile.dart
Normal file
@@ -0,0 +1,25 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:in_app_purchase/in_app_purchase.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
|
||||
class SettingsDonationsIAPTile extends StatelessWidget {
|
||||
final ProductDetails product;
|
||||
|
||||
SettingsDonationsIAPTile({
|
||||
Key key,
|
||||
@required this.product,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => LSCardTile(
|
||||
title: LSTitle(text: product.ls_Name),
|
||||
subtitle: LSSubtitle(text: product.ls_Description),
|
||||
trailing: LSIconButton(icon: product.ls_Icon),
|
||||
onTap: () async => await _purchase(),
|
||||
);
|
||||
|
||||
Future<void> _purchase() async {
|
||||
final PurchaseParam _parameters = PurchaseParam(productDetails: product, sandboxTesting: false);
|
||||
await InAppPurchases.connection.buyConsumable(purchaseParam: _parameters, autoConsume: true);
|
||||
}
|
||||
}
|
||||
1
lib/modules/settings/modules/donations_thankyou.dart
Normal file
1
lib/modules/settings/modules/donations_thankyou.dart
Normal file
@@ -0,0 +1 @@
|
||||
export 'donations_thankyou/route.dart';
|
||||
57
lib/modules/settings/modules/donations_thankyou/route.dart
Normal file
57
lib/modules/settings/modules/donations_thankyou/route.dart
Normal file
@@ -0,0 +1,57 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:flare_flutter/flare_actor.dart';
|
||||
|
||||
class SettingsDonationsThankYouRoute extends StatefulWidget {
|
||||
static const ROUTE_NAME = '/settings/donations/thankyou';
|
||||
|
||||
SettingsDonationsThankYouRoute({
|
||||
Key key,
|
||||
}): super(key: key);
|
||||
|
||||
@override
|
||||
State<SettingsDonationsThankYouRoute> createState() => _State();
|
||||
}
|
||||
|
||||
class _State extends State<SettingsDonationsThankYouRoute> {
|
||||
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Scaffold(
|
||||
key: _scaffoldKey,
|
||||
appBar: _appBar,
|
||||
body: _body,
|
||||
);
|
||||
|
||||
Widget get _appBar => LSAppBar(title: 'Donations');
|
||||
|
||||
Widget get _body => Padding(
|
||||
child: Column(
|
||||
children: [
|
||||
LSHeader(
|
||||
text: 'Thank You',
|
||||
subtitle: [
|
||||
"Thank you for supporting the open-source community! ",
|
||||
"LunaSea was and still is a passion project built for the community, and will remain entirely open-source.",
|
||||
"\n\n",
|
||||
"Donations are never expected or assumed, so thank you for giving back and helping LunaSea remain free, forever!",
|
||||
].join(),
|
||||
),
|
||||
Container(
|
||||
height: MediaQuery.of(context).size.height/3,
|
||||
width: MediaQuery.of(context).size.width,
|
||||
child: FlareActor(
|
||||
RiveAnimations.CODER['path'],
|
||||
shouldClip: false,
|
||||
alignment: Alignment.center,
|
||||
fit: BoxFit.contain,
|
||||
animation: RiveAnimations.CODER['animation'],
|
||||
),
|
||||
),
|
||||
],
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
),
|
||||
padding: EdgeInsets.only(top: 6.0),
|
||||
);
|
||||
}
|
||||
2
lib/modules/settings/modules/logs.dart
Normal file
2
lib/modules/settings/modules/logs.dart
Normal file
@@ -0,0 +1,2 @@
|
||||
export 'logs/route.dart';
|
||||
export 'logs/widgets.dart';
|
||||
68
lib/modules/settings/modules/logs/route.dart
Normal file
68
lib/modules/settings/modules/logs/route.dart
Normal file
@@ -0,0 +1,68 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/settings.dart';
|
||||
|
||||
class SettingsLogsRoute extends StatefulWidget {
|
||||
static const ROUTE_NAME = '/settings/logs';
|
||||
|
||||
@override
|
||||
State<SettingsLogsRoute> createState() => _State();
|
||||
}
|
||||
|
||||
class _State extends State<SettingsLogsRoute> {
|
||||
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Scaffold(
|
||||
key: _scaffoldKey,
|
||||
appBar: _appBar,
|
||||
body: _body,
|
||||
);
|
||||
|
||||
Widget get _appBar => LSAppBar(title: 'Logs');
|
||||
|
||||
Widget get _body => LSListView(
|
||||
children: [
|
||||
..._logs,
|
||||
LSDivider(),
|
||||
..._other,
|
||||
],
|
||||
);
|
||||
|
||||
List<Widget> get _logs => [
|
||||
LSCardTile(
|
||||
title: LSTitle(text: 'All Logs'),
|
||||
subtitle: LSSubtitle(text: 'View Logs of All Types'),
|
||||
trailing: LSIconButton(icon: Icons.developer_mode),
|
||||
onTap: () async => _viewLogs('All'),
|
||||
),
|
||||
LSCardTile(
|
||||
title: LSTitle(text: 'Warning'),
|
||||
subtitle: LSSubtitle(text: 'View Warning Logs'),
|
||||
trailing: LSIconButton(icon: Icons.warning),
|
||||
onTap: () async => _viewLogs('Warning'),
|
||||
),
|
||||
LSCardTile(
|
||||
title: LSTitle(text: 'Error'),
|
||||
subtitle: LSSubtitle(text: 'View Error Logs'),
|
||||
trailing: LSIconButton(icon: Icons.report),
|
||||
onTap: () async => _viewLogs('Error'),
|
||||
),
|
||||
LSCardTile(
|
||||
title: LSTitle(text: 'Fatal'),
|
||||
subtitle: LSSubtitle(text: 'View Fatal Logs'),
|
||||
trailing: LSIconButton(icon: Icons.new_releases),
|
||||
onTap: () async => _viewLogs('Fatal'),
|
||||
),
|
||||
];
|
||||
|
||||
List<Widget> get _other => [
|
||||
SettingsLogsExportTile(),
|
||||
SettingsLogsClearTile(),
|
||||
];
|
||||
|
||||
Future<void> _viewLogs(String type) async => Navigator.of(context).pushNamed(
|
||||
SettingsLogsDetailsRoute.ROUTE_NAME,
|
||||
arguments: SettingsLogsDetailsRouteArguments(type: type),
|
||||
);
|
||||
}
|
||||
2
lib/modules/settings/modules/logs/widgets.dart
Normal file
2
lib/modules/settings/modules/logs/widgets.dart
Normal file
@@ -0,0 +1,2 @@
|
||||
export 'widgets/clear_tile.dart';
|
||||
export 'widgets/export_tile.dart';
|
||||
@@ -2,10 +2,10 @@ import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/settings.dart';
|
||||
|
||||
class SettingsGeneralClearLogsTile extends StatelessWidget {
|
||||
class SettingsLogsClearTile extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) => LSCardTile(
|
||||
title: LSTitle(text: 'Clear Logs'),
|
||||
title: LSTitle(text: 'Clear'),
|
||||
subtitle: LSSubtitle(text: 'Clear All Recorded Logs'),
|
||||
trailing: LSIconButton(icon: Icons.delete),
|
||||
onTap: () async => _clearLogs(context),
|
||||
@@ -2,10 +2,10 @@ import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/settings.dart';
|
||||
|
||||
class SettingsGeneralExportLogsTile extends StatelessWidget {
|
||||
class SettingsLogsExportTile extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) => LSCardTile(
|
||||
title: LSTitle(text: 'Export Logs'),
|
||||
title: LSTitle(text: 'Export'),
|
||||
subtitle: LSSubtitle(text: 'Export All Recorded Logs'),
|
||||
trailing: LSIconButton(icon: Icons.file_download),
|
||||
onTap: () async => _exportLogs(context),
|
||||
2
lib/modules/settings/modules/logs_details.dart
Normal file
2
lib/modules/settings/modules/logs_details.dart
Normal file
@@ -0,0 +1,2 @@
|
||||
export 'logs_details/route.dart';
|
||||
export 'logs_details/widgets.dart';
|
||||
92
lib/modules/settings/modules/logs_details/route.dart
Normal file
92
lib/modules/settings/modules/logs_details/route.dart
Normal file
@@ -0,0 +1,92 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/scheduler.dart';
|
||||
import 'package:f_logs/f_logs.dart' as FLog;
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/settings.dart';
|
||||
|
||||
class SettingsLogsDetailsRouteArguments {
|
||||
final String type;
|
||||
|
||||
SettingsLogsDetailsRouteArguments({
|
||||
@required this.type,
|
||||
});
|
||||
}
|
||||
|
||||
class SettingsLogsDetailsRoute extends StatefulWidget {
|
||||
static const ROUTE_NAME = '/settings/logs/details';
|
||||
|
||||
@override
|
||||
State<SettingsLogsDetailsRoute> createState() => _State();
|
||||
}
|
||||
|
||||
class _State extends State<SettingsLogsDetailsRoute> {
|
||||
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
SettingsLogsDetailsRouteArguments _arguments;
|
||||
List<String> levels = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
SchedulerBinding.instance.scheduleFrameCallback((_) async {
|
||||
_arguments = ModalRoute.of(context).settings.arguments;
|
||||
_setLogLevel();
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
|
||||
void _setLogLevel() {
|
||||
switch(_arguments?.type) {
|
||||
case 'All': levels = []; break;
|
||||
case 'Warning': levels = [FLog.LogLevel.WARNING.toString()]; break;
|
||||
case 'Error': levels = [FLog.LogLevel.ERROR.toString()]; break;
|
||||
case 'Fatal': levels = [FLog.LogLevel.FATAL.toString()]; break;
|
||||
default: levels = []; break;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => _arguments == null
|
||||
? Scaffold()
|
||||
: Scaffold(
|
||||
key: _scaffoldKey,
|
||||
appBar: _appBar,
|
||||
body: _body,
|
||||
);
|
||||
|
||||
Widget get _appBar => LSAppBar(title: '${_arguments?.type ?? 'Unknown'} Logs');
|
||||
|
||||
Widget get _body => FutureBuilder(
|
||||
future: FLog.FLog.getAllLogsByFilter(logLevels: levels),
|
||||
builder: (BuildContext context, AsyncSnapshot<List<FLog.Log>> snapshot) {
|
||||
switch(snapshot.connectionState) {
|
||||
case ConnectionState.done:
|
||||
if(snapshot.hasError) {
|
||||
Logger.error(
|
||||
'SettingsLogsDetailsRoute',
|
||||
'_body',
|
||||
'Unable to fetch logs',
|
||||
snapshot.error,
|
||||
StackTrace.current,
|
||||
);
|
||||
return LSErrorMessage(onTapHandler: () => {});
|
||||
}
|
||||
if(snapshot.hasData) return snapshot.data.length == 0
|
||||
? _noLogs
|
||||
: _list(snapshot.data);
|
||||
break;
|
||||
case ConnectionState.none:
|
||||
case ConnectionState.waiting:
|
||||
case ConnectionState.active:
|
||||
default: return LSLoader();
|
||||
}
|
||||
return LSLoader();
|
||||
},
|
||||
);
|
||||
|
||||
Widget _list(List<FLog.Log> logs) => LSListViewBuilder(
|
||||
itemCount: logs.length,
|
||||
itemBuilder: (context, index) => SettingsLogsDetailsLogTile(log: logs[index])
|
||||
);
|
||||
|
||||
Widget get _noLogs => LSGenericMessage(text: 'No Logs Found');
|
||||
}
|
||||
1
lib/modules/settings/modules/logs_details/widgets.dart
Normal file
1
lib/modules/settings/modules/logs_details/widgets.dart
Normal file
@@ -0,0 +1 @@
|
||||
export 'widgets/log_tile.dart';
|
||||
123
lib/modules/settings/modules/logs_details/widgets/log_tile.dart
Normal file
123
lib/modules/settings/modules/logs_details/widgets/log_tile.dart
Normal file
@@ -0,0 +1,123 @@
|
||||
import 'package:expandable/expandable.dart';
|
||||
import 'package:f_logs/f_logs.dart' as FLog;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
|
||||
class SettingsLogsDetailsLogTile extends StatelessWidget {
|
||||
final FLog.Log log;
|
||||
final ExpandableController _controller = ExpandableController();
|
||||
|
||||
SettingsLogsDetailsLogTile({
|
||||
@required this.log,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => LSExpandable(
|
||||
controller: _controller,
|
||||
collapsed: _collapsed(context),
|
||||
expanded: _expanded(context),
|
||||
);
|
||||
|
||||
Widget _collapsed(BuildContext context) => LSCardTile(
|
||||
title: LSTitle(text: log.text),
|
||||
subtitle: RichText(
|
||||
text: TextSpan(
|
||||
style: TextStyle(
|
||||
fontSize: Constants.UI_FONT_SIZE_SUBTITLE,
|
||||
color: Colors.white70,
|
||||
),
|
||||
children: [
|
||||
TextSpan(text: log.timestamp),
|
||||
TextSpan(text: '\n'),
|
||||
TextSpan(
|
||||
style: TextStyle(
|
||||
color: log.logLevel.lsFLogLogLevel_color(),
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
text: log.logLevel.lsFLogLogLevel_name(),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
padContent: true,
|
||||
onTap: () => _controller.toggle(),
|
||||
|
||||
);
|
||||
|
||||
Widget _expanded(BuildContext context) => LSCard(
|
||||
child: InkWell(
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Padding(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
LSTitle(text: log.text, softWrap: true, maxLines: 12),
|
||||
Padding(
|
||||
child: Wrap(
|
||||
direction: Axis.horizontal,
|
||||
runSpacing: 10.0,
|
||||
children: [
|
||||
LSTextHighlighted(
|
||||
text: log.logLevel.lsFLogLogLevel_name(),
|
||||
bgColor: log.logLevel.lsFLogLogLevel_color(),
|
||||
),
|
||||
],
|
||||
),
|
||||
padding: EdgeInsets.only(top: 8.0, bottom: 2.0),
|
||||
),
|
||||
Padding(
|
||||
child: RichText(
|
||||
text: TextSpan(
|
||||
style: TextStyle(
|
||||
color: Colors.white70,
|
||||
fontSize: Constants.UI_FONT_SIZE_SUBTITLE,
|
||||
),
|
||||
children: [
|
||||
TextSpan(text: log.timestamp),
|
||||
TextSpan(text: '\n'),
|
||||
TextSpan(text: log.className),
|
||||
TextSpan(text: '\n'),
|
||||
TextSpan(text: log.methodName),
|
||||
],
|
||||
),
|
||||
),
|
||||
padding: EdgeInsets.only(top: 6.0, bottom: 10.0),
|
||||
),
|
||||
Padding(
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Expanded(
|
||||
child: LSButtonSlim(
|
||||
text: 'Exception',
|
||||
backgroundColor: LSColors.red,
|
||||
onTap: () async => GlobalDialogs.textPreview(context, 'Exception', log?.exception ?? 'Unavailable', alignLeft: true),
|
||||
margin: EdgeInsets.only(right: 6.0),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: LSButtonSlim(
|
||||
text: 'Stack Trace',
|
||||
backgroundColor: LSColors.blue,
|
||||
onTap: () async => GlobalDialogs.textPreview(context, 'Stack Trace', log?.stacktrace ?? 'Unavailable', alignLeft: true),
|
||||
margin: EdgeInsets.only(left: 6.0),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
padding: EdgeInsets.only(bottom: 2.0),
|
||||
),
|
||||
],
|
||||
),
|
||||
padding: EdgeInsets.symmetric(horizontal: 12.0, vertical: 10.0),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(Constants.UI_BORDER_RADIUS),
|
||||
onTap: () => _controller.toggle(),
|
||||
),
|
||||
);
|
||||
}
|
||||
2
lib/modules/settings/modules/modules.dart
Normal file
2
lib/modules/settings/modules/modules.dart
Normal file
@@ -0,0 +1,2 @@
|
||||
export 'modules/route.dart';
|
||||
export 'modules/widgets.dart';
|
||||
77
lib/modules/settings/modules/modules/route.dart
Normal file
77
lib/modules/settings/modules/modules/route.dart
Normal file
@@ -0,0 +1,77 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules.dart';
|
||||
|
||||
class SettingsModulesRoute extends StatefulWidget {
|
||||
static const ROUTE_NAME = '/settings/modules';
|
||||
|
||||
SettingsModulesRoute({
|
||||
Key key,
|
||||
}): super(key: key);
|
||||
|
||||
@override
|
||||
State<SettingsModulesRoute> createState() => _State();
|
||||
}
|
||||
|
||||
class _State extends State<SettingsModulesRoute> with AutomaticKeepAliveClientMixin {
|
||||
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
|
||||
@override
|
||||
bool get wantKeepAlive => true;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
return Scaffold(
|
||||
key: _scaffoldKey,
|
||||
appBar: _appBar,
|
||||
body: _body,
|
||||
);
|
||||
}
|
||||
|
||||
Widget get _appBar => LSAppBar(
|
||||
title: 'Modules',
|
||||
actions: [
|
||||
SettingsModulesEnabledProfileButton(),
|
||||
],
|
||||
);
|
||||
|
||||
Widget get _body => LSListView(
|
||||
children: [
|
||||
..._general,
|
||||
LSDivider(),
|
||||
..._automation,
|
||||
LSDivider(),
|
||||
..._clients,
|
||||
LSDivider(),
|
||||
..._monitoring,
|
||||
],
|
||||
);
|
||||
|
||||
List<Widget> get _general => [
|
||||
_tileFromModuleMap(SearchConstants.MODULE_MAP, () async => Navigator.of(context).pushNamed(SettingsModulesSearchRoute.ROUTE_NAME)),
|
||||
_tileFromModuleMap(WakeOnLANConstants.MODULE_MAP, () async => Navigator.of(context).pushNamed(SettingsModulesWakeOnLANRoute.ROUTE_NAME)),
|
||||
];
|
||||
|
||||
List<Widget> get _automation => [
|
||||
_tileFromModuleMap(LidarrConstants.MODULE_MAP, () async => Navigator.of(context).pushNamed(SettingsModulesLidarrRoute.ROUTE_NAME)),
|
||||
_tileFromModuleMap(RadarrConstants.MODULE_MAP, () async => Navigator.of(context).pushNamed(SettingsModulesRadarrRoute.ROUTE_NAME)),
|
||||
_tileFromModuleMap(SonarrConstants.MODULE_MAP, () async => Navigator.of(context).pushNamed(SettingsModulesSonarrRoute.ROUTE_NAME)),
|
||||
];
|
||||
|
||||
List<Widget> get _clients => [
|
||||
_tileFromModuleMap(NZBGetConstants.MODULE_MAP, () async => Navigator.of(context).pushNamed(SettingsModulesNZBGetRoute.ROUTE_NAME)),
|
||||
_tileFromModuleMap(SABnzbdConstants.MODULE_MAP, () async => Navigator.of(context).pushNamed(SettingsModulesSABnzbdRoute.ROUTE_NAME)),
|
||||
];
|
||||
|
||||
List<Widget> get _monitoring => [
|
||||
_tileFromModuleMap(TautulliConstants.MODULE_MAP, () async => Navigator.of(context).pushNamed(SettingsModulesTautulliRoute.ROUTE_NAME)),
|
||||
];
|
||||
|
||||
Widget _tileFromModuleMap(ModuleMap map, Function onTap) => LSCardTile(
|
||||
title: LSTitle(text: map.name),
|
||||
subtitle: LSSubtitle(text: map.settingsDescription),
|
||||
trailing: LSIconButton(icon: map.icon),
|
||||
onTap: onTap,
|
||||
);
|
||||
}
|
||||
1
lib/modules/settings/modules/modules/widgets.dart
Normal file
1
lib/modules/settings/modules/modules/widgets.dart
Normal file
@@ -0,0 +1 @@
|
||||
export 'widgets/enabled_profile.dart';
|
||||
@@ -0,0 +1,30 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/settings.dart';
|
||||
|
||||
class SettingsModulesEnabledProfileButton extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) => LSIconButton(
|
||||
icon: Icons.person,
|
||||
onPressed: () async => _changeProfile(context),
|
||||
);
|
||||
|
||||
Future<void> _changeProfile(BuildContext context) async {
|
||||
List<dynamic> values = await SettingsDialogs.enabledProfile(
|
||||
context,
|
||||
Database.profilesBox.keys.map((x) => x as String).toList()..sort((a,b) => a.toLowerCase().compareTo(b.toLowerCase())),
|
||||
);
|
||||
if(values[0]) {
|
||||
if(values[1] != LunaSeaDatabaseValue.ENABLED_PROFILE.data) {
|
||||
LunaSeaDatabaseValue.ENABLED_PROFILE.put(values[1]);
|
||||
Providers.reset(context);
|
||||
}
|
||||
LSSnackBar(
|
||||
context: context,
|
||||
title: 'Changed Profile',
|
||||
message: 'Using profile "${values[1]}"',
|
||||
type: SNACKBAR_TYPE.info,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
lib/modules/settings/modules/modules_lidarr.dart
Normal file
2
lib/modules/settings/modules/modules_lidarr.dart
Normal file
@@ -0,0 +1,2 @@
|
||||
export 'modules_lidarr/route.dart';
|
||||
export 'modules_lidarr/widgets.dart';
|
||||
62
lib/modules/settings/modules/modules_lidarr/route.dart
Normal file
62
lib/modules/settings/modules/modules_lidarr/route.dart
Normal file
@@ -0,0 +1,62 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/settings.dart';
|
||||
|
||||
class SettingsModulesLidarrRoute extends StatefulWidget {
|
||||
static const ROUTE_NAME = '/settings/modules/lidarr';
|
||||
|
||||
@override
|
||||
State<SettingsModulesLidarrRoute> createState() => _State();
|
||||
}
|
||||
|
||||
class _State extends State<SettingsModulesLidarrRoute> {
|
||||
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Scaffold(
|
||||
key: _scaffoldKey,
|
||||
appBar: _appBar,
|
||||
body: _body,
|
||||
);
|
||||
|
||||
Widget get _appBar => LSAppBar(
|
||||
title: 'Lidarr',
|
||||
actions: [
|
||||
LSIconButton(
|
||||
icon: Icons.brush,
|
||||
onPressed: () async => Navigator.of(context).pushNamed(SettingsCustomizationLidarrRoute.ROUTE_NAME),
|
||||
),
|
||||
]
|
||||
);
|
||||
|
||||
Widget get _body => ValueListenableBuilder(
|
||||
valueListenable: Database.profilesBox.listenable(),
|
||||
builder: (context, box, _) => LSListView(
|
||||
children: [
|
||||
..._mandatory,
|
||||
LSDivider(),
|
||||
SettingsModulesLidarrTestConnectionTile(),
|
||||
..._advanced,
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
List<Widget> get _mandatory => [
|
||||
LSHeader(
|
||||
text: 'Mandatory',
|
||||
subtitle: 'Configuration that is required for functionality',
|
||||
),
|
||||
SettingsModulesLidarrEnabledTile(),
|
||||
SettingsModulesLidarrHostTile(),
|
||||
SettingsModulesLidarrAPIKeyTile(),
|
||||
];
|
||||
|
||||
List<Widget> get _advanced => [
|
||||
LSHeader(
|
||||
text: 'Advanced',
|
||||
subtitle: 'Options for non-standard networking configurations',
|
||||
),
|
||||
SettingsModulesLidarrCustomHeadersTile(),
|
||||
SettingsModulesLidarrStrictTLSTile(),
|
||||
];
|
||||
}
|
||||
6
lib/modules/settings/modules/modules_lidarr/widgets.dart
Normal file
6
lib/modules/settings/modules/modules_lidarr/widgets.dart
Normal file
@@ -0,0 +1,6 @@
|
||||
export 'widgets/apikey_tile.dart';
|
||||
export 'widgets/custom_headers_tile.dart';
|
||||
export 'widgets/enabled_tile.dart';
|
||||
export 'widgets/host_tile.dart';
|
||||
export 'widgets/strict_tls_tile.dart';
|
||||
export 'widgets/test_connection_tile.dart';
|
||||
@@ -0,0 +1,28 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
|
||||
class SettingsModulesLidarrAPIKeyTile extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) => LSCardTile(
|
||||
title: LSTitle(text: 'API Key'),
|
||||
subtitle: LSSubtitle(
|
||||
text: Database.currentProfileObject.lidarrKey == null || Database.currentProfileObject.lidarrKey == ''
|
||||
? 'Not Set'
|
||||
: '••••••••••••'
|
||||
),
|
||||
trailing: LSIconButton(icon: Icons.arrow_forward_ios),
|
||||
onTap: () async => _changeKey(context),
|
||||
);
|
||||
|
||||
Future<void> _changeKey(BuildContext context) async {
|
||||
List<dynamic> _values = await GlobalDialogs.editText(
|
||||
context,
|
||||
'Lidarr API Key',
|
||||
prefill: Database.currentProfileObject.lidarrKey ?? '',
|
||||
);
|
||||
if(_values[0]) {
|
||||
Database.currentProfileObject.lidarrKey = _values[1];
|
||||
Database.currentProfileObject.save(context: context);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/settings.dart';
|
||||
|
||||
class SettingsModulesLidarrCustomHeadersTile extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) => LSCardTile(
|
||||
title: LSTitle(text: 'Custom Headers'),
|
||||
subtitle: LSSubtitle(text: 'Add Custom Headers to Requests'),
|
||||
trailing: LSIconButton(icon: Icons.arrow_forward_ios),
|
||||
onTap: () async => Navigator.of(context).pushNamed(SettingsModulesLidarrHeadersRoute.ROUTE_NAME),
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
|
||||
class SettingsModulesLidarrEnabledTile extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) => LSCardTile(
|
||||
title: LSTitle(text: 'Enable Lidarr'),
|
||||
trailing: Switch(
|
||||
value: Database.currentProfileObject.lidarrEnabled ?? false,
|
||||
onChanged: (value) {
|
||||
Database.currentProfileObject.lidarrEnabled = value;
|
||||
Database.currentProfileObject.save(context: context);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/settings.dart';
|
||||
|
||||
class SettingsModulesLidarrHostTile extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) => LSCardTile(
|
||||
title: LSTitle(text: 'Host'),
|
||||
subtitle: LSSubtitle(
|
||||
text: Database.currentProfileObject.lidarrHost == null || Database.currentProfileObject.lidarrHost == ''
|
||||
? 'Not Set'
|
||||
: Database.currentProfileObject.lidarrHost
|
||||
),
|
||||
trailing: LSIconButton(icon: Icons.arrow_forward_ios),
|
||||
onTap: () async => _changeHost(context),
|
||||
);
|
||||
|
||||
Future<void> _changeHost(BuildContext context) async {
|
||||
List<dynamic> _values = await SettingsDialogs.editHost(
|
||||
context,
|
||||
'Lidarr Host',
|
||||
prefill: Database.currentProfileObject.lidarrHost ?? '',
|
||||
);
|
||||
if(_values[0]) {
|
||||
Database.currentProfileObject.lidarrHost = _values[1];
|
||||
Database.currentProfileObject.save(context: context);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/core.dart';
|
||||
import 'package:lunasea/modules/settings.dart';
|
||||
|
||||
class SettingsModulesLidarrStrictTLSTile extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) => LSCardTile(
|
||||
title: LSTitle(text: 'Strict SSL/TLS Validation'),
|
||||
subtitle: LSSubtitle(text: 'For Invalid Certificates'),
|
||||
trailing: Switch(
|
||||
value: Database.currentProfileObject.lidarrStrictTLS ?? true,
|
||||
onChanged: (value) async => _onChanged(context, value),
|
||||
),
|
||||
);
|
||||
|
||||
Future<void> _onChanged(BuildContext context, bool value) async {
|
||||
if(value) {
|
||||
Database.currentProfileObject.lidarrStrictTLS = value;
|
||||
Database.currentProfileObject.save(context: context);
|
||||
} else {
|
||||
List _values = await SettingsDialogs.toggleStrictTLS(context);
|
||||
if(_values[0]) {
|
||||
Database.currentProfileObject.lidarrStrictTLS = value;
|
||||
Database.currentProfileObject.save(context: context);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user