Flutter按钮提示文本未显示

huangapple go评论69阅读模式
英文:

Flutter button hint text not showing

问题

我正在使用multi_select_flutter包,它显示的下拉框比原生的flutter选项更好。然而,提示文本没有显示 - 昨天还显示,然后突然消失了,我不确定为什么会发生这种情况。有其他人遇到相同的问题吗?以下是我的代码:

MultiSelectBottomSheetField(
  initialChildSize: 0.4,
  listType: MultiSelectListType.CHIP,
  searchable: true,
  selectedColor: Color.fromARGB(255, 31, 31, 31),
  searchHint: 'Biceps',
  confirmText: Text('SAVE', style: TextStyle(color: Colors.black)),
  selectedItemsTextStyle: TextStyle(color: Colors.white),
  buttonText: Text("Muscles used",
      style: TextStyle(
        fontSize: 30,
        color: Color.fromARGB(255, 255, 255, 255),
      )),
  buttonIcon: Icon(Icons.arrow_downward, color: Colors.white),
  barrierColor: Color.fromARGB(255, 43, 43, 43).withOpacity(.7),
  title: Text("Muscles  (Scroll down for more)"),
  items: _options,
  onConfirm: (values) {
    selectedOptions = values;
  },
  initialValue: selectedOptions,
  chipDisplay: MultiSelectChipDisplay(
    onTap: (value) {
      setState(() {
        selectedOptions.remove(value);
      });
    },
  ),
)

非常感谢!

英文:

I am using the package multi_select_flutter, that displays a dropdown better than the native flutter option. However, the hint text is not showing - it was showing up until yesterday, and then disappeared, and I am not sure why this is happening. Did anyone else have the same issue? Here is my code

MultiSelectBottomSheetField(
                      initialChildSize: 0.4,
                      listType: MultiSelectListType.CHIP,
                      searchable: true,
                      selectedColor: Color.fromARGB(255, 31, 31, 31),
                      searchHint: 'Biceps',
                      confirmText:
                          Text('SAVE', style: TextStyle(color: Colors.black)),
                      selectedItemsTextStyle: TextStyle(color: Colors.white),
                      buttonText: Text("Muscles used",
                          style: TextStyle(
                            fontSize: 30,
                            color: Color.fromARGB(255, 255, 255, 255),
                          )),
                      buttonIcon:
                          Icon(Icons.arrow_downward, color: Colors.white),
                      barrierColor:
                          Color.fromARGB(255, 43, 43, 43).withOpacity(.7),
                      title: Text("Muscles  (Scroll down for more)"),
                      items: _options,
                      onConfirm: (values) {
                        selectedOptions = values;
                      },
                      initialValue: selectedOptions,
                      chipDisplay: MultiSelectChipDisplay(
                        onTap: (value) {
                          setState(() {
                            selectedOptions.remove(value);
                          });
                        },
                      ),
                    ),

THANK YOU SO MUCH!!!

答案1

得分: 1

我检查了你的代码,发现在MultiSelectBottomSheetField中存在一个bug,当你为buttonText定义了textStyle时,它不会显示出来,然而,你需要移除为buttonText定义的textStyle,它就会显示出来。

英文:

I checked your code and there is a bug in MultiSelectBottomSheetField, when you define textStyle for buttonText it doesn't show it, however, you needs to remove textStyle that you have defined for buttonText and it will show it.

huangapple
  • 本文由 发表于 2023年7月11日 11:17:01
  • 转载请务必保留本文链接:https://go.coder-hub.com/76658510.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定