feat(order info): added order info screen

This commit is contained in:
Username1548
2025-04-04 20:21:31 +07:00
parent 9715f4cac9
commit 748484cf8f
387 changed files with 16171 additions and 18199 deletions

View File

@@ -22,8 +22,9 @@ class BlogPostCreateScreen extends StatefulWidget {
final FeedBlogPostModel? feedBlogPostModel;
const BlogPostCreateScreen({
super.key,
this.feedBlogPostModel,
}) : super();
});
@override
State<BlogPostCreateScreen> createState() => _BlogPostCreateScreenState();
@@ -61,6 +62,7 @@ class _BlogPostCreateScreenState extends State<BlogPostCreateScreen> {
super.dispose();
}
@override
Widget build(BuildContext context) {
return BlocProvider<BlogPostCreateCubit>(
create: (BuildContext context) => blogPostCubit,
@@ -70,7 +72,7 @@ class _BlogPostCreateScreenState extends State<BlogPostCreateScreen> {
context.read<FeedCubit>().loadFeedBlogPostList();
}
},
child: _buildBlogPostCreate(),
child: _buildBlogPostCreate(context),
),
);
}
@@ -85,10 +87,11 @@ class _BlogPostCreateScreenState extends State<BlogPostCreateScreen> {
final picker = ImagePicker();
image = await picker.pickImage(source: ImageSource.camera);
setState(() {});
if (!context.mounted) return;
Navigator.of(context).pop();
},
child: const Row(
children: const [
children: [
Icon(Icons.photo_camera),
SizedBox(width: 8),
Text('Фото'),
@@ -100,10 +103,11 @@ class _BlogPostCreateScreenState extends State<BlogPostCreateScreen> {
final picker = ImagePicker();
image = await picker.pickImage(source: ImageSource.gallery);
setState(() {});
if (!context.mounted) return;
Navigator.of(context).pop();
},
child: const Row(
children: const [
children: [
Icon(Icons.photo),
SizedBox(width: 8),
Text('Галерея'),
@@ -120,7 +124,7 @@ class _BlogPostCreateScreenState extends State<BlogPostCreateScreen> {
);
}
_buildBlogPostCreate() {
_buildBlogPostCreate(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: true,
appBar: AppBar(),
@@ -137,8 +141,8 @@ class _BlogPostCreateScreenState extends State<BlogPostCreateScreen> {
),
backgroundColor: appTheme.blueA400,
label: isLoading
? CircularProgressIndicator()
: Text(
? const CircularProgressIndicator()
: const Text(
'Создать',
style: TextStyle(
color: Colors.white,
@@ -164,8 +168,10 @@ class _BlogPostCreateScreenState extends State<BlogPostCreateScreen> {
isLoading = false;
});
if (!result) {
if (!context.mounted) return;
showErrorDialog(context, title: S.current.could_not_update_blog_post);
} else {
if (!context.mounted) return;
context.pop();
}
} else {
@@ -179,8 +185,10 @@ class _BlogPostCreateScreenState extends State<BlogPostCreateScreen> {
isLoading = false;
});
if (!result) {
if (!context.mounted) return;
showErrorDialog(context, title: S.current.could_not_publish_blog_post);
} else {
if (!context.mounted) return;
context.pop();
}
}
@@ -188,36 +196,36 @@ class _BlogPostCreateScreenState extends State<BlogPostCreateScreen> {
),
),
body: SingleChildScrollView(
padding: EdgeInsets.all(16),
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(height: 16),
Text('Заголовок'),
SizedBox(height: 8),
const SizedBox(height: 16),
const Text('Заголовок'),
const SizedBox(height: 8),
CustomTextFormField(
controller: titleController,
),
SizedBox(height: 16),
Text('Описание'),
SizedBox(height: 8),
const SizedBox(height: 16),
const Text('Описание'),
const SizedBox(height: 8),
CustomTextFormField(
controller: descriptionController,
maxLines: 6,
minLines: 4,
),
SizedBox(height: 16),
if (videoUrlController.text.isEmpty) Text('Изображение поста'),
if (videoUrlController.text.isEmpty) SizedBox(height: 8),
const SizedBox(height: 16),
if (videoUrlController.text.isEmpty) const Text('Изображение поста'),
if (videoUrlController.text.isEmpty) const SizedBox(height: 8),
if (videoUrlController.text.isEmpty) _buildAddPhoto(),
SizedBox(height: 16),
if (image == null && widget.feedBlogPostModel?.image == null) Text('Ссылка на видео'),
if (image == null && widget.feedBlogPostModel?.image == null) SizedBox(height: 8),
const SizedBox(height: 16),
if (image == null && widget.feedBlogPostModel?.image == null) const Text('Ссылка на видео'),
if (image == null && widget.feedBlogPostModel?.image == null) const SizedBox(height: 8),
if (image == null && widget.feedBlogPostModel?.image == null)
CustomTextFormField(
controller: videoUrlController,
),
SizedBox(height: 80),
const SizedBox(height: 80),
],
),
),
@@ -235,7 +243,7 @@ class _BlogPostCreateScreenState extends State<BlogPostCreateScreen> {
AnimatedContainer(
height: shrinkImage ? 52 : 128,
curve: Curves.easeIn,
duration: Duration(milliseconds: 150),
duration: const Duration(milliseconds: 150),
decoration: AppDecoration.fillGray.copyWith(
borderRadius: BorderRadius.circular(16),
),
@@ -247,7 +255,7 @@ class _BlogPostCreateScreenState extends State<BlogPostCreateScreen> {
Icons.photo_library,
color: appTheme.blueGray300,
),
SizedBox(width: 8),
const SizedBox(width: 8),
Text(
"Добавить фото",
selectionColor: appTheme.blueA400,
@@ -256,7 +264,7 @@ class _BlogPostCreateScreenState extends State<BlogPostCreateScreen> {
),
),
if (image != null)
Container(
SizedBox(
width: shrinkImage ? 52 : MediaQuery.of(context).size.width - 32,
child: ClipRRect(
borderRadius: BorderRadius.circular(16),
@@ -270,12 +278,12 @@ class _BlogPostCreateScreenState extends State<BlogPostCreateScreen> {
),
),
if (widget.feedBlogPostModel?.image != null && image == null)
Container(
SizedBox(
width: shrinkImage ? 52 : MediaQuery.of(context).size.width - 32,
child: ClipRRect(
borderRadius: BorderRadius.circular(16),
child: Image(
image: NetworkImage(baseUrl + '/storage/' + widget.feedBlogPostModel!.image),
image: NetworkImage('$baseUrl/storage/${widget.feedBlogPostModel!.image}'),
),
),
),