All characters cannot be 1

This commit is contained in:
mohammad
2024-07-01 15:41:53 +03:00
parent dbdf9fca76
commit a802fd2955
3 changed files with 10 additions and 9 deletions

View File

@ -185,8 +185,7 @@ class SmartDoorBloc extends Bloc<SmartDoorEvent, SmartDoorState> {
}
} else {
if (effectiveTimeTimeStamp != null && selectedTimestamp < effectiveTimeTimeStamp!) {
CustomSnackBar.displaySnackBar(
'Expiration Time cannot be earlier than Effective Time.');
CustomSnackBar.displaySnackBar('Expiration Time cannot be earlier than Effective Time.');
} else {
expirationTime =
selectedDateTime.toString().split('.').first; // Remove seconds and milliseconds

View File

@ -11,6 +11,7 @@ import 'package:syncrow_app/features/shared_widgets/default_container.dart';
import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';
import 'package:syncrow_app/utils/helpers/snack_bar.dart';
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
import 'package:syncrow_app/utils/resource_manager/font_manager.dart';
import 'package:time_picker_spinner/time_picker_spinner.dart';
@ -67,8 +68,7 @@ class CreateTemporaryPassword extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const BodyMedium(
text:
'Save the password immediately. The password is not displayed in the app.',
text: 'Save the password immediately. The password is not displayed in the app.',
fontWeight: FontWeight.normal,
fontColor: ColorsManager.grayColor,
),
@ -89,6 +89,12 @@ class CreateTemporaryPassword extends StatelessWidget {
Flexible(
flex: 2,
child: PinCodeTextField(
onCompleted: (value) {
if (value.split('').every((char) => char == '1')) {
BlocProvider.of<SmartDoorBloc>(context).passwordController.clear();
CustomSnackBar.displaySnackBar('All characters cannot be 1.');
}
},
autoDisposeControllers: false,
keyboardType: TextInputType.phone,
length: 7,
@ -109,8 +115,7 @@ class CreateTemporaryPassword extends StatelessWidget {
animationDuration: const Duration(milliseconds: 300),
backgroundColor: Colors.white,
enableActiveFill: false,
controller:
BlocProvider.of<SmartDoorBloc>(context).passwordController,
controller: BlocProvider.of<SmartDoorBloc>(context).passwordController,
appContext: context,
)),
const SizedBox(

View File

@ -1,11 +1,8 @@
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:syncrow_app/features/devices/model/device_model.dart';
import 'package:syncrow_app/features/devices/model/temporary_password_model.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/title_medium.dart';
import 'package:syncrow_app/utils/context_extension.dart';
import 'package:syncrow_app/utils/helpers/snack_bar.dart';
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
import 'package:syncrow_app/utils/resource_manager/font_manager.dart';