diff options
author | Scott Murray <scott.murray@konsulko.com> | 2023-12-17 15:48:21 -0500 |
---|---|---|
committer | Jan-Simon Moeller <jsmoeller@linuxfoundation.org> | 2023-12-18 13:28:28 +0000 |
commit | 4ae68f5be11d110f2df10d54377d970921e30a21 (patch) | |
tree | b37b5cb3c6964fbaeaa95edc1edeb44d615912e9 /lib/presentation/screens/dashboard | |
parent | dda6c8502a3fa1e50654c4cca934b4b846bbca98 (diff) |
Implement audio settings
Changes:
- Rework KUKSA.val "VAL" gRPC API implementation to separate it
from the vehicle model + notifier, and more easily allow using
it from other notifiers.
- Move volume handling from the vehicle model + notifier to the
audio set for clarity.
- Wire up the new VSS audio signals in the audio notifier. The
"rearFront" variable naming has been changed to "fade" in
several places to match expected terminology.
- Add a balance slider to the audio settings page.
- Change the min/max labels on the fade slider to be Text instead
of Icon's since we do not have the equivalent to use with the
balance slider, and text seems like it'd be what you would want
for any potential future internationalization.
- Rework configuration file to be usable from anywhere via a
RiverPod Provider instead of tied to the vehicle notifier code,
and shifted the background and hybrid animation flags to be handled
with it. This change removes the built-in asset with defaults in
favor of maintaining the defaults for the ICS environment in the
AppConfig and KuksaConfig classes, with a goal of avoiding the need
for using async methods in the config provider.
- Change some notifiers from using StateNotifier to the RiverPod
2.0 Notifier class for improved flexibility. The other notifiers
will be updated in future work.
- Added select's to several ref.watches in the new hybrid animation
code to avoid unnecessary repaints.
- Fix several spelling issues in method and parameter names
across the codebase.
Bug-AGL: SPEC-5001
Change-Id: Iefae417fa870405d659303497d96e519e6b6d1de
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Diffstat (limited to 'lib/presentation/screens/dashboard')
3 files changed, 11 insertions, 9 deletions
diff --git a/lib/presentation/screens/dashboard/widgets/dashboard_content.dart b/lib/presentation/screens/dashboard/widgets/dashboard_content.dart index 28cf944..7e4c469 100644 --- a/lib/presentation/screens/dashboard/widgets/dashboard_content.dart +++ b/lib/presentation/screens/dashboard/widgets/dashboard_content.dart @@ -39,6 +39,7 @@ class DashBoardState extends ConsumerState<DashBoard> }); } + bool randomHybridAnimation = ref.read(appConfigProvider).randomHybridAnimation; if (randomHybridAnimation) { timer = Timer.periodic(const Duration(seconds: 5), (timer) { Random random = Random(); diff --git a/lib/presentation/screens/dashboard/widgets/hybrid/hybrid.dart b/lib/presentation/screens/dashboard/widgets/hybrid/hybrid.dart index 6badf62..24eabd6 100644 --- a/lib/presentation/screens/dashboard/widgets/hybrid/hybrid.dart +++ b/lib/presentation/screens/dashboard/widgets/hybrid/hybrid.dart @@ -1,7 +1,7 @@ import 'package:flutter_ics_homescreen/export.dart'; -class HybridBackround extends StatelessWidget { - const HybridBackround({ +class HybridBackground extends StatelessWidget { + const HybridBackground({ super.key, }); @@ -21,9 +21,9 @@ class TopArrow extends StatelessWidget { return Align( alignment: const Alignment(0, -0.75), child: Consumer(builder: (context, ref, child) { - final state = ref.watch(hybridStateProvider.select((hybrid) => hybrid)); + final arrowState = ref.watch(hybridStateProvider.select((hybrid) => hybrid.topArrowState)); Widget? widget; - switch (state.topArrowState) { + switch (arrowState) { case ArrowState.blue: widget = SvgPicture.asset( 'animations/hybrid_model/top_blue.svg', @@ -56,9 +56,9 @@ class LeftArrow extends StatelessWidget { return Align( alignment: const Alignment(-0.7, 0.5), child: Consumer(builder: (context, ref, child) { - final state = ref.watch(hybridStateProvider.select((hybrid) => hybrid)); + final arrowState = ref.watch(hybridStateProvider.select((hybrid) => hybrid.leftArrowState)); Widget? widget; - switch (state.leftArrowState) { + switch (arrowState) { case ArrowState.blue: widget = SvgPicture.asset( 'animations/hybrid_model/left_blue.svg', @@ -92,10 +92,10 @@ class RightArrow extends StatelessWidget { return Align( alignment: const Alignment(0.70, 0.5), child: Consumer(builder: (context, ref, child) { - final state = ref.watch(hybridStateProvider.select((hybrid) => hybrid)); + final arrowState = ref.watch(hybridStateProvider.select((hybrid) => hybrid.rightArrowState)); Widget? widget; - switch (state.rightArrowState) { + switch (arrowState) { case ArrowState.blue: widget = SvgPicture.asset( 'animations/hybrid_model/right_blue.svg', diff --git a/lib/presentation/screens/dashboard/widgets/hybrid_mode.dart b/lib/presentation/screens/dashboard/widgets/hybrid_mode.dart index f5f1286..01fb981 100644 --- a/lib/presentation/screens/dashboard/widgets/hybrid_mode.dart +++ b/lib/presentation/screens/dashboard/widgets/hybrid_mode.dart @@ -11,6 +11,7 @@ class HybridModelState extends ConsumerState<HybridModel> { @override Widget build(BuildContext context) { + bool randomHybridAnimation = ref.watch(appConfigProvider).randomHybridAnimation; if (!randomHybridAnimation) { ref.listen<Vehicle>(vehicleProvider, (Vehicle? previous, Vehicle next) { ref.watch(hybridStateProvider.notifier).updateHybridState( @@ -25,7 +26,7 @@ class HybridModelState extends ConsumerState<HybridModel> { height: 500, child: Stack( children: [ - HybridBackround(), + HybridBackground(), TopArrow(), LeftArrow(), RightArrow(), |