2021-04-09 14:56:23 +02:00
|
|
|
import 'dart:math';
|
|
|
|
|
2021-05-29 09:56:52 +02:00
|
|
|
import 'package:fluffychat/config/themes.dart';
|
2021-09-19 13:48:23 +02:00
|
|
|
import 'package:fluffychat/widgets/matrix.dart';
|
2021-04-09 14:56:23 +02:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
class OnePageCard extends StatelessWidget {
|
|
|
|
final Widget child;
|
|
|
|
|
|
|
|
const OnePageCard({Key key, this.child}) : super(key: key);
|
|
|
|
|
2021-05-01 07:45:11 +02:00
|
|
|
static const int alpha = 12;
|
2021-05-29 09:56:52 +02:00
|
|
|
static num breakpoint = FluffyThemes.columnWidth * 2;
|
2021-04-09 14:56:23 +02:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2021-09-19 13:48:23 +02:00
|
|
|
return MediaQuery.of(context).size.width <= breakpoint ||
|
|
|
|
Matrix.of(context).client.isLogged()
|
2021-04-09 15:48:50 +02:00
|
|
|
? child
|
2021-08-31 11:51:39 +02:00
|
|
|
: Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
image: DecorationImage(
|
|
|
|
image: AssetImage('assets/login_wallpaper.jpg'),
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: Padding(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal:
|
|
|
|
max((MediaQuery.of(context).size.width - 600) / 2, 24),
|
|
|
|
vertical:
|
|
|
|
max((MediaQuery.of(context).size.height - 800) / 2, 24),
|
2021-04-09 15:48:50 +02:00
|
|
|
),
|
2021-08-31 11:51:39 +02:00
|
|
|
child: SafeArea(child: Card(elevation: 5, child: child)),
|
2021-04-09 15:48:50 +02:00
|
|
|
),
|
|
|
|
);
|
2021-04-09 14:56:23 +02:00
|
|
|
}
|
|
|
|
}
|