import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart'; import 'package:eatvio_app/features/profile/models/sub_model.dart'; import 'package:eatvio_app/features/profile/presentation/widgets/sub_action_button_widget.dart'; import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; class SubWidget extends StatefulWidget { final SubModel subModel; const SubWidget({ super.key, required this.subModel, }); @override State createState() => _SubWidgetState(); } class _SubWidgetState extends State { @override Widget build(BuildContext context) { return InkWell( onTap: () => GoRouter.of(context).pushNamed( 'profileScreen', extra: Author( authorSlug: widget.subModel.slug, authorName: widget.subModel.name, authorProfileIcon: widget.subModel.profilePhotoUrl, authorIsMe: false, isEntitySubscribedByMe: false, ), ), child: Ink( padding: EdgeInsets.symmetric(vertical: 8, horizontal: 16), child: Row( children: [ CircleAvatar( backgroundImage: NetworkImage(widget.subModel.profilePhotoUrl), radius: 28, ), const SizedBox(width: 12), Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ Text( widget.subModel.name, style: TextStyle( color: Color(0xFF323F4B), fontSize: 16, fontWeight: FontWeight.w600, height: 1, ), ), const SizedBox(height: 4), Text( '${DateTime.now().year - widget.subModel.birthdate.year - (DateTime.now().isBefore(DateTime(DateTime.now().year, widget.subModel.birthdate.month, widget.subModel.birthdate.day)) ? 1 : 0)} лет, ${widget.subModel.city}', style: TextStyle( color: Color(0xFF6D6F71), fontSize: 12, fontWeight: FontWeight.w500, height: 1, ), ), ], ), const Spacer(), SubActionButtonWidget( subActionType: widget.subModel.isEntitySubscribedByMe ? SubActionType.SendMessage : SubActionType.Subscribe, slug: widget.subModel.slug, ), ], ), ), ); } }