forked from eatvio/eatvio_app
feat(profile): some fixes, add buttons
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user