mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-15 09:45:22 +00:00

- Added ProfileTab widget for displaying user profile information in a tab. - Added ProfileView widget for displaying user profile details in a separate view.
199 lines
5.9 KiB
Dart
199 lines
5.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:syncrow_app/features/auth/bloc/auth_cubit.dart';
|
|
import 'package:syncrow_app/features/menu/bloc/menu_cubit.dart';
|
|
import 'package:syncrow_app/features/menu/view/widgets/menu_list.dart';
|
|
import 'package:syncrow_app/features/menu/view/widgets/profile/profile_tab.dart';
|
|
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
|
|
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
|
|
import 'package:syncrow_app/generated/assets.dart';
|
|
import 'package:syncrow_app/navigation/routing_constants.dart';
|
|
import 'package:syncrow_app/utils/context_extension.dart';
|
|
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
|
import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
|
|
|
class MenuView extends StatelessWidget {
|
|
const MenuView({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return BlocProvider(
|
|
create: (BuildContext context) => MenuCubit(),
|
|
child: BlocBuilder<MenuCubit, MenuState>(
|
|
builder: (context, state) {
|
|
return BlocBuilder<AuthCubit, AuthState>(
|
|
builder: (context, state) {
|
|
return Padding(
|
|
padding: EdgeInsets.only(
|
|
top: Constants.appBarHeight,
|
|
bottom: Constants.bottomNavBarHeight,
|
|
left: Constants.defaultPadding,
|
|
right: Constants.defaultPadding,
|
|
),
|
|
child: SingleChildScrollView(
|
|
physics: const BouncingScrollPhysics(),
|
|
child: Column(
|
|
children: [
|
|
const ProfileTab(),
|
|
for (var section in menuSections)
|
|
MenuList(
|
|
section: section,
|
|
),
|
|
const SizedBox(
|
|
height: 15,
|
|
),
|
|
InkWell(
|
|
onTap: () {
|
|
AuthCubit.get(context).logout();
|
|
Navigator.of(context).pushNamedAndRemoveUntil(
|
|
Routes.authLogin, (route) => false);
|
|
},
|
|
child: Row(
|
|
children: [
|
|
Expanded(
|
|
child: DefaultContainer(
|
|
child: Center(
|
|
child: BodyLarge(
|
|
text: 'Logout',
|
|
style: context.bodyLarge.copyWith(
|
|
color: Colors.red,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
);
|
|
},
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
List<Map<String, Object>> menuSections = [
|
|
//Home Management
|
|
{
|
|
'title': 'Home Management',
|
|
'color': ColorsManager.primaryColor,
|
|
'buttons': [
|
|
{
|
|
'title': 'Create a Home',
|
|
'Icon': Assets.homeManagementIconsCreateHome,
|
|
'page': null
|
|
},
|
|
{
|
|
'title': 'Join a Home',
|
|
'Icon': Assets.homeManagementIconsJoinAHome,
|
|
'page': null
|
|
},
|
|
{
|
|
'title': 'Manage Your Home',
|
|
'Icon': Assets.homeManagementIconsManageYourHome,
|
|
'page': null
|
|
},
|
|
],
|
|
},
|
|
//General Settings
|
|
{
|
|
'title': 'General Settings',
|
|
'color': const Color(0xFF0030CB),
|
|
'buttons': [
|
|
{
|
|
'title': 'Voice Assistant',
|
|
'Icon': Assets.generalSettingsIconsVoiceAssistant,
|
|
'page': null
|
|
},
|
|
{
|
|
'title': 'Temperature unit',
|
|
'Icon': Assets.generalSettingsIconsTemperatureUnit,
|
|
'page': null
|
|
},
|
|
{
|
|
'title': 'Touch tone on panel',
|
|
'Icon': Assets.generalSettingsIconsTouchTone,
|
|
'page': null
|
|
},
|
|
{
|
|
'title': 'Language',
|
|
'Icon': Assets.generalSettingsIconsLanguage,
|
|
'page': null
|
|
},
|
|
{
|
|
'title': 'Network Diagnosis',
|
|
'Icon': Assets.generalSettingsIconsNetworkDiagnosis,
|
|
'page': null
|
|
},
|
|
{
|
|
'title': 'Clear Cache',
|
|
'Icon': Assets.generalSettingsIconsClearCache,
|
|
'page': null
|
|
},
|
|
],
|
|
},
|
|
//Messages Center
|
|
{
|
|
'title': 'Messages Center',
|
|
'color': const Color(0xFF0088FF),
|
|
'buttons': [
|
|
{
|
|
'title': 'Alerts',
|
|
'Icon': Assets.messagesCenterIconsAlerts,
|
|
'page': null
|
|
},
|
|
{
|
|
'title': 'Messages',
|
|
'Icon': Assets.messagesCenterIconsMessages,
|
|
'page': null
|
|
},
|
|
{'title': 'FAQs', 'Icon': Assets.messagesCenterIconsFAQs, 'page': null},
|
|
{
|
|
'title': 'Help & Feedback',
|
|
'Icon': Assets.messagesCenterIconsHelpAndFeedbacks,
|
|
'page': null
|
|
},
|
|
],
|
|
},
|
|
//Security And Privacy
|
|
{
|
|
'title': 'Security And Privacy',
|
|
'color': const Color(0xFF8AB9FF),
|
|
'buttons': [
|
|
{
|
|
'title': 'Security',
|
|
'Icon': Assets.securityAndPrivacyIconsSecurty,
|
|
'page': null
|
|
},
|
|
{
|
|
'title': 'Privacy',
|
|
'Icon': Assets.securityAndPrivacyIconsPrivacy,
|
|
'page': null
|
|
},
|
|
],
|
|
},
|
|
//Legal Information
|
|
{
|
|
'title': 'Legal Information',
|
|
'color': const Color(0xFF001B72),
|
|
'buttons': [
|
|
{'title': 'About', 'Icon': Assets.leagalInfoIconsAbout, 'page': null},
|
|
{
|
|
'title': 'Privacy Policy',
|
|
'Icon': Assets.leagalInfoIconsPrivacyPolicy,
|
|
'page': null
|
|
},
|
|
{
|
|
'title': 'User Agreement',
|
|
'Icon': Assets.leagalInfoIconsUserAgreement,
|
|
'page': null
|
|
},
|
|
],
|
|
},
|
|
];
|