mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-10-23 14:17:55 +00:00
CreateTemporaryPassword
This commit is contained in:
@@ -219,20 +219,24 @@ class SmartDoorBloc extends Bloc<SmartDoorEvent, SmartDoorState> {
|
||||
}
|
||||
|
||||
bool _validateInputs(BuildContext context) {
|
||||
if (passwordController.text.length<7) {
|
||||
CustomSnackBar.displaySnackBar('Password less than 7');
|
||||
return true;
|
||||
}
|
||||
if (passwordController.text.isEmpty) {
|
||||
_showSnackBar(context, 'Password required');
|
||||
CustomSnackBar.displaySnackBar('Password required');
|
||||
return true;
|
||||
}
|
||||
if (passwordNameController.text.isEmpty) {
|
||||
_showSnackBar(context, 'Password name required');
|
||||
CustomSnackBar.displaySnackBar('Password name required');
|
||||
return true;
|
||||
}
|
||||
if (effectiveTime == 'Select Time' || effectiveTimeTimeStamp == null) {
|
||||
_showSnackBar(context, 'Select effective time');
|
||||
CustomSnackBar.displaySnackBar('Select effective time');
|
||||
return true;
|
||||
}
|
||||
if (expirationTime == 'Select Time' || expirationTimeTimeStamp == null) {
|
||||
_showSnackBar(context, 'Select expiration time');
|
||||
CustomSnackBar.displaySnackBar('Select expiration time');
|
||||
return true;
|
||||
}
|
||||
if (repeat == true &&
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:day_picker/day_picker.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:pin_code_fields/pin_code_fields.dart';
|
||||
import 'package:syncrow_app/features/devices/bloc/smart_door_bloc/smart_door_bloc.dart';
|
||||
@@ -46,7 +47,7 @@ class CreateTemporaryPassword extends StatelessWidget {
|
||||
),
|
||||
leading: IconButton(onPressed: () {
|
||||
Navigator.of(context).pop('UpdatePage');
|
||||
}, icon: Icon(Icons.arrow_back)),
|
||||
}, icon: const Icon(Icons.arrow_back)),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
@@ -123,6 +124,11 @@ class CreateTemporaryPassword extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
BlocProvider.of<SmartDoorBloc>(context).passwordController.text.isNotEmpty?
|
||||
TextButton(onPressed: () async {
|
||||
await Clipboard.setData(ClipboardData(text: BlocProvider.of<SmartDoorBloc>(context).passwordController.text));
|
||||
},
|
||||
child: const Text('Copy')):SizedBox(),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
@@ -192,6 +198,7 @@ class CreateTemporaryPassword extends StatelessWidget {
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
if(type=='Online Password')
|
||||
DefaultContainer(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 5, vertical: 5),
|
||||
|
||||
@@ -49,7 +49,6 @@ class TemporaryPasswordPage extends StatelessWidget {
|
||||
Navigator.of(context).push(MaterialPageRoute(builder: (context) => ViewTemporaryPassword(deviceId:deviceId,type:'Online Password'),));
|
||||
},
|
||||
trailing: const Icon(
|
||||
|
||||
Icons.arrow_forward_ios,
|
||||
color: ColorsManager.greyColor,
|
||||
size: 15,
|
||||
|
||||
@@ -24,7 +24,6 @@ class ViewTemporaryPassword extends StatelessWidget {
|
||||
SmartDoorBloc(deviceId: deviceId!)..add(InitialPasswordsPage(type:type )),
|
||||
child: BlocConsumer<SmartDoorBloc, SmartDoorState>(
|
||||
listener: (context, state) {
|
||||
print('=======4${state}');
|
||||
if (state is FailedState) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
@@ -35,7 +34,6 @@ class ViewTemporaryPassword extends StatelessWidget {
|
||||
}
|
||||
}, builder: (context, state) {
|
||||
final smartDoorBloc = BlocProvider.of<SmartDoorBloc>(context);
|
||||
|
||||
return DefaultScaffold(
|
||||
title: 'Passwords',
|
||||
actions: [
|
||||
@@ -45,9 +43,9 @@ class ViewTemporaryPassword extends StatelessWidget {
|
||||
builder: (context) => CreateTemporaryPassword(deviceId: deviceId, type: type),
|
||||
)).then((result) {
|
||||
if (result != null) {
|
||||
smartDoorBloc.add(InitialPasswordsPage(type:type )); }
|
||||
smartDoorBloc.add(InitialPasswordsPage(type:type ));
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
icon: const Icon(Icons.add))
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user