From 9268a3337d02362395b0efd885225f2ac4e1043c Mon Sep 17 00:00:00 2001 From: Patrick Alvin Alcala Date: Thu, 19 Feb 2026 09:42:51 +0800 Subject: [PATCH] Updated pages --- lib/pages/application_info_page.dart | 96 ++++++++++++++++++++++------ lib/pages/index_page.dart | 46 ++++++++----- lib/pages/validate_detail_page.dart | 7 +- lib/pages/validate_page.dart | 31 +++++++-- 4 files changed, 138 insertions(+), 42 deletions(-) diff --git a/lib/pages/application_info_page.dart b/lib/pages/application_info_page.dart index cc8b44b..ab7e48e 100644 --- a/lib/pages/application_info_page.dart +++ b/lib/pages/application_info_page.dart @@ -1,11 +1,11 @@ -import 'dart:developer'; - import 'package:flutter/material.dart'; import 'package:gap/gap.dart'; +import 'package:intl/intl.dart'; import 'package:ocbo_esign_mobile/blocs/application/functions/bloc_getapplication.dart'; import 'package:ocbo_esign_mobile/blocs/qr/functions/bloc_getqr.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/loading_widget.dart'; import 'package:ocbo_esign_mobile/widgets/text_widget.dart'; class ApplicationInfoPage extends StatefulWidget { @@ -16,13 +16,25 @@ class ApplicationInfoPage extends StatefulWidget { } class _ApplicationInfoPageState extends State { + // final NumberFormat formatter = NumberFormat('#,###.##'); + final NumberFormat formatter = NumberFormat.currency(symbol: '₱ ', decimalDigits: 2); + late String _applicationNo = ''; late String _name = ''; - late String _month = ''; - late String _day = ''; - late String _year = ''; + late String _monthApproved = ''; + late String _dayApproved = ''; + late String _yearApproved = ''; + late String _monthPrinted = ''; + late String _dayPrinted = ''; + late String _yearPrinted = ''; + late String _amount = ''; + late bool _isLoading = false; void _getInfo() async { + setState(() { + _isLoading = true; + }); + late String applicationBloc = ''; late String qrBloc = ''; @@ -33,14 +45,22 @@ class _ApplicationInfoPageState extends State { } final id = await getApi('get-esignid-byname', qrBloc, null); - final response = await getApi('get-infoapproval-electrical', applicationBloc, id["result"].toString()); + final responseApproval = await getApi('get-infoapproval-electrical', applicationBloc, id["result"].toString()); + final responsePrinted = await getApi('get-infoprinted-electrical', applicationBloc, id["result"].toString()); + final responseAmount = await getApi('get-totalamount-electrical', applicationBloc, null); + final formattedAmount = formatter.format(double.parse(responseAmount["result"].toString())); setState(() { _applicationNo = applicationBloc; - _name = response["result"].toString(); - _month = response["result2"].toString(); - _day = response["result3"].toString(); - _year = response["result4"].toString(); + _name = responseApproval["result"].toString(); + _monthApproved = responseApproval["result2"].toString(); + _dayApproved = responseApproval["result3"].toString(); + _yearApproved = responseApproval["result4"].toString(); + _monthPrinted = responsePrinted["result"].toString(); + _dayPrinted = responsePrinted["result2"].toString(); + _yearPrinted = responsePrinted["result3"].toString(); + _amount = formattedAmount; + _isLoading = false; }); } @@ -76,12 +96,29 @@ class _ApplicationInfoPageState extends State { const Gap(88), BoxWidget( circular: 16, - content: Center(child: TextWidget(text: _applicationNo, bold: true)), + padding: EdgeInsets.all(8), + content: _isLoading + ? Center(child: LoadingWidget(text: 'Gathering Data, please wait')) + : Center(child: TextWidget(text: _applicationNo, bold: true, size: 30)), ), const Gap(16), BoxWidget( circular: 16, - content: Center(child: TextWidget(text: _name, bold: false, size: 16)), + padding: EdgeInsets.all(8), + content: Center( + child: Column( + children: [ + const TextWidget( + text: 'Name of Owner', + bold: false, + size: 8, + color: Color.fromRGBO(255, 255, 255, 0.8), + ), + const Gap(4), + TextWidget(text: _name, bold: false, size: 16), + ], + ), + ), ), const Gap(8), Row( @@ -89,7 +126,7 @@ class _ApplicationInfoPageState extends State { children: [ BoxWidget( circular: 16, - width: 180, + width: 140, padding: EdgeInsets.all(0), content: Center( child: Column( @@ -101,16 +138,16 @@ class _ApplicationInfoPageState extends State { color: Color.fromRGBO(255, 255, 255, 0.8), ), const Gap(4), - TextWidget(text: _month, bold: false, size: 16), - TextWidget(text: _day, bold: true, size: 48), - TextWidget(text: _year, bold: false, size: 16), + TextWidget(text: _monthApproved, bold: false, size: 16), + TextWidget(text: _dayApproved, bold: true, size: 40), + TextWidget(text: _yearApproved, bold: false, size: 16), ], ), ), ), BoxWidget( circular: 16, - width: 180, + width: 140, padding: EdgeInsets.all(0), content: Center( child: Column( @@ -122,15 +159,34 @@ class _ApplicationInfoPageState extends State { color: Color.fromRGBO(255, 255, 255, 0.8), ), const Gap(4), - TextWidget(text: _month, bold: false, size: 16), - TextWidget(text: _day, bold: true, size: 48), - TextWidget(text: _year, bold: false, size: 16), + TextWidget(text: _monthPrinted, bold: false, size: 16), + TextWidget(text: _dayPrinted, bold: true, size: 40), + TextWidget(text: _yearPrinted, bold: false, size: 16), ], ), ), ), ], ), + const Gap(8), + BoxWidget( + circular: 16, + padding: EdgeInsets.all(8), + content: Center( + child: Column( + children: [ + const TextWidget( + text: 'Total Amount', + bold: false, + size: 8, + color: Color.fromRGBO(255, 255, 255, 0.8), + ), + const Gap(4), + TextWidget(text: _amount, bold: true, size: 32), + ], + ), + ), + ), ], ), ), diff --git a/lib/pages/index_page.dart b/lib/pages/index_page.dart index 1992525..4ccb0c2 100644 --- a/lib/pages/index_page.dart +++ b/lib/pages/index_page.dart @@ -46,18 +46,13 @@ class IndexPage extends StatelessWidget { const Gap(88), const ImageWidget(imagePath: 'assets/esign-mobile.webp', size: 160, measureByHeight: false), const Gap(20), - const TextWidget( - text: "OCBO e-Sign", - color: Color.fromARGB(255, 244, 243, 243), - bold: true, - size: 34, - ), + const TextWidget(text: "OCBO e-Sign", color: Color.fromRGBO(244, 243, 243, 1), bold: true, size: 34), Padding( padding: EdgeInsets.only(right: (screenWidth / 2) - 100), child: const Row( mainAxisAlignment: MainAxisAlignment.end, children: [ - TextWidget(text: "Mobile", color: Color.fromARGB(255, 244, 243, 243), bold: false, size: 16), + TextWidget(text: "Mobile", color: Color.fromRGBO(244, 243, 243, 1), bold: false, size: 16), ], ), ), @@ -85,15 +80,36 @@ class IndexPage extends StatelessWidget { const MaxGap(516), const Opacity( opacity: 0.7, - child: 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.7), - bold: false, - size: 10, + child: Column( + children: [ + ImageWidget(imagePath: 'assets/ocbologo.webp', size: 26, measureByHeight: false), + Gap(8), + TextWidget(text: '© 2026 Office of the City Building Official', size: 10), + Gap(8), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + TextWidget( + text: "Developed By:", + color: Color.fromRGBO(244, 243, 243, 0.7), + bold: false, + size: 10, + ), + Gap(4), + ImageWidget(imagePath: 'assets/pat-alcala.webp', size: 60, measureByHeight: false), + Gap(4), + TextWidget( + text: "Pat Alcala", + color: Color.fromRGBO(244, 243, 243, 0.7), + bold: false, + size: 10, + ), + ], + ), + ], + ), ), + const Gap(24), ], ), diff --git a/lib/pages/validate_detail_page.dart b/lib/pages/validate_detail_page.dart index fba5374..7e8ee77 100644 --- a/lib/pages/validate_detail_page.dart +++ b/lib/pages/validate_detail_page.dart @@ -7,6 +7,7 @@ import 'package:ocbo_esign_mobile/functions/get_api.dart'; import 'package:ocbo_esign_mobile/widgets/box_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/loading_widget.dart'; import 'package:ocbo_esign_mobile/widgets/text_widget.dart'; import 'package:intl/intl.dart'; @@ -19,7 +20,7 @@ class ValidateDetailPage extends StatefulWidget { class _ValidateDetailPageState extends State { final _searchController = TextEditingController(); - final NumberFormat formatter = NumberFormat('#,###.##'); + final NumberFormat formatter = NumberFormat('#,###'); final dateFormatter = DateFormat('yyyy-MM-dd'); // final Color greenColor = const Color(0xFF4CCE51); late bool isLoading = false; @@ -129,7 +130,7 @@ class _ValidateDetailPageState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ isLoading - ? TextWidget(text: 'Loading Data, please wait', size: 20, bold: false) + ? LoadingWidget(text: 'Loading Data, please wait') : Column( children: [ TextWidget(text: formatter.format(_total), size: 50, bold: true), @@ -169,7 +170,7 @@ class _ValidateDetailPageState extends State { const Gap(4), TextWidget(text: 'Time: ${_timeList[index]}', size: 10, opacity: 1), const Gap(4), - TextWidget(text: 'Tap to show details', size: 9, opacity: 0.6), + const TextWidget(text: 'Tap to show details', size: 9, opacity: 0.6), ], ), ], diff --git a/lib/pages/validate_page.dart b/lib/pages/validate_page.dart index 5e2b597..d28cb28 100644 --- a/lib/pages/validate_page.dart +++ b/lib/pages/validate_page.dart @@ -5,6 +5,7 @@ import 'package:mobile_scanner/mobile_scanner.dart'; import 'package:ocbo_esign_mobile/blocs/qr/functions/bloc_setqr.dart'; import 'package:ocbo_esign_mobile/functions/get_api.dart'; import 'package:ocbo_esign_mobile/widgets/button_widget.dart'; +import 'package:ocbo_esign_mobile/widgets/loading_widget.dart'; import 'package:ocbo_esign_mobile/widgets/text_widget.dart'; import 'package:vibration/vibration.dart'; @@ -26,13 +27,18 @@ class BarcodeScannerScreen extends StatefulWidget { class _BarcodeScannerScreenState extends State { final Color _redColorShade = const Color.fromRGBO(86, 38, 38, 0.2); - final Color _redColor = const Color.fromRGBO(235, 88, 115, 0.91); - final Color _greenColorShade = const Color.fromARGB(51, 41, 115, 43); - final Color _greenColor = const Color.fromRGBO(76, 206, 81, 0.91); + final Color _redColor = const Color.fromRGBO(235, 88, 115, 0.8); + final Color _greenColorShade = const Color.fromRGBO(41, 115, 43, 0.2); + final Color _greenColor = const Color.fromRGBO(76, 206, 81, 0.8); late String _qrResult = ''; + late bool _scanning = false; void readQr(String value) async { + setState(() { + _scanning = true; + }); + if (value.contains('OCBO e-Sign')) { final qr = value.substring(35); final response = await getApi('check-qr', qr, null); @@ -40,15 +46,18 @@ class _BarcodeScannerScreenState extends State { if (result != '') { setState(() { + _scanning = false; _qrResult = result; }); } else { setState(() { + _scanning = false; _qrResult = 'non-exist'; }); } } else { setState(() { + _scanning = false; _qrResult = 'invalid'; }); @@ -61,6 +70,10 @@ class _BarcodeScannerScreenState extends State { } void tryQR() async { + setState(() { + _scanning = true; + }); + final value = "Use OCBO e-Sign Validator - scanid=0918d59e"; if (value.contains('OCBO e-Sign')) { @@ -70,10 +83,12 @@ class _BarcodeScannerScreenState extends State { if (result != null) { setState(() { + _scanning = false; _qrResult = result; }); } else { setState(() { + _scanning = false; _qrResult = 'non-exist'; }); @@ -85,6 +100,7 @@ class _BarcodeScannerScreenState extends State { } } else { setState(() { + _scanning = false; _qrResult = 'invalid'; }); @@ -180,7 +196,14 @@ class _BarcodeScannerScreenState extends State { ), ), const Gap(24), - ButtonWidget(text: 'Try API', disabled: false, onPressed: tryQR), + // ButtonWidget(text: 'Try API', disabled: false, onPressed: tryQR), + if (_scanning) + Column( + children: [ + const Gap(16), + const LoadingWidget(text: 'Reading QR'), + ], + ), if (_qrResult.isNotEmpty) Column( children: [