feat(settings): add settings screen, general info, font

This commit is contained in:
mso7nueh
2024-09-23 15:17:14 +03:00
parent d771feefe3
commit 2dcb677c7c
61 changed files with 2429 additions and 1131 deletions

View File

@@ -0,0 +1,83 @@
import 'package:eatvio_app/generated/l10n.dart';
import 'package:eatvio_app/theme/theme_helper.dart';
import 'package:eatvio_app/widgets/custom_edit_text_form_field.dart';
import 'package:flutter/material.dart';
class GeneralInfoScreen extends StatefulWidget {
const GeneralInfoScreen({super.key});
@override
State<GeneralInfoScreen> createState() => _GeneralInfoScreenState();
}
class _GeneralInfoScreenState extends State<GeneralInfoScreen> {
final firstNameController = TextEditingController();
final lastNameController = TextEditingController();
@override
Widget build(BuildContext context) {
final s = S.of(context);
return Scaffold(
appBar: AppBar(
title: Text('Общая информация'),
),
bottomSheet: _saveButton(),
body: SingleChildScrollView(
physics: const BouncingScrollPhysics(),
padding: EdgeInsets.symmetric(vertical: 16, horizontal: 8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(s.first_name),
SizedBox(height: 4),
CustomTextFormField(
controller: firstNameController,
textInputAction: TextInputAction.next,
hintText: 'Введите имя',
onChanged: (newValue) {},
),
SizedBox(height: 16),
Text(s.last_name),
SizedBox(height: 4),
CustomTextFormField(
controller: lastNameController,
textInputAction: TextInputAction.done,
hintText: 'Введите фамилию',
onChanged: (newValue) {},
),
],
),
),
);
}
_saveButton() {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 4),
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,
),
),
),
),
),
);
}
}

View File

@@ -0,0 +1,15 @@
import 'package:flutter/cupertino.dart';
class OtherInfoScreen extends StatefulWidget {
const OtherInfoScreen({super.key});
@override
State<OtherInfoScreen> createState() => _OtherInfoScreenState();
}
class _OtherInfoScreenState extends State<OtherInfoScreen> {
@override
Widget build(BuildContext context) {
return const Placeholder();
}
}

View File

@@ -0,0 +1,15 @@
import 'package:flutter/cupertino.dart';
class PhysicalActivityScreen extends StatefulWidget {
const PhysicalActivityScreen({super.key});
@override
State<PhysicalActivityScreen> createState() => _PhysicalActivityScreenState();
}
class _PhysicalActivityScreenState extends State<PhysicalActivityScreen> {
@override
Widget build(BuildContext context) {
return const Placeholder();
}
}

View File

@@ -0,0 +1,15 @@
import 'package:flutter/cupertino.dart';
class PhysicalFormScreen extends StatefulWidget {
const PhysicalFormScreen({super.key});
@override
State<PhysicalFormScreen> createState() => _PhysicalFormScreenState();
}
class _PhysicalFormScreenState extends State<PhysicalFormScreen> {
@override
Widget build(BuildContext context) {
return const Placeholder();
}
}

View File

@@ -0,0 +1,15 @@
import 'package:flutter/cupertino.dart';
class PressureScreen extends StatefulWidget {
const PressureScreen({super.key});
@override
State<PressureScreen> createState() => _PressureScreenState();
}
class _PressureScreenState extends State<PressureScreen> {
@override
Widget build(BuildContext context) {
return const Placeholder();
}
}

View File

@@ -0,0 +1,409 @@
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),
),
);
}
}