From 11515a988b6b2daadb577f28f2780e41a49620bb Mon Sep 17 00:00:00 2001
From: Tanish2002 <tanishkhare@gmail.com>
Date: Mon, 26 Feb 2024 03:51:44 +0530
Subject: [PATCH] fix: colors not changing in headers suggestion list

---
 lib/widgets/headerfield.dart | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/lib/widgets/headerfield.dart b/lib/widgets/headerfield.dart
index 52dd8ec5..dbe45886 100644
--- a/lib/widgets/headerfield.dart
+++ b/lib/widgets/headerfield.dart
@@ -54,7 +54,7 @@ class _HeaderFieldState extends State<HeaderField> {
     var colorScheme = widget.colorScheme ?? Theme.of(context).colorScheme;
     return TypeAheadField(
       key: Key(widget.keyId),
-      hideOnEmpty: false,
+      hideOnEmpty: true,
       controller: controller,
       onSelected: (value) {
         setState(() {
@@ -65,11 +65,15 @@ class _HeaderFieldState extends State<HeaderField> {
       itemBuilder: (context, String suggestion) {
         return ListTile(
           dense: true,
-          title: Text(suggestion),
+          title: Text(
+            suggestion,
+            style: TextStyle(color: colorScheme.inverseSurface),
+          ),
         );
       },
       suggestionsCallback: headerSuggestionCallback,
-      decorationBuilder: suggestionBoxDecorations,
+      decorationBuilder: (context, child) =>
+          suggestionBoxDecorations(context, child, colorScheme),
       constraints: const BoxConstraints(maxHeight: 400),
       builder: (context, controller, focusNode) => TextField(
         onChanged: widget.onChanged,
@@ -97,9 +101,11 @@ class _HeaderFieldState extends State<HeaderField> {
     );
   }
 
-  Material suggestionBoxDecorations(BuildContext context, Widget child) {
+  Material suggestionBoxDecorations(
+      BuildContext context, Widget child, ColorScheme colorScheme) {
     return Material(
       elevation: 4,
+      color: colorScheme.surface,
       shape: RoundedRectangleBorder(
         side: BorderSide(color: Theme.of(context).dividerColor, width: 1.2),
         borderRadius: const BorderRadius.vertical(bottom: Radius.circular(8)),