import 'package:cached_network_image/cached_network_image.dart'; import 'package:eatvio_app/core/const.dart'; import 'package:eatvio_app/core/theme/theme_helper.dart'; import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart'; import 'package:eatvio_app/features/feed/models/feed_consultant_model.dart'; import 'package:eatvio_app/features/profile/models/badge_model.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:go_router/go_router.dart'; class ConsultantWidget extends StatelessWidget { final FeedConsultantModel consultant; const ConsultantWidget({ super.key, required this.consultant, }); @override Widget build(BuildContext context) { return InkWell( onTap: () { GoRouter.of(context).pushNamed( 'profileScreen', extra: Author( authorSlug: consultant.slug, authorName: consultant.name, authorProfileIcon: consultant.photo, authorIsMe: false, ), ); }, borderRadius: BorderRadius.circular(20), child: Ink( padding: EdgeInsets.all(12), decoration: BoxDecoration( borderRadius: BorderRadius.circular(20), color: Color(0xFFF6F6F6), ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Row( children: [ Ink( padding: EdgeInsets.symmetric(vertical: 4, horizontal: 8), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(8), ), child: Text( '${consultant.ratingPlace}', style: TextStyle( fontSize: 20, color: appTheme.blueA400, fontWeight: FontWeight.w600, ), ), ), const SizedBox(width: 8), CircleAvatar( foregroundImage: NetworkImage(consultant.photo), ), const SizedBox(width: 8), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( consultant.name, style: TextStyle( height: 1, fontWeight: FontWeight.w500, fontSize: 15, color: Color(0xFF323F4B), ), ), const SizedBox(height: 4), Text( 'Рейтинг: RATING', style: TextStyle( color: appTheme.blueA400, height: 1, fontWeight: FontWeight.w500, fontSize: 12, ), ), ], ), ], ), Ink( padding: EdgeInsets.all(6), decoration: BoxDecoration( borderRadius: BorderRadius.circular(4), color: Colors.white, ), child: SvgPicture.asset( 'assets/icons/go_to_arrow.svg', ), ), ], ), const SizedBox(height: 8), Text('description'), if (consultant.badges.isNotEmpty) const SizedBox(height: 8), _badges(consultant.badges, context), ], ), ), ); } _badges(List badges, BuildContext context) { return SingleChildScrollView( scrollDirection: Axis.horizontal, child: Row( children: [ for (int i = 0; i < badges.length; i++) ...[ badges[i].image.contains('svg') ? SvgPicture.network( baseUrl + '/storage/' + badges[i].image, width: 28, height: 28, ) : CachedNetworkImage( imageUrl: baseUrl + '/storage/' + badges[i].image, ), i < badges.length - 1 ? const SizedBox(width: 8) : const SizedBox.shrink(), ], ], ), ); } }