feat(profile): diplomas and certificates

This commit is contained in:
mso7nueh
2024-10-18 15:34:17 +03:00
parent dae3070caa
commit 8c1784bea4

View File

@@ -1,3 +1,4 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart';
import 'package:eatvio_app/features/feed/presentation/widgets/blog_post_widget.dart';
import 'package:eatvio_app/features/profile/models/circumference_model.dart';
@@ -116,6 +117,8 @@ class _ProfileScreenState extends State<ProfileScreen> {
if (widget.author == null) SizedBox(height: 16),
_education(state),
if (widget.author == null) SizedBox(height: 16),
_diplomasAndCertificates(state),
if (widget.author == null) SizedBox(height: 16),
if (widget.author == null) _charts(),
_blogPosts(state),
],
@@ -124,6 +127,85 @@ class _ProfileScreenState extends State<ProfileScreen> {
);
}
_diplomasAndCertificates(ProfileStateLoaded state) {
if (state.profile.role != 'consultant') {
return const SizedBox.shrink();
}
return Column(
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'Дипломы\nисертификаты',
style: TextStyle(
color: Color(0xFF323F4B),
fontSize: 24,
height: 1,
fontWeight: FontWeight.w600,
),
),
Text(
widget.author == null ? 'Редактировать' : 'Показать все',
style: TextStyle(
color: Color(0xFF2F80ED),
fontSize: 16,
fontWeight: FontWeight.w500,
),
),
],
),
),
const SizedBox(height: 8),
Container(
width: MediaQuery.of(context).size.width - 8,
padding: const EdgeInsets.symmetric(horizontal: 4),
child: Material(
color: Colors.white,
borderRadius: BorderRadius.circular(12),
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
child: Row(
children: [
_diplomaImage(
state.profile.profilePhotoUrl,
),
const SizedBox(width: 8),
_diplomaImage(
state.profile.profilePhotoUrl,
),
const SizedBox(width: 8),
_diplomaImage(
state.profile.profilePhotoUrl,
),
const SizedBox(width: 8),
_diplomaImage(
state.profile.profilePhotoUrl,
),
],
),
),
),
),
],
);
}
_diplomaImage(String url) {
return ClipRRect(
borderRadius: BorderRadius.circular(8),
child: CachedNetworkImage(
imageUrl: url,
fit: BoxFit.fitHeight,
width: MediaQuery.of(context).size.width / 3 - (60 / 3),
height: 160,
),
);
}
_education(ProfileStateLoaded state) {
if (state.profile.role != 'consultant') {
return const SizedBox.shrink();