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'; class ApprovalPage extends StatefulWidget { const ApprovalPage({super.key}); @override State createState() => _ApprovalPageState(); } class _ApprovalPageState extends State { late String blocUser = ''; late List _applicationList = []; late List _nameList = []; Future _getUser() async { final user = await blocGetUser(context); return user; } Future _getListForApprovalElectrical() async { final response = await getApi('get-listopapproval-electrical', null, null); _applicationList = response["result"]; _nameList = response["result2"]; } void _initUser() async { final user = await _getUser(); await _getListForApprovalElectrical(); setState(() { blocUser = user; }); } @override void initState() { _initUser(); super.initState(); } @override Widget build(BuildContext context) { return Scaffold( resizeToAvoidBottomInset: false, body: 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), ], ), ), child: Column( children: [ const Gap(76), Column( children: [ 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), 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), ], ), ), ); } }