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

MultiSelectChipField - selectedTextStyle fontSize not respected #182

Open
rstolys opened this issue Jun 19, 2023 · 0 comments
Open

MultiSelectChipField - selectedTextStyle fontSize not respected #182

rstolys opened this issue Jun 19, 2023 · 0 comments

Comments

@rstolys
Copy link

rstolys commented Jun 19, 2023

When defining the style of the selectedText the fontSize is not respected and a default font size is used...

Example usage:

MultiSelectChipField<String?>(
  items: ['item1', 'item2', 'item3'],
  initialValue: [],
  showHeader: false,
  textStyle: TextStyle(
    fontSize: 10,
    fontWeight: FontWeight.w400,
    color: AppColor.dark,
  ),
  selectedChipColor: Colors.blue,
  selectedTextStyle: TextStyle(
    fontSize: 10, // This value is not respected
    fontWeight: FontWeight.w400,
    color: AppColor.dark
 ),

This issue can be traced to multi_select_chip_field.dart ...

label: Container(
          width: widget.chipWidth,
          child: Text(
            item.label,
            overflow: TextOverflow.ellipsis,
            style: _selectedValues.contains(item.value)
                ? TextStyle(
                    color: widget.colorator != null &&
                            widget.colorator!(item.value) != null
                        ? widget.colorator!(item.value)!.withOpacity(1)
                        : widget.selectedTextStyle != null
                            ? widget.selectedTextStyle!.color
                            : null) // Need to add fontSize here
                : TextStyle(
                    color: widget.textStyle != null
                        ? widget.textStyle!.color ?? widget.chipColor
                        : widget.chipColor,
                    fontSize: widget.textStyle != null
                        ? widget.textStyle!.fontSize
                        : null,
                  ),
          ),

To resolve this the below snippet can be added:

fontSize: widget.selectedTextStyle != null
  ? widget.selectedTextStyle!.fontSize
  : null)
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

1 participant