mirror of
https://github.com/jagandeepbrar/lunasea.git
synced 2026-08-31 12:42:34 +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
90 lines
3.7 KiB
Dart
90 lines
3.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:lunasea/core.dart';
|
|
import 'package:tuple/tuple.dart';
|
|
import 'package:lunasea/modules/nzbget.dart';
|
|
|
|
class NZBGetAppBarStats extends StatelessWidget {
|
|
@override
|
|
Widget build(BuildContext context) => Selector<NZBGetState, Tuple5<bool, String, String, String, String>>(
|
|
selector: (_, model) => Tuple5(
|
|
model.paused, //item1
|
|
model.currentSpeed, //item2
|
|
model.queueTimeLeft, //item3
|
|
model.queueSizeLeft, //item4
|
|
model.speedLimit, //item5
|
|
),
|
|
builder: (context, data, widget) => GestureDetector(
|
|
onTap: () async => _onTap(context, data.item5),
|
|
child: Center(
|
|
child: RichText(
|
|
text: TextSpan(
|
|
style: TextStyle(
|
|
color: Colors.white54,
|
|
fontSize: Constants.UI_FONT_SIZE_SUBTITLE,
|
|
),
|
|
children: [
|
|
TextSpan(
|
|
text: _status(data.item1, data.item2),
|
|
style: TextStyle(
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: Constants.UI_FONT_SIZE_HEADER,
|
|
color: LunaColours.accent,
|
|
),
|
|
),
|
|
TextSpan(text: '\n'),
|
|
TextSpan(text: data.item3 == '0:00:00' ? '―' : data.item3),
|
|
TextSpan(text: '\t\t•\t\t'),
|
|
TextSpan(text: data.item4 == '0.0 B' ? '―' : data.item4)
|
|
],
|
|
),
|
|
overflow: TextOverflow.fade,
|
|
maxLines: 2,
|
|
softWrap: false,
|
|
textAlign: TextAlign.right,
|
|
),
|
|
),
|
|
),
|
|
);
|
|
|
|
String _status(bool paused, String speed) => paused
|
|
? 'Paused'
|
|
: speed == '0.0 B/s'
|
|
? 'Idle'
|
|
: speed;
|
|
|
|
Future<void> _onTap(BuildContext context, String speed) async {
|
|
List values = await NZBGetDialogs.speedLimit(context, speed);
|
|
if(values[0]) switch(values[1]) {
|
|
case -1: {
|
|
values = await NZBGetDialogs.customSpeedLimit(context);
|
|
if(values[0]) NZBGetAPI.from(Database.currentProfileObject).setSpeedLimit(values[1])
|
|
.then((_) => LSSnackBar(
|
|
context: context,
|
|
title: 'Speed Limit Set',
|
|
message: 'Set to ${(values[1] as int).lsBytes_KilobytesToString(decimals: 0)}/s',
|
|
type: SNACKBAR_TYPE.success,
|
|
))
|
|
.catchError((_) => LSSnackBar(
|
|
context: context,
|
|
title: 'Failed to Set Speed Limit',
|
|
message: Constants.CHECK_LOGS_MESSAGE,
|
|
type: SNACKBAR_TYPE.failure,
|
|
));
|
|
break;
|
|
}
|
|
default: NZBGetAPI.from(Database.currentProfileObject).setSpeedLimit(values[1])
|
|
.then((_) => LSSnackBar(
|
|
context: context,
|
|
title: 'Speed Limit Set',
|
|
message: 'Set to ${(values[1] as int).lsBytes_KilobytesToString(decimals: 0)}/s',
|
|
type: SNACKBAR_TYPE.success,
|
|
))
|
|
.catchError((_) => LSSnackBar(
|
|
context: context,
|
|
title: 'Failed to Set Speed Limit',
|
|
message: Constants.CHECK_LOGS_MESSAGE,
|
|
type: SNACKBAR_TYPE.failure,
|
|
));
|
|
}
|
|
}
|
|
} |