Minor updates

This commit is contained in:
Ankit Mahato
2023-03-08 23:45:03 +05:30
parent 618a9f126f
commit c99bd771b9
4 changed files with 10 additions and 5 deletions

1
.gitignore vendored
View File

@ -49,3 +49,4 @@ linux/
macos/ macos/
windows/ windows/
web/ web/
.vscode/settings.json

View File

@ -28,7 +28,7 @@ class _RequestEditorPaneState extends ConsumerState<RequestEditorPane> {
return Padding( return Padding(
padding: const EdgeInsets.all(8), padding: const EdgeInsets.all(8),
child: Column( child: Column(
children: [ children: const [
EditorPaneRequestURLCard(), EditorPaneRequestURLCard(),
SizedBox( SizedBox(
height: 10, height: 10,

View File

@ -150,7 +150,7 @@ class _URLTextFieldState extends ConsumerState<URLTextField> {
key: Key("url-${activeId!}"), key: Key("url-${activeId!}"),
initialValue: ref initialValue: ref
.read(collectionStateNotifierProvider.notifier) .read(collectionStateNotifierProvider.notifier)
.getRequestModel(activeId!) .getRequestModel(activeId)
.url, .url,
style: codeStyle, style: codeStyle,
decoration: InputDecoration( decoration: InputDecoration(
@ -161,7 +161,7 @@ class _URLTextFieldState extends ConsumerState<URLTextField> {
onChanged: (value) { onChanged: (value) {
ref ref
.read(collectionStateNotifierProvider.notifier) .read(collectionStateNotifierProvider.notifier)
.update(activeId!, url: value); .update(activeId, url: value);
}, },
); );
} }

View File

@ -20,6 +20,8 @@ class CollectionStateNotifier extends StateNotifier<List<RequestModel>> {
), ),
]); ]);
final baseResponseModel = const ResponseModel();
int idxOfId(String id) => state.indexWhere((element) => element.id == id); int idxOfId(String id) => state.indexWhere((element) => element.id == id);
RequestModel getRequestModel(String id) { RequestModel getRequestModel(String id) {
@ -95,8 +97,10 @@ class CollectionStateNotifier extends StateNotifier<List<RequestModel>> {
message: responseRec.$2, message: responseRec.$2,
); );
} else { } else {
final responseModel = ResponseModel() final responseModel = baseResponseModel.fromResponse(
.fromResponse(response: responseRec.$0!, time: responseRec.$1!); response: responseRec.$0!,
time: responseRec.$1!,
);
int statusCode = responseRec.$0!.statusCode; int statusCode = responseRec.$0!.statusCode;
newRequestModel = requestModel.copyWith( newRequestModel = requestModel.copyWith(
responseStatus: statusCode, responseStatus: statusCode,