From 039c09962ab441354dce2636fbc6d31074611447 Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Mon, 4 Aug 2025 12:40:21 +0300 Subject: [PATCH] fix: env --- .gitignore | 1 + .../widgets/consultation_card_widget.dart | 209 ++++++---------- .../presentation/pages/support_screen.dart | 1 - .../cubit/user_details_cubit.dart | 16 +- .../presentation/user_details_screen.dart | 224 ++++-------------- lib/main.dart | 6 + pubspec.yaml | 1 + 7 files changed, 128 insertions(+), 330 deletions(-) diff --git a/.gitignore b/.gitignore index 9d5ba6c3..b448cede 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ android/build/ ios/XCBuildData/ .env +env.example diff --git a/lib/features/consultations/presentation/widgets/consultation_card_widget.dart b/lib/features/consultations/presentation/widgets/consultation_card_widget.dart index 04a0b7fb..efebd74f 100644 --- a/lib/features/consultations/presentation/widgets/consultation_card_widget.dart +++ b/lib/features/consultations/presentation/widgets/consultation_card_widget.dart @@ -14,10 +14,7 @@ import 'package:go_router/go_router.dart'; class ConsultationCardWidget extends StatefulWidget { final ConsultationModel consultationsModel; - const ConsultationCardWidget({ - super.key, - required this.consultationsModel, - }); + const ConsultationCardWidget({super.key, required this.consultationsModel}); @override State createState() => _ConsultationCardWidgetState(); @@ -32,13 +29,7 @@ class _ConsultationCardWidgetState extends State { 'Дневник заполнен, прокомментирован консультантом и после этого клиент просмотрел комментарии.', ]; - final List legendColors = const [ - Colors.white, - Color(0xFFF0C497), - Color(0xFFFF9500), - Color(0xFF2F80ED), - Color(0xFF4CD964), - ]; + final List legendColors = const [Colors.white, Color(0xFFF0C497), Color(0xFFFF9500), Color(0xFF2F80ED), Color(0xFF4CD964)]; late final List<(int, DiaryModel)> givenDaysWithDayNumber; final List> legendStates = [ @@ -46,7 +37,7 @@ class _ConsultationCardWidgetState extends State { [DiaryStateEnum.started, DiaryStateEnum.lastDayStarted], [DiaryStateEnum.finished, DiaryStateEnum.lastDayFinished], [DiaryStateEnum.commented, DiaryStateEnum.lastDayCommented], - [DiaryStateEnum.reviewedByUser] + [DiaryStateEnum.reviewedByUser], ]; @override void initState() { @@ -72,32 +63,19 @@ class _ConsultationCardWidgetState extends State { children: [ Row( children: [ - CircleAvatar( - radius: 30, - backgroundImage: NetworkImage(baseUrl + widget.consultationsModel.userProfilePhotoUrl), - ), + CircleAvatar(radius: 30, backgroundImage: NetworkImage(baseUrl + widget.consultationsModel.userProfilePhotoUrl)), const SizedBox(width: 12), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( widget.consultationsModel.userName, - style: const TextStyle( - height: 1, - color: Color(0xFF323F4B), - fontSize: 16, - fontWeight: FontWeight.w600, - ), + style: const TextStyle(height: 1, color: Color(0xFF323F4B), fontSize: 16, fontWeight: FontWeight.w600), ), const SizedBox(height: 4), Text( widget.consultationsModel.planTitle, - style: const TextStyle( - height: 1, - color: Color(0xFF88949F), - fontSize: 14, - fontWeight: FontWeight.w500, - ), + style: const TextStyle(height: 1, color: Color(0xFF88949F), fontSize: 14, fontWeight: FontWeight.w500), ), ], ), @@ -127,12 +105,7 @@ class _ConsultationCardWidgetState extends State { children: [ Text( 'День ${widget.consultationsModel.currentDiaryDay} из ${widget.consultationsModel.duration}', - style: const TextStyle( - height: 1, - color: Color(0xFF323F4B), - fontSize: 16, - fontWeight: FontWeight.w500, - ), + style: const TextStyle(height: 1, color: Color(0xFF323F4B), fontSize: 16, fontWeight: FontWeight.w500), ), GestureDetector( onTap: () { @@ -149,12 +122,7 @@ class _ConsultationCardWidgetState extends State { children: [ const Text( 'Легенда', - style: TextStyle( - height: 1, - fontSize: 20, - fontWeight: FontWeight.w700, - color: Color(0xFF323F4B), - ), + style: TextStyle(height: 1, fontSize: 20, fontWeight: FontWeight.w700, color: Color(0xFF323F4B)), ), const SizedBox(height: 16), ListView.separated( @@ -170,11 +138,7 @@ class _ConsultationCardWidgetState extends State { ), ); }, - child: const Icon( - Icons.help_outline_rounded, - color: Color(0xFF323F4B), - size: 20, - ), + child: const Icon(Icons.help_outline_rounded, color: Color(0xFF323F4B), size: 20), ), ], ), @@ -185,7 +149,8 @@ class _ConsultationCardWidgetState extends State { children: List.generate(widget.consultationsModel.duration, (index) { final day = givenDaysWithDayNumber.firstWhereOrNull((e) => e.$1 == index); final hasActivity = day != null && day.$2.state != DiaryStateEnum.init; - final canConsultantOpenThisDay = day != null && + final canConsultantOpenThisDay = + day != null && (day.$2.state != DiaryStateEnum.init && day.$2.state != DiaryStateEnum.started && day.$2.state != DiaryStateEnum.lastDayStarted); return Padding( padding: const EdgeInsets.only(right: 12), @@ -195,81 +160,74 @@ class _ConsultationCardWidgetState extends State { InkWell( onTap: () { if (!hasActivity || !canConsultantOpenThisDay) { - showErrorDialog(context, - title: s.you_can_not_open_this_day, description: '${widget.consultationsModel.userName} ${s.has_not_filled_it_yet}'); + showErrorDialog( + context, + title: s.you_can_not_open_this_day, + description: '${widget.consultationsModel.userName} ${s.has_not_filled_it_yet}', + ); return; } - GoRouter.of(context).push(UserDiaryScreen.path, extra: { - 'diaryId': day.$2.id, - 'currentDiaryDay': index + 1, - }); + GoRouter.of(context).push(UserDiaryScreen.path, extra: {'diaryId': day.$2.id, 'currentDiaryDay': index + 1}); }, borderRadius: BorderRadius.circular(100), child: Ink( decoration: BoxDecoration( - color: hasActivity ? appTheme.dividerColor : appTheme.dividerColor.withValues(alpha: 0.4), - borderRadius: BorderRadius.circular(100)), + color: hasActivity ? appTheme.dividerColor : appTheme.dividerColor.withValues(alpha: 0.4), + borderRadius: BorderRadius.circular(100), + ), width: 58, height: 32, child: Center( child: Text( (index + 1).toString(), - style: TextStyles.textMSemibold.copyWith( - color: hasActivity ? appTheme.gray : appTheme.gray.withValues(alpha: 0.4), - ), + style: TextStyles.textMSemibold.copyWith(color: hasActivity ? appTheme.gray : appTheme.gray.withValues(alpha: 0.4)), ), ), ), ), if (hasActivity) ...[ - const SizedBox( - height: 4, - ), + const SizedBox(height: 4), switch (day.$2.state) { DiaryStateEnum.init => const SizedBox.shrink(), DiaryStateEnum.started => Container( - width: 8, - height: 8, - decoration: BoxDecoration(shape: BoxShape.circle, color: legendColors[1]), - ), + width: 8, + height: 8, + decoration: BoxDecoration(shape: BoxShape.circle, color: legendColors[1]), + ), DiaryStateEnum.lastDayStarted => Container( - width: 8, - height: 8, - decoration: BoxDecoration(shape: BoxShape.circle, color: legendColors[1]), - ), + width: 8, + height: 8, + decoration: BoxDecoration(shape: BoxShape.circle, color: legendColors[1]), + ), DiaryStateEnum.finished => Container( - width: 8, - height: 8, - decoration: BoxDecoration(shape: BoxShape.circle, color: legendColors[2]), - ), + width: 8, + height: 8, + decoration: BoxDecoration(shape: BoxShape.circle, color: legendColors[2]), + ), DiaryStateEnum.lastDayFinished => Container( - width: 8, - height: 8, - decoration: BoxDecoration(shape: BoxShape.circle, color: legendColors[2]), - ), + width: 8, + height: 8, + decoration: BoxDecoration(shape: BoxShape.circle, color: legendColors[2]), + ), DiaryStateEnum.commented => Container( - width: 8, - height: 8, - decoration: BoxDecoration(shape: BoxShape.circle, color: legendColors[3]), - ), + width: 8, + height: 8, + decoration: BoxDecoration(shape: BoxShape.circle, color: legendColors[3]), + ), DiaryStateEnum.lastDayCommented => Container( - width: 8, - height: 8, - decoration: BoxDecoration(shape: BoxShape.circle, color: legendColors[3]), - ), + width: 8, + height: 8, + decoration: BoxDecoration(shape: BoxShape.circle, color: legendColors[3]), + ), DiaryStateEnum.reviewedByUser => Container( - width: 8, - height: 8, - decoration: BoxDecoration(shape: BoxShape.circle, color: legendColors[4]), - ), + width: 8, + height: 8, + decoration: BoxDecoration(shape: BoxShape.circle, color: legendColors[4]), + ), }, - const SizedBox( - height: 12, - ), + const SizedBox(height: 12), ] else - const SizedBox( - height: 24, - ), + const SizedBox(height: 24), ], ), ); @@ -280,11 +238,7 @@ class _ConsultationCardWidgetState extends State { const SizedBox(height: 12), Text( '${widget.consultationsModel.consultationOptionPrice.toStringAsFixed(0)} ₽', - style: const TextStyle( - color: Color(0xFF019A3E), - fontSize: 20, - fontWeight: FontWeight.w600, - ), + style: const TextStyle(color: Color(0xFF019A3E), fontSize: 20, fontWeight: FontWeight.w600), ), const SizedBox(height: 16), Row( @@ -292,36 +246,33 @@ class _ConsultationCardWidgetState extends State { InkWell( borderRadius: BorderRadius.circular(20), onTap: () { + print(givenDaysWithDayNumber); + print(DiaryStateEnum.finished); + print(DiaryStateEnum.lastDayFinished); + print(DiaryStateEnum.commented); + print(DiaryStateEnum.lastDayCommented); + print(DiaryStateEnum.reviewedByUser); final lastActiveDay = givenDaysWithDayNumber - .where( - (e) => e.$2.state == DiaryStateEnum.finished || e.$2.state == DiaryStateEnum.lastDayFinished, - ) + .where((e) => e.$2.state == DiaryStateEnum.finished || e.$2.state == DiaryStateEnum.lastDayFinished) .lastOrNull; if (lastActiveDay != null) { - GoRouter.of(context).push(UserDiaryScreen.path, extra: { - 'diaryId': lastActiveDay.$2.id, - 'currentDiaryDay': lastActiveDay.$1, - }); + GoRouter.of(context).push(UserDiaryScreen.path, extra: {'diaryId': lastActiveDay.$2.id, 'currentDiaryDay': lastActiveDay.$1}); return; } - showErrorDialog(context, - title: s.you_can_not_open_this_day, description: '${widget.consultationsModel.userName} ${s.has_not_filled_it_yet}'); + showErrorDialog( + context, + title: s.you_can_not_open_this_day, + description: '${widget.consultationsModel.userName} ${s.has_not_filled_it_yet}', + ); }, child: Ink( width: MediaQuery.of(context).size.width - 32 - 52 - 8, padding: const EdgeInsets.all(16), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(20), - color: appTheme.blueA400, - ), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(20), color: appTheme.blueA400), child: const Center( child: Text( 'Комментировать отчёт', - style: TextStyle( - color: Colors.white, - fontSize: 16, - fontWeight: FontWeight.w600, - ), + style: TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.w600), ), ), ), @@ -333,16 +284,8 @@ class _ConsultationCardWidgetState extends State { child: Ink( height: 52, width: 52, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(20), - color: const Color(0xFFF6F6F6), - ), - child: const Center( - child: Icon( - Icons.chat_outlined, - size: 24, - ), - ), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(20), color: const Color(0xFFF6F6F6)), + child: const Center(child: Icon(Icons.chat_outlined, size: 24)), ), ), ], @@ -360,21 +303,13 @@ class _ConsultationCardWidgetState extends State { Container( height: 20, width: 20, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: color, - ), + decoration: BoxDecoration(shape: BoxShape.circle, color: color), ), const SizedBox(width: 12), Flexible( child: Text( text, - style: const TextStyle( - height: 1, - fontSize: 16, - fontWeight: FontWeight.w500, - color: Color(0xFF323F4B), - ), + style: const TextStyle(height: 1, fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xFF323F4B)), ), ), ], diff --git a/lib/features/support/presentation/pages/support_screen.dart b/lib/features/support/presentation/pages/support_screen.dart index 3fac3447..c6f7719a 100644 --- a/lib/features/support/presentation/pages/support_screen.dart +++ b/lib/features/support/presentation/pages/support_screen.dart @@ -7,7 +7,6 @@ import 'package:flutter/services.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:url_launcher/url_launcher.dart'; import 'package:eatvio_app/core/env_config.dart'; -import 'package:eatvio_app/core/const.dart'; class SupportScreen extends StatelessWidget { const SupportScreen({super.key}); diff --git a/lib/features/user_details/presentation/cubit/user_details_cubit.dart b/lib/features/user_details/presentation/cubit/user_details_cubit.dart index c6eb36b7..0ce0bd93 100644 --- a/lib/features/user_details/presentation/cubit/user_details_cubit.dart +++ b/lib/features/user_details/presentation/cubit/user_details_cubit.dart @@ -20,19 +20,11 @@ class UserDetailsCubit extends Cubit { } } - void getChartData({ - String period = '1', - required String slug, - }) async { + void getChartData({String period = '1', required String slug}) async { try { - final weightPoints = await profileRepository.getWeight(period: period); - final circumferencePoints = await profileRepository.getCircumferences(period: period); - emit( - state.copyWith( - weightPoints: weightPoints, - circumferencePoints: circumferencePoints, - ), - ); + final weightPoints = await profileRepository.getWeight(period: period, slug: slug); + final circumferencePoints = await profileRepository.getCircumferences(period: period, slug: slug); + emit(state.copyWith(weightPoints: weightPoints, circumferencePoints: circumferencePoints)); } catch (e, stackTrace) { log(e.toString(), stackTrace: stackTrace); emit(state.copyWith(error: e.toString(), isLoading: false)); diff --git a/lib/features/user_details/presentation/user_details_screen.dart b/lib/features/user_details/presentation/user_details_screen.dart index f79b990e..4907e3dd 100644 --- a/lib/features/user_details/presentation/user_details_screen.dart +++ b/lib/features/user_details/presentation/user_details_screen.dart @@ -31,9 +31,7 @@ class UserDetailsScreen extends StatelessWidget { Widget build(BuildContext context) { return BlocProvider( create: (context) => sl()..getUserDetails(slug), - child: UserDetailsContent( - slug: slug, - ), + child: UserDetailsContent(slug: slug), ); } } @@ -79,27 +77,15 @@ class _UserDetailsContentState extends State { actions: [ PortalTarget( visible: isMoreOptionsVisible, - portalFollower: MoreOptions( - path: 'profile/${widget.slug}', - complainedContentType: ComplainedContent.profile, - slug: widget.slug, - ), - anchor: const Aligned( - shiftToWithinBound: AxisFlag(x: true, y: true), - follower: Alignment.topRight, - target: Alignment.bottomRight, - ), + portalFollower: MoreOptions(path: 'profile/${widget.slug}', complainedContentType: ComplainedContent.profile, slug: widget.slug), + anchor: const Aligned(shiftToWithinBound: AxisFlag(x: true, y: true), follower: Alignment.topRight, target: Alignment.bottomRight), child: IconButton( onPressed: () { setState(() { isMoreOptionsVisible = !isMoreOptionsVisible; }); }, - icon: SvgPicture.asset( - 'assets/icons/more_button.svg', - width: 20, - height: 20, - ), + icon: SvgPicture.asset('assets/icons/more_button.svg', width: 20, height: 20), ), ), ], @@ -124,25 +110,16 @@ class _UserDetailsContentState extends State { initiallyExpanded: true, title: s.general_info, children: [ - Text( - s.date_of_birth, - style: TextStyles.textSMedium.copyWith(color: appTheme.black), - ), + Text(s.date_of_birth, style: TextStyles.textSMedium.copyWith(color: appTheme.black)), const SizedBox(height: 4), CustomTextFormField( readOnly: true, controller: TextEditingController(text: DateTime.parse(profileDetails.birthdate).format('dd.MM.yyyy')), ), const SizedBox(height: 16), - Text( - s.sex, - style: TextStyles.textSMedium.copyWith(color: appTheme.black), - ), + Text(s.sex, style: TextStyles.textSMedium.copyWith(color: appTheme.black)), const SizedBox(height: 4), - CustomTextFormField( - readOnly: true, - controller: TextEditingController(text: profileDetails.gender.parseGender()), - ), + CustomTextFormField(readOnly: true, controller: TextEditingController(text: profileDetails.gender.parseGender())), const SizedBox(height: 16), ], ), @@ -155,15 +132,9 @@ class _UserDetailsContentState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - s.height, - style: TextStyles.textSMedium.copyWith(color: appTheme.black), - ), + Text(s.height, style: TextStyles.textSMedium.copyWith(color: appTheme.black)), const SizedBox(height: 4), - CustomTextFormField( - readOnly: true, - controller: TextEditingController(text: profileDetails.height.toString()), - ), + CustomTextFormField(readOnly: true, controller: TextEditingController(text: profileDetails.height.toString())), ], ), ), @@ -172,15 +143,9 @@ class _UserDetailsContentState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - s.weight, - style: TextStyles.textSMedium.copyWith(color: appTheme.black), - ), + Text(s.weight, style: TextStyles.textSMedium.copyWith(color: appTheme.black)), const SizedBox(height: 4), - CustomTextFormField( - readOnly: true, - controller: TextEditingController(text: profileDetails.weight.toStringAsFixed(0)), - ), + CustomTextFormField(readOnly: true, controller: TextEditingController(text: profileDetails.weight.toStringAsFixed(0))), ], ), ), @@ -193,15 +158,9 @@ class _UserDetailsContentState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - s.chest_circumference, - style: TextStyles.textSMedium.copyWith(color: appTheme.black), - ), + Text(s.chest_circumference, style: TextStyles.textSMedium.copyWith(color: appTheme.black)), const SizedBox(height: 4), - CustomTextFormField( - readOnly: true, - controller: TextEditingController(text: profileDetails.chestCircumference.toString()), - ), + CustomTextFormField(readOnly: true, controller: TextEditingController(text: profileDetails.chestCircumference.toString())), ], ), ), @@ -210,15 +169,9 @@ class _UserDetailsContentState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - s.waist_circumference, - style: TextStyles.textSMedium.copyWith(color: appTheme.black), - ), + Text(s.waist_circumference, style: TextStyles.textSMedium.copyWith(color: appTheme.black)), const SizedBox(height: 4), - CustomTextFormField( - readOnly: true, - controller: TextEditingController(text: profileDetails.waistCircumference.toString()), - ), + CustomTextFormField(readOnly: true, controller: TextEditingController(text: profileDetails.waistCircumference.toString())), ], ), ), @@ -227,15 +180,9 @@ class _UserDetailsContentState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - s.hip_circumference, - style: TextStyles.textSMedium.copyWith(color: appTheme.black), - ), + Text(s.hip_circumference, style: TextStyles.textSMedium.copyWith(color: appTheme.black)), const SizedBox(height: 4), - CustomTextFormField( - readOnly: true, - controller: TextEditingController(text: profileDetails.hipCircumference.toString()), - ), + CustomTextFormField(readOnly: true, controller: TextEditingController(text: profileDetails.hipCircumference.toString())), ], ), ), @@ -253,15 +200,9 @@ class _UserDetailsContentState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - s.upper, - style: TextStyles.textSMedium.copyWith(color: appTheme.black), - ), + Text(s.upper, style: TextStyles.textSMedium.copyWith(color: appTheme.black)), const SizedBox(height: 4), - CustomTextFormField( - readOnly: true, - controller: TextEditingController(text: profileDetails.bloodPressureUp.toString()), - ), + CustomTextFormField(readOnly: true, controller: TextEditingController(text: profileDetails.bloodPressureUp.toString())), ], ), ), @@ -270,10 +211,7 @@ class _UserDetailsContentState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - s.lower, - style: TextStyles.textSMedium.copyWith(color: appTheme.black), - ), + Text(s.lower, style: TextStyles.textSMedium.copyWith(color: appTheme.black)), const SizedBox(height: 4), CustomTextFormField( readOnly: true, @@ -291,15 +229,9 @@ class _UserDetailsContentState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - s.has_hypo, - style: TextStyles.textSMedium.copyWith(color: appTheme.black), - ), + Text(s.has_hypo, style: TextStyles.textSMedium.copyWith(color: appTheme.black)), const SizedBox(height: 4), - CustomTextFormField( - readOnly: true, - controller: TextEditingController(text: profileDetails.hasHypo.toString()), - ), + CustomTextFormField(readOnly: true, controller: TextEditingController(text: profileDetails.hasHypo.toString())), ], ), ), @@ -308,15 +240,9 @@ class _UserDetailsContentState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - s.has_hyper, - style: TextStyles.textSMedium.copyWith(color: appTheme.black), - ), + Text(s.has_hyper, style: TextStyles.textSMedium.copyWith(color: appTheme.black)), const SizedBox(height: 4), - CustomTextFormField( - readOnly: true, - controller: TextEditingController(text: profileDetails.hasHyper.toString()), - ), + CustomTextFormField(readOnly: true, controller: TextEditingController(text: profileDetails.hasHyper.toString())), ], ), ), @@ -328,60 +254,27 @@ class _UserDetailsContentState extends State { ExpandableBouble( title: s.other_info, children: [ - Text( - s.has_alergy, - style: TextStyles.textSMedium.copyWith(color: appTheme.black), - ), + Text(s.has_alergy, style: TextStyles.textSMedium.copyWith(color: appTheme.black)), const SizedBox(height: 4), - CustomTextFormField( - readOnly: true, - controller: TextEditingController(text: profileDetails.aboutAlergy), - ), + CustomTextFormField(readOnly: true, controller: TextEditingController(text: profileDetails.aboutAlergy)), const SizedBox(height: 16), - Text( - s.takes_pills, - style: TextStyles.textSMedium.copyWith(color: appTheme.black), - ), + Text(s.takes_pills, style: TextStyles.textSMedium.copyWith(color: appTheme.black)), const SizedBox(height: 4), - CustomTextFormField( - readOnly: true, - controller: TextEditingController(text: profileDetails.aboutTakingPils), - ), + CustomTextFormField(readOnly: true, controller: TextEditingController(text: profileDetails.aboutTakingPils)), const SizedBox(height: 16), - Text( - s.sport_hobbies, - style: TextStyles.textSMedium.copyWith(color: appTheme.black), - ), + Text(s.sport_hobbies, style: TextStyles.textSMedium.copyWith(color: appTheme.black)), const SizedBox(height: 4), - CustomTextFormField( - readOnly: true, - controller: TextEditingController(text: profileDetails.aboutSportHobbies), - ), + CustomTextFormField(readOnly: true, controller: TextEditingController(text: profileDetails.aboutSportHobbies)), const SizedBox(height: 16), - Text( - s.liked_groceries, - style: TextStyles.textSMedium.copyWith(color: appTheme.black), - ), + Text(s.liked_groceries, style: TextStyles.textSMedium.copyWith(color: appTheme.black)), const SizedBox(height: 4), - CustomTextFormField( - readOnly: true, - controller: TextEditingController(text: profileDetails.favoriteFoods), - ), + CustomTextFormField(readOnly: true, controller: TextEditingController(text: profileDetails.favoriteFoods)), const SizedBox(height: 16), - Text( - s.not_liked_groceries, - style: TextStyles.textSMedium.copyWith(color: appTheme.black), - ), + Text(s.not_liked_groceries, style: TextStyles.textSMedium.copyWith(color: appTheme.black)), const SizedBox(height: 4), - CustomTextFormField( - readOnly: true, - controller: TextEditingController(text: profileDetails.unfavoriteFoods), - ), + CustomTextFormField(readOnly: true, controller: TextEditingController(text: profileDetails.unfavoriteFoods)), const SizedBox(height: 16), - Text( - s.additional_information, - style: TextStyles.textSMedium.copyWith(color: appTheme.black), - ), + Text(s.additional_information, style: TextStyles.textSMedium.copyWith(color: appTheme.black)), const SizedBox(height: 4), SizedBox( height: 112, @@ -413,10 +306,7 @@ class _UserDetailsContentState extends State { ), ); } - return Scaffold( - appBar: AppBar(), - body: const Loader(), - ); + return Scaffold(appBar: AppBar(), body: const Loader()); }, ); } @@ -432,31 +322,17 @@ class _UserDetailsContentState extends State { SingleChildScrollView( padding: const EdgeInsets.symmetric(horizontal: 16), scrollDirection: Axis.horizontal, - child: Row( - children: [ - _choiceChipWidget(0), - const SizedBox(width: 8), - _choiceChipWidget(1), - const SizedBox(width: 8), - _choiceChipWidget(2), - ], - ), + child: Row(children: [_choiceChipWidget(0), const SizedBox(width: 8), _choiceChipWidget(1), const SizedBox(width: 8), _choiceChipWidget(2)]), ), Builder( builder: (context) { switch (_selectedChipIndex) { case 0: - return WeightChartWidget( - weightPoints: weightPoints, - ); + return WeightChartWidget(weightPoints: weightPoints); case 1: - return CircumferenceChartWidget( - circumferencePoints: circumferencePoints, - ); + return CircumferenceChartWidget(circumferencePoints: circumferencePoints); case 2: - return ImtChartWidget( - weightPoints: weightPoints, - ); + return ImtChartWidget(weightPoints: weightPoints); default: return const SizedBox.shrink(); } @@ -489,16 +365,10 @@ class _UserDetailsContentState extends State { pressElevation: 0, showCheckmark: false, side: BorderSide.none, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(16), - ), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)), padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4), label: Text(chipsIntervalLabelList[index]), - labelStyle: TextStyle( - color: appTheme.gray600, - fontWeight: FontWeight.w500, - fontSize: 12, - ), + labelStyle: TextStyle(color: appTheme.gray600, fontWeight: FontWeight.w500, fontSize: 12), selected: _selectedIntervalChipIndex == index, onSelected: (bool selected) { context.read().getChartData(period: chipsIntervalList[index], slug: widget.slug); @@ -515,16 +385,10 @@ class _UserDetailsContentState extends State { pressElevation: 0, showCheckmark: false, side: BorderSide.none, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(16), - ), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)), padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4), label: Text(chipsLabelList[index]), - labelStyle: TextStyle( - color: index == _selectedChipIndex ? Colors.white : appTheme.gray600, - fontWeight: FontWeight.w500, - fontSize: 12, - ), + labelStyle: TextStyle(color: index == _selectedChipIndex ? Colors.white : appTheme.gray600, fontWeight: FontWeight.w500, fontSize: 12), selected: _selectedChipIndex == index, backgroundColor: appTheme.gray100, onSelected: (bool selected) { diff --git a/lib/main.dart b/lib/main.dart index 8e2796b0..f96256c5 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,3 +1,4 @@ +import 'dart:io' as io; import 'package:eatvio_app/core/app_router.dart'; import 'package:eatvio_app/core/locator_service.dart' as di; import 'package:eatvio_app/core/locator_service.dart'; @@ -12,6 +13,7 @@ import 'package:eatvio_app/firebase_options.dart'; import 'package:eatvio_app/generated/l10n.dart'; import 'package:firebase_core/firebase_core.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; @@ -32,6 +34,10 @@ Future main() async { await FirebaseMessaging.instance.requestPermission(); await di.init(); + if (kDebugMode) { + io.HttpClient.enableTimelineLogging = true; + } + await SentryFlutter.init((options) { options.dsn = EnvConfig.sentryDsn; options.tracesSampleRate = 1.0; diff --git a/pubspec.yaml b/pubspec.yaml index ef434489..46ff6a69 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -89,6 +89,7 @@ dev_dependencies: flutter: uses-material-design: true assets: + - .env - assets/ - assets/images/ - assets/audio/