first commit
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
|
||||
import '../../services/finamp_settings_helper.dart';
|
||||
|
||||
class BufferDurationListTile extends StatefulWidget {
|
||||
const BufferDurationListTile({super.key});
|
||||
|
||||
@override
|
||||
State<BufferDurationListTile> createState() => _BufferDurationListTileState();
|
||||
}
|
||||
|
||||
class _BufferDurationListTileState extends State<BufferDurationListTile> {
|
||||
final _controller = TextEditingController(
|
||||
text:
|
||||
FinampSettingsHelper.finampSettings.bufferDurationSeconds.toString());
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListTile(
|
||||
title: Text(AppLocalizations.of(context)!.bufferDuration),
|
||||
subtitle: Text(AppLocalizations.of(context)!.bufferDurationSubtitle),
|
||||
trailing: SizedBox(
|
||||
width: 50 * MediaQuery.of(context).textScaleFactor,
|
||||
child: TextField(
|
||||
controller: _controller,
|
||||
textAlign: TextAlign.center,
|
||||
keyboardType: TextInputType.number,
|
||||
onChanged: (value) {
|
||||
final valueInt = int.tryParse(value);
|
||||
|
||||
if (valueInt != null && !valueInt.isNegative) {
|
||||
FinampSettingsHelper.setBufferDuration(
|
||||
Duration(seconds: valueInt));
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
|
||||
import '../../services/finamp_settings_helper.dart';
|
||||
|
||||
class SongShuffleItemCountEditor extends StatefulWidget {
|
||||
const SongShuffleItemCountEditor({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<SongShuffleItemCountEditor> createState() =>
|
||||
_SongShuffleItemCountEditorState();
|
||||
}
|
||||
|
||||
class _SongShuffleItemCountEditorState
|
||||
extends State<SongShuffleItemCountEditor> {
|
||||
final _controller = TextEditingController(
|
||||
text:
|
||||
FinampSettingsHelper.finampSettings.songShuffleItemCount.toString());
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListTile(
|
||||
title: Text(AppLocalizations.of(context)!.shuffleAllSongCount),
|
||||
subtitle: Text(AppLocalizations.of(context)!.shuffleAllSongCountSubtitle),
|
||||
trailing: SizedBox(
|
||||
width: 50 * MediaQuery.of(context).textScaleFactor,
|
||||
child: TextField(
|
||||
controller: _controller,
|
||||
textAlign: TextAlign.center,
|
||||
keyboardType: TextInputType.number,
|
||||
onChanged: (value) {
|
||||
final valueInt = int.tryParse(value);
|
||||
|
||||
if (valueInt != null) {
|
||||
FinampSettingsHelper.setSongShuffleItemCount(valueInt);
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
|
||||
import '../../services/finamp_settings_helper.dart';
|
||||
import '../../models/finamp_models.dart';
|
||||
|
||||
class StopForegroundSelector extends StatelessWidget {
|
||||
const StopForegroundSelector({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ValueListenableBuilder<Box<FinampSettings>>(
|
||||
valueListenable: FinampSettingsHelper.finampSettingsListener,
|
||||
builder: (_, box, __) {
|
||||
return SwitchListTile.adaptive(
|
||||
title:
|
||||
Text(AppLocalizations.of(context)!.enterLowPriorityStateOnPause),
|
||||
subtitle: Text(AppLocalizations.of(context)!
|
||||
.enterLowPriorityStateOnPauseSubtitle),
|
||||
value:
|
||||
FinampSettingsHelper.finampSettings.androidStopForegroundOnPause,
|
||||
onChanged: (value) =>
|
||||
FinampSettingsHelper.setAndroidStopForegroundOnPause(value),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user