forked from eatvio/eatvio_app
feat(profile): add education, social links
This commit is contained in:
@@ -13,6 +13,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:rive/rive.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
|
||||
class ProfileScreen extends StatefulWidget {
|
||||
final Author? author;
|
||||
@@ -27,14 +28,15 @@ class ProfileScreen extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _ProfileScreenState extends State<ProfileScreen> {
|
||||
List<CircumferenceModel> circumferencePoints = [];
|
||||
List<WeightModel> weightPoints = [];
|
||||
final ProfileCubit profileCubit = sl<ProfileCubit>();
|
||||
final List<String> chipsLabelList = ['Вес', 'Замеры', 'ИМТ'];
|
||||
final List<String> chipsIntervalLabelList = ['1М', '3М', '6М', '1Г', 'ВСЁ ВРЕМЯ'];
|
||||
final List<String> chipsIntervalList = ['1', '3', '6', '12', 'all'];
|
||||
|
||||
List<WeightModel> weightPoints = [];
|
||||
List<CircumferenceModel> circumferencePoints = [];
|
||||
int _selectedChipIndex = 0;
|
||||
int _selectedIntervalChipIndex = 0;
|
||||
final ProfileCubit profileCubit = sl<ProfileCubit>();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -110,6 +112,10 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
_subscriptionsAndSubscribers(state),
|
||||
_badges(state),
|
||||
if (widget.author == null) SizedBox(height: 16),
|
||||
_socialLinks(state),
|
||||
if (widget.author == null) SizedBox(height: 16),
|
||||
_education(state),
|
||||
if (widget.author == null) SizedBox(height: 16),
|
||||
if (widget.author == null) _charts(),
|
||||
_blogPosts(state),
|
||||
],
|
||||
@@ -118,10 +124,140 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
_badges(ProfileStateLoaded state) {
|
||||
if (state.profile.badges.isEmpty) {
|
||||
_education(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(
|
||||
'Образование',
|
||||
style: TextStyle(
|
||||
color: Color(0xFF323F4B),
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
widget.author == null ? 'Редактировать' : 'Показать все',
|
||||
style: TextStyle(
|
||||
color: Color(0xFF2F80ED),
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4),
|
||||
child: Material(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
child: Column(
|
||||
children: [
|
||||
_educationBlock(
|
||||
'Наименование диплома или сертификата в 2 строки',
|
||||
'30.01.2020',
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
_educationBlock(String title, String date) {
|
||||
return Material(
|
||||
color: Color(0xFFF6FAFF),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
height: 1,
|
||||
color: Color(0xFF323F4B),
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
date,
|
||||
style: TextStyle(
|
||||
height: 1,
|
||||
color: Color(0xFF6D6F71),
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_socialLinks(ProfileStateLoaded state) {
|
||||
if (state.profile.role != 'consultant') {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4),
|
||||
child: Material(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
child: Row(
|
||||
children: [
|
||||
_socialLinkButton(() {}, 'assets/icons/vk.svg'),
|
||||
const SizedBox(width: 12),
|
||||
_socialLinkButton(() {}, 'assets/icons/telegram.svg'),
|
||||
const SizedBox(width: 12),
|
||||
_socialLinkButton(() {}, 'assets/icons/web.svg'),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_socialLinkButton(Function() onTap, String icon) {
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
child: Ink(
|
||||
width: MediaQuery.of(context).size.width / 3 - (56 / 3),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
color: Color(0xFFF6F6F6),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 40, vertical: 16),
|
||||
child: SvgPicture.asset(
|
||||
icon,
|
||||
width: 24,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_badges(ProfileStateLoaded state) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4),
|
||||
child: InkWell(
|
||||
@@ -141,16 +277,25 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Row(
|
||||
children: [
|
||||
// CircleAvatar(
|
||||
// backgroundImage: NetworkImage(
|
||||
// state.profile.badges.first.image,
|
||||
// ),
|
||||
// radius: 20,
|
||||
// ),
|
||||
CircleAvatar(
|
||||
radius: 20,
|
||||
backgroundColor: Colors.grey.shade200,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
CircleAvatar(
|
||||
radius: 20,
|
||||
backgroundColor: Colors.grey.shade200,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
CircleAvatar(
|
||||
radius: 20,
|
||||
backgroundColor: Colors.grey.shade200,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user