From b9acef5b3821b6040b71bd2eae83945e575cf97c Mon Sep 17 00:00:00 2001 From: maxxkim Date: Fri, 29 Dec 2023 12:44:51 +0300 Subject: [PATCH] Finished Auth --- lib/data/models/tokenModel/token_model.dart | 9 + lib/localization/ru/ru_translations.dart | 99 +++ lib/main.dart | 3 + .../my_profile_screen/my_profile_screen.dart | 645 ++---------------- .../additional_information_screen.dart | 9 +- lib/widgets/app_bar/appbar_subtitle.dart | 2 +- lib/widgets/app_bar/exit_button.dart | 38 ++ lib/widgets/custom_bottom_bar.dart | 166 +++++ pubspec.yaml | 1 + 9 files changed, 398 insertions(+), 574 deletions(-) create mode 100644 lib/data/models/tokenModel/token_model.dart create mode 100644 lib/widgets/app_bar/exit_button.dart create mode 100644 lib/widgets/custom_bottom_bar.dart diff --git a/lib/data/models/tokenModel/token_model.dart b/lib/data/models/tokenModel/token_model.dart new file mode 100644 index 00000000..17ab28a1 --- /dev/null +++ b/lib/data/models/tokenModel/token_model.dart @@ -0,0 +1,9 @@ +import 'package:hive/hive.dart'; + +@HiveType(typeId: 0) +class TokenModel { + @HiveField(0) + String token; + + TokenModel({required this.token}); +} diff --git a/lib/localization/ru/ru_translations.dart b/lib/localization/ru/ru_translations.dart index 3d328fe0..780dd19f 100644 --- a/lib/localization/ru/ru_translations.dart +++ b/lib/localization/ru/ru_translations.dart @@ -99,4 +99,103 @@ final Map ru = { // Body Circumference "pressure_empty": "Все показатели давления обязательны к заполнению", "pressure_is_not_a_number": "Все показатели давления должны быть числами", + + // Личный кабинет Screen + "Dmitry_Koval": "Дмитрий Коваль", "done": "Готово", "exit": "Выйти", + "my_blog": "Мой блог", "lbl_01_04_21": "01.04.21", "lbl_01_05_21": "01.05.21", + + // Настройки Screen + "language": "Язык:", + "lbl23": "Уведомления", + "lbl24": "О нас ", + "msg2": "Уведомление о новых обновлениях", + "msg3": "Напоминания о заполнении дневника", + "msg4": "Дополнительная информация", + "msg5": "Персональные данные", + "msg6": "Стать консультантом", + + // Блог Screen + "lbl25": "Опубликовано", + "lbl26": "Черновик", + "msg_made_as_per_recipe": + "Made as per recipe, prepared about an hour early, covered and refrigerated. Very good, flavours melded with little astringency. Definitely will be having again.", + "msg_mediterranean_tuna": "Mediterranean tuna salad\r\n", + + // Блог - Tab Container Screen + "lbl27": "Мой Блог", "lbl28": "Статьи", "lbl29": "Рецепты", + + // Статья Screen + "lbl30": "Статья", + "lbl31": "Имя Фамилия", + "lbl32": "Цитировать", + "lbl33": "Комментарий", + "lbl_18_30": "18:30", + "lbl_23_04_2021": "23.04.2021,", + "lbl_32": "3", + "lbl_52": "5", + "msg7": "Комментарии пользователей: 3", + "msg_lorem_ipsum_dolor": + "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum", + "msg_lorem_ipsum_dolor2": + "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut", + "msg_lorem_ipsum_dolor3": + "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", + + // Личный кабинет One Screen + "lbl36": "Готов", "msg10": "Создать публикацию", + "msg8": "Редактировать профиль", "msg9": "Индекс массы тела:", + + // Личный кабинет Two Screen + "lbl40": "Написать", + + // Common String + "lbl10": "Талия:", + "lbl11": "Бедра:", + "lbl12": "Лёгкий", + "lbl14": "Умеренный", + "lbl15": "Полный", + "in_progress": "В процессе", + "lbl17": "План", + "lbl18": "Лента", + "lbl19": "Главная", + "lbl20": "Профиль", + "lbl21": "Чат", + "lbl34": "Хедер", + "lbl35": "Анна Власова", + "lbl37": "Все публикации", + "lbl38": "Комментировать", + "lbl39": "Нравится", + "lbl4": "Настройки", + "lbl5": "Вес:", + "lbl6": "Было:", + "lbl7": "Стало:", + "lbl8": "Обхват:", + "lbl9": "Грудь:", + "lbl_0": "0", + "lbl_01_01_21": "01.01.21", + "lbl_01_02_21": "01.02.21", + "lbl_01_03_21": "01.03.21", + "lbl_100": "100", + "lbl_12_11": "Вчера в 12:11", + "lbl_200": "200", + "lbl_50": "50", + "lbl_55": "Стало: 55", + "lbl_552": " 55", + "lbl_60": "Талия: 60", + "lbl_602": "60", + "lbl_64": "64", + "lbl_80": "Было: 80", + "lbl_802": " 80", + "lbl_90": "Грудь: 90", + "lbl_902": "90", + "lbl_903": "Бедра: 90", + "msg": "Пройденные планы:", + "msg_10_trending_nutrition": + "10 Trending Nutrition Research Articles of 2021", + "msg_amet_minim_mollit": + "Amet minim mollit non deserunt ullamco est sit aliqua dolor do amet sint. Velit officia consequat duis enim velit mollit. Exercitation veniam consequat sunt nostrud amet. ", + "msg_as_2020_begins": + "As 2020 begins, we took a look back at nutrition in the news during 2019. The most popular diet search according to Google was intermittent fasting, which we can attest was a popular search term in American Society for Nutrition’s content as well. But there’s much more to nutrition than trending diets and many more areas in the field of nutrition were researched and discussed this past year. Below we share 10 articles from ASN’s four peer reviewed journals that received high levels of attention in the news and social media.", + "msg_as_2020_begins2": + "As 2020 begins, we took a look back at nutrition in the news during 2019. The most popular diet search according to Google was intermittent fasting...", }; diff --git a/lib/main.dart b/lib/main.dart index 6407cf7e..1b6ea4e4 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -3,11 +3,14 @@ import 'package:flutter/services.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'core/app_export.dart'; import 'package:hive_flutter/hive_flutter.dart'; +import 'package:eatvio_app/data/models/tokenModel/token_model.dart'; var globalMessengerKey = GlobalKey(); void main() async { var path = '/'; await Hive.initFlutter(path); + await Hive.openBox('token'); + await Hive.openBox('userData'); SystemChrome.setPreferredOrientations([ DeviceOrientation.portraitUp, ]); diff --git a/lib/presentation/profile/my_profile_screen/my_profile_screen.dart b/lib/presentation/profile/my_profile_screen/my_profile_screen.dart index f8c0bcf2..a9b25c34 100644 --- a/lib/presentation/profile/my_profile_screen/my_profile_screen.dart +++ b/lib/presentation/profile/my_profile_screen/my_profile_screen.dart @@ -5,8 +5,11 @@ import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart'; import 'package:eatvio_app/widgets/app_bar/appbar_subtitle.dart'; import 'package:eatvio_app/widgets/app_bar/appbar_title_circleimage.dart'; import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart'; -import 'package:eatvio_app/widgets/custom_outlined_button.dart'; +import 'package:eatvio_app/widgets/custom_bottom_bar.dart'; +import 'package:eatvio_app/widgets/app_bar/exit_button.dart'; +import 'package:eatvio_app/widgets/next_step_button.dart'; import 'package:flutter/material.dart'; +import 'package:fl_chart/fl_chart.dart'; class MyProfileScreen extends StatelessWidget { const MyProfileScreen({Key? key}) : super(key: key); @@ -35,11 +38,20 @@ class MyProfileScreen extends StatelessWidget { SizedBox(height: 15.v), _buildSettings(context), SizedBox(height: 30.v), - _buildAreaChart(context), + /*_buildChart( + [70.0, 72.0, 71.0, 73.0], + [ + DateTime(2021, 10, 1), + DateTime(2021, 10, 2), + DateTime(2021, 10, 3), + DateTime(2021, 10, 4), + ], + ),*/ SizedBox(height: 15.v), _buildWidget(context), - SizedBox(height: 5.v) - ])))); + SizedBox(height: 5.v), + ])), + bottomNavigationBar: _buildBottomBar(context))); }); } @@ -59,12 +71,12 @@ class MyProfileScreen extends StatelessWidget { child: Row(children: [ AppbarTitleCircleimage(imagePath: ImageConstant.imgEllipse1), AppbarSubtitle( - text: "lbl".tr, + text: "Dmitry_Koval".tr, margin: EdgeInsets.only(left: 35.h, top: 12.v, bottom: 9.v)) ])), actions: [ - AppbarSubtitle( - text: "lbl2".tr, + ExitButton( + text: "exit".tr, margin: EdgeInsets.symmetric(horizontal: 16.h, vertical: 17.v)) ]); } @@ -80,8 +92,9 @@ class MyProfileScreen extends StatelessWidget { width: 24.adaptSize, margin: EdgeInsets.symmetric(vertical: 3.v)), Expanded( - child: CustomOutlinedButton( - text: "lbl3".tr.toUpperCase(), + child: NextStepButton( + buttonStyle: CustomButtonStyles.outlinePrimaryTL15, + text: "my_blog".tr.toUpperCase(), margin: EdgeInsets.only(left: 10.h))) ])); } @@ -97,552 +110,62 @@ class MyProfileScreen extends StatelessWidget { width: 24.adaptSize, margin: EdgeInsets.symmetric(vertical: 3.v)), Expanded( - child: CustomOutlinedButton( + child: NextStepButton( + buttonStyle: CustomButtonStyles.outlinePrimaryTL15, text: "lbl4".tr.toUpperCase(), margin: EdgeInsets.only(left: 10.h))) ])); } - /// Section Widget - Widget _buildAreaChart(BuildContext context) { - return Padding( - padding: EdgeInsets.only(left: 7.h), - child: Column(children: [ - Padding( - padding: EdgeInsets.only(right: 7.h), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text("lbl5".tr, - style: CustomTextStyles.titleSmallBluegray800), - Row(mainAxisAlignment: MainAxisAlignment.center, children: [ - RichText( - text: TextSpan(children: [ - TextSpan( - text: "lbl6".tr, - style: - CustomTextStyles.bodyMediumBluegray800_1), - TextSpan( - text: "lbl_802".tr, - style: CustomTextStyles - .titleSmallBluegray800ExtraBold) - ]), - textAlign: TextAlign.left), - Padding( - padding: EdgeInsets.only(left: 15.h), - child: RichText( - text: TextSpan(children: [ - TextSpan( - text: "lbl7".tr, - style: CustomTextStyles - .bodyMediumBluegray800_1), - TextSpan( - text: "lbl_552".tr, - style: CustomTextStyles - .titleSmallBluegray800ExtraBold) - ]), - textAlign: TextAlign.left)) - ]) - ])), - SizedBox(height: 8.v), - SizedBox( - height: 139.v, - width: 350.h, - child: Stack(alignment: Alignment.centerLeft, children: [ - Align( - alignment: Alignment.bottomRight, - child: Text("lbl_01_04_21".tr, - style: theme.textTheme.bodySmall)), - Align( - alignment: Alignment.centerLeft, - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row(children: [ - _buildLineChart(context, - text100: "lbl_100".tr, - text50: "lbl_50".tr, - text0: "lbl_0".tr), - Expanded( - child: Padding( - padding: EdgeInsets.only( - left: 10.h, - top: 6.v, - bottom: 4.v), - child: Column(children: [ - SizedBox( - height: 112.v, - width: 304.h, - child: Stack( - alignment: - Alignment.centerLeft, - children: [ - Align( - alignment: Alignment - .centerLeft, - child: SizedBox( - height: 112.v, - child: - VerticalDivider( - width: - 1.h, - thickness: - 1.v))), - Align( - alignment: Alignment - .centerLeft, - child: Padding( - padding: EdgeInsets - .only( - left: 101 - .h), - child: SizedBox( - height: 112.v, - child: VerticalDivider( - width: - 1.h, - thickness: - 1.v)))), - Align( - alignment: Alignment - .centerRight, - child: Padding( - padding: EdgeInsets - .only( - right: 100 - .h), - child: SizedBox( - height: 112.v, - child: VerticalDivider( - width: - 1.h, - thickness: - 1.v)))), - Align( - alignment: - Alignment.center, - child: SizedBox( - width: 304.h, - child: - Divider())), - Align( - alignment: Alignment - .topCenter, - child: SizedBox( - width: 304.h, - child: - Divider())), - CustomImageView( - imagePath: - ImageConstant - .imgArea1, - height: 88.v, - width: 304.h, - alignment: Alignment - .bottomCenter) - ])), - Divider() - ]))) - ]), - SizedBox(height: 3.v), - Container( - width: 240.h, - margin: - EdgeInsets.only(left: 8.h, right: 82.h), - child: Row(children: [ - Text("lbl_01_01_21".tr, - style: theme.textTheme.bodySmall), - Spacer(flex: 49), - Text("lbl_01_02_21".tr, - style: theme.textTheme.bodySmall), - Spacer(flex: 50), - Text("lbl_01_03_21".tr, - style: theme.textTheme.bodySmall) - ])) - ])), - SizedBox( - height: 138.v, - child: VerticalDivider( - width: 1.h, - thickness: 1.v, - indent: 6.h, - endIndent: 20.h)) - ])) - ])), - SizedBox(height: 14.v), - Padding( - padding: EdgeInsets.only(right: 7.h), - child: - Row(mainAxisAlignment: MainAxisAlignment.center, children: [ - Text("lbl8".tr, style: CustomTextStyles.titleSmallBluegray800), - Spacer(), - RichText( - text: TextSpan(children: [ - TextSpan( - text: "lbl9".tr, - style: CustomTextStyles.bodyMediumBluegray800_1), - TextSpan(text: " "), - TextSpan( - text: "lbl_902".tr, - style: CustomTextStyles.titleSmallRed200) - ]), - textAlign: TextAlign.left), - Padding( - padding: EdgeInsets.only(left: 15.h), - child: RichText( - text: TextSpan(children: [ - TextSpan( - text: "lbl10".tr, - style: CustomTextStyles.bodyMediumBluegray800_1), - TextSpan(text: " "), - TextSpan( - text: "lbl_602".tr, - style: CustomTextStyles.titleSmallBlue800) - ]), - textAlign: TextAlign.left)), - Padding( - padding: EdgeInsets.only(left: 16.h), - child: RichText( - text: TextSpan(children: [ - TextSpan( - text: "lbl11".tr, - style: CustomTextStyles.bodyMediumBluegray800_1), - TextSpan(text: " "), - TextSpan( - text: "lbl_902".tr, - style: CustomTextStyles.titleSmallLightgreen300) - ]), - textAlign: TextAlign.left)) - ])), - SizedBox(height: 6.v), - Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - Padding( - padding: EdgeInsets.only(right: 15.h), - child: Row(children: [ - _buildLineChart(context, - text100: "lbl_100".tr, - text50: "lbl_50".tr, - text0: "lbl_0".tr), - Expanded( - child: Padding( - padding: - EdgeInsets.only(left: 6.h, top: 6.v, bottom: 4.v), - child: Column(children: [ - SizedBox( - height: 112.v, - width: 312.h, - child: Stack( - alignment: Alignment.centerLeft, - children: [ - Align( - alignment: Alignment.centerLeft, - child: Padding( - padding: - EdgeInsets.only(left: 4.h), - child: SizedBox( - height: 112.v, - child: VerticalDivider( - width: 1.h, - thickness: 1.v)))), - Align( - alignment: Alignment.centerLeft, - child: Padding( - padding: - EdgeInsets.only(left: 80.h), - child: SizedBox( - height: 112.v, - child: VerticalDivider( - width: 1.h, - thickness: 1.v)))), - Align( - alignment: Alignment.center, - child: SizedBox( - height: 112.v, - child: VerticalDivider( - width: 1.h, thickness: 1.v))), - Align( - alignment: Alignment.centerRight, - child: Padding( - padding: - EdgeInsets.only(right: 79.h), - child: SizedBox( - height: 112.v, - child: VerticalDivider( - width: 1.h, - thickness: 1.v)))), - Align( - alignment: Alignment.centerRight, - child: Padding( - padding: - EdgeInsets.only(right: 2.h), - child: SizedBox( - height: 112.v, - child: VerticalDivider( - width: 1.h, - thickness: 1.v)))), - Align( - alignment: Alignment.center, - child: SizedBox( - width: 304.h, child: Divider())), - Align( - alignment: Alignment.topCenter, - child: SizedBox( - width: 304.h, child: Divider())), - Align( - alignment: Alignment.topCenter, - child: Container( - height: 36.v, - width: 304.h, - margin: - EdgeInsets.only(top: 30.v), - child: Stack( - alignment: Alignment.topLeft, - children: [ - CustomImageView( - imagePath: ImageConstant - .imgLine1, - height: 36.v, - width: 304.h, - alignment: - Alignment.center), - Align( - alignment: - Alignment.topLeft, - child: Container( - height: 8.adaptSize, - width: 8.adaptSize, - margin: - EdgeInsets.only( - left: 72.h, - top: 5.v), - decoration: BoxDecoration( - color: appTheme - .red200, - borderRadius: - BorderRadius - .circular( - 4.h)))) - ]))), - Align( - alignment: Alignment.topLeft, - child: Container( - height: 8.adaptSize, - width: 8.adaptSize, - margin: - EdgeInsets.only(top: 46.v), - decoration: BoxDecoration( - color: appTheme.teal100, - borderRadius: - BorderRadius.circular( - 4.h)))), - Align( - alignment: Alignment.topCenter, - child: Container( - height: 8.adaptSize, - width: 8.adaptSize, - margin: - EdgeInsets.only(top: 26.v), - decoration: BoxDecoration( - color: appTheme.red200, - borderRadius: - BorderRadius.circular( - 4.h)))), - Align( - alignment: Alignment.bottomRight, - child: Container( - height: 8.adaptSize, - width: 8.adaptSize, - margin: EdgeInsets.only( - right: 76.h, bottom: 41.v), - decoration: BoxDecoration( - color: appTheme.red200, - borderRadius: - BorderRadius.circular( - 4.h)))), - Align( - alignment: Alignment.topRight, - child: Container( - height: 8.adaptSize, - width: 8.adaptSize, - margin: - EdgeInsets.only(top: 46.v), - decoration: BoxDecoration( - color: appTheme.teal100, - borderRadius: - BorderRadius.circular( - 4.h)))), - Align( - alignment: Alignment.topCenter, - child: Container( - height: 28.v, - width: 304.h, - margin: - EdgeInsets.only(top: 29.v), - child: Stack( - alignment: Alignment.topLeft, - children: [ - CustomImageView( - imagePath: ImageConstant - .imgLine2, - height: 28.v, - width: 304.h, - alignment: - Alignment.center), - Align( - alignment: - Alignment.topLeft, - child: Container( - height: 8.adaptSize, - width: 8.adaptSize, - margin: - EdgeInsets.only( - left: 72.h, - top: 9.v), - decoration: BoxDecoration( - color: appTheme - .blue800, - borderRadius: - BorderRadius - .circular( - 4.h)))) - ]))), - Align( - alignment: Alignment.topLeft, - child: Container( - height: 8.adaptSize, - width: 8.adaptSize, - margin: - EdgeInsets.only(top: 46.v), - decoration: BoxDecoration( - color: appTheme.blue800, - borderRadius: - BorderRadius.circular( - 4.h)))), - Align( - alignment: Alignment.topCenter, - child: Container( - height: 8.adaptSize, - width: 8.adaptSize, - margin: - EdgeInsets.only(top: 25.v), - decoration: BoxDecoration( - color: appTheme.blue800, - borderRadius: - BorderRadius.circular( - 4.h)))), - Align( - alignment: Alignment.centerRight, - child: Container( - height: 8.adaptSize, - width: 8.adaptSize, - margin: - EdgeInsets.only(right: 76.h), - decoration: BoxDecoration( - color: appTheme.blue800, - borderRadius: - BorderRadius.circular( - 4.h)))), - Align( - alignment: Alignment.topRight, - child: Container( - height: 8.adaptSize, - width: 8.adaptSize, - margin: - EdgeInsets.only(top: 46.v), - decoration: BoxDecoration( - color: appTheme.blue800, - borderRadius: - BorderRadius.circular( - 4.h)))), - CustomImageView( - imagePath: ImageConstant.imgLine3, - height: 12.v, - width: 304.h, - alignment: Alignment.center), - Align( - alignment: Alignment.topLeft, - child: Container( - height: 8.adaptSize, - width: 8.adaptSize, - margin: - EdgeInsets.only(top: 46.v), - decoration: BoxDecoration( - color: appTheme.lightGreen300, - borderRadius: - BorderRadius.circular( - 4.h)))), - Align( - alignment: Alignment.topLeft, - child: Container( - height: 8.adaptSize, - width: 8.adaptSize, - margin: EdgeInsets.only( - left: 76.h, top: 47.v), - decoration: BoxDecoration( - color: appTheme.lightGreen300, - borderRadius: - BorderRadius.circular( - 4.h)))), - Align( - alignment: Alignment.topCenter, - child: Container( - height: 8.adaptSize, - width: 8.adaptSize, - margin: - EdgeInsets.only(top: 47.v), - decoration: BoxDecoration( - color: appTheme.lightGreen300, - borderRadius: - BorderRadius.circular( - 4.h)))), - Align( - alignment: Alignment.bottomRight, - child: Container( - height: 8.adaptSize, - width: 8.adaptSize, - margin: EdgeInsets.only( - right: 76.h, bottom: 46.v), - decoration: BoxDecoration( - color: appTheme.lightGreen300, - borderRadius: - BorderRadius.circular( - 4.h)))), - Align( - alignment: Alignment.topRight, - child: Container( - height: 8.adaptSize, - width: 8.adaptSize, - margin: - EdgeInsets.only(top: 46.v), - decoration: BoxDecoration( - color: appTheme.lightGreen300, - borderRadius: - BorderRadius.circular( - 4.h)))) - ])), - Divider(indent: 4.h, endIndent: 4.h) - ]))) - ])), - SizedBox(height: 3.v), - Padding( - padding: EdgeInsets.only(left: 8.h), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text("lbl_01_01_21".tr, style: theme.textTheme.bodySmall), - Text("lbl_01_02_21".tr, style: theme.textTheme.bodySmall), - Text("lbl_01_03_21".tr, style: theme.textTheme.bodySmall), - Text("lbl_01_04_21".tr, style: theme.textTheme.bodySmall), - Text("lbl_01_05_21".tr, style: theme.textTheme.bodySmall) - ])) - ]) - ])); + Widget _buildBottomBar(BuildContext context) { + return CustomBottomBar(onChanged: (BottomBarEnum type) {}); } + /// Section Widget +/* Widget _buildChart(List values, List dates) { + // Создаем список точек для графика + final List spots = []; + for (int i = 0; i < values.length; i++) { + spots.add(FlSpot(i.toDouble(), values[i])); + } + + return LineChart( + LineChartData( + // Ось X - даты + minX: 0, + maxX: dates.length.toDouble() - 1, + // Ось Y - значения + minY: 0, + maxY: values.reduce((a, b) => a > b ? a : b) + 10, + // Список точек + lineBarsData: [ + LineChartBarData( + spots: spots, + isCurved: false, + color: Colors.blue, + barWidth: 3, + ), + ], + // Оси и легенда + titlesData: FlTitlesData( + bottomTitles: AxisTitles(sideTitles:SideTitles( + showTitles: true, + getTitlesWidget: (value) { + final index = value.toInt(); + return '${dates[index].day}.${dates[index].month}'; + }, + )), + leftTitles: AxisTitles(sideTitles: SideTitles( + showTitles: true, + getTitlesWidget: (value,TitleMeta ) { + return '${value.toInt()}'; + }, + ), + )), + ), + ); +}*/ + /// Section Widget Widget _buildWidget(BuildContext context) { return Padding( @@ -652,7 +175,6 @@ class MyProfileScreen extends StatelessWidget { padding: EdgeInsets.only(left: 15.h), child: Text("msg".tr, style: CustomTextStyles.titleSmallBluegray800)), - SizedBox(height: 3.v), SizedBox( height: 95.v, width: 343.h, @@ -696,7 +218,7 @@ class MyProfileScreen extends StatelessWidget { child: Container( width: 40.h, margin: EdgeInsets.only(right: 30.h), - child: Text("lbl13".tr, + child: Text("done".tr, maxLines: 2, overflow: TextOverflow.ellipsis, style: theme.textTheme.titleSmall))) @@ -741,7 +263,7 @@ class MyProfileScreen extends StatelessWidget { child: Container( width: 40.h, margin: EdgeInsets.only(right: 30.h), - child: Text("lbl13".tr, + child: Text("done".tr, maxLines: 2, overflow: TextOverflow.ellipsis, style: theme.textTheme.titleSmall))) @@ -782,7 +304,7 @@ class MyProfileScreen extends StatelessWidget { 5.h)))), Align( alignment: Alignment.bottomCenter, - child: Text("lbl16".tr, + child: Text("in_progress".tr, style: theme.textTheme.titleSmall)) ])) @@ -820,25 +342,6 @@ class MyProfileScreen extends StatelessWidget { ])); } - /// Common widget - Widget _buildLineChart( - BuildContext context, { - required String text100, - required String text50, - required String text0, - }) { - return Column(crossAxisAlignment: CrossAxisAlignment.end, children: [ - Text(text100, - style: theme.textTheme.bodySmall!.copyWith(color: appTheme.gray500)), - SizedBox(height: 44.v), - Text(text50, - style: theme.textTheme.bodySmall!.copyWith(color: appTheme.gray500)), - SizedBox(height: 44.v), - Text(text0, - style: theme.textTheme.bodySmall!.copyWith(color: appTheme.gray500)) - ]); - } - /// Navigates to the previous screen. onTapArrowLeft(BuildContext context) { NavigatorService.goBack(); diff --git a/lib/presentation/registration/additional_information_screen/additional_information_screen.dart b/lib/presentation/registration/additional_information_screen/additional_information_screen.dart index f534bf14..a5783af4 100644 --- a/lib/presentation/registration/additional_information_screen/additional_information_screen.dart +++ b/lib/presentation/registration/additional_information_screen/additional_information_screen.dart @@ -5,10 +5,12 @@ import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart'; import 'package:eatvio_app/widgets/app_bar/appbar_title_image.dart'; import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart'; import 'package:eatvio_app/widgets/next_step_button.dart'; -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; +import 'package:eatvio_app/data/models/tokenModel/token_model.dart'; import 'package:flutter/material.dart'; import 'dart:convert'; +import 'package:hive/hive.dart'; import 'package:http/http.dart' as http; class AdditionalInformationScreen extends StatelessWidget { @@ -74,7 +76,10 @@ class AdditionalInformationScreen extends StatelessWidget { headers: {'Content-Type': 'application/json'}, body: json.encode(sheet), ); - print(response.body); + final box = await Hive.openBox('token'); + final token = json.decode(response.body)['token']; + box.put('token', token); + print('token: ${box.get('token')}'); }); }), ])))); diff --git a/lib/widgets/app_bar/appbar_subtitle.dart b/lib/widgets/app_bar/appbar_subtitle.dart index 83ff1b3c..69c1b639 100644 --- a/lib/widgets/app_bar/appbar_subtitle.dart +++ b/lib/widgets/app_bar/appbar_subtitle.dart @@ -29,7 +29,7 @@ class AppbarSubtitle extends StatelessWidget { child: Text( text, style: CustomTextStyles.titleMediumBlack.copyWith( - color: appTheme.blue400, + color: appTheme.black900, ), ), ), diff --git a/lib/widgets/app_bar/exit_button.dart b/lib/widgets/app_bar/exit_button.dart new file mode 100644 index 00000000..a93c9a84 --- /dev/null +++ b/lib/widgets/app_bar/exit_button.dart @@ -0,0 +1,38 @@ +import 'package:eatvio_app/core/app_export.dart'; +import 'package:flutter/material.dart'; + +// ignore: must_be_immutable +class ExitButton extends StatelessWidget { + ExitButton({ + Key? key, + required this.text, + this.margin, + this.onTap, + }) : super( + key: key, + ); + + String text; + + EdgeInsetsGeometry? margin; + + Function? onTap; + + @override + Widget build(BuildContext context) { + return GestureDetector( + onTap: () { + onTap!.call(); + }, + child: Padding( + padding: margin ?? EdgeInsets.zero, + child: Text( + text, + style: CustomTextStyles.titleSmallRed200.copyWith( + color: Colors.red, + ), + ), + ), + ); + } +} diff --git a/lib/widgets/custom_bottom_bar.dart b/lib/widgets/custom_bottom_bar.dart new file mode 100644 index 00000000..6304f2d5 --- /dev/null +++ b/lib/widgets/custom_bottom_bar.dart @@ -0,0 +1,166 @@ +import 'package:eatvio_app/core/app_export.dart'; +import 'package:flutter/material.dart'; + +class CustomBottomBar extends StatefulWidget { + CustomBottomBar({this.onChanged}); + + Function(BottomBarEnum)? onChanged; + + @override + CustomBottomBarState createState() => CustomBottomBarState(); +} + +class CustomBottomBarState extends State { + int selectedIndex = 0; + + List bottomMenuList = [ + BottomMenuModel( + icon: ImageConstant.imgNav, + activeIcon: ImageConstant.imgNav, + title: "lbl17".tr, + type: BottomBarEnum.tf, + ), + BottomMenuModel( + icon: ImageConstant.imgNavBlueGray400, + activeIcon: ImageConstant.imgNavBlueGray400, + title: "lbl18".tr, + type: BottomBarEnum.tf, + ), + BottomMenuModel( + icon: ImageConstant.imgNavBlueGray40024x23, + activeIcon: ImageConstant.imgNavBlueGray40024x23, + title: "lbl19".tr, + type: BottomBarEnum.tf, + ), + BottomMenuModel( + icon: ImageConstant.imgNavPrimary, + activeIcon: ImageConstant.imgNavPrimary, + title: "lbl20".tr, + type: BottomBarEnum.tf, + ), + BottomMenuModel( + icon: ImageConstant.imgNavBlueGray40024x25, + activeIcon: ImageConstant.imgNavBlueGray40024x25, + title: "lbl21".tr, + type: BottomBarEnum.tf, + ) + ]; + + @override + Widget build(BuildContext context) { + return Container( + height: 80.v, + decoration: BoxDecoration( + border: Border.all( + color: appTheme.whiteA700, + width: 1.h, + ), + ), + child: BottomNavigationBar( + backgroundColor: Colors.transparent, + showSelectedLabels: false, + showUnselectedLabels: false, + selectedFontSize: 0, + elevation: 0, + currentIndex: selectedIndex, + type: BottomNavigationBarType.fixed, + items: List.generate(bottomMenuList.length, (index) { + return BottomNavigationBarItem( + icon: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + CustomImageView( + imagePath: bottomMenuList[index].icon, + height: 24.v, + width: 19.h, + color: appTheme.blueGray400, + ), + Padding( + padding: EdgeInsets.only(top: 8.v), + child: Text( + bottomMenuList[index].title ?? "", + style: + CustomTextStyles.bodySmallMulishBluegray80012.copyWith( + color: appTheme.blueGray800, + ), + ), + ), + ], + ), + activeIcon: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + CustomImageView( + imagePath: bottomMenuList[index].activeIcon, + height: 24.adaptSize, + width: 24.adaptSize, + color: theme.colorScheme.primary, + ), + Padding( + padding: EdgeInsets.only(top: 9.v), + child: Text( + bottomMenuList[index].title ?? "", + style: CustomTextStyles.bodySmallMulishPrimary.copyWith( + color: theme.colorScheme.primary, + ), + ), + ), + ], + ), + label: '', + ); + }), + onTap: (index) { + selectedIndex = index; + widget.onChanged?.call(bottomMenuList[index].type); + setState(() {}); + }, + ), + ); + } +} + +enum BottomBarEnum { + tf, +} + +class BottomMenuModel { + BottomMenuModel({ + required this.icon, + required this.activeIcon, + this.title, + required this.type, + }); + + String icon; + + String activeIcon; + + String? title; + + BottomBarEnum type; +} + +class DefaultWidget extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Container( + color: Colors.white, + padding: EdgeInsets.all(10), + child: Center( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + 'Please replace the respective Widget here', + style: TextStyle( + fontSize: 18, + ), + ), + ], + ), + ), + ); + } +} diff --git a/pubspec.yaml b/pubspec.yaml index 4cb29eb7..f9601192 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -19,6 +19,7 @@ dependencies: hive_flutter: ^1.1.0 isar_flutter_libs: ^4.0.0-dev.13 path_provider: ^2.1.0 + fl_chart: ^0.66.0 dev_dependencies: flutter_test: