Compare commits

...

4 commits

Author SHA1 Message Date
fd33a67b47 Updated pages 2026-01-26 13:41:51 +08:00
5a05058256 Updated .env 2026-01-26 13:41:39 +08:00
3756ed32d3 Updated logo 2026-01-26 13:41:32 +08:00
90e3d876dd Removed page 2026-01-26 13:40:59 +08:00
9 changed files with 234 additions and 135 deletions

4
.env
View file

@ -1,5 +1,5 @@
BACKEND_URL='http://10.0.2.2:4320' # BACKEND_URL='http://10.0.2.2:4320'
# BACKEND_SERVER='https://ocboapps.davaocity.gov.ph/esign-server' BACKEND_URL='https://ocboapps.davaocity.gov.ph/esign-server'
HEAD=ARCH. KHASHAYAR L. TOGHYANI HEAD=ARCH. KHASHAYAR L. TOGHYANI
PESO= PESO=

View file

@ -4,7 +4,7 @@
# This file should be version controlled and should not be manually edited. # This file should be version controlled and should not be manually edited.
version: version:
revision: "adc901062556672b4138e18a4dc62a4be8f4b3c2" revision: "19074d12f7eaf6a8180cd4036a430c1d76de904e"
channel: "stable" channel: "stable"
project_type: app project_type: app
@ -13,14 +13,11 @@ project_type: app
migration: migration:
platforms: platforms:
- platform: root - platform: root
create_revision: adc901062556672b4138e18a4dc62a4be8f4b3c2 create_revision: 19074d12f7eaf6a8180cd4036a430c1d76de904e
base_revision: adc901062556672b4138e18a4dc62a4be8f4b3c2 base_revision: 19074d12f7eaf6a8180cd4036a430c1d76de904e
- platform: android - platform: linux
create_revision: adc901062556672b4138e18a4dc62a4be8f4b3c2 create_revision: 19074d12f7eaf6a8180cd4036a430c1d76de904e
base_revision: adc901062556672b4138e18a4dc62a4be8f4b3c2 base_revision: 19074d12f7eaf6a8180cd4036a430c1d76de904e
- platform: ios
create_revision: adc901062556672b4138e18a4dc62a4be8f4b3c2
base_revision: adc901062556672b4138e18a4dc62a4be8f4b3c2
# User provided section # User provided section

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Before After
Before After

View file

@ -6,8 +6,8 @@ import 'package:ocbo_esign_mobile/blocs/user/user_bloc.dart';
import 'package:ocbo_esign_mobile/pages/approval_page.dart'; import 'package:ocbo_esign_mobile/pages/approval_page.dart';
import 'package:ocbo_esign_mobile/pages/index_page.dart'; import 'package:ocbo_esign_mobile/pages/index_page.dart';
import 'package:ocbo_esign_mobile/pages/login_page.dart'; import 'package:ocbo_esign_mobile/pages/login_page.dart';
import 'package:ocbo_esign_mobile/pages/validate_detail_page.dart';
import 'package:ocbo_esign_mobile/pages/validate_page.dart'; import 'package:ocbo_esign_mobile/pages/validate_page.dart';
import 'package:ocbo_esign_mobile/pages/validation_result_page.dart';
Future<void> main() async { Future<void> main() async {
await dotenv.load(fileName: ".env"); await dotenv.load(fileName: ".env");
@ -50,7 +50,22 @@ final _router = GoRouter(
), ),
), ),
// GoRoute(name: 'validate', path: '/validate', builder: (context, state) => const ValidatePage()), // GoRoute(name: 'validate', path: '/validate', builder: (context, state) => const ValidatePage()),
GoRoute(name: 'result', path: '/result', builder: (context, state) => const ValidationResultPage()), // GoRoute(name: 'details', path: '/details', builder: (context, state) => const ValidateDetailPage()),
GoRoute(
name: 'details',
path: '/details',
builder: (context, state) => const ValidateDetailPage(),
pageBuilder: (BuildContext context, GoRouterState state) => CustomTransitionPage<void>(
key: state.pageKey,
child: const ValidateDetailPage(),
transitionsBuilder: (context, animation, secondaryAnimation, child) {
return SlideTransition(
position: Tween<Offset>(begin: Offset(0.0, 1.0), end: Offset.zero).animate(animation),
child: child,
);
},
),
),
], ],
); );

View file

@ -83,9 +83,9 @@ class IndexPage extends StatelessWidget {
], ],
), ),
const MaxGap(516), const MaxGap(516),
Opacity( const Opacity(
opacity: 0.7, opacity: 0.7,
child: const ImageWidget(imagePath: 'assets/pat-alcala.webp', size: 74, measureByHeight: false), child: ImageWidget(imagePath: 'assets/pat-alcala.webp', size: 74, measureByHeight: false),
), ),
const Gap(4), const Gap(4),
const TextWidget( const TextWidget(

View file

@ -34,23 +34,23 @@ class _LoginPageState extends State<LoginPage> {
}); });
} }
Future<bool> _checkConnection() async { // Future<bool> _checkConnection() async {
try { // try {
final connection = await getApi('check-connection', null, null); // final connection = await getApi('check-connection', null, null);
return connection["result"]; // return connection["result"];
} catch (e) { // } catch (e) {
return false; // return false;
} // }
} // }
Future<String> _getPassword(String employeeid) async { // Future<String> _getPassword(String employeeid) async {
try { // try {
final response = await getApi('get-password', employeeid, null); // final response = await getApi('get-password', employeeid, null);
return (response["result"]); // return (response["result"]);
} catch (e) { // } catch (e) {
return "0"; // return "0";
} // }
} // }
Future<String> _securePassword(String password) async { Future<String> _securePassword(String password) async {
final firstHash = sha1.string(password); final firstHash = sha1.string(password);
@ -60,23 +60,23 @@ class _LoginPageState extends State<LoginPage> {
return thirdHash.toString(); return thirdHash.toString();
} }
void _login() async { // void _login() async {
final connected = await _checkConnection(); // final connected = await _checkConnection();
if (connected) { // if (connected) {
final employeeid = _approverId; // final employeeid = _approverId;
final dbpassword = await _getPassword(employeeid); // final dbpassword = await _getPassword(employeeid);
final hashPassword = await _securePassword(_passwordController.text); // final hashPassword = await _securePassword(_passwordController.text);
if (context.mounted) { // if (context.mounted) {
if (dbpassword == hashPassword) { // if (dbpassword == hashPassword) {
_setLogin(); // _setLogin();
} else { // } else {
_showDialog(); // _showDialog();
} // }
} // }
} // }
} // }
void _setLogin() { void _setLogin() {
blocSetUser(context, _approver); blocSetUser(context, _approver);
@ -134,16 +134,16 @@ class _LoginPageState extends State<LoginPage> {
const Gap(8), const Gap(8),
InputWidget(controller: _passwordController, password: true), InputWidget(controller: _passwordController, password: true),
const Gap(24), const Gap(24),
ValueListenableBuilder<String>( // ValueListenableBuilder<String>(
valueListenable: passwordNotifier, // valueListenable: passwordNotifier,
builder: (context, password, child) { // builder: (context, password, child) {
return ButtonWidget( // return ButtonWidget(
text: password.isNotEmpty ? 'Login' : 'Required password', // text: password.isNotEmpty ? 'Login' : 'Required password',
onPressed: password.isNotEmpty ? _login : _ignoreButton, // onPressed: password.isNotEmpty ? _login : _ignoreButton,
disabled: password.isEmpty, // disabled: password.isEmpty,
); // );
}, // },
), // ),
], ],
), ),
), ),

View file

@ -0,0 +1,29 @@
import 'package:flutter/material.dart';
class ValidateDetailPage extends StatelessWidget {
const ValidateDetailPage({super.key});
@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),
],
),
),
),
);
}
}

View file

@ -1,9 +1,9 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:gap/gap.dart'; import 'package:gap/gap.dart';
import 'package:go_router/go_router.dart';
import 'package:mobile_scanner/mobile_scanner.dart'; import 'package:mobile_scanner/mobile_scanner.dart';
import 'package:ocbo_esign_mobile/functions/get_api.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/button_widget.dart';
import 'package:ocbo_esign_mobile/widgets/text_widget.dart'; import 'package:ocbo_esign_mobile/widgets/text_widget.dart';
import 'package:vibration/vibration.dart'; import 'package:vibration/vibration.dart';
@ -25,24 +25,74 @@ class BarcodeScannerScreen extends StatefulWidget {
class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> { class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
late String qrResult = ''; late String qrResult = '';
late String qrResultSub = '';
final Color redColorShade = const Color.fromARGB(26, 225, 82, 103);
final Color redColor = const Color.fromARGB(255, 229, 89, 115);
final Color greenColorShade = const Color.fromRGBO(69, 191, 73, 0.1);
final Color greenColor = const Color.fromRGBO(76, 206, 81, 1);
void readQr(String value) async { void readQr(String value) async {
if (value.contains('OCBO e-Sign')) { if (value.contains('OCBO e-Sign')) {
final response = await getApi('check-qr', value, null); final qr = value.substring(35);
final result = response["result"]; final response = await getApi('check-qr', qr, null);
final result = response["result"].toString();
if (result != '') { if (result != '') {
setState(() { setState(() {
qrResult = result; qrResult = result;
}); });
} else {
setState(() {
qrResult = 'non-exist';
});
} }
} else { } else {
setState(() { setState(() {
qrResult = 'invalid'; qrResult = 'invalid';
}); });
Future.delayed(Duration(seconds: 3), () {
setState(() {
qrResult = '';
});
});
} }
} }
// void tryQR() async {
// final value = "Use OCBO e-Sign Validator - scanid=0918d59e";
// if (value.contains('OCBO e-Sign')) {
// final qr = value.substring(35);
// final response = await getApi('check-qr', qr, null);
// final result = response["result"].toString();
// if (result != '') {
// setState(() {
// qrResult = result;
// });
// } else {
// setState(() {
// qrResult = 'result';
// });
// }
// } else {
// setState(() {
// qrResult = 'invalid';
// });
// Future.delayed(Duration(seconds: 3), () {
// setState(() {
// qrResult = '';
// });
// });
// }
// }
void gotoDetails() {
context.push('/details');
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -114,91 +164,109 @@ class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
), ),
), ),
const Gap(24), const Gap(24),
// ButtonWidget(text: 'Try API', disabled: false, onPressed: tryQR),
if (qrResult.isNotEmpty) if (qrResult.isNotEmpty)
Column( Column(
children: [ children: [
if (qrResult != 'invalid') if (qrResult == 'invalid')
Row( Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Container( Container(
padding: EdgeInsets.all(0), width: MediaQuery.of(context).size.width - 160,
width: 90, padding: const EdgeInsets.fromLTRB(8, 16, 8, 26),
height: 90,
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color.fromRGBO(69, 191, 73, 0.1), border: BoxBorder.all(color: redColor),
border: Border.all(color: const Color.fromRGBO(69, 191, 73, 1), width: 2), color: redColorShade,
borderRadius: BorderRadius.circular(99), // Optional: rounded corners borderRadius: BorderRadius.circular(12),
), ),
child: Icon(Icons.check, color: const Color.fromRGBO(69, 191, 73, 1), size: 48), child: Column(
),
const Gap(24),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const TextWidget(
text: 'Valid',
bold: true,
size: 22,
color: Color.fromRGBO(69, 191, 73, 1),
),
const Gap(16),
const TextWidget(
text: 'QR is a valid OCBO e-Sign',
bold: false,
size: 14,
color: Color.fromRGBO(69, 191, 73, 1),
),
],
),
const Gap(24),
BoxWidget(
title: '',
content: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
const TextWidget(text: 'Name', bold: true, size: 14), TextWidget(text: 'Invalid', bold: true, size: 24, color: redColor),
const Gap(8), const Gap(16),
TextWidget(text: qrResult, bold: false, size: 14), Container(
width: 90,
height: 90,
decoration: BoxDecoration(
color: redColorShade,
border: Border.all(color: redColor, width: 2),
borderRadius: BorderRadius.circular(99),
),
child: Icon(Icons.close, color: redColor, size: 48),
),
], ],
), ),
), ),
const Gap(16),
TextWidget(text: 'Not valid OCBO e-Sign QR', bold: true, size: 20, color: redColor),
],
)
else if (qrResult != 'non-exist')
Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
width: MediaQuery.of(context).size.width - 160,
padding: const EdgeInsets.fromLTRB(8, 16, 8, 26),
decoration: BoxDecoration(
border: BoxBorder.all(color: redColor),
color: redColorShade,
borderRadius: BorderRadius.circular(12),
),
child: Column(
children: [
TextWidget(text: 'Unregistered', bold: true, size: 24, color: redColor),
const Gap(16),
Container(
width: 90,
height: 90,
decoration: BoxDecoration(
color: redColorShade,
border: Border.all(color: redColor, width: 2),
borderRadius: BorderRadius.circular(99),
),
child: Icon(Icons.close, color: redColor, size: 48),
),
],
),
),
const Gap(16),
TextWidget(text: 'OCBO e-Sign QR is not registered', bold: true, size: 20, color: redColor),
], ],
) )
else else
Row( Column(
children: [ children: [
Container( Container(
padding: EdgeInsets.all(0), width: MediaQuery.of(context).size.width - 160,
width: 90, padding: const EdgeInsets.fromLTRB(8, 16, 8, 26),
height: 90,
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color.fromRGBO(206, 74, 77, 0.1), border: BoxBorder.all(color: greenColor),
border: Border.all(color: const Color.fromRGBO(206, 74, 77, 1), width: 2), color: greenColorShade,
borderRadius: BorderRadius.circular(99), borderRadius: BorderRadius.circular(12),
),
child: Column(
children: [
TextWidget(text: 'Valid', bold: true, size: 24, color: greenColor),
const Gap(16),
Container(
padding: EdgeInsets.all(0),
width: 90,
height: 90,
decoration: BoxDecoration(
color: greenColorShade,
border: Border.all(color: greenColor, width: 2),
borderRadius: BorderRadius.circular(99),
),
child: Icon(Icons.check, color: greenColor, size: 48),
),
],
), ),
child: Icon(Icons.close, color: const Color.fromRGBO(206, 74, 77, 1), size: 48),
), ),
const Gap(24), const Gap(24),
TextWidget(text: qrResult, bold: true, size: 20, color: greenColor),
Column( const Gap(24),
crossAxisAlignment: CrossAxisAlignment.start, ButtonWidget(text: "Show Details", disabled: false, onPressed: gotoDetails),
children: [
const TextWidget(
text: 'Invalid',
bold: true,
size: 22,
color: Color.fromRGBO(206, 74, 77, 1),
),
const Gap(16),
const TextWidget(
text: 'QR is a not valid OCBO e-Sign',
bold: false,
size: 14,
color: Color.fromRGBO(206, 74, 77, 1),
),
],
),
], ],
), ),
], ],

View file

@ -1,10 +0,0 @@
import 'package:flutter/material.dart';
class ValidationResultPage extends StatelessWidget {
const ValidationResultPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold();
}
}