diff --git a/Support/ExportOptions.plist b/Support/ExportOptions.plist index f86bc811..f1ac2646 100644 --- a/Support/ExportOptions.plist +++ b/Support/ExportOptions.plist @@ -16,7 +16,7 @@ signingCertificate Apple Distribution signingStyle - manual + automatic stripSwiftSymbols uploadSymbols diff --git a/lib/core/app_router.dart b/lib/core/app_router.dart index 1e8a78d0..6791b620 100644 --- a/lib/core/app_router.dart +++ b/lib/core/app_router.dart @@ -68,16 +68,8 @@ class AppRouter { name: 'authScreen', builder: (context, state) => const AuthScreen(), routes: [ - GoRoute( - path: 'webView-registration-screen', - name: 'webViewRegistrationScreen', - builder: (context, state) => const WebViewRegistrationScreen(), - ), - GoRoute( - path: 'registration-screen', - name: 'registrationScreen', - builder: (context, state) => const RegistrationScreen(), - ), + GoRoute(path: 'webView-registration-screen', name: 'webViewRegistrationScreen', builder: (context, state) => const WebViewRegistrationScreen()), + GoRoute(path: 'registration-screen', name: 'registrationScreen', builder: (context, state) => const RegistrationScreen()), ], ), ShellRoute( @@ -85,10 +77,7 @@ class AppRouter { return BlocBuilder( builder: (BuildContext context, ProfileAvatarState state) { if (state is ProfileAvatarStateLoaded) { - return BottomNavigationBarWidget( - child: child, - profileModel: state.profile, - ); + return BottomNavigationBarWidget(child: child, profileModel: state.profile); } return SizedBox.shrink(); }, @@ -106,146 +95,76 @@ class AppRouter { return NoTransitionPage(child: ProfileScreen()); }, ), - GoRoute( - path: '/feed-screen', - name: 'feedScreen', - pageBuilder: (context, state) => NoTransitionPage(child: FeedScreen()), - ), - GoRoute( - path: '/diary-screen', - name: 'diaryScreen', - pageBuilder: (context, state) => NoTransitionPage(child: DiaryScreen()), - ), - GoRoute( - path: '/consultations-screen', - name: 'consultationsScreen', - pageBuilder: (context, state) => NoTransitionPage(child: ConsultationsScreen()), - ), - GoRoute( - path: '/chat-select-screen', - name: 'chatSelectScreen', - pageBuilder: (context, state) => NoTransitionPage(child: ChatsScreen()), - ), - GoRoute( - path: '/notifications-screen', - name: 'notificationsScreen', - pageBuilder: (context, state) => NoTransitionPage(child: NotificationsScreen()), - ), + GoRoute(path: '/feed-screen', name: 'feedScreen', pageBuilder: (context, state) => NoTransitionPage(child: FeedScreen())), + GoRoute(path: '/diary-screen', name: 'diaryScreen', pageBuilder: (context, state) => NoTransitionPage(child: DiaryScreen())), + GoRoute(path: '/consultations-screen', name: 'consultationsScreen', pageBuilder: (context, state) => NoTransitionPage(child: ConsultationsScreen())), + GoRoute(path: '/chat-select-screen', name: 'chatSelectScreen', pageBuilder: (context, state) => NoTransitionPage(child: ChatsScreen())), + GoRoute(path: '/notifications-screen', name: 'notificationsScreen', pageBuilder: (context, state) => NoTransitionPage(child: NotificationsScreen())), GoRoute( path: '/menu-screen', name: 'menuScreen', - pageBuilder: (context, state) => NoTransitionPage( - child: BlocBuilder( - builder: (BuildContext context, ProfileAvatarState state) { - if (state is ProfileAvatarStateLoaded) { - return MenuScreen(profileModel: state.profile); - } - return SizedBox.shrink(); - }, - ), - ), + pageBuilder: + (context, state) => NoTransitionPage( + child: BlocBuilder( + builder: (BuildContext context, ProfileAvatarState state) { + if (state is ProfileAvatarStateLoaded) { + return MenuScreen(profileModel: state.profile); + } + return SizedBox.shrink(); + }, + ), + ), ), ], ), - GoRoute( - path: '/consultant-finance-screen', - name: 'consultantFinanceScreen', - builder: (context, state) => ConsultantFinanceScreen(), - ), - GoRoute( - path: '/user-finance-screen', - name: 'userFinanceScreen', - builder: (context, state) => UserFinanceScreen(), - ), - GoRoute( - path: '/card-settings-screen', - name: 'cardSettingsScreen', - builder: (context, state) => CardSettingsScreen(), - ), + GoRoute(path: '/consultant-finance-screen', name: 'consultantFinanceScreen', builder: (context, state) => ConsultantFinanceScreen()), + GoRoute(path: '/user-finance-screen', name: 'userFinanceScreen', builder: (context, state) => UserFinanceScreen()), + GoRoute(path: '/card-settings-screen', name: 'cardSettingsScreen', builder: (context, state) => CardSettingsScreen()), GoRoute( path: '/about-plan-screen', name: 'aboutPlanScreen', builder: (context, state) { final data = state.extra as Map; - return AboutPlanScreen( - plan: data['plan'] as PlanModel, - index: data['index'] as int?, - navigateToComments: data['navigateToComments'] as bool, - ); + return AboutPlanScreen(plan: data['plan'] as PlanModel, index: data['index'] as int?, navigateToComments: data['navigateToComments'] as bool); }, ), - GoRoute( - path: '/glossary-screen', - name: 'glossaryScreen', - builder: (context, state) => GlossaryScreen(), - ), + GoRoute(path: '/glossary-screen', name: 'glossaryScreen', builder: (context, state) => GlossaryScreen()), GoRoute( path: '/about-recipes-screen', name: 'aboutRecipesScreen', builder: (context, state) { final data = state.extra as Map; - return AboutRecipeScreen( - recipe: data['recipe'] as Recipe, - index: data['index'] as int?, - navigateToComments: data['navigateToComments'] as bool, - ); + return AboutRecipeScreen(recipe: data['recipe'] as Recipe, index: data['index'] as int?, navigateToComments: data['navigateToComments'] as bool); }, ), - GoRoute( - path: RecipeCreateScreen.path, - name: RecipeCreateScreen.name, - builder: (context, state) => RecipeCreateScreen(), - ), - GoRoute( - path: '/profile-screen', - name: 'profileScreen', - builder: (context, state) => ProfileScreen( - author: state.extra as Author, - ), - ), + GoRoute(path: RecipeCreateScreen.path, name: RecipeCreateScreen.name, builder: (context, state) => RecipeCreateScreen()), + GoRoute(path: '/profile-screen', name: 'profileScreen', builder: (context, state) => ProfileScreen(author: state.extra as Author)), GoRoute( path: '/subs-screen/:slug', name: 'subsScreen', - builder: (context, state) => SubsScreen( - slug: state.pathParameters['slug']!, - subType: state.extra as SubType, - ), + builder: (context, state) => SubsScreen(slug: state.pathParameters['slug']!, subType: state.extra as SubType), ), GoRoute( path: '/about-diet-screen', name: 'aboutDietScreen', builder: (context, state) { final data = state.extra as Map; - return AboutDietScreen( - diet: data['diet'] as Diet, - index: data['index'] as int?, - navigateToComments: data['navigateToComments'] as bool, - ); + return AboutDietScreen(diet: data['diet'] as Diet, index: data['index'] as int?, navigateToComments: data['navigateToComments'] as bool); }, ), GoRoute( path: '/blog-post-create-screen', name: 'blogPostCreateScreen', - builder: (context, state) => BlogPostCreateScreen( - feedBlogPostModel: state.extra != null ? state.extra as FeedBlogPostModel : null, - ), - ), - GoRoute( - path: '/blog-post-screen', - name: 'blogPostScreen', - builder: (context, state) => BlogPostScreen( - blogPost: state.extra as FeedBlogPostModel, - ), + builder: (context, state) => BlogPostCreateScreen(feedBlogPostModel: state.extra != null ? state.extra as FeedBlogPostModel : null), ), + GoRoute(path: '/blog-post-screen', name: 'blogPostScreen', builder: (context, state) => BlogPostScreen(blogPost: state.extra as FeedBlogPostModel)), GoRoute( path: '/chat-screen', name: 'chatScreen', builder: (context, state) { - final data = state.extra as Map; + final data = state.extra as Map; final chatId = data['chatId'] as String; - return ChatScreen( - chatId: chatId, - ); + return ChatScreen(chatId: chatId); }, ), GoRoute( @@ -256,81 +175,44 @@ class AppRouter { GoRoute( path: 'general-info-screen', name: 'generalInfoScreen', - builder: (context, state) => GeneralInfoScreen( - settingsEntity: state.extra as SettingsEntity, - ), + builder: (context, state) => GeneralInfoScreen(settingsEntity: state.extra as SettingsEntity), ), GoRoute( path: 'other-info-screen', name: 'otherInfoScreen', - builder: (context, state) => OtherInfoScreen( - settingsEntity: state.extra as SettingsEntity, - ), + builder: (context, state) => OtherInfoScreen(settingsEntity: state.extra as SettingsEntity), ), GoRoute( path: 'physical-activity-screen', name: 'physicalActivityScreen', - builder: (context, state) => PhysicalActivityScreen( - settingsEntity: state.extra as SettingsEntity, - ), + builder: (context, state) => PhysicalActivityScreen(settingsEntity: state.extra as SettingsEntity), ), GoRoute( path: 'physical-form-screen', name: 'physicalFormScreen', - builder: (context, state) => PhysicalFormScreen( - settingsEntity: state.extra as SettingsEntity, - ), - ), - GoRoute( - path: 'pressure-screen', - name: 'pressureScreen', - builder: (context, state) => PressureScreen( - settingsEntity: state.extra as SettingsEntity, - ), + builder: (context, state) => PhysicalFormScreen(settingsEntity: state.extra as SettingsEntity), ), + GoRoute(path: 'pressure-screen', name: 'pressureScreen', builder: (context, state) => PressureScreen(settingsEntity: state.extra as SettingsEntity)), GoRoute( path: 'change-password-screen', name: 'changePasswordScreen', - builder: (context, state) => ChangePasswordScreen( - settingsEntity: state.extra as SettingsEntity, - ), + builder: (context, state) => ChangePasswordScreen(settingsEntity: state.extra as SettingsEntity), ), GoRoute( path: 'change-email-screen', name: 'changeEmailScreen', - builder: (context, state) => ChangeEmailScreen( - settingsEntity: state.extra as SettingsEntity, - ), + builder: (context, state) => ChangeEmailScreen(settingsEntity: state.extra as SettingsEntity), ), ], ), - GoRoute( - path: '/become-consultant-screen', - name: 'becomeConsultantScreen', - builder: (context, state) => BecomeConsultantScreen(), - ), - GoRoute( - path: '/stepper-become-consultant-screen', - name: 'stepperBecomeConsultantScreen', - builder: (context, state) => StepperBecomeConsultantScreen(), - ), - GoRoute( - path: '/calendar-screen', - name: 'calendarScreen', - builder: (context, state) => CalendarScreen(), - ), - GoRoute( - path: '/support-screen', - name: 'supportScreen', - builder: (context, state) => SupportScreen(), - ), + GoRoute(path: '/become-consultant-screen', name: 'becomeConsultantScreen', builder: (context, state) => BecomeConsultantScreen()), + GoRoute(path: '/stepper-become-consultant-screen', name: 'stepperBecomeConsultantScreen', builder: (context, state) => StepperBecomeConsultantScreen()), + GoRoute(path: '/calendar-screen', name: 'calendarScreen', builder: (context, state) => CalendarScreen()), + GoRoute(path: '/support-screen', name: 'supportScreen', builder: (context, state) => SupportScreen()), GoRoute( path: '/photo-view-screen/:index', name: 'photoViewScreen', - builder: (context, state) => PhotoViewScreen( - imageUrls: state.extra as List, - index: int.parse(state.pathParameters['index']!), - ), + builder: (context, state) => PhotoViewScreen(imageUrls: state.extra as List, index: int.parse(state.pathParameters['index']!)), ), GoRoute( path: CreateDietScreen.path, @@ -345,48 +227,16 @@ class AppRouter { name: DietPreviewScreen.name, builder: (context, state) { final data = state.extra as Diet; - return DietPreviewScreen( - diet: data, - ); + return DietPreviewScreen(diet: data); }, ), - GoRoute( - path: CreatePlanScreen.path, - name: CreatePlanScreen.name, - builder: (context, state) => CreatePlanScreen(), - ), - GoRoute( - path: MyDietsScreen.path, - name: MyDietsScreen.name, - builder: (context, state) => MyDietsScreen(), - ), - GoRoute( - path: MyPlansScreen.path, - name: MyPlansScreen.name, - builder: (context, state) => MyPlansScreen(), - ), - GoRoute( - path: UserDetailsScreen.path, - name: UserDetailsScreen.name, - builder: (context, state) => UserDetailsScreen( - slug: state.extra as String, - ), - ), - GoRoute( - path: DevToolsScreen.path, - name: DevToolsScreen.name, - builder: (context, state) => DevToolsScreen(), - ), - GoRoute( - path: ConsultantRatingScreen.path, - name: ConsultantRatingScreen.name, - builder: (context, state) => ConsultantRatingScreen(), - ), - GoRoute( - path: InfoByOrderScreen.path, - name: InfoByOrderScreen.name, - builder: (context, state) => InfoByOrderScreen(), - ), + GoRoute(path: CreatePlanScreen.path, name: CreatePlanScreen.name, builder: (context, state) => CreatePlanScreen()), + GoRoute(path: MyDietsScreen.path, name: MyDietsScreen.name, builder: (context, state) => MyDietsScreen()), + GoRoute(path: MyPlansScreen.path, name: MyPlansScreen.name, builder: (context, state) => MyPlansScreen()), + GoRoute(path: UserDetailsScreen.path, name: UserDetailsScreen.name, builder: (context, state) => UserDetailsScreen(slug: state.extra as String)), + GoRoute(path: DevToolsScreen.path, name: DevToolsScreen.name, builder: (context, state) => DevToolsScreen()), + GoRoute(path: ConsultantRatingScreen.path, name: ConsultantRatingScreen.name, builder: (context, state) => ConsultantRatingScreen()), + GoRoute(path: InfoByOrderScreen.path, name: InfoByOrderScreen.name, builder: (context, state) => InfoByOrderScreen()), ], ); } diff --git a/lib/features/blog_post/presentation/pages/blog_post_screen.dart b/lib/features/blog_post/presentation/pages/blog_post_screen.dart index 637a2a56..09d0d9f5 100644 --- a/lib/features/blog_post/presentation/pages/blog_post_screen.dart +++ b/lib/features/blog_post/presentation/pages/blog_post_screen.dart @@ -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 createState() => _BlogPostScreenState(); @@ -50,12 +47,7 @@ class _BlogPostScreenState extends State { @override Widget build(BuildContext context) { return BlocProvider( - 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( listener: (BuildContext context, CommentsState state) { if (state is CommentsStateLoaded) { @@ -69,14 +61,7 @@ class _BlogPostScreenState extends State { 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 { 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 { 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 { } }, 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 { 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 { 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 { 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 { 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 { 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 { 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)), ], ), ), diff --git a/lib/features/consultations/presentation/pages/info_by_order_screen.dart b/lib/features/consultations/presentation/pages/info_by_order_screen.dart index ad4e48ca..a64879c8 100644 --- a/lib/features/consultations/presentation/pages/info_by_order_screen.dart +++ b/lib/features/consultations/presentation/pages/info_by_order_screen.dart @@ -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 createState() => _InfoByOrderScreenState(); +} +class _InfoByOrderScreenState extends State { + 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)), ); } }