Files
eatvio_app/lib/core/widgets/info_row.dart
2024-12-23 15:36:00 +07:00

82 lines
2.7 KiB
Dart

import 'package:eatvio_app/core/theme/custom_text_style.dart';
import 'package:eatvio_app/core/utils/localization_utils.dart';
import 'package:eatvio_app/features/diets/presentation/widgets/info_bouble.dart';
import 'package:eatvio_app/features/diets/presentation/widgets/type_badges.dart';
import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart';
import 'package:eatvio_app/features/feed/models/plan_pagination_model.dart';
import 'package:eatvio_app/generated/l10n.dart';
import 'package:eatvio_app/core/theme/theme_helper.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
class InfoRow extends StatelessWidget {
const InfoRow({
super.key,
this.diet,
this.itemsBackgroundColor,
this.disableDescriptionOfTypes = false,
this.plan,
});
final Color? itemsBackgroundColor;
final Diet? diet;
final PlanModel? plan;
final bool disableDescriptionOfTypes;
@override
Widget build(BuildContext context) {
final s = S.of(context);
return SingleChildScrollView(
padding: const EdgeInsets.symmetric(horizontal: 16),
scrollDirection: Axis.horizontal,
child: Row(
children: [
InfoBouble(
backgroundColor: itemsBackgroundColor,
children: [
SvgPicture.asset(
'assets/icons/time2.svg',
width: 13.3,
height: 13.3,
),
SizedBox(width: 4),
Text(
diet == null ? '${plan?.duration} ${getDayForm(plan?.duration ?? 7, s)}' : '${diet?.duration} ${getDayForm(diet?.duration ?? 7, s)}',
style: TextStyles.textXSSemibold.copyWith(color: appTheme.black),
),
],
),
SizedBox(width: 12),
InfoBouble(
backgroundColor: itemsBackgroundColor,
children: [
SvgPicture.asset(
'assets/icons/people.svg',
width: 13.3,
height: 13.3,
),
SizedBox(width: 4),
Text(
'80 человек прошли',
style: TextStyles.textXSSemibold.copyWith(color: appTheme.black),
),
],
),
SizedBox(width: 12),
if (plan?.type.hasAtLeastOneType() == true || diet?.type.hasAtLeastOneType() == true)
InfoBouble(
backgroundColor: itemsBackgroundColor,
children: [
TypeBadges(
type: diet?.type,
planType: plan?.type,
disableDescriptionOfTypes: disableDescriptionOfTypes,
),
],
),
],
),
);
}
}