2020-09-01 21:36:58 +02:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
2020-09-30 19:05:00 +02:00
|
|
|
/// Should be spawned with a showModalBottomSheet, not routed to.
|
2020-09-01 21:36:58 +02:00
|
|
|
class BottomModal extends StatelessWidget {
|
|
|
|
final Widget child;
|
|
|
|
final String title;
|
|
|
|
|
2021-01-03 18:21:56 +01:00
|
|
|
const BottomModal({@required this.child, this.title});
|
2020-09-01 21:36:58 +02:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2020-09-16 23:22:04 +02:00
|
|
|
final theme = Theme.of(context);
|
2020-09-01 21:36:58 +02:00
|
|
|
|
2020-09-02 16:54:29 +02:00
|
|
|
return SafeArea(
|
|
|
|
child: Padding(
|
2021-01-03 18:03:59 +01:00
|
|
|
padding: const EdgeInsets.all(8),
|
2020-09-05 23:48:30 +02:00
|
|
|
child: SingleChildScrollView(
|
|
|
|
child: Container(
|
2020-09-09 21:23:58 +02:00
|
|
|
padding: title != null ? const EdgeInsets.only(top: 10) : null,
|
2020-09-05 23:48:30 +02:00
|
|
|
decoration: BoxDecoration(
|
2021-01-09 02:49:01 +01:00
|
|
|
color: theme.scaffoldBackgroundColor,
|
|
|
|
borderRadius: const BorderRadius.all(Radius.circular(10)),
|
|
|
|
border: Border.all(
|
|
|
|
color: Colors.grey.withOpacity(0.5),
|
|
|
|
width: 0.2,
|
|
|
|
)),
|
2020-09-05 23:48:30 +02:00
|
|
|
child: Column(
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
if (title != null) ...[
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.only(left: 70),
|
|
|
|
child: Text(
|
|
|
|
title,
|
|
|
|
style: theme.textTheme.subtitle2,
|
|
|
|
textAlign: TextAlign.left,
|
|
|
|
),
|
2020-09-02 16:54:29 +02:00
|
|
|
),
|
2021-01-03 19:43:39 +01:00
|
|
|
const Divider(
|
2020-09-05 23:48:30 +02:00
|
|
|
indent: 20,
|
|
|
|
endIndent: 20,
|
|
|
|
)
|
|
|
|
],
|
|
|
|
child,
|
2020-09-02 16:54:29 +02:00
|
|
|
],
|
2020-09-05 23:48:30 +02:00
|
|
|
),
|
2020-09-02 16:54:29 +02:00
|
|
|
),
|
2020-09-01 21:36:58 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|