fix: set boost valumn
This commit is contained in:
parent
199f3e8a28
commit
1df6ed6116
|
@ -25,17 +25,17 @@ import 'messages_ru.dart' as messages_ru;
|
||||||
import 'messages_tr.dart' as messages_tr;
|
import 'messages_tr.dart' as messages_tr;
|
||||||
import 'messages_zh-Hans.dart' as messages_zh_hans;
|
import 'messages_zh-Hans.dart' as messages_zh_hans;
|
||||||
|
|
||||||
typedef LibraryLoader = Future<dynamic> Function();
|
typedef Future<dynamic> LibraryLoader();
|
||||||
Map<String, LibraryLoader> _deferredLibraries = {
|
Map<String, LibraryLoader> _deferredLibraries = {
|
||||||
'el': () => Future.value(null),
|
'el': () => new Future.value(null),
|
||||||
'en': () => Future.value(null),
|
'en': () => new Future.value(null),
|
||||||
'es': () => Future.value(null),
|
'es': () => new Future.value(null),
|
||||||
'fr': () => Future.value(null),
|
'fr': () => new Future.value(null),
|
||||||
'it': () => Future.value(null),
|
'it': () => new Future.value(null),
|
||||||
'pt': () => Future.value(null),
|
'pt': () => new Future.value(null),
|
||||||
'ru': () => Future.value(null),
|
'ru': () => new Future.value(null),
|
||||||
'tr': () => Future.value(null),
|
'tr': () => new Future.value(null),
|
||||||
'zh_Hans': () => Future.value(null),
|
'zh_Hans': () => new Future.value(null),
|
||||||
};
|
};
|
||||||
|
|
||||||
MessageLookupByLibrary? _findExact(String localeName) {
|
MessageLookupByLibrary? _findExact(String localeName) {
|
||||||
|
@ -69,13 +69,13 @@ Future<bool> initializeMessages(String localeName) async {
|
||||||
localeName, (locale) => _deferredLibraries[locale] != null,
|
localeName, (locale) => _deferredLibraries[locale] != null,
|
||||||
onFailure: (_) => null);
|
onFailure: (_) => null);
|
||||||
if (availableLocale == null) {
|
if (availableLocale == null) {
|
||||||
return Future.value(false);
|
return new Future.value(false);
|
||||||
}
|
}
|
||||||
var lib = _deferredLibraries[availableLocale];
|
var lib = _deferredLibraries[availableLocale];
|
||||||
await (lib == null ? Future.value(false) : lib());
|
await (lib == null ? new Future.value(false) : lib());
|
||||||
initializeInternalMessageLookup(() => CompositeMessageLookup());
|
initializeInternalMessageLookup(() => new CompositeMessageLookup());
|
||||||
messageLookup.addLocale(availableLocale, _findGeneratedMessagesFor);
|
messageLookup.addLocale(availableLocale, _findGeneratedMessagesFor);
|
||||||
return Future.value(true);
|
return new Future.value(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool _messagesExistFor(String locale) {
|
bool _messagesExistFor(String locale) {
|
||||||
|
|
|
@ -13,10 +13,9 @@
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:intl/message_lookup_by_library.dart';
|
import 'package:intl/message_lookup_by_library.dart';
|
||||||
|
|
||||||
final messages = MessageLookup();
|
final messages = new MessageLookup();
|
||||||
|
|
||||||
typedef MessageIfAbsent = String Function(
|
typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
|
||||||
String messageStr, List<dynamic> args);
|
|
||||||
|
|
||||||
class MessageLookup extends MessageLookupByLibrary {
|
class MessageLookup extends MessageLookupByLibrary {
|
||||||
String get localeName => 'el';
|
String get localeName => 'el';
|
||||||
|
|
|
@ -13,10 +13,9 @@
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:intl/message_lookup_by_library.dart';
|
import 'package:intl/message_lookup_by_library.dart';
|
||||||
|
|
||||||
final messages = MessageLookup();
|
final messages = new MessageLookup();
|
||||||
|
|
||||||
typedef MessageIfAbsent = String Function(
|
typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
|
||||||
String messageStr, List<dynamic> args);
|
|
||||||
|
|
||||||
class MessageLookup extends MessageLookupByLibrary {
|
class MessageLookup extends MessageLookupByLibrary {
|
||||||
String get localeName => 'en';
|
String get localeName => 'en';
|
||||||
|
|
|
@ -13,10 +13,9 @@
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:intl/message_lookup_by_library.dart';
|
import 'package:intl/message_lookup_by_library.dart';
|
||||||
|
|
||||||
final messages = MessageLookup();
|
final messages = new MessageLookup();
|
||||||
|
|
||||||
typedef MessageIfAbsent = String Function(
|
typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
|
||||||
String messageStr, List<dynamic> args);
|
|
||||||
|
|
||||||
class MessageLookup extends MessageLookupByLibrary {
|
class MessageLookup extends MessageLookupByLibrary {
|
||||||
String get localeName => 'es';
|
String get localeName => 'es';
|
||||||
|
|
|
@ -13,10 +13,9 @@
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:intl/message_lookup_by_library.dart';
|
import 'package:intl/message_lookup_by_library.dart';
|
||||||
|
|
||||||
final messages = MessageLookup();
|
final messages = new MessageLookup();
|
||||||
|
|
||||||
typedef MessageIfAbsent = String Function(
|
typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
|
||||||
String messageStr, List<dynamic> args);
|
|
||||||
|
|
||||||
class MessageLookup extends MessageLookupByLibrary {
|
class MessageLookup extends MessageLookupByLibrary {
|
||||||
String get localeName => 'fr';
|
String get localeName => 'fr';
|
||||||
|
|
|
@ -13,10 +13,9 @@
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:intl/message_lookup_by_library.dart';
|
import 'package:intl/message_lookup_by_library.dart';
|
||||||
|
|
||||||
final messages = MessageLookup();
|
final messages = new MessageLookup();
|
||||||
|
|
||||||
typedef MessageIfAbsent = String Function(
|
typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
|
||||||
String messageStr, List<dynamic> args);
|
|
||||||
|
|
||||||
class MessageLookup extends MessageLookupByLibrary {
|
class MessageLookup extends MessageLookupByLibrary {
|
||||||
String get localeName => 'it';
|
String get localeName => 'it';
|
||||||
|
|
|
@ -13,10 +13,9 @@
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:intl/message_lookup_by_library.dart';
|
import 'package:intl/message_lookup_by_library.dart';
|
||||||
|
|
||||||
final messages = MessageLookup();
|
final messages = new MessageLookup();
|
||||||
|
|
||||||
typedef MessageIfAbsent = String Function(
|
typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
|
||||||
String messageStr, List<dynamic> args);
|
|
||||||
|
|
||||||
class MessageLookup extends MessageLookupByLibrary {
|
class MessageLookup extends MessageLookupByLibrary {
|
||||||
String get localeName => 'pt';
|
String get localeName => 'pt';
|
||||||
|
|
|
@ -13,10 +13,9 @@
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:intl/message_lookup_by_library.dart';
|
import 'package:intl/message_lookup_by_library.dart';
|
||||||
|
|
||||||
final messages = MessageLookup();
|
final messages = new MessageLookup();
|
||||||
|
|
||||||
typedef MessageIfAbsent = String Function(
|
typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
|
||||||
String messageStr, List<dynamic> args);
|
|
||||||
|
|
||||||
class MessageLookup extends MessageLookupByLibrary {
|
class MessageLookup extends MessageLookupByLibrary {
|
||||||
String get localeName => 'ru';
|
String get localeName => 'ru';
|
||||||
|
|
|
@ -13,10 +13,9 @@
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:intl/message_lookup_by_library.dart';
|
import 'package:intl/message_lookup_by_library.dart';
|
||||||
|
|
||||||
final messages = MessageLookup();
|
final messages = new MessageLookup();
|
||||||
|
|
||||||
typedef MessageIfAbsent = String Function(
|
typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
|
||||||
String messageStr, List<dynamic> args);
|
|
||||||
|
|
||||||
class MessageLookup extends MessageLookupByLibrary {
|
class MessageLookup extends MessageLookupByLibrary {
|
||||||
String get localeName => 'tr';
|
String get localeName => 'tr';
|
||||||
|
|
|
@ -13,10 +13,9 @@
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:intl/message_lookup_by_library.dart';
|
import 'package:intl/message_lookup_by_library.dart';
|
||||||
|
|
||||||
final messages = MessageLookup();
|
final messages = new MessageLookup();
|
||||||
|
|
||||||
typedef MessageIfAbsent = String Function(
|
typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
|
||||||
String messageStr, List<dynamic> args);
|
|
||||||
|
|
||||||
class MessageLookup extends MessageLookupByLibrary {
|
class MessageLookup extends MessageLookupByLibrary {
|
||||||
String get localeName => 'zh_Hans';
|
String get localeName => 'zh_Hans';
|
||||||
|
|
|
@ -54,11 +54,54 @@ class PlayerWidget extends StatelessWidget {
|
||||||
PlayerWidget({this.playerKey, this.isPlayingPage = false});
|
PlayerWidget({this.playerKey, this.isPlayingPage = false});
|
||||||
final GlobalKey<AudioPanelState>? playerKey;
|
final GlobalKey<AudioPanelState>? playerKey;
|
||||||
final bool isPlayingPage;
|
final bool isPlayingPage;
|
||||||
Widget _miniPanel(BuildContext context) {
|
|
||||||
var audio = Provider.of<AudioPlayerNotifier>(context, listen: false);
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Selector<AudioPlayerNotifier, Tuple2<bool, PlayerHeight?>>(
|
||||||
|
selector: (_, audio) => Tuple2(audio.playerRunning, audio.playerHeight),
|
||||||
|
builder: (_, data, __) {
|
||||||
|
if (!data.item1) {
|
||||||
|
return Center();
|
||||||
|
} else {
|
||||||
|
final minHeight = kMinPlayerHeight[data.item2!.index];
|
||||||
|
final maxHeight = math.min(
|
||||||
|
kMaxPlayerHeight[data.item2!.index] as double,
|
||||||
|
context.height - 20);
|
||||||
|
return AudioPanel(
|
||||||
|
minHeight: minHeight,
|
||||||
|
maxHeight: maxHeight,
|
||||||
|
expandHeight: context.height - context.paddingTop - 20,
|
||||||
|
key: playerKey,
|
||||||
|
miniPanel: _MiniPanel(),
|
||||||
|
expandedPanel: ControlPanel(
|
||||||
|
maxHeight: maxHeight,
|
||||||
|
isPlayingPage: isPlayingPage,
|
||||||
|
onExpand: () {
|
||||||
|
playerKey!.currentState!.scrollToTop();
|
||||||
|
},
|
||||||
|
onClose: () {
|
||||||
|
playerKey!.currentState!.backToMini();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MiniPanel extends StatelessWidget {
|
||||||
|
const _MiniPanel({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final audio = Provider.of<AudioPlayerNotifier>(context, listen: false);
|
||||||
final s = context.s;
|
final s = context.s;
|
||||||
|
final bgColor = audio.episode == null
|
||||||
|
? context.primaryColor
|
||||||
|
: audio.episode!.cardColor(context);
|
||||||
return Container(
|
return Container(
|
||||||
color: context.primaryColor,
|
color: bgColor,
|
||||||
height: 60,
|
height: 60,
|
||||||
child:
|
child:
|
||||||
Column(mainAxisAlignment: MainAxisAlignment.start, children: <Widget>[
|
Column(mainAxisAlignment: MainAxisAlignment.start, children: <Widget>[
|
||||||
|
@ -70,7 +113,7 @@ class PlayerWidget extends StatelessWidget {
|
||||||
height: 2,
|
height: 2,
|
||||||
child: LinearProgressIndicator(
|
child: LinearProgressIndicator(
|
||||||
value: data.item2,
|
value: data.item2,
|
||||||
backgroundColor: context.primaryColor,
|
backgroundColor: bgColor,
|
||||||
valueColor: AlwaysStoppedAnimation<Color>(c),
|
valueColor: AlwaysStoppedAnimation<Color>(c),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -223,40 +266,6 @@ class PlayerWidget extends StatelessWidget {
|
||||||
]),
|
]),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Selector<AudioPlayerNotifier, Tuple2<bool, PlayerHeight?>>(
|
|
||||||
selector: (_, audio) => Tuple2(audio.playerRunning, audio.playerHeight),
|
|
||||||
builder: (_, data, __) {
|
|
||||||
if (!data.item1) {
|
|
||||||
return Center();
|
|
||||||
} else {
|
|
||||||
final minHeight = kMinPlayerHeight[data.item2!.index];
|
|
||||||
final maxHeight = math.min(
|
|
||||||
kMaxPlayerHeight[data.item2!.index] as double,
|
|
||||||
context.height - 20);
|
|
||||||
return AudioPanel(
|
|
||||||
minHeight: minHeight,
|
|
||||||
maxHeight: maxHeight,
|
|
||||||
expandHeight: context.height - context.paddingTop - 20,
|
|
||||||
key: playerKey,
|
|
||||||
miniPanel: _miniPanel(context),
|
|
||||||
expandedPanel: ControlPanel(
|
|
||||||
maxHeight: maxHeight,
|
|
||||||
isPlayingPage: isPlayingPage,
|
|
||||||
onExpand: () {
|
|
||||||
playerKey!.currentState!.scrollToTop();
|
|
||||||
},
|
|
||||||
onClose: () {
|
|
||||||
playerKey!.currentState!.backToMini();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class LastPosition extends StatelessWidget {
|
class LastPosition extends StatelessWidget {
|
||||||
|
@ -285,9 +294,19 @@ class LastPosition extends StatelessWidget {
|
||||||
builder: (_, data, __) => TextButton(
|
builder: (_, data, __) => TextButton(
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Icon(Icons.flash_on, size: 18),
|
Icon(Icons.flash_on,
|
||||||
|
size: 18,
|
||||||
|
color: data!
|
||||||
|
? context.accentColor
|
||||||
|
: context.textColor),
|
||||||
SizedBox(width: 5),
|
SizedBox(width: 5),
|
||||||
Text(s.skipSilence),
|
Text(
|
||||||
|
s.skipSilence,
|
||||||
|
style: TextStyle(
|
||||||
|
color: data
|
||||||
|
? context.accentColor
|
||||||
|
: context.textColor),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
style: TextButton.styleFrom(
|
style: TextButton.styleFrom(
|
||||||
|
@ -308,16 +327,27 @@ class LastPosition extends StatelessWidget {
|
||||||
SizedBox(width: 10),
|
SizedBox(width: 10),
|
||||||
Selector<AudioPlayerNotifier, bool?>(
|
Selector<AudioPlayerNotifier, bool?>(
|
||||||
selector: (_, audio) => audio.boostVolume,
|
selector: (_, audio) => audio.boostVolume,
|
||||||
builder: (_, data, __) => FlatButton(
|
builder: (_, data, __) => TextButton(
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Icon(Icons.volume_up, size: 18),
|
Icon(Icons.volume_up,
|
||||||
|
size: 18,
|
||||||
|
color: data!
|
||||||
|
? context.accentColor
|
||||||
|
: context.textColor),
|
||||||
SizedBox(width: 5),
|
SizedBox(width: 5),
|
||||||
Text(s.boostVolume),
|
Text(
|
||||||
|
s.boostVolume,
|
||||||
|
style: TextStyle(
|
||||||
|
color: data
|
||||||
|
? context.accentColor
|
||||||
|
: context.textColor),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
color: data! ? context.accentColor : Colors.transparent,
|
style: TextButton.styleFrom(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 10),
|
primary:
|
||||||
|
data ? context.accentColor : Colors.transparent,
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(100.0),
|
borderRadius: BorderRadius.circular(100.0),
|
||||||
side: BorderSide(
|
side: BorderSide(
|
||||||
|
@ -327,7 +357,8 @@ class LastPosition extends StatelessWidget {
|
||||||
.colorScheme
|
.colorScheme
|
||||||
.onSurface
|
.onSurface
|
||||||
.withOpacity(0.12))),
|
.withOpacity(0.12))),
|
||||||
textColor: data ? Colors.white : null,
|
padding: EdgeInsets.symmetric(horizontal: 10),
|
||||||
|
),
|
||||||
onPressed: () =>
|
onPressed: () =>
|
||||||
audio.setBoostVolume(boostVolume: !data))),
|
audio.setBoostVolume(boostVolume: !data))),
|
||||||
SizedBox(width: 10),
|
SizedBox(width: 10),
|
||||||
|
@ -1268,10 +1299,10 @@ class _ControlPanelState extends State<ControlPanel>
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
var audio = Provider.of<AudioPlayerNotifier>(context, listen: false);
|
final audio = Provider.of<AudioPlayerNotifier>(context, listen: false);
|
||||||
return LayoutBuilder(
|
return LayoutBuilder(
|
||||||
builder: (context, constraints) {
|
builder: (context, constraints) {
|
||||||
var height = constraints.maxHeight;
|
final height = constraints.maxHeight;
|
||||||
return Container(
|
return Container(
|
||||||
color: context.primaryColor,
|
color: context.primaryColor,
|
||||||
height: 300,
|
height: 300,
|
||||||
|
@ -1499,12 +1530,12 @@ class _ControlPanelState extends State<ControlPanel>
|
||||||
padding: EdgeInsets.only(left: 60, right: 60),
|
padding: EdgeInsets.only(left: 60, right: 60),
|
||||||
child: LayoutBuilder(
|
child: LayoutBuilder(
|
||||||
builder: (context, size) {
|
builder: (context, size) {
|
||||||
var span = TextSpan(
|
final span = TextSpan(
|
||||||
text: title,
|
text: title,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
fontSize: 20));
|
fontSize: 20));
|
||||||
var tp = TextPainter(
|
final tp = TextPainter(
|
||||||
text: span,
|
text: span,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
textDirection: TextDirection.ltr);
|
textDirection: TextDirection.ltr);
|
||||||
|
|
|
@ -58,6 +58,7 @@ class _HomeState extends State<Home> with SingleTickerProviderStateMixin {
|
||||||
final _androidAppRetain = MethodChannel("android_app_retain");
|
final _androidAppRetain = MethodChannel("android_app_retain");
|
||||||
var feature1OverflowMode = OverflowMode.clipContent;
|
var feature1OverflowMode = OverflowMode.clipContent;
|
||||||
var feature1EnablePulsingAnimation = false;
|
var feature1EnablePulsingAnimation = false;
|
||||||
|
double top = 0;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
|
@ -87,7 +88,6 @@ class _HomeState extends State<Home> with SingleTickerProviderStateMixin {
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
double top = 0;
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final height = (context.width - 20) / 3 + 140;
|
final height = (context.width - 20) / 3 + 140;
|
||||||
|
|
|
@ -180,7 +180,7 @@ class _PlaySettingState extends State<PlaySetting> {
|
||||||
EdgeInsets.only(left: 70.0, right: 20, bottom: 10, top: 10),
|
EdgeInsets.only(left: 70.0, right: 20, bottom: 10, top: 10),
|
||||||
title: Text(s.settingsBoostVolume),
|
title: Text(s.settingsBoostVolume),
|
||||||
subtitle: Text(s.settingsBoostVolumeDes),
|
subtitle: Text(s.settingsBoostVolumeDes),
|
||||||
trailing: Selector<AudioPlayerNotifier, int?>(
|
trailing: Selector<AudioPlayerNotifier, int>(
|
||||||
selector: (_, audio) => audio.volumeGain,
|
selector: (_, audio) => audio.volumeGain,
|
||||||
builder: (_, volumeGain, __) => MyDropdownButton(
|
builder: (_, volumeGain, __) => MyDropdownButton(
|
||||||
hint: Text(_volumeEffect(context, volumeGain)),
|
hint: Text(_volumeEffect(context, volumeGain)),
|
||||||
|
@ -189,7 +189,7 @@ class _PlaySettingState extends State<PlaySetting> {
|
||||||
displayItemCount: 5,
|
displayItemCount: 5,
|
||||||
isDense: true,
|
isDense: true,
|
||||||
value: volumeGain,
|
value: volumeGain,
|
||||||
onChanged: (dynamic value) => audio.setVolumeGain = value,
|
onChanged: (int value) => audio.setVolumeGain = value,
|
||||||
items: [2000, 3000, 4000].map<DropdownMenuItem<int>>((e) {
|
items: [2000, 3000, 4000].map<DropdownMenuItem<int>>((e) {
|
||||||
return DropdownMenuItem<int>(
|
return DropdownMenuItem<int>(
|
||||||
value: e, child: Text(_volumeEffect(context, e)));
|
value: e, child: Text(_volumeEffect(context, e)));
|
||||||
|
|
|
@ -165,7 +165,7 @@ class AudioPlayerNotifier extends ChangeNotifier {
|
||||||
bool? _boostVolume;
|
bool? _boostVolume;
|
||||||
|
|
||||||
/// Boost volume gain.
|
/// Boost volume gain.
|
||||||
int? _volumeGain;
|
late int _volumeGain;
|
||||||
|
|
||||||
// ignore: prefer_final_fields
|
// ignore: prefer_final_fields
|
||||||
bool _playerRunning = false;
|
bool _playerRunning = false;
|
||||||
|
@ -241,7 +241,7 @@ class AudioPlayerNotifier extends ChangeNotifier {
|
||||||
PlayerHeight? get playerHeight => _playerHeight;
|
PlayerHeight? get playerHeight => _playerHeight;
|
||||||
bool? get skipSilence => _skipSilence;
|
bool? get skipSilence => _skipSilence;
|
||||||
bool? get boostVolume => _boostVolume;
|
bool? get boostVolume => _boostVolume;
|
||||||
int? get volumeGain => _volumeGain;
|
int get volumeGain => _volumeGain;
|
||||||
|
|
||||||
set setSwitchValue(double value) {
|
set setSwitchValue(double value) {
|
||||||
_switchValue = value;
|
_switchValue = value;
|
||||||
|
@ -303,7 +303,7 @@ class AudioPlayerNotifier extends ChangeNotifier {
|
||||||
);
|
);
|
||||||
await _playlist!.getPlaylist();
|
await _playlist!.getPlaylist();
|
||||||
if (state[1] != '') {
|
if (state[1] != '') {
|
||||||
var episode = await _dbHelper.getRssItemWithUrl(state[1]);
|
final episode = await _dbHelper.getRssItemWithUrl(state[1]);
|
||||||
if (episode != null &&
|
if (episode != null &&
|
||||||
((!_playlist!.isQueue && _playlist!.contains(episode)) ||
|
((!_playlist!.isQueue && _playlist!.contains(episode)) ||
|
||||||
(_playlist!.isQueue &&
|
(_playlist!.isQueue &&
|
||||||
|
@ -476,18 +476,18 @@ class AudioPlayerNotifier extends ChangeNotifier {
|
||||||
//Check auto sleep timer setting
|
//Check auto sleep timer setting
|
||||||
await _getAutoSleepTimer();
|
await _getAutoSleepTimer();
|
||||||
if (_autoSleepTimer!) {
|
if (_autoSleepTimer!) {
|
||||||
var startTime = await (_autoSleepTimerStartStorage.getInt(
|
final startTime =
|
||||||
defaultValue: 1380) as FutureOr<int>);
|
await (_autoSleepTimerStartStorage.getInt(defaultValue: 1380));
|
||||||
var endTime = await (_autoSleepTimerEndStorage.getInt(defaultValue: 360)
|
final endTime =
|
||||||
as FutureOr<int>);
|
await (_autoSleepTimerEndStorage.getInt(defaultValue: 360));
|
||||||
var currentTime = DateTime.now().hour * 60 + DateTime.now().minute;
|
final currentTime = DateTime.now().hour * 60 + DateTime.now().minute;
|
||||||
if ((startTime > endTime &&
|
if ((startTime > endTime &&
|
||||||
(currentTime > startTime || currentTime < endTime)) ||
|
(currentTime > startTime || currentTime < endTime)) ||
|
||||||
((startTime < endTime) &&
|
((startTime < endTime) &&
|
||||||
(currentTime > startTime && currentTime < endTime))) {
|
(currentTime > startTime && currentTime < endTime))) {
|
||||||
var mode = await (_autoSleepTimerModeStorage.getInt() as FutureOr<int>);
|
final mode = await (_autoSleepTimerModeStorage.getInt());
|
||||||
_sleepTimerMode = SleepTimerMode.values[mode];
|
_sleepTimerMode = SleepTimerMode.values[mode];
|
||||||
var defaultTimer =
|
final defaultTimer =
|
||||||
await _defaultSleepTimerStorage.getInt(defaultValue: 30);
|
await _defaultSleepTimerStorage.getInt(defaultValue: 30);
|
||||||
sleepTimer(defaultTimer);
|
sleepTimer(defaultTimer);
|
||||||
}
|
}
|
||||||
|
@ -619,7 +619,7 @@ class AudioPlayerNotifier extends ChangeNotifier {
|
||||||
|
|
||||||
/// Queue management
|
/// Queue management
|
||||||
Future<void> addToPlaylist(EpisodeBrief episode) async {
|
Future<void> addToPlaylist(EpisodeBrief episode) async {
|
||||||
var episodeNew = await (_dbHelper.getRssItemWithUrl(episode.enclosureUrl)
|
final episodeNew = await (_dbHelper.getRssItemWithUrl(episode.enclosureUrl)
|
||||||
as FutureOr<EpisodeBrief>);
|
as FutureOr<EpisodeBrief>);
|
||||||
if (episodeNew.isNew == 1) {
|
if (episodeNew.isNew == 1) {
|
||||||
await _dbHelper.removeEpisodeNewMark(episodeNew.enclosureUrl);
|
await _dbHelper.removeEpisodeNewMark(episodeNew.enclosureUrl);
|
||||||
|
@ -635,7 +635,7 @@ class AudioPlayerNotifier extends ChangeNotifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> addToPlaylistAt(EpisodeBrief episode, int index) async {
|
Future<void> addToPlaylistAt(EpisodeBrief episode, int index) async {
|
||||||
var episodeNew = await (_dbHelper.getRssItemWithUrl(episode.enclosureUrl)
|
final episodeNew = await (_dbHelper.getRssItemWithUrl(episode.enclosureUrl)
|
||||||
as FutureOr<EpisodeBrief>);
|
as FutureOr<EpisodeBrief>);
|
||||||
if (episodeNew.isNew == 1) {
|
if (episodeNew.isNew == 1) {
|
||||||
await _dbHelper.removeEpisodeNewMark(episodeNew.enclosureUrl);
|
await _dbHelper.removeEpisodeNewMark(episodeNew.enclosureUrl);
|
||||||
|
@ -680,11 +680,11 @@ class AudioPlayerNotifier extends ChangeNotifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<int> delFromPlaylist(EpisodeBrief episode) async {
|
Future<int> delFromPlaylist(EpisodeBrief episode) async {
|
||||||
var episodeNew = await _dbHelper.getRssItemWithUrl(episode.enclosureUrl);
|
final episodeNew = await _dbHelper.getRssItemWithUrl(episode.enclosureUrl);
|
||||||
if (playerRunning && _playlist!.isQueue) {
|
if (playerRunning && _playlist!.isQueue) {
|
||||||
await _audioHandler.removeQueueItem(episodeNew!.toMediaItem());
|
await _audioHandler.removeQueueItem(episodeNew!.toMediaItem());
|
||||||
}
|
}
|
||||||
var index = _queue.delFromPlaylist(episodeNew);
|
final index = _queue.delFromPlaylist(episodeNew);
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
_lastPosition = 0;
|
_lastPosition = 0;
|
||||||
await _positionStorage.saveInt(0);
|
await _positionStorage.saveInt(0);
|
||||||
|
@ -697,7 +697,7 @@ class AudioPlayerNotifier extends ChangeNotifier {
|
||||||
if (newIndex > oldIndex) {
|
if (newIndex > oldIndex) {
|
||||||
newIndex -= 1;
|
newIndex -= 1;
|
||||||
}
|
}
|
||||||
var episode = _queue.episodes[oldIndex]!;
|
final episode = _queue.episodes[oldIndex]!;
|
||||||
_queue.addToPlayListAt(episode, newIndex);
|
_queue.addToPlayListAt(episode, newIndex);
|
||||||
updatePlaylist(_queue, updateEpisodes: false);
|
updatePlaylist(_queue, updateEpisodes: false);
|
||||||
if (playerRunning && _playlist!.name == 'Queue') {
|
if (playerRunning && _playlist!.name == 'Queue') {
|
||||||
|
@ -910,13 +910,13 @@ class AudioPlayerNotifier extends ChangeNotifier {
|
||||||
set setVolumeGain(int volumeGain) {
|
set setVolumeGain(int volumeGain) {
|
||||||
_volumeGain = volumeGain;
|
_volumeGain = volumeGain;
|
||||||
if (_playerRunning && _boostVolume!) {
|
if (_playerRunning && _boostVolume!) {
|
||||||
setBoostVolume(boostVolume: _boostVolume, gain: _volumeGain);
|
setBoostVolume(boostVolume: _boostVolume!, gain: _volumeGain);
|
||||||
}
|
}
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
_volumeGainStorage.saveInt(volumeGain);
|
_volumeGainStorage.saveInt(volumeGain);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> setBoostVolume({required bool? boostVolume, int? gain}) async {
|
Future<void> setBoostVolume({required bool boostVolume, int? gain}) async {
|
||||||
await _audioHandler.customAction(
|
await _audioHandler.customAction(
|
||||||
'setBoostVolume', {'boostVolume': boostVolume, 'gain': _volumeGain});
|
'setBoostVolume', {'boostVolume': boostVolume, 'gain': _volumeGain});
|
||||||
_boostVolume = boostVolume;
|
_boostVolume = boostVolume;
|
||||||
|
@ -1297,7 +1297,7 @@ class CustomAudioHandler extends BaseAudioHandler
|
||||||
|
|
||||||
Future _setBoostVolume(bool enabled, int gain) async {
|
Future _setBoostVolume(bool enabled, int gain) async {
|
||||||
await _loudnessEnhancer.setEnabled(enabled);
|
await _loudnessEnhancer.setEnabled(enabled);
|
||||||
await _loudnessEnhancer.setTargetGain(1.5);
|
await _loudnessEnhancer.setTargetGain(gain / 2000);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<MediaControl> _getControls(int? index) {
|
List<MediaControl> _getControls(int? index) {
|
||||||
|
|
|
@ -150,7 +150,7 @@ class _DropdownMenuItemButtonState<T>
|
||||||
|
|
||||||
Navigator.pop(
|
Navigator.pop(
|
||||||
context,
|
context,
|
||||||
_DropdownRouteResult<T?>(dropdownMenuItem.value),
|
_DropdownRouteResult<T>(dropdownMenuItem.value!),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue