lemmur-app-android/lib/widgets/bottom_modal.dart

51 lines
1.4 KiB
Dart
Raw Normal View History

import 'package:flutter/material.dart';
2020-09-30 19:05:00 +02:00
/// Should be spawned with a showModalBottomSheet, not routed to.
class BottomModal extends StatelessWidget {
final Widget child;
final String title;
BottomModal({@required this.child, this.title});
@override
Widget build(BuildContext context) {
2020-09-16 23:22:04 +02:00
final theme = Theme.of(context);
2020-09-02 16:54:29 +02:00
return SafeArea(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: SingleChildScrollView(
child: Container(
2020-09-09 21:23:58 +02:00
padding: title != null ? const EdgeInsets.only(top: 10) : null,
decoration: BoxDecoration(
color: theme.scaffoldBackgroundColor,
borderRadius: BorderRadius.all(const Radius.circular(10.0)),
),
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
),
Divider(
indent: 20,
endIndent: 20,
)
],
child,
2020-09-02 16:54:29 +02:00
],
),
2020-09-02 16:54:29 +02:00
),
),
),
);
}
}