Updated pages

This commit is contained in:
Patrick Alvin Alcala 2026-02-12 13:00:22 +08:00
parent cb69b25b98
commit 9ef7e5ffe3
2 changed files with 117 additions and 30 deletions

View file

@ -1,6 +1,10 @@
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:gap/gap.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/text_widget.dart';
@ -13,12 +17,30 @@ class ApplicationInfoPage extends StatefulWidget {
class _ApplicationInfoPageState extends State<ApplicationInfoPage> {
late String _applicationNo = '';
late String _name = '';
late String _month = '';
late String _day = '';
late String _year = '';
void _getInfo() async {
final applicationBloc = await blocGetApplication(context);
late String applicationBloc = '';
late String qrBloc = '';
if (context.mounted) {
applicationBloc = await blocGetApplication(context);
// ignore: use_build_context_synchronously
qrBloc = await blocGetQr(context);
}
final id = await getApi('get-esignid-byname', qrBloc, null);
final response = await getApi('get-infoapproval-electrical', applicationBloc, id["result"].toString());
setState(() {
_applicationNo = applicationBloc;
_name = response["result"].toString();
_month = response["result2"].toString();
_day = response["result3"].toString();
_year = response["result4"].toString();
});
}
@ -30,36 +52,88 @@ class _ApplicationInfoPageState extends State<ApplicationInfoPage> {
@override
Widget build(BuildContext context) {
return Container(
alignment: Alignment.center,
height: MediaQuery.of(context).size.height,
decoration: const BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Color.fromRGBO(37, 25, 44, 1),
Color.fromRGBO(22, 33, 44, 1),
Color.fromRGBO(22, 33, 44, 1),
Color.fromRGBO(22, 33, 44, 1),
Color.fromRGBO(25, 46, 41, 1),
return Scaffold(
resizeToAvoidBottomInset: false,
body: Container(
padding: EdgeInsets.only(left: 16, right: 16),
alignment: Alignment.center,
height: MediaQuery.of(context).size.height,
decoration: const BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Color.fromRGBO(37, 25, 44, 1),
Color.fromRGBO(22, 33, 44, 1),
Color.fromRGBO(22, 33, 44, 1),
Color.fromRGBO(22, 33, 44, 1),
Color.fromRGBO(25, 46, 41, 1),
],
),
),
child: Column(
children: [
const Gap(88),
BoxWidget(
circular: 16,
content: Center(child: TextWidget(text: _applicationNo, bold: true)),
),
const Gap(16),
BoxWidget(
circular: 16,
content: Center(child: TextWidget(text: _name, bold: false, size: 16)),
),
const Gap(8),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
BoxWidget(
circular: 16,
width: 180,
padding: EdgeInsets.all(0),
content: Center(
child: Column(
children: [
const TextWidget(
text: 'Approved Date',
bold: false,
size: 8,
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),
],
),
),
),
BoxWidget(
circular: 16,
width: 180,
padding: EdgeInsets.all(0),
content: Center(
child: Column(
children: [
const TextWidget(
text: 'Printed Date',
bold: false,
size: 8,
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),
],
),
),
),
],
),
],
),
),
child: Column(
children: [
const Gap(88),
BoxWidget(
circular: 16,
content: Center(child: TextWidget(text: _applicationNo, bold: true)),
),
const Gap(16),
BoxWidget(
circular: 16,
content: Center(child: TextWidget(text: _applicationNo, bold: true)),
),
],
),
);
}
}

View file

@ -180,7 +180,7 @@ class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
),
),
const Gap(24),
// ButtonWidget(text: 'Try API', disabled: false, onPressed: tryQR),
ButtonWidget(text: 'Try API', disabled: false, onPressed: tryQR),
if (_qrResult.isNotEmpty)
Column(
children: [
@ -214,7 +214,20 @@ class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
),
),
const Gap(16),
TextWidget(text: 'QR Detected is not OCBO e-Sign', bold: true, size: 20, color: _redColor),
Container(
padding: EdgeInsets.all(16),
decoration: BoxDecoration(
border: Border.all(color: _redColor, width: 2),
color: _redColorShade,
borderRadius: BorderRadius.circular(16),
),
child: TextWidget(
text: 'Not OCBO e-Sign QR detected',
bold: true,
size: 18,
color: _redColor,
),
),
],
)
else if (_qrResult == 'non-exist')