mirror of
https://github.com/foss42/apidash.git
synced 2025-12-12 16:17:34 +08:00
Table header to M3
This commit is contained in:
@@ -62,12 +62,29 @@ class EditRequestHeadersState extends ConsumerState<EditRequestHeaders> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final tableThemeData = DaviThemeData(
|
||||||
|
columnDividerThickness: 1,
|
||||||
|
columnDividerColor: colorGrey100,
|
||||||
|
row: RowThemeData(dividerColor: colorGrey100),
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
border: Border(),
|
||||||
|
),
|
||||||
|
header: HeaderThemeData(
|
||||||
|
color: Theme.of(context).colorScheme.surface,
|
||||||
|
columnDividerColor: colorGrey100,
|
||||||
|
bottomBorderHeight: 1,
|
||||||
|
bottomBorderColor: colorGrey100,
|
||||||
|
),
|
||||||
|
headerCell: const HeaderCellThemeData(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
textStyle: null,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
final activeId = ref.watch(activeItemIdStateProvider);
|
final activeId = ref.watch(activeItemIdStateProvider);
|
||||||
rows = ref
|
final collection = ref.watch(collectionStateNotifierProvider);
|
||||||
.read(collectionStateNotifierProvider.notifier)
|
final idIdx = collection.indexWhere((m) => m.id == activeId);
|
||||||
.getRequestModel(activeId!)
|
rows = collection[idIdx].requestHeaders ?? [const KVRow("", "")];
|
||||||
.requestHeaders ??
|
|
||||||
[];
|
|
||||||
DaviModel<KVRow> model = DaviModel<KVRow>(
|
DaviModel<KVRow> model = DaviModel<KVRow>(
|
||||||
rows: rows,
|
rows: rows,
|
||||||
columns: [
|
columns: [
|
||||||
@@ -83,6 +100,23 @@ class EditRequestHeadersState extends ConsumerState<EditRequestHeaders> {
|
|||||||
cellBuilder: _buildValueField,
|
cellBuilder: _buildValueField,
|
||||||
sortable: false,
|
sortable: false,
|
||||||
),
|
),
|
||||||
|
DaviColumn(
|
||||||
|
pinStatus: PinStatus.none,
|
||||||
|
width: 30,
|
||||||
|
cellBuilder: (BuildContext context, DaviRow<KVRow> row) {
|
||||||
|
return InkWell(
|
||||||
|
child: Icon(
|
||||||
|
Icons.remove_circle,
|
||||||
|
size: 16,
|
||||||
|
color: Colors.red.withOpacity(0.9),
|
||||||
|
),
|
||||||
|
onTap: () {
|
||||||
|
rows.removeAt(row.index);
|
||||||
|
_onFieldChange(activeId!);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
return Stack(
|
return Stack(
|
||||||
@@ -108,7 +142,7 @@ class EditRequestHeadersState extends ConsumerState<EditRequestHeaders> {
|
|||||||
child: ElevatedButton.icon(
|
child: ElevatedButton.icon(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
rows.add(const KVRow("", ""));
|
rows.add(const KVRow("", ""));
|
||||||
model.addRow(const KVRow("", ""));
|
_onFieldChange(activeId!);
|
||||||
},
|
},
|
||||||
icon: const Icon(Icons.add),
|
icon: const Icon(Icons.add),
|
||||||
label: const Text(
|
label: const Text(
|
||||||
|
|||||||
@@ -63,6 +63,25 @@ class EditRequestURLParamsState extends ConsumerState<EditRequestURLParams> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final tableThemeData = DaviThemeData(
|
||||||
|
columnDividerThickness: 1,
|
||||||
|
columnDividerColor: colorGrey100,
|
||||||
|
row: RowThemeData(dividerColor: colorGrey100),
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
border: Border(),
|
||||||
|
),
|
||||||
|
header: HeaderThemeData(
|
||||||
|
color: Theme.of(context).colorScheme.surface,
|
||||||
|
columnDividerColor: colorGrey100,
|
||||||
|
bottomBorderHeight: 1,
|
||||||
|
bottomBorderColor: colorGrey100,
|
||||||
|
),
|
||||||
|
headerCell: const HeaderCellThemeData(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
textStyle: null,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
final activeId = ref.watch(activeItemIdStateProvider);
|
final activeId = ref.watch(activeItemIdStateProvider);
|
||||||
final collection = ref.watch(collectionStateNotifierProvider);
|
final collection = ref.watch(collectionStateNotifierProvider);
|
||||||
final idIdx = collection.indexWhere((m) => m.id == activeId);
|
final idIdx = collection.indexWhere((m) => m.id == activeId);
|
||||||
@@ -87,11 +106,16 @@ class EditRequestURLParamsState extends ConsumerState<EditRequestURLParams> {
|
|||||||
width: 30,
|
width: 30,
|
||||||
cellBuilder: (BuildContext context, DaviRow<KVRow> row) {
|
cellBuilder: (BuildContext context, DaviRow<KVRow> row) {
|
||||||
return InkWell(
|
return InkWell(
|
||||||
child: const Icon(Icons.remove_circle, size: 16),
|
child: Icon(
|
||||||
|
Icons.remove_circle,
|
||||||
|
size: 16,
|
||||||
|
color: Colors.red.withOpacity(0.9),
|
||||||
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
rows.removeAt(row.index);
|
rows.removeAt(row.index);
|
||||||
_onFieldChange(activeId!);
|
_onFieldChange(activeId!);
|
||||||
});
|
},
|
||||||
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -22,24 +22,6 @@ const tableContainerDecoration = BoxDecoration(
|
|||||||
color: colorBg,
|
color: colorBg,
|
||||||
borderRadius: border12,
|
borderRadius: border12,
|
||||||
);
|
);
|
||||||
final tableThemeData = DaviThemeData(
|
|
||||||
columnDividerThickness: 1,
|
|
||||||
columnDividerColor: colorGrey100,
|
|
||||||
row: RowThemeData(dividerColor: colorGrey100),
|
|
||||||
decoration: const BoxDecoration(
|
|
||||||
border: Border(),
|
|
||||||
),
|
|
||||||
header: HeaderThemeData(
|
|
||||||
color: colorGrey50,
|
|
||||||
columnDividerColor: colorGrey100,
|
|
||||||
bottomBorderHeight: 1,
|
|
||||||
bottomBorderColor: colorGrey100,
|
|
||||||
),
|
|
||||||
headerCell: const HeaderCellThemeData(
|
|
||||||
alignment: Alignment.center,
|
|
||||||
textStyle: null,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
const p5 = EdgeInsets.all(5);
|
const p5 = EdgeInsets.all(5);
|
||||||
const p10 = EdgeInsets.all(10);
|
const p10 = EdgeInsets.all(10);
|
||||||
|
|||||||
Reference in New Issue
Block a user