fix: analyzer and token storage

This commit is contained in:
Alexander
2025-08-20 11:34:28 +03:00
parent 442da40622
commit 9d4687553a
11 changed files with 274 additions and 286 deletions

View File

@@ -23,81 +23,105 @@ class _RegistrationAsScreenState extends State<RegistrationAsScreen> {
children: [
const Padding(
padding: EdgeInsets.symmetric(horizontal: 16),
child: Text(
'Регистрация в качестве',
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.w700,
height: 1.1,
),
),
child: Text('Регистрация в качестве', style: TextStyle(fontSize: 24, fontWeight: FontWeight.w700, height: 1.1)),
),
const SizedBox(height: 16),
RadioListTile<RegistrationAsType>(
value: RegistrationAsType.physical,
groupValue: registrationAsType,
title: const Text(
'Физического лица',
style: TextStyle(
fontSize: 18,
height: 1,
Column(
children: [
Row(
children: [
Radio<RegistrationAsType>(
value: RegistrationAsType.physical,
// ignore: deprecated_member_use
groupValue: registrationAsType,
activeColor: appTheme.blueA400,
// ignore: deprecated_member_use
onChanged: (value) {
setState(() {
registrationAsType = value!;
});
},
),
const Expanded(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 8),
child: Text('Физического лица', style: TextStyle(fontSize: 18, height: 1)),
),
),
],
),
),
activeColor: appTheme.blueA400,
onChanged: (value) {},
contentPadding: const EdgeInsets.symmetric(horizontal: 8),
),
RadioListTile<RegistrationAsType>(
value: RegistrationAsType.selfBusy,
groupValue: registrationAsType,
title: const Text(
'Самозанятого',
style: TextStyle(
fontSize: 18,
height: 1,
Row(
children: [
Radio<RegistrationAsType>(
value: RegistrationAsType.selfBusy,
// ignore: deprecated_member_use
groupValue: registrationAsType,
activeColor: appTheme.blueA400,
// ignore: deprecated_member_use
onChanged: (value) {
setState(() {
registrationAsType = value!;
});
},
),
const Expanded(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 8),
child: Text('Самозанятого', style: TextStyle(fontSize: 18, height: 1)),
),
),
],
),
),
onChanged: null,
contentPadding: const EdgeInsets.symmetric(horizontal: 8),
),
RadioListTile<RegistrationAsType>(
value: RegistrationAsType.iP,
groupValue: registrationAsType,
title: const Text(
'Индивидуального предпринимателя',
style: TextStyle(
fontSize: 18,
height: 1,
Row(
children: [
Radio<RegistrationAsType>(
value: RegistrationAsType.iP,
// ignore: deprecated_member_use
groupValue: registrationAsType,
activeColor: appTheme.blueA400,
// ignore: deprecated_member_use
onChanged: (value) {
setState(() {
registrationAsType = value!;
});
},
),
const Expanded(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 8),
child: Text('Индивидуального предпринимателя', style: TextStyle(fontSize: 18, height: 1)),
),
),
],
),
),
onChanged: null,
contentPadding: const EdgeInsets.symmetric(horizontal: 8),
),
RadioListTile<RegistrationAsType>(
value: RegistrationAsType.ooo,
groupValue: registrationAsType,
title: const Text(
'Общества с ограниченной ответственностью',
style: TextStyle(
fontSize: 18,
height: 1,
Row(
children: [
Radio<RegistrationAsType>(
value: RegistrationAsType.ooo,
// ignore: deprecated_member_use
groupValue: registrationAsType,
activeColor: appTheme.blueA400,
// ignore: deprecated_member_use
onChanged: (value) {
setState(() {
registrationAsType = value!;
});
},
),
const Expanded(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 8),
child: Text('Общества с ограниченной ответственностью', style: TextStyle(fontSize: 18, height: 1)),
),
),
],
),
),
onChanged: null,
contentPadding: const EdgeInsets.symmetric(horizontal: 8),
),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 16,
),
child: _divider(context),
],
),
Padding(padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 16), child: _divider(context)),
const Padding(
padding: EdgeInsets.symmetric(horizontal: 16),
child: Text(
'* На данный момент регистрация доступна только в качестве физического лица. Остальные варианты скоро появятся',
),
child: Text('* На данный момент регистрация доступна только в качестве физического лица. Остальные варианты скоро появятся'),
),
],
),
@@ -108,10 +132,7 @@ class _RegistrationAsScreenState extends State<RegistrationAsScreen> {
return Container(
height: 0.4,
width: MediaQuery.of(context).size.width - 32,
decoration: BoxDecoration(
color: Colors.black26,
borderRadius: BorderRadius.circular(16),
),
decoration: BoxDecoration(color: Colors.black26, borderRadius: BorderRadius.circular(16)),
);
}
}

View File

@@ -27,48 +27,46 @@ class _GenderScreenState extends State<GenderScreen> {
padding: const EdgeInsets.only(bottom: 80, top: 16, left: 16, right: 16),
child: Column(
children: [
RadioListTile(
contentPadding: EdgeInsets.zero,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
),
title: const Text('Мужской'),
value: 'male',
groupValue: currentValue,
onChanged: (newValue) {
final registrationCubit = context.read<RegistrationCubit>();
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(gender: 'male'));
setState(() {
currentValue = 'male';
});
},
secondary: Image.asset(
'assets/images/img_male.png',
width: 40,
height: 40,
),
Row(
children: [
Radio<String>(
value: 'male',
// ignore: deprecated_member_use
groupValue: currentValue,
// ignore: deprecated_member_use
onChanged: (newValue) {
final registrationCubit = context.read<RegistrationCubit>();
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(gender: 'male'));
setState(() {
currentValue = 'male';
});
},
),
Expanded(
child: Row(children: [Image.asset('assets/images/img_male.png', width: 40, height: 40), const SizedBox(width: 8), const Text('Мужской')]),
),
],
),
const SizedBox(height: 16),
RadioListTile(
contentPadding: EdgeInsets.zero,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
),
title: const Text('Женский'),
value: 'female',
groupValue: currentValue,
onChanged: (newValue) {
final registrationCubit = context.read<RegistrationCubit>();
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(gender: 'female'));
setState(() {
currentValue = 'female';
});
},
secondary: Image.asset(
'assets/images/img_female.png',
width: 40,
height: 40,
),
Row(
children: [
Radio<String>(
value: 'female',
// ignore: deprecated_member_use
groupValue: currentValue,
// ignore: deprecated_member_use
onChanged: (newValue) {
final registrationCubit = context.read<RegistrationCubit>();
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(gender: 'female'));
setState(() {
currentValue = 'female';
});
},
),
Expanded(
child: Row(children: [Image.asset('assets/images/img_female.png', width: 40, height: 40), const SizedBox(width: 8), const Text('Женский')]),
),
],
),
],
),

View File

@@ -7,10 +7,7 @@ import 'package:go_router/go_router.dart';
class PhysicalActivityScreen extends StatefulWidget {
final SettingsEntity settingsEntity;
const PhysicalActivityScreen({
super.key,
required this.settingsEntity,
});
const PhysicalActivityScreen({super.key, required this.settingsEntity});
@override
State<PhysicalActivityScreen> createState() => _PhysicalActivityScreenState();
@@ -46,69 +43,108 @@ class _PhysicalActivityScreenState extends State<PhysicalActivityScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Физическая нагрузка'),
),
appBar: AppBar(title: const Text('Физическая нагрузка')),
bottomSheet: _saveButton(),
body: SingleChildScrollView(
physics: const BouncingScrollPhysics(),
padding: const EdgeInsets.only(top: 16, bottom: 80),
child: Column(
children: [
RadioListTile<PhysicalActivity>(
contentPadding: const EdgeInsets.only(left: 8, right: 16),
title: const Text('1,2 — минимальный (сидячая работа, отсутствие физических нагрузок);'),
value: PhysicalActivity.minimum,
groupValue: _physicalActivity,
onChanged: (PhysicalActivity? value) {
setState(() {
_physicalActivity = value;
});
},
Row(
children: [
Radio<PhysicalActivity>(
value: PhysicalActivity.minimum,
// ignore: deprecated_member_use
groupValue: _physicalActivity,
// ignore: deprecated_member_use
onChanged: (PhysicalActivity? value) {
setState(() {
_physicalActivity = value;
});
},
),
const Expanded(
child: Padding(
padding: EdgeInsets.only(left: 8, right: 16),
child: Text('1,2 — минимальный (сидячая работа, отсутствие физических нагрузок);'),
),
),
],
),
RadioListTile<PhysicalActivity>(
contentPadding: const EdgeInsets.only(left: 8, right: 16),
title: const Text('1,375 — низкий (тренировки не менее 20 мин 1–3 раза в неделю);'),
value: PhysicalActivity.low,
groupValue: _physicalActivity,
onChanged: (PhysicalActivity? value) {
setState(() {
_physicalActivity = value;
});
},
Row(
children: [
Radio<PhysicalActivity>(
value: PhysicalActivity.low,
// ignore: deprecated_member_use
groupValue: _physicalActivity,
// ignore: deprecated_member_use
onChanged: (PhysicalActivity? value) {
setState(() {
_physicalActivity = value;
});
},
),
const Expanded(
child: Padding(padding: EdgeInsets.only(left: 8, right: 16), child: Text('1,375 — низкий (тренировки не менее 20 мин 1–3 раза в неделю);')),
),
],
),
RadioListTile<PhysicalActivity>(
contentPadding: const EdgeInsets.only(left: 8, right: 16),
title: const Text('1,55 — умеренный (тренировки 30–60 мин 3–4 раза в неделю);'),
value: PhysicalActivity.medium,
groupValue: _physicalActivity,
onChanged: (PhysicalActivity? value) {
setState(() {
_physicalActivity = value;
});
},
Row(
children: [
Radio<PhysicalActivity>(
value: PhysicalActivity.medium,
// ignore: deprecated_member_use
groupValue: _physicalActivity,
// ignore: deprecated_member_use
onChanged: (PhysicalActivity? value) {
setState(() {
_physicalActivity = value;
});
},
),
const Expanded(
child: Padding(padding: EdgeInsets.only(left: 8, right: 16), child: Text('1,55 — умеренный (тренировки 30–60 мин 3–4 раза в неделю);')),
),
],
),
RadioListTile<PhysicalActivity>(
contentPadding: const EdgeInsets.only(left: 8, right: 16),
title: const Text('1,7 — высокий (тренировки 30–60 мин 5–7 раза в неделю; тяжёлая физическая работа);'),
value: PhysicalActivity.high,
groupValue: _physicalActivity,
onChanged: (PhysicalActivity? value) {
setState(() {
_physicalActivity = value;
});
},
Row(
children: [
Radio<PhysicalActivity>(
value: PhysicalActivity.high,
// ignore: deprecated_member_use
groupValue: _physicalActivity,
// ignore: deprecated_member_use
onChanged: (PhysicalActivity? value) {
setState(() {
_physicalActivity = value;
});
},
),
const Expanded(
child: Padding(
padding: EdgeInsets.only(left: 8, right: 16),
child: Text('1,7 — высокий (тренировки 30–60 мин 5–7 раза в неделю; тяжёлая физическая работа);'),
),
),
],
),
RadioListTile<PhysicalActivity>(
contentPadding: const EdgeInsets.only(left: 8, right: 16),
title: const Text('1,9 — экстремальный (несколько интенсивных тренировок в день'),
value: PhysicalActivity.extreme,
groupValue: _physicalActivity,
onChanged: (PhysicalActivity? value) {
setState(() {
_physicalActivity = value;
});
},
Row(
children: [
Radio<PhysicalActivity>(
value: PhysicalActivity.extreme,
// ignore: deprecated_member_use
groupValue: _physicalActivity,
// ignore: deprecated_member_use
onChanged: (PhysicalActivity? value) {
setState(() {
_physicalActivity = value;
});
},
),
const Expanded(
child: Padding(padding: EdgeInsets.only(left: 8, right: 16), child: Text('1,9 — экстремальный (несколько интенсивных тренировок в день')),
),
],
),
],
),
@@ -141,8 +177,8 @@ class _PhysicalActivityScreenState extends State<PhysicalActivityScreen> {
}
widget.settingsEntity.settingsCubit.updateProfileDetails(
profileDetailsModel: (widget.settingsEntity.settingsCubit.state as SettingsStateLoaded).profileDetails.copyWith(
activityCoefficient: activityCoefficient,
),
activityCoefficient: activityCoefficient,
),
);
GoRouter.of(context).pop();
},
@@ -150,19 +186,11 @@ class _PhysicalActivityScreenState extends State<PhysicalActivityScreen> {
child: Ink(
height: 52,
width: MediaQuery.of(context).size.width - 32,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: appTheme.blueA400,
),
decoration: BoxDecoration(borderRadius: BorderRadius.circular(20), color: appTheme.blueA400),
child: const Center(
child: Text(
'Сохранить',
style: TextStyle(
color: Colors.white,
height: 1,
fontWeight: FontWeight.w600,
fontSize: 18,
),
style: TextStyle(color: Colors.white, height: 1, fontWeight: FontWeight.w600, fontSize: 18),
),
),
),