Updated pages

This commit is contained in:
Patrick Alvin Alcala 2026-02-19 09:42:51 +08:00
parent cf9cdafc6b
commit 9268a3337d
4 changed files with 138 additions and 42 deletions

View file

@ -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<ApplicationInfoPage> {
// 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<ApplicationInfoPage> {
}
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<ApplicationInfoPage> {
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<ApplicationInfoPage> {
children: [
BoxWidget(
circular: 16,
width: 180,
width: 140,
padding: EdgeInsets.all(0),
content: Center(
child: Column(
@ -101,16 +138,16 @@ class _ApplicationInfoPageState extends State<ApplicationInfoPage> {
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<ApplicationInfoPage> {
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),
],
),
),
),
],
),
),