refactor(diary): Compiled version apk: profile, settings, diarym registration, auth, navigation bar

This commit is contained in:
2024-04-10 17:07:56 +03:00
parent f4ddb7285c
commit bbbc20a15a
11 changed files with 164 additions and 133 deletions

View File

@@ -21,12 +21,12 @@ class CustomBottomBarState extends State<CustomBottomBar> {
title: "diary".tr,
type: BottomBarEnum.tf,
),
BottomMenuModel(
/*BottomMenuModel(
icon: ImageConstant.imgNavBlueGray400,
activeIcon: ImageConstant.imgNavBlueGray400,
title: "my_blog".tr,
type: BottomBarEnum.tf,
),
),*/
BottomMenuModel(
icon: ImageConstant.imgNavBlueGray40024x23,
activeIcon: ImageConstant.imgNavBlueGray40024x23,
@@ -34,9 +34,9 @@ class CustomBottomBarState extends State<CustomBottomBar> {
type: BottomBarEnum.tf,
),
BottomMenuModel(
icon: ImageConstant.imgNavPrimary,
activeIcon: ImageConstant.imgNavPrimary,
title: "admin".tr,
icon: ImageConstant.imgNavBlueGray40024x23,
activeIcon: ImageConstant.imgNavBlueGray40024x23,
title: "Настройки",
type: BottomBarEnum.tf,
),
BottomMenuModel(
@@ -72,12 +72,33 @@ class CustomBottomBarState extends State<CustomBottomBar> {
}
void changeMeny(index) {
selectedIndex = index;
widget.onChanged?.call(bottomMenuList[index].type);
setState(() {});
setState(() {
selectedIndex = index;
});
switch (index) {
case 0:
Navigator.pushNamed(context, AppRoutes.diaryEdit);
break;
/*case 1:
Navigator.pushNamed(context, '/my_blog');
break;*/
case 1:
Navigator.pushNamed(context, AppRoutes.myProfile);
break;
case 2:
Navigator.pushNamed(context, AppRoutes.mySettings);
break;
case 3:
Navigator.pushNamed(context, '/chat');
break;
default:
}
}
BottomNavigationBarItem bottomMenu(index) {
bool isSelected = selectedIndex == index;
return BottomNavigationBarItem(
icon: Column(
crossAxisAlignment: CrossAxisAlignment.center,
@@ -86,14 +107,17 @@ class CustomBottomBarState extends State<CustomBottomBar> {
imagePath: bottomMenuList[index].icon,
height: 24.v,
width: 19.h,
color: appTheme.blueGray400,
color:
isSelected ? theme.colorScheme.primary : appTheme.blueGray400,
),
Padding(
padding: EdgeInsets.only(top: 8.v),
child: Text(
bottomMenuList[index].title ?? "",
style: CustomTextStyles.bodySmallMulishBluegray80012.copyWith(
color: appTheme.blueGray800,
color: isSelected
? theme.colorScheme.primary
: appTheme.blueGray800,
),
),
),

View File

@@ -20,6 +20,7 @@ class CustomTextFormField extends StatelessWidget {
this.prefixConstraints,
this.suffix,
this.suffixConstraints,
this.onFieldSubmitted,
this.initialValue,
this.contentPadding,
this.inputFormatters,
@@ -66,6 +67,8 @@ class CustomTextFormField extends StatelessWidget {
final Widget? suffix;
final Function(String)? onFieldSubmitted;
final BoxConstraints? suffixConstraints;
final EdgeInsets? contentPadding;
@@ -112,6 +115,7 @@ class CustomTextFormField extends StatelessWidget {
keyboardType: keyboardType,
onSaved: onSaved,
onChanged: onChanged,
onFieldSubmitted: onFieldSubmitted,
inputFormatters: inputFormatters,
initialValue: initialValue,
),

View File

@@ -255,7 +255,7 @@ class _ExpandableListState extends State<ExpandableList> {
],
),
NextStepButton(
onPressed: sendData(state),
onPressed: () => sendProfileData(state),
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
text: "save".tr.toUpperCase(),
margin: EdgeInsets.only(top: 20.h, bottom: 20.h)),
@@ -326,6 +326,7 @@ class _ExpandableListState extends State<ExpandableList> {
}
Future<void> sendProfileData(MyProfileLoadedState? state) async {
print("asd");
try {
// Создаем JSON объект с данными профиля
Map<String, dynamic> profileData = {
@@ -350,8 +351,7 @@ class _ExpandableListState extends State<ExpandableList> {
'has_hypo': state?.hypoFormController,
'has_hyper': state?.hyperFormController,
'activity_coefficient':
determineActivityFactor(state?.selectedActivity ?? 'сидячий')
.toString,
determineActivityFactor(state?.selectedActivity ?? 'сидячий'),
};
final box = await Hive.openBox('token');
final token = box.get('token');