Files
eatvio_app/lib/features/diets/presentation/widgets/author_card.dart
2025-04-04 20:21:31 +07:00

107 lines
3.8 KiB
Dart

import 'package:eatvio_app/features/diets/presentation/widgets/info_bouble.dart';
import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart';
import 'package:eatvio_app/core/theme/custom_text_style.dart';
import 'package:eatvio_app/core/theme/theme_helper.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:go_router/go_router.dart';
class AuthorCard extends StatelessWidget {
const AuthorCard({super.key, required this.author, required this.title, this.backgroundColor, this.titleStyle});
final Author author;
final String title;
final Color? backgroundColor;
final TextStyle? titleStyle;
@override
Widget build(BuildContext context) {
return Container(
width: MediaQuery.sizeOf(context).width,
decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: backgroundColor ?? appTheme.cardBackground),
child: Stack(
children: [
Padding(
padding: const EdgeInsets.only(left: 16, top: 16, bottom: 24),
child: Column(
children: [
ListTile(
contentPadding: EdgeInsets.zero,
leading: Container(
width: 64,
height: 64,
decoration: BoxDecoration(
shape: BoxShape.circle,
image: DecorationImage(
image: NetworkImage(author.authorProfileIcon),
fit: BoxFit.cover,
),
),
),
subtitle: Text(
author.authorName,
style: TextStyles.textLSemibold.copyWith(
color: appTheme.black,
),
),
title: Text(
title,
style: titleStyle ?? TextStyles.textSSemibold.copyWith(
color: appTheme.gray,
),
),
),
Row(
children: [
Text(
'Конслуьтант',
style: TextStyles.textMMedium.copyWith(
color: appTheme.black,
),
),
const SizedBox(width: 10),
if (author.authorPlaceInRating != null)
InfoBouble(
radius: 12,
backgroundColor: appTheme.whiteA700,
children: [
Text(
'${author.authorPlaceInRating}-й в рейтинге',
style: TextStyles.textMMediumAuto.copyWith(
color: appTheme.blueA400,
),
),
],
),
],
),
],
),
),
Positioned(
right: 8,
top: 8,
child: GestureDetector(
onTap: () => GoRouter.of(context).pushNamed('profileScreen', extra: author),
child: Container(
width: 28,
height: 28,
decoration: BoxDecoration(
color: appTheme.whiteA700,
borderRadius: BorderRadius.circular(8),
),
child: Center(
child: SvgPicture.asset(
'assets/icons/arrow.svg',
width: 12,
height: 12,
fit: BoxFit.none,
),
),
),
),
),
],
),
);
}
}