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

@ -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,
},
];
}