mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-16 18:16:34 +00:00
Compare commits
6 Commits
power_clam
...
web_issue
Author | SHA1 | Date | |
---|---|---|---|
8b1099c683 | |||
b802a6130d | |||
73ab6f3d05 | |||
bc53605114 | |||
29a2e9285b | |||
5d10b2a35b |
@ -31,7 +31,8 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
|||||||
|
|
||||||
////////////////////////////// forget password //////////////////////////////////
|
////////////////////////////// forget password //////////////////////////////////
|
||||||
final TextEditingController forgetEmailController = TextEditingController();
|
final TextEditingController forgetEmailController = TextEditingController();
|
||||||
final TextEditingController forgetPasswordController = TextEditingController();
|
final TextEditingController forgetPasswordController =
|
||||||
|
TextEditingController();
|
||||||
final TextEditingController forgetOtp = TextEditingController();
|
final TextEditingController forgetOtp = TextEditingController();
|
||||||
final forgetFormKey = GlobalKey<FormState>();
|
final forgetFormKey = GlobalKey<FormState>();
|
||||||
final forgetEmailKey = GlobalKey<FormState>();
|
final forgetEmailKey = GlobalKey<FormState>();
|
||||||
@ -48,7 +49,8 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_remainingTime = 1;
|
_remainingTime = 1;
|
||||||
add(UpdateTimerEvent(remainingTime: _remainingTime, isButtonEnabled: false));
|
add(UpdateTimerEvent(
|
||||||
|
remainingTime: _remainingTime, isButtonEnabled: false));
|
||||||
try {
|
try {
|
||||||
forgetEmailValidate = '';
|
forgetEmailValidate = '';
|
||||||
_remainingTime = (await AuthenticationAPI.sendOtp(
|
_remainingTime = (await AuthenticationAPI.sendOtp(
|
||||||
@ -84,7 +86,8 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
|||||||
_timer?.cancel();
|
_timer?.cancel();
|
||||||
add(const UpdateTimerEvent(remainingTime: 0, isButtonEnabled: true));
|
add(const UpdateTimerEvent(remainingTime: 0, isButtonEnabled: true));
|
||||||
} else {
|
} else {
|
||||||
add(UpdateTimerEvent(remainingTime: _remainingTime, isButtonEnabled: false));
|
add(UpdateTimerEvent(
|
||||||
|
remainingTime: _remainingTime, isButtonEnabled: false));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -94,21 +97,25 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
|||||||
emit(const TimerState(isButtonEnabled: true, remainingTime: 0));
|
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());
|
emit(LoadingForgetState());
|
||||||
try {
|
try {
|
||||||
var response = await AuthenticationAPI.verifyOtp(
|
var response = await AuthenticationAPI.verifyOtp(
|
||||||
email: forgetEmailController.text, otpCode: forgetOtp.text);
|
email: forgetEmailController.text, otpCode: forgetOtp.text);
|
||||||
if (response == true) {
|
if (response == true) {
|
||||||
await AuthenticationAPI.forgetPassword(
|
await AuthenticationAPI.forgetPassword(
|
||||||
password: forgetPasswordController.text, email: forgetEmailController.text);
|
otpCode: forgetOtp.text,
|
||||||
|
password: forgetPasswordController.text,
|
||||||
|
email: forgetEmailController.text);
|
||||||
_timer?.cancel();
|
_timer?.cancel();
|
||||||
emit(const TimerState(isButtonEnabled: true, remainingTime: 0));
|
emit(const TimerState(isButtonEnabled: true, remainingTime: 0));
|
||||||
emit(SuccessForgetState());
|
emit(SuccessForgetState());
|
||||||
}
|
}
|
||||||
} on DioException catch (e) {
|
} on DioException catch (e) {
|
||||||
final errorData = e.response!.data;
|
final errorData = e.response!.data;
|
||||||
String errorMessage = errorData['error']['message'] ?? 'something went wrong';
|
String errorMessage =
|
||||||
|
errorData['error']['message'] ?? 'something went wrong';
|
||||||
validate = errorMessage;
|
validate = errorMessage;
|
||||||
emit(AuthInitialState());
|
emit(AuthInitialState());
|
||||||
}
|
}
|
||||||
@ -122,7 +129,9 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _onUpdateTimer(UpdateTimerEvent event, Emitter<AuthState> emit) {
|
void _onUpdateTimer(UpdateTimerEvent event, Emitter<AuthState> emit) {
|
||||||
emit(TimerState(isButtonEnabled: event.isButtonEnabled, remainingTime: event.remainingTime));
|
emit(TimerState(
|
||||||
|
isButtonEnabled: event.isButtonEnabled,
|
||||||
|
remainingTime: event.remainingTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////// login /////////////////////////////////////
|
///////////////////////////////////// login /////////////////////////////////////
|
||||||
@ -154,7 +163,9 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
|||||||
|
|
||||||
token = await AuthenticationAPI.loginWithEmail(
|
token = await AuthenticationAPI.loginWithEmail(
|
||||||
model: LoginWithEmailModel(
|
model: LoginWithEmailModel(
|
||||||
email: event.username, password: event.password, regionUuid: event.regionUuid),
|
email: event.username,
|
||||||
|
password: event.password,
|
||||||
|
regionUuid: event.regionUuid),
|
||||||
);
|
);
|
||||||
} catch (failure) {
|
} catch (failure) {
|
||||||
validate = 'Invalid Credentials!';
|
validate = 'Invalid Credentials!';
|
||||||
@ -164,7 +175,8 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
|||||||
|
|
||||||
if (token.accessTokenIsNotEmpty) {
|
if (token.accessTokenIsNotEmpty) {
|
||||||
FlutterSecureStorage storage = const FlutterSecureStorage();
|
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(
|
const FlutterSecureStorage().write(
|
||||||
key: UserModel.userUuidKey,
|
key: UserModel.userUuidKey,
|
||||||
value: Token.decodeToken(token.accessToken)['uuid'].toString());
|
value: Token.decodeToken(token.accessToken)['uuid'].toString());
|
||||||
@ -322,12 +334,14 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
|||||||
static Future<String> getTokenAndValidate() async {
|
static Future<String> getTokenAndValidate() async {
|
||||||
try {
|
try {
|
||||||
const storage = FlutterSecureStorage();
|
const storage = FlutterSecureStorage();
|
||||||
final firstLaunch =
|
final firstLaunch = await SharedPreferencesHelper.readBoolFromSP(
|
||||||
await SharedPreferencesHelper.readBoolFromSP(StringsManager.firstLaunch) ?? true;
|
StringsManager.firstLaunch) ??
|
||||||
|
true;
|
||||||
if (firstLaunch) {
|
if (firstLaunch) {
|
||||||
storage.deleteAll();
|
storage.deleteAll();
|
||||||
}
|
}
|
||||||
await SharedPreferencesHelper.saveBoolToSP(StringsManager.firstLaunch, false);
|
await SharedPreferencesHelper.saveBoolToSP(
|
||||||
|
StringsManager.firstLaunch, false);
|
||||||
final value = await storage.read(key: Token.loginAccessTokenKey) ?? '';
|
final value = await storage.read(key: Token.loginAccessTokenKey) ?? '';
|
||||||
if (value.isEmpty) {
|
if (value.isEmpty) {
|
||||||
return 'Token not found';
|
return 'Token not found';
|
||||||
@ -380,7 +394,9 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
|||||||
final String formattedTime = [
|
final String formattedTime = [
|
||||||
if (days > 0) '${days}d', // Append 'd' for days
|
if (days > 0) '${days}d', // Append 'd' for days
|
||||||
if (days > 0 || hours > 0)
|
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'),
|
minutes.toString().padLeft(2, '0'),
|
||||||
seconds.toString().padLeft(2, '0'),
|
seconds.toString().padLeft(2, '0'),
|
||||||
].join(':');
|
].join(':');
|
||||||
|
@ -131,7 +131,10 @@ class _DynamicTableState extends State<DynamicTable> {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
if (widget.withCheckBox) _buildSelectAllCheckbox(),
|
if (widget.withCheckBox) _buildSelectAllCheckbox(),
|
||||||
...widget.headers.map((header) => _buildTableHeaderCell(header)),
|
...List.generate(widget.headers.length, (index) {
|
||||||
|
return _buildTableHeaderCell(widget.headers[index], index);
|
||||||
|
})
|
||||||
|
//...widget.headers.map((header) => _buildTableHeaderCell(header)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -224,7 +227,7 @@ class _DynamicTableState extends State<DynamicTable> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildTableHeaderCell(String title) {
|
Widget _buildTableHeaderCell(String title, int index) {
|
||||||
return Expanded(
|
return Expanded(
|
||||||
child: Container(
|
child: Container(
|
||||||
decoration: const BoxDecoration(
|
decoration: const BoxDecoration(
|
||||||
@ -235,7 +238,7 @@ class _DynamicTableState extends State<DynamicTable> {
|
|||||||
constraints: const BoxConstraints.expand(height: 40),
|
constraints: const BoxConstraints.expand(height: 40),
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 4),
|
padding: EdgeInsets.symmetric(horizontal: index == widget.headers.length - 1 ? 12 : 8.0, vertical: 4),
|
||||||
child: Text(
|
child: Text(
|
||||||
title,
|
title,
|
||||||
style: context.textTheme.titleSmall!.copyWith(
|
style: context.textTheme.titleSmall!.copyWith(
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
@ -431,7 +431,10 @@ class SmartPowerBloc extends Bloc<SmartPowerEvent, SmartPowerState> {
|
|||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
color: Colors.white,
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
),
|
||||||
height: 350,
|
height: 350,
|
||||||
width: 350,
|
width: 350,
|
||||||
child: Column(
|
child: Column(
|
||||||
@ -544,7 +547,10 @@ class SmartPowerBloc extends Bloc<SmartPowerEvent, SmartPowerState> {
|
|||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
color: Colors.white,
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
),
|
||||||
height: 350,
|
height: 350,
|
||||||
width: 350,
|
width: 350,
|
||||||
child: Column(
|
child: Column(
|
||||||
@ -589,14 +595,14 @@ class SmartPowerBloc extends Bloc<SmartPowerEvent, SmartPowerState> {
|
|||||||
TextButton(
|
TextButton(
|
||||||
child: const Text('Cancel'),
|
child: const Text('Cancel'),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.of(context) .pop();
|
Navigator.of(context).pop();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
TextButton(
|
TextButton(
|
||||||
child: const Text('OK'),
|
child: const Text('OK'),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
final selectedDateTime = DateTime(selectedYear);
|
final selectedDateTime = DateTime(selectedYear);
|
||||||
Navigator.of(context).pop(selectedDateTime);
|
Navigator.of(context).pop(selectedDateTime);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -624,9 +630,12 @@ class SmartPowerBloc extends Bloc<SmartPowerEvent, SmartPowerState> {
|
|||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
color: Colors.white,
|
|
||||||
height: 350,
|
height: 350,
|
||||||
width: 350,
|
width: 350,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
@ -702,7 +711,7 @@ class SmartPowerBloc extends Bloc<SmartPowerEvent, SmartPowerState> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Future.delayed(const Duration(milliseconds: 500), () {
|
Future.delayed(const Duration(milliseconds: 500), () {
|
||||||
emit(SmartPowerLoading());
|
emit(FakeState());
|
||||||
});
|
});
|
||||||
// Use the selected picker
|
// Use the selected picker
|
||||||
await dateSelector(event.context).then((newDate) {
|
await dateSelector(event.context).then((newDate) {
|
||||||
@ -718,13 +727,12 @@ class SmartPowerBloc extends Bloc<SmartPowerEvent, SmartPowerState> {
|
|||||||
// formattedDate = newDate.toString();
|
// formattedDate = newDate.toString();
|
||||||
});
|
});
|
||||||
emit(FilterRecordsState(filteredRecords: energyDataList));
|
emit(FilterRecordsState(filteredRecords: energyDataList));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<EnergyData> energyDataList = [];
|
List<EnergyData> energyDataList = [];
|
||||||
void _filterRecordsByDate(
|
void _filterRecordsByDate(
|
||||||
FilterRecordsByDateEvent event, Emitter<SmartPowerState> emit) {
|
FilterRecordsByDateEvent event, Emitter<SmartPowerState> emit) {
|
||||||
emit(SmartPowerLoading());
|
// emit(SmartPowerLoading());
|
||||||
|
|
||||||
if (event.viewType == 'Year') {
|
if (event.viewType == 'Year') {
|
||||||
formattedDate = event.selectedDate.year.toString();
|
formattedDate = event.selectedDate.year.toString();
|
||||||
@ -773,7 +781,7 @@ class SmartPowerBloc extends Bloc<SmartPowerEvent, SmartPowerState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String endChartDate = '';
|
String endChartDate = '';
|
||||||
|
|
||||||
void selectDateRange() async {
|
void selectDateRange() async {
|
||||||
DateTime startDate = dateTime!;
|
DateTime startDate = dateTime!;
|
||||||
DateTime endDate = DateTime(startDate.year, startDate.month + 1, 1)
|
DateTime endDate = DateTime(startDate.year, startDate.month + 1, 1)
|
||||||
|
@ -11,6 +11,7 @@ class SmartPowerState extends Equatable {
|
|||||||
class SmartPowerInitial extends SmartPowerState {}
|
class SmartPowerInitial extends SmartPowerState {}
|
||||||
|
|
||||||
class SmartPowerLoading extends SmartPowerState {}
|
class SmartPowerLoading extends SmartPowerState {}
|
||||||
|
|
||||||
class GetDeviceStatus extends SmartPowerState {}
|
class GetDeviceStatus extends SmartPowerState {}
|
||||||
//GetDeviceStatus
|
//GetDeviceStatus
|
||||||
|
|
||||||
@ -25,6 +26,8 @@ class SmartPowerLoadBatchControll extends SmartPowerState {
|
|||||||
|
|
||||||
class DateSelectedState extends SmartPowerState {}
|
class DateSelectedState extends SmartPowerState {}
|
||||||
|
|
||||||
|
class FakeState extends SmartPowerState {}
|
||||||
|
|
||||||
class SmartPowerStatusLoaded extends SmartPowerState {
|
class SmartPowerStatusLoaded extends SmartPowerState {
|
||||||
final PowerClampModel deviceStatus;
|
final PowerClampModel deviceStatus;
|
||||||
final int currentPage;
|
final int currentPage;
|
||||||
|
@ -93,9 +93,9 @@ class _EnergyConsumptionPageState extends State<EnergyConsumptionPage> {
|
|||||||
Column(
|
Column(
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(top: 15),
|
padding: const EdgeInsets.only(top: 10),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: MediaQuery.of(context).size.height * 0.12,
|
height: MediaQuery.of(context).size.height * 0.11,
|
||||||
child: LineChart(
|
child: LineChart(
|
||||||
LineChartData(
|
LineChartData(
|
||||||
lineTouchData: LineTouchData(
|
lineTouchData: LineTouchData(
|
||||||
@ -227,7 +227,7 @@ class _EnergyConsumptionPageState extends State<EnergyConsumptionPage> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(5.0),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
@ -240,7 +240,7 @@ class _EnergyConsumptionPageState extends State<EnergyConsumptionPage> {
|
|||||||
child: Container(child: widget.widget),
|
child: Container(child: widget.widget),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(
|
const SizedBox(
|
||||||
width: 20,
|
width: 20,
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/painting.dart';
|
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
import 'package:syncrow_web/utils/color_manager.dart';
|
import 'package:syncrow_web/utils/color_manager.dart';
|
||||||
|
|
||||||
@ -20,57 +19,61 @@ class PowerClampInfoCard extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Expanded(
|
return Expanded(
|
||||||
child: Padding(
|
child: Container(
|
||||||
padding: const EdgeInsets.all(5.0),
|
margin: const EdgeInsets.symmetric(horizontal: 6),
|
||||||
child: Container(
|
decoration: BoxDecoration(
|
||||||
decoration: BoxDecoration(
|
color: ColorsManager.whiteColors,
|
||||||
color: ColorsManager.graysColor,
|
borderRadius: BorderRadius.circular(20),
|
||||||
borderRadius: BorderRadius.circular(20),
|
),
|
||||||
),
|
height: 55,
|
||||||
height: 55,
|
child: Row(
|
||||||
child: Row(
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
children: [
|
||||||
children: [
|
const SizedBox(
|
||||||
SvgPicture.asset(
|
width: 16,
|
||||||
iconPath,
|
),
|
||||||
fit: BoxFit.fill,
|
SvgPicture.asset(
|
||||||
),
|
iconPath,
|
||||||
Column(
|
fit: BoxFit.fill,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
),
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
const SizedBox(
|
||||||
children: [
|
width: 18,
|
||||||
Text(
|
),
|
||||||
title,
|
Column(
|
||||||
style: TextStyle(
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
fontSize: 8,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
fontWeight: FontWeight.w400,
|
children: [
|
||||||
|
Text(
|
||||||
|
title,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 8,
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
value,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 15,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
Text(
|
||||||
Row(
|
unit,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
style: const TextStyle(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
fontSize: 15,
|
||||||
children: [
|
fontWeight: FontWeight.w700,
|
||||||
Text(
|
|
||||||
value,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 15,
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Text(
|
),
|
||||||
unit,
|
],
|
||||||
style: TextStyle(
|
),
|
||||||
fontSize: 15,
|
],
|
||||||
fontWeight: FontWeight.w700,
|
)
|
||||||
),
|
],
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -3,9 +3,9 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
|||||||
import 'package:syncrow_web/pages/device_managment/power_clamp/bloc/smart_power_bloc.dart';
|
import 'package:syncrow_web/pages/device_managment/power_clamp/bloc/smart_power_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/power_clamp/bloc/smart_power_event.dart';
|
import 'package:syncrow_web/pages/device_managment/power_clamp/bloc/smart_power_event.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/power_clamp/bloc/smart_power_state.dart';
|
import 'package:syncrow_web/pages/device_managment/power_clamp/bloc/smart_power_state.dart';
|
||||||
|
import 'package:syncrow_web/pages/device_managment/power_clamp/view/phase_widget.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/power_clamp/view/power_chart.dart';
|
import 'package:syncrow_web/pages/device_managment/power_clamp/view/power_chart.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/power_clamp/view/power_info_card.dart';
|
import 'package:syncrow_web/pages/device_managment/power_clamp/view/power_info_card.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/power_clamp/view/phase_widget.dart';
|
|
||||||
import 'package:syncrow_web/pages/device_managment/shared/device_controls_container.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/color_manager.dart';
|
||||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||||
@ -29,6 +29,12 @@ class SmartPowerDeviceControl extends StatelessWidget
|
|||||||
|
|
||||||
if (state is SmartPowerLoading) {
|
if (state is SmartPowerLoading) {
|
||||||
return const Center(child: CircularProgressIndicator());
|
return const Center(child: CircularProgressIndicator());
|
||||||
|
} else if (state is FakeState) {
|
||||||
|
return _buildStatusControls(
|
||||||
|
currentPage: _blocProvider.currentPage,
|
||||||
|
context: context,
|
||||||
|
blocProvider: _blocProvider,
|
||||||
|
);
|
||||||
} else if (state is GetDeviceStatus) {
|
} else if (state is GetDeviceStatus) {
|
||||||
return _buildStatusControls(
|
return _buildStatusControls(
|
||||||
currentPage: _blocProvider.currentPage,
|
currentPage: _blocProvider.currentPage,
|
||||||
@ -56,6 +62,7 @@ class SmartPowerDeviceControl extends StatelessWidget
|
|||||||
}) {
|
}) {
|
||||||
PageController _pageController = PageController(initialPage: currentPage);
|
PageController _pageController = PageController(initialPage: currentPage);
|
||||||
return Container(
|
return Container(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 50),
|
||||||
child: DeviceControlsContainer(
|
child: DeviceControlsContainer(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
@ -66,12 +73,12 @@ class SmartPowerDeviceControl extends StatelessWidget
|
|||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 32,
|
fontSize: 32,
|
||||||
fontWeight: FontWeight.w700,
|
fontWeight: FontWeight.w700,
|
||||||
color: ColorsManager.grayColor),
|
color: ColorsManager.textPrimaryColor),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(10.0),
|
padding: const EdgeInsets.symmetric(vertical: 10),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
@ -102,23 +109,24 @@ class SmartPowerDeviceControl extends StatelessWidget
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
|
||||||
height: 10,
|
|
||||||
),
|
|
||||||
PhaseWidget(
|
PhaseWidget(
|
||||||
phaseData: blocProvider.phaseData,
|
phaseData: blocProvider.phaseData,
|
||||||
),
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
Container(
|
Container(
|
||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
top: 10,
|
top: 10,
|
||||||
left: 20,
|
left: 20,
|
||||||
right: 20,
|
right: 20,
|
||||||
|
bottom: 10,
|
||||||
),
|
),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: ColorsManager.whiteColors,
|
color: ColorsManager.whiteColors,
|
||||||
borderRadius: BorderRadius.circular(20),
|
borderRadius: BorderRadius.circular(20),
|
||||||
),
|
),
|
||||||
height: 325,
|
height: 300,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
@ -164,9 +172,10 @@ class SmartPowerDeviceControl extends StatelessWidget
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 10,
|
height: 5,
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
|
flex: 2,
|
||||||
child: PageView(
|
child: PageView(
|
||||||
controller: _pageController,
|
controller: _pageController,
|
||||||
onPageChanged: (int page) {
|
onPageChanged: (int page) {
|
||||||
@ -176,7 +185,7 @@ class SmartPowerDeviceControl extends StatelessWidget
|
|||||||
children: [
|
children: [
|
||||||
EnergyConsumptionPage(
|
EnergyConsumptionPage(
|
||||||
formattedDate:
|
formattedDate:
|
||||||
'${blocProvider.formattedDate}${blocProvider.endChartDate}',
|
'${blocProvider.dateTime!.day}/${blocProvider.dateTime!.month}/${blocProvider.dateTime!.year} ${blocProvider.endChartDate}',
|
||||||
onTap: () {
|
onTap: () {
|
||||||
blocProvider.add(SelectDateEvent(context: context));
|
blocProvider.add(SelectDateEvent(context: context));
|
||||||
blocProvider.add(FilterRecordsByDateEvent(
|
blocProvider.add(FilterRecordsByDateEvent(
|
||||||
@ -205,7 +214,8 @@ class SmartPowerDeviceControl extends StatelessWidget
|
|||||||
date: blocProvider.formattedDate,
|
date: blocProvider.formattedDate,
|
||||||
),
|
),
|
||||||
EnergyConsumptionPage(
|
EnergyConsumptionPage(
|
||||||
formattedDate: blocProvider.formattedDate,
|
formattedDate:
|
||||||
|
'${blocProvider.dateTime!.day}/${blocProvider.dateTime!.month}/${blocProvider.dateTime!.year} ${blocProvider.endChartDate}',
|
||||||
onTap: () {
|
onTap: () {
|
||||||
blocProvider.add(SelectDateEvent(context: context));
|
blocProvider.add(SelectDateEvent(context: context));
|
||||||
},
|
},
|
||||||
@ -230,7 +240,8 @@ class SmartPowerDeviceControl extends StatelessWidget
|
|||||||
date: blocProvider.formattedDate,
|
date: blocProvider.formattedDate,
|
||||||
),
|
),
|
||||||
EnergyConsumptionPage(
|
EnergyConsumptionPage(
|
||||||
formattedDate: blocProvider.formattedDate,
|
formattedDate:
|
||||||
|
'${blocProvider.dateTime!.day}/${blocProvider.dateTime!.month}/${blocProvider.dateTime!.year} ${blocProvider.endChartDate}',
|
||||||
onTap: () {
|
onTap: () {
|
||||||
blocProvider.add(SelectDateEvent(context: context));
|
blocProvider.add(SelectDateEvent(context: context));
|
||||||
},
|
},
|
||||||
|
@ -52,6 +52,7 @@ class _FactoryResetWidgetState extends State<FactoryResetWidget> {
|
|||||||
child: DefaultButton(
|
child: DefaultButton(
|
||||||
height: 20,
|
height: 20,
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
|
padding: 0,
|
||||||
onPressed: _toggleConfirmation,
|
onPressed: _toggleConfirmation,
|
||||||
backgroundColor: ColorsManager.greyColor,
|
backgroundColor: ColorsManager.greyColor,
|
||||||
child: Text(
|
child: Text(
|
||||||
@ -69,14 +70,16 @@ class _FactoryResetWidgetState extends State<FactoryResetWidget> {
|
|||||||
child: DefaultButton(
|
child: DefaultButton(
|
||||||
height: 20,
|
height: 20,
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
|
padding: 0,
|
||||||
onPressed: widget.callFactoryReset,
|
onPressed: widget.callFactoryReset,
|
||||||
backgroundColor: ColorsManager.red,
|
backgroundColor: ColorsManager.red,
|
||||||
child: Text(
|
child: Text(
|
||||||
'Reset',
|
'Reset',
|
||||||
style: context.textTheme.bodyMedium!.copyWith(
|
style: context.textTheme.bodyMedium!.copyWith(
|
||||||
color: ColorsManager.whiteColors,
|
color: ColorsManager.whiteColors,
|
||||||
fontWeight: FontWeight.w400,
|
fontWeight: FontWeight.w400,
|
||||||
fontSize: 12),
|
fontSize: 12,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -18,10 +18,11 @@ class AuthenticationAPI {
|
|||||||
static Future forgetPassword({
|
static Future forgetPassword({
|
||||||
required var email,
|
required var email,
|
||||||
required var password,
|
required var password,
|
||||||
|
required var otpCode,
|
||||||
}) async {
|
}) async {
|
||||||
final response = await HTTPService().post(
|
final response = await HTTPService().post(
|
||||||
path: ApiEndpoints.forgetPassword,
|
path: ApiEndpoints.forgetPassword,
|
||||||
body: {"email": email, "password": password},
|
body: {"email": email, "password": password,"otpCode": otpCode},
|
||||||
showServerMessage: true,
|
showServerMessage: true,
|
||||||
expectedResponseModel: (json) {});
|
expectedResponseModel: (json) {});
|
||||||
return response;
|
return response;
|
||||||
|
@ -42,4 +42,5 @@ abstract class ColorsManager {
|
|||||||
static const Color textGreen = Color(0xFF008905);
|
static const Color textGreen = Color(0xFF008905);
|
||||||
static const Color yaGreen = Color(0xFFFFBF44);
|
static const Color yaGreen = Color(0xFFFFBF44);
|
||||||
}
|
}
|
||||||
//background: #999999;
|
//background: #background: #5D5D5D;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user