Updated pages

This commit is contained in:
Patrick Alvin Alcala 2025-12-18 17:13:44 +08:00
parent 226588289f
commit 93858c8ded
4 changed files with 128 additions and 66 deletions

View file

@ -1,8 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gap/gap.dart'; import 'package:gap/gap.dart';
import 'package:ocbo_esign_validator/blocs/user/functions/bloc_getuser.dart'; import 'package:ocbo_esign_mobile/blocs/user/functions/bloc_getuser.dart';
import 'package:ocbo_esign_validator/widgets/image_widget.dart'; import 'package:ocbo_esign_mobile/widgets/image_widget.dart';
import 'package:ocbo_esign_validator/widgets/text_widget.dart'; import 'package:ocbo_esign_mobile/widgets/text_widget.dart';
class ApprovalPage extends StatefulWidget { class ApprovalPage extends StatefulWidget {
const ApprovalPage({super.key}); const ApprovalPage({super.key});
@ -41,10 +41,11 @@ class _ApprovalPageState extends State<ApprovalPage> {
begin: Alignment.topCenter, begin: Alignment.topCenter,
end: Alignment.bottomCenter, end: Alignment.bottomCenter,
colors: [ colors: [
Color.fromRGBO(39, 26, 47, 1), Color.fromRGBO(51, 34, 61, 1),
Color.fromRGBO(22, 33, 44, 1), Color.fromRGBO(22, 33, 44, 1),
Color.fromRGBO(22, 33, 44, 1), Color.fromRGBO(22, 33, 44, 1),
Color.fromRGBO(24, 45, 40, 1), Color.fromRGBO(22, 33, 44, 1),
Color.fromRGBO(30, 56, 50, 1),
], ],
), ),
), ),

View file

@ -1,9 +1,9 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gap/gap.dart'; import 'package:gap/gap.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:ocbo_esign_validator/widgets/menu_widget.dart'; import 'package:ocbo_esign_mobile/widgets/image_widget.dart';
import 'package:ocbo_esign_validator/widgets/image_widget.dart'; import 'package:ocbo_esign_mobile/widgets/menu_widget.dart';
import 'package:ocbo_esign_validator/widgets/text_widget.dart'; import 'package:ocbo_esign_mobile/widgets/text_widget.dart';
class IndexPage extends StatelessWidget { class IndexPage extends StatelessWidget {
const IndexPage({super.key}); const IndexPage({super.key});
@ -32,10 +32,11 @@ class IndexPage extends StatelessWidget {
begin: Alignment.topCenter, begin: Alignment.topCenter,
end: Alignment.bottomCenter, end: Alignment.bottomCenter,
colors: [ colors: [
Color.fromRGBO(39, 26, 47, 1), Color.fromRGBO(51, 34, 61, 1),
Color.fromRGBO(22, 33, 44, 1), Color.fromRGBO(22, 33, 44, 1),
Color.fromRGBO(22, 33, 44, 1), Color.fromRGBO(22, 33, 44, 1),
Color.fromRGBO(24, 45, 40, 1), Color.fromRGBO(22, 33, 44, 1),
Color.fromRGBO(30, 56, 50, 1),
], ],
), ),
), ),
@ -43,7 +44,7 @@ class IndexPage extends StatelessWidget {
child: Column( child: Column(
children: [ children: [
const Gap(88), const Gap(88),
const ImageWidget(imagePath: 'assets/logo.png', size: 140, measureByHeight: true), const ImageWidget(imagePath: 'assets/logo.webp', size: 140, measureByHeight: false),
const Gap(24), const Gap(24),
const TextWidget( const TextWidget(
text: "OCBO e-Sign", text: "OCBO e-Sign",
@ -60,7 +61,7 @@ class IndexPage extends StatelessWidget {
], ],
), ),
), ),
const MaxGap(200), const Gap(184),
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
spacing: 32, spacing: 32,
@ -81,6 +82,16 @@ class IndexPage extends StatelessWidget {
), ),
], ],
), ),
const MaxGap(516),
const ImageWidget(imagePath: 'assets/pat-alcala.webp', size: 74, measureByHeight: false),
const Gap(4),
const TextWidget(
text: "Developed By: Pat Alcala",
color: Color.fromRGBO(244, 243, 243, 0.8),
bold: false,
size: 10,
),
const Gap(24),
], ],
), ),
), ),

View file

@ -5,14 +5,14 @@ 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: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_mobile/blocs/user/functions/bloc_setuser.dart';
import 'package:ocbo_esign_validator/functions/get_api.dart'; import 'package:ocbo_esign_mobile/functions/get_api.dart';
import 'package:ocbo_esign_validator/functions/modal.dart'; import 'package:ocbo_esign_mobile/functions/modal.dart';
import 'package:ocbo_esign_validator/widgets/box_widget.dart'; import 'package:ocbo_esign_mobile/widgets/box_widget.dart';
import 'package:ocbo_esign_validator/widgets/button_widget.dart'; import 'package:ocbo_esign_mobile/widgets/button_widget.dart';
import 'package:ocbo_esign_validator/widgets/image_widget.dart'; import 'package:ocbo_esign_mobile/widgets/image_widget.dart';
import 'package:ocbo_esign_validator/widgets/input_widget.dart'; import 'package:ocbo_esign_mobile/widgets/input_widget.dart';
import 'package:ocbo_esign_validator/widgets/text_widget.dart'; import 'package:ocbo_esign_mobile/widgets/text_widget.dart';
class LoginPage extends StatefulWidget { class LoginPage extends StatefulWidget {
const LoginPage({super.key}); const LoginPage({super.key});
@ -110,17 +110,18 @@ class _LoginPageState extends State<LoginPage> {
begin: Alignment.topCenter, begin: Alignment.topCenter,
end: Alignment.bottomCenter, end: Alignment.bottomCenter,
colors: [ colors: [
Color.fromRGBO(39, 26, 47, 1), Color.fromRGBO(51, 34, 61, 1),
Color.fromRGBO(22, 33, 44, 1), Color.fromRGBO(22, 33, 44, 1),
Color.fromRGBO(22, 33, 44, 1), Color.fromRGBO(22, 33, 44, 1),
Color.fromRGBO(24, 45, 40, 1), Color.fromRGBO(22, 33, 44, 1),
Color.fromRGBO(30, 56, 50, 1),
], ],
), ),
), ),
child: Column( child: Column(
children: [ children: [
const Gap(88), const Gap(88),
const ImageWidget(imagePath: 'assets/logo.png', size: 100, measureByHeight: true), const ImageWidget(imagePath: 'assets/logo.webp', size: 100, measureByHeight: true),
const Gap(58), const Gap(58),
BoxWidget( BoxWidget(
title: 'Login', title: 'Login',

View file

@ -2,8 +2,9 @@ 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:mobile_scanner/mobile_scanner.dart'; import 'package:mobile_scanner/mobile_scanner.dart';
import 'package:ocbo_esign_validator/widgets/box_widget.dart'; import 'package:ocbo_esign_mobile/functions/get_api.dart';
import 'package:ocbo_esign_validator/widgets/text_widget.dart'; import 'package:ocbo_esign_mobile/widgets/box_widget.dart';
import 'package:ocbo_esign_mobile/widgets/text_widget.dart';
import 'package:vibration/vibration.dart'; import 'package:vibration/vibration.dart';
class ValidatePage extends StatelessWidget { class ValidatePage extends StatelessWidget {
@ -25,6 +26,23 @@ class BarcodeScannerScreen extends StatefulWidget {
class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> { class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
late String qrResult = ''; late String qrResult = '';
void readQr(String value) async {
if (value.contains('OCBO e-Sign')) {
final response = await getApi('check-qr', value, null);
final result = response["result"];
if (result != '') {
setState(() {
qrResult = result;
});
}
} else {
setState(() {
qrResult = 'invalid';
});
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -37,22 +55,23 @@ class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
begin: Alignment.topCenter, begin: Alignment.topCenter,
end: Alignment.bottomCenter, end: Alignment.bottomCenter,
colors: [ colors: [
Color.fromRGBO(39, 26, 47, 1), Color.fromRGBO(51, 34, 61, 1),
Color.fromRGBO(22, 33, 44, 1), Color.fromRGBO(22, 33, 44, 1),
Color.fromRGBO(22, 33, 44, 1), Color.fromRGBO(22, 33, 44, 1),
Color.fromRGBO(24, 45, 40, 1), Color.fromRGBO(22, 33, 44, 1),
Color.fromRGBO(30, 56, 50, 1),
], ],
), ),
), ),
child: Center( child: Center(
child: Padding( child: Padding(
padding: const EdgeInsets.only(top: 70, left: 16, right: 16), padding: const EdgeInsets.only(top: 64, left: 16, right: 16),
child: Column( child: Column(
children: [ children: [
Container( Container(
padding: EdgeInsets.only(top: 8, bottom: 8, left: 20, right: 20), padding: EdgeInsets.only(top: 8, bottom: 8, left: 20, right: 20),
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color.fromRGBO(9, 13, 16, 0.623), color: const Color.fromRGBO(9, 13, 16, 0.725),
borderRadius: BorderRadius.circular(32), borderRadius: BorderRadius.circular(32),
), ),
child: const TextWidget(text: 'Scan OCBO e-Sign QR Code', size: 14, bold: true), child: const TextWidget(text: 'Scan OCBO e-Sign QR Code', size: 14, bold: true),
@ -60,16 +79,17 @@ class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
const Gap(24), const Gap(24),
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(24), borderRadius: BorderRadius.circular(36),
border: BoxBorder.all(color: const Color.fromARGB(58, 227, 227, 227)),
boxShadow: [ boxShadow: [
const BoxShadow( const BoxShadow(
color: Color.fromRGBO(5, 5, 8, 0.341), color: Color.fromRGBO(5, 5, 8, 0.526),
blurRadius: 8.0, blurRadius: 6,
offset: Offset(4, 4), // left and up offset: Offset(4, 4), // left and up
), ),
const BoxShadow( const BoxShadow(
color: Color.fromRGBO(92, 71, 97, 0.373), color: Color.fromRGBO(92, 71, 97, 0.526),
blurRadius: 8.0, blurRadius: 6,
offset: Offset(-4, -4), // right and down offset: Offset(-4, -4), // right and down
), ),
], ],
@ -77,15 +97,13 @@ class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
height: 330, height: 330,
width: 340, width: 340,
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.circular(24), // Adjust the radius as needed borderRadius: BorderRadius.circular(36), // Adjust the radius as needed
child: MobileScanner( child: MobileScanner(
fit: BoxFit.cover, fit: BoxFit.cover,
onDetect: (BarcodeCapture capture) async { onDetect: (BarcodeCapture capture) async {
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(() { readQr(barcodes.first.rawValue!);
qrResult = barcodes.first.rawValue!;
});
if (await Vibration.hasVibrator()) { if (await Vibration.hasVibrator()) {
Vibration.vibrate(duration: 100); Vibration.vibrate(duration: 100);
@ -95,12 +113,11 @@ class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
), ),
), ),
), ),
const Gap(40), const Gap(24),
if (qrResult.isNotEmpty) if (qrResult.isNotEmpty)
Padding( Column(
padding: const EdgeInsets.only(left: 16, right: 16), children: [
child: Column( if (qrResult != 'invalid')
children: [
Row( Row(
children: [ children: [
Container( Container(
@ -109,17 +126,18 @@ class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
height: 90, height: 90,
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color.fromRGBO(69, 191, 73, 0.1), color: const Color.fromRGBO(69, 191, 73, 0.1),
border: Border.all(color: Color.fromRGBO(69, 191, 73, 1), width: 2), border: Border.all(color: const Color.fromRGBO(69, 191, 73, 1), width: 2),
borderRadius: BorderRadius.circular(99), // Optional: rounded corners borderRadius: BorderRadius.circular(99), // Optional: rounded corners
), ),
child: Icon(Icons.thumb_up, color: const Color.fromRGBO(69, 191, 73, 1), size: 48), child: Icon(Icons.check, color: const Color.fromRGBO(69, 191, 73, 1), size: 48),
), ),
const Gap(32), const Gap(24),
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
const TextWidget( const TextWidget(
text: 'Verified', text: 'Valid',
bold: true, bold: true,
size: 22, size: 22,
color: Color.fromRGBO(69, 191, 73, 1), color: Color.fromRGBO(69, 191, 73, 1),
@ -128,31 +146,62 @@ class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
const TextWidget( const TextWidget(
text: 'QR is a valid OCBO e-Sign', text: 'QR is a valid OCBO e-Sign',
bold: false, bold: false,
size: 16, size: 14,
color: Color.fromRGBO(69, 191, 73, 1), color: Color.fromRGBO(69, 191, 73, 1),
), ),
], ],
), ),
const Gap(24),
BoxWidget(
title: '',
content: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const TextWidget(text: 'Name', bold: true, size: 14),
const Gap(8),
TextWidget(text: qrResult, bold: false, size: 14),
],
),
),
],
)
else
Row(
children: [
Container(
padding: EdgeInsets.all(0),
width: 90,
height: 90,
decoration: BoxDecoration(
color: const Color.fromRGBO(206, 74, 77, 0.1),
border: Border.all(color: const Color.fromRGBO(206, 74, 77, 1), width: 2),
borderRadius: BorderRadius.circular(99),
),
child: Icon(Icons.close, color: const Color.fromRGBO(206, 74, 77, 1), size: 48),
),
const Gap(24),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const TextWidget(
text: 'Invalid',
bold: true,
size: 22,
color: Color.fromRGBO(206, 74, 77, 1),
),
const Gap(16),
const TextWidget(
text: 'QR is a not valid OCBO e-Sign',
bold: false,
size: 14,
color: Color.fromRGBO(206, 74, 77, 1),
),
],
),
], ],
), ),
const Gap(32), ],
BoxWidget(
title: '',
content: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextWidget(text: 'Name', bold: true, size: 14),
const Gap(8),
TextWidget(text: dotenv.env['HEAD']!, bold: false, size: 14),
const Gap(16),
TextWidget(text: 'Role:', bold: true, size: 14),
const Gap(8),
TextWidget(text: 'APPROVER', bold: false, size: 14),
],
),
),
],
),
), ),
], ],
), ),