dynamic
build(- dynamic context
)
Implementation
@override
Widget build(BuildContext context) {
final ThemeData themeData = Theme.of(context);
Color? colorFromEvaluation;
if (knowledgePanelTitleElement.iconColorFromEvaluation ?? false) {
if (themeData.brightness == Brightness.dark) {
colorFromEvaluation = _getColorFromEvaluationDarkMode(evaluation);
} else {
colorFromEvaluation = _getColorFromEvaluation(evaluation);
}
}
List<Widget> iconWidget;
if (knowledgePanelTitleElement.iconUrl != null) {
iconWidget = <Widget>[
Expanded(
flex: IconWidgetSizer.getIconFlex(),
child: Center(
child: AbstractCache.best(
iconUrl: knowledgePanelTitleElement.iconUrl,
width: 36,
height: 36,
color: colorFromEvaluation,
),
),
),
const Padding(padding: EdgeInsets.only(left: SMALL_SPACE)),
];
} else {
iconWidget = <Widget>[];
}
return Padding(
padding: const EdgeInsets.only(
top: VERY_SMALL_SPACE,
bottom: VERY_SMALL_SPACE,
),
child: Row(
children: <Widget>[
...iconWidget,
Expanded(
flex: IconWidgetSizer.getRemainingWidgetFlex(),
child: LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) {
return Wrap(
direction: Axis.vertical,
children: <Widget>[
SizedBox(
width: constraints.maxWidth,
child: Text(
knowledgePanelTitleElement.title,
style: TextStyle(color: colorFromEvaluation),
),
),
if (knowledgePanelTitleElement.subtitle != null)
SizedBox(
width: constraints.maxWidth,
child: Text(knowledgePanelTitleElement.subtitle!)
.selectable(),
),
],
);
},
),
),
const Icon(
Icons.keyboard_arrow_down_outlined,
),
],
),
);
}