mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-09 22:57:21 +00:00
@ -11,7 +11,7 @@ import 'package:syncrow_web/pages/common/filter/filter_widget.dart';
|
||||
import 'package:syncrow_web/pages/common/text_field/custom_web_textfield.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/navigate_home_grid_view.dart';
|
||||
import 'package:syncrow_web/pages/visitor_password/view/visitor_password_dialog.dart';
|
||||
import 'package:syncrow_web/utils/color_manager.dart';
|
||||
// import 'package:syncrow_web/utils/color_manager.dart';
|
||||
import 'package:syncrow_web/utils/constants/app_enum.dart';
|
||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||
import 'package:syncrow_web/utils/extension/build_context_x.dart';
|
||||
@ -27,8 +27,7 @@ class AccessManagementPage extends StatelessWidget with HelperResponsiveLayout {
|
||||
final isLargeScreen = isLargeScreenSize(context);
|
||||
final isSmallScreen = isSmallScreenSize(context);
|
||||
final isHalfMediumScreen = isHafMediumScreenSize(context);
|
||||
final padding =
|
||||
isLargeScreen ? const EdgeInsets.all(30) : const EdgeInsets.all(15);
|
||||
final padding = isLargeScreen ? const EdgeInsets.all(30) : const EdgeInsets.all(15);
|
||||
|
||||
return WebScaffold(
|
||||
enableMenuSidebar: false,
|
||||
@ -40,8 +39,7 @@ class AccessManagementPage extends StatelessWidget with HelperResponsiveLayout {
|
||||
),
|
||||
rightBody: 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) {
|
||||
@ -95,14 +93,11 @@ class AccessManagementPage extends StatelessWidget with HelperResponsiveLayout {
|
||||
return [
|
||||
item.passwordName,
|
||||
item.passwordType.value,
|
||||
accessBloc
|
||||
.timestampToDate(item.effectiveTime),
|
||||
accessBloc
|
||||
.timestampToDate(item.invalidTime),
|
||||
accessBloc.timestampToDate(item.effectiveTime),
|
||||
accessBloc.timestampToDate(item.invalidTime),
|
||||
item.deviceName.toString(),
|
||||
item.authorizerEmail.toString(),
|
||||
accessBloc
|
||||
.timestampToDate(item.invalidTime),
|
||||
accessBloc.timestampToDate(item.invalidTime),
|
||||
item.passwordStatus.value,
|
||||
];
|
||||
}).toList(),
|
||||
@ -113,8 +108,7 @@ class AccessManagementPage extends StatelessWidget with HelperResponsiveLayout {
|
||||
})));
|
||||
}
|
||||
|
||||
Wrap _buildVisitorAdminPasswords(
|
||||
BuildContext context, AccessBloc accessBloc) {
|
||||
Wrap _buildVisitorAdminPasswords(BuildContext context, AccessBloc accessBloc) {
|
||||
return Wrap(
|
||||
spacing: 10,
|
||||
runSpacing: 10,
|
||||
@ -140,23 +134,22 @@ class AccessManagementPage extends StatelessWidget with HelperResponsiveLayout {
|
||||
borderRadius: 8,
|
||||
child: Text(
|
||||
'Create Visitor Password ',
|
||||
style: context.textTheme.titleSmall!
|
||||
.copyWith(color: Colors.white, fontSize: 12),
|
||||
)),
|
||||
),
|
||||
Container(
|
||||
width: 133,
|
||||
height: 42,
|
||||
decoration: containerDecoration,
|
||||
child: DefaultButton(
|
||||
borderRadius: 8,
|
||||
backgroundColor: ColorsManager.whiteColors,
|
||||
child: Text(
|
||||
'Admin Password',
|
||||
style: context.textTheme.titleSmall!
|
||||
.copyWith(color: Colors.black, fontSize: 12),
|
||||
style: context.textTheme.titleSmall!.copyWith(color: Colors.white, fontSize: 12),
|
||||
)),
|
||||
),
|
||||
// Container(
|
||||
// width: 133,
|
||||
// height: 42,
|
||||
// decoration: containerDecoration,
|
||||
// child: DefaultButton(
|
||||
// borderRadius: 8,
|
||||
// backgroundColor: ColorsManager.whiteColors,
|
||||
// child: Text(
|
||||
// 'Admin Password',
|
||||
// style: context.textTheme.titleSmall!
|
||||
// .copyWith(color: Colors.black, fontSize: 12),
|
||||
// )),
|
||||
// ),
|
||||
],
|
||||
);
|
||||
}
|
||||
@ -179,10 +172,8 @@ class AccessManagementPage extends StatelessWidget with HelperResponsiveLayout {
|
||||
description: '',
|
||||
onSubmitted: (value) {
|
||||
accessBloc.add(FilterDataEvent(
|
||||
emailAuthorizer:
|
||||
accessBloc.emailAuthorizer.text.toLowerCase(),
|
||||
selectedTabIndex:
|
||||
BlocProvider.of<AccessBloc>(context).selectedIndex,
|
||||
emailAuthorizer: accessBloc.emailAuthorizer.text.toLowerCase(),
|
||||
selectedTabIndex: BlocProvider.of<AccessBloc>(context).selectedIndex,
|
||||
passwordName: accessBloc.passwordName.text.toLowerCase(),
|
||||
startTime: accessBloc.effectiveTimeTimeStamp,
|
||||
endTime: accessBloc.expirationTimeTimeStamp));
|
||||
@ -200,10 +191,8 @@ class AccessManagementPage extends StatelessWidget with HelperResponsiveLayout {
|
||||
description: '',
|
||||
onSubmitted: (value) {
|
||||
accessBloc.add(FilterDataEvent(
|
||||
emailAuthorizer:
|
||||
accessBloc.emailAuthorizer.text.toLowerCase(),
|
||||
selectedTabIndex:
|
||||
BlocProvider.of<AccessBloc>(context).selectedIndex,
|
||||
emailAuthorizer: accessBloc.emailAuthorizer.text.toLowerCase(),
|
||||
selectedTabIndex: BlocProvider.of<AccessBloc>(context).selectedIndex,
|
||||
passwordName: accessBloc.passwordName.text.toLowerCase(),
|
||||
startTime: accessBloc.effectiveTimeTimeStamp,
|
||||
endTime: accessBloc.expirationTimeTimeStamp));
|
||||
@ -232,8 +221,7 @@ class AccessManagementPage extends StatelessWidget with HelperResponsiveLayout {
|
||||
onSearch: () {
|
||||
accessBloc.add(FilterDataEvent(
|
||||
emailAuthorizer: accessBloc.emailAuthorizer.text.toLowerCase(),
|
||||
selectedTabIndex:
|
||||
BlocProvider.of<AccessBloc>(context).selectedIndex,
|
||||
selectedTabIndex: BlocProvider.of<AccessBloc>(context).selectedIndex,
|
||||
passwordName: accessBloc.passwordName.text.toLowerCase(),
|
||||
startTime: accessBloc.effectiveTimeTimeStamp,
|
||||
endTime: accessBloc.expirationTimeTimeStamp));
|
||||
@ -261,10 +249,8 @@ class AccessManagementPage extends StatelessWidget with HelperResponsiveLayout {
|
||||
description: '',
|
||||
onSubmitted: (value) {
|
||||
accessBloc.add(FilterDataEvent(
|
||||
emailAuthorizer:
|
||||
accessBloc.emailAuthorizer.text.toLowerCase(),
|
||||
selectedTabIndex:
|
||||
BlocProvider.of<AccessBloc>(context).selectedIndex,
|
||||
emailAuthorizer: accessBloc.emailAuthorizer.text.toLowerCase(),
|
||||
selectedTabIndex: BlocProvider.of<AccessBloc>(context).selectedIndex,
|
||||
passwordName: accessBloc.passwordName.text.toLowerCase(),
|
||||
startTime: accessBloc.effectiveTimeTimeStamp,
|
||||
endTime: accessBloc.expirationTimeTimeStamp));
|
||||
@ -288,8 +274,7 @@ class AccessManagementPage extends StatelessWidget with HelperResponsiveLayout {
|
||||
onSearch: () {
|
||||
accessBloc.add(FilterDataEvent(
|
||||
emailAuthorizer: accessBloc.emailAuthorizer.text.toLowerCase(),
|
||||
selectedTabIndex:
|
||||
BlocProvider.of<AccessBloc>(context).selectedIndex,
|
||||
selectedTabIndex: BlocProvider.of<AccessBloc>(context).selectedIndex,
|
||||
passwordName: accessBloc.passwordName.text.toLowerCase(),
|
||||
startTime: accessBloc.effectiveTimeTimeStamp,
|
||||
endTime: accessBloc.expirationTimeTimeStamp));
|
||||
|
@ -31,8 +31,7 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
||||
|
||||
////////////////////////////// forget password //////////////////////////////////
|
||||
final TextEditingController forgetEmailController = TextEditingController();
|
||||
final TextEditingController forgetPasswordController =
|
||||
TextEditingController();
|
||||
final TextEditingController forgetPasswordController = TextEditingController();
|
||||
final TextEditingController forgetOtp = TextEditingController();
|
||||
final forgetFormKey = GlobalKey<FormState>();
|
||||
final forgetEmailKey = GlobalKey<FormState>();
|
||||
@ -49,12 +48,12 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
||||
return;
|
||||
}
|
||||
_remainingTime = 1;
|
||||
add(UpdateTimerEvent(
|
||||
remainingTime: _remainingTime, isButtonEnabled: false));
|
||||
add(UpdateTimerEvent(remainingTime: _remainingTime, isButtonEnabled: false));
|
||||
try {
|
||||
forgetEmailValidate = '';
|
||||
_remainingTime = (await AuthenticationAPI.sendOtp(
|
||||
email: forgetEmailController.text, regionUuid: regionUuid))!;
|
||||
email: forgetEmailController.text,
|
||||
))!;
|
||||
} on DioException catch (e) {
|
||||
if (e.response!.statusCode == 400) {
|
||||
final errorData = e.response!.data;
|
||||
@ -86,8 +85,7 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
||||
_timer?.cancel();
|
||||
add(const UpdateTimerEvent(remainingTime: 0, isButtonEnabled: true));
|
||||
} else {
|
||||
add(UpdateTimerEvent(
|
||||
remainingTime: _remainingTime, isButtonEnabled: false));
|
||||
add(UpdateTimerEvent(remainingTime: _remainingTime, isButtonEnabled: false));
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -97,8 +95,7 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
||||
emit(const TimerState(isButtonEnabled: true, remainingTime: 0));
|
||||
}
|
||||
|
||||
Future<void> changePassword(
|
||||
ChangePasswordEvent event, Emitter<AuthState> emit) async {
|
||||
Future<void> changePassword(ChangePasswordEvent event, Emitter<AuthState> emit) async {
|
||||
emit(LoadingForgetState());
|
||||
try {
|
||||
var response = await AuthenticationAPI.verifyOtp(
|
||||
@ -114,8 +111,7 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
||||
}
|
||||
} on DioException catch (e) {
|
||||
final errorData = e.response!.data;
|
||||
String errorMessage =
|
||||
errorData['error']['message'] ?? 'something went wrong';
|
||||
String errorMessage = errorData['error']['message'] ?? 'something went wrong';
|
||||
validate = errorMessage;
|
||||
emit(AuthInitialState());
|
||||
}
|
||||
@ -129,16 +125,14 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
||||
}
|
||||
|
||||
void _onUpdateTimer(UpdateTimerEvent event, Emitter<AuthState> emit) {
|
||||
emit(TimerState(
|
||||
isButtonEnabled: event.isButtonEnabled,
|
||||
remainingTime: event.remainingTime));
|
||||
emit(TimerState(isButtonEnabled: event.isButtonEnabled, remainingTime: event.remainingTime));
|
||||
}
|
||||
|
||||
///////////////////////////////////// login /////////////////////////////////////
|
||||
final TextEditingController loginEmailController = TextEditingController();
|
||||
final TextEditingController loginPasswordController = TextEditingController();
|
||||
final loginFormKey = GlobalKey<FormState>();
|
||||
bool isChecked = false;
|
||||
bool isChecked = true;
|
||||
bool obscureText = true;
|
||||
String newPassword = '';
|
||||
String maskedEmail = '';
|
||||
@ -146,7 +140,7 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
||||
String validate = '';
|
||||
String forgetValidate = '';
|
||||
String forgetEmailValidate = '';
|
||||
String regionUuid = '';
|
||||
// String regionUuid = '';
|
||||
static Token token = Token.emptyConstructor();
|
||||
static UserModel? user;
|
||||
bool showValidationMessage = false;
|
||||
@ -163,9 +157,9 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
||||
|
||||
token = await AuthenticationAPI.loginWithEmail(
|
||||
model: LoginWithEmailModel(
|
||||
email: event.username,
|
||||
password: event.password,
|
||||
regionUuid: event.regionUuid),
|
||||
email: event.username,
|
||||
password: event.password,
|
||||
),
|
||||
);
|
||||
} catch (failure) {
|
||||
validate = 'Invalid Credentials!';
|
||||
@ -175,8 +169,7 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
||||
|
||||
if (token.accessTokenIsNotEmpty) {
|
||||
FlutterSecureStorage storage = const FlutterSecureStorage();
|
||||
await storage.write(
|
||||
key: Token.loginAccessTokenKey, value: token.accessToken);
|
||||
await storage.write(key: Token.loginAccessTokenKey, value: token.accessToken);
|
||||
const FlutterSecureStorage().write(
|
||||
key: UserModel.userUuidKey,
|
||||
value: Token.decodeToken(token.accessToken)['uuid'].toString());
|
||||
@ -334,14 +327,12 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
||||
static Future<String> getTokenAndValidate() async {
|
||||
try {
|
||||
const storage = FlutterSecureStorage();
|
||||
final firstLaunch = await SharedPreferencesHelper.readBoolFromSP(
|
||||
StringsManager.firstLaunch) ??
|
||||
true;
|
||||
final firstLaunch =
|
||||
await SharedPreferencesHelper.readBoolFromSP(StringsManager.firstLaunch) ?? true;
|
||||
if (firstLaunch) {
|
||||
storage.deleteAll();
|
||||
}
|
||||
await SharedPreferencesHelper.saveBoolToSP(
|
||||
StringsManager.firstLaunch, false);
|
||||
await SharedPreferencesHelper.saveBoolToSP(StringsManager.firstLaunch, false);
|
||||
final value = await storage.read(key: Token.loginAccessTokenKey) ?? '';
|
||||
if (value.isEmpty) {
|
||||
return 'Token not found';
|
||||
@ -376,7 +367,7 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
||||
Future selectRegion(SelectRegionEvent event, Emitter<AuthState> emit) async {
|
||||
try {
|
||||
emit(AuthLoading());
|
||||
regionUuid = event.val;
|
||||
// regionUuid = event.val;
|
||||
add(CheckEnableEvent());
|
||||
emit(AuthInitialState());
|
||||
} catch (e) {
|
||||
@ -394,9 +385,7 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
||||
final String formattedTime = [
|
||||
if (days > 0) '${days}d', // Append 'd' for days
|
||||
if (days > 0 || hours > 0)
|
||||
hours
|
||||
.toString()
|
||||
.padLeft(2, '0'), // Show hours if there are days or hours
|
||||
hours.toString().padLeft(2, '0'), // Show hours if there are days or hours
|
||||
minutes.toString().padLeft(2, '0'),
|
||||
seconds.toString().padLeft(2, '0'),
|
||||
].join(':');
|
||||
@ -411,8 +400,7 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
||||
emit(AuthLoading());
|
||||
checkValidate = isChecked == true &&
|
||||
loginPasswordController.text.isNotEmpty &&
|
||||
loginEmailController.text.isNotEmpty &&
|
||||
regionUuid != '';
|
||||
loginEmailController.text.isNotEmpty;
|
||||
emit(LoginInitial());
|
||||
return checkValidate;
|
||||
}
|
||||
|
@ -10,16 +10,16 @@ abstract class AuthEvent extends Equatable {
|
||||
class LoginButtonPressed extends AuthEvent {
|
||||
final String username;
|
||||
final String password;
|
||||
final String regionUuid;
|
||||
// final String regionUuid;
|
||||
|
||||
const LoginButtonPressed({
|
||||
required this.username,
|
||||
required this.password,
|
||||
required this.regionUuid,
|
||||
// required this.regionUuid,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object> get props => [username, password, regionUuid];
|
||||
List<Object> get props => [username, password];
|
||||
}
|
||||
|
||||
class CheckBoxEvent extends AuthEvent {
|
||||
@ -49,13 +49,9 @@ class UpdateTimerEvent extends AuthEvent {
|
||||
const UpdateTimerEvent({required this.remainingTime, required this.isButtonEnabled});
|
||||
}
|
||||
|
||||
class ChangePasswordEvent extends AuthEvent {
|
||||
class ChangePasswordEvent extends AuthEvent {}
|
||||
|
||||
}
|
||||
|
||||
class SendOtpEvent extends AuthEvent {
|
||||
|
||||
}
|
||||
class SendOtpEvent extends AuthEvent {}
|
||||
|
||||
class PasswordVisibleEvent extends AuthEvent {
|
||||
final bool? newValue;
|
||||
|
@ -1,19 +1,19 @@
|
||||
class LoginWithEmailModel {
|
||||
final String email;
|
||||
final String password;
|
||||
final String regionUuid;
|
||||
// final String regionUuid;
|
||||
|
||||
LoginWithEmailModel({
|
||||
required this.email,
|
||||
required this.password,
|
||||
required this.regionUuid,
|
||||
// required this.regionUuid,
|
||||
});
|
||||
|
||||
factory LoginWithEmailModel.fromJson(Map<String, dynamic> json) {
|
||||
return LoginWithEmailModel(
|
||||
email: json['email'],
|
||||
password: json['password'],
|
||||
regionUuid: json['regionUuid'],
|
||||
// regionUuid: json['regionUuid'],
|
||||
);
|
||||
}
|
||||
|
||||
@ -21,7 +21,7 @@ class LoginWithEmailModel {
|
||||
return {
|
||||
'email': email,
|
||||
'password': password,
|
||||
'regionUuid': regionUuid,
|
||||
// 'regionUuid': regionUuid,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -124,18 +124,18 @@ class ForgetPasswordWebPage extends StatelessWidget {
|
||||
.copyWith(fontSize: 14, fontWeight: FontWeight.w400),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(height: 10),
|
||||
Form(
|
||||
key: forgetBloc.forgetRegionKey,
|
||||
child: SizedBox(
|
||||
child:
|
||||
_buildDropdownField(context, forgetBloc, size)))
|
||||
],
|
||||
),
|
||||
// Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// mainAxisAlignment: MainAxisAlignment.start,
|
||||
// children: [
|
||||
// const SizedBox(height: 10),
|
||||
// Form(
|
||||
// key: forgetBloc.forgetRegionKey,
|
||||
// child: SizedBox(
|
||||
// child:
|
||||
// _buildDropdownField(context, forgetBloc, size)))
|
||||
// ],
|
||||
// ),
|
||||
const SizedBox(height: 20),
|
||||
Form(
|
||||
key: forgetBloc.forgetEmailKey,
|
||||
@ -459,9 +459,9 @@ class ForgetPasswordWebPage extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
value: loginBloc.regionList!.any((region) => region.id == loginBloc.regionUuid)
|
||||
? loginBloc.regionUuid
|
||||
: null,
|
||||
// value: loginBloc.regionList!.any((region) => region.id == loginBloc.regionUuid)
|
||||
// ? loginBloc.regionUuid
|
||||
// : null,
|
||||
onChanged: (String? value) {
|
||||
if (value != null) {
|
||||
loginBloc.add(SelectRegionEvent(val: value));
|
||||
|
@ -6,7 +6,7 @@ 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';
|
||||
import 'package:syncrow_web/pages/auth/model/region_model.dart';
|
||||
// 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/utils/color_manager.dart';
|
||||
@ -112,44 +112,44 @@ class LoginMobilePage extends StatelessWidget {
|
||||
color: Colors.white, fontSize: 24, fontWeight: FontWeight.bold),
|
||||
),
|
||||
const SizedBox(height: 30),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"Country/Region",
|
||||
style: Theme.of(context).textTheme.bodySmall,
|
||||
),
|
||||
SizedBox(
|
||||
child: DropdownButtonFormField<String>(
|
||||
validator: loginBloc.validateRegion,
|
||||
icon: const Icon(
|
||||
Icons.keyboard_arrow_down_outlined,
|
||||
),
|
||||
decoration: textBoxDecoration()!.copyWith(
|
||||
hintText: null,
|
||||
),
|
||||
hint: const Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
'Select your region/country',
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
isDense: true,
|
||||
style: const TextStyle(color: Colors.black),
|
||||
items: loginBloc.regionList!.map((RegionModel region) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: region.name,
|
||||
child: Text(region.name),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (String? value) {},
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 20.0),
|
||||
// Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// mainAxisAlignment: MainAxisAlignment.start,
|
||||
// children: [
|
||||
// Text(
|
||||
// "Country/Region",
|
||||
// style: Theme.of(context).textTheme.bodySmall,
|
||||
// ),
|
||||
// SizedBox(
|
||||
// child: DropdownButtonFormField<String>(
|
||||
// validator: loginBloc.validateRegion,
|
||||
// icon: const Icon(
|
||||
// Icons.keyboard_arrow_down_outlined,
|
||||
// ),
|
||||
// decoration: textBoxDecoration()!.copyWith(
|
||||
// hintText: null,
|
||||
// ),
|
||||
// hint: const Align(
|
||||
// alignment: Alignment.centerLeft,
|
||||
// child: Text(
|
||||
// 'Select your region/country',
|
||||
// textAlign: TextAlign.center,
|
||||
// ),
|
||||
// ),
|
||||
// isDense: true,
|
||||
// style: const TextStyle(color: Colors.black),
|
||||
// items: loginBloc.regionList!.map((RegionModel region) {
|
||||
// return DropdownMenuItem<String>(
|
||||
// value: region.name,
|
||||
// child: Text(region.name),
|
||||
// );
|
||||
// }).toList(),
|
||||
// onChanged: (String? value) {},
|
||||
// ),
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// const SizedBox(height: 20.0),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
@ -207,7 +207,10 @@ class LoginMobilePage extends StatelessWidget {
|
||||
},
|
||||
child: Text(
|
||||
"Forgot Password?",
|
||||
style: Theme.of(context).textTheme.bodySmall,
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.bodySmall!
|
||||
.copyWith(color: ColorsManager.blackColor),
|
||||
),
|
||||
),
|
||||
],
|
||||
@ -276,7 +279,6 @@ class LoginMobilePage extends StatelessWidget {
|
||||
if (loginBloc.loginFormKey.currentState!.validate()) {
|
||||
loginBloc.add(
|
||||
LoginButtonPressed(
|
||||
regionUuid: '',
|
||||
username: loginBloc.loginEmailController.text,
|
||||
password: loginBloc.loginPasswordController.text,
|
||||
),
|
||||
|
@ -155,16 +155,16 @@ class _LoginWebPageState extends State<LoginWebPage> with HelperResponsiveLayout
|
||||
children: <Widget>[
|
||||
const SizedBox(height: 40),
|
||||
Text('Login', style: Theme.of(context).textTheme.headlineLarge),
|
||||
SizedBox(height: size.height * 0.03),
|
||||
_buildDropdownField(context, loginBloc, size),
|
||||
// SizedBox(height: size.height * 0.03),
|
||||
// _buildDropdownField(context, loginBloc, size),
|
||||
const SizedBox(height: 20.0),
|
||||
_buildEmailField(context, loginBloc),
|
||||
const SizedBox(height: 20.0),
|
||||
_buildPasswordField(context, loginBloc),
|
||||
const SizedBox(height: 20),
|
||||
_buildForgotPassword(context),
|
||||
const SizedBox(height: 20),
|
||||
_buildCheckbox(context, loginBloc, size),
|
||||
// const SizedBox(height: 20),
|
||||
// _buildCheckbox(context, loginBloc, size),
|
||||
const SizedBox(height: 20.0),
|
||||
_buildSignInButton(context, loginBloc, size),
|
||||
const SizedBox(height: 15.0),
|
||||
@ -219,11 +219,11 @@ class _LoginWebPageState extends State<LoginWebPage> with HelperResponsiveLayout
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
value: loginBloc.regionList!.any(
|
||||
(region) => region.id == loginBloc.regionUuid,
|
||||
)
|
||||
? loginBloc.regionUuid
|
||||
: null,
|
||||
// value: loginBloc.regionList!.any(
|
||||
// (region) => region.id == loginBloc.regionUuid,
|
||||
// )
|
||||
// ? loginBloc.regionUuid
|
||||
// : null,
|
||||
onChanged: (String? value) {
|
||||
if (value != null) {
|
||||
loginBloc.add(CheckEnableEvent());
|
||||
@ -462,7 +462,7 @@ class _LoginWebPageState extends State<LoginWebPage> with HelperResponsiveLayout
|
||||
onPressed: () {
|
||||
if (loginBloc.loginFormKey.currentState!.validate()) {
|
||||
loginBloc.add(LoginButtonPressed(
|
||||
regionUuid: loginBloc.regionUuid,
|
||||
// regionUuid: loginBloc.regionUuid,
|
||||
username: loginBloc.loginEmailController.text,
|
||||
password: loginBloc.loginPasswordController.text,
|
||||
));
|
||||
|
@ -8,7 +8,7 @@ import 'package:syncrow_web/pages/device_managment/ac/view/batch_control_list/ba
|
||||
import 'package:syncrow_web/pages/device_managment/ac/view/batch_control_list/batch_fan_speed.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/all_devices/models/factory_reset_model.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/batch_control/factory_reset.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/batch_control/firmware_update.dart';
|
||||
// import 'package:syncrow_web/pages/device_managment/shared/batch_control/firmware_update.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/toggle_widget.dart';
|
||||
import 'package:syncrow_web/utils/color_manager.dart';
|
||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||
@ -26,7 +26,8 @@ class AcDeviceBatchControlView extends StatelessWidget with HelperResponsiveLayo
|
||||
final isLarge = isLargeScreenSize(context);
|
||||
final isMedium = isMediumScreenSize(context);
|
||||
return BlocProvider(
|
||||
create: (context) => AcBloc(deviceId: devicesIds.first)..add(AcFetchBatchStatusEvent(devicesIds)),
|
||||
create: (context) =>
|
||||
AcBloc(deviceId: devicesIds.first)..add(AcFetchBatchStatusEvent(devicesIds)),
|
||||
child: BlocBuilder<AcBloc, AcsState>(
|
||||
builder: (context, state) {
|
||||
if (state is ACStatusLoaded) {
|
||||
@ -98,7 +99,8 @@ class AcDeviceBatchControlView extends StatelessWidget with HelperResponsiveLayo
|
||||
),
|
||||
Text(
|
||||
'h',
|
||||
style: context.textTheme.bodySmall!.copyWith(color: ColorsManager.blackColor),
|
||||
style:
|
||||
context.textTheme.bodySmall!.copyWith(color: ColorsManager.blackColor),
|
||||
),
|
||||
Text(
|
||||
'30',
|
||||
@ -107,7 +109,9 @@ class AcDeviceBatchControlView extends StatelessWidget with HelperResponsiveLayo
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
Text('m', style: context.textTheme.bodySmall!.copyWith(color: ColorsManager.blackColor)),
|
||||
Text('m',
|
||||
style: context.textTheme.bodySmall!
|
||||
.copyWith(color: ColorsManager.blackColor)),
|
||||
IconButton(
|
||||
onPressed: () {},
|
||||
icon: const Icon(
|
||||
@ -138,7 +142,7 @@ class AcDeviceBatchControlView extends StatelessWidget with HelperResponsiveLayo
|
||||
));
|
||||
},
|
||||
),
|
||||
FirmwareUpdateWidget(deviceId: devicesIds.first, version: 5),
|
||||
// FirmwareUpdateWidget(deviceId: devicesIds.first, version: 5),
|
||||
FactoryResetWidget(
|
||||
callFactoryReset: () {
|
||||
context.read<AcBloc>().add(AcFactoryResetEvent(
|
||||
|
@ -6,7 +6,7 @@ import 'package:syncrow_web/pages/device_managment/ceiling_sensor/bloc/ceiling_e
|
||||
import 'package:syncrow_web/pages/device_managment/ceiling_sensor/bloc/ceiling_state.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/ceiling_sensor/model/ceiling_sensor_model.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/batch_control/factory_reset.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/batch_control/firmware_update.dart';
|
||||
// import 'package:syncrow_web/pages/device_managment/shared/batch_control/firmware_update.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/sensors_widgets/presence_space_type.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/sensors_widgets/presence_update_data.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/sensors_widgets/presense_nobody_time.dart';
|
||||
@ -110,7 +110,7 @@ class CeilingSensorBatchControlView extends StatelessWidget with HelperResponsiv
|
||||
),
|
||||
),
|
||||
),
|
||||
FirmwareUpdateWidget(deviceId: devicesIds.first, version: 4),
|
||||
// FirmwareUpdateWidget(deviceId: devicesIds.first, version: 4),
|
||||
FactoryResetWidget(
|
||||
callFactoryReset: () {
|
||||
context.read<CeilingSensorBloc>().add(
|
||||
|
@ -6,11 +6,10 @@ import 'package:syncrow_web/pages/device_managment/curtain/bloc/curtain_bloc.dar
|
||||
import 'package:syncrow_web/pages/device_managment/curtain/bloc/curtain_event.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/curtain/bloc/curtain_state.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/batch_control/factory_reset.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/batch_control/firmware_update.dart';
|
||||
// import 'package:syncrow_web/pages/device_managment/shared/batch_control/firmware_update.dart';
|
||||
import 'package:syncrow_web/utils/helpers/responsice_layout_helper/responsive_layout_helper.dart';
|
||||
|
||||
class CurtainBatchStatusView extends StatelessWidget
|
||||
with HelperResponsiveLayout {
|
||||
class CurtainBatchStatusView extends StatelessWidget with HelperResponsiveLayout {
|
||||
const CurtainBatchStatusView({super.key, required this.devicesIds});
|
||||
|
||||
final List<String> devicesIds;
|
||||
@ -18,8 +17,8 @@ class CurtainBatchStatusView extends StatelessWidget
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => CurtainBloc(deviceId: devicesIds.first)
|
||||
..add(CurtainFetchBatchStatus(devicesIds)),
|
||||
create: (context) =>
|
||||
CurtainBloc(deviceId: devicesIds.first)..add(CurtainFetchBatchStatus(devicesIds)),
|
||||
child: BlocBuilder<CurtainBloc, CurtainState>(
|
||||
builder: (context, state) {
|
||||
if (state is CurtainStatusLoading) {
|
||||
@ -68,7 +67,7 @@ class CurtainBatchStatusView extends StatelessWidget
|
||||
));
|
||||
},
|
||||
),
|
||||
FirmwareUpdateWidget(deviceId: devicesIds.first, version: 5),
|
||||
// FirmwareUpdateWidget(deviceId: devicesIds.first, version: 5),
|
||||
FactoryResetWidget(
|
||||
callFactoryReset: () {
|
||||
context.read<CurtainBloc>().add(
|
||||
|
@ -4,11 +4,10 @@ import 'package:syncrow_web/pages/device_managment/all_devices/models/factory_re
|
||||
import 'package:syncrow_web/pages/device_managment/door_lock/bloc/door_lock_bloc.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/door_lock/bloc/door_lock_event.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/batch_control/factory_reset.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/batch_control/firmware_update.dart';
|
||||
// import 'package:syncrow_web/pages/device_managment/shared/batch_control/firmware_update.dart';
|
||||
import 'package:syncrow_web/utils/helpers/responsice_layout_helper/responsive_layout_helper.dart';
|
||||
|
||||
class DoorLockBatchControlView extends StatelessWidget
|
||||
with HelperResponsiveLayout {
|
||||
class DoorLockBatchControlView extends StatelessWidget with HelperResponsiveLayout {
|
||||
const DoorLockBatchControlView({super.key, required this.devicesIds});
|
||||
|
||||
final List<String> devicesIds;
|
||||
@ -18,17 +17,17 @@ class DoorLockBatchControlView extends StatelessWidget
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 170,
|
||||
height: 140,
|
||||
child: FirmwareUpdateWidget(
|
||||
deviceId: devicesIds.first,
|
||||
version: 12,
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 12,
|
||||
),
|
||||
// SizedBox(
|
||||
// width: 170,
|
||||
// height: 140,
|
||||
// child: FirmwareUpdateWidget(
|
||||
// deviceId: devicesIds.first,
|
||||
// version: 12,
|
||||
// ),
|
||||
// ),
|
||||
// const SizedBox(
|
||||
// width: 12,
|
||||
// ),
|
||||
SizedBox(
|
||||
width: 170,
|
||||
height: 140,
|
||||
|
@ -6,17 +6,15 @@ import 'package:syncrow_web/pages/device_managment/garage_door/bloc/garage_door_
|
||||
import 'package:syncrow_web/pages/device_managment/garage_door/bloc/garage_door_state.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/garage_door/models/garage_door_model.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/batch_control/factory_reset.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/batch_control/firmware_update.dart';
|
||||
// import 'package:syncrow_web/pages/device_managment/shared/batch_control/firmware_update.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/toggle_widget.dart';
|
||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||
import 'package:syncrow_web/utils/helpers/responsice_layout_helper/responsive_layout_helper.dart';
|
||||
|
||||
class GarageDoorBatchControlView extends StatelessWidget
|
||||
with HelperResponsiveLayout {
|
||||
class GarageDoorBatchControlView extends StatelessWidget with HelperResponsiveLayout {
|
||||
final List<String> deviceIds;
|
||||
|
||||
const GarageDoorBatchControlView({Key? key, required this.deviceIds})
|
||||
: super(key: key);
|
||||
const GarageDoorBatchControlView({Key? key, required this.deviceIds}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -39,8 +37,7 @@ class GarageDoorBatchControlView extends StatelessWidget
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildStatusControls(
|
||||
BuildContext context, GarageDoorStatusModel status) {
|
||||
Widget _buildStatusControls(BuildContext context, GarageDoorStatusModel status) {
|
||||
final isExtraLarge = isExtraLargeScreenSize(context);
|
||||
final isLarge = isLargeScreenSize(context);
|
||||
final isMedium = isMediumScreenSize(context);
|
||||
@ -75,10 +72,10 @@ class GarageDoorBatchControlView extends StatelessWidget
|
||||
);
|
||||
},
|
||||
),
|
||||
FirmwareUpdateWidget(
|
||||
deviceId: deviceIds.first,
|
||||
version: 12,
|
||||
),
|
||||
// FirmwareUpdateWidget(
|
||||
// deviceId: deviceIds.first,
|
||||
// version: 12,
|
||||
// ),
|
||||
FactoryResetWidget(
|
||||
callFactoryReset: () {
|
||||
context.read<GarageDoorBloc>().add(
|
||||
|
@ -3,11 +3,10 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/all_devices/models/factory_reset_model.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/gateway/bloc/gate_way_bloc.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/batch_control/factory_reset.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/batch_control/firmware_update.dart';
|
||||
// import 'package:syncrow_web/pages/device_managment/shared/batch_control/firmware_update.dart';
|
||||
import 'package:syncrow_web/utils/helpers/responsice_layout_helper/responsive_layout_helper.dart';
|
||||
|
||||
class GatewayBatchControlView extends StatelessWidget
|
||||
with HelperResponsiveLayout {
|
||||
class GatewayBatchControlView extends StatelessWidget with HelperResponsiveLayout {
|
||||
const GatewayBatchControlView({super.key, required this.gatewayIds});
|
||||
|
||||
final List<String> gatewayIds;
|
||||
@ -24,14 +23,13 @@ class GatewayBatchControlView extends StatelessWidget
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 170,
|
||||
height: 140,
|
||||
child: FirmwareUpdateWidget(
|
||||
deviceId: gatewayIds.first, version: 2)),
|
||||
const SizedBox(
|
||||
width: 12,
|
||||
),
|
||||
// SizedBox(
|
||||
// width: 170,
|
||||
// height: 140,
|
||||
// child: FirmwareUpdateWidget(deviceId: gatewayIds.first, version: 2)),
|
||||
// const SizedBox(
|
||||
// width: 12,
|
||||
// ),
|
||||
SizedBox(
|
||||
width: 170,
|
||||
height: 140,
|
||||
@ -40,8 +38,7 @@ class GatewayBatchControlView extends StatelessWidget
|
||||
context.read<GateWayBloc>().add(
|
||||
GateWayFactoryReset(
|
||||
deviceId: gatewayIds.first,
|
||||
factoryReset:
|
||||
FactoryResetModel(devicesUuid: gatewayIds),
|
||||
factoryReset: FactoryResetModel(devicesUuid: gatewayIds),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
@ -4,7 +4,7 @@ import 'package:syncrow_web/pages/device_managment/all_devices/models/factory_re
|
||||
import 'package:syncrow_web/pages/device_managment/main_door_sensor/bloc/main_door_sensor_bloc.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/main_door_sensor/bloc/main_door_sensor_event.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/batch_control/factory_reset.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/batch_control/firmware_update.dart';
|
||||
// import 'package:syncrow_web/pages/device_managment/shared/batch_control/firmware_update.dart';
|
||||
|
||||
class MainDoorSensorBatchView extends StatelessWidget {
|
||||
const MainDoorSensorBatchView({super.key, required this.devicesIds});
|
||||
@ -16,17 +16,17 @@ class MainDoorSensorBatchView extends StatelessWidget {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 170,
|
||||
height: 140,
|
||||
child: FirmwareUpdateWidget(
|
||||
deviceId: devicesIds.first,
|
||||
version: 12,
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 12,
|
||||
),
|
||||
// SizedBox(
|
||||
// width: 170,
|
||||
// height: 140,
|
||||
// child: FirmwareUpdateWidget(
|
||||
// deviceId: devicesIds.first,
|
||||
// version: 12,
|
||||
// ),
|
||||
// ),
|
||||
// const SizedBox(
|
||||
// width: 12,
|
||||
// ),
|
||||
SizedBox(
|
||||
width: 170,
|
||||
height: 140,
|
||||
|
@ -4,16 +4,14 @@ import 'package:syncrow_web/pages/device_managment/all_devices/models/factory_re
|
||||
import 'package:syncrow_web/pages/device_managment/one_g_glass_switch/bloc/one_gang_glass_switch_bloc.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/one_g_glass_switch/models/once_gang_glass_status_model.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/batch_control/factory_reset.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/batch_control/firmware_update.dart';
|
||||
// import 'package:syncrow_web/pages/device_managment/shared/batch_control/firmware_update.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/toggle_widget.dart';
|
||||
import 'package:syncrow_web/utils/helpers/responsice_layout_helper/responsive_layout_helper.dart';
|
||||
|
||||
class OneGangGlassSwitchBatchControlView extends StatelessWidget
|
||||
with HelperResponsiveLayout {
|
||||
class OneGangGlassSwitchBatchControlView extends StatelessWidget with HelperResponsiveLayout {
|
||||
final List<String> deviceIds;
|
||||
|
||||
const OneGangGlassSwitchBatchControlView(
|
||||
{required this.deviceIds, super.key});
|
||||
const OneGangGlassSwitchBatchControlView({required this.deviceIds, super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -36,8 +34,7 @@ class OneGangGlassSwitchBatchControlView extends StatelessWidget
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildStatusControls(
|
||||
BuildContext context, OneGangGlassStatusModel status) {
|
||||
Widget _buildStatusControls(BuildContext context, OneGangGlassStatusModel status) {
|
||||
final isExtraLarge = isExtraLargeScreenSize(context);
|
||||
final isLarge = isLargeScreenSize(context);
|
||||
final isMedium = isMediumScreenSize(context);
|
||||
@ -71,10 +68,10 @@ class OneGangGlassSwitchBatchControlView extends StatelessWidget
|
||||
);
|
||||
},
|
||||
),
|
||||
FirmwareUpdateWidget(
|
||||
deviceId: deviceIds.first,
|
||||
version: 12,
|
||||
),
|
||||
// FirmwareUpdateWidget(
|
||||
// deviceId: deviceIds.first,
|
||||
// version: 12,
|
||||
// ),
|
||||
FactoryResetWidget(
|
||||
callFactoryReset: () {
|
||||
context.read<OneGangGlassSwitchBloc>().add(
|
||||
|
@ -6,12 +6,11 @@ import 'package:syncrow_web/pages/device_managment/one_gang_switch/bloc/wall_lig
|
||||
import 'package:syncrow_web/pages/device_managment/one_gang_switch/bloc/wall_light_switch_state.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/one_gang_switch/models/wall_light_status_model.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/batch_control/factory_reset.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/batch_control/firmware_update.dart';
|
||||
// import 'package:syncrow_web/pages/device_managment/shared/batch_control/firmware_update.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/toggle_widget.dart';
|
||||
import 'package:syncrow_web/utils/helpers/responsice_layout_helper/responsive_layout_helper.dart';
|
||||
|
||||
class WallLightBatchControlView extends StatelessWidget
|
||||
with HelperResponsiveLayout {
|
||||
class WallLightBatchControlView extends StatelessWidget with HelperResponsiveLayout {
|
||||
const WallLightBatchControlView({super.key, required this.deviceIds});
|
||||
|
||||
final List<String> deviceIds;
|
||||
@ -27,8 +26,7 @@ class WallLightBatchControlView extends StatelessWidget
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
} else if (state is WallLightSwitchStatusLoaded) {
|
||||
return _buildStatusControls(context, state.status);
|
||||
} else if (state is WallLightSwitchError ||
|
||||
state is WallLightSwitchControlError) {
|
||||
} else if (state is WallLightSwitchError || state is WallLightSwitchControlError) {
|
||||
return const Center(child: Text('Error fetching status'));
|
||||
} else {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
@ -38,8 +36,7 @@ class WallLightBatchControlView extends StatelessWidget
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildStatusControls(
|
||||
BuildContext context, WallLightStatusModel status) {
|
||||
Widget _buildStatusControls(BuildContext context, WallLightStatusModel status) {
|
||||
final isExtraLarge = isExtraLargeScreenSize(context);
|
||||
final isLarge = isLargeScreenSize(context);
|
||||
final isMedium = isMediumScreenSize(context);
|
||||
@ -74,15 +71,14 @@ class WallLightBatchControlView extends StatelessWidget
|
||||
);
|
||||
},
|
||||
),
|
||||
FirmwareUpdateWidget(
|
||||
deviceId: deviceIds.first,
|
||||
version: 12,
|
||||
),
|
||||
// FirmwareUpdateWidget(
|
||||
// deviceId: deviceIds.first,
|
||||
// version: 12,
|
||||
// ),
|
||||
FactoryResetWidget(
|
||||
callFactoryReset: () {
|
||||
context.read<WallLightSwitchBloc>().add(WallLightFactoryReset(
|
||||
deviceId: status.uuid,
|
||||
factoryReset: FactoryResetModel(devicesUuid: deviceIds)));
|
||||
deviceId: status.uuid, factoryReset: FactoryResetModel(devicesUuid: deviceIds)));
|
||||
},
|
||||
),
|
||||
],
|
||||
|
@ -6,21 +6,19 @@ import 'package:syncrow_web/pages/device_managment/power_clamp/bloc/smart_power_
|
||||
import 'package:syncrow_web/pages/device_managment/power_clamp/bloc/smart_power_state.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/power_clamp/models/power_clamp_batch_model.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/batch_control/factory_reset.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/batch_control/firmware_update.dart';
|
||||
// import 'package:syncrow_web/pages/device_managment/shared/batch_control/firmware_update.dart';
|
||||
import 'package:syncrow_web/utils/helpers/responsice_layout_helper/responsive_layout_helper.dart';
|
||||
|
||||
class PowerClampBatchControlView extends StatelessWidget
|
||||
with HelperResponsiveLayout {
|
||||
class PowerClampBatchControlView extends StatelessWidget with HelperResponsiveLayout {
|
||||
final List<String> deviceIds;
|
||||
|
||||
const PowerClampBatchControlView({Key? key, required this.deviceIds})
|
||||
: super(key: key);
|
||||
const PowerClampBatchControlView({Key? key, required this.deviceIds}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => SmartPowerBloc(deviceId: deviceIds.first)
|
||||
..add(SmartPowerFetchBatchEvent(deviceIds)),
|
||||
create: (context) =>
|
||||
SmartPowerBloc(deviceId: deviceIds.first)..add(SmartPowerFetchBatchEvent(deviceIds)),
|
||||
child: BlocBuilder<SmartPowerBloc, SmartPowerState>(
|
||||
builder: (context, state) {
|
||||
if (state is SmartPowerLoading) {
|
||||
@ -37,18 +35,17 @@ class PowerClampBatchControlView extends StatelessWidget
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildStatusControls(
|
||||
BuildContext context, PowerClampBatchModel status) {
|
||||
Widget _buildStatusControls(BuildContext context, PowerClampBatchModel status) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 170,
|
||||
// height: 140,
|
||||
child: FirmwareUpdateWidget(deviceId: deviceIds.first, version: 2)),
|
||||
const SizedBox(
|
||||
width: 12,
|
||||
),
|
||||
// SizedBox(
|
||||
// width: 170,
|
||||
// // height: 140,
|
||||
// child: FirmwareUpdateWidget(deviceId: deviceIds.first, version: 2)),
|
||||
// const SizedBox(
|
||||
// width: 12,
|
||||
// ),
|
||||
SizedBox(
|
||||
width: 170,
|
||||
height: 140,
|
||||
|
@ -1,128 +1,128 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:syncrow_web/pages/common/buttons/default_button.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/device_controls_container.dart';
|
||||
import 'package:syncrow_web/utils/color_manager.dart';
|
||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||
import 'package:syncrow_web/utils/extension/build_context_x.dart';
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:flutter_svg/flutter_svg.dart';
|
||||
// import 'package:syncrow_web/pages/common/buttons/default_button.dart';
|
||||
// import 'package:syncrow_web/pages/device_managment/shared/device_controls_container.dart';
|
||||
// import 'package:syncrow_web/utils/color_manager.dart';
|
||||
// import 'package:syncrow_web/utils/constants/assets.dart';
|
||||
// import 'package:syncrow_web/utils/extension/build_context_x.dart';
|
||||
|
||||
class FirmwareUpdateWidget extends StatefulWidget {
|
||||
const FirmwareUpdateWidget({super.key, required this.deviceId, required this.version});
|
||||
// class FirmwareUpdateWidget extends StatefulWidget {
|
||||
// const FirmwareUpdateWidget({super.key, required this.deviceId, required this.version});
|
||||
|
||||
final String deviceId;
|
||||
final int version;
|
||||
// final String deviceId;
|
||||
// final int version;
|
||||
|
||||
@override
|
||||
State<FirmwareUpdateWidget> createState() => _FirmwareUpdateWidgetState();
|
||||
}
|
||||
// @override
|
||||
// State<FirmwareUpdateWidget> createState() => _FirmwareUpdateWidgetState();
|
||||
// }
|
||||
|
||||
class _FirmwareUpdateWidgetState extends State<FirmwareUpdateWidget> {
|
||||
bool _showConfirmation = false;
|
||||
// class _FirmwareUpdateWidgetState extends State<FirmwareUpdateWidget> {
|
||||
// bool _showConfirmation = false;
|
||||
|
||||
void _toggleConfirmation() {
|
||||
setState(() {
|
||||
_showConfirmation = !_showConfirmation;
|
||||
});
|
||||
}
|
||||
// void _toggleConfirmation() {
|
||||
// setState(() {
|
||||
// _showConfirmation = !_showConfirmation;
|
||||
// });
|
||||
// }
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return DeviceControlsContainer(
|
||||
child: _showConfirmation
|
||||
? Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
Text(
|
||||
'Firmware Update',
|
||||
style: context.textTheme.titleMedium!.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: ColorsManager.blackColor,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'Are you sure?',
|
||||
style: context.textTheme.bodySmall!.copyWith(
|
||||
color: ColorsManager.grayColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Flexible(
|
||||
child: DefaultButton(
|
||||
height: 20,
|
||||
elevation: 0,
|
||||
padding: 0,
|
||||
onPressed: _toggleConfirmation,
|
||||
backgroundColor: ColorsManager.greyColor,
|
||||
child: Text(
|
||||
'Cancel',
|
||||
style: context.textTheme.bodyMedium!.copyWith(
|
||||
color: ColorsManager.blackColor,
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Flexible(
|
||||
child: DefaultButton(
|
||||
height: 20,
|
||||
elevation: 0,
|
||||
padding: 0,
|
||||
onPressed: () {
|
||||
_toggleConfirmation();
|
||||
},
|
||||
backgroundColor: ColorsManager.primaryColor,
|
||||
child: Text(
|
||||
'Update',
|
||||
style: context.textTheme.bodyMedium!.copyWith(
|
||||
color: ColorsManager.whiteColors,
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
)
|
||||
: GestureDetector(
|
||||
onTap: _toggleConfirmation,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
ClipOval(
|
||||
child: Container(
|
||||
color: ColorsManager.whiteColors,
|
||||
height: 60,
|
||||
width: 60,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
child: SvgPicture.asset(
|
||||
Assets.firmware,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'Firmware Update',
|
||||
style: context.textTheme.titleMedium!.copyWith(
|
||||
fontWeight: FontWeight.w400,
|
||||
color: ColorsManager.blackColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return DeviceControlsContainer(
|
||||
// child: _showConfirmation
|
||||
// ? Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
// children: [
|
||||
// Column(
|
||||
// children: [
|
||||
// Text(
|
||||
// 'Firmware Update',
|
||||
// style: context.textTheme.titleMedium!.copyWith(
|
||||
// fontWeight: FontWeight.bold,
|
||||
// color: ColorsManager.blackColor,
|
||||
// ),
|
||||
// ),
|
||||
// Text(
|
||||
// 'Are you sure?',
|
||||
// style: context.textTheme.bodySmall!.copyWith(
|
||||
// color: ColorsManager.grayColor,
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// Row(
|
||||
// children: [
|
||||
// Flexible(
|
||||
// child: DefaultButton(
|
||||
// height: 20,
|
||||
// elevation: 0,
|
||||
// padding: 0,
|
||||
// onPressed: _toggleConfirmation,
|
||||
// backgroundColor: ColorsManager.greyColor,
|
||||
// child: Text(
|
||||
// 'Cancel',
|
||||
// style: context.textTheme.bodyMedium!.copyWith(
|
||||
// color: ColorsManager.blackColor,
|
||||
// fontWeight: FontWeight.w400,
|
||||
// fontSize: 12,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// const SizedBox(width: 8),
|
||||
// Flexible(
|
||||
// child: DefaultButton(
|
||||
// height: 20,
|
||||
// elevation: 0,
|
||||
// padding: 0,
|
||||
// onPressed: () {
|
||||
// _toggleConfirmation();
|
||||
// },
|
||||
// backgroundColor: ColorsManager.primaryColor,
|
||||
// child: Text(
|
||||
// 'Update',
|
||||
// style: context.textTheme.bodyMedium!.copyWith(
|
||||
// color: ColorsManager.whiteColors,
|
||||
// fontWeight: FontWeight.w400,
|
||||
// fontSize: 12,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ],
|
||||
// )
|
||||
// : GestureDetector(
|
||||
// onTap: _toggleConfirmation,
|
||||
// child: Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
// children: [
|
||||
// ClipOval(
|
||||
// child: Container(
|
||||
// color: ColorsManager.whiteColors,
|
||||
// height: 60,
|
||||
// width: 60,
|
||||
// child: Padding(
|
||||
// padding: const EdgeInsets.all(12.0),
|
||||
// child: SvgPicture.asset(
|
||||
// Assets.firmware,
|
||||
// fit: BoxFit.cover,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// Text(
|
||||
// 'Firmware Update',
|
||||
// style: context.textTheme.titleMedium!.copyWith(
|
||||
// fontWeight: FontWeight.w400,
|
||||
// color: ColorsManager.blackColor,
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
@ -18,20 +18,21 @@ class SOSBatchControlView extends StatelessWidget {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 170,
|
||||
// height: 140,
|
||||
child: FirmwareUpdateWidget(deviceId: deviceIds.first, version: 2)),
|
||||
const SizedBox(
|
||||
width: 12,
|
||||
),
|
||||
// SizedBox(
|
||||
// width: 170,
|
||||
// // height: 140,
|
||||
// child: FirmwareUpdateWidget(deviceId: deviceIds.first, version: 2)),
|
||||
// const SizedBox(
|
||||
// width: 12,
|
||||
// ),
|
||||
SizedBox(
|
||||
width: 170,
|
||||
height: 140,
|
||||
child: FactoryResetWidget(
|
||||
callFactoryReset: () {
|
||||
context.read<SosDeviceBloc>().add(
|
||||
SosFactoryReset(deviceId: deviceIds.first, factoryReset: FactoryResetModel(devicesUuid: deviceIds)));
|
||||
context.read<SosDeviceBloc>().add(SosFactoryReset(
|
||||
deviceId: deviceIds.first,
|
||||
factoryReset: FactoryResetModel(devicesUuid: deviceIds)));
|
||||
},
|
||||
),
|
||||
),
|
||||
|
@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/all_devices/models/factory_reset_model.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/batch_control/factory_reset.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/batch_control/firmware_update.dart';
|
||||
// import 'package:syncrow_web/pages/device_managment/shared/batch_control/firmware_update.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/toggle_widget.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/three_g_glass_switch/bloc/three_gang_glass_switch_bloc.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/three_g_glass_switch/models/three_gang_glass_switch.dart';
|
||||
@ -98,10 +98,10 @@ class ThreeGangGlassSwitchBatchControlView extends StatelessWidget with HelperRe
|
||||
);
|
||||
},
|
||||
),
|
||||
FirmwareUpdateWidget(
|
||||
deviceId: deviceIds.first,
|
||||
version: 12, // adjust the version according to your requirement
|
||||
),
|
||||
// FirmwareUpdateWidget(
|
||||
// deviceId: deviceIds.first,
|
||||
// version: 12, // adjust the version according to your requirement
|
||||
// ),
|
||||
FactoryResetWidget(
|
||||
callFactoryReset: () {
|
||||
context.read<ThreeGangGlassSwitchBloc>().add(
|
||||
|
@ -2,14 +2,13 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/all_devices/models/factory_reset_model.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/batch_control/factory_reset.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/batch_control/firmware_update.dart';
|
||||
// import 'package:syncrow_web/pages/device_managment/shared/batch_control/firmware_update.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/shared/toggle_widget.dart';
|
||||
import 'package:syncrow_web/utils/helpers/responsice_layout_helper/responsive_layout_helper.dart';
|
||||
|
||||
class LivingRoomBatchControlsView extends StatelessWidget
|
||||
with HelperResponsiveLayout {
|
||||
class LivingRoomBatchControlsView extends StatelessWidget with HelperResponsiveLayout {
|
||||
const LivingRoomBatchControlsView({super.key, required this.deviceIds});
|
||||
|
||||
final List<String> deviceIds;
|
||||
@ -17,16 +16,15 @@ class LivingRoomBatchControlsView extends StatelessWidget
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => LivingRoomBloc(deviceId: deviceIds.first)
|
||||
..add(LivingRoomFetchBatchEvent(deviceIds)),
|
||||
create: (context) =>
|
||||
LivingRoomBloc(deviceId: deviceIds.first)..add(LivingRoomFetchBatchEvent(deviceIds)),
|
||||
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());
|
||||
@ -36,8 +34,7 @@ class LivingRoomBatchControlsView 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);
|
||||
@ -102,10 +99,10 @@ class LivingRoomBatchControlsView extends StatelessWidget
|
||||
);
|
||||
},
|
||||
),
|
||||
FirmwareUpdateWidget(
|
||||
deviceId: deviceIds.first,
|
||||
version: 12,
|
||||
),
|
||||
// FirmwareUpdateWidget(
|
||||
// deviceId: deviceIds.first,
|
||||
// version: 12,
|
||||
// ),
|
||||
FactoryResetWidget(callFactoryReset: () {
|
||||
context.read<LivingRoomBloc>().add(
|
||||
LivingRoomFactoryResetEvent(
|
||||
|
@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/all_devices/models/factory_reset_model.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/batch_control/factory_reset.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/batch_control/firmware_update.dart';
|
||||
// import 'package:syncrow_web/pages/device_managment/shared/batch_control/firmware_update.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/toggle_widget.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/two_g_glass_switch/bloc/two_gang_glass_switch_bloc.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/two_g_glass_switch/models/two_gang_glass_status_model.dart';
|
||||
@ -16,8 +16,8 @@ class TwoGangGlassSwitchBatchControlView extends StatelessWidget with HelperResp
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) =>
|
||||
TwoGangGlassSwitchBloc(deviceId: deviceIds.first)..add(TwoGangGlassSwitchFetchBatchStatusEvent(deviceIds)),
|
||||
create: (context) => TwoGangGlassSwitchBloc(deviceId: deviceIds.first)
|
||||
..add(TwoGangGlassSwitchFetchBatchStatusEvent(deviceIds)),
|
||||
child: BlocBuilder<TwoGangGlassSwitchBloc, TwoGangGlassSwitchState>(
|
||||
builder: (context, state) {
|
||||
if (state is TwoGangGlassSwitchLoading) {
|
||||
@ -83,10 +83,10 @@ class TwoGangGlassSwitchBatchControlView extends StatelessWidget with HelperResp
|
||||
);
|
||||
},
|
||||
),
|
||||
FirmwareUpdateWidget(
|
||||
deviceId: deviceIds.first,
|
||||
version: 12, // adjust the version according to your requirement
|
||||
),
|
||||
// FirmwareUpdateWidget(
|
||||
// deviceId: deviceIds.first,
|
||||
// version: 12, // adjust the version according to your requirement
|
||||
// ),
|
||||
FactoryResetWidget(
|
||||
callFactoryReset: () {
|
||||
context.read<TwoGangGlassSwitchBloc>().add(
|
||||
|
@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/all_devices/models/factory_reset_model.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/batch_control/factory_reset.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/batch_control/firmware_update.dart';
|
||||
// import 'package:syncrow_web/pages/device_managment/shared/batch_control/firmware_update.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/toggle_widget.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/two_gang_switch/bloc/two_gang_switch_bloc.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/two_gang_switch/bloc/two_gang_switch_event.dart';
|
||||
@ -10,8 +10,7 @@ import 'package:syncrow_web/pages/device_managment/two_gang_switch/bloc/two_gang
|
||||
import 'package:syncrow_web/pages/device_managment/two_gang_switch/models/two_gang_status_model.dart';
|
||||
import 'package:syncrow_web/utils/helpers/responsice_layout_helper/responsive_layout_helper.dart';
|
||||
|
||||
class TwoGangBatchControlView extends StatelessWidget
|
||||
with HelperResponsiveLayout {
|
||||
class TwoGangBatchControlView extends StatelessWidget with HelperResponsiveLayout {
|
||||
const TwoGangBatchControlView({super.key, required this.deviceIds});
|
||||
|
||||
final List<String> deviceIds;
|
||||
@ -27,8 +26,7 @@ class TwoGangBatchControlView extends StatelessWidget
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
} else if (state is TwoGangSwitchStatusLoaded) {
|
||||
return _buildStatusControls(context, state.status);
|
||||
} else if (state is TwoGangSwitchError ||
|
||||
state is TwoGangSwitchControlError) {
|
||||
} else if (state is TwoGangSwitchError || state is TwoGangSwitchControlError) {
|
||||
return const Center(child: Text('Error fetching status'));
|
||||
} else {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
@ -84,10 +82,10 @@ class TwoGangBatchControlView extends StatelessWidget
|
||||
));
|
||||
},
|
||||
),
|
||||
FirmwareUpdateWidget(
|
||||
deviceId: deviceIds.first,
|
||||
version: 12,
|
||||
),
|
||||
// FirmwareUpdateWidget(
|
||||
// deviceId: deviceIds.first,
|
||||
// version: 12,
|
||||
// ),
|
||||
FactoryResetWidget(callFactoryReset: () {
|
||||
context.read<TwoGangSwitchBloc>().add(
|
||||
TwoGangFactoryReset(
|
||||
|
@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/all_devices/models/factory_reset_model.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/batch_control/factory_reset.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/batch_control/firmware_update.dart';
|
||||
// import 'package:syncrow_web/pages/device_managment/shared/batch_control/firmware_update.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/sensors_widgets/presence_update_data.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/wall_sensor/bloc/wall_bloc.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/wall_sensor/bloc/wall_event.dart';
|
||||
@ -113,7 +113,7 @@ class WallSensorBatchControlView extends StatelessWidget with HelperResponsiveLa
|
||||
),
|
||||
),
|
||||
),
|
||||
FirmwareUpdateWidget(deviceId: devicesIds.first, version: 2),
|
||||
// FirmwareUpdateWidget(deviceId: devicesIds.first, version: 2),
|
||||
FactoryResetWidget(
|
||||
callFactoryReset: () {
|
||||
context.read<WallSensorBloc>().add(
|
||||
|
@ -2,15 +2,14 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
import 'package:syncrow_web/pages/device_managment/shared/batch_control/factory_reset.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/batch_control/firmware_update.dart';
|
||||
// import 'package:syncrow_web/pages/device_managment/shared/batch_control/firmware_update.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/toggle_widget.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/water_heater/bloc/water_heater_bloc.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/water_heater/models/water_heater_status_model.dart';
|
||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||
import 'package:syncrow_web/utils/helpers/responsice_layout_helper/responsive_layout_helper.dart';
|
||||
|
||||
class WaterHEaterBatchControlView extends StatelessWidget
|
||||
with HelperResponsiveLayout {
|
||||
class WaterHEaterBatchControlView extends StatelessWidget with HelperResponsiveLayout {
|
||||
const WaterHEaterBatchControlView({super.key, required this.deviceIds});
|
||||
|
||||
final List<String> deviceIds;
|
||||
@ -18,8 +17,8 @@ class WaterHEaterBatchControlView extends StatelessWidget
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => WaterHeaterBloc()
|
||||
..add(FetchWaterHeaterBatchStatusEvent(devicesUuid: deviceIds)),
|
||||
create: (context) =>
|
||||
WaterHeaterBloc()..add(FetchWaterHeaterBatchStatusEvent(devicesUuid: deviceIds)),
|
||||
child: BlocBuilder<WaterHeaterBloc, WaterHeaterState>(
|
||||
builder: (context, state) {
|
||||
if (state is WaterHeaterLoadingState) {
|
||||
@ -36,8 +35,7 @@ class WaterHEaterBatchControlView extends StatelessWidget
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildStatusControls(
|
||||
BuildContext context, WaterHeaterStatusModel status) {
|
||||
Widget _buildStatusControls(BuildContext context, WaterHeaterStatusModel status) {
|
||||
final isExtraLarge = isExtraLargeScreenSize(context);
|
||||
final isLarge = isLargeScreenSize(context);
|
||||
final isMedium = isMediumScreenSize(context);
|
||||
@ -73,10 +71,10 @@ class WaterHEaterBatchControlView extends StatelessWidget
|
||||
);
|
||||
},
|
||||
),
|
||||
FirmwareUpdateWidget(
|
||||
deviceId: deviceIds.first,
|
||||
version: 12,
|
||||
),
|
||||
// FirmwareUpdateWidget(
|
||||
// deviceId: deviceIds.first,
|
||||
// version: 12,
|
||||
// ),
|
||||
FactoryResetWidget(
|
||||
callFactoryReset: () {},
|
||||
),
|
||||
|
@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/all_devices/models/factory_reset_model.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/batch_control/factory_reset.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/batch_control/firmware_update.dart';
|
||||
// import 'package:syncrow_web/pages/device_managment/shared/batch_control/firmware_update.dart';
|
||||
|
||||
import 'package:syncrow_web/pages/device_managment/water_leak/bloc/water_leak_bloc.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/water_leak/bloc/water_leak_event.dart';
|
||||
@ -10,18 +10,16 @@ import 'package:syncrow_web/pages/device_managment/water_leak/bloc/water_leak_st
|
||||
import 'package:syncrow_web/pages/device_managment/water_leak/model/water_leak_status_model.dart';
|
||||
import 'package:syncrow_web/utils/helpers/responsice_layout_helper/responsive_layout_helper.dart';
|
||||
|
||||
class WaterLeakBatchControlView extends StatelessWidget
|
||||
with HelperResponsiveLayout {
|
||||
class WaterLeakBatchControlView extends StatelessWidget with HelperResponsiveLayout {
|
||||
final List<String> deviceIds;
|
||||
|
||||
const WaterLeakBatchControlView({Key? key, required this.deviceIds})
|
||||
: super(key: key);
|
||||
const WaterLeakBatchControlView({Key? key, required this.deviceIds}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => WaterLeakBloc(deviceIds.first)
|
||||
..add(FetchWaterLeakBatchStatusEvent(deviceIds)),
|
||||
create: (context) =>
|
||||
WaterLeakBloc(deviceIds.first)..add(FetchWaterLeakBatchStatusEvent(deviceIds)),
|
||||
child: BlocBuilder<WaterLeakBloc, WaterLeakState>(
|
||||
builder: (context, state) {
|
||||
if (state is WaterLeakLoadingState) {
|
||||
@ -38,18 +36,17 @@ class WaterLeakBatchControlView extends StatelessWidget
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildStatusControls(
|
||||
BuildContext context, WaterLeakStatusModel status) {
|
||||
Widget _buildStatusControls(BuildContext context, WaterLeakStatusModel status) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 170,
|
||||
height: 140,
|
||||
child: FirmwareUpdateWidget(deviceId: deviceIds.first, version: 2)),
|
||||
const SizedBox(
|
||||
width: 12,
|
||||
),
|
||||
// SizedBox(
|
||||
// width: 170,
|
||||
// height: 140,
|
||||
// child: FirmwareUpdateWidget(deviceId: deviceIds.first, version: 2)),
|
||||
// const SizedBox(
|
||||
// width: 12,
|
||||
// ),
|
||||
SizedBox(
|
||||
width: 170,
|
||||
height: 140,
|
||||
|
@ -90,40 +90,40 @@ class HomeBloc extends Bloc<HomeEvent, HomeState> {
|
||||
},
|
||||
color: ColorsManager.primaryColor,
|
||||
),
|
||||
HomeItemModel(
|
||||
title: 'Move in',
|
||||
icon: Assets.moveinIcon,
|
||||
active: false,
|
||||
onPress: (context) {},
|
||||
color: ColorsManager.primaryColor,
|
||||
),
|
||||
HomeItemModel(
|
||||
title: 'Construction',
|
||||
icon: Assets.constructionIcon,
|
||||
active: false,
|
||||
onPress: (context) {},
|
||||
color: ColorsManager.primaryColor,
|
||||
),
|
||||
HomeItemModel(
|
||||
title: 'Energy',
|
||||
icon: Assets.energyIcon,
|
||||
active: false,
|
||||
onPress: (context) {},
|
||||
color: ColorsManager.slidingBlueColor.withOpacity(0.2),
|
||||
),
|
||||
HomeItemModel(
|
||||
title: 'Integrations',
|
||||
icon: Assets.integrationsIcon,
|
||||
active: false,
|
||||
onPress: (context) {},
|
||||
color: ColorsManager.slidingBlueColor.withOpacity(0.2),
|
||||
),
|
||||
HomeItemModel(
|
||||
title: 'Asset',
|
||||
icon: Assets.assetIcon,
|
||||
active: false,
|
||||
onPress: (context) {},
|
||||
color: ColorsManager.slidingBlueColor.withOpacity(0.2),
|
||||
),
|
||||
// HomeItemModel(
|
||||
// title: 'Move in',
|
||||
// icon: Assets.moveinIcon,
|
||||
// active: false,
|
||||
// onPress: (context) {},
|
||||
// color: ColorsManager.primaryColor,
|
||||
// ),
|
||||
// HomeItemModel(
|
||||
// title: 'Construction',
|
||||
// icon: Assets.constructionIcon,
|
||||
// active: false,
|
||||
// onPress: (context) {},
|
||||
// color: ColorsManager.primaryColor,
|
||||
// ),
|
||||
// HomeItemModel(
|
||||
// title: 'Energy',
|
||||
// icon: Assets.energyIcon,
|
||||
// active: false,
|
||||
// onPress: (context) {},
|
||||
// color: ColorsManager.slidingBlueColor.withOpacity(0.2),
|
||||
// ),
|
||||
// HomeItemModel(
|
||||
// title: 'Integrations',
|
||||
// icon: Assets.integrationsIcon,
|
||||
// active: false,
|
||||
// onPress: (context) {},
|
||||
// color: ColorsManager.slidingBlueColor.withOpacity(0.2),
|
||||
// ),
|
||||
// HomeItemModel(
|
||||
// title: 'Asset',
|
||||
// icon: Assets.assetIcon,
|
||||
// active: false,
|
||||
// onPress: (context) {},
|
||||
// color: ColorsManager.slidingBlueColor.withOpacity(0.2),
|
||||
// ),
|
||||
];
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ class HomeWebPage extends StatelessWidget {
|
||||
height: size.height * 0.6,
|
||||
width: size.width * 0.68,
|
||||
child: GridView.builder(
|
||||
itemCount: 8,
|
||||
itemCount: 3, //8
|
||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 4,
|
||||
crossAxisSpacing: 20.0,
|
||||
|
@ -22,16 +22,16 @@ class AuthenticationAPI {
|
||||
}) async {
|
||||
final response = await HTTPService().post(
|
||||
path: ApiEndpoints.forgetPassword,
|
||||
body: {"email": email, "password": password,"otpCode": otpCode},
|
||||
body: {"email": email, "password": password, "otpCode": otpCode},
|
||||
showServerMessage: true,
|
||||
expectedResponseModel: (json) {});
|
||||
return response;
|
||||
}
|
||||
|
||||
static Future<int?> sendOtp({required String email, required String regionUuid}) async {
|
||||
static Future<int?> sendOtp({required String email}) async {
|
||||
final response = await HTTPService().post(
|
||||
path: ApiEndpoints.sendOtp,
|
||||
body: {"email": email, "type": "PASSWORD", "regionUuid": regionUuid},
|
||||
body: {"email": email, "type": "PASSWORD"},
|
||||
showServerMessage: true,
|
||||
expectedResponseModel: (json) {
|
||||
return json['data']['cooldown'];
|
||||
|
@ -75,26 +75,26 @@ class _UserDropdownMenuState extends State<UserDropdownMenu> {
|
||||
),
|
||||
),
|
||||
items: <PopupMenuEntry>[
|
||||
PopupMenuItem(
|
||||
onTap: () {},
|
||||
child: ListTile(
|
||||
leading: SvgPicture.asset(Assets.accountSetting),
|
||||
title: Text(
|
||||
"Account Settings",
|
||||
style: context.textTheme.bodyMedium,
|
||||
),
|
||||
),
|
||||
),
|
||||
PopupMenuItem(
|
||||
onTap: () {},
|
||||
child: ListTile(
|
||||
leading: SvgPicture.asset(Assets.settings),
|
||||
title: Text(
|
||||
"Settings",
|
||||
style: context.textTheme.bodyMedium,
|
||||
),
|
||||
),
|
||||
),
|
||||
// PopupMenuItem(
|
||||
// onTap: () {},
|
||||
// child: ListTile(
|
||||
// leading: SvgPicture.asset(Assets.accountSetting),
|
||||
// title: Text(
|
||||
// "Account Settings",
|
||||
// style: context.textTheme.bodyMedium,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// PopupMenuItem(
|
||||
// onTap: () {},
|
||||
// child: ListTile(
|
||||
// leading: SvgPicture.asset(Assets.settings),
|
||||
// title: Text(
|
||||
// "Settings",
|
||||
// style: context.textTheme.bodyMedium,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
PopupMenuItem(
|
||||
onTap: () {
|
||||
showDialog(
|
||||
@ -211,8 +211,10 @@ class _UserDropdownMenuState extends State<UserDropdownMenu> {
|
||||
elevation: 1,
|
||||
child: Text(
|
||||
'Logout',
|
||||
style:
|
||||
Theme.of(context).textTheme.bodyMedium!.copyWith(fontSize: 12, color: Colors.white),
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.bodyMedium!
|
||||
.copyWith(fontSize: 12, color: Colors.white),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
Reference in New Issue
Block a user