Added Create Home Page

This commit is contained in:
Mohammad Salameh
2024-04-23 16:53:41 +03:00
parent 6050fa745f
commit 3a41a7118d
5 changed files with 132 additions and 3 deletions

View File

@ -2,6 +2,7 @@ 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/home%20management/create_home_view.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';
@ -86,7 +87,7 @@ List<Map<String, Object>> menuSections = [
{
'title': 'Create a Home',
'Icon': Assets.homeManagementIconsCreateHome,
'page': null
'page': const CreateHomeView()
},
{
'title': 'Join a Home',

View File

@ -0,0 +1,124 @@
// ignore_for_file: unnecessary_const
import 'package:flutter/material.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/features/shared_widgets/text_widgets/title_medium.dart';
import 'package:syncrow_app/utils/context_extension.dart';
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
class CreateHomeView extends StatelessWidget {
const CreateHomeView({super.key});
@override
Widget build(BuildContext context) {
return DefaultScaffold(
actions: [
TextButton(
onPressed: () {},
child: const BodyLarge(
text: 'Save',
fontWeight: FontWeight.bold,
),
),
],
title: 'Create Home',
child: Column(
children: [
//Home Info
DefaultContainer(
padding: const EdgeInsets.symmetric(
horizontal: 25,
vertical: 5,
),
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const BodyMedium(text: 'Home Name '),
Flexible(
child: TextField(
textAlign: TextAlign.end,
decoration: InputDecoration(
hintText: 'Enter Name',
hintStyle:
context.bodyMedium.copyWith(color: Colors.grey),
border: InputBorder.none,
),
),
),
],
),
Container(
height: 1,
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,
),
),
),
],
),
],
),
),
//Rooms Info
const SizedBox(height: 10),
const Row(
children: [
SizedBox(
width: 25,
),
BodySmall(
text: 'Rooms',
fontWeight: FontWeight.bold,
),
],
),
DefaultContainer(
padding: const EdgeInsets.symmetric(
horizontal: 25,
vertical: 5,
),
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start,
children: [
TextButton(
onPressed: () {
//TODO add room
},
child: const Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
BodyMedium(
text: 'Add Room',
fontColor: ColorsManager.primaryColor,
),
],
))
],
),
),
],
),
);
}
}

View File

@ -19,6 +19,7 @@ class MenuListItem extends StatelessWidget {
Widget build(BuildContext context) {
return InkWell(
onTap: () {
debugPrint('clicked $title page: $page');
if (page == null) {
return;
}

View File

@ -8,10 +8,12 @@ import 'package:syncrow_app/utils/resource_manager/constants.dart';
import 'package:syncrow_app/utils/resource_manager/font_manager.dart';
class DefaultScaffold extends StatelessWidget {
const DefaultScaffold({super.key, required this.child, this.title});
const DefaultScaffold(
{super.key, required this.child, this.title, this.actions});
final Widget child;
final String? title;
final List<Widget>? actions;
@override
Widget build(BuildContext context) {
return AnnotatedRegion(
@ -32,6 +34,7 @@ class DefaultScaffold extends StatelessWidget {
fontColor: ColorsManager.primaryColor,
fontWeight: FontsManager.bold,
),
actions: actions,
),
body: Container(
width: MediaQuery.sizeOf(context).width,

View File

@ -9,7 +9,7 @@ import 'package:syncrow_app/features/auth/view/widgets/user_agreement/user_agree
import 'package:syncrow_app/features/dashboard/view/dashboard_view.dart';
import 'package:syncrow_app/features/layout/view/layout_view.dart';
import 'package:syncrow_app/features/menu/view/menu_view.dart';
import 'package:syncrow_app/features/profile/view/profile_view.dart';
import 'package:syncrow_app/features/menu/view/widgets/profile/profile_view.dart';
import 'package:syncrow_app/features/scene/view/scene_view.dart';
import 'package:syncrow_app/features/splash/view/splash_view.dart';