feature(settings): Верстка экранов настроек
This commit is contained in:
136
lib/screens/settings/states/initial.dart
Normal file
136
lib/screens/settings/states/initial.dart
Normal file
@@ -0,0 +1,136 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:remever/common/functions.dart';
|
||||
import 'package:remever/common/resources.dart';
|
||||
import 'package:remever/common/widgets/typography.dart';
|
||||
import 'package:remever/common/widgets/wspace.dart';
|
||||
import 'package:remever/components/extensions/context.dart';
|
||||
import 'package:remever/gen/assets.gen.dart';
|
||||
import 'package:remever/screens/settings/cubit/settings_cubit.dart';
|
||||
import 'package:remever/widgets/primary_button.dart';
|
||||
|
||||
class InitialSettingsState extends StatelessWidget {
|
||||
const InitialSettingsState({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.bg,
|
||||
appBar: _buildAppBar(context),
|
||||
body: Padding(
|
||||
padding: EdgeInsets.all(16.r),
|
||||
child: Column(
|
||||
children: [
|
||||
_buildSettingsItem(
|
||||
context,
|
||||
Assets.icons.settingsProfile,
|
||||
'Профиль',
|
||||
SettingsCubitType.profile,
|
||||
),
|
||||
HSpace(8),
|
||||
_buildSettingsItem(
|
||||
context,
|
||||
Assets.icons.settingsNotification,
|
||||
'Уведомления',
|
||||
SettingsCubitType.notifications,
|
||||
),
|
||||
HSpace(8),
|
||||
_buildSettingsItem(
|
||||
context,
|
||||
Assets.icons.settingsFaq,
|
||||
'FAQ',
|
||||
SettingsCubitType.faq,
|
||||
),
|
||||
HSpace(8),
|
||||
_buildSettingsItem(
|
||||
context,
|
||||
Assets.icons.settingsAbout,
|
||||
'О приложении',
|
||||
SettingsCubitType.about,
|
||||
),
|
||||
const Spacer(),
|
||||
_buildContactDeveloperButton(),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// AppBar экрана настроек
|
||||
AppBar _buildAppBar(BuildContext context) {
|
||||
return AppBar(
|
||||
toolbarHeight: 66.h,
|
||||
backgroundColor: AppColors.white,
|
||||
shadowColor: Colors.transparent,
|
||||
centerTitle: true,
|
||||
leadingWidth: 0,
|
||||
title: AppTypography('Настройки', type: SemiBold20px()),
|
||||
actions: [
|
||||
IconButton(
|
||||
onPressed: () => showInfoToast('Тут будет выход'),
|
||||
icon: Assets.icons.settingsExit.image(height: 24.h, width: 24.w),
|
||||
color: Colors.black,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
/// Общий метод для построения пункта меню
|
||||
Widget _buildSettingsItem(
|
||||
BuildContext context,
|
||||
AssetGenImage icon,
|
||||
String title,
|
||||
SettingsCubitType cubitType,
|
||||
) {
|
||||
return GestureDetector(
|
||||
onTap: () => _navigateToSection(context, cubitType),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.white,
|
||||
borderRadius: BorderRadius.circular(12.r),
|
||||
),
|
||||
margin: EdgeInsets.zero,
|
||||
padding: EdgeInsets.symmetric(vertical: 16.r, horizontal: 12.r),
|
||||
child: Row(
|
||||
children: [
|
||||
icon.image(height: 24.h, width: 24.w),
|
||||
WSpace(8),
|
||||
AppTypography(title, type: Regular16px()),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Метод для навигации к разделу через Cubit
|
||||
void _navigateToSection(BuildContext context, SettingsCubitType cubitType) {
|
||||
switch (cubitType) {
|
||||
case SettingsCubitType.initial:
|
||||
context.read<SettingsCubit>().toInitialState();
|
||||
case SettingsCubitType.profile:
|
||||
context.read<SettingsCubit>().toProfileState();
|
||||
case SettingsCubitType.notifications:
|
||||
context.read<SettingsCubit>().toNotificationsState();
|
||||
case SettingsCubitType.faq:
|
||||
context.read<SettingsCubit>().toFaqState();
|
||||
case SettingsCubitType.about:
|
||||
context.read<SettingsCubit>().toAboutState();
|
||||
}
|
||||
}
|
||||
|
||||
/// Кнопка "Написать разработчику"
|
||||
Widget _buildContactDeveloperButton() {
|
||||
return PrimaryButton(
|
||||
child: AppTypography(
|
||||
'Написать разработчику',
|
||||
color: AppColors.white,
|
||||
type: Medium14px(),
|
||||
),
|
||||
onTap: () {},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Перечисление типов состояний для SettingsCubit
|
||||
enum SettingsCubitType { initial, profile, notifications, faq, about }
|
||||
Reference in New Issue
Block a user