mirror of
https://github.com/jagandeepbrar/lunasea.git
synced 2026-08-31 04:32:32 +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
219 lines
7.2 KiB
Dart
219 lines
7.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:lunasea/core.dart';
|
|
|
|
abstract class LSDialog {
|
|
static const HEADER_SIZE = Constants.UI_FONT_SIZE_HEADER;
|
|
static const BODY_SIZE = Constants.UI_FONT_SIZE_SUBTITLE;
|
|
static const SUBBODY_SIZE = Constants.UI_FONT_SIZE_SUBHEADER;
|
|
static const BUTTON_SIZE = Constants.UI_FONT_SIZE_SUBHEADER;
|
|
|
|
static Widget title({ @required String text }) => Text(
|
|
text,
|
|
textAlign: TextAlign.center,
|
|
style: TextStyle(
|
|
fontSize: LSDialog.HEADER_SIZE,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
);
|
|
|
|
static TextSpan bolded({ @required String text, double fontSize = LSDialog.BODY_SIZE, Color color }) => TextSpan(
|
|
text: text,
|
|
style: TextStyle(
|
|
color: color == null
|
|
? LunaColours.accent
|
|
: color,
|
|
fontWeight: FontWeight.w600,
|
|
fontSize: fontSize,
|
|
),
|
|
);
|
|
|
|
static Widget richText({ @required List<TextSpan> children, TextAlign alignment = TextAlign.start }) => RichText(
|
|
text: TextSpan(
|
|
style: TextStyle(
|
|
fontSize: LSDialog.BODY_SIZE,
|
|
),
|
|
children: children,
|
|
),
|
|
textAlign: alignment,
|
|
);
|
|
|
|
static Widget button({ @required String text, @required void Function() onPressed, Color textColor }) => FlatButton(
|
|
child: Text(
|
|
text,
|
|
style: TextStyle(
|
|
color: textColor == null
|
|
? LunaColours.accent
|
|
: textColor,
|
|
fontSize: LSDialog.BUTTON_SIZE,
|
|
),
|
|
),
|
|
onPressed: onPressed,
|
|
);
|
|
|
|
static Widget cancel(BuildContext context, { Color textColor = Colors.white }) => FlatButton(
|
|
child: Text(
|
|
'Cancel',
|
|
style: TextStyle(
|
|
color: textColor,
|
|
fontSize: LSDialog.BUTTON_SIZE,
|
|
),
|
|
),
|
|
onPressed: () => Navigator.of(context).pop(),
|
|
);
|
|
|
|
static Widget content({ @required List<Widget> children }) => SingleChildScrollView(
|
|
child: ListBody(
|
|
children: children,
|
|
),
|
|
padding: EdgeInsets.fromLTRB(0.0, 0.0, 0.0, 1.0),
|
|
);
|
|
|
|
static Widget textContent({ @required String text, TextAlign textAlign = TextAlign.center }) => Text(
|
|
text,
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: LSDialog.BODY_SIZE,
|
|
),
|
|
textAlign: textAlign,
|
|
);
|
|
|
|
static TextSpan textSpanContent({ @required String text }) => TextSpan(
|
|
text: text,
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: LSDialog.BODY_SIZE,
|
|
),
|
|
);
|
|
|
|
static Widget textInput({
|
|
@required TextEditingController controller,
|
|
@required Function(String) onSubmitted,
|
|
@required String title,
|
|
}) => TextField(
|
|
autofocus: true,
|
|
autocorrect: false,
|
|
controller: controller,
|
|
decoration: InputDecoration(
|
|
labelText: title,
|
|
labelStyle: TextStyle(
|
|
color: Colors.white54,
|
|
decoration: TextDecoration.none,
|
|
fontSize: LSDialog.BODY_SIZE,
|
|
),
|
|
focusedBorder: UnderlineInputBorder(
|
|
borderSide: BorderSide(color: LunaColours.accent),
|
|
),
|
|
enabledBorder: UnderlineInputBorder(
|
|
borderSide: BorderSide(color: LunaColours.accent.withOpacity(0.3)),
|
|
),
|
|
),
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: LSDialog.BODY_SIZE,
|
|
),
|
|
cursorColor: LunaColours.accent,
|
|
textInputAction: TextInputAction.done,
|
|
onSubmitted: onSubmitted,
|
|
);
|
|
|
|
static Widget textFormInput({
|
|
@required TextEditingController controller,
|
|
@required String title,
|
|
@required Function(String) onSubmitted,
|
|
@required Function(String) validator,
|
|
bool obscureText = false,
|
|
TextInputType keyboardType = TextInputType.text,
|
|
}) => TextFormField(
|
|
autofocus: true,
|
|
autocorrect: false,
|
|
controller: controller,
|
|
obscureText: obscureText,
|
|
keyboardType: keyboardType,
|
|
decoration: InputDecoration(
|
|
labelText: title,
|
|
labelStyle: TextStyle(
|
|
color: Colors.white54,
|
|
decoration: TextDecoration.none,
|
|
fontSize: LSDialog.BODY_SIZE,
|
|
),
|
|
focusedBorder: UnderlineInputBorder(
|
|
borderSide: BorderSide(color: LunaColours.accent),
|
|
),
|
|
enabledBorder: UnderlineInputBorder(
|
|
borderSide: BorderSide(color: LunaColours.accent.withOpacity(0.3)),
|
|
),
|
|
),
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: LSDialog.BODY_SIZE,
|
|
),
|
|
cursorColor: LunaColours.accent,
|
|
textInputAction: TextInputAction.done,
|
|
validator: validator,
|
|
onFieldSubmitted: onSubmitted,
|
|
);
|
|
|
|
static Widget tile({
|
|
@required IconData icon,
|
|
Color iconColor,
|
|
@required String text,
|
|
RichText subtitle,
|
|
@required Function onTap,
|
|
}) => ListTile(
|
|
leading: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: <Widget>[
|
|
LSIcon(
|
|
icon: icon ?? Icons.error_outline,
|
|
color: iconColor ?? LunaColours.accent,
|
|
),
|
|
],
|
|
),
|
|
title: Text(
|
|
text,
|
|
style: TextStyle(
|
|
fontSize: LSDialog.BODY_SIZE,
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
subtitle: text == null
|
|
? null
|
|
: subtitle,
|
|
onTap: onTap,
|
|
contentPadding: tileContentPadding(),
|
|
);
|
|
|
|
static EdgeInsets tileContentPadding() => EdgeInsets.fromLTRB(32.0, 0.0, 16.0, 0.0);
|
|
static EdgeInsets textDialogContentPadding() => EdgeInsets.fromLTRB(24.0, 32.0, 24.0, 14.0);
|
|
static EdgeInsets listDialogContentPadding() => EdgeInsets.fromLTRB(0.0, 26.0, 24.0, 0.0);
|
|
static EdgeInsets inputTextDialogContentPadding() => EdgeInsets.fromLTRB(24.0, 34.0, 24.0, 22.0);
|
|
static EdgeInsets inputDialogContentPadding() => EdgeInsets.fromLTRB(24.0, 24.0, 24.0, 22.0);
|
|
|
|
static Future<void> dialog({
|
|
@required BuildContext context,
|
|
@required String title,
|
|
@required List<Widget> content,
|
|
@required EdgeInsets contentPadding,
|
|
List<Widget> buttons,
|
|
}) async {
|
|
await showDialog(
|
|
context: context,
|
|
builder: (context) => AlertDialog(
|
|
actions: <Widget>[
|
|
LSDialog.cancel(
|
|
context,
|
|
textColor: buttons != null ? Colors.white : LunaColours.accent,
|
|
),
|
|
if(buttons != null) ...buttons,
|
|
],
|
|
title: LSDialog.title(text: title),
|
|
content: LSDialog.content(children: content),
|
|
contentPadding: contentPadding,
|
|
shape: LunaSeaDatabaseValue.THEME_AMOLED.data && LunaSeaDatabaseValue.THEME_AMOLED_BORDER.data
|
|
? LSRoundedShapeWithBorder()
|
|
: LSRoundedShape(),
|
|
),
|
|
);
|
|
}
|
|
}
|