From cbb142b0cf3f36f0a1ef88dc5499a6fefa90ebff Mon Sep 17 00:00:00 2001 From: Patrick Alvin Alcala Date: Mon, 15 Dec 2025 17:37:26 +0800 Subject: [PATCH] Updated pages --- lib/pages/index_page.dart | 4 +- lib/pages/validate_page.dart | 114 +++++++++++++++++++++++++++-------- 2 files changed, 91 insertions(+), 27 deletions(-) diff --git a/lib/pages/index_page.dart b/lib/pages/index_page.dart index 44c35ac..4458874 100644 --- a/lib/pages/index_page.dart +++ b/lib/pages/index_page.dart @@ -53,14 +53,14 @@ class IndexPage extends StatelessWidget { ), Padding( padding: EdgeInsets.only(right: (screenWidth / 2) - 100), - child: Row( + child: const Row( mainAxisAlignment: MainAxisAlignment.end, children: [ TextWidget(text: "Mobile", color: Color.fromARGB(255, 244, 243, 243), bold: false, size: 16), ], ), ), - Gap(200), + const MaxGap(200), Row( mainAxisAlignment: MainAxisAlignment.center, spacing: 32, diff --git a/lib/pages/validate_page.dart b/lib/pages/validate_page.dart index 469a866..a769922 100644 --- a/lib/pages/validate_page.dart +++ b/lib/pages/validate_page.dart @@ -1,7 +1,10 @@ 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:vibration/vibration.dart'; class ValidatePage extends StatelessWidget { const ValidatePage({super.key}); @@ -43,53 +46,114 @@ class _BarcodeScannerScreenState extends State { ), child: Center( child: Padding( - padding: const EdgeInsets.only(top: 88, left: 16, right: 16), + padding: const EdgeInsets.only(top: 70, left: 16, right: 16), child: Column( children: [ Container( padding: EdgeInsets.only(top: 8, bottom: 8, left: 20, right: 20), decoration: BoxDecoration( - color: Color.fromARGB(149, 16, 22, 28), - borderRadius: BorderRadius.circular(8), + color: const Color.fromRGBO(9, 13, 16, 0.623), + borderRadius: BorderRadius.circular(32), ), - child: 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), ), - const Gap(50), - SizedBox( - height: 350, + const Gap(24), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(24), + boxShadow: [ + const BoxShadow( + color: Color.fromRGBO(5, 5, 8, 0.341), + blurRadius: 8.0, + offset: Offset(4, 4), // left and up + ), + const BoxShadow( + color: Color.fromRGBO(92, 71, 97, 0.373), + blurRadius: 8.0, + offset: Offset(-4, -4), // right and down + ), + ], + ), + height: 330, + width: 340, child: ClipRRect( - borderRadius: BorderRadius.circular(20), // Adjust the radius as needed + borderRadius: BorderRadius.circular(24), // Adjust the radius as needed child: MobileScanner( fit: BoxFit.cover, - onDetect: (BarcodeCapture capture) { + onDetect: (BarcodeCapture capture) async { final List barcodes = capture.barcodes; if (barcodes.isNotEmpty && barcodes.first.rawValue != null) { setState(() { qrResult = barcodes.first.rawValue!; }); + + if (await Vibration.hasVibrator()) { + Vibration.vibrate(duration: 100); + } } }, ), ), ), 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 + if (qrResult.isNotEmpty) + Padding( + padding: const EdgeInsets.only(left: 16, right: 16), + child: Column( + children: [ + Row( + children: [ + Container( + padding: EdgeInsets.all(0), + width: 90, + 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), + borderRadius: BorderRadius.circular(99), // Optional: rounded corners + ), + child: Icon(Icons.thumb_up, color: const Color.fromRGBO(69, 191, 73, 1), size: 48), + ), + const Gap(32), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const TextWidget( + text: 'Verified', + bold: true, + size: 22, + color: Color.fromRGBO(69, 191, 73, 1), + ), + const Gap(16), + const TextWidget( + text: 'QR is a valid OCBO e-Sign', + bold: false, + size: 16, + color: Color.fromRGBO(69, 191, 73, 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), + ], + ), + ), + ], + ), ), - 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), ], ), ),