diff --git a/lib/pages/approval_page.dart b/lib/pages/approval_page.dart index 5ba85cc..756a014 100644 --- a/lib/pages/approval_page.dart +++ b/lib/pages/approval_page.dart @@ -1,8 +1,8 @@ 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'; +import 'package:ocbo_esign_mobile/blocs/user/functions/bloc_getuser.dart'; +import 'package:ocbo_esign_mobile/widgets/image_widget.dart'; +import 'package:ocbo_esign_mobile/widgets/text_widget.dart'; class ApprovalPage extends StatefulWidget { const ApprovalPage({super.key}); @@ -41,10 +41,11 @@ class _ApprovalPageState extends State { begin: Alignment.topCenter, end: Alignment.bottomCenter, 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(24, 45, 40, 1), + Color.fromRGBO(22, 33, 44, 1), + Color.fromRGBO(30, 56, 50, 1), ], ), ), diff --git a/lib/pages/index_page.dart b/lib/pages/index_page.dart index 4458874..1e59943 100644 --- a/lib/pages/index_page.dart +++ b/lib/pages/index_page.dart @@ -1,9 +1,9 @@ import 'package:flutter/material.dart'; import 'package:gap/gap.dart'; import 'package:go_router/go_router.dart'; -import 'package:ocbo_esign_validator/widgets/menu_widget.dart'; -import 'package:ocbo_esign_validator/widgets/image_widget.dart'; -import 'package:ocbo_esign_validator/widgets/text_widget.dart'; +import 'package:ocbo_esign_mobile/widgets/image_widget.dart'; +import 'package:ocbo_esign_mobile/widgets/menu_widget.dart'; +import 'package:ocbo_esign_mobile/widgets/text_widget.dart'; class IndexPage extends StatelessWidget { const IndexPage({super.key}); @@ -32,10 +32,11 @@ class IndexPage extends StatelessWidget { begin: Alignment.topCenter, end: Alignment.bottomCenter, 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(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( children: [ 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 TextWidget( text: "OCBO e-Sign", @@ -60,7 +61,7 @@ class IndexPage extends StatelessWidget { ], ), ), - const MaxGap(200), + const Gap(184), Row( mainAxisAlignment: MainAxisAlignment.center, 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), ], ), ), diff --git a/lib/pages/login_page.dart b/lib/pages/login_page.dart index 0d481d3..e215f7d 100644 --- a/lib/pages/login_page.dart +++ b/lib/pages/login_page.dart @@ -5,14 +5,14 @@ import 'package:flutter_dotenv/flutter_dotenv.dart'; import 'package:gap/gap.dart'; import 'package:go_router/go_router.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/modal.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/image_widget.dart'; -import 'package:ocbo_esign_validator/widgets/input_widget.dart'; -import 'package:ocbo_esign_validator/widgets/text_widget.dart'; +import 'package:ocbo_esign_mobile/blocs/user/functions/bloc_setuser.dart'; +import 'package:ocbo_esign_mobile/functions/get_api.dart'; +import 'package:ocbo_esign_mobile/functions/modal.dart'; +import 'package:ocbo_esign_mobile/widgets/box_widget.dart'; +import 'package:ocbo_esign_mobile/widgets/button_widget.dart'; +import 'package:ocbo_esign_mobile/widgets/image_widget.dart'; +import 'package:ocbo_esign_mobile/widgets/input_widget.dart'; +import 'package:ocbo_esign_mobile/widgets/text_widget.dart'; class LoginPage extends StatefulWidget { const LoginPage({super.key}); @@ -110,17 +110,18 @@ class _LoginPageState extends State { begin: Alignment.topCenter, end: Alignment.bottomCenter, 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(24, 45, 40, 1), + Color.fromRGBO(22, 33, 44, 1), + Color.fromRGBO(30, 56, 50, 1), ], ), ), child: Column( children: [ 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), BoxWidget( title: 'Login', diff --git a/lib/pages/validate_page.dart b/lib/pages/validate_page.dart index a769922..8d0b6ba 100644 --- a/lib/pages/validate_page.dart +++ b/lib/pages/validate_page.dart @@ -2,8 +2,9 @@ import 'package:flutter/material.dart'; import 'package:flutter_dotenv/flutter_dotenv.dart'; import 'package:gap/gap.dart'; import 'package:mobile_scanner/mobile_scanner.dart'; -import 'package:ocbo_esign_validator/widgets/box_widget.dart'; -import 'package:ocbo_esign_validator/widgets/text_widget.dart'; +import 'package:ocbo_esign_mobile/functions/get_api.dart'; +import 'package:ocbo_esign_mobile/widgets/box_widget.dart'; +import 'package:ocbo_esign_mobile/widgets/text_widget.dart'; import 'package:vibration/vibration.dart'; class ValidatePage extends StatelessWidget { @@ -25,6 +26,23 @@ class BarcodeScannerScreen extends StatefulWidget { class _BarcodeScannerScreenState extends State { 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 Widget build(BuildContext context) { return Scaffold( @@ -37,22 +55,23 @@ class _BarcodeScannerScreenState extends State { begin: Alignment.topCenter, end: Alignment.bottomCenter, 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(24, 45, 40, 1), + Color.fromRGBO(22, 33, 44, 1), + Color.fromRGBO(30, 56, 50, 1), ], ), ), child: Center( child: Padding( - padding: const EdgeInsets.only(top: 70, left: 16, right: 16), + padding: const EdgeInsets.only(top: 64, left: 16, right: 16), child: Column( children: [ Container( padding: EdgeInsets.only(top: 8, bottom: 8, left: 20, right: 20), decoration: BoxDecoration( - color: const Color.fromRGBO(9, 13, 16, 0.623), + color: const Color.fromRGBO(9, 13, 16, 0.725), borderRadius: BorderRadius.circular(32), ), child: const TextWidget(text: 'Scan OCBO e-Sign QR Code', size: 14, bold: true), @@ -60,16 +79,17 @@ class _BarcodeScannerScreenState extends State { const Gap(24), Container( decoration: BoxDecoration( - borderRadius: BorderRadius.circular(24), + borderRadius: BorderRadius.circular(36), + border: BoxBorder.all(color: const Color.fromARGB(58, 227, 227, 227)), boxShadow: [ const BoxShadow( - color: Color.fromRGBO(5, 5, 8, 0.341), - blurRadius: 8.0, + color: Color.fromRGBO(5, 5, 8, 0.526), + blurRadius: 6, offset: Offset(4, 4), // left and up ), const BoxShadow( - color: Color.fromRGBO(92, 71, 97, 0.373), - blurRadius: 8.0, + color: Color.fromRGBO(92, 71, 97, 0.526), + blurRadius: 6, offset: Offset(-4, -4), // right and down ), ], @@ -77,15 +97,13 @@ class _BarcodeScannerScreenState extends State { height: 330, width: 340, child: ClipRRect( - borderRadius: BorderRadius.circular(24), // Adjust the radius as needed + borderRadius: BorderRadius.circular(36), // Adjust the radius as needed child: MobileScanner( fit: BoxFit.cover, onDetect: (BarcodeCapture capture) async { final List barcodes = capture.barcodes; if (barcodes.isNotEmpty && barcodes.first.rawValue != null) { - setState(() { - qrResult = barcodes.first.rawValue!; - }); + readQr(barcodes.first.rawValue!); if (await Vibration.hasVibrator()) { Vibration.vibrate(duration: 100); @@ -95,12 +113,11 @@ class _BarcodeScannerScreenState extends State { ), ), ), - const Gap(40), + const Gap(24), if (qrResult.isNotEmpty) - Padding( - padding: const EdgeInsets.only(left: 16, right: 16), - child: Column( - children: [ + Column( + children: [ + if (qrResult != 'invalid') Row( children: [ Container( @@ -109,17 +126,18 @@ class _BarcodeScannerScreenState extends State { height: 90, decoration: BoxDecoration( 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 ), - 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( crossAxisAlignment: CrossAxisAlignment.start, children: [ const TextWidget( - text: 'Verified', + text: 'Valid', bold: true, size: 22, color: Color.fromRGBO(69, 191, 73, 1), @@ -128,31 +146,62 @@ class _BarcodeScannerScreenState extends State { const TextWidget( text: 'QR is a valid OCBO e-Sign', bold: false, - size: 16, + size: 14, 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), - ], - ), - ), - ], - ), + ], ), ], ),