mirror of
https://github.com/foss42/apidash.git
synced 2025-06-03 08:16:25 +08:00
freezed NameValueModel
This commit is contained in:
@ -37,7 +37,9 @@ class EditRequestHeadersState extends ConsumerState<EditRequestHeaders> {
|
||||
final length = ref.watch(activeRequestModelProvider
|
||||
.select((value) => value?.requestHeaders?.length));
|
||||
var rH = ref.read(activeRequestModelProvider)?.requestHeaders;
|
||||
rows = (rH == null || rH.isEmpty) ? [const NameValueModel("", "")] : rH;
|
||||
rows = (rH == null || rH.isEmpty)
|
||||
? [const NameValueModel(name: "", value: "")]
|
||||
: rH;
|
||||
|
||||
DaviModel<NameValueModel> model = DaviModel<NameValueModel>(
|
||||
rows: rows,
|
||||
@ -49,10 +51,10 @@ class EditRequestHeadersState extends ConsumerState<EditRequestHeaders> {
|
||||
int idx = row.index;
|
||||
return CellField(
|
||||
keyId: "$activeId-$idx-headers-k-$seed",
|
||||
initialValue: rows[idx].k,
|
||||
initialValue: rows[idx].name,
|
||||
hintText: "Add Header Name",
|
||||
onChanged: (value) {
|
||||
rows[idx] = rows[idx].copyWith(k: value);
|
||||
rows[idx] = rows[idx].copyWith(name: value);
|
||||
_onFieldChange(activeId!);
|
||||
},
|
||||
colorScheme: Theme.of(context).colorScheme,
|
||||
@ -76,10 +78,10 @@ class EditRequestHeadersState extends ConsumerState<EditRequestHeaders> {
|
||||
int idx = row.index;
|
||||
return CellField(
|
||||
keyId: "$activeId-$idx-headers-v-$seed",
|
||||
initialValue: rows[idx].v,
|
||||
initialValue: rows[idx].value,
|
||||
hintText: " Add Header Value",
|
||||
onChanged: (value) {
|
||||
rows[idx] = rows[idx].copyWith(v: value);
|
||||
rows[idx] = rows[idx].copyWith(value: value);
|
||||
_onFieldChange(activeId!);
|
||||
},
|
||||
colorScheme: Theme.of(context).colorScheme,
|
||||
@ -133,7 +135,7 @@ class EditRequestHeadersState extends ConsumerState<EditRequestHeaders> {
|
||||
padding: const EdgeInsets.only(bottom: 30),
|
||||
child: ElevatedButton.icon(
|
||||
onPressed: () {
|
||||
rows.add(const NameValueModel("", ""));
|
||||
rows.add(const NameValueModel(name: "", value: ""));
|
||||
_onFieldChange(activeId!);
|
||||
},
|
||||
icon: const Icon(Icons.add),
|
||||
|
@ -38,7 +38,9 @@ class EditRequestURLParamsState extends ConsumerState<EditRequestURLParams> {
|
||||
final length = ref.watch(activeRequestModelProvider
|
||||
.select((value) => value?.requestParams?.length));
|
||||
var rP = ref.read(activeRequestModelProvider)?.requestParams;
|
||||
rows = (rP == null || rP.isEmpty) ? [const NameValueModel("", "")] : rP;
|
||||
rows = (rP == null || rP.isEmpty)
|
||||
? [const NameValueModel(name: "", value: "")]
|
||||
: rP;
|
||||
|
||||
DaviModel<NameValueModel> model = DaviModel<NameValueModel>(
|
||||
rows: rows,
|
||||
@ -50,10 +52,10 @@ class EditRequestURLParamsState extends ConsumerState<EditRequestURLParams> {
|
||||
int idx = row.index;
|
||||
return CellField(
|
||||
keyId: "$activeId-$idx-params-k-$seed",
|
||||
initialValue: rows[idx].k,
|
||||
initialValue: rows[idx].name,
|
||||
hintText: "Add URL Parameter",
|
||||
onChanged: (value) {
|
||||
rows[idx] = rows[idx].copyWith(k: value);
|
||||
rows[idx] = rows[idx].copyWith(name: value);
|
||||
_onFieldChange(activeId!);
|
||||
},
|
||||
colorScheme: Theme.of(context).colorScheme,
|
||||
@ -77,10 +79,10 @@ class EditRequestURLParamsState extends ConsumerState<EditRequestURLParams> {
|
||||
int idx = row.index;
|
||||
return CellField(
|
||||
keyId: "$activeId-$idx-params-v-$seed",
|
||||
initialValue: rows[idx].v,
|
||||
initialValue: rows[idx].value,
|
||||
hintText: "Add Value",
|
||||
onChanged: (value) {
|
||||
rows[idx] = rows[idx].copyWith(v: value);
|
||||
rows[idx] = rows[idx].copyWith(value: value);
|
||||
_onFieldChange(activeId!);
|
||||
},
|
||||
colorScheme: Theme.of(context).colorScheme,
|
||||
@ -134,7 +136,7 @@ class EditRequestURLParamsState extends ConsumerState<EditRequestURLParams> {
|
||||
padding: const EdgeInsets.only(bottom: 30),
|
||||
child: ElevatedButton.icon(
|
||||
onPressed: () {
|
||||
rows.add(const NameValueModel("", ""));
|
||||
rows.add(const NameValueModel(name: "", value: ""));
|
||||
_onFieldChange(activeId!);
|
||||
},
|
||||
icon: const Icon(Icons.add),
|
||||
|
Reference in New Issue
Block a user