feat(profile): some fixes, add buttons

This commit is contained in:
mso7nueh
2024-09-04 17:27:46 +03:00
parent d76f535663
commit f9c10047b2
154 changed files with 1249 additions and 296 deletions

View File

@@ -2,14 +2,13 @@ import 'dart:async';
import 'dart:io';
import 'package:eatvio_app/core/app_export.dart';
import 'package:eatvio_app/old/feed/blog_post_create_screen/bloc/blog_post_create_bloc.dart';
import 'package:eatvio_app/old/feed/blog_post_create_screen/models/blog_post_create_model.dart';
import 'package:eatvio_app/widgets/custom_text_form_field.dart';
import 'package:flutter/material.dart';
import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart';
import 'package:image_picker/image_picker.dart';
import '../../../../presentation/feed/blog_post_create_screen/bloc/blog_post_create_bloc.dart';
import '../../../../presentation/feed/blog_post_create_screen/models/blog_post_create_model.dart';
class BlogPostCreateScreen extends StatefulWidget {
const BlogPostCreateScreen({Key? key}) : super(key: key);

View File

@@ -190,9 +190,9 @@ class _BottomNavigationBarWidgetState extends State<BottomNavigationBarWidget> {
label: '',
icon: BlocBuilder<ProfileAvatarCubit, ProfileAvatarState>(
builder: (BuildContext context, ProfileAvatarState state) {
if (state is ProfileAvatarStateLoaded && state.profile.user.profilePhotoUrl.isNotEmpty) {
if (state is ProfileAvatarStateLoaded && state.profile.user.profilePhotoUrl != null) {
return CircleAvatar(
backgroundImage: NetworkImage(state.profile.user.profilePhotoUrl),
backgroundImage: NetworkImage(state.profile.user.profilePhotoUrl!),
radius: 16,
);
}

View File

@@ -6,6 +6,7 @@ import 'package:eatvio_app/features/feed/models/feed_blog_post_model.dart';
import 'package:eatvio_app/features/feed/presentation/bloc/feed_cubit/feed_cubit.dart';
import 'package:flutter/material.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:go_router/go_router.dart';
import 'package:share_plus/share_plus.dart';
@@ -62,8 +63,24 @@ class _BlogPostWidgetState extends State<BlogPostWidget> {
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(widget.feedBlogPostModel.author.authorName),
Text(calculateDifference(widget.feedBlogPostModel.createdAt)),
Text(
widget.feedBlogPostModel.author.authorName,
style: TextStyle(
height: 1,
color: Colors.black87,
fontWeight: FontWeight.w500,
),
),
const SizedBox(height: 4),
Text(
calculateDifference(
widget.feedBlogPostModel.createdAt,
),
style: TextStyle(
height: 1,
color: Colors.black45,
),
),
],
),
],
@@ -81,12 +98,18 @@ class _BlogPostWidgetState extends State<BlogPostWidget> {
),
),
if (widget.feedBlogPostModel.title.isNotEmpty && widget.feedBlogPostModel.description.isNotEmpty) SizedBox(height: 8),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 12),
child: Html(
data: widget.feedBlogPostModel.description,
if (widget.feedBlogPostModel.description.isNotEmpty)
Padding(
padding: const EdgeInsets.symmetric(horizontal: 4),
child: Html(
data: widget.feedBlogPostModel.description,
style: {
"*": Style(
color: Colors.black87,
),
},
),
),
),
if (widget.feedBlogPostModel.title.isNotEmpty || widget.feedBlogPostModel.description.isNotEmpty) SizedBox(height: 8),
GestureDetector(
onTap: () {
@@ -112,7 +135,7 @@ class _BlogPostWidgetState extends State<BlogPostWidget> {
child: Row(
children: [
_iconButton(
icon: Icons.favorite_border_rounded,
icon: isLiked ? Icons.favorite_rounded : Icons.favorite_border_rounded,
text: totalLikes.toString(),
iconColor: isLiked ? Colors.red.withOpacity(0.8) : null,
backgroundColor: isLiked ? Colors.red.withOpacity(0.1) : null,
@@ -130,7 +153,15 @@ class _BlogPostWidgetState extends State<BlogPostWidget> {
),
SizedBox(width: 8),
_iconButton(
icon: Icons.mode_comment_outlined,
svgIcon: SvgPicture.asset(
'assets/icons/comment.svg',
height: 20,
width: 20,
colorFilter: ColorFilter.mode(
appTheme.gray600,
BlendMode.srcIn,
),
),
text: widget.feedBlogPostModel.totalComments.toString(),
onTap: () => GoRouter.of(context).pushNamed(
'blogPostScreen',
@@ -139,7 +170,12 @@ class _BlogPostWidgetState extends State<BlogPostWidget> {
),
SizedBox(width: 8),
_iconButton(
icon: Icons.reply_rounded,
svgIcon: SvgPicture.asset(
height: 20,
width: 20,
'assets/icons/share.svg',
colorFilter: ColorFilter.mode(appTheme.gray600, BlendMode.srcIn),
),
onTap: () => Share.shareUri(
Uri.parse(
baseUrl + '/ru/blog_post/' + widget.feedBlogPostModel.id.toString(),
@@ -171,7 +207,7 @@ class _BlogPostWidgetState extends State<BlogPostWidget> {
);
}
_iconButton({required IconData icon, String? text, Function()? onTap, Color? iconColor, Color? backgroundColor, Color? textColor}) {
_iconButton({IconData? icon, SvgPicture? svgIcon, String? text, Function()? onTap, Color? iconColor, Color? backgroundColor, Color? textColor}) {
return InkWell(
onTap: onTap ?? () {},
borderRadius: BorderRadius.circular(16),
@@ -185,11 +221,13 @@ class _BlogPostWidgetState extends State<BlogPostWidget> {
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
icon,
size: 20,
color: iconColor ?? appTheme.gray600,
),
if (svgIcon != null) svgIcon,
if (icon != null)
Icon(
icon,
size: 20,
color: iconColor ?? appTheme.gray600,
),
if (text != null) SizedBox(width: 8),
if (text != null)
Text(

View File

@@ -41,17 +41,17 @@ class User with _$User {
@JsonKey(name: "id") required int id,
@JsonKey(name: "name") required String name,
@JsonKey(name: "email") required String email,
@JsonKey(name: "email_verified_at") required DateTime emailVerifiedAt,
@JsonKey(name: "email_verified_at") required dynamic emailVerifiedAt,
@JsonKey(name: "two_factor_confirmed_at") required dynamic twoFactorConfirmedAt,
@JsonKey(name: "current_team_id") required dynamic currentTeamId,
@JsonKey(name: "profile_photo_path") required String profilePhotoPath,
@JsonKey(name: "profile_photo_path") String? profilePhotoPath,
@JsonKey(name: "created_at") required DateTime createdAt,
@JsonKey(name: "updated_at") required DateTime updatedAt,
@JsonKey(name: "is_consultant") required int isConsultant,
@JsonKey(name: "is_public_profile") required int isPublicProfile,
@JsonKey(name: "slug") required String slug,
@JsonKey(name: "user_settings_id") required dynamic userSettingsId,
@JsonKey(name: "profile_photo_url") required String profilePhotoUrl,
@JsonKey(name: "profile_photo_url") String? profilePhotoUrl,
@JsonKey(name: "detailz") required UserDetails detailz,
}) = _User;

View File

@@ -776,13 +776,13 @@ mixin _$User {
@JsonKey(name: "email")
String get email => throw _privateConstructorUsedError;
@JsonKey(name: "email_verified_at")
DateTime get emailVerifiedAt => throw _privateConstructorUsedError;
dynamic get emailVerifiedAt => throw _privateConstructorUsedError;
@JsonKey(name: "two_factor_confirmed_at")
dynamic get twoFactorConfirmedAt => throw _privateConstructorUsedError;
@JsonKey(name: "current_team_id")
dynamic get currentTeamId => throw _privateConstructorUsedError;
@JsonKey(name: "profile_photo_path")
String get profilePhotoPath => throw _privateConstructorUsedError;
String? get profilePhotoPath => throw _privateConstructorUsedError;
@JsonKey(name: "created_at")
DateTime get createdAt => throw _privateConstructorUsedError;
@JsonKey(name: "updated_at")
@@ -796,7 +796,7 @@ mixin _$User {
@JsonKey(name: "user_settings_id")
dynamic get userSettingsId => throw _privateConstructorUsedError;
@JsonKey(name: "profile_photo_url")
String get profilePhotoUrl => throw _privateConstructorUsedError;
String? get profilePhotoUrl => throw _privateConstructorUsedError;
@JsonKey(name: "detailz")
UserDetails get detailz => throw _privateConstructorUsedError;
@@ -814,17 +814,17 @@ abstract class $UserCopyWith<$Res> {
{@JsonKey(name: "id") int id,
@JsonKey(name: "name") String name,
@JsonKey(name: "email") String email,
@JsonKey(name: "email_verified_at") DateTime emailVerifiedAt,
@JsonKey(name: "email_verified_at") dynamic emailVerifiedAt,
@JsonKey(name: "two_factor_confirmed_at") dynamic twoFactorConfirmedAt,
@JsonKey(name: "current_team_id") dynamic currentTeamId,
@JsonKey(name: "profile_photo_path") String profilePhotoPath,
@JsonKey(name: "profile_photo_path") String? profilePhotoPath,
@JsonKey(name: "created_at") DateTime createdAt,
@JsonKey(name: "updated_at") DateTime updatedAt,
@JsonKey(name: "is_consultant") int isConsultant,
@JsonKey(name: "is_public_profile") int isPublicProfile,
@JsonKey(name: "slug") String slug,
@JsonKey(name: "user_settings_id") dynamic userSettingsId,
@JsonKey(name: "profile_photo_url") String profilePhotoUrl,
@JsonKey(name: "profile_photo_url") String? profilePhotoUrl,
@JsonKey(name: "detailz") UserDetails detailz});
$UserDetailsCopyWith<$Res> get detailz;
@@ -846,17 +846,17 @@ class _$UserCopyWithImpl<$Res, $Val extends User>
Object? id = null,
Object? name = null,
Object? email = null,
Object? emailVerifiedAt = null,
Object? emailVerifiedAt = freezed,
Object? twoFactorConfirmedAt = freezed,
Object? currentTeamId = freezed,
Object? profilePhotoPath = null,
Object? profilePhotoPath = freezed,
Object? createdAt = null,
Object? updatedAt = null,
Object? isConsultant = null,
Object? isPublicProfile = null,
Object? slug = null,
Object? userSettingsId = freezed,
Object? profilePhotoUrl = null,
Object? profilePhotoUrl = freezed,
Object? detailz = null,
}) {
return _then(_value.copyWith(
@@ -872,10 +872,10 @@ class _$UserCopyWithImpl<$Res, $Val extends User>
? _value.email
: email // ignore: cast_nullable_to_non_nullable
as String,
emailVerifiedAt: null == emailVerifiedAt
emailVerifiedAt: freezed == emailVerifiedAt
? _value.emailVerifiedAt
: emailVerifiedAt // ignore: cast_nullable_to_non_nullable
as DateTime,
as dynamic,
twoFactorConfirmedAt: freezed == twoFactorConfirmedAt
? _value.twoFactorConfirmedAt
: twoFactorConfirmedAt // ignore: cast_nullable_to_non_nullable
@@ -884,10 +884,10 @@ class _$UserCopyWithImpl<$Res, $Val extends User>
? _value.currentTeamId
: currentTeamId // ignore: cast_nullable_to_non_nullable
as dynamic,
profilePhotoPath: null == profilePhotoPath
profilePhotoPath: freezed == profilePhotoPath
? _value.profilePhotoPath
: profilePhotoPath // ignore: cast_nullable_to_non_nullable
as String,
as String?,
createdAt: null == createdAt
? _value.createdAt
: createdAt // ignore: cast_nullable_to_non_nullable
@@ -912,10 +912,10 @@ class _$UserCopyWithImpl<$Res, $Val extends User>
? _value.userSettingsId
: userSettingsId // ignore: cast_nullable_to_non_nullable
as dynamic,
profilePhotoUrl: null == profilePhotoUrl
profilePhotoUrl: freezed == profilePhotoUrl
? _value.profilePhotoUrl
: profilePhotoUrl // ignore: cast_nullable_to_non_nullable
as String,
as String?,
detailz: null == detailz
? _value.detailz
: detailz // ignore: cast_nullable_to_non_nullable
@@ -943,17 +943,17 @@ abstract class _$$UserImplCopyWith<$Res> implements $UserCopyWith<$Res> {
{@JsonKey(name: "id") int id,
@JsonKey(name: "name") String name,
@JsonKey(name: "email") String email,
@JsonKey(name: "email_verified_at") DateTime emailVerifiedAt,
@JsonKey(name: "email_verified_at") dynamic emailVerifiedAt,
@JsonKey(name: "two_factor_confirmed_at") dynamic twoFactorConfirmedAt,
@JsonKey(name: "current_team_id") dynamic currentTeamId,
@JsonKey(name: "profile_photo_path") String profilePhotoPath,
@JsonKey(name: "profile_photo_path") String? profilePhotoPath,
@JsonKey(name: "created_at") DateTime createdAt,
@JsonKey(name: "updated_at") DateTime updatedAt,
@JsonKey(name: "is_consultant") int isConsultant,
@JsonKey(name: "is_public_profile") int isPublicProfile,
@JsonKey(name: "slug") String slug,
@JsonKey(name: "user_settings_id") dynamic userSettingsId,
@JsonKey(name: "profile_photo_url") String profilePhotoUrl,
@JsonKey(name: "profile_photo_url") String? profilePhotoUrl,
@JsonKey(name: "detailz") UserDetails detailz});
@override
@@ -973,17 +973,17 @@ class __$$UserImplCopyWithImpl<$Res>
Object? id = null,
Object? name = null,
Object? email = null,
Object? emailVerifiedAt = null,
Object? emailVerifiedAt = freezed,
Object? twoFactorConfirmedAt = freezed,
Object? currentTeamId = freezed,
Object? profilePhotoPath = null,
Object? profilePhotoPath = freezed,
Object? createdAt = null,
Object? updatedAt = null,
Object? isConsultant = null,
Object? isPublicProfile = null,
Object? slug = null,
Object? userSettingsId = freezed,
Object? profilePhotoUrl = null,
Object? profilePhotoUrl = freezed,
Object? detailz = null,
}) {
return _then(_$UserImpl(
@@ -999,10 +999,10 @@ class __$$UserImplCopyWithImpl<$Res>
? _value.email
: email // ignore: cast_nullable_to_non_nullable
as String,
emailVerifiedAt: null == emailVerifiedAt
emailVerifiedAt: freezed == emailVerifiedAt
? _value.emailVerifiedAt
: emailVerifiedAt // ignore: cast_nullable_to_non_nullable
as DateTime,
as dynamic,
twoFactorConfirmedAt: freezed == twoFactorConfirmedAt
? _value.twoFactorConfirmedAt
: twoFactorConfirmedAt // ignore: cast_nullable_to_non_nullable
@@ -1011,10 +1011,10 @@ class __$$UserImplCopyWithImpl<$Res>
? _value.currentTeamId
: currentTeamId // ignore: cast_nullable_to_non_nullable
as dynamic,
profilePhotoPath: null == profilePhotoPath
profilePhotoPath: freezed == profilePhotoPath
? _value.profilePhotoPath
: profilePhotoPath // ignore: cast_nullable_to_non_nullable
as String,
as String?,
createdAt: null == createdAt
? _value.createdAt
: createdAt // ignore: cast_nullable_to_non_nullable
@@ -1039,10 +1039,10 @@ class __$$UserImplCopyWithImpl<$Res>
? _value.userSettingsId
: userSettingsId // ignore: cast_nullable_to_non_nullable
as dynamic,
profilePhotoUrl: null == profilePhotoUrl
profilePhotoUrl: freezed == profilePhotoUrl
? _value.profilePhotoUrl
: profilePhotoUrl // ignore: cast_nullable_to_non_nullable
as String,
as String?,
detailz: null == detailz
? _value.detailz
: detailz // ignore: cast_nullable_to_non_nullable
@@ -1062,14 +1062,14 @@ class _$UserImpl implements _User {
@JsonKey(name: "two_factor_confirmed_at")
required this.twoFactorConfirmedAt,
@JsonKey(name: "current_team_id") required this.currentTeamId,
@JsonKey(name: "profile_photo_path") required this.profilePhotoPath,
@JsonKey(name: "profile_photo_path") this.profilePhotoPath,
@JsonKey(name: "created_at") required this.createdAt,
@JsonKey(name: "updated_at") required this.updatedAt,
@JsonKey(name: "is_consultant") required this.isConsultant,
@JsonKey(name: "is_public_profile") required this.isPublicProfile,
@JsonKey(name: "slug") required this.slug,
@JsonKey(name: "user_settings_id") required this.userSettingsId,
@JsonKey(name: "profile_photo_url") required this.profilePhotoUrl,
@JsonKey(name: "profile_photo_url") this.profilePhotoUrl,
@JsonKey(name: "detailz") required this.detailz});
factory _$UserImpl.fromJson(Map<String, dynamic> json) =>
@@ -1086,7 +1086,7 @@ class _$UserImpl implements _User {
final String email;
@override
@JsonKey(name: "email_verified_at")
final DateTime emailVerifiedAt;
final dynamic emailVerifiedAt;
@override
@JsonKey(name: "two_factor_confirmed_at")
final dynamic twoFactorConfirmedAt;
@@ -1095,7 +1095,7 @@ class _$UserImpl implements _User {
final dynamic currentTeamId;
@override
@JsonKey(name: "profile_photo_path")
final String profilePhotoPath;
final String? profilePhotoPath;
@override
@JsonKey(name: "created_at")
final DateTime createdAt;
@@ -1116,7 +1116,7 @@ class _$UserImpl implements _User {
final dynamic userSettingsId;
@override
@JsonKey(name: "profile_photo_url")
final String profilePhotoUrl;
final String? profilePhotoUrl;
@override
@JsonKey(name: "detailz")
final UserDetails detailz;
@@ -1134,8 +1134,8 @@ class _$UserImpl implements _User {
(identical(other.id, id) || other.id == id) &&
(identical(other.name, name) || other.name == name) &&
(identical(other.email, email) || other.email == email) &&
(identical(other.emailVerifiedAt, emailVerifiedAt) ||
other.emailVerifiedAt == emailVerifiedAt) &&
const DeepCollectionEquality()
.equals(other.emailVerifiedAt, emailVerifiedAt) &&
const DeepCollectionEquality()
.equals(other.twoFactorConfirmedAt, twoFactorConfirmedAt) &&
const DeepCollectionEquality()
@@ -1165,7 +1165,7 @@ class _$UserImpl implements _User {
id,
name,
email,
emailVerifiedAt,
const DeepCollectionEquality().hash(emailVerifiedAt),
const DeepCollectionEquality().hash(twoFactorConfirmedAt),
const DeepCollectionEquality().hash(currentTeamId),
profilePhotoPath,
@@ -1198,19 +1198,18 @@ abstract class _User implements User {
@JsonKey(name: "name") required final String name,
@JsonKey(name: "email") required final String email,
@JsonKey(name: "email_verified_at")
required final DateTime emailVerifiedAt,
required final dynamic emailVerifiedAt,
@JsonKey(name: "two_factor_confirmed_at")
required final dynamic twoFactorConfirmedAt,
@JsonKey(name: "current_team_id") required final dynamic currentTeamId,
@JsonKey(name: "profile_photo_path")
required final String profilePhotoPath,
@JsonKey(name: "profile_photo_path") final String? profilePhotoPath,
@JsonKey(name: "created_at") required final DateTime createdAt,
@JsonKey(name: "updated_at") required final DateTime updatedAt,
@JsonKey(name: "is_consultant") required final int isConsultant,
@JsonKey(name: "is_public_profile") required final int isPublicProfile,
@JsonKey(name: "slug") required final String slug,
@JsonKey(name: "user_settings_id") required final dynamic userSettingsId,
@JsonKey(name: "profile_photo_url") required final String profilePhotoUrl,
@JsonKey(name: "profile_photo_url") final String? profilePhotoUrl,
@JsonKey(name: "detailz")
required final UserDetails detailz}) = _$UserImpl;
@@ -1227,7 +1226,7 @@ abstract class _User implements User {
String get email;
@override
@JsonKey(name: "email_verified_at")
DateTime get emailVerifiedAt;
dynamic get emailVerifiedAt;
@override
@JsonKey(name: "two_factor_confirmed_at")
dynamic get twoFactorConfirmedAt;
@@ -1236,7 +1235,7 @@ abstract class _User implements User {
dynamic get currentTeamId;
@override
@JsonKey(name: "profile_photo_path")
String get profilePhotoPath;
String? get profilePhotoPath;
@override
@JsonKey(name: "created_at")
DateTime get createdAt;
@@ -1257,7 +1256,7 @@ abstract class _User implements User {
dynamic get userSettingsId;
@override
@JsonKey(name: "profile_photo_url")
String get profilePhotoUrl;
String? get profilePhotoUrl;
@override
@JsonKey(name: "detailz")
UserDetails get detailz;

View File

@@ -65,17 +65,17 @@ _$UserImpl _$$UserImplFromJson(Map<String, dynamic> json) => _$UserImpl(
id: (json['id'] as num).toInt(),
name: json['name'] as String,
email: json['email'] as String,
emailVerifiedAt: DateTime.parse(json['email_verified_at'] as String),
emailVerifiedAt: json['email_verified_at'],
twoFactorConfirmedAt: json['two_factor_confirmed_at'],
currentTeamId: json['current_team_id'],
profilePhotoPath: json['profile_photo_path'] as String,
profilePhotoPath: json['profile_photo_path'] as String?,
createdAt: DateTime.parse(json['created_at'] as String),
updatedAt: DateTime.parse(json['updated_at'] as String),
isConsultant: (json['is_consultant'] as num).toInt(),
isPublicProfile: (json['is_public_profile'] as num).toInt(),
slug: json['slug'] as String,
userSettingsId: json['user_settings_id'],
profilePhotoUrl: json['profile_photo_url'] as String,
profilePhotoUrl: json['profile_photo_url'] as String?,
detailz: UserDetails.fromJson(json['detailz'] as Map<String, dynamic>),
);
@@ -84,7 +84,7 @@ Map<String, dynamic> _$$UserImplToJson(_$UserImpl instance) =>
'id': instance.id,
'name': instance.name,
'email': instance.email,
'email_verified_at': instance.emailVerifiedAt.toIso8601String(),
'email_verified_at': instance.emailVerifiedAt,
'two_factor_confirmed_at': instance.twoFactorConfirmedAt,
'current_team_id': instance.currentTeamId,
'profile_photo_path': instance.profilePhotoPath,

View File

@@ -9,6 +9,7 @@ import 'package:eatvio_app/features/profile/presentation/widgets/imt_chart_widge
import 'package:eatvio_app/features/profile/presentation/widgets/weight_chart_widget.dart';
import 'package:eatvio_app/locator_service.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
class ProfileScreen extends StatefulWidget {
final Author? author;
@@ -62,35 +63,125 @@ class _ProfileScreenState extends State<ProfileScreen> {
padding: const EdgeInsets.only(left: 16, right: 16, bottom: 16),
child: Row(
children: [
CircleAvatar(
radius: 32,
backgroundImage: NetworkImage(state.profile.user.profilePhotoUrl),
),
state.profile.user.profilePhotoUrl != null
? CircleAvatar(
radius: 32,
backgroundImage: NetworkImage(state.profile.user.profilePhotoUrl!),
)
: CircleAvatar(
radius: 32,
),
const SizedBox(width: 12),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
Text(
state.profile.user.name,
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.w500,
height: 1,
),
),
const Spacer(),
Row(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
state.profile.user.name,
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.w500,
height: 1,
Container(
child: SvgPicture.asset(
height: 28,
width: 28,
'assets/icons/subscribers.svg',
colorFilter: ColorFilter.mode(appTheme.blueA400, BlendMode.srcIn),
),
),
if (state.profile.userDetails.additionalInfo.isNotEmpty)
Text(
state.profile.userDetails.additionalInfo,
style: TextStyle(
color: Colors.black.withOpacity(0.4),
height: 1,
SizedBox(width: 8),
Column(
children: [
Text(
'123',
style: TextStyle(
height: 1,
fontSize: 18,
fontWeight: FontWeight.w500,
color: Colors.black87,
),
),
),
Text(
'Подписчика',
style: TextStyle(
height: 1,
fontSize: 12,
fontWeight: FontWeight.w400,
color: Colors.black38,
),
),
],
),
],
),
Container(
padding: EdgeInsets.only(left: 16),
child: SvgPicture.asset(
height: 24,
width: 24,
'assets/icons/share.svg',
colorFilter: ColorFilter.mode(appTheme.blueA400, BlendMode.srcIn),
),
),
],
),
),
if (state.profile.userDetails.additionalInfo.isNotEmpty)
Container(
alignment: Alignment.centerLeft,
padding: const EdgeInsets.all(16),
child: Text(
state.profile.userDetails.additionalInfo,
style: TextStyle(
color: Colors.black.withOpacity(0.4),
height: 1,
),
),
),
if (widget.author != null) const SizedBox(height: 8),
if (widget.author != null)
Row(
children: [
SizedBox(width: 16),
Container(
alignment: Alignment.center,
padding: EdgeInsets.all(8),
width: (MediaQuery.of(context).size.width - 40) / 2,
decoration: BoxDecoration(
color: appTheme.blueA400.withOpacity(0.1),
borderRadius: BorderRadius.circular(16),
),
child: Text(
'Сообщение',
style: TextStyle(
color: appTheme.blueA400,
),
),
),
SizedBox(width: 8),
Container(
alignment: Alignment.center,
padding: EdgeInsets.all(8),
width: (MediaQuery.of(context).size.width - 40) / 2,
decoration: BoxDecoration(
color: appTheme.blueA400,
borderRadius: BorderRadius.circular(16),
),
child: Text(
'Подписаться',
style: TextStyle(
color: Colors.white,
),
),
),
SizedBox(width: 16),
],
),
if (widget.author != null) SizedBox(height: 16),
if (widget.author == null) _divider(context),
if (widget.author == null)
Column(

View File

@@ -32,70 +32,104 @@ class _CircumferenceChartWidgetState extends State<CircumferenceChartWidget> {
Widget build(BuildContext context) {
return Column(
children: [
Padding(
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: Row(
children: [
Text(
'${widget.chartData.last.chestCircumference}',
style: TextStyle(
color: Colors.black,
fontSize: 40,
fontWeight: FontWeight.w500,
if (widget.chartData.isNotEmpty)
Padding(
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: Row(
children: [
Text(
'${widget.chartData.last.chestCircumference}',
style: TextStyle(
color: Colors.black,
fontSize: 40,
fontWeight: FontWeight.w500,
),
),
),
widget.chartData.last.chestCircumference > widget.chartData[widget.chartData.length - 2].chestCircumference
? Icon(
Icons.arrow_drop_up,
size: 40,
color: Colors.grey,
)
: Icon(
Icons.arrow_drop_down,
size: 40,
color: Colors.grey,
if (widget.chartData.length == 1)
Container(
margin: EdgeInsets.symmetric(horizontal: 12),
width: 8,
height: 8,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black12,
),
Text(
'${widget.chartData.last.waistCircumference}',
style: TextStyle(
color: Colors.black,
fontSize: 40,
fontWeight: FontWeight.w500,
),
if (widget.chartData.length > 1)
widget.chartData.last.chestCircumference > widget.chartData[widget.chartData.length - 2].chestCircumference
? Icon(
Icons.arrow_drop_up,
size: 40,
color: Colors.grey,
)
: Icon(
Icons.arrow_drop_down,
size: 40,
color: Colors.grey,
),
Text(
'${widget.chartData.last.waistCircumference}',
style: TextStyle(
color: Colors.black,
fontSize: 40,
fontWeight: FontWeight.w500,
),
),
),
widget.chartData.last.waistCircumference > widget.chartData[widget.chartData.length - 2].waistCircumference
? Icon(
Icons.arrow_drop_up,
size: 40,
color: Colors.grey,
)
: Icon(
Icons.arrow_drop_down,
size: 40,
color: Colors.grey,
if (widget.chartData.length == 1)
Container(
margin: EdgeInsets.symmetric(horizontal: 12),
width: 8,
height: 8,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black12,
),
Text(
'${widget.chartData.last.hipCircumference}',
style: TextStyle(
color: Colors.black,
fontSize: 40,
fontWeight: FontWeight.w500,
),
if (widget.chartData.length > 1)
widget.chartData.last.waistCircumference > widget.chartData[widget.chartData.length - 2].waistCircumference
? Icon(
Icons.arrow_drop_up,
size: 40,
color: Colors.grey,
)
: Icon(
Icons.arrow_drop_down,
size: 40,
color: Colors.grey,
),
Text(
'${widget.chartData.last.hipCircumference}',
style: TextStyle(
color: Colors.black,
fontSize: 40,
fontWeight: FontWeight.w500,
),
),
),
widget.chartData.last.hipCircumference > widget.chartData[widget.chartData.length - 2].hipCircumference
? Icon(
Icons.arrow_drop_up,
size: 40,
color: Colors.grey,
)
: Icon(
Icons.arrow_drop_down,
size: 40,
color: Colors.grey,
if (widget.chartData.length == 1)
Container(
margin: EdgeInsets.symmetric(horizontal: 12),
width: 8,
height: 8,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black12,
),
],
),
if (widget.chartData.length > 1)
widget.chartData.last.hipCircumference > widget.chartData[widget.chartData.length - 2].hipCircumference
? Icon(
Icons.arrow_drop_up,
size: 40,
color: Colors.grey,
)
: Icon(
Icons.arrow_drop_down,
size: 40,
color: Colors.grey,
),
],
),
),
),
Stack(
alignment: Alignment.bottomRight,
children: [
@@ -140,12 +174,18 @@ class _CircumferenceChartWidgetState extends State<CircumferenceChartWidget> {
FloatingActionButton.small(
heroTag: 'addCircumference',
onPressed: () {
chest = widget.chartData.last.chestCircumference;
waist = widget.chartData.last.waistCircumference;
hip = widget.chartData.last.hipCircumference;
chestController = FixedExtentScrollController(initialItem: chest - 20);
waistController = FixedExtentScrollController(initialItem: waist - 20);
hipController = FixedExtentScrollController(initialItem: hip - 20);
if (widget.chartData.isNotEmpty) {
chest = widget.chartData.last.chestCircumference;
waist = widget.chartData.last.waistCircumference;
hip = widget.chartData.last.hipCircumference;
chestController = FixedExtentScrollController(initialItem: chest - 20);
waistController = FixedExtentScrollController(initialItem: waist - 20);
hipController = FixedExtentScrollController(initialItem: hip - 20);
} else {
chestController = FixedExtentScrollController();
waistController = FixedExtentScrollController();
hipController = FixedExtentScrollController();
}
showModalBottomSheet(
useRootNavigator: true,
context: context,

View File

@@ -31,83 +31,97 @@ class _WeightChartWidgetState extends State<WeightChartWidget> {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: Row(
children: [
Text(
'${widget.chartPoints.last.weight.toStringAsFixed(1)} кг',
style: TextStyle(
color: Colors.black,
fontSize: 40,
fontWeight: FontWeight.w500,
if (widget.chartPoints.isNotEmpty)
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: Row(
children: [
Text(
'${widget.chartPoints.last.weight.toStringAsFixed(1)} кг',
style: TextStyle(
color: Colors.black,
fontSize: 40,
fontWeight: FontWeight.w500,
),
),
),
widget.chartPoints.last.weight > widget.chartPoints[widget.chartPoints.length - 2].weight
? Icon(
Icons.arrow_drop_up,
size: 40,
color: Colors.grey.withOpacity(0.4),
)
: Icon(
Icons.arrow_drop_down,
size: 40,
color: Colors.grey.withOpacity(0.4),
if (widget.chartPoints.length == 1)
Container(
margin: EdgeInsets.symmetric(horizontal: 12),
width: 8,
height: 8,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black12,
),
],
),
if (widget.chartPoints.length > 1) widget.chartPoints.last.weight > widget.chartPoints[widget.chartPoints.length - 2].weight
? Icon(
Icons.arrow_drop_up,
size: 40,
color: Colors.grey.withOpacity(0.4),
)
: Icon(
Icons.arrow_drop_down,
size: 40,
color: Colors.grey.withOpacity(0.4),
),
],
),
),
),
Stack(
alignment: Alignment.bottomRight,
children: [
SfCartesianChart(
margin: EdgeInsets.symmetric(horizontal: 8),
enableAxisAnimation: true,
plotAreaBorderWidth: 0,
trackballBehavior: TrackballBehavior(
enable: true,
activationMode: ActivationMode.singleTap,
tooltipDisplayMode: TrackballDisplayMode.groupAllPoints,
tooltipSettings: InteractiveTooltip(),
lineType: TrackballLineType.vertical,
SfCartesianChart(
margin: EdgeInsets.symmetric(horizontal: 8),
enableAxisAnimation: true,
plotAreaBorderWidth: 0,
trackballBehavior: TrackballBehavior(
enable: true,
activationMode: ActivationMode.singleTap,
tooltipDisplayMode: TrackballDisplayMode.groupAllPoints,
tooltipSettings: InteractiveTooltip(),
lineType: TrackballLineType.vertical,
),
primaryXAxis: DateTimeCategoryAxis(
tickPosition: TickPosition.inside,
majorTickLines: MajorTickLines(
size: 0,
),
edgeLabelPlacement: EdgeLabelPlacement.shift,
dateFormat: DateFormat.MMMd('ru'),
labelStyle: TextStyle(
color: Colors.grey,
),
majorGridLines: MajorGridLines(dashArray: [1], color: Colors.grey.withOpacity(0.3)),
axisLine: AxisLine(
color: Colors.grey.withOpacity(0.3),
width: 0.4,
),
),
primaryYAxis: NumericAxis(
isVisible: false,
labelFormat: '{value} кг',
majorGridLines: MajorGridLines(dashArray: [1], color: Colors.grey),
axisLine: AxisLine(
width: 1,
),
majorTickLines: MajorTickLines(size: 0),
),
series: _getSplineSeries(),
tooltipBehavior: TooltipBehavior(enable: true),
),
primaryXAxis: DateTimeCategoryAxis(
initialVisibleMinimum: widget.chartPoints.first.createdAt,
initialVisibleMaximum: widget.chartPoints.last.createdAt,
tickPosition: TickPosition.inside,
majorTickLines: MajorTickLines(
size: 0,
),
edgeLabelPlacement: EdgeLabelPlacement.shift,
dateFormat: DateFormat.MMMd('ru'),
labelStyle: TextStyle(
color: Colors.grey,
),
majorGridLines: MajorGridLines(dashArray: [1], color: Colors.grey.withOpacity(0.3)),
axisLine: AxisLine(
color: Colors.grey.withOpacity(0.3),
width: 0.4,
),
),
primaryYAxis: NumericAxis(
isVisible: false,
labelFormat: '{value} кг',
majorGridLines: MajorGridLines(dashArray: [1], color: Colors.grey),
axisLine: AxisLine(
width: 1,
),
majorTickLines: MajorTickLines(size: 0),
),
series: _getSplineSeries(),
tooltipBehavior: TooltipBehavior(enable: true),
),
FloatingActionButton.small(
heroTag: 'addWeight',
onPressed: () {
weightKilo = int.parse(widget.chartPoints.last.weight.toString().split('.')[0]);
weightGrams = int.parse(widget.chartPoints.last.weight.toString().split('.')[1][0]);
weightKiloController = FixedExtentScrollController(initialItem: weightKilo - 20);
weightGramsController = FixedExtentScrollController(initialItem: weightGrams);
if (widget.chartPoints.isNotEmpty) {
weightKilo = int.parse(widget.chartPoints.last.weight.toString().split('.')[0]);
weightGrams = int.parse(widget.chartPoints.last.weight.toString().split('.')[1][0]);
weightKiloController = FixedExtentScrollController(initialItem: weightKilo - 20);
weightGramsController = FixedExtentScrollController(initialItem: weightGrams);
} else {
weightKiloController = FixedExtentScrollController();
weightGramsController = FixedExtentScrollController();
}
showModalBottomSheet(
useRootNavigator: true,
context: context,