forked from eatvio/eatvio_app
130 lines
4.1 KiB
Dart
130 lines
4.1 KiB
Dart
import 'package:cached_network_image/cached_network_image.dart';
|
|
import 'package:dismissible_page/dismissible_page.dart';
|
|
import 'package:eatvio_app/core/app_export.dart';
|
|
import 'package:eatvio_app/features/chat/presentation/pages/photo_view_screen.dart';
|
|
import 'package:eatvio_app/features/feed/models/feed_blog_post_model.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class BlogPostWidget extends StatefulWidget {
|
|
final FeedBlogPostModel feedBlogPostModel;
|
|
|
|
const BlogPostWidget({super.key, required this.feedBlogPostModel});
|
|
|
|
@override
|
|
State<BlogPostWidget> createState() => _BlogPostWidgetState();
|
|
}
|
|
|
|
class _BlogPostWidgetState extends State<BlogPostWidget> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return GestureDetector(
|
|
onTap: () {},
|
|
child: Ink(
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(12),
|
|
color: Colors.white,
|
|
),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
SizedBox(height: 12),
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 12),
|
|
child: Row(
|
|
children: [
|
|
CircleAvatar(radius: 20),
|
|
SizedBox(width: 8),
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text('Имя автора'),
|
|
Text('Время поста'),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
SizedBox(height: 12),
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 12),
|
|
child: Text(widget.feedBlogPostModel.title),
|
|
),
|
|
SizedBox(height: 8),
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 12),
|
|
child: Text(widget.feedBlogPostModel.description),
|
|
),
|
|
SizedBox(height: 8),
|
|
GestureDetector(
|
|
onTap: () {
|
|
context.pushTransparentRoute(
|
|
rootNavigator: true,
|
|
PhotoViewScreen(
|
|
imageUrls: [baseUrl + '/storage/' + widget.feedBlogPostModel.image],
|
|
index: 0,
|
|
),
|
|
);
|
|
},
|
|
child: Hero(
|
|
tag: baseUrl + '/storage/' + widget.feedBlogPostModel.image,
|
|
child: CachedNetworkImage(
|
|
imageUrl: baseUrl + '/storage/' + widget.feedBlogPostModel.image,
|
|
),
|
|
),
|
|
),
|
|
SizedBox(height: 8),
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 12),
|
|
child: Row(
|
|
children: [
|
|
_iconButton(Icons.favorite_border_rounded),
|
|
SizedBox(width: 8),
|
|
_iconButton(Icons.mode_comment_outlined),
|
|
SizedBox(width: 8),
|
|
_iconButton(Icons.reply_rounded),
|
|
],
|
|
),
|
|
),
|
|
SizedBox(height: 8),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
_iconButton(IconData icon, [String? text]) {
|
|
return InkWell(
|
|
onTap: () {},
|
|
borderRadius: BorderRadius.circular(16),
|
|
child: Ink(
|
|
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 4),
|
|
decoration: BoxDecoration(
|
|
color: appTheme.gray100,
|
|
borderRadius: BorderRadius.circular(16),
|
|
),
|
|
height: 32,
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Icon(
|
|
icon,
|
|
size: 20,
|
|
color: appTheme.gray600,
|
|
),
|
|
if (text != null) SizedBox(width: 8),
|
|
if (text != null)
|
|
Text(
|
|
text,
|
|
style: TextStyle(
|
|
color: appTheme.gray600,
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|