diff options
author | Scott Murray <scott.murray@konsulko.com> | 2024-01-23 16:22:17 -0500 |
---|---|---|
committer | Scott Murray <scott.murray@konsulko.com> | 2024-01-23 16:40:14 -0500 |
commit | 5587c6ae79b482fbff26442bb239d7d7eb55a337 (patch) | |
tree | 781ed45ea798f3a4dde8d132e0282b534d1ed190 /lib/presentation/screens/home/home.dart | |
parent | 6046300bd723d9289a15d28112b653e6f2b29dec (diff) |
Improve background disablingricefish_18.0.0ricefish/18.0.0quillback_17.1.4quillback_17.1.3quillback_17.1.2quillback_17.1.1quillback_17.1.0quillback_17.0.2quillback_17.0.1quillback_17.0.0quillback/17.1.4quillback/17.1.3quillback/17.1.2quillback/17.1.1quillback/17.1.0quillback/17.0.2quillback/17.0.1quillback/17.0.018.0.017.1.417.1.317.1.217.1.117.1.017.0.217.0.117.0.0
Rework things to show the first frame of the background animation
when the animation is disabled. A new 'plain-bg' option has been
added to the configuration in case the previous behavior is still
desired.
Bug-AGL: SPEC-5054
Change-Id: I15dde41fe8472bea8ef9690ad188ee6d2ba5c3af
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Diffstat (limited to 'lib/presentation/screens/home/home.dart')
-rw-r--r-- | lib/presentation/screens/home/home.dart | 37 |
1 files changed, 25 insertions, 12 deletions
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, |