Updated pages
This commit is contained in:
parent
1b86907d1b
commit
a60d6284ca
3 changed files with 103 additions and 9 deletions
|
|
@ -1,10 +1,71 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:gap/gap.dart';
|
||||||
|
import 'package:ocbo_esign_validator/blocs/user/functions/bloc_getuser.dart';
|
||||||
|
import 'package:ocbo_esign_validator/widgets/image_widget.dart';
|
||||||
|
import 'package:ocbo_esign_validator/widgets/text_widget.dart';
|
||||||
|
|
||||||
class ApprovalPage extends StatelessWidget {
|
class ApprovalPage extends StatefulWidget {
|
||||||
const ApprovalPage({super.key});
|
const ApprovalPage({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<ApprovalPage> createState() => _ApprovalPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ApprovalPageState extends State<ApprovalPage> {
|
||||||
|
late String blocUser = '';
|
||||||
|
|
||||||
|
Future<String> _getUser() async {
|
||||||
|
final user = await blocGetUser(context);
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _initUser() async {
|
||||||
|
blocUser = await _getUser();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
_initUser();
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold();
|
return Scaffold(
|
||||||
|
resizeToAvoidBottomInset: false,
|
||||||
|
body: Container(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
height: MediaQuery.of(context).size.height,
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
gradient: LinearGradient(
|
||||||
|
begin: Alignment.topCenter,
|
||||||
|
end: Alignment.bottomCenter,
|
||||||
|
colors: [
|
||||||
|
Color.fromRGBO(39, 26, 47, 1),
|
||||||
|
Color.fromRGBO(22, 33, 44, 1),
|
||||||
|
Color.fromRGBO(22, 33, 44, 1),
|
||||||
|
Color.fromRGBO(24, 45, 40, 1),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
const Gap(76),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
const Gap(16),
|
||||||
|
const ImageWidget(imagePath: 'assets/logo.png', size: 32, measureByHeight: true),
|
||||||
|
const Gap(8),
|
||||||
|
TextWidget(text: blocUser, size: 16, bold: true),
|
||||||
|
const MaxGap(80),
|
||||||
|
Icon(Icons.menu, size: 20, color: Colors.white),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const Gap(32),
|
||||||
|
TextWidget(text: blocUser, size: 16, bold: true),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,11 @@ import 'dart:developer';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||||
import 'package:gap/gap.dart';
|
import 'package:gap/gap.dart';
|
||||||
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:hashlib/hashlib.dart';
|
import 'package:hashlib/hashlib.dart';
|
||||||
|
import 'package:ocbo_esign_validator/blocs/user/functions/bloc_setuser.dart';
|
||||||
import 'package:ocbo_esign_validator/functions/get_api.dart';
|
import 'package:ocbo_esign_validator/functions/get_api.dart';
|
||||||
|
import 'package:ocbo_esign_validator/functions/modal.dart';
|
||||||
import 'package:ocbo_esign_validator/widgets/box_widget.dart';
|
import 'package:ocbo_esign_validator/widgets/box_widget.dart';
|
||||||
import 'package:ocbo_esign_validator/widgets/button_widget.dart';
|
import 'package:ocbo_esign_validator/widgets/button_widget.dart';
|
||||||
import 'package:ocbo_esign_validator/widgets/image_widget.dart';
|
import 'package:ocbo_esign_validator/widgets/image_widget.dart';
|
||||||
|
|
@ -66,14 +69,26 @@ class _LoginPageState extends State<LoginPage> {
|
||||||
final employeeid = _approverId;
|
final employeeid = _approverId;
|
||||||
final dbpassword = await _getPassword(employeeid);
|
final dbpassword = await _getPassword(employeeid);
|
||||||
final hashPassword = await _securePassword(_passwordController.text);
|
final hashPassword = await _securePassword(_passwordController.text);
|
||||||
if (dbpassword == hashPassword) {
|
|
||||||
log('yeah');
|
if (context.mounted) {
|
||||||
} else {
|
if (dbpassword == hashPassword) {
|
||||||
log('no');
|
_setLogin();
|
||||||
|
} else {
|
||||||
|
_showDialog();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _setLogin() {
|
||||||
|
blocSetUser(context, _approver);
|
||||||
|
context.push('/approval');
|
||||||
|
}
|
||||||
|
|
||||||
|
void _showDialog() {
|
||||||
|
showModal(context, 'Error', 'Invalid password, try again.', true);
|
||||||
|
}
|
||||||
|
|
||||||
void _ignoreButton() {}
|
void _ignoreButton() {}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ class BarcodeScannerScreen extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
|
class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
|
||||||
String barcodeResult = "Point the camera at a barcode";
|
late String qrResult = '';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
@ -54,7 +54,7 @@ class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
|
||||||
),
|
),
|
||||||
child: TextWidget(text: 'Scan OCBO e-Sign QR Code', size: 14, bold: true),
|
child: TextWidget(text: 'Scan OCBO e-Sign QR Code', size: 14, bold: true),
|
||||||
),
|
),
|
||||||
Gap(50),
|
const Gap(50),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 350,
|
height: 350,
|
||||||
child: ClipRRect(
|
child: ClipRRect(
|
||||||
|
|
@ -65,13 +65,31 @@ class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
|
||||||
final List<Barcode> barcodes = capture.barcodes;
|
final List<Barcode> barcodes = capture.barcodes;
|
||||||
if (barcodes.isNotEmpty && barcodes.first.rawValue != null) {
|
if (barcodes.isNotEmpty && barcodes.first.rawValue != null) {
|
||||||
setState(() {
|
setState(() {
|
||||||
barcodeResult = barcodes.first.rawValue!;
|
qrResult = barcodes.first.rawValue!;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
const Gap(40),
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.all(0),
|
||||||
|
width: 120,
|
||||||
|
height: 120,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(
|
||||||
|
color: Color.fromRGBO(59, 169, 62, 1),
|
||||||
|
width: 2,
|
||||||
|
), // Background color of the container
|
||||||
|
borderRadius: BorderRadius.circular(99), // Optional: rounded corners
|
||||||
|
),
|
||||||
|
child: Icon(Icons.thumb_up, color: const Color.fromRGBO(59, 169, 62, 1), size: 80),
|
||||||
|
),
|
||||||
|
const Gap(16),
|
||||||
|
const TextWidget(text: 'Verified', size: 20, bold: true, color: Color.fromRGBO(59, 169, 62, 1)),
|
||||||
|
const Gap(16),
|
||||||
|
TextWidget(text: qrResult, size: 20, bold: true),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue