diff options
author | Scott Murray <scott.murray@konsulko.com> | 2024-07-31 11:30:22 -0400 |
---|---|---|
committer | Scott Murray <scott.murray@konsulko.com> | 2024-08-01 14:29:54 +0000 |
commit | 6188a4c545e6e6794eba943431ec20108553b98f (patch) | |
tree | cc55957a7f1678078406f38a92be3c12bb663495 /lib/data | |
parent | 60f049213525a7f487d0cd527f2bea675451409f (diff) |
Add support for CI screenshot testing
Rework the high-level App & AppView widgets a bit to allow
conditionally displaying a simple fixed pattern if the
HOMESCREEN_DEMO_CI environment variable is set to anything
other than "0". The pattern displayed matches what the
Qt homescreen shows for this to allow the CI test to be
common.
Bug-AGL: SPEC-5203
Change-Id: I36ed77c91304e3b6cdbce6a7350831d52d20d378
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
(cherry picked from commit 25b6a079d5fe9c1365d776298ae5230a4de1ba16)
Diffstat (limited to 'lib/data')
-rw-r--r-- | lib/data/data_providers/app.dart | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/lib/data/data_providers/app.dart b/lib/data/data_providers/app.dart index acfaa01..3368a83 100644 --- a/lib/data/data_providers/app.dart +++ b/lib/data/data_providers/app.dart @@ -1,25 +1,32 @@ import '../../export.dart'; +final homeScreenProvider = Provider((ref) { + final Map<String, String> envVars = Platform.environment; + final ciFlagStr = envVars['HOMESCREEN_DEMO_CI']; + final bool ciFlag = ciFlagStr != null && ciFlagStr != "0"; + return ciFlag ? const HomeScreenCI() : const HomeScreen(); +}); + class App extends StatelessWidget { const App({super.key}); @override Widget build(BuildContext context) { - return const AppView(); - } -} - -class AppView extends StatelessWidget { - const AppView({super.key}); - - @override - Widget build(BuildContext context) { return ProviderScope( child: MaterialApp( debugShowCheckedModeBanner: false, theme: theme, - home: const HomeScreen(), + home: const AppView(), ), ); } } + +class AppView extends ConsumerWidget { + const AppView({super.key}); + + @override + Widget build(BuildContext context, WidgetRef ref) { + return ref.watch(homeScreenProvider); + } +} |