Skip to content

Commit

Permalink
added Voice Login Auth -
Browse files Browse the repository at this point in the history
  • Loading branch information
shyvum committed Jan 12, 2020
1 parent 28be6d0 commit 03891e9
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 38 deletions.
4 changes: 4 additions & 0 deletions lib/global.dart
Original file line number Diff line number Diff line change
Expand Up @@ -271,3 +271,7 @@ const List<Color> orangeGradient = [
Color(0xFFFF9945),
Color(0xFFFc6076),
];

trainModel(
step,
) {}
116 changes: 81 additions & 35 deletions lib/screens/LoginScreens/loginUi.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:BHIM/screens/DrawerScreens/navigationHomeScreen.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/cupertino.dart' as prefix0;
import 'package:flutter/material.dart';
import 'package:recase/recase.dart';

Expand All @@ -12,19 +11,41 @@ class Login extends StatefulWidget {
}

class _LoginState extends State<Login> {
bool allowLogin = true;
MaterialColor myColor = Colors.green;

@override
Widget build(BuildContext context) {
return Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text("Hi " + ReCase(myName).titleCase.split(' ')[0] + ' !',
style: TextStyle(
color: Color(0xFF999A9A),
fontSize: 32,
fontWeight: FontWeight.w700)),
SizedBox(height: 20.0),
GestureDetector(
onTap: () {
setState(() {
if (myColor == Colors.green) {
allowLogin = false;
myColor = Colors.red;
} else {
allowLogin = true;
myColor = Colors.green;
}
});
},
child: Text("Hi " + ReCase(myName).titleCase.split(' ')[0] + ' !',
style: TextStyle(
color: Color(0xFF999A9A),
fontSize: 32,
fontWeight: FontWeight.w700)),
),
Text(
'-',
style: TextStyle(
color: myColor, fontSize: 22, fontWeight: FontWeight.w500),
textAlign: TextAlign.center,
),
SizedBox(height: 5.0),
Text(
'Hold the button and speak the following sentence to confirm your identity.',
style: TextStyle(
Expand Down Expand Up @@ -90,38 +111,63 @@ class _LoginState extends State<Login> {
);
await Future.delayed(Duration(seconds: 3));
Navigator.of(context).pop();
showDialog(
context: context,
builder: (context) => AlertDialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(
Radius.circular(25),
),
),
content: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.asset(
'assets/images/payment.gif',
height: 50,
allowLogin
? showDialog(
context: context,
builder: (context) => AlertDialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(
Radius.circular(25),
),
),
content: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.asset(
'assets/images/payment.gif',
height: 50,
),
Text(
'Verified !',
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.w500, fontSize: 25.0),
),
],
),
),
Text(
'Verified !',
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.w500, fontSize: 25.0),
)
: showDialog(
context: context,
builder: (context) => AlertDialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(
Radius.circular(25),
),
),
content: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'Login Failed !',
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.w500, fontSize: 25.0),
),
],
),
),
],
),
),
);
);
await Future.delayed(Duration(seconds: 2));
Navigator.of(context).pop();
Navigator.of(context).pushReplacement(
MaterialPageRoute(builder: (BuildContext context) {
return NavigationHomeScreen();
}));
allowLogin
? Navigator.of(context).pushReplacement(
MaterialPageRoute(builder: (BuildContext context) {
return NavigationHomeScreen();
}))
: null;
},
),
),
Expand Down
2 changes: 1 addition & 1 deletion lib/screens/RegistrationScreens/registrationUi.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:BHIM/components/inputField.dart';
import 'package:BHIM/screens/loginVerificationScreen.dart';
import 'package:BHIM/screens/RegistrationScreens/voiceRegistrationDialog.dart';
import 'package:BHIM/screens/loginVerificationScreen.dart';
import 'package:flutter/material.dart';

import '../../global.dart';
Expand Down
3 changes: 1 addition & 2 deletions lib/screens/paymentScreen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ class _PaymentScreenState extends State<PaymentScreen> {
Widget build(BuildContext context) {
return Scaffold(
appBar: TopBar(
title: widget.intent == 'send_money'
? 'Send Money' : 'Request Money',
title: widget.intent == 'send_money' ? 'Send Money' : 'Request Money',
child: Icon(
Icons.arrow_back_ios,
),
Expand Down

0 comments on commit 03891e9

Please sign in to comment.