Set environment variables for enabling debugging screen and main animation. 48/29448/4
authorLisandro Pérez Meyer <lpmeyer@ics.com>
Fri, 17 Nov 2023 17:11:58 +0000 (14:11 -0300)
committerLisandro Pérez Meyer <lpmeyer@ics.com>
Sun, 19 Nov 2023 17:06:17 +0000 (14:06 -0300)
Change-Id: Ia4100f300b7f8507564ef80a1fc56c2352cfd5ce
Signed-off-by: Lisandro Pérez Meyer <lpmeyer@ics.com>
README.md
lib/main.dart
lib/presentation/screens/home/home.dart

index cf7d4c6..92c8463 100644 (file)
--- a/README.md
+++ b/README.md
@@ -14,3 +14,14 @@ A few resources to get you started if this is your first Flutter project:
 For help getting started with Flutter development, view the
 [online documentation](https://docs.flutter.dev/), which offers tutorials,
 samples, guidance on mobile development, and a full API reference.
+
+## Useful environment variables
+
+- **DEBUG_DISPLAY** enables the Device Preview.
+- **DISABLE_BKG_ANIMATION** disables the main background animation.
+
+Use them like this:
+
+```
+flutter run --dart-define=DEBUG_DISPLAY=true,DISABLE_BKG_ANIMATION=true
+```
\ No newline at end of file
index 3b896fc..85c7506 100644 (file)
@@ -4,8 +4,9 @@ import 'export.dart';
 
 void main() async {
   WidgetsFlutterBinding.ensureInitialized();
+  const debugDisplay = bool.fromEnvironment('DEBUG_DISPLAY');
   runApp(DevicePreview(
-    enabled: false,
+    enabled: debugDisplay,
     tools: const [
       ...DevicePreview.defaultTools,
     ],
index a18e640..41f6895 100644 (file)
@@ -31,6 +31,9 @@ class HomeScreenState extends ConsumerState<HomeScreen> {
   ) {
     return Consumer(builder: (context, ref, child) {
       final state = ref.read(appProvider);
+      const disableBkgAnimation = bool.fromEnvironment('DISABLE_BKG_ANIMATION');
+      if(disableBkgAnimation)
+        print('Background animation: disabled');
       return Scaffold(
         key: homeScaffoldKey,
         extendBody: true,
@@ -38,11 +41,12 @@ class HomeScreenState extends ConsumerState<HomeScreen> {
         appBar: const CustomTopBar(),
         body: Stack(
           children: [
-            Lottie.asset(
-              'animations/BG-dotwaveform.json',
-              fit: BoxFit.cover,
-              repeat: true,
-            ),
+            if (!disableBkgAnimation)
+              Lottie.asset(
+                'animations/BG-dotwaveform.json',
+                fit: BoxFit.cover,
+                repeat: true,
+              ),
             FlowBuilder<AppState>(
               state: ref.watch(appProvider),
               onGeneratePages: onGenerateAppViewPages,