diff --git a/lib/components/editor_pane/request_headers.dart b/lib/components/editor_pane/request_headers.dart index be28c380..4263b99b 100644 --- a/lib/components/editor_pane/request_headers.dart +++ b/lib/components/editor_pane/request_headers.dart @@ -62,12 +62,29 @@ class EditRequestHeadersState extends ConsumerState { @override 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); - rows = ref - .read(collectionStateNotifierProvider.notifier) - .getRequestModel(activeId!) - .requestHeaders ?? - []; + final collection = ref.watch(collectionStateNotifierProvider); + final idIdx = collection.indexWhere((m) => m.id == activeId); + rows = collection[idIdx].requestHeaders ?? [const KVRow("", "")]; DaviModel model = DaviModel( rows: rows, columns: [ @@ -83,6 +100,23 @@ class EditRequestHeadersState extends ConsumerState { cellBuilder: _buildValueField, sortable: false, ), + DaviColumn( + pinStatus: PinStatus.none, + width: 30, + cellBuilder: (BuildContext context, DaviRow 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( @@ -108,7 +142,7 @@ class EditRequestHeadersState extends ConsumerState { child: ElevatedButton.icon( onPressed: () { rows.add(const KVRow("", "")); - model.addRow(const KVRow("", "")); + _onFieldChange(activeId!); }, icon: const Icon(Icons.add), label: const Text( diff --git a/lib/components/editor_pane/request_params.dart b/lib/components/editor_pane/request_params.dart index ebd09cfe..5c3558a2 100644 --- a/lib/components/editor_pane/request_params.dart +++ b/lib/components/editor_pane/request_params.dart @@ -63,6 +63,25 @@ class EditRequestURLParamsState extends ConsumerState { @override 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 collection = ref.watch(collectionStateNotifierProvider); final idIdx = collection.indexWhere((m) => m.id == activeId); @@ -87,11 +106,16 @@ class EditRequestURLParamsState extends ConsumerState { width: 30, cellBuilder: (BuildContext context, DaviRow row) { return InkWell( - child: const Icon(Icons.remove_circle, size: 16), - onTap: () { - rows.removeAt(row.index); - _onFieldChange(activeId!); - }); + child: Icon( + Icons.remove_circle, + size: 16, + color: Colors.red.withOpacity(0.9), + ), + onTap: () { + rows.removeAt(row.index); + _onFieldChange(activeId!); + }, + ); }, ), ], diff --git a/lib/components/styles.dart b/lib/components/styles.dart index e78b26f5..68de283a 100644 --- a/lib/components/styles.dart +++ b/lib/components/styles.dart @@ -22,24 +22,6 @@ const tableContainerDecoration = BoxDecoration( color: colorBg, 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 p10 = EdgeInsets.all(10);