forked from eatvio/eatvio_app
410 lines
12 KiB
Dart
410 lines
12 KiB
Dart
import 'package:eatvio_app/data/models/selectionPopupModel/selection_popup_model.dart';
|
||
import 'package:eatvio_app/theme/theme_helper.dart';
|
||
import 'package:eatvio_app/widgets/custom_drop_down.dart';
|
||
import 'package:flutter/cupertino.dart';
|
||
import 'package:flutter/material.dart';
|
||
import 'package:go_router/go_router.dart';
|
||
|
||
class SettingsScreen extends StatefulWidget {
|
||
const SettingsScreen({super.key});
|
||
|
||
@override
|
||
State<SettingsScreen> createState() => _SettingsScreenState();
|
||
}
|
||
|
||
class _SettingsScreenState extends State<SettingsScreen> {
|
||
bool updatesNotificationsSwitchState = true;
|
||
bool fillDiaryNotificationsSwitchState = true;
|
||
|
||
@override
|
||
Widget build(BuildContext context) {
|
||
return Scaffold(
|
||
backgroundColor: Color(0xFFF0F2F5),
|
||
appBar: AppBar(
|
||
title: Text('Настройки'),
|
||
),
|
||
body: SingleChildScrollView(
|
||
physics: const BouncingScrollPhysics(),
|
||
child: Column(
|
||
children: [
|
||
const SizedBox(height: 16),
|
||
_selectLanguageDropDown(),
|
||
const SizedBox(height: 20),
|
||
_additionalInfo(),
|
||
const SizedBox(height: 12),
|
||
_notifications(),
|
||
const SizedBox(height: 12),
|
||
_aboutEatvio(),
|
||
const SizedBox(height: 16),
|
||
_becomeConsultantButton(),
|
||
const SizedBox(height: 8),
|
||
_deleteAccountButton(),
|
||
const SizedBox(height: 16),
|
||
],
|
||
),
|
||
),
|
||
);
|
||
}
|
||
|
||
_selectLanguageDropDown() {
|
||
final items = [SelectionPopupModel(title: 'Русский', id: 0, isSelected: true, value: 'Русский')];
|
||
|
||
return Column(
|
||
crossAxisAlignment: CrossAxisAlignment.start,
|
||
children: [
|
||
Padding(
|
||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||
child: Text(
|
||
'Язык',
|
||
style: TextStyle(
|
||
fontSize: 16,
|
||
height: 1,
|
||
color: Colors.grey,
|
||
),
|
||
),
|
||
),
|
||
const SizedBox(height: 8),
|
||
_actionsGroup(
|
||
CustomDropDown(
|
||
items: items,
|
||
value: items[0],
|
||
autofocus: false,
|
||
),
|
||
),
|
||
],
|
||
);
|
||
}
|
||
|
||
_additionalInfo() {
|
||
return Column(
|
||
crossAxisAlignment: CrossAxisAlignment.start,
|
||
children: [
|
||
Padding(
|
||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||
child: Text(
|
||
'Дополнительаная информация',
|
||
style: TextStyle(
|
||
fontSize: 16,
|
||
height: 1,
|
||
color: Colors.grey,
|
||
fontFamily: 'Mulish',
|
||
),
|
||
),
|
||
),
|
||
const SizedBox(height: 8),
|
||
_actionsGroup(
|
||
Column(
|
||
children: [
|
||
const SizedBox(height: 8),
|
||
GestureDetector(
|
||
onTap: () => GoRouter.of(context).pushNamed('generalInfoScreen'),
|
||
child: Row(
|
||
children: [
|
||
Text(
|
||
'Общая информация',
|
||
style: TextStyle(
|
||
color: Colors.black,
|
||
),
|
||
),
|
||
const Spacer(),
|
||
Icon(
|
||
Icons.keyboard_arrow_right_rounded,
|
||
color: Colors.grey.shade400,
|
||
),
|
||
],
|
||
),
|
||
),
|
||
_divider(context),
|
||
GestureDetector(
|
||
onTap: () => GoRouter.of(context).pushNamed('physicalFormScreen'),
|
||
child: Row(
|
||
children: [
|
||
Text(
|
||
'Физическая форма',
|
||
style: TextStyle(
|
||
color: Colors.black,
|
||
),
|
||
),
|
||
const Spacer(),
|
||
Icon(
|
||
Icons.keyboard_arrow_right_rounded,
|
||
color: Colors.grey.shade400,
|
||
),
|
||
],
|
||
),
|
||
),
|
||
_divider(context),
|
||
GestureDetector(
|
||
onTap: () => GoRouter.of(context).pushNamed('pressureScreen'),
|
||
child: Row(
|
||
children: [
|
||
Text(
|
||
'Давление',
|
||
style: TextStyle(
|
||
color: Colors.black,
|
||
),
|
||
),
|
||
const Spacer(),
|
||
Icon(
|
||
Icons.keyboard_arrow_right_rounded,
|
||
color: Colors.grey.shade400,
|
||
),
|
||
],
|
||
),
|
||
),
|
||
_divider(context),
|
||
GestureDetector(
|
||
onTap: () => GoRouter.of(context).pushNamed('otherInfoScreen'),
|
||
child: Row(
|
||
children: [
|
||
Text(
|
||
'Прочая информация',
|
||
style: TextStyle(
|
||
color: Colors.black,
|
||
),
|
||
),
|
||
const Spacer(),
|
||
Icon(
|
||
Icons.keyboard_arrow_right_rounded,
|
||
color: Colors.grey.shade400,
|
||
),
|
||
],
|
||
),
|
||
),
|
||
_divider(context),
|
||
GestureDetector(
|
||
onTap: () => GoRouter.of(context).pushNamed('physicalActivityScreen'),
|
||
child: Row(
|
||
children: [
|
||
Text(
|
||
'Физическая нагрузка',
|
||
style: TextStyle(
|
||
color: Colors.black,
|
||
),
|
||
),
|
||
const Spacer(),
|
||
Icon(
|
||
Icons.keyboard_arrow_right_rounded,
|
||
color: Colors.grey.shade400,
|
||
),
|
||
],
|
||
),
|
||
),
|
||
const SizedBox(height: 8),
|
||
],
|
||
),
|
||
),
|
||
],
|
||
);
|
||
}
|
||
|
||
_notifications() {
|
||
return Column(
|
||
crossAxisAlignment: CrossAxisAlignment.start,
|
||
children: [
|
||
const SizedBox(height: 8),
|
||
Padding(
|
||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||
child: Text(
|
||
'Уведомления',
|
||
style: TextStyle(
|
||
fontSize: 16,
|
||
height: 1,
|
||
color: Colors.grey,
|
||
),
|
||
),
|
||
),
|
||
const SizedBox(height: 8),
|
||
_actionsGroup(
|
||
Column(
|
||
children: [
|
||
Row(
|
||
children: [
|
||
Text(
|
||
'Уведомление о новых обновлениях',
|
||
style: TextStyle(
|
||
color: Colors.black,
|
||
),
|
||
),
|
||
const Spacer(),
|
||
CupertinoSwitch(
|
||
value: updatesNotificationsSwitchState,
|
||
activeColor: appTheme.blueA400,
|
||
onChanged: (newValue) {
|
||
setState(() {
|
||
updatesNotificationsSwitchState = newValue;
|
||
});
|
||
},
|
||
),
|
||
],
|
||
),
|
||
_divider(context),
|
||
Row(
|
||
children: [
|
||
Text(
|
||
'Напоминание о заполнении дневника',
|
||
style: TextStyle(
|
||
color: Colors.black,
|
||
),
|
||
),
|
||
const Spacer(),
|
||
CupertinoSwitch(
|
||
value: fillDiaryNotificationsSwitchState,
|
||
activeColor: appTheme.blueA400,
|
||
onChanged: (newValue) {
|
||
setState(() {
|
||
fillDiaryNotificationsSwitchState = newValue;
|
||
});
|
||
},
|
||
),
|
||
],
|
||
),
|
||
],
|
||
),
|
||
),
|
||
const SizedBox(height: 8),
|
||
],
|
||
);
|
||
}
|
||
|
||
_aboutEatvio() {
|
||
return Column(
|
||
crossAxisAlignment: CrossAxisAlignment.start,
|
||
children: [
|
||
Padding(
|
||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||
child: Text(
|
||
'О Eatvio',
|
||
style: TextStyle(
|
||
fontSize: 16,
|
||
height: 1,
|
||
color: Colors.grey,
|
||
),
|
||
),
|
||
),
|
||
const SizedBox(height: 8),
|
||
_actionsGroup(
|
||
Column(
|
||
children: [
|
||
const SizedBox(height: 8),
|
||
Row(
|
||
children: [
|
||
Text(
|
||
'О компании',
|
||
style: TextStyle(
|
||
color: Colors.black,
|
||
),
|
||
),
|
||
const Spacer(),
|
||
Icon(
|
||
Icons.keyboard_arrow_right_rounded,
|
||
color: Colors.grey.shade400,
|
||
),
|
||
],
|
||
),
|
||
_divider(context),
|
||
Row(
|
||
children: [
|
||
Text(
|
||
'Пользовательское соглашение',
|
||
style: TextStyle(
|
||
color: Colors.black,
|
||
),
|
||
),
|
||
const Spacer(),
|
||
Icon(
|
||
Icons.keyboard_arrow_right_rounded,
|
||
color: Colors.grey.shade400,
|
||
),
|
||
],
|
||
),
|
||
const SizedBox(height: 8),
|
||
],
|
||
),
|
||
),
|
||
],
|
||
);
|
||
}
|
||
|
||
_becomeConsultantButton() {
|
||
return Padding(
|
||
padding: EdgeInsets.symmetric(horizontal: 8),
|
||
child: InkWell(
|
||
onTap: () {},
|
||
borderRadius: BorderRadius.circular(12),
|
||
child: Ink(
|
||
height: 52,
|
||
width: MediaQuery.of(context).size.width - 16,
|
||
decoration: BoxDecoration(
|
||
borderRadius: BorderRadius.circular(12),
|
||
color: appTheme.blueA400,
|
||
),
|
||
child: Center(
|
||
child: Text(
|
||
'Стать консультантом',
|
||
style: TextStyle(
|
||
color: Colors.white,
|
||
height: 1,
|
||
fontWeight: FontWeight.w600,
|
||
fontSize: 18,
|
||
),
|
||
),
|
||
),
|
||
),
|
||
),
|
||
);
|
||
}
|
||
|
||
_deleteAccountButton() {
|
||
return Padding(
|
||
padding: EdgeInsets.symmetric(horizontal: 8),
|
||
child: InkWell(
|
||
onTap: () {},
|
||
borderRadius: BorderRadius.circular(12),
|
||
child: Ink(
|
||
height: 52,
|
||
width: MediaQuery.of(context).size.width - 16,
|
||
decoration: BoxDecoration(
|
||
borderRadius: BorderRadius.circular(12),
|
||
color: Colors.black.withOpacity(0.1),
|
||
),
|
||
child: Center(
|
||
child: Text(
|
||
'Удалить аккаунт',
|
||
style: TextStyle(
|
||
color: Colors.black,
|
||
height: 1,
|
||
fontWeight: FontWeight.w600,
|
||
fontSize: 18,
|
||
),
|
||
),
|
||
),
|
||
),
|
||
),
|
||
);
|
||
}
|
||
|
||
_actionsGroup(Widget child) {
|
||
return Container(
|
||
padding: EdgeInsets.symmetric(vertical: 8, horizontal: 8),
|
||
decoration: BoxDecoration(
|
||
color: Colors.white,
|
||
borderRadius: BorderRadius.circular(12),
|
||
),
|
||
child: child,
|
||
);
|
||
}
|
||
|
||
_divider(BuildContext context) {
|
||
return Container(
|
||
margin: EdgeInsets.symmetric(vertical: 12),
|
||
height: 0.4,
|
||
width: MediaQuery.of(context).size.width - 16,
|
||
decoration: BoxDecoration(
|
||
color: Colors.black26,
|
||
borderRadius: BorderRadius.circular(16),
|
||
),
|
||
);
|
||
}
|
||
}
|