summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--assets/BG_Sequence_00000.pngbin0 -> 1574415 bytes
-rw-r--r--lib/data/data_providers/app_config_provider.dart15
-rw-r--r--lib/presentation/screens/home/home.dart37
3 files changed, 40 insertions, 12 deletions
diff --git a/assets/BG_Sequence_00000.png b/assets/BG_Sequence_00000.png
new file mode 100644
index 0000000..b28ca0d
--- /dev/null
+++ b/assets/BG_Sequence_00000.png
Binary files differ
diff --git a/lib/data/data_providers/app_config_provider.dart b/lib/data/data_providers/app_config_provider.dart
index 2f6d4bc..7ec8d8a 100644
--- a/lib/data/data_providers/app_config_provider.dart
+++ b/lib/data/data_providers/app_config_provider.dart
@@ -73,6 +73,7 @@ class MpdConfig {
class AppConfig {
final bool disableBkgAnimation;
+ final bool plainBackground;
final bool randomHybridAnimation;
final KuksaConfig kuksaConfig;
final RadioConfig radioConfig;
@@ -82,6 +83,7 @@ class AppConfig {
AppConfig(
{required this.disableBkgAnimation,
+ required this.plainBackground,
required this.randomHybridAnimation,
required this.kuksaConfig,
required this.radioConfig,
@@ -151,6 +153,7 @@ class AppConfig {
ca_certificate: ca_cert,
tls_server_name: tls_server_name);
} catch (_) {
+ debugPrint("Invalid KUKSA.val configuration, using defaults");
return KuksaConfig.defaultConfig();
}
}
@@ -174,6 +177,7 @@ class AppConfig {
return RadioConfig(hostname: hostname, port: port, presets: presets);
} catch (_) {
+ debugPrint("Invalid radio configuration, using defaults");
return RadioConfig.defaultConfig();
}
}
@@ -192,6 +196,7 @@ class AppConfig {
return MpdConfig(hostname: hostname, port: port);
} catch (_) {
+ debugPrint("Invalid MPD configuration, using defaults");
return MpdConfig.defaultConfig();
}
}
@@ -239,6 +244,14 @@ final appConfigProvider = Provider((ref) {
}
}
+ bool plainBackground = false;
+ if (yamlMap.containsKey('plain-bg')) {
+ var value = yamlMap['plain-bg'];
+ if (value is bool) {
+ plainBackground = value;
+ }
+ }
+
bool randomHybridAnimation = randomHybridAnimationDefault;
if (yamlMap.containsKey('random-hybrid-animation')) {
var value = yamlMap['random-hybrid-animation'];
@@ -249,6 +262,7 @@ final appConfigProvider = Provider((ref) {
return AppConfig(
disableBkgAnimation: disableBkgAnimation,
+ plainBackground: plainBackground,
randomHybridAnimation: randomHybridAnimation,
kuksaConfig: kuksaConfig,
radioConfig: radioConfig,
@@ -256,6 +270,7 @@ final appConfigProvider = Provider((ref) {
} catch (_) {
return AppConfig(
disableBkgAnimation: false,
+ plainBackground: false,
randomHybridAnimation: false,
kuksaConfig: KuksaConfig.defaultConfig(),
radioConfig: RadioConfig.defaultConfig(),
diff --git a/lib/presentation/screens/home/home.dart b/lib/presentation/screens/home/home.dart
index 8f0d125..0ee52ac 100644
--- a/lib/presentation/screens/home/home.dart
+++ b/lib/presentation/screens/home/home.dart
@@ -1,6 +1,25 @@
import 'package:flutter_ics_homescreen/export.dart';
// import 'package:media_kit_video/media_kit_video.dart';
+final bkgImageProvider = Provider((ref) {
+ return Container(
+ width: 1080,
+ height: 1920,
+ decoration: const BoxDecoration(
+ image: DecorationImage(
+ image: AssetImage("assets/BG_Sequence_00000.png"),
+ ),
+ ));
+});
+
+final bkgAnimationProvider = Provider((ref) {
+ return Lottie.asset(
+ 'animations/BG-dotwaveform.json',
+ fit: BoxFit.cover,
+ repeat: true,
+ );
+});
+
class HomeScreen extends ConsumerStatefulWidget {
const HomeScreen({
super.key,
@@ -24,16 +43,12 @@ class HomeScreenState extends ConsumerState<HomeScreen> {
}
@override
- Widget build(
- BuildContext context,
- ) {
+ Widget build(BuildContext context) {
return Consumer(builder: (context, ref, child) {
final appState = ref.watch(appProvider);
final bool disableBkgAnimation =
- ref.read(appConfigProvider).disableBkgAnimation;
- if (disableBkgAnimation) {
- print('Background animation: disabled');
- }
+ ref.watch(appConfigProvider).disableBkgAnimation;
+ final bool plainBackground = ref.watch(appConfigProvider).plainBackground;
return Scaffold(
key: homeScaffoldKey,
extendBody: true,
@@ -42,11 +57,9 @@ class HomeScreenState extends ConsumerState<HomeScreen> {
body: Stack(
children: [
if (!disableBkgAnimation)
- Lottie.asset(
- 'animations/BG-dotwaveform.json',
- fit: BoxFit.cover,
- repeat: true,
- ),
+ ref.watch(bkgAnimationProvider)
+ else if (!plainBackground)
+ ref.watch(bkgImageProvider),
FlowBuilder<AppState>(
state: appState,
onGeneratePages: onGenerateAppViewPages,