Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to set search text color #155

Open
divan opened this issue Sep 13, 2024 · 2 comments
Open

Unable to set search text color #155

divan opened this issue Sep 13, 2024 · 2 comments

Comments

@divan
Copy link

divan commented Sep 13, 2024

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.

@AntonioAEMartins
Copy link

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?

@george-curtis-sqlwatchmen

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

Screen.Recording.2025-02-20.at.10.58.36.AM.mov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants