aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2024-07-31 11:30:22 -0400
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2024-08-01 10:08:49 +0000
commit25b6a079d5fe9c1365d776298ae5230a4de1ba16 (patch)
tree41e1dc22ba9cfb9a6b78755e928ac321cc97851c /lib
parentf957ceb8e7220261be82ae8ba27a29ddad5daff2 (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>
Diffstat (limited to 'lib')
-rw-r--r--lib/data/data_providers/app.dart27
-rw-r--r--lib/export.dart1
-rw-r--r--lib/presentation/screens/home/home_ci.dart20
3 files changed, 38 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);
+ }
+}
diff --git a/lib/export.dart b/lib/export.dart
index ef029c7..90ed196 100644
--- a/lib/export.dart
+++ b/lib/export.dart
@@ -16,6 +16,7 @@ export 'data/models/hybrid.dart';
//Screens
export 'presentation/screens/home/home.dart';
+export 'presentation/screens/home/home_ci.dart';
export 'presentation/screens/home/widgets/custom_tile.dart';
export 'presentation/screens/dashboard/dashboard.dart';
export 'presentation/screens/dashboard/widgets/hybrid/hybrid.dart';
diff --git a/lib/presentation/screens/home/home_ci.dart b/lib/presentation/screens/home/home_ci.dart
new file mode 100644
index 0000000..8584420
--- /dev/null
+++ b/lib/presentation/screens/home/home_ci.dart
@@ -0,0 +1,20 @@
+import 'package:flutter_ics_homescreen/export.dart';
+
+// Simple fixed pattern homescreen for AGL CI screenshot testing
+
+class HomeScreenCI extends StatelessWidget {
+ const HomeScreenCI({super.key});
+
+ @override
+ Widget build(BuildContext context) {
+ return Column(
+ children: [
+ // Note that the colors are specified with hex in order to match
+ // Qt's red/blue/green constants, which are different than Flutter's.
+ Container(width: 1080, height: 216, color: Color(0xFF0000FF)),
+ Container(width: 1080, height: 1488, color: Color(0xFFFF0000)),
+ Container(width: 1080, height: 216, color: Color(0xFF008000))
+ ],
+ );
+ }
+}