Skip to content

Commit 711e3bd

Browse files
committed
fix: add buttons back
1 parent e421650 commit 711e3bd

File tree

3 files changed

+115
-50
lines changed

3 files changed

+115
-50
lines changed

lib/screens/home_page/editor_pane/details_card/request_pane/request_form_data.dart

Lines changed: 43 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,20 @@ class _FormDataBodyState extends ConsumerState<FormDataWidget> {
1818
late int seed;
1919
final random = Random.secure();
2020
late List<FormDataModel> rows;
21+
2122
@override
2223
void initState() {
2324
super.initState();
2425
seed = random.nextInt(kRandMax);
2526
}
2627

28+
void _onFieldChange(String selectedId) {
29+
ref.read(collectionStateNotifierProvider.notifier).update(
30+
selectedId,
31+
requestFormDataList: rows,
32+
);
33+
}
34+
2735
@override
2836
Widget build(BuildContext context) {
2937
final selectedId = ref.watch(selectedIdStateProvider);
@@ -168,36 +176,49 @@ class _FormDataBodyState extends ConsumerState<FormDataWidget> {
168176
rows.removeAt(row.index);
169177
}
170178
_onFieldChange(selectedId!);
171-
setState(() {});
172179
},
173180
);
174181
},
175182
),
176183
],
177184
);
178-
return Container(
179-
decoration: BoxDecoration(
180-
color: Theme.of(context).colorScheme.background,
181-
borderRadius: kBorderRadius12,
182-
),
183-
margin: kP10,
184-
child: Column(
185-
children: [
186-
Expanded(
187-
child: DaviTheme(
188-
data: kTableThemeData,
189-
child: Davi<FormDataModel>(daviModelRows),
185+
return Stack(
186+
children: [
187+
Container(
188+
decoration: BoxDecoration(
189+
color: Theme.of(context).colorScheme.background,
190+
borderRadius: kBorderRadius12,
191+
),
192+
margin: kP10,
193+
child: Column(
194+
children: [
195+
Expanded(
196+
child: DaviTheme(
197+
data: kTableThemeData,
198+
child: Davi<FormDataModel>(daviModelRows),
199+
),
200+
),
201+
],
202+
),
203+
),
204+
Align(
205+
alignment: Alignment.bottomCenter,
206+
child: Padding(
207+
padding: const EdgeInsets.only(bottom: 30),
208+
child: ElevatedButton.icon(
209+
onPressed: () {
210+
rows.add(kFormDataEmptyModel);
211+
_onFieldChange(selectedId!);
212+
},
213+
icon: const Icon(Icons.add),
214+
label: const Text(
215+
"Add Form Data",
216+
style: kTextStyleButton,
217+
),
190218
),
191219
),
192-
],
193-
),
220+
),
221+
],
194222
);
195223
}
196-
197-
void _onFieldChange(String selectedId) {
198-
ref.read(collectionStateNotifierProvider.notifier).update(
199-
selectedId,
200-
requestFormDataList: rows,
201-
);
202-
}
203224
}

lib/screens/home_page/editor_pane/details_card/request_pane/request_headers.dart

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -160,22 +160,44 @@ class EditRequestHeadersState extends ConsumerState<EditRequestHeaders> {
160160
),
161161
],
162162
);
163-
return Container(
164-
decoration: BoxDecoration(
165-
color: Theme.of(context).colorScheme.background,
166-
borderRadius: kBorderRadius12,
167-
),
168-
margin: kP10,
169-
child: Column(
170-
children: [
171-
Expanded(
172-
child: DaviTheme(
173-
data: kTableThemeData,
174-
child: Davi<NameValueModel>(model),
163+
return Stack(
164+
children: [
165+
Container(
166+
decoration: BoxDecoration(
167+
color: Theme.of(context).colorScheme.background,
168+
borderRadius: kBorderRadius12,
169+
),
170+
margin: kP10,
171+
child: Column(
172+
children: [
173+
Expanded(
174+
child: DaviTheme(
175+
data: kTableThemeData,
176+
child: Davi<NameValueModel>(model),
177+
),
178+
),
179+
],
180+
),
181+
),
182+
Align(
183+
alignment: Alignment.bottomCenter,
184+
child: Padding(
185+
padding: const EdgeInsets.only(bottom: 30),
186+
child: ElevatedButton.icon(
187+
onPressed: () {
188+
rows.add(kNameValueEmptyModel);
189+
isRowEnabledList.add(false);
190+
_onFieldChange(selectedId!);
191+
},
192+
icon: const Icon(Icons.add),
193+
label: const Text(
194+
"Add Header",
195+
style: kTextStyleButton,
196+
),
175197
),
176198
),
177-
],
178-
),
199+
),
200+
],
179201
);
180202
}
181203
}

lib/screens/home_page/editor_pane/details_card/request_pane/request_params.dart

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -161,22 +161,44 @@ class EditRequestURLParamsState extends ConsumerState<EditRequestURLParams> {
161161
),
162162
],
163163
);
164-
return Container(
165-
decoration: BoxDecoration(
166-
color: Theme.of(context).colorScheme.background,
167-
borderRadius: kBorderRadius12,
168-
),
169-
margin: kP10,
170-
child: Column(
171-
children: [
172-
Expanded(
173-
child: DaviTheme(
174-
data: kTableThemeData,
175-
child: Davi<NameValueModel>(model),
164+
return Stack(
165+
children: [
166+
Container(
167+
decoration: BoxDecoration(
168+
color: Theme.of(context).colorScheme.background,
169+
borderRadius: kBorderRadius12,
170+
),
171+
margin: kP10,
172+
child: Column(
173+
children: [
174+
Expanded(
175+
child: DaviTheme(
176+
data: kTableThemeData,
177+
child: Davi<NameValueModel>(model),
178+
),
179+
),
180+
],
181+
),
182+
),
183+
Align(
184+
alignment: Alignment.bottomCenter,
185+
child: Padding(
186+
padding: const EdgeInsets.only(bottom: 30),
187+
child: ElevatedButton.icon(
188+
onPressed: () {
189+
rows.add(kNameValueEmptyModel);
190+
isRowEnabledList.add(false);
191+
_onFieldChange(selectedId!);
192+
},
193+
icon: const Icon(Icons.add),
194+
label: const Text(
195+
"Add Param",
196+
style: kTextStyleButton,
197+
),
176198
),
177199
),
178-
],
179-
),
200+
),
201+
],
180202
);
181203
}
182204
}

0 commit comments

Comments
 (0)