Updated pages

This commit is contained in:
Patrick Alvin Alcala 2026-02-23 17:01:57 +08:00
parent 6a565815fc
commit 57ea482f66
3 changed files with 141 additions and 79 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/user/functions/bloc_getuser.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/image_widget.dart';
import 'package:ocbo_esign_mobile/widgets/text_widget.dart';
@ -13,14 +17,28 @@ class ApprovalPage extends StatefulWidget {
class _ApprovalPageState extends State<ApprovalPage> {
late String blocUser = '';
late List<dynamic> _applicationList = [];
late List<dynamic> _nameList = [];
Future<String> _getUser() async {
final user = await blocGetUser(context);
return user;
}
Future<void> _getListForApprovalElectrical() async {
final response = await getApi('get-listopapproval-electrical', null, null);
_applicationList = response["result"];
_nameList = response["result2"];
}
void _initUser() async {
blocUser = await _getUser();
final user = await _getUser();
await _getListForApprovalElectrical();
setState(() {
blocUser = user;
});
}
@override
@ -52,18 +70,60 @@ class _ApprovalPageState extends State<ApprovalPage> {
child: Column(
children: [
const Gap(76),
Row(
Column(
children: [
const Gap(16),
const ImageWidget(imagePath: 'assets/logo.png', size: 32, measureByHeight: true),
BoxWidget(
padding: const EdgeInsets.only(bottom: 8),
content: Center(
child: Column(
children: [
TextWidget(text: _applicationList.length.toString(), size: 32, bold: true),
const Gap(4),
const TextWidget(text: 'Ready to Sign and Approve Applications', size: 12, bold: false),
],
),
),
),
const Gap(8),
TextWidget(text: blocUser, size: 16, bold: true),
const MaxGap(80),
Icon(Icons.menu, size: 20, color: Colors.white),
Expanded(
flex: 1,
child: ListView.builder(
padding: EdgeInsets.only(bottom: 16),
itemCount: _applicationList.length,
itemBuilder: (BuildContext context, int index) {
return InkWell(
// onTap: () => _showDetails(_applicationList[index]),
child: BoxWidget(
alignment: CrossAxisAlignment.start,
circular: 16,
content: Row(
children: [
// const ImageWidget(imagePath: 'assets/esign-check.webp', size: 40, measureByHeight: true),
const Gap(16),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextWidget(text: _applicationList[index], size: 18, bold: true),
const Gap(4),
SizedBox(width: 180, child: TextWidget(text: _nameList[index], size: 10, opacity: 1)),
const Gap(4),
const TextWidget(text: 'Tap to show details', size: 9, opacity: 0.6),
],
),
],
),
),
);
},
),
),
// // TextWidget(text: blocUser, size: 16, bold: true),
// const MaxGap(80),
// Icon(Icons.menu, size: 20, color: Colors.white),
],
),
const Gap(32),
TextWidget(text: blocUser, size: 16, bold: true),
// const Gap(32),
// TextWidget(text: blocUser, size: 16, bold: true),
],
),
),