mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
new HourPicker
This commit is contained in:
@ -2,7 +2,6 @@ import 'dart:math';
|
|||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.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:fluttertoast/fluttertoast.dart';
|
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:syncrow_web/pages/common/custom_dialog.dart';
|
import 'package:syncrow_web/pages/common/custom_dialog.dart';
|
||||||
import 'package:syncrow_web/pages/common/hour_picker_dialog.dart';
|
import 'package:syncrow_web/pages/common/hour_picker_dialog.dart';
|
||||||
@ -53,6 +52,7 @@ class VisitorPasswordBloc extends Bloc<VisitorPasswordEvent, VisitorPasswordStat
|
|||||||
String accessTypeSelected = 'Online Password';
|
String accessTypeSelected = 'Online Password';
|
||||||
String usageFrequencySelected = 'One-Time';
|
String usageFrequencySelected = 'One-Time';
|
||||||
String passwordController = '';
|
String passwordController = '';
|
||||||
|
String accessPeriodValidate = '';
|
||||||
|
|
||||||
bool repeat = false;
|
bool repeat = false;
|
||||||
|
|
||||||
@ -379,25 +379,17 @@ class VisitorPasswordBloc extends Bloc<VisitorPasswordEvent, VisitorPasswordStat
|
|||||||
1000; // Divide by 1000 to remove milliseconds
|
1000; // Divide by 1000 to remove milliseconds
|
||||||
if (event.isEffective) {
|
if (event.isEffective) {
|
||||||
if (expirationTimeTimeStamp != null && selectedTimestamp > expirationTimeTimeStamp!) {
|
if (expirationTimeTimeStamp != null && selectedTimestamp > expirationTimeTimeStamp!) {
|
||||||
showCustomToast(
|
accessPeriodValidate="Effective Time cannot be later than Expiration Time.";
|
||||||
message: "Effective Time cannot be later than Expiration Time.",
|
|
||||||
gravity: ToastGravity.CENTER,
|
|
||||||
textColor: Colors.white,
|
|
||||||
fontSize: 16.0,
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
|
accessPeriodValidate='';
|
||||||
effectiveTime = selectedDateTime.toString().split('.').first;
|
effectiveTime = selectedDateTime.toString().split('.').first;
|
||||||
effectiveTimeTimeStamp = selectedTimestamp;
|
effectiveTimeTimeStamp = selectedTimestamp;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (effectiveTimeTimeStamp != null && selectedTimestamp < effectiveTimeTimeStamp!) {
|
if (effectiveTimeTimeStamp != null && selectedTimestamp < effectiveTimeTimeStamp!) {
|
||||||
showCustomToast(
|
accessPeriodValidate= 'Expiration Time cannot be earlier than Effective Time.';
|
||||||
message: 'Expiration Time cannot be earlier than Effective Time.',
|
|
||||||
gravity: ToastGravity.CENTER,
|
|
||||||
textColor: Colors.white,
|
|
||||||
fontSize: 16.0,
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
|
accessPeriodValidate='';
|
||||||
expirationTime = selectedDateTime.toString().split('.').first;
|
expirationTime = selectedDateTime.toString().split('.').first;
|
||||||
expirationTimeTimeStamp = selectedTimestamp;
|
expirationTimeTimeStamp = selectedTimestamp;
|
||||||
}
|
}
|
||||||
|
@ -404,6 +404,9 @@ class VisitorPasswordDialog extends StatelessWidget {
|
|||||||
? visitorBloc.expirationTime
|
? visitorBloc.expirationTime
|
||||||
: visitorBloc.endTimeAccess.toString(),
|
: visitorBloc.endTimeAccess.toString(),
|
||||||
icon: Assets.calendarIcon),
|
icon: Assets.calendarIcon),
|
||||||
|
const SizedBox(height: 10,),
|
||||||
|
Text(visitorBloc.accessPeriodValidate,
|
||||||
|
style: Theme.of(context).textTheme.bodyMedium!.copyWith(color: ColorsManager.red),),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 20,
|
height: 20,
|
||||||
),
|
),
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:fluttertoast/fluttertoast.dart';
|
|
||||||
import 'color_manager.dart';
|
import 'color_manager.dart';
|
||||||
|
|
||||||
InputDecoration? textBoxDecoration({bool suffixIcon = false}) =>
|
InputDecoration? textBoxDecoration({bool suffixIcon = false}) =>
|
||||||
@ -43,25 +42,3 @@ BoxDecoration containerDecoration = BoxDecoration(
|
|||||||
color: ColorsManager.boxColor,
|
color: ColorsManager.boxColor,
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(10)));
|
borderRadius: const BorderRadius.all(Radius.circular(10)));
|
||||||
|
|
||||||
|
|
||||||
/// A function to display a customizable toast message
|
|
||||||
void showCustomToast({
|
|
||||||
required String message,
|
|
||||||
ToastGravity gravity = ToastGravity.BOTTOM,
|
|
||||||
Color textColor = Colors.white,
|
|
||||||
Toast toastLength = Toast.LENGTH_SHORT,
|
|
||||||
int timeInSecForIosWeb = 2,
|
|
||||||
double fontSize = 16.0,
|
|
||||||
}) {
|
|
||||||
Fluttertoast.showToast(
|
|
||||||
msg: message,
|
|
||||||
webBgColor: "linear-gradient(to right, #dc1c13, #dc1c13)",
|
|
||||||
webPosition:'right' ,
|
|
||||||
toastLength: toastLength,
|
|
||||||
webShowClose: true,
|
|
||||||
gravity: gravity,
|
|
||||||
timeInSecForIosWeb: timeInSecForIosWeb,
|
|
||||||
textColor: textColor,
|
|
||||||
fontSize: fontSize,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
@ -232,14 +232,6 @@ packages:
|
|||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.0"
|
version: "0.0.0"
|
||||||
fluttertoast:
|
|
||||||
dependency: "direct main"
|
|
||||||
description:
|
|
||||||
name: fluttertoast
|
|
||||||
sha256: "95f349437aeebe524ef7d6c9bde3e6b4772717cf46a0eb6a3ceaddc740b297cc"
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "8.2.8"
|
|
||||||
get_it:
|
get_it:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -49,7 +49,6 @@ dependencies:
|
|||||||
intl: ^0.19.0
|
intl: ^0.19.0
|
||||||
dropdown_search: ^5.0.6
|
dropdown_search: ^5.0.6
|
||||||
flutter_dotenv: ^5.1.0
|
flutter_dotenv: ^5.1.0
|
||||||
fluttertoast: ^8.2.8
|
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
Reference in New Issue
Block a user