mirror of
https://github.com/Dr-Blank/Vaani.git
synced 2025-12-06 19:19:28 +00:00
feat: extensive settings for media controls through notification (#28)
* feat: add notification settings customisation options * feat: add notification settings page and update routing
This commit is contained in:
parent
721b0a87fc
commit
3cf0a0b124
21 changed files with 1391 additions and 376 deletions
|
|
@ -1,5 +1,6 @@
|
|||
// a freezed class to store the settings of the app
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'app_settings.freezed.dart';
|
||||
|
|
@ -14,6 +15,7 @@ class AppSettings with _$AppSettings {
|
|||
@Default(ThemeSettings()) ThemeSettings themeSettings,
|
||||
@Default(PlayerSettings()) PlayerSettings playerSettings,
|
||||
@Default(DownloadSettings()) DownloadSettings downloadSettings,
|
||||
@Default(NotificationSettings()) NotificationSettings notificationSettings,
|
||||
}) = _AppSettings;
|
||||
|
||||
factory AppSettings.fromJson(Map<String, dynamic> json) =>
|
||||
|
|
@ -133,3 +135,53 @@ class DownloadSettings with _$DownloadSettings {
|
|||
factory DownloadSettings.fromJson(Map<String, dynamic> json) =>
|
||||
_$DownloadSettingsFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
class NotificationSettings with _$NotificationSettings {
|
||||
const factory NotificationSettings({
|
||||
@Default(Duration(seconds: 30)) Duration fastForwardInterval,
|
||||
@Default(Duration(seconds: 10)) Duration rewindInterval,
|
||||
@Default(true) bool progressBarIsChapterProgress,
|
||||
@Default('\$bookTitle') String primaryTitle,
|
||||
@Default('\$author') String secondaryTitle,
|
||||
@Default(
|
||||
[
|
||||
NotificationMediaControl.rewind,
|
||||
NotificationMediaControl.fastForward,
|
||||
NotificationMediaControl.skipToPreviousChapter,
|
||||
NotificationMediaControl.skipToNextChapter,
|
||||
],
|
||||
)
|
||||
List<NotificationMediaControl> mediaControls,
|
||||
}) = _NotificationSettings;
|
||||
|
||||
factory NotificationSettings.fromJson(Map<String, dynamic> json) =>
|
||||
_$NotificationSettingsFromJson(json);
|
||||
}
|
||||
|
||||
enum NotificationTitleType {
|
||||
chapterTitle('chapterTitle'),
|
||||
bookTitle('bookTitle'),
|
||||
author('author'),
|
||||
subtitle('subtitle'),
|
||||
series('series'),
|
||||
narrator('narrator'),
|
||||
year('year');
|
||||
|
||||
const NotificationTitleType(this.stringValue);
|
||||
|
||||
final String stringValue;
|
||||
}
|
||||
|
||||
enum NotificationMediaControl {
|
||||
fastForward(Icons.fast_forward),
|
||||
rewind(Icons.fast_rewind),
|
||||
speedToggle(Icons.speed),
|
||||
stop(Icons.stop),
|
||||
skipToNextChapter(Icons.skip_next),
|
||||
skipToPreviousChapter(Icons.skip_previous);
|
||||
|
||||
const NotificationMediaControl(this.icon);
|
||||
|
||||
final IconData icon;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue