mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-17 02:25:16 +00:00
Added Manage Home Page And Home Settings Page
This commit is contained in:
@ -4,6 +4,7 @@ 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/bloc/menu_cubit.dart';
|
||||||
import 'package:syncrow_app/features/menu/view/widgets/home%20management/create_home_view.dart';
|
import 'package:syncrow_app/features/menu/view/widgets/home%20management/create_home_view.dart';
|
||||||
import 'package:syncrow_app/features/menu/view/widgets/join_home/join_home_view.dart';
|
import 'package:syncrow_app/features/menu/view/widgets/join_home/join_home_view.dart';
|
||||||
|
import 'package:syncrow_app/features/menu/view/widgets/manage_home/manage_home_view.dart';
|
||||||
import 'package:syncrow_app/features/menu/view/widgets/menu_list.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/menu/view/widgets/profile/profile_tab.dart';
|
||||||
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
|
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
|
||||||
@ -98,14 +99,14 @@ List<Map<String, Object>> menuSections = [
|
|||||||
{
|
{
|
||||||
'title': 'Manage Your Home',
|
'title': 'Manage Your Home',
|
||||||
'Icon': Assets.homeManagementIconsManageYourHome,
|
'Icon': Assets.homeManagementIconsManageYourHome,
|
||||||
'page': null
|
'page': const ManageHomeView()
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
//General Settings
|
//General Settings
|
||||||
{
|
{
|
||||||
'title': 'General Settings',
|
'title': 'General Settings',
|
||||||
'color': const Color(0xFF0030CB),
|
'color': const Color(0xFF023DFE),
|
||||||
'buttons': [
|
'buttons': [
|
||||||
{
|
{
|
||||||
'title': 'Voice Assistant',
|
'title': 'Voice Assistant',
|
||||||
|
@ -5,7 +5,6 @@ import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart';
|
|||||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
|
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
|
||||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';
|
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';
|
||||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_small.dart';
|
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_small.dart';
|
||||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/title_medium.dart';
|
|
||||||
import 'package:syncrow_app/utils/context_extension.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/color_manager.dart';
|
||||||
|
|
||||||
@ -54,6 +53,7 @@ class CreateHomeView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
//Divider
|
||||||
Container(
|
Container(
|
||||||
height: 1,
|
height: 1,
|
||||||
color: ColorsManager.greyColor,
|
color: ColorsManager.greyColor,
|
||||||
|
174
lib/features/menu/view/widgets/manage_home/home_settings.dart
Normal file
174
lib/features/menu/view/widgets/manage_home/home_settings.dart
Normal file
@ -0,0 +1,174 @@
|
|||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:syncrow_app/features/app_layout/model/space_model.dart';
|
||||||
|
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
|
||||||
|
import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart';
|
||||||
|
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
|
||||||
|
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';
|
||||||
|
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_small.dart';
|
||||||
|
import 'package:syncrow_app/utils/context_extension.dart';
|
||||||
|
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
||||||
|
|
||||||
|
class HomeSettingsView extends StatelessWidget {
|
||||||
|
const HomeSettingsView({super.key, this.space});
|
||||||
|
|
||||||
|
final SpaceModel? space;
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return DefaultScaffold(
|
||||||
|
title: 'Home Settings',
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
//Home Info
|
||||||
|
DefaultContainer(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 25,
|
||||||
|
vertical: 10,
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
const BodyMedium(text: 'Name '),
|
||||||
|
Flexible(
|
||||||
|
child: TextField(
|
||||||
|
textAlign: TextAlign.end,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
hintText: 'Enter Name',
|
||||||
|
hintStyle:
|
||||||
|
context.bodyMedium.copyWith(color: Colors.grey),
|
||||||
|
border: InputBorder.none,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
//Divider
|
||||||
|
Container(
|
||||||
|
margin: const EdgeInsets.only(bottom: 10),
|
||||||
|
height: 1,
|
||||||
|
color: ColorsManager.greyColor,
|
||||||
|
),
|
||||||
|
const Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
BodyMedium(text: 'Rooms'),
|
||||||
|
Icon(
|
||||||
|
Icons.arrow_forward_ios,
|
||||||
|
color: ColorsManager.greyColor,
|
||||||
|
size: 15,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
//Divider
|
||||||
|
Container(
|
||||||
|
height: 1,
|
||||||
|
margin: const EdgeInsets.only(top: 10),
|
||||||
|
color: ColorsManager.greyColor,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
const BodyMedium(text: 'Location'),
|
||||||
|
Flexible(
|
||||||
|
child: TextField(
|
||||||
|
textAlign: TextAlign.end,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
hintText: 'Set',
|
||||||
|
hintStyle:
|
||||||
|
context.bodyMedium.copyWith(color: Colors.grey),
|
||||||
|
border: InputBorder.none,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
//Members Info
|
||||||
|
const SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
|
//TODO connect the members to this GridView
|
||||||
|
const BodySmall(
|
||||||
|
text: "Members",
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
GridView.builder(
|
||||||
|
shrinkWrap: true,
|
||||||
|
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
|
crossAxisCount: 2,
|
||||||
|
crossAxisSpacing: 10,
|
||||||
|
),
|
||||||
|
itemCount: 4,
|
||||||
|
itemBuilder: (context, index) => Stack(
|
||||||
|
alignment: Alignment.topCenter,
|
||||||
|
children: [
|
||||||
|
DefaultContainer(
|
||||||
|
margin: const EdgeInsets.only(top: 20),
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.symmetric(vertical: 15, horizontal: 40),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
const SizedBox(
|
||||||
|
height: 50,
|
||||||
|
),
|
||||||
|
BodyMedium(
|
||||||
|
text: 'Member ${index + 1}',
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 3),
|
||||||
|
const BodySmall(
|
||||||
|
text: 'Syncrow Account',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox.square(
|
||||||
|
dimension: 80,
|
||||||
|
child: CircleAvatar(
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
child: SizedBox.square(
|
||||||
|
dimension: 77,
|
||||||
|
child: CircleAvatar(
|
||||||
|
backgroundColor: ColorsManager.greyColor,
|
||||||
|
child: Icon(Icons.person),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Spacer(),
|
||||||
|
InkWell(
|
||||||
|
onTap: () {},
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: DefaultContainer(
|
||||||
|
child: Center(
|
||||||
|
child: BodyLarge(
|
||||||
|
text: 'Leave Home',
|
||||||
|
style: context.bodyLarge.copyWith(
|
||||||
|
color: Colors.red,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
110
lib/features/menu/view/widgets/manage_home/manage_home_view.dart
Normal file
110
lib/features/menu/view/widgets/manage_home/manage_home_view.dart
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
|
||||||
|
import 'package:syncrow_app/features/menu/view/widgets/manage_home/home_settings.dart';
|
||||||
|
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
|
||||||
|
import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart';
|
||||||
|
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';
|
||||||
|
import 'package:syncrow_app/utils/helpers/custom_page_route.dart';
|
||||||
|
import 'package:syncrow_app/utils/helpers/misc_string_helpers.dart';
|
||||||
|
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
||||||
|
|
||||||
|
class ManageHomeView extends StatelessWidget {
|
||||||
|
const ManageHomeView({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
var spaces = HomeCubit.getInstance().spaces;
|
||||||
|
return DefaultScaffold(
|
||||||
|
title: 'Manage Your Home',
|
||||||
|
child: spaces == null
|
||||||
|
? const Center(
|
||||||
|
child: CircularProgressIndicator(),
|
||||||
|
)
|
||||||
|
: Column(
|
||||||
|
children: [
|
||||||
|
DefaultContainer(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 25,
|
||||||
|
vertical: 20,
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
children: List.generate(
|
||||||
|
spaces.length,
|
||||||
|
(index) {
|
||||||
|
if (index == spaces.length - 1) {
|
||||||
|
return InkWell(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.of(context).push(CustomPageRoute(
|
||||||
|
builder: (context) => HomeSettingsView(
|
||||||
|
space: spaces[index],
|
||||||
|
)));
|
||||||
|
},
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
BodyMedium(
|
||||||
|
text: StringHelpers.toTitleCase(
|
||||||
|
spaces[index].name ?? "")),
|
||||||
|
const Icon(
|
||||||
|
Icons.arrow_forward_ios,
|
||||||
|
color: ColorsManager.greyColor,
|
||||||
|
size: 15,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return InkWell(
|
||||||
|
onTap: () {
|
||||||
|
//TODO refactor the routing to use named routes
|
||||||
|
// Navigator.of(context).pushNamed(
|
||||||
|
// '/home_settings',
|
||||||
|
// arguments: spaces[index],
|
||||||
|
// );
|
||||||
|
|
||||||
|
Navigator.of(context).push(CustomPageRoute(
|
||||||
|
builder: (context) => HomeSettingsView(
|
||||||
|
space: spaces[index],
|
||||||
|
)));
|
||||||
|
},
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
BodyMedium(
|
||||||
|
text: HomeCubit.getInstance()
|
||||||
|
.spaces![index]
|
||||||
|
.name ??
|
||||||
|
""),
|
||||||
|
const Icon(
|
||||||
|
Icons.arrow_forward_ios,
|
||||||
|
color: ColorsManager.greyColor,
|
||||||
|
size: 15,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin:
|
||||||
|
const EdgeInsets.symmetric(vertical: 15),
|
||||||
|
height: 1,
|
||||||
|
color: ColorsManager.greyColor,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user