diff --git a/lib/screens/home_page/editor_pane/details_card/request_pane/request_form_data.dart b/lib/screens/home_page/editor_pane/details_card/request_pane/request_form_data.dart index de703930..b83666a6 100644 --- a/lib/screens/home_page/editor_pane/details_card/request_pane/request_form_data.dart +++ b/lib/screens/home_page/editor_pane/details_card/request_pane/request_form_data.dart @@ -34,13 +34,19 @@ class _FormDataBodyState extends ConsumerState { List columns = const [ DataColumn2( label: Text('Key'), + size: ColumnSize.M, ), DataColumn2( label: Text('='), - fixedWidth: 30, + fixedWidth: 20, + ), + DataColumn2( + label: Text('Type'), + fixedWidth: 70, ), DataColumn2( label: Text('Value'), + size: ColumnSize.L, ), DataColumn2( label: Text('Remove'), @@ -78,30 +84,16 @@ class _FormDataBodyState extends ConsumerState { key: ValueKey("$selectedId-$index-form-row-$seed"), cells: [ DataCell( - Theme( - data: Theme.of(context), - child: FormDataField( - keyId: "$selectedId-$index-form-k-$seed", - initialValue: rows[index].name, - hintText: " Add Key", - onChanged: (value) { - rows[index] = rows[index].copyWith( - name: value, - ); - _onFieldChange(selectedId!); - }, - colorScheme: Theme.of(context).colorScheme, - formDataType: rows[index].type, - onFormDataTypeChanged: (value) { - rows[index] = rows[index].copyWith( - type: value ?? FormDataType.text, - ); - rows[index] = - rows[index].copyWith(value: ""); - setState(() {}); - _onFieldChange(selectedId!); - }, - ), + CellField( + keyId: "$selectedId-$index-form-k-$seed", + initialValue: rows[index].name, + hintText: " Add Key", + onChanged: (value) { + rows[index] = + rows[index].copyWith(name: value); + _onFieldChange(selectedId!); + }, + colorScheme: Theme.of(context).colorScheme, ), ), DataCell( @@ -110,69 +102,56 @@ class _FormDataBodyState extends ConsumerState { style: kCodeStyle, ), ), + DataCell( + DropdownButtonFormData( + formDataType: rows[index].type, + onChanged: (value) { + rows[index] = rows[index].copyWith( + type: value ?? FormDataType.text, + ); + rows[index] = rows[index].copyWith(value: ""); + setState(() {}); + _onFieldChange(selectedId!); + }, + ), + ), DataCell( rows[index].type == FormDataType.file - ? Align( - alignment: Alignment.centerLeft, - child: Row( - children: [ - Expanded( - child: Theme( - data: Theme.of(context), - child: ElevatedButton.icon( - icon: const Icon( - Icons.snippet_folder_rounded, - size: 20, - ), - style: ButtonStyle( - shape: - MaterialStatePropertyAll( - RoundedRectangleBorder( - borderRadius: - BorderRadius.circular( - 6), - ), - ), - ), - onPressed: () async { - var pickedResult = - await pickFile(); - if (pickedResult != null && - pickedResult - .files.isNotEmpty && - pickedResult.files.first - .path != - null) { - rows[index] = - rows[index].copyWith( - value: pickedResult - .files.first.path!, - ); - setState(() {}); - _onFieldChange(selectedId!); - } - }, - label: Text( - (rows[index].type == - FormDataType - .file && - rows[index] - .value - .isNotEmpty) - ? rows[index] - .value - .toString() - : "Select File", - textAlign: TextAlign.center, - overflow: - TextOverflow.ellipsis, - style: - kFormDataButtonLabelTextStyle, - ), - ), - ), - ), - ], + ? ElevatedButton.icon( + icon: const Icon( + Icons.snippet_folder_rounded, + size: 20, + ), + style: ElevatedButton.styleFrom( + minimumSize: const Size.fromHeight( + kDataRowHeight), + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(6), + ), + ), + onPressed: () async { + var pickedResult = await pickFile(); + if (pickedResult != null && + pickedResult.files.isNotEmpty && + pickedResult.files.first.path != + null) { + rows[index] = rows[index].copyWith( + value: + pickedResult.files.first.path!, + ); + setState(() {}); + _onFieldChange(selectedId!); + } + }, + label: Text( + (rows[index].type == + FormDataType.file && + rows[index].value.isNotEmpty) + ? rows[index].value.toString() + : "Select File", + overflow: TextOverflow.ellipsis, + style: kFormDataButtonLabelTextStyle, ), ) : CellField( diff --git a/lib/screens/home_page/editor_pane/details_card/request_pane/request_headers.dart b/lib/screens/home_page/editor_pane/details_card/request_pane/request_headers.dart index 52648d4b..2fde22ab 100644 --- a/lib/screens/home_page/editor_pane/details_card/request_pane/request_headers.dart +++ b/lib/screens/home_page/editor_pane/details_card/request_pane/request_headers.dart @@ -59,7 +59,7 @@ class EditRequestHeadersState extends ConsumerState { ), DataColumn2( label: Text('='), - fixedWidth: 30, + fixedWidth: 22, ), DataColumn2( label: Text('Header Value'), diff --git a/lib/screens/home_page/editor_pane/details_card/request_pane/request_params.dart b/lib/screens/home_page/editor_pane/details_card/request_pane/request_params.dart index 6c673db5..4f122798 100644 --- a/lib/screens/home_page/editor_pane/details_card/request_pane/request_params.dart +++ b/lib/screens/home_page/editor_pane/details_card/request_pane/request_params.dart @@ -60,7 +60,7 @@ class EditRequestURLParamsState extends ConsumerState { ), DataColumn2( label: Text('='), - fixedWidth: 30, + fixedWidth: 22, ), DataColumn2( label: Text('Parameter Value'), diff --git a/lib/widgets/form_data_field.dart b/lib/widgets/form_data_field.dart index 76c40be4..7b7751fb 100644 --- a/lib/widgets/form_data_field.dart +++ b/lib/widgets/form_data_field.dart @@ -43,12 +43,10 @@ class _FormDataFieldState extends State { initialValue: widget.initialValue, key: Key(widget.keyId), style: kCodeStyle.copyWith( - height: 1.8, color: colorScheme.onSurface, ), decoration: InputDecoration( hintStyle: kCodeStyle.copyWith( - height: 1.8, color: colorScheme.outline.withOpacity( kHintOpacity, ), diff --git a/lib/widgets/headerfield.dart b/lib/widgets/headerfield.dart index ec0f3a48..3d60caac 100644 --- a/lib/widgets/headerfield.dart +++ b/lib/widgets/headerfield.dart @@ -77,12 +77,10 @@ class _HeaderFieldState extends State { controller: controller, focusNode: focusNode, style: kCodeStyle.copyWith( - height: 1.6, color: colorScheme.onSurface, ), decoration: InputDecoration( hintStyle: kCodeStyle.copyWith( - height: 1.6, color: colorScheme.outline.withOpacity(kHintOpacity)), hintText: widget.hintText, contentPadding: const EdgeInsets.only(bottom: 12), diff --git a/lib/widgets/textfields.dart b/lib/widgets/textfields.dart index cb5e224b..c7bac1fb 100644 --- a/lib/widgets/textfields.dart +++ b/lib/widgets/textfields.dart @@ -59,12 +59,10 @@ class CellField extends StatelessWidget { key: Key(keyId), initialValue: initialValue, style: kCodeStyle.copyWith( - height: 1.6, color: clrScheme.onSurface, ), decoration: InputDecoration( hintStyle: kCodeStyle.copyWith( - height: 1.6, color: clrScheme.outline.withOpacity( kHintOpacity, ), diff --git a/pubspec.yaml b/pubspec.yaml index 79ee83ab..9c30cd6f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -13,7 +13,7 @@ dependencies: multi_split_view: ^2.4.0 url_launcher: ^6.2.5 flutter_riverpod: ^2.5.1 - riverpod: ^2.5.1 + riverpod: ^2.5.1 uuid: ^4.3.3 http: ^1.2.1 http_parser: ^4.0.2 @@ -56,7 +56,7 @@ dependencies: json_text_field: ^1.1.0 csv: ^6.0.0 data_table_2: ^2.5.11 - + dependency_overrides: web: ^0.5.0