Add option to disable thumbnails
This commit is contained in:
parent
e0b2fcc0b3
commit
590f723e2e
6 changed files with 56 additions and 21 deletions
|
|
@ -95,6 +95,7 @@ class CategoryStreams extends StatelessWidget {
|
|||
width: thumbnailWidth,
|
||||
height: thumbnailHeight,
|
||||
showUptime: context.read<SettingsStore>().showThumbnailUptime,
|
||||
showThumbnail: context.read<SettingsStore>().showThumbnails,
|
||||
showCategory: false,
|
||||
),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ class StreamCard extends StatelessWidget {
|
|||
final int width;
|
||||
final int height;
|
||||
final bool showUptime;
|
||||
final bool showThumbnail;
|
||||
final bool showCategory;
|
||||
|
||||
const StreamCard({
|
||||
|
|
@ -29,6 +30,7 @@ class StreamCard extends StatelessWidget {
|
|||
required this.width,
|
||||
required this.height,
|
||||
required this.showUptime,
|
||||
required this.showThumbnail,
|
||||
this.showCategory = true,
|
||||
}) : super(key: key);
|
||||
|
||||
|
|
@ -69,28 +71,29 @@ class StreamCard extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 15.0),
|
||||
padding: EdgeInsets.symmetric(vertical: 10.0, horizontal: showThumbnail ? 15.0 : 5.0),
|
||||
child: Row(
|
||||
children: [
|
||||
Flexible(
|
||||
flex: 1,
|
||||
child: showUptime
|
||||
? Stack(
|
||||
alignment: AlignmentDirectional.bottomEnd,
|
||||
children: [
|
||||
thumbnail,
|
||||
Container(
|
||||
color: const Color.fromRGBO(0, 0, 0, 0.5),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 2.0),
|
||||
child: Text(
|
||||
DateTime.now().difference(DateTime.parse(streamInfo.startedAt)).toString().split('.')[0],
|
||||
style: const TextStyle(fontSize: 12, color: Colors.white),
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
: thumbnail,
|
||||
),
|
||||
if (showThumbnail)
|
||||
Flexible(
|
||||
flex: 1,
|
||||
child: showUptime
|
||||
? Stack(
|
||||
alignment: AlignmentDirectional.bottomEnd,
|
||||
children: [
|
||||
thumbnail,
|
||||
Container(
|
||||
color: const Color.fromRGBO(0, 0, 0, 0.5),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 2.0),
|
||||
child: Text(
|
||||
DateTime.now().difference(DateTime.parse(streamInfo.startedAt)).toString().split('.')[0],
|
||||
style: const TextStyle(fontSize: 12, color: Colors.white),
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
: thumbnail,
|
||||
),
|
||||
Flexible(
|
||||
flex: 2,
|
||||
child: Padding(
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ class _StreamsListState extends State<StreamsList> with AutomaticKeepAliveClient
|
|||
streamInfo: _listStore.streams[index],
|
||||
width: thumbnailWidth,
|
||||
height: thumbnailHeight,
|
||||
showThumbnail: context.read<SettingsStore>().showThumbnails,
|
||||
showUptime: context.read<SettingsStore>().showThumbnailUptime,
|
||||
),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -35,12 +35,17 @@ class GeneralSettings extends StatelessWidget {
|
|||
.toList(),
|
||||
),
|
||||
),
|
||||
SwitchListTile.adaptive(
|
||||
title: const Text('Stream Card Thumbnails'),
|
||||
value: settingsStore.showThumbnails,
|
||||
onChanged: (newValue) => settingsStore.showThumbnails = newValue,
|
||||
),
|
||||
SwitchListTile.adaptive(
|
||||
isThreeLine: true,
|
||||
title: const Text('Stream Uptime on Thumbnails'),
|
||||
subtitle: const Text('Displays the uptime of the stream in the HH:MM:SS format.'),
|
||||
value: settingsStore.showThumbnailUptime,
|
||||
onChanged: (newValue) => settingsStore.showThumbnailUptime = newValue,
|
||||
onChanged: settingsStore.showThumbnails ? (newValue) => settingsStore.showThumbnailUptime = newValue : null,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@ abstract class _SettingsStoreBase with Store {
|
|||
|
||||
static const defaultShowThumbnailUptime = false;
|
||||
|
||||
static const defaultShowThumbnails = true;
|
||||
|
||||
@JsonKey(defaultValue: defaultThemeType, unknownEnumValue: ThemeType.system)
|
||||
@observable
|
||||
var themeType = defaultThemeType;
|
||||
|
|
@ -25,6 +27,10 @@ abstract class _SettingsStoreBase with Store {
|
|||
@observable
|
||||
var showThumbnailUptime = defaultShowThumbnailUptime;
|
||||
|
||||
@JsonKey(defaultValue: defaultShowThumbnails)
|
||||
@observable
|
||||
var showThumbnails = defaultShowThumbnails;
|
||||
|
||||
// * Video Settings
|
||||
static const defaultShowVideo = true;
|
||||
|
||||
|
|
@ -142,6 +148,7 @@ abstract class _SettingsStoreBase with Store {
|
|||
// * General Settings
|
||||
themeType = defaultThemeType;
|
||||
showThumbnailUptime = defaultShowThumbnailUptime;
|
||||
showThumbnails = defaultShowThumbnails;
|
||||
|
||||
// * Video Settings
|
||||
showVideo = defaultShowVideo;
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ SettingsStore _$SettingsStoreFromJson(Map<String, dynamic> json) =>
|
|||
unknownValue: ThemeType.system) ??
|
||||
ThemeType.system
|
||||
..showThumbnailUptime = json['showThumbnailUptime'] as bool? ?? false
|
||||
..showThumbnails = json['showThumbnails'] as bool? ?? true
|
||||
..showVideo = json['showVideo'] as bool? ?? true
|
||||
..showOverlay = json['showOverlay'] as bool? ?? true
|
||||
..toggleableOverlay = json['toggleableOverlay'] as bool? ?? false
|
||||
|
|
@ -39,6 +40,7 @@ Map<String, dynamic> _$SettingsStoreToJson(SettingsStore instance) =>
|
|||
<String, dynamic>{
|
||||
'themeType': _$ThemeTypeEnumMap[instance.themeType],
|
||||
'showThumbnailUptime': instance.showThumbnailUptime,
|
||||
'showThumbnails': instance.showThumbnails,
|
||||
'showVideo': instance.showVideo,
|
||||
'showOverlay': instance.showOverlay,
|
||||
'toggleableOverlay': instance.toggleableOverlay,
|
||||
|
|
@ -110,6 +112,21 @@ mixin _$SettingsStore on _SettingsStoreBase, Store {
|
|||
});
|
||||
}
|
||||
|
||||
final _$showThumbnailsAtom = Atom(name: '_SettingsStoreBase.showThumbnails');
|
||||
|
||||
@override
|
||||
bool get showThumbnails {
|
||||
_$showThumbnailsAtom.reportRead();
|
||||
return super.showThumbnails;
|
||||
}
|
||||
|
||||
@override
|
||||
set showThumbnails(bool value) {
|
||||
_$showThumbnailsAtom.reportWrite(value, super.showThumbnails, () {
|
||||
super.showThumbnails = value;
|
||||
});
|
||||
}
|
||||
|
||||
final _$showVideoAtom = Atom(name: '_SettingsStoreBase.showVideo');
|
||||
|
||||
@override
|
||||
|
|
@ -405,6 +422,7 @@ mixin _$SettingsStore on _SettingsStoreBase, Store {
|
|||
return '''
|
||||
themeType: ${themeType},
|
||||
showThumbnailUptime: ${showThumbnailUptime},
|
||||
showThumbnails: ${showThumbnails},
|
||||
showVideo: ${showVideo},
|
||||
showOverlay: ${showOverlay},
|
||||
toggleableOverlay: ${toggleableOverlay},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue