Audio normalize

This commit is contained in:
LittleSheep 2024-08-29 22:34:56 +08:00
parent ef40c2ffe4
commit 586f47575c

View File

@ -2,8 +2,10 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:rhythm_box/providers/auth.dart'; import 'package:rhythm_box/providers/auth.dart';
import 'package:rhythm_box/providers/spotify.dart'; import 'package:rhythm_box/providers/spotify.dart';
import 'package:rhythm_box/providers/user_preferences.dart';
import 'package:rhythm_box/screens/auth/login.dart'; import 'package:rhythm_box/screens/auth/login.dart';
import 'package:rhythm_box/widgets/auto_cache_image.dart'; import 'package:rhythm_box/widgets/auto_cache_image.dart';
import 'package:rhythm_box/widgets/sized_container.dart';
class SettingsScreen extends StatefulWidget { class SettingsScreen extends StatefulWidget {
const SettingsScreen({super.key}); const SettingsScreen({super.key});
@ -15,6 +17,7 @@ class SettingsScreen extends StatefulWidget {
class _SettingsScreenState extends State<SettingsScreen> { class _SettingsScreenState extends State<SettingsScreen> {
late final SpotifyProvider _spotify = Get.find(); late final SpotifyProvider _spotify = Get.find();
late final AuthenticationProvider _authenticate = Get.find(); late final AuthenticationProvider _authenticate = Get.find();
late final UserPreferencesProvider _preferences = Get.find();
bool _isLoggingIn = false; bool _isLoggingIn = false;
@ -22,7 +25,12 @@ class _SettingsScreenState extends State<SettingsScreen> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Material( return Material(
color: Theme.of(context).colorScheme.surface, color: Theme.of(context).colorScheme.surface,
child: SafeArea( child: Scaffold(
appBar: AppBar(
title: const Text('Settings'),
centerTitle: MediaQuery.of(context).size.width >= 720,
),
body: CenteredContainer(
child: Column( child: Column(
children: [ children: [
Obx(() { Obx(() {
@ -31,7 +39,8 @@ class _SettingsScreenState extends State<SettingsScreen> {
contentPadding: const EdgeInsets.symmetric(horizontal: 24), contentPadding: const EdgeInsets.symmetric(horizontal: 24),
leading: const Icon(Icons.login), leading: const Icon(Icons.login),
title: const Text('Connect with Spotify'), title: const Text('Connect with Spotify'),
subtitle: const Text('To explore your own library and more'), subtitle:
const Text('To explore your own library and more'),
trailing: const Icon(Icons.chevron_right), trailing: const Icon(Icons.chevron_right),
enabled: !_isLoggingIn, enabled: !_isLoggingIn,
onTap: () async { onTap: () async {
@ -90,9 +99,22 @@ class _SettingsScreenState extends State<SettingsScreen> {
}, },
); );
}), }),
const Divider(thickness: 0.3, height: 1),
Obx(
() => SwitchListTile(
contentPadding: const EdgeInsets.symmetric(horizontal: 24),
secondary: const Icon(Icons.graphic_eq),
title: const Text('Normalize Audio'),
subtitle:
const Text('Make audio not too loud either too quiet'),
value: _preferences.state.value.normalizeAudio,
onChanged: _preferences.setNormalizeAudio,
),
),
], ],
), ),
), ),
),
); );
} }
} }