Files
lunasea/lib/core/dialogs.dart
Jagandeep Brar 7656943a52 [Release] v3.0.0 (300100) (#223)
* [UI] Rounded all tile elements
* [UI] Scaled entire UI down a few font sizes
* [UI] Increase drawer font size, decrease PopupMenu font size
* [UI] Sticky headers are now attached to AppBar
* [TestFlight] v2.4.0 (240001)
* [Clients/Queue] Animated play/pause icon
* [Radarr] Releases are now shown as expandable tiles
* [Headers] Match button size to input bar
* [UI/Divider] Darken colour, slim down
* [Sonarr/Releases] Updated release tiles to expandable tiles
* [Sonarr] Removed sticky headers in upcoming & season details
* [Sonarr] Remove unused routes
* [Lidarr/Releases] Updated to expanded tile format
* [Search] Updated result tiles to be expandable
* [TestFlight] v2.4.0 (240002)
* [Lists] Require or create a ScrollController for all LSLists
* [Sonarr] Episode tiles now expandable, fixed statistics data crash
* [TestFlight] v2.4.0 (240003)
* [Popup Menu] Rounded shape on popup menus
* [Sonarr] More sorting options for Sonarr catalogue & releases
* [Sonarr/Catalogue] Sort by quality using id, not name
* [AMOLED] Optional setting to add UI borders
* [Refactor] Some file name changes
* [Database] Cleanup reads and updates to database
* [Module Flags] Hiding -rr's wouldn't hide the calendar setting
* [Dropdowns] Changed remaining dropdowns to popup menus
* [Sonarr] Safe-guard fetching episode queue
* [TestFlight] v2.4.0 (240006)
* [Changelog] Remove routes, redirect to documentation
* [Search] Added sorting options to search/results, filter for results
* [Sonarr/Add] Ability to set initial episode monitor status
* [Images] Option to clear network image cache
* [TestFlight] v3.0.0 (300001)
* [Tweaks] Small tweaks to text, typos
* [TestFlight] v3.0.0 (300002)
* [Lidarr] Additional sorting options for catalogue
* [Sonarr/Episode] Fix episode list crash
* [Lidarr/Releases] Added widgets for hide, filter, sort
* [Lidarr/Releases] Implemented sort, hide, and filter functionality
* [TestFlight] v3.0.0 (300003)
* [README] Added CI shield, updated version
* [Sonarr] Ability to set initial page
* [Radarr] Ability to set initial page
* [Lidarr] Ability to set initial page
* [NZBGet] Ability to set initial page
* [SABnzbd] Ability to set initial page
* [Home] Ability to set initial page
* [Radarr] Implemented new sorting structure
* [Radarr] Implemented filter, hide, and sorting of releases
* [Radarr] Additional catalogue sorting methods
* [TestFlight] v3.0.0 (300100)
2020-06-30 03:34:45 -05:00

99 lines
3.3 KiB
Dart

import 'package:flutter/material.dart';
import 'package:lunasea/core.dart';
class GlobalDialogs {
GlobalDialogs._();
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).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.button(
text: 'Close',
onPressed: () => Navigator.of(context).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).pop();
}
await LSDialog.dialog(
context: context,
title: 'Delete All Files',
buttons: [
LSDialog.button(
text: 'Delete',
textColor: LSColors.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];
}
}