Add table creation
This commit is contained in:
parent
09c9549004
commit
4a5039cb19
19 changed files with 1132 additions and 141 deletions
51
lib/widgets/table_field_widget.dart
Normal file
51
lib/widgets/table_field_widget.dart
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:tuuli_app/api/model/table_field_model.dart';
|
||||
|
||||
class TableFieldWidget<T> extends StatelessWidget {
|
||||
final TableField<T> field;
|
||||
final VoidCallback? onRemove;
|
||||
|
||||
const TableFieldWidget({
|
||||
super.key,
|
||||
required this.field,
|
||||
this.onRemove,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Card(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
margin: const EdgeInsets.all(8),
|
||||
child: Row(
|
||||
children: [
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
if (field.isPrimary) const Icon(Icons.star),
|
||||
if (field.isUnique) const Icon(Icons.lock),
|
||||
Text(
|
||||
"Field \"${field.fieldName}\"",
|
||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
Text("Field type: ${field.fieldType} (baked by ${field.type})"),
|
||||
],
|
||||
),
|
||||
if (onRemove != null) const Spacer(),
|
||||
if (onRemove != null)
|
||||
IconButton(
|
||||
icon: const Icon(Icons.delete),
|
||||
onPressed: onRemove,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue