forked from eatvio/eatvio_app
Merge remote-tracking branch 'upstream/main'
This commit is contained in:
@@ -24,10 +24,7 @@ import 'package:share_plus/share_plus.dart';
|
||||
class BlogPostScreen extends StatefulWidget {
|
||||
final FeedBlogPostModel blogPost;
|
||||
|
||||
BlogPostScreen({
|
||||
super.key,
|
||||
required this.blogPost,
|
||||
});
|
||||
BlogPostScreen({super.key, required this.blogPost});
|
||||
|
||||
@override
|
||||
State<BlogPostScreen> createState() => _BlogPostScreenState();
|
||||
@@ -50,12 +47,7 @@ class _BlogPostScreenState extends State<BlogPostScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider<CommentsCubit>(
|
||||
create: (BuildContext context) => commentsCubit
|
||||
..getComments(
|
||||
widget.blogPost.id.toString(),
|
||||
CommentSourceType.blogPost,
|
||||
true,
|
||||
),
|
||||
create: (BuildContext context) => commentsCubit..getComments(widget.blogPost.id.toString(), CommentSourceType.blogPost, true),
|
||||
child: BlocConsumer<CommentsCubit, CommentsState>(
|
||||
listener: (BuildContext context, CommentsState state) {
|
||||
if (state is CommentsStateLoaded) {
|
||||
@@ -69,14 +61,7 @@ class _BlogPostScreenState extends State<BlogPostScreen> {
|
||||
resizeToAvoidBottomInset: true,
|
||||
bottomSheet: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 12) + (Platform.isIOS ? const EdgeInsets.only(bottom: 16) : EdgeInsets.zero),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
border: Border(
|
||||
top: BorderSide(
|
||||
color: Colors.black.withValues(alpha: 0.1),
|
||||
),
|
||||
),
|
||||
),
|
||||
decoration: BoxDecoration(color: Colors.white, border: Border(top: BorderSide(color: Colors.black.withValues(alpha: 0.1)))),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
@@ -91,17 +76,10 @@ class _BlogPostScreenState extends State<BlogPostScreen> {
|
||||
FocusManager.instance.primaryFocus?.unfocus();
|
||||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: appTheme.blueA400,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
decoration: BoxDecoration(color: appTheme.blueA400, shape: BoxShape.circle),
|
||||
height: 32,
|
||||
width: 32,
|
||||
child: Icon(
|
||||
Icons.close_rounded,
|
||||
size: 18,
|
||||
color: Colors.white,
|
||||
),
|
||||
child: Icon(Icons.close_rounded, size: 18, color: Colors.white),
|
||||
),
|
||||
),
|
||||
if (replyId != null) SizedBox(width: 8),
|
||||
@@ -115,44 +93,16 @@ class _BlogPostScreenState extends State<BlogPostScreen> {
|
||||
maxLines: 5,
|
||||
minLines: 1,
|
||||
keyboardType: TextInputType.multiline,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Colors.black,
|
||||
height: 1,
|
||||
),
|
||||
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w400, color: Colors.black, height: 1),
|
||||
decoration: InputDecoration(
|
||||
isDense: true,
|
||||
contentPadding: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
hintText: 'Комментарий',
|
||||
hintStyle: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w400,
|
||||
height: 1,
|
||||
color: Color(0xFFAEAEB2),
|
||||
),
|
||||
hintStyle: TextStyle(fontSize: 16, fontWeight: FontWeight.w400, height: 1, color: Color(0xFFAEAEB2)),
|
||||
filled: true,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
borderSide: BorderSide(
|
||||
color: Color(0xFFD1D1D6),
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
borderSide: BorderSide(
|
||||
color: Color(0xFFD1D1D6),
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
borderSide: BorderSide(
|
||||
color: Color(0xFFD1D1D6),
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
border: OutlineInputBorder(borderRadius: BorderRadius.circular(16), borderSide: BorderSide(color: Color(0xFFD1D1D6), width: 1)),
|
||||
enabledBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(16), borderSide: BorderSide(color: Color(0xFFD1D1D6), width: 1)),
|
||||
focusedBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(16), borderSide: BorderSide(color: Color(0xFFD1D1D6), width: 1)),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -175,17 +125,10 @@ class _BlogPostScreenState extends State<BlogPostScreen> {
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: textEditingController.text.length > 2 ? appTheme.blueA400 : Colors.grey,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
decoration: BoxDecoration(color: textEditingController.text.length > 2 ? appTheme.blueA400 : Colors.grey, shape: BoxShape.circle),
|
||||
height: 32,
|
||||
width: 32,
|
||||
child: Icon(
|
||||
Icons.send_rounded,
|
||||
size: 18,
|
||||
color: Colors.white,
|
||||
),
|
||||
child: Icon(Icons.send_rounded, size: 18, color: Colors.white),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -206,39 +149,26 @@ class _BlogPostScreenState extends State<BlogPostScreen> {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
if (value == 'edit') {
|
||||
GoRouter.of(context).replaceNamed(
|
||||
'blogPostCreateScreen',
|
||||
extra: widget.blogPost,
|
||||
);
|
||||
GoRouter.of(context).replaceNamed('blogPostCreateScreen', extra: widget.blogPost);
|
||||
}
|
||||
},
|
||||
itemBuilder: (context) => [
|
||||
if (widget.blogPost.author.authorIsMe)
|
||||
PopupMenuItem(
|
||||
value: 'edit',
|
||||
child: Text('Редактировать'),
|
||||
),
|
||||
if (widget.blogPost.author.authorIsMe)
|
||||
PopupMenuItem(
|
||||
value: 'delete',
|
||||
child: Text('Удалить'),
|
||||
),
|
||||
if (!widget.blogPost.author.authorIsMe)
|
||||
PopupMenuItem(
|
||||
value: 'report',
|
||||
child: Text('Пожаловаться'),
|
||||
onTap: () {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
builder: (context) => ComplainingBottomSheet(
|
||||
complainedContentType: ComplainedContent.posts,
|
||||
id: widget.blogPost.id,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
itemBuilder:
|
||||
(context) => [
|
||||
if (widget.blogPost.author.authorIsMe) PopupMenuItem(value: 'edit', child: Text('Редактировать')),
|
||||
if (widget.blogPost.author.authorIsMe) PopupMenuItem(value: 'delete', child: Text('Удалить')),
|
||||
if (!widget.blogPost.author.authorIsMe)
|
||||
PopupMenuItem(
|
||||
value: 'report',
|
||||
child: Text('Пожаловаться'),
|
||||
onTap: () {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
builder: (context) => ComplainingBottomSheet(complainedContentType: ComplainedContent.posts, id: widget.blogPost.id),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -255,32 +185,19 @@ class _BlogPostScreenState extends State<BlogPostScreen> {
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
CircleAvatar(
|
||||
radius: 16,
|
||||
backgroundImage: NetworkImage(widget.blogPost.author.authorProfileIcon),
|
||||
),
|
||||
CircleAvatar(radius: 16, backgroundImage: NetworkImage(widget.blogPost.author.authorProfileIcon)),
|
||||
SizedBox(width: 8),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
widget.blogPost.author.authorName,
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w400,
|
||||
height: 1,
|
||||
),
|
||||
style: TextStyle(color: Colors.black, fontSize: 14, fontWeight: FontWeight.w400, height: 1),
|
||||
),
|
||||
SizedBox(height: 2),
|
||||
Text(
|
||||
widget.blogPost.createdAt.format('dd MMMM', 'ru'),
|
||||
style: TextStyle(
|
||||
color: Colors.grey.shade600,
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w400,
|
||||
height: 1,
|
||||
),
|
||||
style: TextStyle(color: Colors.grey.shade600, fontSize: 12, fontWeight: FontWeight.w400, height: 1),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -291,19 +208,10 @@ class _BlogPostScreenState extends State<BlogPostScreen> {
|
||||
if (widget.blogPost.description.isNotEmpty)
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
child: Html(
|
||||
data: widget.blogPost.description,
|
||||
style: {
|
||||
"*": Style(
|
||||
color: Colors.black87,
|
||||
),
|
||||
},
|
||||
),
|
||||
child: Html(data: widget.blogPost.description, style: {"*": Style(color: Colors.black87)}),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
CachedNetworkImage(
|
||||
imageUrl: baseUrl + '/storage/' + (widget.blogPost.image),
|
||||
),
|
||||
CachedNetworkImage(imageUrl: baseUrl + '/storage/' + (widget.blogPost.image)),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
child: Row(
|
||||
@@ -331,38 +239,22 @@ class _BlogPostScreenState extends State<BlogPostScreen> {
|
||||
onTap: () {
|
||||
final box = context.findRenderObject() as RenderBox?;
|
||||
Share.shareUri(
|
||||
Uri.parse(
|
||||
baseUrl + '/ru/blog_post/' + widget.blogPost.id.toString(),
|
||||
),
|
||||
Uri.parse(baseUrl + '/ru/blog_post/' + widget.blogPost.id.toString()),
|
||||
sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,
|
||||
);
|
||||
},
|
||||
),
|
||||
Spacer(),
|
||||
Icon(
|
||||
Icons.visibility_rounded,
|
||||
size: 16,
|
||||
color: appTheme.gray500,
|
||||
),
|
||||
Icon(Icons.visibility_rounded, size: 16, color: appTheme.gray500),
|
||||
SizedBox(width: 4),
|
||||
Text(
|
||||
widget.blogPost.totalViews.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: appTheme.gray500,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
Text(widget.blogPost.totalViews.toString(), style: TextStyle(fontSize: 12, color: appTheme.gray500, fontWeight: FontWeight.w400)),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: MediaQuery.of(context).size.width - 32,
|
||||
height: 0.4,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.black.withValues(alpha: 0.2),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
decoration: BoxDecoration(color: Colors.black.withValues(alpha: 0.2), borderRadius: BorderRadius.circular(16)),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
Container(
|
||||
@@ -370,22 +262,13 @@ class _BlogPostScreenState extends State<BlogPostScreen> {
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
widget.blogPost.totalComments.toString() + ' КОММЕНТАРИЕВ',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: appTheme.gray500,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
style: TextStyle(fontSize: 12, color: appTheme.gray500, fontWeight: FontWeight.w400),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
if (state is CommentsStateLoading) const Loader(),
|
||||
if (state is CommentsStateLoaded)
|
||||
CommentsWidget(
|
||||
id: widget.blogPost.id.toString(),
|
||||
commentSourceType: CommentSourceType.blogPost,
|
||||
comment: state.comment,
|
||||
replyId: replyId,
|
||||
),
|
||||
CommentsWidget(id: widget.blogPost.id.toString(), commentSourceType: CommentSourceType.blogPost, comment: state.comment, replyId: replyId),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -401,28 +284,14 @@ class _BlogPostScreenState extends State<BlogPostScreen> {
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
child: Ink(
|
||||
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: backgroundColor ?? appTheme.gray100,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
decoration: BoxDecoration(color: backgroundColor ?? appTheme.gray100, borderRadius: BorderRadius.circular(16)),
|
||||
height: 32,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(
|
||||
icon,
|
||||
size: 20,
|
||||
color: iconColor ?? appTheme.gray600,
|
||||
),
|
||||
Icon(icon, size: 20, color: iconColor ?? appTheme.gray600),
|
||||
if (text != null) SizedBox(width: 8),
|
||||
if (text != null)
|
||||
Text(
|
||||
text,
|
||||
style: TextStyle(
|
||||
color: textColor ?? appTheme.gray600,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
if (text != null) Text(text, style: TextStyle(color: textColor ?? appTheme.gray600, fontWeight: FontWeight.w500)),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,26 +1,155 @@
|
||||
import 'package:eatvio_app/core/app_colors.dart';
|
||||
import 'package:eatvio_app/features/diets/presentation/widgets/author_card.dart';
|
||||
import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart';
|
||||
import 'package:eatvio_app/generated/l10n.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class InfoByOrderScreen extends StatelessWidget {
|
||||
class InfoByOrderScreen extends StatefulWidget {
|
||||
static const name = 'infoByOrderScreen';
|
||||
static const path = '/info-by-order-screen';
|
||||
|
||||
const InfoByOrderScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final s = S.of(context);
|
||||
State<InfoByOrderScreen> createState() => _InfoByOrderScreenState();
|
||||
}
|
||||
|
||||
class _InfoByOrderScreenState extends State<InfoByOrderScreen> {
|
||||
bool _isHelpExpanded = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.scaffoldBackgroundColor,
|
||||
appBar: AppBar(
|
||||
title: Text(s.infoAboutOrder),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.vertical(bottom: Radius.circular(12))),
|
||||
appBar: AppBar(title: Text("Информация о заказе"), leading: IconButton(icon: Icon(Icons.arrow_back), onPressed: () {})),
|
||||
body: ListView(
|
||||
padding: EdgeInsets.all(16.0),
|
||||
children: [
|
||||
_buildProfileSection(),
|
||||
SizedBox(height: 10),
|
||||
_buildOrderStatus(),
|
||||
SizedBox(height: 20),
|
||||
_buildPlanDetails(),
|
||||
SizedBox(height: 20),
|
||||
_buildOptionDetails(),
|
||||
SizedBox(height: 20),
|
||||
_buildOrderProgress(),
|
||||
SizedBox(height: 20),
|
||||
_buildHelpSection(),
|
||||
SizedBox(height: 20),
|
||||
_buildCancelButton(),
|
||||
],
|
||||
),
|
||||
body: AuthorCard(author: Author(authorSlug: 'authorSlug', authorName: 'authorName', authorProfileIcon: '', authorIsMe: false), title: 'asdasd'),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildProfileSection() {
|
||||
return Row(
|
||||
children: [
|
||||
CircleAvatar(
|
||||
radius: 30,
|
||||
backgroundImage: AssetImage('assets/profile.jpg'), // Замените на реальный путь
|
||||
),
|
||||
SizedBox(width: 10),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text("Дмитрий Коваль", style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16)),
|
||||
Text("Консультант 128-й в рейтинге", style: TextStyle(color: Colors.grey)),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildOrderStatus() {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text("Статус заказа", style: TextStyle(fontWeight: FontWeight.bold)),
|
||||
Chip(label: Text("Заказ оплачен", style: TextStyle(color: Colors.white)), backgroundColor: Colors.green),
|
||||
],
|
||||
),
|
||||
Text("Сумма заказа: 2500₽"),
|
||||
Text("Время выполнения плана: 7 дней"),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildPlanDetails() {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text("Название плана", style: TextStyle(fontWeight: FontWeight.bold)),
|
||||
Text("В мире, где технологии становятся все более..."),
|
||||
SizedBox(height: 10),
|
||||
Image.asset('assets/plan_image.jpg', height: 150, fit: BoxFit.cover),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildOptionDetails() {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text("Название опции", style: TextStyle(fontWeight: FontWeight.bold)),
|
||||
Text("Поддержка 24/7"),
|
||||
Text("Составление индивидуальной диеты"),
|
||||
Text("Длинное название опции..."),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildOrderProgress() {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text("Этапы заказа", style: TextStyle(fontWeight: FontWeight.bold)),
|
||||
ListTile(leading: Icon(Icons.check_circle, color: Colors.green), title: Text("Заказ создан")),
|
||||
ListTile(leading: Icon(Icons.check_circle, color: Colors.green), title: Text("Выбрана дата старта")),
|
||||
ListTile(leading: Icon(Icons.check_circle, color: Colors.green), title: Text("Заказ оплачен")),
|
||||
ListTile(leading: Icon(Icons.radio_button_unchecked, color: Colors.grey), title: Text("В процессе")),
|
||||
ListTile(leading: Icon(Icons.radio_button_unchecked, color: Colors.grey), title: Text("Завершен")),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildHelpSection() {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
ListTile(
|
||||
leading: Icon(Icons.help_outline),
|
||||
title: Text("Помощь", style: TextStyle(fontWeight: FontWeight.bold)),
|
||||
trailing: Icon(_isHelpExpanded ? Icons.expand_less : Icons.expand_more),
|
||||
onTap: () {
|
||||
setState(() {
|
||||
_isHelpExpanded = !_isHelpExpanded;
|
||||
});
|
||||
},
|
||||
),
|
||||
if (_isHelpExpanded) ...[
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text("Продавец не отвечает на мои сообщения", style: TextStyle(fontWeight: FontWeight.bold)),
|
||||
Text("Ответ некоторых продавцов может занять больше времени, чем вы ожидали..."),
|
||||
SizedBox(height: 10),
|
||||
Text("Работа, которую сдал продавец, отличалась от описания", style: TextStyle(fontWeight: FontWeight.bold)),
|
||||
Text("У вас есть три дня, чтобы проверить сданную на проверку работу..."),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildCancelButton() {
|
||||
return ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(backgroundColor: Colors.red, padding: EdgeInsets.symmetric(vertical: 15)),
|
||||
onPressed: () {},
|
||||
child: Text("Отменить заказ", style: TextStyle(color: Colors.white)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,8 @@ class CreateRecipeTask implements TestCases {
|
||||
RecipeModel(
|
||||
title: 'Title',
|
||||
state: 'active',
|
||||
activeCookTime: 10,
|
||||
image: null,
|
||||
description: 'desc',
|
||||
type: 'first_meals',
|
||||
servings: 10,
|
||||
|
||||
Reference in New Issue
Block a user