forked from eatvio/eatvio_app
82 lines
2.8 KiB
Dart
82 lines
2.8 KiB
Dart
import 'package:eatvio_app/core/const.dart';
|
|
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<SubWidget> createState() => _SubWidgetState();
|
|
}
|
|
|
|
class _SubWidgetState extends State<SubWidget> {
|
|
@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: const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
|
|
child: Row(
|
|
children: [
|
|
CircleAvatar(
|
|
foregroundImage: NetworkImage(baseUrl + widget.subModel.profilePhotoUrl),
|
|
backgroundImage: const AssetImage('assets/images/no_avatar.png'),
|
|
radius: 28,
|
|
),
|
|
const SizedBox(width: 12),
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Text(
|
|
widget.subModel.name,
|
|
style: const 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: const 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,
|
|
name: widget.subModel.name,
|
|
porfileIcon: widget.subModel.profilePhotoUrl,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|