Home page UI

This commit is contained in:
mohammad
2024-08-01 15:21:29 +03:00
parent 09dc49b630
commit a3805d62ec
17 changed files with 317 additions and 43 deletions

View File

@ -38,7 +38,7 @@ class MyApp extends StatelessWidget {
useMaterial3: true, // Enable Material 3
),
home: isLoggedIn == 'Success'?
const HomePage()
HomePage()
:
const LoginPage(),
);

View File

@ -27,7 +27,7 @@ class LoginMobilePage extends StatelessWidget {
// Navigate to home screen after successful login
Navigator.pushReplacement(
context,
MaterialPageRoute(builder: (context) => const HomePage()),
MaterialPageRoute(builder: (context) => HomePage()),
);
} else if (state is LoginFailure) {
// Show error message

View File

@ -29,7 +29,7 @@ class LoginWebPage extends StatelessWidget {
// Navigate to home screen after successful login
Navigator.pushReplacement(
context,
MaterialPageRoute(builder: (context) => const HomePage()),
MaterialPageRoute(builder: (context) => HomePage()),
);
} else if (state is LoginFailure) {
// Show error message

View File

@ -0,0 +1,73 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import '../../../utils/color_manager.dart';
class HomeCard extends StatelessWidget {
final bool active;
final String img;
final int index;
final String name;
final Function()? onTap;
const HomeCard({
super.key,
required this.name,
required this.index,
this.active = false,
required this.img,
required this.onTap,
});
@override
Widget build(BuildContext context) {
bool evenNumbers = index % 2 == 0;
return InkWell(
onTap: active ? onTap : null,
child: Container(
padding: const EdgeInsets.only(left: 10, bottom: 10),
decoration: BoxDecoration(
color: evenNumbers&&active?
ColorsManager.blueColor.withOpacity(0.8) :
(active ?ColorsManager.blueColor
: ColorsManager.blueColor.withOpacity(0.2)),
borderRadius: BorderRadius.circular(30),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
FittedBox(
fit: BoxFit.scaleDown,
child: Text(
name,
style: const TextStyle(
fontSize: 20,
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
),
],
),
),
const SizedBox(height: 10),
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
SizedBox(
child: SvgPicture.asset(
img,
),
),
],
),
),
],
),
),
);
}
}

View File

@ -1,30 +1,119 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_svg/svg.dart';
import 'package:syncrow_web/pages/home/bloc/home_bloc.dart';
import 'package:syncrow_web/pages/home/view/tree_page.dart';
import 'package:syncrow_web/utils/style.dart';
import 'package:syncrow_web/pages/home/view/home_card.dart';
import 'package:syncrow_web/utils/color_manager.dart';
import 'package:syncrow_web/utils/constants/assets.dart';
import 'package:syncrow_web/web_layout/web_scaffold.dart';
class HomePage extends StatelessWidget {
const HomePage({super.key});
HomePage({super.key});
@override
Widget build(BuildContext context) {
return WebScaffold(
appBarTitle: 'Space Management',
appBarBody:[
Text(
'Community structure',
style: appBarTextStyle,
),
Text(
'Community ',
style: appBarTextStyle
),
],
Size size = MediaQuery.of(context).size;
return WebScaffold(
enableMenuSideba:false ,
appBarTitle: Row(
children: [
SvgPicture.asset(
Assets.loginLogo,
width: 150,
),
],
),
scaffoldBody: BlocProvider(
create: (context) => HomeBloc(),
child: const TreeWidget(),
child: SizedBox(
height: size.height,
width: size.width,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(height: size.height * 0.1),
const Text(
'ACCESS YOUR APPS',
style: TextStyle(fontSize: 40, fontWeight: FontWeight.w700),
),
const SizedBox(height: 30),
Expanded(
flex: 4,
child: SizedBox(
height: size.height * 0.6,
width: size.width * 0.68,
child: GridView.builder(
itemCount: 8,
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 4,
crossAxisSpacing: 20.0,
mainAxisSpacing: 20.0,
childAspectRatio: 1.5,
),
itemBuilder: (context, index) {
return HomeCard(
index:index,
active:ceilingSensorButtons[index]['active'],
name: ceilingSensorButtons[index]['title'],
img:ceilingSensorButtons[index]['icon'] ,
onTap: () {
},);
},
),
),
),
],
),
),
),
);
}
dynamic ceilingSensorButtons =
[
{
'title': 'Access',
'icon': Assets.accessIcon,
'active': true,
},
{
'title': 'Space Management',
'icon': Assets.spaseManagementIcon,
'color': ColorsManager.primaryColor,
'active': true,
},
{
'title': 'Devices',
'icon':Assets.devicesIcon,
'active': true,
},
{
'title': 'Move in',
'icon': Assets.moveinIcon,
'active': false,
},
{
'title': 'Construction',
'icon': Assets.constructionIcon,
'active': false,
},
{
'title': 'Energy',
'icon': Assets.energyIcon,
'color': ColorsManager.slidingBlueColor.withOpacity(0.2),
'active': false,
},
{
'title': 'Integrations',
'icon': Assets.integrationsIcon,
'color': ColorsManager.slidingBlueColor.withOpacity(0.2),
'active': false,
}, {
'title': 'Asset',
'icon': Assets.assetIcon,
'color': ColorsManager.slidingBlueColor.withOpacity(0.2),
'active': false,
},
];
}

View File

@ -28,4 +28,5 @@ abstract class ColorsManager {
static const Color graysColor = Color(0xffEBEBEB);
static const Color textGray = Color(0xffD5D5D5);
static const Color btnColor = Color(0xFF00008B);
static const Color blueColor = Color(0xFF0036E6);
}

View File

@ -15,4 +15,12 @@ class Assets {
static const String facebook = "assets/images/facebook.svg";
static const String invisiblePassword = "assets/images/Password_invisible.svg";
static const String visiblePassword = "assets/images/Password_visible.svg";
static const String accessIcon = "assets/images/access_icon.svg";
static const String spaseManagementIcon = "assets/images/spase_management_icon.svg";
static const String devicesIcon = "assets/images/devices_icon.svg";
static const String moveinIcon = "assets/images/movein_icon.svg";
static const String constructionIcon = "assets/images/construction_icon.svg";
static const String energyIcon = "assets/images/energy_icon.svg";
static const String integrationsIcon = "assets/images/Integrations_icon.svg";
static const String assetIcon = "assets/images/asset_icon.svg";
}

View File

@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:syncrow_web/utils/color_manager.dart';
class WebAppBar extends StatelessWidget {
final String? title;
final Widget? title;
final List<Widget>? body;
const WebAppBar({super.key,this.title,this.body});
@ -16,11 +16,13 @@ class WebAppBar extends StatelessWidget {
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Text(
title!,style: const TextStyle(
fontSize: 30,
color: Colors.white),)
SizedBox(width: 40,),
Expanded(
child: title!
// Text(
// title!,style: const TextStyle(
// fontSize: 30,
// color: Colors.white),)
),
if (body != null)
Expanded(
@ -30,26 +32,26 @@ class WebAppBar extends StatelessWidget {
children: body!,
),
),
Row(
const Row(
children: [
IconButton(onPressed: () {},
icon: const Icon(Icons.apps_sharp,color: Colors.white,)),
const SizedBox(width: 10,),
const SizedBox.square(
dimension: 40,
child: CircleAvatar(
backgroundColor: Colors.white,
child: SizedBox.square(
dimension: 35,
child: CircleAvatar(
backgroundColor: Colors.grey,
child: FlutterLogo(),
),
),
),
),
SizedBox(width: 10,),
SizedBox.square(
dimension: 40,
child: CircleAvatar(
backgroundColor: Colors.white,
child: SizedBox.square(
dimension: 35,
child: CircleAvatar(
backgroundColor: Colors.grey,
child: FlutterLogo(),
),
),
),
),
const SizedBox(width: 10,),
const Text('mohamamd alnemer ',style: TextStyle(fontSize: 16,color: Colors.white),),
Icon(Icons.arrow_drop_down,color: ColorsManager.whiteColors,),
SizedBox(width: 40,)
],
)
],

View File

@ -6,7 +6,7 @@ import 'menu_sidebar.dart';
class WebScaffold extends StatelessWidget {
final bool enableMenuSideba;
final String? appBarTitle;
final Widget? appBarTitle;
final List<Widget>? appBarBody;
final Widget? scaffoldBody;
const WebScaffold({super.key,this.appBarTitle,this.appBarBody,this.scaffoldBody,this.enableMenuSideba=true});
@ -24,6 +24,7 @@ class WebScaffold extends StatelessWidget {
fit: BoxFit.cover,
),
),
Container(color: Colors.white.withOpacity(0.7),),
Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [