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:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:fluttertoast/fluttertoast.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:syncrow_web/pages/common/custom_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 usageFrequencySelected = 'One-Time';
|
||||
String passwordController = '';
|
||||
String accessPeriodValidate = '';
|
||||
|
||||
bool repeat = false;
|
||||
|
||||
@ -379,25 +379,17 @@ class VisitorPasswordBloc extends Bloc<VisitorPasswordEvent, VisitorPasswordStat
|
||||
1000; // Divide by 1000 to remove milliseconds
|
||||
if (event.isEffective) {
|
||||
if (expirationTimeTimeStamp != null && selectedTimestamp > expirationTimeTimeStamp!) {
|
||||
showCustomToast(
|
||||
message: "Effective Time cannot be later than Expiration Time.",
|
||||
gravity: ToastGravity.CENTER,
|
||||
textColor: Colors.white,
|
||||
fontSize: 16.0,
|
||||
);
|
||||
accessPeriodValidate="Effective Time cannot be later than Expiration Time.";
|
||||
} else {
|
||||
accessPeriodValidate='';
|
||||
effectiveTime = selectedDateTime.toString().split('.').first;
|
||||
effectiveTimeTimeStamp = selectedTimestamp;
|
||||
}
|
||||
} else {
|
||||
if (effectiveTimeTimeStamp != null && selectedTimestamp < effectiveTimeTimeStamp!) {
|
||||
showCustomToast(
|
||||
message: 'Expiration Time cannot be earlier than Effective Time.',
|
||||
gravity: ToastGravity.CENTER,
|
||||
textColor: Colors.white,
|
||||
fontSize: 16.0,
|
||||
);
|
||||
accessPeriodValidate= 'Expiration Time cannot be earlier than Effective Time.';
|
||||
} else {
|
||||
accessPeriodValidate='';
|
||||
expirationTime = selectedDateTime.toString().split('.').first;
|
||||
expirationTimeTimeStamp = selectedTimestamp;
|
||||
}
|
||||
|
@ -404,6 +404,9 @@ class VisitorPasswordDialog extends StatelessWidget {
|
||||
? visitorBloc.expirationTime
|
||||
: visitorBloc.endTimeAccess.toString(),
|
||||
icon: Assets.calendarIcon),
|
||||
const SizedBox(height: 10,),
|
||||
Text(visitorBloc.accessPeriodValidate,
|
||||
style: Theme.of(context).textTheme.bodyMedium!.copyWith(color: ColorsManager.red),),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
|
@ -1,5 +1,4 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:fluttertoast/fluttertoast.dart';
|
||||
import 'color_manager.dart';
|
||||
|
||||
InputDecoration? textBoxDecoration({bool suffixIcon = false}) =>
|
||||
@ -43,25 +42,3 @@ BoxDecoration containerDecoration = BoxDecoration(
|
||||
color: ColorsManager.boxColor,
|
||||
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
|
||||
source: sdk
|
||||
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:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -49,7 +49,6 @@ dependencies:
|
||||
intl: ^0.19.0
|
||||
dropdown_search: ^5.0.6
|
||||
flutter_dotenv: ^5.1.0
|
||||
fluttertoast: ^8.2.8
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
Reference in New Issue
Block a user