From 2275eee3d7be2716a6430a97dd86bbdfd6c1a00a Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Mon, 21 Apr 2025 11:59:03 +0300 Subject: [PATCH 1/4] feat(feed): #338 --- .../widgets/blog_post_widget.dart | 13 +- .../presentation/widgets/recipes_widget.dart | 11 +- .../widgets/circumference_chart_widget.dart | 148 +++++++++--------- .../widgets/profile_blog_post_widget.dart | 11 +- .../widgets/weight_chart_widget.dart | 112 ++++++------- .../presentation/pages/settings_screen.dart | 38 ++--- 6 files changed, 171 insertions(+), 162 deletions(-) diff --git a/lib/features/feed/presentation/widgets/blog_post_widget.dart b/lib/features/feed/presentation/widgets/blog_post_widget.dart index 089ad1d0..89877270 100644 --- a/lib/features/feed/presentation/widgets/blog_post_widget.dart +++ b/lib/features/feed/presentation/widgets/blog_post_widget.dart @@ -2,13 +2,13 @@ import 'package:cached_network_image/cached_network_image.dart'; import 'package:dismissible_page/dismissible_page.dart'; import 'package:eatvio_app/core/const.dart'; import 'package:eatvio_app/core/enums/complained_content.dart'; +import 'package:eatvio_app/core/theme/theme_helper.dart'; import 'package:eatvio_app/core/utils/date_time_utils.dart'; import 'package:eatvio_app/core/widgets/feed_icon_button.dart'; import 'package:eatvio_app/features/chat/presentation/pages/photo_view_screen.dart'; import 'package:eatvio_app/features/diets/presentation/widgets/more_options.dart'; import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart'; import 'package:eatvio_app/features/feed/presentation/bloc/feed_cubit/feed_cubit.dart'; -import 'package:eatvio_app/core/theme/theme_helper.dart'; import 'package:eatvio_app/features/feed/presentation/bloc/feed_cubit/feed_state.dart'; import 'package:eatvio_app/features/feed/presentation/widgets/subscribe_button_widget.dart'; import 'package:flutter/material.dart'; @@ -179,14 +179,15 @@ class _BlogPostWidgetState extends State { ), ), if (state.feedBlogPostList[widget.index].description.length > 200) - Padding( - padding: const EdgeInsets.symmetric(horizontal: 16), + const Padding( + padding: EdgeInsets.symmetric(horizontal: 12), child: Text( - 'Читать полностью...', + 'Показать ещё', style: TextStyle( height: 1, - color: appTheme.blueA400, - decoration: TextDecoration.underline, + color: Color(0xFF8B8B8B), + fontSize: 14, + fontWeight: FontWeight.w600, ), ), ), diff --git a/lib/features/feed/presentation/widgets/recipes_widget.dart b/lib/features/feed/presentation/widgets/recipes_widget.dart index 30202813..02c05eab 100644 --- a/lib/features/feed/presentation/widgets/recipes_widget.dart +++ b/lib/features/feed/presentation/widgets/recipes_widget.dart @@ -188,14 +188,15 @@ class _RecipesWidgetState extends State { ), ), if (widget.recipe.description.length > 200) - Padding( - padding: const EdgeInsets.symmetric(horizontal: 16), + const Padding( + padding: EdgeInsets.symmetric(horizontal: 12), child: Text( - 'Читать полностью...', + 'Показать ещё', style: TextStyle( height: 1, - color: appTheme.blueA400, - decoration: TextDecoration.underline, + color: Color(0xFF8B8B8B), + fontSize: 14, + fontWeight: FontWeight.w600, ), ), ), diff --git a/lib/features/profile/presentation/widgets/circumference_chart_widget.dart b/lib/features/profile/presentation/widgets/circumference_chart_widget.dart index f4f6e997..99d674e5 100644 --- a/lib/features/profile/presentation/widgets/circumference_chart_widget.dart +++ b/lib/features/profile/presentation/widgets/circumference_chart_widget.dart @@ -194,87 +194,89 @@ class _CircumferenceChartWidgetState extends State { useRootNavigator: true, context: context, builder: (context) { - return Column( - children: [ - Expanded( - child: Row( - children: [ - Expanded( - child: CupertinoPicker( - magnification: 1.22, - squeeze: 1.2, - useMagnifier: true, - scrollController: chestController, - itemExtent: 24, - onSelectedItemChanged: (int value) { - chest = value; - }, - children: [ - for (int i = 20; i < 200; i++) Text('$i'), - ], + return SafeArea( + child: Column( + children: [ + Expanded( + child: Row( + children: [ + Expanded( + child: CupertinoPicker( + magnification: 1.22, + squeeze: 1.2, + useMagnifier: true, + scrollController: chestController, + itemExtent: 24, + onSelectedItemChanged: (int value) { + chest = value; + }, + children: [ + for (int i = 20; i < 200; i++) Text('$i'), + ], + ), ), - ), - Expanded( - child: CupertinoPicker( - magnification: 1.22, - squeeze: 1.2, - useMagnifier: true, - scrollController: waistController, - itemExtent: 24, - onSelectedItemChanged: (int value) { - waist = value; - }, - children: [ - for (int i = 20; i < 200; i++) Text('$i'), - ], + Expanded( + child: CupertinoPicker( + magnification: 1.22, + squeeze: 1.2, + useMagnifier: true, + scrollController: waistController, + itemExtent: 24, + onSelectedItemChanged: (int value) { + waist = value; + }, + children: [ + for (int i = 20; i < 200; i++) Text('$i'), + ], + ), ), - ), - Expanded( - child: CupertinoPicker( - magnification: 1.22, - squeeze: 1.2, - useMagnifier: true, - scrollController: hipController, - itemExtent: 24, - onSelectedItemChanged: (int value) { - hip = value; - }, - children: [ - for (int i = 20; i < 200; i++) Text('$i'), - ], + Expanded( + child: CupertinoPicker( + magnification: 1.22, + squeeze: 1.2, + useMagnifier: true, + scrollController: hipController, + itemExtent: 24, + onSelectedItemChanged: (int value) { + hip = value; + }, + children: [ + for (int i = 20; i < 200; i++) Text('$i'), + ], + ), ), - ), - ], - ), - ), - InkWell( - onTap: () { - widget.profileCubit?.addCircumference( - chestCircumference: chest + 20, - waistCircumference: waist + 20, - hipCircumference: hip + 20, - ); - Navigator.of(context).pop(); - }, - borderRadius: BorderRadius.circular(16), - child: Ink( - width: MediaQuery.of(context).size.width - 32, - padding: const EdgeInsets.all(16), - decoration: BoxDecoration( - color: appTheme.blueA400, - borderRadius: BorderRadius.circular(16), + ], ), - child: const Center( - child: Text( - 'Сохранить', - style: TextStyle( - color: Colors.white, + ), + InkWell( + onTap: () { + widget.profileCubit?.addCircumference( + chestCircumference: chest + 20, + waistCircumference: waist + 20, + hipCircumference: hip + 20, + ); + Navigator.of(context).pop(); + }, + borderRadius: BorderRadius.circular(16), + child: Ink( + width: MediaQuery.of(context).size.width - 32, + padding: const EdgeInsets.all(16), + decoration: BoxDecoration( + color: appTheme.blueA400, + borderRadius: BorderRadius.circular(16), + ), + child: const Center( + child: Text( + 'Сохранить', + style: TextStyle( + color: Colors.white, + ), ), ), ), ), - ), - ], + ], + ), ); }, ); diff --git a/lib/features/profile/presentation/widgets/profile_blog_post_widget.dart b/lib/features/profile/presentation/widgets/profile_blog_post_widget.dart index a180fee6..06bcc85d 100644 --- a/lib/features/profile/presentation/widgets/profile_blog_post_widget.dart +++ b/lib/features/profile/presentation/widgets/profile_blog_post_widget.dart @@ -128,14 +128,15 @@ class _ProfileBlogPostWidgetState extends State { ), ), if (state.blogPosts[widget.index].description.length > 200) - Padding( - padding: const EdgeInsets.symmetric(horizontal: 16), + const Padding( + padding: EdgeInsets.symmetric(horizontal: 12), child: Text( - 'Читать полностью...', + 'Показать ещё', style: TextStyle( height: 1, - color: appTheme.blueA400, - decoration: TextDecoration.underline, + color: Color(0xFF8B8B8B), + fontSize: 14, + fontWeight: FontWeight.w600, ), ), ), diff --git a/lib/features/profile/presentation/widgets/weight_chart_widget.dart b/lib/features/profile/presentation/widgets/weight_chart_widget.dart index 4062bcd2..3084f882 100644 --- a/lib/features/profile/presentation/widgets/weight_chart_widget.dart +++ b/lib/features/profile/presentation/widgets/weight_chart_widget.dart @@ -135,68 +135,70 @@ class _WeightChartWidgetState extends State { useRootNavigator: true, context: context, builder: (context) { - return Column( - children: [ - Expanded( - child: Row( - children: [ - Expanded( - child: CupertinoPicker( - magnification: 1.22, - squeeze: 1.2, - useMagnifier: true, - scrollController: weightKiloController, - itemExtent: 24, - onSelectedItemChanged: (int value) { - weightKilo = value + 20; - }, - children: [ - for (int i = 20; i < 300; i++) Text('$i'), - ], + return SafeArea( + child: Column( + children: [ + Expanded( + child: Row( + children: [ + Expanded( + child: CupertinoPicker( + magnification: 1.22, + squeeze: 1.2, + useMagnifier: true, + scrollController: weightKiloController, + itemExtent: 24, + onSelectedItemChanged: (int value) { + weightKilo = value + 20; + }, + children: [ + for (int i = 20; i < 300; i++) Text('$i'), + ], + ), ), - ), - Expanded( - child: CupertinoPicker( - magnification: 1.22, - squeeze: 1.2, - useMagnifier: true, - scrollController: weightGramsController, - itemExtent: 24, - onSelectedItemChanged: (int value) { - weightGrams = value; - }, - children: [ - for (int i = 0; i < 10; i++) Text('$i'), - ], + Expanded( + child: CupertinoPicker( + magnification: 1.22, + squeeze: 1.2, + useMagnifier: true, + scrollController: weightGramsController, + itemExtent: 24, + onSelectedItemChanged: (int value) { + weightGrams = value; + }, + children: [ + for (int i = 0; i < 10; i++) Text('$i'), + ], + ), ), - ), - ], - ), - ), - InkWell( - onTap: () { - widget.profileCubit?.addWeight(weight: double.parse('$weightKilo.$weightGrams')); - Navigator.of(context).pop(); - }, - borderRadius: BorderRadius.circular(16), - child: Ink( - width: MediaQuery.of(context).size.width - 32, - padding: const EdgeInsets.all(16), - decoration: BoxDecoration( - color: appTheme.blueA400, - borderRadius: BorderRadius.circular(16), + ], ), - child: const Center( - child: Text( - 'Сохранить', - style: TextStyle( - color: Colors.white, + ), + InkWell( + onTap: () { + widget.profileCubit?.addWeight(weight: double.parse('$weightKilo.$weightGrams')); + Navigator.of(context).pop(); + }, + borderRadius: BorderRadius.circular(16), + child: Ink( + width: MediaQuery.of(context).size.width - 32, + padding: const EdgeInsets.all(16), + decoration: BoxDecoration( + color: appTheme.blueA400, + borderRadius: BorderRadius.circular(16), + ), + child: const Center( + child: Text( + 'Сохранить', + style: TextStyle( + color: Colors.white, + ), ), ), ), ), - ), - ], + ], + ), ); }, ); diff --git a/lib/features/settings/presentation/pages/settings_screen.dart b/lib/features/settings/presentation/pages/settings_screen.dart index c7f97d39..18d6a261 100644 --- a/lib/features/settings/presentation/pages/settings_screen.dart +++ b/lib/features/settings/presentation/pages/settings_screen.dart @@ -46,24 +46,26 @@ class _SettingsScreenState extends State { appBar: AppBar( title: const Text('Настройки'), ), - body: SingleChildScrollView( - padding: const EdgeInsets.symmetric(vertical: 16), - physics: const BouncingScrollPhysics(), - child: Column( - children: [ - _additionalInfo(state), - const SizedBox(height: 12), - _notifications(state), - const SizedBox(height: 12), - _aboutEatvio(state), - const SizedBox(height: 12), - if (!state.profile.roles.contains('consultant')) - Padding( - padding: const EdgeInsets.only(bottom: 8), - child: _becomeConsultantButton(state), - ), - _deleteAccountButton(state), - ], + body: SafeArea( + child: SingleChildScrollView( + padding: const EdgeInsets.symmetric(vertical: 16), + physics: const BouncingScrollPhysics(), + child: Column( + children: [ + _additionalInfo(state), + const SizedBox(height: 12), + _notifications(state), + const SizedBox(height: 12), + _aboutEatvio(state), + const SizedBox(height: 12), + if (!state.profile.roles.contains('consultant')) + Padding( + padding: const EdgeInsets.only(bottom: 8), + child: _becomeConsultantButton(state), + ), + _deleteAccountButton(state), + ], + ), ), ), ); From 76b514614a501c6b29f162ba7909f19c782292d0 Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Mon, 21 Apr 2025 12:04:02 +0300 Subject: [PATCH 2/4] feat(feed): #337 --- .../feed/presentation/widgets/blog_post_widget.dart | 8 +++----- lib/features/feed/presentation/widgets/diets_widget.dart | 8 +++----- lib/features/feed/presentation/widgets/plan_widget.dart | 8 +++----- .../feed/presentation/widgets/recipes_widget.dart | 8 +++----- 4 files changed, 12 insertions(+), 20 deletions(-) diff --git a/lib/features/feed/presentation/widgets/blog_post_widget.dart b/lib/features/feed/presentation/widgets/blog_post_widget.dart index 89877270..819d8c62 100644 --- a/lib/features/feed/presentation/widgets/blog_post_widget.dart +++ b/lib/features/feed/presentation/widgets/blog_post_widget.dart @@ -49,11 +49,9 @@ class _BlogPostWidgetState extends State { 'blogPostScreen', extra: state.feedBlogPostList[widget.index], ), - child: Ink( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white, - ), + child: Material( + borderRadius: BorderRadius.circular(12), + color: Colors.white, child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/features/feed/presentation/widgets/diets_widget.dart b/lib/features/feed/presentation/widgets/diets_widget.dart index b5830473..ef406b3b 100644 --- a/lib/features/feed/presentation/widgets/diets_widget.dart +++ b/lib/features/feed/presentation/widgets/diets_widget.dart @@ -45,11 +45,9 @@ class _DietsWidgetState extends State { 'navigateToComments': false, }, ), - child: Ink( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white, - ), + child: Material( + borderRadius: BorderRadius.circular(12), + color: Colors.white, child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/features/feed/presentation/widgets/plan_widget.dart b/lib/features/feed/presentation/widgets/plan_widget.dart index 0f6e135f..56fcd4e5 100644 --- a/lib/features/feed/presentation/widgets/plan_widget.dart +++ b/lib/features/feed/presentation/widgets/plan_widget.dart @@ -49,11 +49,9 @@ class _PlanWidgetState extends State { 'navigateToComments': false, }, ), - child: Ink( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white, - ), + child: Material( + borderRadius: BorderRadius.circular(12), + color: Colors.white, child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/features/feed/presentation/widgets/recipes_widget.dart b/lib/features/feed/presentation/widgets/recipes_widget.dart index 02c05eab..8d51da7c 100644 --- a/lib/features/feed/presentation/widgets/recipes_widget.dart +++ b/lib/features/feed/presentation/widgets/recipes_widget.dart @@ -64,11 +64,9 @@ class _RecipesWidgetState extends State { 'navigateToComments': false, }, ), - child: Ink( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white, - ), + child: Material( + borderRadius: BorderRadius.circular(12), + color: Colors.white, child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, From d49fa29dfb5f7584274fb0fdd9e97757f0f1a980 Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Mon, 21 Apr 2025 12:14:08 +0300 Subject: [PATCH 3/4] feat(finance): #332 --- .../pages/user_finance_screen.dart | 165 ++++++++++++------ 1 file changed, 107 insertions(+), 58 deletions(-) diff --git a/lib/features/my_finance/presentation/pages/user_finance_screen.dart b/lib/features/my_finance/presentation/pages/user_finance_screen.dart index 7d80011d..3eecb395 100644 --- a/lib/features/my_finance/presentation/pages/user_finance_screen.dart +++ b/lib/features/my_finance/presentation/pages/user_finance_screen.dart @@ -1,3 +1,5 @@ +import 'package:collection/collection.dart'; +import 'package:eatvio_app/core/theme/custom_text_style.dart'; import 'package:eatvio_app/core/theme/theme_helper.dart'; import 'package:eatvio_app/core/utils/date_time_utils.dart'; import 'package:eatvio_app/core/widgets/custom_drop_down_button.dart'; @@ -6,16 +8,23 @@ import 'package:eatvio_app/features/my_finance/presentation/pages/card_settings. import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; -class UserFinanceScreen extends StatelessWidget { +class UserFinanceScreen extends StatefulWidget { const UserFinanceScreen({super.key}); + @override + State createState() => _UserFinanceScreenState(); +} + +class _UserFinanceScreenState extends State { + final List periods = ['За всё время', 'За месяц', 'За неделю']; + @override Widget build(BuildContext context) { return Scaffold( backgroundColor: const Color(0xFFF0F2F5), appBar: AppBar( shape: const RoundedRectangleBorder(borderRadius: BorderRadiusDirectional.vertical(bottom: Radius.circular(12))), - title: const Text('История операций'), + title: const Text('Финансы'), centerTitle: true, ), body: SingleChildScrollView( @@ -49,73 +58,113 @@ class UserFinanceScreen extends StatelessWidget { physics: const NeverScrollableScrollPhysics(), child: Column( children: [ - CustomDropDownButton(items: const [], onChanged: (value) {}), + CustomDropDownButton( + items: periods + .mapIndexed( + (index, value) => DropdownMenuItem( + value: periods[index], + child: Text( + periods[index], + style: TextStyles.textMMedium.copyWith(color: appTheme.black), + ), + ), + ) + .toList(), + onChanged: (value) {}, + value: periods.first, + ), const SizedBox(height: 12), ListView.separated( shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), - itemBuilder: - (context, index) => Material( - color: const Color(0xFFF6F6F6), - borderRadius: BorderRadius.circular(20), - child: Padding( - padding: const EdgeInsets.all(12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + itemBuilder: (context, index) => Material( + color: const Color(0xFFF6F6F6), + borderRadius: BorderRadius.circular(20), + child: Padding( + padding: const EdgeInsets.all(12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - testFinanceEntity.consultationsList[index].id, - style: const TextStyle(color: Color(0xFF323F4B), height: 1, fontWeight: FontWeight.w500), - ), - Text( - testFinanceEntity.consultationsList[index].date.format('dd.MM.yyy', 'RU'), - style: const TextStyle(color: Color(0xFF6D6F71), height: 1, fontWeight: FontWeight.w500), - ), - ], + Tooltip( + message: testFinanceEntity.consultationsList[index].id, + triggerMode: TooltipTriggerMode.tap, + textStyle: const TextStyle( + color: Colors.black, + fontSize: 16, + fontWeight: FontWeight.w500, + ), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(4), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha((255 * 0.2).toInt()), + blurRadius: 32, + ) + ], + ), + child: Text( + testFinanceEntity.consultationsList[index].id, + style: const TextStyle(color: Color(0xFF323F4B), height: 1, fontWeight: FontWeight.w500), + ), ), - const SizedBox(height: 8), Text( - testFinanceEntity.consultationsList[index].title, - style: TextStyle(color: appTheme.blueA400, height: 1, fontSize: 18, fontWeight: FontWeight.w600), - ), - const SizedBox(height: 8), - Text( - 'Покупатель: ${testFinanceEntity.consultationsList[index].clientName}', - style: const TextStyle(color: Color(0xFF323F4B), height: 1, fontSize: 14, fontWeight: FontWeight.w500), - ), - const SizedBox(height: 8), - Text( - '${testFinanceEntity.consultationsList[index].planDuration} дней', - style: const TextStyle(color: Color(0xFF323F4B), height: 1, fontSize: 14, fontWeight: FontWeight.w500), - ), - const SizedBox(height: 8), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - '${testFinanceEntity.consultationsList[index].price} ₽', - style: const TextStyle(color: Color(0xFF323F4B), height: 1, fontSize: 18, fontWeight: FontWeight.w600), - ), - Material( - color: const Color(0xFF0BB450).withAlpha(11), - borderRadius: BorderRadius.circular(8), - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4), - child: Text( - testFinanceEntity.consultationsList[index].status.name, - style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w400, color: Color(0xFF0BB450), height: 1), - ), - ), - ), - ], + testFinanceEntity.consultationsList[index].date.format('dd.MM.yyy', 'RU'), + style: const TextStyle(color: Color(0xFF6D6F71), height: 1, fontWeight: FontWeight.w500), ), ], ), - ), + const SizedBox(height: 8), + Text( + testFinanceEntity.consultationsList[index].title, + style: TextStyle(color: appTheme.blueA400, height: 1, fontSize: 18, fontWeight: FontWeight.w600), + ), + const SizedBox(height: 8), + Text( + 'Покупатель: ${testFinanceEntity.consultationsList[index].clientName}', + style: const TextStyle(color: Color(0xFF323F4B), height: 1, fontSize: 14, fontWeight: FontWeight.w500), + ), + const SizedBox(height: 8), + Text( + '${testFinanceEntity.consultationsList[index].planDuration} дней', + style: const TextStyle(color: Color(0xFF323F4B), height: 1, fontSize: 14, fontWeight: FontWeight.w500), + ), + const SizedBox(height: 8), + Container( + height: 1, + width: double.infinity, + decoration: const BoxDecoration( + color: Color(0xFFDEDEDF), + ), + ), + const SizedBox(height: 8), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + '${testFinanceEntity.consultationsList[index].price} ₽', + style: const TextStyle(color: Color(0xFF323F4B), height: 1, fontSize: 18, fontWeight: FontWeight.w600), + ), + Material( + color: const Color(0xFF0BB450).withAlpha(11), + borderRadius: BorderRadius.circular(8), + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4), + child: Text( + testFinanceEntity.consultationsList[index].status.name, + style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w400, color: Color(0xFF0BB450), height: 1), + ), + ), + ), + ], + ), + ], ), + ), + ), separatorBuilder: (context, index) => const SizedBox(height: 12), itemCount: testFinanceEntity.consultationsList.length, ), From 0ead4556b9f0c6947812bd9ad7ca98e78b0712d6 Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Mon, 21 Apr 2025 13:00:23 +0300 Subject: [PATCH 4/4] feat(archiveOfConsultations): #331 --- .../entities/consultations_entity.dart | 2 +- .../pages/consultations_screen.dart | 52 ++++++++++++++++--- .../pages/consultant_finance_screen.dart | 46 ++++++++++++++-- 3 files changed, 88 insertions(+), 12 deletions(-) diff --git a/lib/features/consultations/entities/consultations_entity.dart b/lib/features/consultations/entities/consultations_entity.dart index 8b7ed8dd..d3cbbae5 100644 --- a/lib/features/consultations/entities/consultations_entity.dart +++ b/lib/features/consultations/entities/consultations_entity.dart @@ -51,7 +51,7 @@ List generateTestData() { final List names = ["Иван Петров", "Анна Смирнова", "Дмитрий Соколов", "Елена Козлова", "Алексей Иванов"]; final List plans = ["Похудение", "Набор массы", "Детокс", "Здоровое питание", "Вегетарианство"]; - List testConsultations = List.generate(20, (index) { + List testConsultations = List.generate(6, (index) { DateTime startDate = DateTime.now().subtract(Duration(days: random.nextInt(30))); DateTime endDate = startDate.add(const Duration(days: 30)); diff --git a/lib/features/consultations/presentation/pages/consultations_screen.dart b/lib/features/consultations/presentation/pages/consultations_screen.dart index d5b7bc18..7fd9c773 100644 --- a/lib/features/consultations/presentation/pages/consultations_screen.dart +++ b/lib/features/consultations/presentation/pages/consultations_screen.dart @@ -1,6 +1,8 @@ +import 'package:eatvio_app/core/theme/theme_helper.dart'; import 'package:eatvio_app/features/consultations/entities/consultations_entity.dart'; import 'package:eatvio_app/features/consultations/presentation/widgets/consultation_card_widget.dart'; import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; class ConsultationsScreen extends StatelessWidget { const ConsultationsScreen({super.key}); @@ -18,15 +20,49 @@ class ConsultationsScreen extends StatelessWidget { ), ), ), - body: ListView.separated( - padding: const EdgeInsets.symmetric(vertical: 12), - itemBuilder: (context, index) => ConsultationCardWidget( - consultationsEntity: testData[index], + body: SingleChildScrollView( + child: Column( + children: [ + ListView.separated( + physics: const NeverScrollableScrollPhysics(), + shrinkWrap: true, + padding: const EdgeInsets.symmetric(vertical: 12), + itemBuilder: (context, index) => ConsultationCardWidget( + consultationsEntity: testData[index], + ), + separatorBuilder: (context, index) => const SizedBox( + height: 12, + ), + itemCount: testData.length, + ), + const SizedBox(height: 20), + InkWell( + borderRadius: BorderRadius.circular(20), + onTap: () { + GoRouter.of(context).pushNamed('consultantFinanceScreen'); + }, + child: Ink( + width: MediaQuery.of(context).size.width - 32, + padding: const EdgeInsets.all(16), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(20), + color: appTheme.blueA400, + ), + child: const Center( + child: Text( + 'Архив консультаций', + style: TextStyle( + color: Colors.white, + fontSize: 16, + fontWeight: FontWeight.w600, + ), + ), + ), + ), + ), + const SizedBox(height: 20), + ], ), - separatorBuilder: (context, index) => const SizedBox( - height: 12, - ), - itemCount: testData.length, ), ); } diff --git a/lib/features/my_finance/presentation/pages/consultant_finance_screen.dart b/lib/features/my_finance/presentation/pages/consultant_finance_screen.dart index 39a7cbd7..c079e0a3 100644 --- a/lib/features/my_finance/presentation/pages/consultant_finance_screen.dart +++ b/lib/features/my_finance/presentation/pages/consultant_finance_screen.dart @@ -1,12 +1,22 @@ +import 'package:collection/collection.dart'; +import 'package:eatvio_app/core/theme/custom_text_style.dart'; import 'package:eatvio_app/core/theme/theme_helper.dart'; import 'package:eatvio_app/core/utils/date_time_utils.dart'; import 'package:eatvio_app/core/widgets/custom_drop_down_button.dart'; import 'package:eatvio_app/features/my_finance/entities/consultant_finance_entity.dart'; import 'package:flutter/material.dart'; -class ConsultantFinanceScreen extends StatelessWidget { +class ConsultantFinanceScreen extends StatefulWidget { const ConsultantFinanceScreen({super.key}); + @override + State createState() => _ConsultantFinanceScreenState(); +} + +class _ConsultantFinanceScreenState extends State { + final List periods = ['За всё время', 'За месяц', 'За неделю']; + final List statuses = ['Все консультации', 'Отменён', 'Завершён', 'В процессе']; + @override Widget build(BuildContext context) { return Scaffold( @@ -117,13 +127,35 @@ class ConsultantFinanceScreen extends StatelessWidget { child: Column( children: [ CustomDropDownButton( - items: const [], + items: periods + .mapIndexed( + (index, value) => DropdownMenuItem( + value: periods[index], + child: Text( + periods[index], + style: TextStyles.textMMedium.copyWith(color: appTheme.black), + ), + ), + ) + .toList(), onChanged: (value) {}, + value: periods.first, ), const SizedBox(height: 12), CustomDropDownButton( - items: const [], + items: statuses + .mapIndexed( + (index, value) => DropdownMenuItem( + value: statuses[index], + child: Text( + statuses[index], + style: TextStyles.textMMedium.copyWith(color: appTheme.black), + ), + ), + ) + .toList(), onChanged: (value) {}, + value: statuses.first, ), const SizedBox(height: 12), ListView.separated( @@ -189,6 +221,14 @@ class ConsultantFinanceScreen extends StatelessWidget { ), ), const SizedBox(height: 8), + Container( + height: 1, + width: double.infinity, + decoration: const BoxDecoration( + color: Color(0xFFDEDEDF), + ), + ), + const SizedBox(height: 8), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [