buildFooterTextSpans method
Get the footer under the carousel that returns the current image index.
Implementation
Widget buildFooterTextSpans({
required BuildContext context,
required AppModel appModel,
required int itemCount,
}) {
double fontSize =
(Theme.of(context).textTheme.labelMedium?.fontSize)! * 0.9;
return Text.rich(
TextSpan(
text: '',
children: <InlineSpan>[
WidgetSpan(
alignment: PlaceholderAlignment.middle,
child: Padding(
child: Icon(
icon,
size: fontSize,
color: Theme.of(context).unselectedWidgetColor,
),
padding: EdgeInsets.only(
top: 1.25,
right: Spacing.of(context).spaces.small,
),
),
),
if (selectedIndex == -1)
TextSpan(
text: t.image_search_label_none_before,
style: TextStyle(
fontSize: fontSize,
color: Theme.of(context).unselectedWidgetColor,
),
),
if (selectedIndex == -1)
TextSpan(
text: t.image_search_label_none_middle,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: fontSize,
),
),
if (selectedIndex != -1)
TextSpan(
text: t.image_search_label_before,
style: TextStyle(
fontSize: fontSize,
color: Theme.of(context).unselectedWidgetColor,
),
),
if (selectedIndex != -1)
TextSpan(
text: '${selectedIndex! + 1} ',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: fontSize,
),
),
TextSpan(
text: t.image_search_label_middle,
style: TextStyle(
fontSize: fontSize,
color: Theme.of(context).unselectedWidgetColor,
),
),
TextSpan(
text: '$itemCount ',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: fontSize,
),
),
if (currentSearchTerm != null && currentSearchTerm!.trim().isNotEmpty)
TextSpan(
text: t.image_search_label_after,
style: TextStyle(
fontSize: fontSize,
color: Theme.of(context).unselectedWidgetColor,
),
),
if (currentSearchTerm != null && currentSearchTerm!.trim().isNotEmpty)
TextSpan(
text: ' ',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: fontSize,
color: Theme.of(context).unselectedWidgetColor,
),
),
if (currentSearchTerm != null && currentSearchTerm!.trim().isNotEmpty)
TextSpan(
text: currentSearchTerm,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: fontSize,
),
),
],
),
textAlign: TextAlign.center,
maxLines: 2,
overflow: TextOverflow.ellipsis,
);
}