diff --git a/lib/screens/home_page/editor_pane/details_card/request_pane/request_headers.dart b/lib/screens/home_page/editor_pane/details_card/request_pane/request_headers.dart index 452d7d24..f4fe5314 100644 --- a/lib/screens/home_page/editor_pane/details_card/request_pane/request_headers.dart +++ b/lib/screens/home_page/editor_pane/details_card/request_pane/request_headers.dart @@ -47,7 +47,6 @@ class EditRequestHeadersState extends ConsumerState { 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 { rows[idx] = rows[idx].copyWith(k: value); _onFieldChange(activeId!); }, + colorScheme: Theme.of(context).colorScheme, ); }, sortable: false, @@ -74,7 +74,6 @@ class EditRequestHeadersState extends ConsumerState { 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 { rows[idx] = rows[idx].copyWith(v: value); _onFieldChange(activeId!); }, + colorScheme: Theme.of(context).colorScheme, ); }, sortable: false, diff --git a/lib/screens/home_page/editor_pane/details_card/request_pane/request_params.dart b/lib/screens/home_page/editor_pane/details_card/request_pane/request_params.dart index 4d2855db..094a22dd 100644 --- a/lib/screens/home_page/editor_pane/details_card/request_pane/request_params.dart +++ b/lib/screens/home_page/editor_pane/details_card/request_pane/request_params.dart @@ -49,7 +49,6 @@ class EditRequestURLParamsState extends ConsumerState { 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 { rows[idx] = rows[idx].copyWith(k: value); _onFieldChange(activeId!); }, + colorScheme: Theme.of(context).colorScheme, ); }, sortable: false, @@ -76,7 +76,6 @@ class EditRequestURLParamsState extends ConsumerState { 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 { rows[idx] = rows[idx].copyWith(v: value); _onFieldChange(activeId!); }, + colorScheme: Theme.of(context).colorScheme, ); }, sortable: false, diff --git a/lib/widgets/textfields.dart b/lib/widgets/textfields.dart index 1fa2bcc4..ed0e2cd1 100644 --- a/lib/widgets/textfields.dart +++ b/lib/widgets/textfields.dart @@ -44,19 +44,20 @@ class _URLFieldState extends State { } 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 createState() => _CellFieldState(); @@ -65,29 +66,30 @@ class CellField extends StatefulWidget { class _CellFieldState extends State { @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, ), ), ),