Files
lunasea/lib/modules/lidarr/widgets/missing_tile.dart
Jagandeep Brar 5d36aede4a [Release] v2.3.0 (230004) (#220)
* [Packages] Updated packages
* [Sonarr/Series] Switched to bottom navigation, removed sliver app bar
* [Sonarr/Series] Removed bottom padding from overview
* [README] Added AltStore, Removed Feedback, Updated Android APK Build (#213)
* [Snackbar] Fixed cases where iOS swipe-back would lock UI
* [Android/Back Button] Back button now shows drawer on primary routes instead of closing app
* [Wake on LAN] Added configuration to hive
* [Settings/Modules] Added Wake on LAN section
* [Wake on LAN] Added entry to drawer
* [Lidarr/Details] Removed sliver app bar, removed fanart, switched to bottom navigation bar
* [Radarr/Details] Removed sliver app bar, removed fanart, switched to bottom navigation bar
* [Wake on LAN] Show toast on action
* [Wake on LAN] Created RawDatagramSocket binding
* [WoL] Full support for Wake on LAN functionality
* [Semantics] Cleanup
* [TestFlight] v2.3.0 (230002)
* [Settings/Modules] Implemented settings UI for custom headers
* [Custom Headers] Finished UI implementation
* [Custom Headers] Integrated into API calls
* [TestFlight] v2.3.0 (230003)
* [Images] Attach custom headers to all network image requests
* [Everything] Many Changes (Read Notes) (#218)
    - Unified the structure of each module (core, routes, widgets at the root of every module)
    - Cleaned Most Remaining Dialogs (SABnzbd and NZBGet remain)
    - Reduced font-size across dialogs
    - Unified padding across all dialogs (that have been cleaned so far)
    - Changelog is now a routed page, not a dialog prompt
- SABnzbd: Fixed bug where setting priority to "stop" would cause a fatal crash
* [Networking] Added RegExp Validation for IPv4 & MAC Addresses
* [Networking] Improved network address classes
* Finished Dialog Rework
* [TestFlight] v2.3.0 (230004)
* [README] Updated README for v2.3.0
2020-06-14 23:58:49 -05:00

97 lines
3.3 KiB
Dart

import 'package:flutter/material.dart';
import 'package:lunasea/core.dart';
import '../../lidarr.dart';
class LidarrMissingTile extends StatefulWidget {
final LidarrMissingData entry;
final GlobalKey<ScaffoldState> scaffoldKey;
final Function refresh;
LidarrMissingTile({
@required this.entry,
@required this.scaffoldKey,
@required this.refresh,
});
@override
State<LidarrMissingTile> createState() => _State();
}
class _State extends State<LidarrMissingTile> {
@override
Widget build(BuildContext context) => LSCardTile(
title: LSTitle(text: widget.entry.artistTitle),
subtitle: RichText(
text: TextSpan(
children: <TextSpan>[
TextSpan(
text: widget.entry.title,
style: TextStyle(
color: Colors.white70,
fontStyle: FontStyle.italic,
),
),
TextSpan(
text: '\nReleased ${widget.entry.releaseDateString}',
style: TextStyle(
color: Colors.red,
fontWeight: FontWeight.bold,
),
),
],
),
overflow: TextOverflow.fade,
softWrap: false,
maxLines: 2,
),
trailing: LSIconButton(
icon: Icons.search,
onPressed: () async => _search(),
),
onTap: () async => _enterAlbum(),
onLongPress: () async => _enterArtist(),
decoration: LSCardBackground(
uri: widget.entry.bannerURI(),
headers: Database.currentProfileObject.getLidarr()['headers'],
),
padContent: true,
);
Future<void> _search() async {
final _api = LidarrAPI.from(Database.currentProfileObject);
await _api.searchAlbums([widget.entry.albumID])
.then((_) => LSSnackBar(context: context, title: 'Searching...', message: widget.entry.title))
.catchError((_) => LSSnackBar(context: context, title: 'Failed to Search', message: Constants.CHECK_LOGS_MESSAGE, type: SNACKBAR_TYPE.failure));
}
Future<void> _enterArtist() async {
final dynamic result = await Navigator.of(context).pushNamed(
LidarrDetailsArtist.ROUTE_NAME,
arguments: LidarrDetailsArtistArguments(
data: null,
artistID: widget.entry.artistID,
),
);
if(result != null) switch(result[0]) {
case 'remove_artist': {
LSSnackBar(
context: context,
title: result[1] ? 'Removed (With Data)' : 'Removed',
message: widget.entry.artistTitle,
type: SNACKBAR_TYPE.success,
);
widget.refresh();
break;
}
}
}
Future<void> _enterAlbum() async => await Navigator.of(context).pushNamed(
LidarrDetailsAlbum.ROUTE_NAME,
arguments: LidarrDetailsAlbumArguments(
albumID: widget.entry.albumID,
title: widget.entry.title,
monitored: widget.entry.monitored,
),
);
}