mirror of
https://github.com/foss42/apidash.git
synced 2025-10-19 20:54:32 +08:00
Update CellField
This commit is contained in:
@ -47,7 +47,6 @@ class EditRequestHeadersState extends ConsumerState<EditRequestHeaders> {
|
|||||||
cellBuilder: (_, row) {
|
cellBuilder: (_, row) {
|
||||||
int idx = row.index;
|
int idx = row.index;
|
||||||
return CellField(
|
return CellField(
|
||||||
colorScheme: Theme.of(context).colorScheme,
|
|
||||||
keyId: "$activeId-$idx-headers-k-$seed",
|
keyId: "$activeId-$idx-headers-k-$seed",
|
||||||
initialValue: rows[idx].k,
|
initialValue: rows[idx].k,
|
||||||
hintText: "Add Header Name",
|
hintText: "Add Header Name",
|
||||||
@ -55,6 +54,7 @@ class EditRequestHeadersState extends ConsumerState<EditRequestHeaders> {
|
|||||||
rows[idx] = rows[idx].copyWith(k: value);
|
rows[idx] = rows[idx].copyWith(k: value);
|
||||||
_onFieldChange(activeId!);
|
_onFieldChange(activeId!);
|
||||||
},
|
},
|
||||||
|
colorScheme: Theme.of(context).colorScheme,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
sortable: false,
|
sortable: false,
|
||||||
@ -74,7 +74,6 @@ class EditRequestHeadersState extends ConsumerState<EditRequestHeaders> {
|
|||||||
cellBuilder: (_, row) {
|
cellBuilder: (_, row) {
|
||||||
int idx = row.index;
|
int idx = row.index;
|
||||||
return CellField(
|
return CellField(
|
||||||
colorScheme: Theme.of(context).colorScheme,
|
|
||||||
keyId: "$activeId-$idx-headers-v-$seed",
|
keyId: "$activeId-$idx-headers-v-$seed",
|
||||||
initialValue: rows[idx].v,
|
initialValue: rows[idx].v,
|
||||||
hintText: " Add Header Value",
|
hintText: " Add Header Value",
|
||||||
@ -82,6 +81,7 @@ class EditRequestHeadersState extends ConsumerState<EditRequestHeaders> {
|
|||||||
rows[idx] = rows[idx].copyWith(v: value);
|
rows[idx] = rows[idx].copyWith(v: value);
|
||||||
_onFieldChange(activeId!);
|
_onFieldChange(activeId!);
|
||||||
},
|
},
|
||||||
|
colorScheme: Theme.of(context).colorScheme,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
sortable: false,
|
sortable: false,
|
||||||
|
@ -49,7 +49,6 @@ class EditRequestURLParamsState extends ConsumerState<EditRequestURLParams> {
|
|||||||
cellBuilder: (_, row) {
|
cellBuilder: (_, row) {
|
||||||
int idx = row.index;
|
int idx = row.index;
|
||||||
return CellField(
|
return CellField(
|
||||||
colorScheme: Theme.of(context).colorScheme,
|
|
||||||
keyId: "$activeId-$idx-params-k-$seed",
|
keyId: "$activeId-$idx-params-k-$seed",
|
||||||
initialValue: rows[idx].k,
|
initialValue: rows[idx].k,
|
||||||
hintText: "Add URL Parameter",
|
hintText: "Add URL Parameter",
|
||||||
@ -57,6 +56,7 @@ class EditRequestURLParamsState extends ConsumerState<EditRequestURLParams> {
|
|||||||
rows[idx] = rows[idx].copyWith(k: value);
|
rows[idx] = rows[idx].copyWith(k: value);
|
||||||
_onFieldChange(activeId!);
|
_onFieldChange(activeId!);
|
||||||
},
|
},
|
||||||
|
colorScheme: Theme.of(context).colorScheme,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
sortable: false,
|
sortable: false,
|
||||||
@ -76,7 +76,6 @@ class EditRequestURLParamsState extends ConsumerState<EditRequestURLParams> {
|
|||||||
cellBuilder: (_, row) {
|
cellBuilder: (_, row) {
|
||||||
int idx = row.index;
|
int idx = row.index;
|
||||||
return CellField(
|
return CellField(
|
||||||
colorScheme: Theme.of(context).colorScheme,
|
|
||||||
keyId: "$activeId-$idx-params-v-$seed",
|
keyId: "$activeId-$idx-params-v-$seed",
|
||||||
initialValue: rows[idx].v,
|
initialValue: rows[idx].v,
|
||||||
hintText: "Add Value",
|
hintText: "Add Value",
|
||||||
@ -84,6 +83,7 @@ class EditRequestURLParamsState extends ConsumerState<EditRequestURLParams> {
|
|||||||
rows[idx] = rows[idx].copyWith(v: value);
|
rows[idx] = rows[idx].copyWith(v: value);
|
||||||
_onFieldChange(activeId!);
|
_onFieldChange(activeId!);
|
||||||
},
|
},
|
||||||
|
colorScheme: Theme.of(context).colorScheme,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
sortable: false,
|
sortable: false,
|
||||||
|
@ -44,19 +44,20 @@ class _URLFieldState extends State<URLField> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class CellField extends StatefulWidget {
|
class CellField extends StatefulWidget {
|
||||||
const CellField(
|
const CellField({
|
||||||
{super.key,
|
super.key,
|
||||||
required this.colorScheme,
|
required this.keyId,
|
||||||
required this.keyId,
|
this.initialValue,
|
||||||
required this.initialValue,
|
this.hintText,
|
||||||
this.hintText,
|
this.onChanged,
|
||||||
this.onChanged});
|
this.colorScheme,
|
||||||
|
});
|
||||||
|
|
||||||
final ColorScheme colorScheme;
|
|
||||||
final String keyId;
|
final String keyId;
|
||||||
final String initialValue;
|
final String? initialValue;
|
||||||
final String? hintText;
|
final String? hintText;
|
||||||
final void Function(String)? onChanged;
|
final void Function(String)? onChanged;
|
||||||
|
final ColorScheme? colorScheme;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<CellField> createState() => _CellFieldState();
|
State<CellField> createState() => _CellFieldState();
|
||||||
@ -65,29 +66,30 @@ class CellField extends StatefulWidget {
|
|||||||
class _CellFieldState extends State<CellField> {
|
class _CellFieldState extends State<CellField> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
var colorScheme = widget.colorScheme ?? Theme.of(context).colorScheme;
|
||||||
return TextFormField(
|
return TextFormField(
|
||||||
key: Key(widget.keyId),
|
key: Key(widget.keyId),
|
||||||
initialValue: widget.initialValue,
|
initialValue: widget.initialValue,
|
||||||
style: kCodeStyle.copyWith(
|
style: kCodeStyle.copyWith(
|
||||||
color: widget.colorScheme.onSurface,
|
color: colorScheme.onSurface,
|
||||||
),
|
),
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
hintStyle: kCodeStyle.copyWith(
|
hintStyle: kCodeStyle.copyWith(
|
||||||
color: widget.colorScheme.outline.withOpacity(
|
color: colorScheme.outline.withOpacity(
|
||||||
kHintOpacity,
|
kHintOpacity,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
hintText: widget.hintText,
|
hintText: widget.hintText,
|
||||||
focusedBorder: UnderlineInputBorder(
|
focusedBorder: UnderlineInputBorder(
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color: widget.colorScheme.primary.withOpacity(
|
color: colorScheme.primary.withOpacity(
|
||||||
kHintOpacity,
|
kHintOpacity,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
enabledBorder: UnderlineInputBorder(
|
enabledBorder: UnderlineInputBorder(
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color: widget.colorScheme.surfaceVariant,
|
color: colorScheme.surfaceVariant,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Reference in New Issue
Block a user