mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2025-02-02 16:14:21 +01:00
Added a parameter to skip the "client.isLogged()" check on the MatrixState in the OnePageCard.
This commit is contained in:
parent
5fc10f4571
commit
5221a07cc7
@ -10,7 +10,14 @@ import 'package:fluffychat/widgets/matrix.dart';
|
|||||||
class OnePageCard extends StatelessWidget {
|
class OnePageCard extends StatelessWidget {
|
||||||
final Widget child;
|
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 const int alpha = 12;
|
||||||
static num breakpoint = FluffyThemes.columnWidth * 2;
|
static num breakpoint = FluffyThemes.columnWidth * 2;
|
||||||
@ -19,6 +26,7 @@ class OnePageCard extends StatelessWidget {
|
|||||||
final horizontalPadding =
|
final horizontalPadding =
|
||||||
max<double>((MediaQuery.of(context).size.width - 600) / 2, 24);
|
max<double>((MediaQuery.of(context).size.width - 600) / 2, 24);
|
||||||
return MediaQuery.of(context).size.width <= breakpoint ||
|
return MediaQuery.of(context).size.width <= breakpoint ||
|
||||||
|
forceBackgroundless ||
|
||||||
Matrix.of(context).client.isLogged()
|
Matrix.of(context).client.isLogged()
|
||||||
? child
|
? child
|
||||||
: Container(
|
: Container(
|
||||||
|
@ -30,6 +30,7 @@ class _LockScreenState extends State<LockScreen> {
|
|||||||
supportedLocales: L10n.supportedLocales,
|
supportedLocales: L10n.supportedLocales,
|
||||||
home: Builder(
|
home: Builder(
|
||||||
builder: (context) => OnePageCard(
|
builder: (context) => OnePageCard(
|
||||||
|
forceBackgroundless: true,
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
automaticallyImplyLeading: false,
|
automaticallyImplyLeading: false,
|
||||||
|
Loading…
Reference in New Issue
Block a user