From e29f86c15b7ece37b30b7f5c4978130eaa824239 Mon Sep 17 00:00:00 2001 From: Drews Clausen Date: Tue, 7 Dec 2021 00:25:03 +0100 Subject: [PATCH] Added a parameter to skip the "client.isLogged()" check on the MatrixState in the OnePageCard. --- lib/widgets/layouts/one_page_card.dart | 10 +++++++++- lib/widgets/lock_screen.dart | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/widgets/layouts/one_page_card.dart b/lib/widgets/layouts/one_page_card.dart index 130c1cb0b..0ca4bec15 100644 --- a/lib/widgets/layouts/one_page_card.dart +++ b/lib/widgets/layouts/one_page_card.dart @@ -10,7 +10,14 @@ import 'package:fluffychat/widgets/matrix.dart'; class OnePageCard extends StatelessWidget { final Widget child; - const OnePageCard({Key? key, required this.child}) : super(key: key); + /// This will cause the "isLogged()" check to be skipped and force a + /// OnePageCard without login wallpaper. This can be used in situations where + /// "Matrix.of(context) is not yet available, e.g. in the LockScreen widget. + final bool forceBackgroundless; + + const OnePageCard( + {Key? key, required this.child, this.forceBackgroundless = false}) + : super(key: key); static const int alpha = 12; static num breakpoint = FluffyThemes.columnWidth * 2; @@ -19,6 +26,7 @@ class OnePageCard extends StatelessWidget { final horizontalPadding = max((MediaQuery.of(context).size.width - 600) / 2, 24); return MediaQuery.of(context).size.width <= breakpoint || + forceBackgroundless || Matrix.of(context).client.isLogged() ? child : Container( diff --git a/lib/widgets/lock_screen.dart b/lib/widgets/lock_screen.dart index 5382fa00a..52853b55f 100644 --- a/lib/widgets/lock_screen.dart +++ b/lib/widgets/lock_screen.dart @@ -30,6 +30,7 @@ class _LockScreenState extends State { supportedLocales: L10n.supportedLocales, home: Builder( builder: (context) => OnePageCard( + forceBackgroundless: true, child: Scaffold( appBar: AppBar( automaticallyImplyLeading: false,