profile(refactor): New functionalityy for settings screen

This commit is contained in:
2024-04-02 17:14:17 +03:00
parent a2998c1fc7
commit 76a421bba5
5 changed files with 22 additions and 7 deletions

View File

@@ -71,6 +71,12 @@ class AuthScreen extends StatelessWidget {
EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v),
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
onPressed: onTapDiaryTest(context)),
NextStepButton(
text: "Тест профиля".toUpperCase(),
margin:
EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v),
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
onPressed: onTapProfileTest(context)),
BlocBuilder<AuthBloc, AuthState>(builder: (context, state) {
return NextStepButton(
text: "authentificate".tr.toUpperCase(),
@@ -156,6 +162,12 @@ class AuthScreen extends StatelessWidget {
};
}
onTapProfileTest(BuildContext context) {
return () {
Navigator.pushNamed(context, AppRoutes.mySettings);
};
}
onTapNoAccount(BuildContext context) {
return () {
Navigator.pushNamed(context, AppRoutes.languageSelectScreen);

View File

@@ -451,6 +451,7 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
(meal) => meal['type'] == event.value.id,
orElse: () => null);
print(meal);
int? id = event.value.id;
DiaryEditLoadedState updatedState = currentState.copyWith(
currentMeal: event.value,

View File

@@ -21,8 +21,10 @@ class MyProfileBloc extends Bloc<MyProfileEvent, MyProfileState> {
Emitter<MyProfileState> emit,
) async {
try {
final box = await Hive.openBox('token');
final token = box.get('token');
/*final box = await Hive.openBox('token');
final token = box.get('token');*/
final token =
"9|laravel_sanctum_KFXbccDcWEvTPfJmV99EQv1neAggmpR2TidVGDPN34fa201a";
final response = await http.get(
Uri.parse(dotenv.env['SERVER_ROOT']! + '/profile/index'),
headers: {

View File

@@ -44,15 +44,15 @@ class MySettingsScreen extends StatelessWidget {
_buildSetingsScreen(BuildContext context, MyProfileLoadedState state) {
mediaQueryData = MediaQuery.of(context);
SafeArea(
return SafeArea(
child: Scaffold(
appBar: _buildAppBar(context, "my_settings".tr),
body: Padding(
padding: const EdgeInsets.all(16.0),
child: ListView(
children: [
SectionTitle('Язык'),
LanguageDropdown(),
//SectionTitle('Язык'),
//LanguageDropdown(),
SectionTitle('Уведомления'),
NotificationSwitch('Уведомление об обновлениях'),
NotificationSwitch('Напоминания о заполнении'),

View File

@@ -130,7 +130,7 @@ class _ExpandableListState extends State<ExpandableList> {
decoration: InputDecoration(labelText: 'date_of_birth'.tr),
controller: state.dateFormController,
onTap: inputTime(context, state)),
DropdownButtonFormField<String>(
/*DropdownButtonFormField<String>(
value: state.selectedCountry,
hint: Text(state.selectedCountry ?? "Не выбрано"),
onChanged: setCountry(state),
@@ -153,7 +153,7 @@ class _ExpandableListState extends State<ExpandableList> {
);
}).toList(),
decoration: InputDecoration(labelText: 'city_of_living'.tr),
),
),*/
TextField(
controller: state.weightFormController,
decoration: InputDecoration(labelText: 'weight_measurements'.tr),