feat(comments): onTap to profile

This commit is contained in:
mso7nueh
2025-05-12 15:50:42 +03:00
parent b2d9e808fe
commit 2adedf16ae
4 changed files with 34 additions and 12 deletions

View File

@@ -66,7 +66,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
@override
void initState() {
super.initState();
widget.author == null ? profileCubit.getMyProfile() : profileCubit.getProfileBySlug(widget.author!.authorSlug);
widget.author == null || widget.author!.authorIsMe ? profileCubit.getMyProfile() : profileCubit.getProfileBySlug(widget.author!.authorSlug);
}
@override
@@ -89,11 +89,11 @@ class _ProfileScreenState extends State<ProfileScreen> {
}
isFirstFetch = false;
}
return widget.author == null ? _myProfileScreen(state) : _profileScreen(state);
return widget.author == null || widget.author!.authorIsMe ? _myProfileScreen(state) : _profileScreen(state);
} else if (state is ProfileStateError) {
return DataErrorWidget(
onReload: () async {
widget.author == null ? await profileCubit.getMyProfile() : await profileCubit.getProfileBySlug(widget.author!.authorSlug);
widget.author == null || widget.author!.authorIsMe ? await profileCubit.getMyProfile() : await profileCubit.getProfileBySlug(widget.author!.authorSlug);
},
);
} else {
@@ -393,7 +393,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
),
),
Text(
widget.author == null ? 'Редактировать' : '',
widget.author == null || widget.author!.authorIsMe ? 'Редактировать' : '',
style: const TextStyle(
color: Color(0xFF2F80ED),
fontSize: 16,
@@ -478,7 +478,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
),
),
Text(
widget.author == null ? 'Редактировать' : '',
widget.author == null || widget.author!.authorIsMe ? 'Редактировать' : '',
style: const TextStyle(
color: Color(0xFF2F80ED),
fontSize: 16,
@@ -955,12 +955,12 @@ class _ProfileScreenState extends State<ProfileScreen> {
value: 'view',
child: Text('Посмотреть'),
),
if (widget.author == null)
if (widget.author == null || widget.author!.authorIsMe)
const PopupMenuItem(
value: 'replace',
child: Text('Заменить'),
),
if (widget.author == null)
if (widget.author == null || widget.author!.authorIsMe)
const PopupMenuItem(
value: 'delete',
child: Text('Удалить'),