makeTextEx method
Implementation
Widget makeTextEx(
Widget? child, String text, Widget? postfix, Widget? suffix, bool isSel) {
List<Widget> items = [];
if (postfix != null) {
if (postfix is Text) {
final styledPostfix = _styleTextWidget(postfix);
items.add(styledPostfix);
} else {
items.add(postfix);
}
}
items.add(child ??
Text(
text,
style: (isSel ? picker!.selectedTextStyle : null),
textScaler: picker!.textScaler,
));
if (suffix != null) {
if (suffix is Text) {
final styledSuffix = _styleTextWidget(suffix);
items.add(styledSuffix);
} else {
items.add(suffix);
}
}
final theme = picker!.textStyle != null || picker!.state?.context == null
? null
: material.Theme.of(picker!.state!.context);
Color? txtColor = theme?.brightness == Brightness.dark
? material.Colors.white
: material.Colors.black87;
double? txtSize = Picker.defaultTextSize;
if (isSel && picker!.selectedTextStyle != null) {
if (picker!.selectedTextStyle!.color != null) {
txtColor = picker!.selectedTextStyle!.color;
}
if (picker!.selectedTextStyle!.fontSize != null) {
txtSize = picker!.selectedTextStyle!.fontSize;
}
}
return Center(
child: DefaultTextStyle(
overflow: TextOverflow.ellipsis,
maxLines: 1,
textAlign: picker!.textAlign,
style: picker!.textStyle ??
TextStyle(
color: txtColor,
fontSize: txtSize,
fontFamily: theme == null
? ""
: theme.textTheme.titleLarge?.fontFamily),
child: Wrap(
children: items,
)));
}