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