Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/repo/chore/advanced-deployment' …
Browse files Browse the repository at this point in the history
…into repo/chore/advanced-deployment
  • Loading branch information
DenuxPlays committed Apr 18, 2024
2 parents 0cec4b8 + 5ee23e3 commit 4002187
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
12 changes: 10 additions & 2 deletions frontend/lib/data/store.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class KeyValueStore {
/// by either using the [toValue] function of the key or by simply returning
/// its toString() representation.
String? readAsStringSync<T>(StoreKey<T> key) {
return _toStringOrValue<T?>(readSync(key), key);
return _toStringOrValue<T?>(readSync(key), key).toString();
}

/// Reads the value of the key from the local cache.
Expand All @@ -118,6 +118,10 @@ class KeyValueStore {
Future<void> write<T>(StoreKey<T> key, T value) async {
_checkInitialized();
_localCache[key.key] = value;
// simplify enums to strings
if (value is Enum) {
return await write(key, value.name);
}
final dynamic effectiveValue = _toStringOrValue<T?>(value, key);
if (key.secure) {
return await _storage.write(key: key.key, value: effectiveValue);
Expand Down Expand Up @@ -186,7 +190,11 @@ class KeyValueStore {
}

static dynamic _toStringOrValue<T>(T value, StoreKey<T> key) {
return key.toValue?.call(value) ?? value;
final dynamic d = key.toValue?.call(value) ?? value;
if (d is Enum) {
return d.name;
}
return d;
}

static T? _fromStringOrValue<T>(dynamic value, StoreKey<T> key) {
Expand Down
6 changes: 4 additions & 2 deletions frontend/lib/layout/scaffold_navbar_shell.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:financrr_frontend/util/extensions.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';

Expand Down Expand Up @@ -65,11 +66,12 @@ class ScaffoldNavBarShellState extends State<ScaffoldNavBarShell> {
@override
Widget build(BuildContext context) {
final isMobile = context.isMobile;
final Widget shell = kIsWeb ? SelectionArea(child: widget.navigationShell) : widget.navigationShell;
return Scaffold(
body: SafeArea(
top: false,
child: isMobile
? widget.navigationShell
? shell
: Row(
children: [
StatefulBuilder(builder: (context, setState) {
Expand All @@ -84,7 +86,7 @@ class ScaffoldNavBarShellState extends State<ScaffoldNavBarShell> {
);
}),
Expanded(
child: widget.navigationShell,
child: shell,
)
],
),
Expand Down

0 comments on commit 4002187

Please sign in to comment.