Finished Auth

This commit is contained in:
2023-12-29 12:44:51 +03:00
parent 8641bb1dca
commit b9acef5b38
9 changed files with 398 additions and 574 deletions

View File

@@ -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<double> values, List<DateTime> dates) {
// Создаем список точек для графика
final List<FlSpot> 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();

View File

@@ -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')}');
});
}),
]))));