multiselect-dropdown icon indicating copy to clipboard operation
multiselect-dropdown copied to clipboard

Unable to set search text color

Open divan opened this issue 1 year ago • 2 comments

SearchFieldDecoration don't provide a way to change the text (hint text, 'Search') color.

Default color is of too high contrast, takes more attention than the items themselves. So if anyone want to change it to, say' .hintColor, there is no way to do so.

divan avatar Sep 13 '24 17:09 divan

Hey @divan, what's up?

Can you example more about this issue? Or give me an example code with a picture of what part of the selector or dropdown would you like to change the color?

AntonioAEMartins avatar Sep 16 '24 13:09 AntonioAEMartins

Hey @AntonioAEMartins,

Here are some screenshots and a video of the issue (I'm assuming this is the same issue @divan is having). The first screenshot is of the default widget and the second screenshot is of a workaround I found to theme the search text, but it would be much nicer to have it exposed by the widget constructor like many of the other fields. For the sake of visibility, I left the background white, but on black backgrounds the search text would be unreadable without the ability to change it.

import 'package:flutter/material.dart';
import 'package:multi_dropdown/multi_dropdown.dart';

final items = <DropdownItem<int>>[
  DropdownItem(label: 'One', value: 1),
  DropdownItem(label: 'Two', value: 2),
  DropdownItem(label: 'Three', value: 3),
  DropdownItem(label: 'Four', value: 4),
  DropdownItem(label: 'Five', value: 5),
  DropdownItem(label: 'Six', value: 6),
  DropdownItem(label: 'Seven', value: 7),
  DropdownItem(label: 'Eight', value: 8),
  DropdownItem(label: 'Nine', value: 9),
  DropdownItem(label: 'Ten', value: 10),
];

class MultiselectDropdownSearchTextIssueExample extends StatelessWidget {
  const MultiselectDropdownSearchTextIssueExample({super.key});

  @override
  Widget build(BuildContext context) {
    return MultiDropdown(
      items: items,
      searchEnabled: true,
    );
  }
}

class MultiselectDropdownSearchTextWorkaroundExample extends StatelessWidget {
  const MultiselectDropdownSearchTextWorkaroundExample({super.key});

  @override
  Widget build(BuildContext context) {
    return Theme(
      data: ThemeData(
        textTheme: const TextTheme(
          bodyLarge: TextStyle(color: Colors.deepPurpleAccent)),
      ),
      child: MultiDropdown(
        items: items,
        searchEnabled: true,
      ),
    );
  }
}

Image

Image

https://github.com/user-attachments/assets/c254cdfb-f216-4d34-9cc0-c438a4420773