2021-04-09 14:56:23 +02:00
|
|
|
import 'dart:math';
|
|
|
|
|
|
|
|
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-01 07:46:33 +02:00
|
|
|
static const int breakpoint = 600;
|
2021-04-09 14:56:23 +02:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2021-05-01 07:46:33 +02:00
|
|
|
return MediaQuery.of(context).size.width <= breakpoint ||
|
|
|
|
MediaQuery.of(context).size.height <= breakpoint
|
2021-04-09 15:48:50 +02:00
|
|
|
? child
|
2021-05-23 13:28:55 +02:00
|
|
|
: Material(
|
|
|
|
color: Theme.of(context).backgroundColor,
|
|
|
|
child: Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
gradient: LinearGradient(
|
|
|
|
begin: Alignment.topRight,
|
|
|
|
end: Alignment.bottomLeft,
|
|
|
|
stops: [
|
|
|
|
0.1,
|
|
|
|
0.4,
|
|
|
|
0.6,
|
|
|
|
0.9,
|
|
|
|
],
|
|
|
|
colors: [
|
|
|
|
Theme.of(context).secondaryHeaderColor.withAlpha(alpha),
|
|
|
|
Theme.of(context).primaryColor.withAlpha(alpha),
|
2021-05-24 10:59:00 +02:00
|
|
|
Theme.of(context).colorScheme.secondary.withAlpha(alpha),
|
2021-05-23 13:28:55 +02:00
|
|
|
Theme.of(context).backgroundColor.withAlpha(alpha),
|
|
|
|
],
|
|
|
|
),
|
2021-04-09 15:48:50 +02:00
|
|
|
),
|
2021-05-23 13:28:55 +02:00
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal:
|
|
|
|
max((MediaQuery.of(context).size.width - 600) / 2, 12),
|
|
|
|
vertical:
|
|
|
|
max((MediaQuery.of(context).size.height - 800) / 2, 12),
|
|
|
|
),
|
|
|
|
child: SafeArea(child: Card(child: child)),
|
2021-04-09 15:48:50 +02:00
|
|
|
),
|
|
|
|
);
|
2021-04-09 14:56:23 +02:00
|
|
|
}
|
|
|
|
}
|