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

48 lines
1.2 KiB
Dart
Raw Normal View History

2020-10-26 18:47:34 +01:00
import 'package:flutter/material.dart';
2021-02-24 20:52:18 +01:00
import 'bottom_modal.dart';
void showInfoTablePopup({
@required BuildContext context,
@required Map<String, dynamic> table,
String title,
}) {
assert(context != null);
assert(table != null);
showBottomModal(
2020-10-26 18:47:34 +01:00
context: context,
2021-02-24 20:52:18 +01:00
title: title,
builder: (context) => Padding(
padding: const EdgeInsets.symmetric(
2020-10-26 18:47:34 +01:00
horizontal: 20,
vertical: 15,
),
2021-02-24 20:52:18 +01:00
child: Column(
children: [
Table(children: [
for (final e in table.entries)
TableRow(children: [
Text('${e.key}:'),
if (e.value is Map<String, dynamic>)
GestureDetector(
onTap: () => showInfoTablePopup(
context: context,
table: e.value as Map<String, dynamic>,
title: e.key,
),
child: Text(
'[tap to show]',
style: TextStyle(color: Theme.of(context).accentColor),
),
)
else
Text(e.value.toString())
])
]),
],
),
2020-10-26 18:47:34 +01:00
),
);
}