Files
lunasea/lib/core/luna_ui/input_bar.dart
Jagandeep Brar 4340853b8c [Release] v5.0.0 (50000001) (#312)
NEW
- [Radarr] Completely rewritten from the ground-up
- [Radarr] View system status, disk usage, and manage tags
- [Radarr] Catalogue, upcoming, missing, tags, and quality profiles are now held in-state between module switches
- [Radarr/Add] Long-pressing a search result tile will open the movie's TMDB entry
- [Radarr/History] Now an infinite scrolling list
- [Radarr/Movie] Cast information, movie-specific history, more detailed file information, more detailed overview page
- [Radarr/Filtering] Improved sorting and filtering speed, performance, and consistency
- [Radarr/Filtering] Ability to set sorting and filtering defaults in settings
- [Radarr/Filtering] Many additional filtering options
- [Haptics] Added haptic feedback to all buttons, toggles, and dropdowns
- [Quick Actions] Default "Settings" quick action added to end of the list (if there is room)
- [UI/UX] (Radarr Only For Now) Ability to tap the AppBar to scroll to top
- [UI/UX] (Radarr Only For Now) If the list is in a tabbed PageView, tapping the active tab will scroll the list to the top
- [UI/UX] (Radarr Only For Now) If the keyboard is open, scrolling the list, swiping between pages, or opening the drawer will dismiss the keyboard
- [Webhooks] Notification webhooks will now show as an in-app heads up if LunaSea is open at the time of receiving the notification

TWEAKS
- [Radarr] Now only supports v3.0.0 and higher of Radarr
- [Radarr] Many visual changes, too many to list
- [Radarr] The tab "History" has been replaced with "More"
- [Radarr/Edit] Monitor toggle has been moved to the edit prompt
- [Sonarr/Filtering] Updated button to use standard filtering icon
- [Tautulli/Activity] Show session type and bandwidth type breakdown on activity page
- [Tautulli/Activity] Cleanup player information to more closely resemble web GUI
- [Tautulli/Activity] Show subtitle stream decision
- [UI/UX] Reduced the weight of bold text across the application
- [UI/UX] Added padding to bottom of lists for devices that require a safe area
- [UI/UX] Active tab in navigation bar now has a border with the AMOLED theme

FIXES
- [Changelog] Properly align/pad "Full Changelog" button at the end of the changelog
- [Flutter] Update packages
- [Flutter] Now using the beta channel
- [Quick Actions] Improve internal implementation of quick actions to be more stable and reliable
- [Settings/Modules] Newly set headers would sometimes not be passed to the connection test
- [Sonarr/Edit] Series path prompt would show an incorrect title
- [Sonarr/Description] Show "No summary is available" when there is no summary instead of an empty string
- [Sonarr/Releases] Default sorting direction was using catalogue default value
- [Tautulli/Graphs] Description of some graphs were not correct (Thanks @ZuluWhiskey!)
- [Tautulli/IPs] Fix location showing as null for local addresses
- [UI/UX] Border radius for the splash highlight wouldn't clip correctly on slim buttons
- [UI/UX] Margin/size of sort/filter buttons were off by a few pixels
- [UI/UX] InkWell splash now clips correctly to the rounded borders of popup menu buttons
2021-02-16 22:51:43 -06:00

125 lines
4.0 KiB
Dart

import 'package:flutter/material.dart';
import 'package:lunasea/core.dart';
class LunaTextInputBar extends StatefulWidget {
final TextEditingController controller;
final TextInputAction action;
final TextInputType keyboardType;
final Iterable<String> autofillHints;
final String labelText;
final IconData labelIcon;
final bool autofocus;
final bool obscureText;
final bool isFormField;
final void Function(String) onChanged;
final void Function(String) onSubmitted;
final String Function(String) validator;
final EdgeInsets margin;
LunaTextInputBar({
@required this.controller,
this.onChanged,
this.onSubmitted,
this.validator,
this.autofillHints,
this.action = TextInputAction.search,
this.keyboardType = TextInputType.text,
this.labelText = 'Search...',
this.labelIcon = Icons.search,
this.margin = LunaUI.MARGIN_CARD,
this.autofocus = false,
this.obscureText = false,
this.isFormField = false,
}) {
assert(controller != null);
}
@override
State<StatefulWidget> createState() => _State();
}
class _State extends State<LunaTextInputBar> {
bool _isFocused = false;
@override
Widget build(BuildContext context) => LSCard(
margin: widget.margin,
child: FocusScope(
child: Focus(
onFocusChange: (value) => setState(() => _isFocused = value),
child: widget.isFormField ? _isForm : _isNotForm,
),
),
color: Theme.of(context).canvasColor,
);
TextStyle get _sharedTextStyle => TextStyle(
color: Colors.white,
fontSize: Constants.UI_FONT_SIZE_SUBTITLE,
);
InputDecoration get _sharedInputDecoration => InputDecoration(
labelText: widget.labelText,
labelStyle: TextStyle(
color: Colors.white54,
decoration: TextDecoration.none,
fontSize: Constants.UI_FONT_SIZE_SUBTITLE,
),
suffixIcon: AnimatedOpacity(
child: GestureDetector(
child: Icon(
Icons.close,
color: LunaColours.accent,
size: 24.0,
),
onTap: widget.onChanged == null ? null : () {
widget.controller.text = '';
widget.onChanged('');
}
),
opacity: !_isFocused || widget.controller.text == '' ? 0.0 : 1.0,
duration: Duration(milliseconds: 200),
),
icon: Padding(
child: Icon(
widget.labelIcon,
color: LunaColours.accent,
),
padding: EdgeInsets.only(left: 16.0),
),
border: InputBorder.none,
contentPadding: EdgeInsets.symmetric(vertical: 8.0),
);
TextFormField get _isForm => TextFormField(
autofillHints: widget.autofillHints,
autofocus: widget.autofocus,
controller: widget.controller,
decoration: _sharedInputDecoration,
style: _sharedTextStyle,
cursorColor: LunaColours.accent,
textInputAction: widget.action,
obscureText: widget.obscureText,
autocorrect: false,
keyboardType: widget.keyboardType,
validator: widget?.validator,
onChanged: widget.onChanged == null ? null : widget.onChanged,
onFieldSubmitted: widget?.onSubmitted,
);
TextField get _isNotForm => TextField(
autofillHints: widget.autofillHints,
autofocus: widget.autofocus,
controller: widget.controller,
decoration: _sharedInputDecoration,
style: _sharedTextStyle,
cursorColor: LunaColours.accent,
textInputAction: widget.action,
obscureText: widget.obscureText,
autocorrect: false,
keyboardType: widget.keyboardType,
onChanged: widget.onChanged == null ? null : widget.onChanged,
onSubmitted: widget?.onSubmitted,
);
}