selfprivacy.org.app/lib/ui/components/brand_bottom_sheet/brand_bottom_sheet.dart

60 lines
1.5 KiB
Dart
Raw Normal View History

2021-05-26 00:53:54 +03:00
import 'package:flutter/material.dart';
2021-06-08 21:52:44 +03:00
import 'package:selfprivacy/config/brand_colors.dart';
2021-05-26 00:53:54 +03:00
class BrandBottomSheet extends StatelessWidget {
2021-06-21 00:08:52 +03:00
const BrandBottomSheet({
Key? key,
required this.child,
this.isExpended = false,
}) : super(key: key);
2021-05-26 00:53:54 +03:00
final Widget child;
2021-06-21 00:08:52 +03:00
final bool isExpended;
2021-05-26 00:53:54 +03:00
@override
Widget build(BuildContext context) {
2021-06-08 21:52:44 +03:00
var mainHeight = MediaQuery.of(context).size.height -
MediaQuery.of(context).padding.top -
100;
2021-06-21 00:08:52 +03:00
late Widget innerWidget;
if (isExpended) {
innerWidget = Scaffold(
body: child,
);
} else {
final ThemeData themeData = Theme.of(context);
innerWidget = Material(
color: themeData.scaffoldBackgroundColor,
child: IntrinsicHeight(child: child),
);
}
2021-06-08 21:52:44 +03:00
return ConstrainedBox(
constraints: BoxConstraints(maxHeight: mainHeight + 4 + 6),
child: Column(
2021-06-21 00:08:52 +03:00
mainAxisSize: MainAxisSize.min,
2021-06-08 21:52:44 +03:00
children: [
Center(
child: Container(
height: 4,
width: 30,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(2),
color: BrandColors.gray4,
),
),
2021-05-26 00:53:54 +03:00
),
2021-06-08 21:52:44 +03:00
SizedBox(height: 6),
ClipRRect(
2021-06-21 00:08:52 +03:00
borderRadius: BorderRadius.vertical(top: Radius.circular(20)),
2021-06-08 21:52:44 +03:00
child: ConstrainedBox(
constraints: BoxConstraints(maxHeight: mainHeight),
2021-06-21 00:08:52 +03:00
child: innerWidget,
2021-06-08 21:52:44 +03:00
),
),
],
2021-05-26 00:53:54 +03:00
),
);
}
}