chore: Shortcuts improvements (#446)

Co-authored-by: PartyDonut <PartyDonut@users.noreply.github.com>
This commit is contained in:
PartyDonut 2025-08-09 16:17:14 +02:00 committed by GitHub
parent d0d6a2ffa6
commit 70e346b8a2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 481 additions and 198 deletions

View file

@ -79,7 +79,7 @@ class ClientSettingsModel with _$ClientSettingsModel {
@Default(false) bool usePosterForLibrary,
String? lastViewedUpdate,
int? libraryPageSize,
@Default({}) Map<GlobalHotKeys, KeyCombination?> shortcuts,
@Default({}) Map<GlobalHotKeys, KeyCombination> shortcuts,
}) = _ClientSettingsModel;
factory ClientSettingsModel.fromJson(Map<String, dynamic> json) => _$ClientSettingsModelFromJson(json);

View file

@ -45,7 +45,7 @@ mixin _$ClientSettingsModel {
bool get usePosterForLibrary => throw _privateConstructorUsedError;
String? get lastViewedUpdate => throw _privateConstructorUsedError;
int? get libraryPageSize => throw _privateConstructorUsedError;
Map<GlobalHotKeys, KeyCombination?> get shortcuts =>
Map<GlobalHotKeys, KeyCombination> get shortcuts =>
throw _privateConstructorUsedError;
/// Serializes this ClientSettingsModel to a JSON map.
@ -89,7 +89,7 @@ abstract class $ClientSettingsModelCopyWith<$Res> {
bool usePosterForLibrary,
String? lastViewedUpdate,
int? libraryPageSize,
Map<GlobalHotKeys, KeyCombination?> shortcuts});
Map<GlobalHotKeys, KeyCombination> shortcuts});
}
/// @nodoc
@ -233,7 +233,7 @@ class _$ClientSettingsModelCopyWithImpl<$Res, $Val extends ClientSettingsModel>
shortcuts: null == shortcuts
? _value.shortcuts
: shortcuts // ignore: cast_nullable_to_non_nullable
as Map<GlobalHotKeys, KeyCombination?>,
as Map<GlobalHotKeys, KeyCombination>,
) as $Val);
}
}
@ -271,7 +271,7 @@ abstract class _$$ClientSettingsModelImplCopyWith<$Res>
bool usePosterForLibrary,
String? lastViewedUpdate,
int? libraryPageSize,
Map<GlobalHotKeys, KeyCombination?> shortcuts});
Map<GlobalHotKeys, KeyCombination> shortcuts});
}
/// @nodoc
@ -413,7 +413,7 @@ class __$$ClientSettingsModelImplCopyWithImpl<$Res>
shortcuts: null == shortcuts
? _value._shortcuts
: shortcuts // ignore: cast_nullable_to_non_nullable
as Map<GlobalHotKeys, KeyCombination?>,
as Map<GlobalHotKeys, KeyCombination>,
));
}
}
@ -447,7 +447,7 @@ class _$ClientSettingsModelImpl extends _ClientSettingsModel
this.usePosterForLibrary = false,
this.lastViewedUpdate,
this.libraryPageSize,
final Map<GlobalHotKeys, KeyCombination?> shortcuts = const {}})
final Map<GlobalHotKeys, KeyCombination> shortcuts = const {}})
: _shortcuts = shortcuts,
super._();
@ -521,10 +521,10 @@ class _$ClientSettingsModelImpl extends _ClientSettingsModel
final String? lastViewedUpdate;
@override
final int? libraryPageSize;
final Map<GlobalHotKeys, KeyCombination?> _shortcuts;
final Map<GlobalHotKeys, KeyCombination> _shortcuts;
@override
@JsonKey()
Map<GlobalHotKeys, KeyCombination?> get shortcuts {
Map<GlobalHotKeys, KeyCombination> get shortcuts {
if (_shortcuts is EqualUnmodifiableMapView) return _shortcuts;
// ignore: implicit_dynamic_type
return EqualUnmodifiableMapView(_shortcuts);
@ -612,7 +612,7 @@ abstract class _ClientSettingsModel extends ClientSettingsModel {
final bool usePosterForLibrary,
final String? lastViewedUpdate,
final int? libraryPageSize,
final Map<GlobalHotKeys, KeyCombination?> shortcuts}) =
final Map<GlobalHotKeys, KeyCombination> shortcuts}) =
_$ClientSettingsModelImpl;
_ClientSettingsModel._() : super._();
@ -669,7 +669,7 @@ abstract class _ClientSettingsModel extends ClientSettingsModel {
@override
int? get libraryPageSize;
@override
Map<GlobalHotKeys, KeyCombination?> get shortcuts;
Map<GlobalHotKeys, KeyCombination> get shortcuts;
/// Create a copy of ClientSettingsModel
/// with the given fields replaced by the non-null parameter values.

View file

@ -49,11 +49,8 @@ _$ClientSettingsModelImpl _$$ClientSettingsModelImplFromJson(
lastViewedUpdate: json['lastViewedUpdate'] as String?,
libraryPageSize: (json['libraryPageSize'] as num?)?.toInt(),
shortcuts: (json['shortcuts'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(
$enumDecode(_$GlobalHotKeysEnumMap, k),
e == null
? null
: KeyCombination.fromJson(e as Map<String, dynamic>)),
(k, e) => MapEntry($enumDecode(_$GlobalHotKeysEnumMap, k),
KeyCombination.fromJson(e as Map<String, dynamic>)),
) ??
const {},
);

View file

@ -4,31 +4,65 @@ import 'package:flutter/services.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:fladder/screens/settings/widgets/key_listener.dart';
part 'key_combinations.freezed.dart';
part 'key_combinations.g.dart';
@Freezed(toJson: true, fromJson: true)
@Freezed(toJson: true, fromJson: true, copyWith: true)
class KeyCombination with _$KeyCombination {
const KeyCombination._();
factory KeyCombination({
@LogicalKeyboardSerializer() LogicalKeyboardKey? key,
@LogicalKeyboardSerializer() LogicalKeyboardKey? modifier,
@LogicalKeyboardSerializer() required LogicalKeyboardKey key,
@LogicalKeyboardSerializer() LogicalKeyboardKey? altKey,
@LogicalKeyboardSerializer() LogicalKeyboardKey? altModifier,
}) = _KeyCombination;
factory KeyCombination.fromJson(Map<String, dynamic> json) => _$KeyCombinationFromJson(json);
@override
bool operator ==(covariant other) {
return other is KeyCombination && other.key.keyId == key.keyId && other.modifier?.keyId == modifier?.keyId;
return other is KeyCombination &&
other.key?.keyId == key?.keyId &&
other.modifier?.keyId == modifier?.keyId &&
other.altKey?.keyId == altKey?.keyId &&
other.altModifier?.keyId == altModifier?.keyId;
}
bool containsSameSet(KeyCombination other) {
return (key == other.key && modifier == other.modifier) || (altKey == other.key && altModifier == other.modifier);
}
@override
int get hashCode => key.hashCode ^ modifier.hashCode;
int get hashCode => key.hashCode ^ modifier.hashCode ^ altKey.hashCode ^ altModifier.hashCode;
String get label => [modifier?.label, key.label].nonNulls.join(" + ");
String get label => [modifier?.label, key?.label].nonNulls.join(" + ");
String get altLabel => [altModifier?.label, altKey?.label].nonNulls.join(" + ");
KeyCombination? get altSet => altKey != null
? copyWith(
key: altKey!,
modifier: altModifier,
)
: null;
KeyCombination setKeys(
LogicalKeyboardKey? key, {
LogicalKeyboardKey? modifier,
bool alt = false,
}) {
return alt
? copyWith(
altKey: key,
altModifier: modifier,
)
: copyWith(
key: key ?? altKey,
modifier: key == null ? altModifier : modifier,
altKey: key == null ? null : altKey,
altModifier: key == null ? null : altModifier,
);
}
static final Set<LogicalKeyboardKey> shiftKeys = {
LogicalKeyboardKey.shift,
@ -68,3 +102,26 @@ class LogicalKeyboardSerializer extends JsonConverter<LogicalKeyboardKey, String
return jsonEncode(object.keyId.toString());
}
}
extension LogicalKeyExtension on LogicalKeyboardKey {
String get label {
return switch (this) { LogicalKeyboardKey.space => "Space", _ => keyLabel };
}
}
extension KeyMapExtension<T> on Map<T, KeyCombination> {
Map<T, KeyCombination> setOrRemove(MapEntry<T, KeyCombination> newEntry, Map<T, KeyCombination> defaultShortCuts) {
if (newEntry.value == defaultShortCuts[newEntry.key]) {
final currentShortcuts = Map.fromEntries(entries);
return (currentShortcuts..remove(newEntry.key));
} else {
final currentShortcuts = Map.fromEntries(entries);
currentShortcuts.update(
newEntry.key,
(value) => newEntry.value,
ifAbsent: () => newEntry.value,
);
return currentShortcuts;
}
}
}

View file

@ -20,38 +20,173 @@ KeyCombination _$KeyCombinationFromJson(Map<String, dynamic> json) {
/// @nodoc
mixin _$KeyCombination {
@LogicalKeyboardSerializer()
LogicalKeyboardKey? get key => throw _privateConstructorUsedError;
@LogicalKeyboardSerializer()
LogicalKeyboardKey? get modifier => throw _privateConstructorUsedError;
@LogicalKeyboardSerializer()
LogicalKeyboardKey get key => throw _privateConstructorUsedError;
LogicalKeyboardKey? get altKey => throw _privateConstructorUsedError;
@LogicalKeyboardSerializer()
LogicalKeyboardKey? get altModifier => throw _privateConstructorUsedError;
/// Serializes this KeyCombination to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of KeyCombination
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$KeyCombinationCopyWith<KeyCombination> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $KeyCombinationCopyWith<$Res> {
factory $KeyCombinationCopyWith(
KeyCombination value, $Res Function(KeyCombination) then) =
_$KeyCombinationCopyWithImpl<$Res, KeyCombination>;
@useResult
$Res call(
{@LogicalKeyboardSerializer() LogicalKeyboardKey? key,
@LogicalKeyboardSerializer() LogicalKeyboardKey? modifier,
@LogicalKeyboardSerializer() LogicalKeyboardKey? altKey,
@LogicalKeyboardSerializer() LogicalKeyboardKey? altModifier});
}
/// @nodoc
class _$KeyCombinationCopyWithImpl<$Res, $Val extends KeyCombination>
implements $KeyCombinationCopyWith<$Res> {
_$KeyCombinationCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of KeyCombination
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? key = freezed,
Object? modifier = freezed,
Object? altKey = freezed,
Object? altModifier = freezed,
}) {
return _then(_value.copyWith(
key: freezed == key
? _value.key
: key // ignore: cast_nullable_to_non_nullable
as LogicalKeyboardKey?,
modifier: freezed == modifier
? _value.modifier
: modifier // ignore: cast_nullable_to_non_nullable
as LogicalKeyboardKey?,
altKey: freezed == altKey
? _value.altKey
: altKey // ignore: cast_nullable_to_non_nullable
as LogicalKeyboardKey?,
altModifier: freezed == altModifier
? _value.altModifier
: altModifier // ignore: cast_nullable_to_non_nullable
as LogicalKeyboardKey?,
) as $Val);
}
}
/// @nodoc
abstract class _$$KeyCombinationImplCopyWith<$Res>
implements $KeyCombinationCopyWith<$Res> {
factory _$$KeyCombinationImplCopyWith(_$KeyCombinationImpl value,
$Res Function(_$KeyCombinationImpl) then) =
__$$KeyCombinationImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{@LogicalKeyboardSerializer() LogicalKeyboardKey? key,
@LogicalKeyboardSerializer() LogicalKeyboardKey? modifier,
@LogicalKeyboardSerializer() LogicalKeyboardKey? altKey,
@LogicalKeyboardSerializer() LogicalKeyboardKey? altModifier});
}
/// @nodoc
class __$$KeyCombinationImplCopyWithImpl<$Res>
extends _$KeyCombinationCopyWithImpl<$Res, _$KeyCombinationImpl>
implements _$$KeyCombinationImplCopyWith<$Res> {
__$$KeyCombinationImplCopyWithImpl(
_$KeyCombinationImpl _value, $Res Function(_$KeyCombinationImpl) _then)
: super(_value, _then);
/// Create a copy of KeyCombination
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? key = freezed,
Object? modifier = freezed,
Object? altKey = freezed,
Object? altModifier = freezed,
}) {
return _then(_$KeyCombinationImpl(
key: freezed == key
? _value.key
: key // ignore: cast_nullable_to_non_nullable
as LogicalKeyboardKey?,
modifier: freezed == modifier
? _value.modifier
: modifier // ignore: cast_nullable_to_non_nullable
as LogicalKeyboardKey?,
altKey: freezed == altKey
? _value.altKey
: altKey // ignore: cast_nullable_to_non_nullable
as LogicalKeyboardKey?,
altModifier: freezed == altModifier
? _value.altModifier
: altModifier // ignore: cast_nullable_to_non_nullable
as LogicalKeyboardKey?,
));
}
}
/// @nodoc
@JsonSerializable()
class _$KeyCombinationImpl extends _KeyCombination {
_$KeyCombinationImpl(
{@LogicalKeyboardSerializer() this.modifier,
@LogicalKeyboardSerializer() required this.key})
{@LogicalKeyboardSerializer() this.key,
@LogicalKeyboardSerializer() this.modifier,
@LogicalKeyboardSerializer() this.altKey,
@LogicalKeyboardSerializer() this.altModifier})
: super._();
factory _$KeyCombinationImpl.fromJson(Map<String, dynamic> json) =>
_$$KeyCombinationImplFromJson(json);
@override
@LogicalKeyboardSerializer()
final LogicalKeyboardKey? key;
@override
@LogicalKeyboardSerializer()
final LogicalKeyboardKey? modifier;
@override
@LogicalKeyboardSerializer()
final LogicalKeyboardKey key;
final LogicalKeyboardKey? altKey;
@override
@LogicalKeyboardSerializer()
final LogicalKeyboardKey? altModifier;
@override
String toString() {
return 'KeyCombination(modifier: $modifier, key: $key)';
return 'KeyCombination(key: $key, modifier: $modifier, altKey: $altKey, altModifier: $altModifier)';
}
/// Create a copy of KeyCombination
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$KeyCombinationImplCopyWith<_$KeyCombinationImpl> get copyWith =>
__$$KeyCombinationImplCopyWithImpl<_$KeyCombinationImpl>(
this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$KeyCombinationImplToJson(
@ -62,18 +197,33 @@ class _$KeyCombinationImpl extends _KeyCombination {
abstract class _KeyCombination extends KeyCombination {
factory _KeyCombination(
{@LogicalKeyboardSerializer() final LogicalKeyboardKey? modifier,
@LogicalKeyboardSerializer() required final LogicalKeyboardKey key}) =
{@LogicalKeyboardSerializer() final LogicalKeyboardKey? key,
@LogicalKeyboardSerializer() final LogicalKeyboardKey? modifier,
@LogicalKeyboardSerializer() final LogicalKeyboardKey? altKey,
@LogicalKeyboardSerializer() final LogicalKeyboardKey? altModifier}) =
_$KeyCombinationImpl;
_KeyCombination._() : super._();
factory _KeyCombination.fromJson(Map<String, dynamic> json) =
_$KeyCombinationImpl.fromJson;
@override
@LogicalKeyboardSerializer()
LogicalKeyboardKey? get key;
@override
@LogicalKeyboardSerializer()
LogicalKeyboardKey? get modifier;
@override
@LogicalKeyboardSerializer()
LogicalKeyboardKey get key;
LogicalKeyboardKey? get altKey;
@override
@LogicalKeyboardSerializer()
LogicalKeyboardKey? get altModifier;
/// Create a copy of KeyCombination
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$KeyCombinationImplCopyWith<_$KeyCombinationImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View file

@ -8,17 +8,27 @@ part of 'key_combinations.dart';
_$KeyCombinationImpl _$$KeyCombinationImplFromJson(Map<String, dynamic> json) =>
_$KeyCombinationImpl(
key: _$JsonConverterFromJson<String, LogicalKeyboardKey>(
json['key'], const LogicalKeyboardSerializer().fromJson),
modifier: _$JsonConverterFromJson<String, LogicalKeyboardKey>(
json['modifier'], const LogicalKeyboardSerializer().fromJson),
key: const LogicalKeyboardSerializer().fromJson(json['key'] as String),
altKey: _$JsonConverterFromJson<String, LogicalKeyboardKey>(
json['altKey'], const LogicalKeyboardSerializer().fromJson),
altModifier: _$JsonConverterFromJson<String, LogicalKeyboardKey>(
json['altModifier'], const LogicalKeyboardSerializer().fromJson),
);
Map<String, dynamic> _$$KeyCombinationImplToJson(
_$KeyCombinationImpl instance) =>
<String, dynamic>{
'key': _$JsonConverterToJson<String, LogicalKeyboardKey>(
instance.key, const LogicalKeyboardSerializer().toJson),
'modifier': _$JsonConverterToJson<String, LogicalKeyboardKey>(
instance.modifier, const LogicalKeyboardSerializer().toJson),
'key': const LogicalKeyboardSerializer().toJson(instance.key),
'altKey': _$JsonConverterToJson<String, LogicalKeyboardKey>(
instance.altKey, const LogicalKeyboardSerializer().toJson),
'altModifier': _$JsonConverterToJson<String, LogicalKeyboardKey>(
instance.altModifier, const LogicalKeyboardSerializer().toJson),
};
Value? _$JsonConverterFromJson<Json, Value>(

View file

@ -68,7 +68,7 @@ class VideoPlayerSettingsModel with _$VideoPlayerSettingsModel {
@Default(Bitrate.original) Bitrate maxInternetBitrate,
String? audioDevice,
@Default(defaultSegmentSkipValues) Map<MediaSegmentType, SegmentSkip> segmentSkipSettings,
@Default({}) Map<VideoHotKeys, KeyCombination?> hotKeys,
@Default({}) Map<VideoHotKeys, KeyCombination> hotKeys,
}) = _VideoPlayerSettingsModel;
double get volume => switch (defaultTargetPlatform) {
@ -165,14 +165,25 @@ enum AutoNextType {
Map<VideoHotKeys, KeyCombination> get _defaultVideoHotKeys => {
for (var hotKey in VideoHotKeys.values)
hotKey: switch (hotKey) {
VideoHotKeys.playPause => KeyCombination(key: LogicalKeyboardKey.space),
VideoHotKeys.seekForward => KeyCombination(key: LogicalKeyboardKey.arrowRight),
VideoHotKeys.seekBack => KeyCombination(key: LogicalKeyboardKey.arrowLeft),
VideoHotKeys.playPause => KeyCombination(
key: LogicalKeyboardKey.space,
altKey: LogicalKeyboardKey.keyK,
),
VideoHotKeys.seekForward => KeyCombination(
key: LogicalKeyboardKey.arrowRight,
altKey: LogicalKeyboardKey.keyL,
),
VideoHotKeys.seekBack => KeyCombination(
key: LogicalKeyboardKey.arrowLeft,
altKey: LogicalKeyboardKey.keyJ,
),
VideoHotKeys.mute => KeyCombination(key: LogicalKeyboardKey.keyM),
VideoHotKeys.volumeUp => KeyCombination(key: LogicalKeyboardKey.arrowUp),
VideoHotKeys.volumeDown => KeyCombination(key: LogicalKeyboardKey.arrowDown),
VideoHotKeys.prevVideo => KeyCombination(key: LogicalKeyboardKey.keyP, modifier: LogicalKeyboardKey.shift),
VideoHotKeys.nextVideo => KeyCombination(key: LogicalKeyboardKey.keyN, modifier: LogicalKeyboardKey.shift),
VideoHotKeys.prevVideo =>
KeyCombination(key: LogicalKeyboardKey.keyP, modifier: LogicalKeyboardKey.shiftLeft),
VideoHotKeys.nextVideo =>
KeyCombination(key: LogicalKeyboardKey.keyN, modifier: LogicalKeyboardKey.shiftLeft),
VideoHotKeys.nextChapter => KeyCombination(key: LogicalKeyboardKey.pageUp),
VideoHotKeys.prevChapter => KeyCombination(key: LogicalKeyboardKey.pageDown),
VideoHotKeys.fullScreen => KeyCombination(key: LogicalKeyboardKey.keyF),

View file

@ -37,7 +37,7 @@ mixin _$VideoPlayerSettingsModel {
String? get audioDevice => throw _privateConstructorUsedError;
Map<MediaSegmentType, SegmentSkip> get segmentSkipSettings =>
throw _privateConstructorUsedError;
Map<VideoHotKeys, KeyCombination?> get hotKeys =>
Map<VideoHotKeys, KeyCombination> get hotKeys =>
throw _privateConstructorUsedError;
/// Serializes this VideoPlayerSettingsModel to a JSON map.
@ -71,7 +71,7 @@ abstract class $VideoPlayerSettingsModelCopyWith<$Res> {
Bitrate maxInternetBitrate,
String? audioDevice,
Map<MediaSegmentType, SegmentSkip> segmentSkipSettings,
Map<VideoHotKeys, KeyCombination?> hotKeys});
Map<VideoHotKeys, KeyCombination> hotKeys});
}
/// @nodoc
@ -166,7 +166,7 @@ class _$VideoPlayerSettingsModelCopyWithImpl<$Res,
hotKeys: null == hotKeys
? _value.hotKeys
: hotKeys // ignore: cast_nullable_to_non_nullable
as Map<VideoHotKeys, KeyCombination?>,
as Map<VideoHotKeys, KeyCombination>,
) as $Val);
}
}
@ -195,7 +195,7 @@ abstract class _$$VideoPlayerSettingsModelImplCopyWith<$Res>
Bitrate maxInternetBitrate,
String? audioDevice,
Map<MediaSegmentType, SegmentSkip> segmentSkipSettings,
Map<VideoHotKeys, KeyCombination?> hotKeys});
Map<VideoHotKeys, KeyCombination> hotKeys});
}
/// @nodoc
@ -289,7 +289,7 @@ class __$$VideoPlayerSettingsModelImplCopyWithImpl<$Res>
hotKeys: null == hotKeys
? _value._hotKeys
: hotKeys // ignore: cast_nullable_to_non_nullable
as Map<VideoHotKeys, KeyCombination?>,
as Map<VideoHotKeys, KeyCombination>,
));
}
}
@ -314,7 +314,7 @@ class _$VideoPlayerSettingsModelImpl extends _VideoPlayerSettingsModel
this.audioDevice,
final Map<MediaSegmentType, SegmentSkip> segmentSkipSettings =
defaultSegmentSkipValues,
final Map<VideoHotKeys, KeyCombination?> hotKeys = const {}})
final Map<VideoHotKeys, KeyCombination> hotKeys = const {}})
: _allowedOrientations = allowedOrientations,
_segmentSkipSettings = segmentSkipSettings,
_hotKeys = hotKeys,
@ -377,10 +377,10 @@ class _$VideoPlayerSettingsModelImpl extends _VideoPlayerSettingsModel
return EqualUnmodifiableMapView(_segmentSkipSettings);
}
final Map<VideoHotKeys, KeyCombination?> _hotKeys;
final Map<VideoHotKeys, KeyCombination> _hotKeys;
@override
@JsonKey()
Map<VideoHotKeys, KeyCombination?> get hotKeys {
Map<VideoHotKeys, KeyCombination> get hotKeys {
if (_hotKeys is EqualUnmodifiableMapView) return _hotKeys;
// ignore: implicit_dynamic_type
return EqualUnmodifiableMapView(_hotKeys);
@ -446,7 +446,7 @@ abstract class _VideoPlayerSettingsModel extends VideoPlayerSettingsModel {
final Bitrate maxInternetBitrate,
final String? audioDevice,
final Map<MediaSegmentType, SegmentSkip> segmentSkipSettings,
final Map<VideoHotKeys, KeyCombination?> hotKeys}) =
final Map<VideoHotKeys, KeyCombination> hotKeys}) =
_$VideoPlayerSettingsModelImpl;
_VideoPlayerSettingsModel._() : super._();
@ -482,7 +482,7 @@ abstract class _VideoPlayerSettingsModel extends VideoPlayerSettingsModel {
@override
Map<MediaSegmentType, SegmentSkip> get segmentSkipSettings;
@override
Map<VideoHotKeys, KeyCombination?> get hotKeys;
Map<VideoHotKeys, KeyCombination> get hotKeys;
/// Create a copy of VideoPlayerSettingsModel
/// with the given fields replaced by the non-null parameter values.

View file

@ -39,11 +39,8 @@ _$VideoPlayerSettingsModelImpl _$$VideoPlayerSettingsModelImplFromJson(
) ??
defaultSegmentSkipValues,
hotKeys: (json['hotKeys'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(
$enumDecode(_$VideoHotKeysEnumMap, k),
e == null
? null
: KeyCombination.fromJson(e as Map<String, dynamic>)),
(k, e) => MapEntry($enumDecode(_$VideoHotKeysEnumMap, k),
KeyCombination.fromJson(e as Map<String, dynamic>)),
) ??
const {},
);