mirror of
https://github.com/jagandeepbrar/lunasea.git
synced 2026-08-30 20:24:25 +00:00
NEW - [Networking] Strict TLS/SSL validation is now disabled globally - [Routing] Hold the AppBar back button to pop back to the home page of the module - [Settings/Sonarr] Toggle to enable Sonarr v3 features - [Sonarr] Complete rewrite of Sonarr - [Sonarr] State is now held across module switches - [Sonarr/Overview] View tags applied to series - [Sonarr/Catalogue] (v3 only) Ability to set and update language profile - [Sonarr/Catalogue] Ability to view all, only monitored, or only unmonitored series - [Sonarr/Releases] (v3 only) Ability to interactively search for season packs - [Sonarr/Releases] Ability to view all, only approved, or only rejected releases TWEAKS - [Settings] Removed all toggles for strict TLS - [Sonarr] Many tweaks to Sonarr's design - [Sonarr/Add] (v3 only) Tapping an already-added series will take you to the series page - [Sonarr/Add] Automatically navigate to newly added series - [Sonarr/Series] Toggling monitored state of series has now been moved to the edit prompt FIXES - [Images] Images will now load for invalid/self-signed certificates - [Tautulli/Activity] Fix grey screen for music activity - [TextField] Fix TextField actions (cut, copy, paste, etc.) not showing - [Timestamps] Fix 12:xx AM being shown as 00:xx AM - Additional small bug fixes
110 lines
3.9 KiB
Dart
110 lines
3.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:lunasea/core.dart';
|
|
|
|
class LunaDialogs {
|
|
LunaDialogs._();
|
|
|
|
static Future<List<dynamic>> editText(BuildContext context, String title, { String prefill = '' }) async {
|
|
bool _flag = false;
|
|
final _formKey = GlobalKey<FormState>();
|
|
final _textController = TextEditingController()..text = prefill;
|
|
|
|
void _setValues(bool flag) {
|
|
if(_formKey.currentState.validate()) {
|
|
_flag = flag;
|
|
Navigator.of(context, rootNavigator: true).pop();
|
|
}
|
|
}
|
|
|
|
await LSDialog.dialog(
|
|
context: context,
|
|
title: title,
|
|
buttons: [
|
|
LSDialog.button(
|
|
text: 'Save',
|
|
onPressed: () => _setValues(true),
|
|
),
|
|
],
|
|
content: [
|
|
Form(
|
|
key: _formKey,
|
|
child: LSDialog.textFormInput(
|
|
controller: _textController,
|
|
title: title,
|
|
onSubmitted: (_) => _setValues(true),
|
|
validator: (_) => null,
|
|
),
|
|
),
|
|
],
|
|
contentPadding: LSDialog.inputDialogContentPadding(),
|
|
);
|
|
return [_flag, _textController.text];
|
|
}
|
|
|
|
static Future<void> textPreview(BuildContext context, String title, String text, { bool alignLeft = false }) async {
|
|
await showDialog(
|
|
context: context,
|
|
builder: (context) => AlertDialog(
|
|
actions: <Widget>[
|
|
LSDialog.cancel(context),
|
|
LSDialog.button(
|
|
text: 'Copy',
|
|
onPressed: () async {
|
|
await Clipboard.setData(ClipboardData(text: text));
|
|
LSSnackBar(
|
|
context: context,
|
|
title: 'Copied Content',
|
|
message: 'Copied text to the clipboard',
|
|
type: SNACKBAR_TYPE.info,
|
|
);
|
|
Navigator.of(context, rootNavigator: true).pop();
|
|
},
|
|
),
|
|
],
|
|
title: LSDialog.title(text: title),
|
|
content: LSDialog.content(
|
|
children: [
|
|
LSDialog.textContent(
|
|
text: text,
|
|
textAlign: alignLeft
|
|
? TextAlign.left
|
|
: TextAlign.center,
|
|
),
|
|
],
|
|
),
|
|
contentPadding: LSDialog.textDialogContentPadding(),
|
|
shape: LunaSeaDatabaseValue.THEME_AMOLED.data && LunaSeaDatabaseValue.THEME_AMOLED_BORDER.data
|
|
? LSRoundedShapeWithBorder()
|
|
: LSRoundedShape(),
|
|
),
|
|
);
|
|
}
|
|
|
|
static Future<List<dynamic>> deleteCatalogueWithFiles(BuildContext context, String title) async {
|
|
bool _flag = false;
|
|
|
|
void _setValues(bool flag) {
|
|
_flag = flag;
|
|
Navigator.of(context, rootNavigator: true).pop();
|
|
}
|
|
|
|
await LSDialog.dialog(
|
|
context: context,
|
|
title: 'Delete All Files',
|
|
buttons: [
|
|
LSDialog.button(
|
|
text: 'Delete',
|
|
textColor: LunaColours.red,
|
|
onPressed: () => _setValues(true),
|
|
),
|
|
],
|
|
content: [
|
|
LSDialog.textContent(text: 'Are you sure you want to delete all the files and folders for $title?'),
|
|
],
|
|
contentPadding: LSDialog.textDialogContentPadding(),
|
|
);
|
|
return [_flag];
|
|
}
|
|
}
|