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

57 lines
1.4 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({
required this.child,
super.key,
2021-06-21 00:08:52 +03:00
this.isExpended = false,
2022-06-05 22:36:32 +03:00
});
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
2022-06-05 22:36:32 +03:00
Widget build(final BuildContext context) {
final double mainHeight = MediaQuery.of(context).size.height -
2021-06-08 21:52:44 +03:00
MediaQuery.of(context).padding.top -
300;
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),
);
}
return Column(
mainAxisSize: MainAxisSize.min,
children: [
Center(
child: Container(
height: 4,
width: 30,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(2),
color: BrandColors.gray4,
2021-06-08 21:52:44 +03:00
),
2021-05-26 00:53:54 +03:00
),
),
const SizedBox(height: 6),
ClipRRect(
borderRadius: const BorderRadius.vertical(top: Radius.circular(20)),
child: ConstrainedBox(
constraints: BoxConstraints(maxHeight: mainHeight),
child: innerWidget,
2021-06-08 21:52:44 +03:00
),
),
],
2021-05-26 00:53:54 +03:00
);
}
}