mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
Bug fixes
This commit is contained in:
@ -4,7 +4,6 @@ import 'package:syncrow_web/pages/access_management/bloc/access_event.dart';
|
||||
import 'package:syncrow_web/pages/access_management/bloc/access_state.dart';
|
||||
import 'package:syncrow_web/pages/access_management/model/password_model.dart';
|
||||
import 'package:syncrow_web/services/access_mang_api.dart';
|
||||
import 'package:syncrow_web/utils/color_manager.dart';
|
||||
import 'package:syncrow_web/utils/constants/app_enum.dart';
|
||||
import 'package:syncrow_web/utils/snack_bar.dart';
|
||||
|
||||
|
@ -36,18 +36,14 @@ class AccessManagementPage extends StatelessWidget {
|
||||
children: [
|
||||
Text(
|
||||
'Physical Access',
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.headlineMedium!
|
||||
.copyWith(color: Colors.white),
|
||||
style: Theme.of(context).textTheme.headlineMedium!.copyWith(color: Colors.white),
|
||||
),
|
||||
const NavigateHomeGridView(),
|
||||
],
|
||||
),
|
||||
],
|
||||
scaffoldBody: BlocProvider(
|
||||
create: (BuildContext context) =>
|
||||
AccessBloc()..add(FetchTableData()),
|
||||
create: (BuildContext context) => AccessBloc()..add(FetchTableData()),
|
||||
child: BlocConsumer<AccessBloc, AccessState>(
|
||||
listener: (context, state) {},
|
||||
builder: (context, state) {
|
||||
@ -56,7 +52,7 @@ class AccessManagementPage extends StatelessWidget {
|
||||
return state is AccessLoaded
|
||||
? const Center(child: CircularProgressIndicator())
|
||||
: Container(
|
||||
padding: EdgeInsets.all(30),
|
||||
padding: const EdgeInsets.all(30),
|
||||
height: size.height,
|
||||
width: size.width,
|
||||
child: Column(
|
||||
@ -65,64 +61,47 @@ class AccessManagementPage extends StatelessWidget {
|
||||
Container(
|
||||
decoration: containerDecoration,
|
||||
height: size.height * 0.05,
|
||||
child: Flexible(
|
||||
child: ListView.builder(
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemCount:
|
||||
child: ListView.builder(
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemCount: BlocProvider.of<AccessBloc>(context).tabs.length,
|
||||
shrinkWrap: true,
|
||||
itemBuilder: (context, index) {
|
||||
final isSelected =
|
||||
index == BlocProvider.of<AccessBloc>(context).selectedIndex;
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
BlocProvider.of<AccessBloc>(context)
|
||||
.tabs
|
||||
.length,
|
||||
shrinkWrap: true,
|
||||
itemBuilder: (context, index) {
|
||||
final isSelected = index ==
|
||||
BlocProvider.of<AccessBloc>(context)
|
||||
.selectedIndex;
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
BlocProvider.of<AccessBloc>(context)
|
||||
.add(TabChangedEvent(index));
|
||||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: ColorsManager.boxColor,
|
||||
border: Border.all(
|
||||
color: isSelected
|
||||
? Colors.blue
|
||||
: Colors.transparent,
|
||||
width: 2.0,
|
||||
),
|
||||
borderRadius: index == 0
|
||||
? const BorderRadius.only(
|
||||
topLeft:
|
||||
Radius.circular(10),
|
||||
bottomLeft:
|
||||
Radius.circular(10))
|
||||
: index == 3
|
||||
? const BorderRadius.only(
|
||||
topRight:
|
||||
Radius.circular(10),
|
||||
bottomRight:
|
||||
Radius.circular(10))
|
||||
: null,
|
||||
.add(TabChangedEvent(index));
|
||||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: ColorsManager.boxColor,
|
||||
border: Border.all(
|
||||
color: isSelected ? Colors.blue : Colors.transparent,
|
||||
width: 2.0,
|
||||
),
|
||||
padding: const EdgeInsets.only(
|
||||
left: 10, right: 10),
|
||||
child: Center(
|
||||
child: Text(
|
||||
BlocProvider.of<AccessBloc>(
|
||||
context)
|
||||
.tabs[index],
|
||||
style: TextStyle(
|
||||
color: isSelected
|
||||
? Colors.blue
|
||||
: Colors.black,
|
||||
),
|
||||
borderRadius: index == 0
|
||||
? const BorderRadius.only(
|
||||
topLeft: Radius.circular(10),
|
||||
bottomLeft: Radius.circular(10))
|
||||
: index == 3
|
||||
? const BorderRadius.only(
|
||||
topRight: Radius.circular(10),
|
||||
bottomRight: Radius.circular(10))
|
||||
: null,
|
||||
),
|
||||
padding: const EdgeInsets.only(left: 10, right: 10),
|
||||
child: Center(
|
||||
child: Text(
|
||||
BlocProvider.of<AccessBloc>(context).tabs[index],
|
||||
style: TextStyle(
|
||||
color: isSelected ? Colors.blue : Colors.black,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
@ -151,19 +130,13 @@ class AccessManagementPage extends StatelessWidget {
|
||||
title: 'Access Time',
|
||||
size: size,
|
||||
endTime: () {
|
||||
accessBloc.add(SelectTime(
|
||||
context: context, isStart: false));
|
||||
accessBloc.add(SelectTime(context: context, isStart: false));
|
||||
},
|
||||
startTime: () {
|
||||
accessBloc.add(SelectTime(
|
||||
context: context, isStart: true));
|
||||
accessBloc.add(SelectTime(context: context, isStart: true));
|
||||
},
|
||||
firstString:
|
||||
BlocProvider.of<AccessBloc>(context)
|
||||
.startTime,
|
||||
secondString:
|
||||
BlocProvider.of<AccessBloc>(context)
|
||||
.endTime,
|
||||
firstString: BlocProvider.of<AccessBloc>(context).startTime,
|
||||
secondString: BlocProvider.of<AccessBloc>(context).endTime,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 15,
|
||||
@ -175,17 +148,13 @@ class AccessManagementPage extends StatelessWidget {
|
||||
child: DefaultButton(
|
||||
onPressed: () {
|
||||
accessBloc.add(FilterDataEvent(
|
||||
selectedTabIndex: BlocProvider
|
||||
.of<AccessBloc>(
|
||||
context)
|
||||
selectedTabIndex: BlocProvider.of<AccessBloc>(
|
||||
context)
|
||||
.selectedIndex, // Pass the selected tab index
|
||||
passwordName: accessBloc
|
||||
.passwordName.text
|
||||
.toLowerCase(),
|
||||
startTime: accessBloc
|
||||
.effectiveTimeTimeStamp,
|
||||
endTime: accessBloc
|
||||
.expirationTimeTimeStamp));
|
||||
passwordName:
|
||||
accessBloc.passwordName.text.toLowerCase(),
|
||||
startTime: accessBloc.effectiveTimeTimeStamp,
|
||||
endTime: accessBloc.expirationTimeTimeStamp));
|
||||
},
|
||||
borderRadius: 9,
|
||||
child: const Text('Search'))),
|
||||
@ -201,8 +170,7 @@ class AccessManagementPage extends StatelessWidget {
|
||||
onPressed: () {
|
||||
accessBloc.add(ResetSearch());
|
||||
},
|
||||
backgroundColor:
|
||||
ColorsManager.whiteColors,
|
||||
backgroundColor: ColorsManager.whiteColors,
|
||||
borderRadius: 9,
|
||||
child: Text(
|
||||
'Reset',
|
||||
@ -239,8 +207,7 @@ class AccessManagementPage extends StatelessWidget {
|
||||
});
|
||||
},
|
||||
borderRadius: 8,
|
||||
child: const Text(
|
||||
'+ Create Visitor Password ')),
|
||||
child: const Text('+ Create Visitor Password ')),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
@ -250,8 +217,7 @@ class AccessManagementPage extends StatelessWidget {
|
||||
decoration: containerDecoration,
|
||||
child: DefaultButton(
|
||||
borderRadius: 8,
|
||||
backgroundColor:
|
||||
ColorsManager.whiteColors,
|
||||
backgroundColor: ColorsManager.whiteColors,
|
||||
child: Text(
|
||||
'Admin Password',
|
||||
style: Theme.of(context)
|
||||
|
@ -1,5 +1,4 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
abstract class AuthEvent extends Equatable {
|
||||
const AuthEvent();
|
||||
@ -47,8 +46,7 @@ class StopTimerEvent extends AuthEvent {}
|
||||
class UpdateTimerEvent extends AuthEvent {
|
||||
final int remainingTime;
|
||||
final bool isButtonEnabled;
|
||||
const UpdateTimerEvent(
|
||||
{required this.remainingTime, required this.isButtonEnabled});
|
||||
const UpdateTimerEvent({required this.remainingTime, required this.isButtonEnabled});
|
||||
}
|
||||
|
||||
class ChangePasswordEvent extends AuthEvent {}
|
||||
|
@ -56,8 +56,7 @@ class TimerState extends AuthState {
|
||||
final bool isButtonEnabled;
|
||||
final int remainingTime;
|
||||
|
||||
const TimerState(
|
||||
{required this.isButtonEnabled, required this.remainingTime});
|
||||
const TimerState({required this.isButtonEnabled, required this.remainingTime});
|
||||
|
||||
@override
|
||||
List<Object> get props => [isButtonEnabled, remainingTime];
|
||||
@ -65,12 +64,12 @@ class TimerState extends AuthState {
|
||||
|
||||
class AuthError extends AuthState {
|
||||
final String message;
|
||||
String? code;
|
||||
AuthError({required this.message, this.code});
|
||||
final String? code;
|
||||
const AuthError({required this.message, this.code});
|
||||
}
|
||||
|
||||
class AuthTokenError extends AuthError {
|
||||
AuthTokenError({required super.message, super.code});
|
||||
const AuthTokenError({required super.message, super.code});
|
||||
}
|
||||
|
||||
class AuthSuccess extends AuthState {}
|
||||
|
@ -1,5 +1,4 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:syncrow_web/pages/auth/view/forget_password_mobile_page.dart';
|
||||
import 'package:syncrow_web/pages/auth/view/forget_password_web_page.dart';
|
||||
import 'package:syncrow_web/utils/responsive_layout.dart';
|
||||
|
||||
@ -9,7 +8,6 @@ class ForgetPasswordPage extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const ResponsiveLayout(
|
||||
desktopBody: ForgetPasswordWebPage(),
|
||||
mobileBody: ForgetPasswordWebPage());
|
||||
desktopBody: ForgetPasswordWebPage(), mobileBody: ForgetPasswordWebPage());
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:syncrow_web/pages/auth/bloc/auth_bloc.dart';
|
||||
import 'package:syncrow_web/pages/auth/bloc/auth_event.dart';
|
||||
import 'package:syncrow_web/pages/auth/bloc/auth_state.dart';
|
||||
@ -11,7 +11,7 @@ import 'package:syncrow_web/pages/auth/view/forget_password_page.dart';
|
||||
import 'package:syncrow_web/pages/common/buttons/default_button.dart';
|
||||
import 'package:syncrow_web/utils/color_manager.dart';
|
||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||
import 'package:syncrow_web/pages/home/view/home_page.dart';
|
||||
import 'package:syncrow_web/utils/constants/routes_const.dart';
|
||||
import 'package:syncrow_web/utils/style.dart';
|
||||
|
||||
class LoginMobilePage extends StatelessWidget {
|
||||
@ -25,10 +25,7 @@ class LoginMobilePage extends StatelessWidget {
|
||||
listener: (context, state) {
|
||||
if (state is LoginSuccess) {
|
||||
// Navigate to home screen after successful login
|
||||
Navigator.pushReplacement(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => HomePage()),
|
||||
);
|
||||
context.go(RoutesConst.home, extra: {'clearHistory': true});
|
||||
} else if (state is LoginFailure) {
|
||||
// Show error message
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
@ -52,8 +49,6 @@ class LoginMobilePage extends StatelessWidget {
|
||||
|
||||
Widget _buildLoginForm(BuildContext context) {
|
||||
final loginBloc = BlocProvider.of<AuthBloc>(context);
|
||||
final TextEditingController _usernameController = TextEditingController();
|
||||
final TextEditingController _passwordController = TextEditingController();
|
||||
return Center(
|
||||
child: Stack(
|
||||
children: [
|
||||
@ -102,11 +97,8 @@ class LoginMobilePage extends StatelessWidget {
|
||||
padding: EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.1),
|
||||
borderRadius:
|
||||
const BorderRadius.all(Radius.circular(30)),
|
||||
border: Border.all(
|
||||
color:
|
||||
ColorsManager.graysColor.withOpacity(0.2))),
|
||||
borderRadius: const BorderRadius.all(Radius.circular(30)),
|
||||
border: Border.all(color: ColorsManager.graysColor.withOpacity(0.2))),
|
||||
child: Form(
|
||||
key: loginBloc.loginFormKey,
|
||||
child: Column(
|
||||
@ -117,9 +109,7 @@ class LoginMobilePage extends StatelessWidget {
|
||||
const Text(
|
||||
'Login',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.bold),
|
||||
color: Colors.white, fontSize: 24, fontWeight: FontWeight.bold),
|
||||
),
|
||||
const SizedBox(height: 30),
|
||||
Column(
|
||||
@ -148,8 +138,7 @@ class LoginMobilePage extends StatelessWidget {
|
||||
),
|
||||
isDense: true,
|
||||
style: const TextStyle(color: Colors.black),
|
||||
items: loginBloc.regionList!
|
||||
.map((RegionModel region) {
|
||||
items: loginBloc.regionList!.map((RegionModel region) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: region.name,
|
||||
child: Text(region.name),
|
||||
@ -173,8 +162,8 @@ class LoginMobilePage extends StatelessWidget {
|
||||
child: TextFormField(
|
||||
validator: loginBloc.validateEmail,
|
||||
controller: loginBloc.loginEmailController,
|
||||
decoration: textBoxDecoration()!
|
||||
.copyWith(hintText: 'Enter your email'),
|
||||
decoration:
|
||||
textBoxDecoration()!.copyWith(hintText: 'Enter your email'),
|
||||
style: const TextStyle(color: Colors.black),
|
||||
),
|
||||
),
|
||||
@ -194,8 +183,7 @@ class LoginMobilePage extends StatelessWidget {
|
||||
validator: loginBloc.validatePassword,
|
||||
obscureText: loginBloc.obscureText,
|
||||
keyboardType: TextInputType.visiblePassword,
|
||||
controller:
|
||||
loginBloc.loginPasswordController,
|
||||
controller: loginBloc.loginPasswordController,
|
||||
decoration: textBoxDecoration()!.copyWith(
|
||||
hintText: 'At least 8 characters',
|
||||
),
|
||||
@ -213,16 +201,13 @@ class LoginMobilePage extends StatelessWidget {
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Navigator.of(context)
|
||||
.push(MaterialPageRoute(
|
||||
builder: (context) =>
|
||||
const ForgetPasswordPage(),
|
||||
Navigator.of(context).push(MaterialPageRoute(
|
||||
builder: (context) => const ForgetPasswordPage(),
|
||||
));
|
||||
},
|
||||
child: Text(
|
||||
"Forgot Password?",
|
||||
style:
|
||||
Theme.of(context).textTheme.bodySmall,
|
||||
style: Theme.of(context).textTheme.bodySmall,
|
||||
),
|
||||
),
|
||||
],
|
||||
@ -233,15 +218,13 @@ class LoginMobilePage extends StatelessWidget {
|
||||
Transform.scale(
|
||||
scale: 1.2, // Adjust the scale as needed
|
||||
child: Checkbox(
|
||||
fillColor: MaterialStateProperty.all<Color>(
|
||||
Colors.white),
|
||||
fillColor: MaterialStateProperty.all<Color>(Colors.white),
|
||||
activeColor: Colors.white,
|
||||
value: loginBloc.isChecked,
|
||||
checkColor: Colors.black,
|
||||
shape: const CircleBorder(),
|
||||
onChanged: (bool? newValue) {
|
||||
loginBloc.add(
|
||||
CheckBoxEvent(newValue: newValue));
|
||||
loginBloc.add(CheckBoxEvent(newValue: newValue));
|
||||
},
|
||||
),
|
||||
),
|
||||
@ -250,37 +233,30 @@ class LoginMobilePage extends StatelessWidget {
|
||||
child: RichText(
|
||||
text: TextSpan(
|
||||
text: 'Agree to ',
|
||||
style:
|
||||
const TextStyle(color: Colors.white),
|
||||
style: const TextStyle(color: Colors.white),
|
||||
children: [
|
||||
TextSpan(
|
||||
text: '(Terms of Service)',
|
||||
style: const TextStyle(
|
||||
color: Colors.black),
|
||||
style: const TextStyle(color: Colors.black),
|
||||
recognizer: TapGestureRecognizer()
|
||||
..onTap = () {
|
||||
loginBloc.launchURL(
|
||||
'https://example.com/terms');
|
||||
loginBloc.launchURL('https://example.com/terms');
|
||||
},
|
||||
),
|
||||
TextSpan(
|
||||
text: ' (Legal Statement)',
|
||||
style: const TextStyle(
|
||||
color: Colors.black),
|
||||
style: const TextStyle(color: Colors.black),
|
||||
recognizer: TapGestureRecognizer()
|
||||
..onTap = () {
|
||||
loginBloc.launchURL(
|
||||
'https://example.com/legal');
|
||||
loginBloc.launchURL('https://example.com/legal');
|
||||
},
|
||||
),
|
||||
TextSpan(
|
||||
text: ' (Privacy Statement)',
|
||||
style: const TextStyle(
|
||||
color: Colors.black),
|
||||
style: const TextStyle(color: Colors.black),
|
||||
recognizer: TapGestureRecognizer()
|
||||
..onTap = () {
|
||||
loginBloc.launchURL(
|
||||
'https://example.com/privacy');
|
||||
loginBloc.launchURL('https://example.com/privacy');
|
||||
},
|
||||
),
|
||||
],
|
||||
@ -297,15 +273,12 @@ class LoginMobilePage extends StatelessWidget {
|
||||
: ColorsManager.grayColor,
|
||||
child: const Text('Sign in'),
|
||||
onPressed: () {
|
||||
if (loginBloc.loginFormKey.currentState!
|
||||
.validate()) {
|
||||
if (loginBloc.loginFormKey.currentState!.validate()) {
|
||||
loginBloc.add(
|
||||
LoginButtonPressed(
|
||||
regionUuid: '',
|
||||
username:
|
||||
loginBloc.loginEmailController.text,
|
||||
password: loginBloc
|
||||
.loginPasswordController.text,
|
||||
username: loginBloc.loginEmailController.text,
|
||||
password: loginBloc.loginPasswordController.text,
|
||||
),
|
||||
);
|
||||
}
|
||||
@ -320,8 +293,7 @@ class LoginMobilePage extends StatelessWidget {
|
||||
Flexible(
|
||||
child: Text(
|
||||
"Don't you have an account? ",
|
||||
style: TextStyle(
|
||||
color: Colors.white, fontSize: 13),
|
||||
style: TextStyle(color: Colors.white, fontSize: 13),
|
||||
)),
|
||||
Text(
|
||||
"Sign up",
|
||||
|
@ -10,6 +10,7 @@ import 'package:syncrow_web/pages/auth/model/region_model.dart';
|
||||
import 'package:syncrow_web/pages/auth/view/forget_password_page.dart';
|
||||
import 'package:syncrow_web/pages/common/buttons/default_button.dart';
|
||||
import 'package:syncrow_web/pages/common/first_layer.dart';
|
||||
import 'package:syncrow_web/pages/home/view/home_page.dart';
|
||||
import 'package:syncrow_web/utils/color_manager.dart';
|
||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||
import 'package:syncrow_web/utils/constants/routes_const.dart';
|
||||
@ -31,7 +32,7 @@ class _LoginWebPageState extends State<LoginWebPage> {
|
||||
child: BlocConsumer<AuthBloc, AuthState>(
|
||||
listener: (context, state) {
|
||||
if (state is LoginSuccess) {
|
||||
context.go(RoutesConst.home);
|
||||
context.replace(RoutesConst.home);
|
||||
} else if (state is LoginFailure) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
@ -201,7 +202,6 @@ class _LoginWebPageState extends State<LoginWebPage> {
|
||||
child: TextFormField(
|
||||
onChanged: (value) {
|
||||
loginBloc.add(CheckEnableEvent());
|
||||
// print(loginBloc.checkEnable());
|
||||
},
|
||||
validator: loginBloc.loginValidateEmail,
|
||||
controller: loginBloc.loginEmailController,
|
||||
|
@ -5,7 +5,7 @@ import 'package:syncrow_web/pages/device_managment/all_devices/models/devices_mo
|
||||
import 'package:syncrow_web/pages/device_managment/ceiling_sensor/view/ceiling_sensor_controls.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/door_lock/view/door_lock_status_view.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/gateway/view/gateway_view.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/living_room_switch/view/living_room_device_control.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/three_gang_switch/view/living_room_device_control.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/wall_sensor/view/wall_sensor_conrtols.dart';
|
||||
|
||||
mixin RouteControlsBasedCode {
|
||||
|
@ -4,7 +4,7 @@ import 'dart:async';
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/all_devices/models/device_status.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/living_room_switch/models/living_room_model.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/three_gang_switch/models/living_room_model.dart';
|
||||
import 'package:syncrow_web/services/devices_mang_api.dart';
|
||||
|
||||
part 'living_room_event.dart';
|
||||
@ -24,18 +24,15 @@ class LivingRoomBloc extends Bloc<LivingRoomEvent, LivingRoomState> {
|
||||
LivingRoomFetchDeviceStatus event, Emitter<LivingRoomState> emit) async {
|
||||
emit(LivingRoomDeviceStatusLoading());
|
||||
try {
|
||||
final status =
|
||||
await DevicesManagementApi().getDeviceStatus(event.deviceId);
|
||||
deviceStatus =
|
||||
LivingRoomStatusModel.fromJson(event.deviceId, status.status);
|
||||
final status = await DevicesManagementApi().getDeviceStatus(event.deviceId);
|
||||
deviceStatus = LivingRoomStatusModel.fromJson(event.deviceId, status.status);
|
||||
emit(LivingRoomDeviceStatusLoaded(deviceStatus));
|
||||
} catch (e) {
|
||||
emit(LivingRoomDeviceManagementError(e.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
FutureOr<void> _livingRoomControl(
|
||||
LivingRoomControl event, Emitter<LivingRoomState> emit) async {
|
||||
FutureOr<void> _livingRoomControl(LivingRoomControl event, Emitter<LivingRoomState> emit) async {
|
||||
final oldValue = _getValueByCode(event.code);
|
||||
|
||||
_updateLocalValue(event.code, event.value);
|
||||
@ -63,8 +60,8 @@ class LivingRoomBloc extends Bloc<LivingRoomEvent, LivingRoomState> {
|
||||
}
|
||||
_timer = Timer(const Duration(seconds: 1), () async {
|
||||
try {
|
||||
final response = await DevicesManagementApi()
|
||||
.deviceControl(deviceId, Status(code: code, value: value));
|
||||
final response =
|
||||
await DevicesManagementApi().deviceControl(deviceId, Status(code: code, value: value));
|
||||
if (!response) {
|
||||
_revertValueAndEmit(deviceId, code, oldValue, emit);
|
||||
}
|
||||
@ -74,8 +71,8 @@ class LivingRoomBloc extends Bloc<LivingRoomEvent, LivingRoomState> {
|
||||
});
|
||||
}
|
||||
|
||||
void _revertValueAndEmit(String deviceId, String code, dynamic oldValue,
|
||||
Emitter<LivingRoomState> emit) {
|
||||
void _revertValueAndEmit(
|
||||
String deviceId, String code, dynamic oldValue, Emitter<LivingRoomState> emit) {
|
||||
_updateLocalValue(code, oldValue);
|
||||
emit(LivingRoomDeviceStatusLoaded(deviceStatus));
|
||||
emit(const LivingRoomControlError('Failed to control the device.'));
|
@ -1,7 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/living_room_switch/widgets/cieling_light.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/living_room_switch/widgets/spot_light.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/living_room_switch/widgets/wall_light.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/three_gang_switch/widgets/cieling_light.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/three_gang_switch/widgets/spot_light.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/three_gang_switch/widgets/wall_light.dart';
|
||||
|
||||
mixin LivingRoomHelper {
|
||||
Widget livingRoomControlWidgets(
|
||||
@ -18,4 +18,3 @@ mixin LivingRoomHelper {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,11 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/living_room_switch/bloc/living_room_bloc.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/living_room_switch/models/living_room_model.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/living_room_switch/widgets/living_toggle_widget.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/three_gang_switch/bloc/living_room_bloc.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/three_gang_switch/models/living_room_model.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/three_gang_switch/widgets/living_toggle_widget.dart';
|
||||
import 'package:syncrow_web/utils/helpers/responsice_layout_helper/responsive_layout_helper.dart';
|
||||
|
||||
class LivingRoomDeviceControl extends StatelessWidget
|
||||
with HelperResponsiveLayout {
|
||||
class LivingRoomDeviceControl extends StatelessWidget with HelperResponsiveLayout {
|
||||
final String deviceId;
|
||||
|
||||
const LivingRoomDeviceControl({super.key, required this.deviceId});
|
||||
@ -14,16 +13,15 @@ class LivingRoomDeviceControl extends StatelessWidget
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => LivingRoomBloc(deviceId: deviceId)
|
||||
..add(LivingRoomFetchDeviceStatus(deviceId)),
|
||||
create: (context) =>
|
||||
LivingRoomBloc(deviceId: deviceId)..add(LivingRoomFetchDeviceStatus(deviceId)),
|
||||
child: BlocBuilder<LivingRoomBloc, LivingRoomState>(
|
||||
builder: (context, state) {
|
||||
if (state is LivingRoomDeviceStatusLoading) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
} else if (state is LivingRoomDeviceStatusLoaded) {
|
||||
return _buildStatusControls(context, state.status);
|
||||
} else if (state is LivingRoomDeviceManagementError ||
|
||||
state is LivingRoomControlError) {
|
||||
} else if (state is LivingRoomDeviceManagementError || state is LivingRoomControlError) {
|
||||
return const Center(child: Text('Error fetching status'));
|
||||
} else {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
@ -33,8 +31,7 @@ class LivingRoomDeviceControl extends StatelessWidget
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildStatusControls(
|
||||
BuildContext context, LivingRoomStatusModel status) {
|
||||
Widget _buildStatusControls(BuildContext context, LivingRoomStatusModel status) {
|
||||
final isExtraLarge = isExtraLargeScreenSize(context);
|
||||
final isLarge = isLargeScreenSize(context);
|
||||
final isMedium = isMediumScreenSize(context);
|
@ -2,16 +2,12 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/living_room_switch/bloc/living_room_bloc.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/three_gang_switch/bloc/living_room_bloc.dart';
|
||||
import 'package:syncrow_web/utils/color_manager.dart';
|
||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||
|
||||
class CeilingLight extends StatelessWidget {
|
||||
const CeilingLight(
|
||||
{super.key,
|
||||
required this.value,
|
||||
required this.code,
|
||||
required this.deviceId});
|
||||
const CeilingLight({super.key, required this.value, required this.code, required this.deviceId});
|
||||
|
||||
final bool value;
|
||||
final String code;
|
@ -2,7 +2,7 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/living_room_switch/bloc/living_room_bloc.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/three_gang_switch/bloc/living_room_bloc.dart';
|
||||
import 'package:syncrow_web/utils/color_manager.dart';
|
||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||
|
@ -2,16 +2,12 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/living_room_switch/bloc/living_room_bloc.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/three_gang_switch/bloc/living_room_bloc.dart';
|
||||
import 'package:syncrow_web/utils/color_manager.dart';
|
||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||
|
||||
class SpotLight extends StatelessWidget {
|
||||
const SpotLight(
|
||||
{super.key,
|
||||
required this.value,
|
||||
required this.code,
|
||||
required this.deviceId});
|
||||
const SpotLight({super.key, required this.value, required this.code, required this.deviceId});
|
||||
|
||||
final bool value;
|
||||
final String code;
|
@ -2,16 +2,12 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/living_room_switch/bloc/living_room_bloc.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/three_gang_switch/bloc/living_room_bloc.dart';
|
||||
import 'package:syncrow_web/utils/color_manager.dart';
|
||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||
|
||||
class WallLight extends StatelessWidget {
|
||||
const WallLight(
|
||||
{super.key,
|
||||
required this.value,
|
||||
required this.code,
|
||||
required this.deviceId});
|
||||
const WallLight({super.key, required this.value, required this.code, required this.deviceId});
|
||||
|
||||
final bool value;
|
||||
final String code;
|
@ -21,19 +21,17 @@ class WallSensorControls extends StatelessWidget with HelperResponsiveLayout {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final isExtraLarge = isExtraLargeScreenSize(context);
|
||||
final isLarge = isLargeScreenSize(context);
|
||||
final isMedium = isMediumScreenSize(context);
|
||||
return BlocProvider(
|
||||
create: (context) =>
|
||||
WallSensorBloc(deviceId: device.uuid!)..add(WallSensorInitialEvent()),
|
||||
create: (context) => WallSensorBloc(deviceId: device.uuid!)..add(WallSensorInitialEvent()),
|
||||
child: BlocBuilder<WallSensorBloc, WallSensorState>(
|
||||
builder: (context, state) {
|
||||
if (state is WallSensorLoadingInitialState ||
|
||||
state is DeviceReportsLoadingState) {
|
||||
if (state is WallSensorLoadingInitialState || state is DeviceReportsLoadingState) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
} else if (state is WallSensorUpdateState) {
|
||||
return _buildGridView(
|
||||
context, state.wallSensorModel, isLarge, isMedium);
|
||||
return _buildGridView(context, state.wallSensorModel, isExtraLarge, isLarge, isMedium);
|
||||
} else if (state is DeviceReportsState) {
|
||||
return ReportsTable(
|
||||
report: state.deviceReport,
|
||||
@ -51,7 +49,7 @@ class WallSensorControls extends StatelessWidget with HelperResponsiveLayout {
|
||||
);
|
||||
} else if (state is DeviceReportsFailedState) {
|
||||
final model = context.read<WallSensorBloc>().deviceStatus;
|
||||
return _buildGridView(context, model, isLarge, isMedium);
|
||||
return _buildGridView(context, model, isExtraLarge, isLarge, isMedium);
|
||||
}
|
||||
return const Center(child: Text('Error fetching status'));
|
||||
},
|
||||
@ -59,14 +57,14 @@ class WallSensorControls extends StatelessWidget with HelperResponsiveLayout {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildGridView(BuildContext context, WallSensorModel model,
|
||||
bool isLarge, bool isMedium) {
|
||||
Widget _buildGridView(
|
||||
BuildContext context, WallSensorModel model, bool isExtraLarge, bool isLarge, bool isMedium) {
|
||||
return GridView(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 50),
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: isLarge
|
||||
crossAxisCount: isLarge || isExtraLarge
|
||||
? 3
|
||||
: isMedium
|
||||
? 2
|
||||
@ -129,11 +127,10 @@ class WallSensorControls extends StatelessWidget with HelperResponsiveLayout {
|
||||
maxValue: 10000,
|
||||
steps: 1,
|
||||
description: 'hr',
|
||||
action: (int value) =>
|
||||
context.read<WallSensorBloc>().add(WallSensorChangeValueEvent(
|
||||
code: 'no_one_time',
|
||||
value: value,
|
||||
))),
|
||||
action: (int value) => context.read<WallSensorBloc>().add(WallSensorChangeValueEvent(
|
||||
code: 'no_one_time',
|
||||
value: value,
|
||||
))),
|
||||
PresenceUpdateData(
|
||||
value: model.farDetection.toDouble(),
|
||||
title: 'Far Detection:',
|
||||
@ -150,8 +147,9 @@ class WallSensorControls extends StatelessWidget with HelperResponsiveLayout {
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
context.read<WallSensorBloc>().add(GetDeviceReportsEvent(
|
||||
code: 'illuminance_value', deviceUuid: device.uuid!));
|
||||
context
|
||||
.read<WallSensorBloc>()
|
||||
.add(GetDeviceReportsEvent(code: 'illuminance_value', deviceUuid: device.uuid!));
|
||||
},
|
||||
child: const PresenceStaticWidget(
|
||||
icon: Assets.illuminanceRecordIcon,
|
||||
@ -160,8 +158,9 @@ class WallSensorControls extends StatelessWidget with HelperResponsiveLayout {
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
context.read<WallSensorBloc>().add(GetDeviceReportsEvent(
|
||||
code: 'presence_state', deviceUuid: device.uuid!));
|
||||
context
|
||||
.read<WallSensorBloc>()
|
||||
.add(GetDeviceReportsEvent(code: 'presence_state', deviceUuid: device.uuid!));
|
||||
},
|
||||
child: const PresenceStaticWidget(
|
||||
icon: Assets.presenceRecordIcon,
|
||||
|
@ -39,11 +39,10 @@ class HomeBloc extends Bloc<HomeEvent, HomeState> {
|
||||
emit(HomeUpdateTree(graph: graph, builder: builder));
|
||||
}
|
||||
|
||||
Future fetchUserInfo() async {
|
||||
static Future fetchUserInfo() async {
|
||||
try {
|
||||
var uuid = await const FlutterSecureStorage().read(key: UserModel.userUuidKey);
|
||||
user = await HomeApi().fetchUserInfo(uuid);
|
||||
emit(HomeUserInfoLoaded(user!)); // Emit state after fetching user info
|
||||
} catch (e) {
|
||||
return;
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:graphview/GraphView.dart';
|
||||
import 'package:syncrow_web/pages/auth/model/user_model.dart';
|
||||
|
||||
abstract class HomeState extends Equatable {
|
||||
const HomeState();
|
||||
@ -25,9 +24,3 @@ class HomeUpdateTree extends HomeState {
|
||||
@override
|
||||
List<Object> get props => [graph, builder];
|
||||
}
|
||||
|
||||
class HomeUserInfoLoaded extends HomeState {
|
||||
final UserModel user;
|
||||
|
||||
HomeUserInfoLoaded(this.user);
|
||||
}
|
||||
|
@ -8,6 +8,6 @@ class HomePage extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ResponsiveLayout(desktopBody: HomeWebPage(), mobileBody: HomeMobilePage());
|
||||
return ResponsiveLayout(desktopBody: const HomeWebPage(), mobileBody: HomeMobilePage());
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ 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/bloc/home_state.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';
|
||||
@ -22,51 +23,51 @@ class HomeMobilePage extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
scaffoldBody: BlocProvider(
|
||||
create: (context) => HomeBloc(),
|
||||
child: SizedBox(
|
||||
height: size.height,
|
||||
width: size.width,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(height: size.height * 0.05),
|
||||
const Text(
|
||||
'ACCESS YOUR APPS',
|
||||
style: TextStyle(fontSize: 20, 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: 2,
|
||||
crossAxisSpacing: 20.0,
|
||||
mainAxisSpacing: 20.0,
|
||||
childAspectRatio: 1.5,
|
||||
),
|
||||
itemBuilder: (context, index) {
|
||||
return HomeCard(
|
||||
index: index,
|
||||
active: homeItems[index]['active'],
|
||||
name: homeItems[index]['title'],
|
||||
img: homeItems[index]['icon'],
|
||||
onTap: () {},
|
||||
);
|
||||
},
|
||||
scaffoldBody: BlocConsumer<HomeBloc, HomeState>(
|
||||
listener: (context, state) {},
|
||||
builder: (context, state) {
|
||||
return SizedBox(
|
||||
height: size.height,
|
||||
width: size.width,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(height: size.height * 0.05),
|
||||
const Text(
|
||||
'ACCESS YOUR APPS',
|
||||
style: TextStyle(fontSize: 20, 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: 2,
|
||||
crossAxisSpacing: 20.0,
|
||||
mainAxisSpacing: 20.0,
|
||||
childAspectRatio: 1.5,
|
||||
),
|
||||
itemBuilder: (context, index) {
|
||||
return HomeCard(
|
||||
index: index,
|
||||
active: homeItems[index]['active'],
|
||||
name: homeItems[index]['title'],
|
||||
img: homeItems[index]['icon'],
|
||||
onTap: () {},
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -8,78 +8,72 @@ import 'package:syncrow_web/utils/constants/assets.dart';
|
||||
import 'package:syncrow_web/web_layout/web_scaffold.dart';
|
||||
|
||||
class HomeWebPage extends StatelessWidget {
|
||||
HomeWebPage({super.key});
|
||||
const HomeWebPage({super.key});
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Size size = MediaQuery.of(context).size;
|
||||
return PopScope(
|
||||
canPop: false,
|
||||
onPopInvoked: (didPop) => false,
|
||||
child:
|
||||
WebScaffold(
|
||||
enableMenuSideba: false,
|
||||
appBarTitle: Row(
|
||||
children: [
|
||||
SvgPicture.asset(
|
||||
Assets.loginLogo,
|
||||
width: 150,
|
||||
child: WebScaffold(
|
||||
enableMenuSideba: false,
|
||||
appBarTitle: Row(
|
||||
children: [
|
||||
SvgPicture.asset(
|
||||
Assets.loginLogo,
|
||||
width: 150,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
scaffoldBody: BlocProvider(
|
||||
create: (context) => HomeBloc(),
|
||||
child: BlocConsumer<HomeBloc, HomeState>(
|
||||
listener: (BuildContext context, state) {},
|
||||
builder: (context, state) {
|
||||
final homeBloc = BlocProvider.of<HomeBloc>(context);
|
||||
return SizedBox(
|
||||
height: size.height,
|
||||
width: size.width,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(height: size.height * 0.1),
|
||||
Text(
|
||||
'ACCESS YOUR APPS',
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.headlineLarge!
|
||||
.copyWith(color: Colors.black, fontSize: 40),
|
||||
),
|
||||
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,
|
||||
scaffoldBody: BlocConsumer<HomeBloc, HomeState>(
|
||||
listener: (BuildContext context, state) {},
|
||||
builder: (context, state) {
|
||||
final homeBloc = BlocProvider.of<HomeBloc>(context);
|
||||
return SizedBox(
|
||||
height: size.height,
|
||||
width: size.width,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(height: size.height * 0.1),
|
||||
Text(
|
||||
'ACCESS YOUR APPS',
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.headlineLarge!
|
||||
.copyWith(color: Colors.black, fontSize: 40),
|
||||
),
|
||||
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: homeBloc.homeItems[index].active!,
|
||||
name: homeBloc.homeItems[index].title!,
|
||||
img: homeBloc.homeItems[index].icon!,
|
||||
onTap: () => homeBloc.homeItems[index].onPress(context),
|
||||
);
|
||||
},
|
||||
),
|
||||
itemBuilder: (context, index) {
|
||||
return HomeCard(
|
||||
index: index,
|
||||
active: homeBloc.homeItems[index].active!,
|
||||
name: homeBloc.homeItems[index].title!,
|
||||
img: homeBloc.homeItems[index].icon!,
|
||||
onTap: () =>
|
||||
homeBloc.homeItems[index].onPress(context),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
)));
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
)));
|
||||
}
|
||||
}
|
||||
|
@ -205,7 +205,6 @@ class VisitorPasswordBloc extends Bloc<VisitorPasswordEvent, VisitorPasswordStat
|
||||
} on DioException catch (e) {
|
||||
final errorData = e.response!.data;
|
||||
String errorMessage = errorData['message'];
|
||||
print('errorMessage==$errorData');
|
||||
emit(FailedState(errorMessage.toString()));
|
||||
}
|
||||
}
|
||||
@ -239,7 +238,6 @@ class VisitorPasswordBloc extends Bloc<VisitorPasswordEvent, VisitorPasswordStat
|
||||
} on DioException catch (e) {
|
||||
final errorData = e.response!.data;
|
||||
String errorMessage = errorData['message'];
|
||||
print('errorMessage==$errorData');
|
||||
emit(FailedState(errorMessage.toString()));
|
||||
}
|
||||
}
|
||||
@ -260,7 +258,6 @@ class VisitorPasswordBloc extends Bloc<VisitorPasswordEvent, VisitorPasswordStat
|
||||
} on DioException catch (e) {
|
||||
final errorData = e.response!.data;
|
||||
String errorMessage = errorData['message'];
|
||||
print('errorMessage==$errorData');
|
||||
emit(FailedState(errorMessage.toString()));
|
||||
}
|
||||
}
|
||||
@ -285,7 +282,6 @@ class VisitorPasswordBloc extends Bloc<VisitorPasswordEvent, VisitorPasswordStat
|
||||
} on DioException catch (e) {
|
||||
final errorData = e.response!.data;
|
||||
String errorMessage = errorData['message'];
|
||||
print('errorMessage==$errorData');
|
||||
emit(FailedState(errorMessage.toString()));
|
||||
}
|
||||
}
|
||||
@ -322,7 +318,7 @@ class VisitorPasswordBloc extends Bloc<VisitorPasswordEvent, VisitorPasswordStat
|
||||
void filterDevices() {
|
||||
final deviceName = deviceNameController.text.toLowerCase();
|
||||
final deviceId = deviceIdController.text.toLowerCase();
|
||||
final unitName = unitNameController.text.toLowerCase();
|
||||
// final unitName = unitNameController.text.toLowerCase();
|
||||
final filteredData = data.where((device) {
|
||||
final matchesDeviceName = device.name.toLowerCase().contains(deviceName);
|
||||
final matchesDeviceId = device.uuid.toLowerCase().contains(deviceId);
|
||||
@ -332,7 +328,6 @@ class VisitorPasswordBloc extends Bloc<VisitorPasswordEvent, VisitorPasswordStat
|
||||
add(UpdateFilteredDevicesEvent(filteredData));
|
||||
}
|
||||
|
||||
@override
|
||||
Stream<VisitorPasswordState> mapEventToState(VisitorPasswordEvent event) async* {
|
||||
if (event is FetchDevice) {
|
||||
} else if (event is UpdateFilteredDevicesEvent) {
|
||||
@ -417,7 +412,6 @@ class VisitorPasswordBloc extends Bloc<VisitorPasswordEvent, VisitorPasswordStat
|
||||
DateTime dateTime = inputFormat.parse(dateTimeString);
|
||||
return dateTime;
|
||||
} catch (e) {
|
||||
print("Error parsing date: $e");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -529,7 +529,6 @@ class VisitorPasswordDialog extends StatelessWidget {
|
||||
visitorBloc.accessTypeSelected == 'Offline Password') {
|
||||
setPasswordFunction(context, size, visitorBloc);
|
||||
} else if (visitorBloc.accessTypeSelected == 'Dynamic Password') {
|
||||
print('objectobjectobjectobject');
|
||||
setPasswordFunction(context, size, visitorBloc);
|
||||
} else {
|
||||
if (visitorBloc.effectiveTimeTimeStamp != null &&
|
||||
|
@ -123,13 +123,6 @@ class AccessMangApi {
|
||||
String? effectiveTime,
|
||||
String? invalidTime,
|
||||
List<String>? devicesUuid}) async {
|
||||
print(jsonEncode({
|
||||
"email": email,
|
||||
"devicesUuid": devicesUuid,
|
||||
"passwordName": passwordName,
|
||||
"effectiveTime": effectiveTime,
|
||||
"invalidTime": invalidTime,
|
||||
}));
|
||||
final response = await HTTPService().post(
|
||||
path: ApiEndpoints.sendOffLineMultipleTime,
|
||||
body: jsonEncode({
|
||||
|
@ -1,5 +1,5 @@
|
||||
class RoutesConst {
|
||||
static const String auth = '/';
|
||||
static const String auth = '/auth';
|
||||
static const String home = '/home';
|
||||
static const String visitorPassword = '/visitor-password';
|
||||
static const String accessManagementPage = '/access-management-page';
|
||||
|
Reference in New Issue
Block a user