Compare commits

..

7 commits

17 changed files with 318 additions and 224 deletions

View file

@ -6,7 +6,7 @@ plugins {
} }
android { android {
namespace = "com.example.ocbo_esign_validator" namespace = "com.example.ocbo_esign_mobile"
compileSdk = flutter.compileSdkVersion compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion ndkVersion = flutter.ndkVersion
@ -21,7 +21,7 @@ android {
defaultConfig { defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId = "com.example.ocbo_esign_validator" applicationId = "com.example.ocbo_esign_mobile"
// You can update the following values to match your application needs. // You can update the following values to match your application needs.
// For more information, see: https://flutter.dev/to/review-gradle-config. // For more information, see: https://flutter.dev/to/review-gradle-config.
minSdk = flutter.minSdkVersion minSdk = flutter.minSdkVersion

View file

@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> <manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application android:label="ocbo_esign_validator" android:name="${applicationName}" android:icon="@mipmap/launcher_icon"> <application android:label="ocbo_esign_mobile" android:name="${applicationName}" android:icon="@mipmap/launcher_icon">
<activity android:name=".MainActivity" android:exported="true" android:launchMode="singleTop" android:taskAffinity="" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize"> <activity android:name=".MainActivity" android:exported="true" android:launchMode="singleTop" android:taskAffinity="" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as <!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user the Android process has started. This theme is visible to the user

View file

@ -1,4 +1,4 @@
package com.example.ocbo_esign_validator package com.example.ocbo_esign_mobile
import io.flutter.embedding.android.FlutterActivity import io.flutter.embedding.android.FlutterActivity

View file

@ -13,7 +13,7 @@
<key>CFBundleInfoDictionaryVersion</key> <key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string> <string>6.0</string>
<key>CFBundleName</key> <key>CFBundleName</key>
<string>ocbo_esign_validator</string> <string>ocbo_esign_mobile</string>
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>

View file

@ -0,0 +1,14 @@
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:ocbo_esign_mobile/blocs/application/application_event.dart';
import 'package:ocbo_esign_mobile/blocs/application/application_state.dart';
class ApplicationBloc extends Bloc<ApplicationEvent, ApplicationState> {
ApplicationBloc() : super(ApplicationState('')) {
on<ApplicationSetValue>((event, emit) {
emit(ApplicationState(event.value));
});
on<ApplicationGetValue>((event, emit) {
emit(state);
});
}
}

View file

@ -0,0 +1,8 @@
abstract class ApplicationEvent {}
class ApplicationSetValue extends ApplicationEvent {
final String value;
ApplicationSetValue(this.value);
}
class ApplicationGetValue extends ApplicationEvent {}

View file

@ -0,0 +1,5 @@
class ApplicationState {
final String value;
ApplicationState(this.value);
}

View file

@ -0,0 +1,14 @@
import 'package:flutter/widgets.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:ocbo_esign_mobile/blocs/application/application_bloc.dart';
import 'package:ocbo_esign_mobile/blocs/application/application_event.dart';
Future<String> blocGetApplication(BuildContext context) async {
try {
final applicationBloc = context.read<ApplicationBloc>();
applicationBloc.add(ApplicationGetValue());
return applicationBloc.state.value;
} catch (e) {
return '';
}
}

View file

@ -0,0 +1,14 @@
import 'package:flutter/widgets.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:ocbo_esign_mobile/blocs/application/application_bloc.dart';
import 'package:ocbo_esign_mobile/blocs/application/application_event.dart';
Future<bool> blocSetApplication(BuildContext context, String value) async {
try {
final applicationBloc = context.read<ApplicationBloc>();
applicationBloc.add(ApplicationSetValue(value));
return true;
} catch (e) {
return false;
}
}

View file

@ -2,8 +2,10 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart'; import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:ocbo_esign_mobile/blocs/application/application_bloc.dart';
import 'package:ocbo_esign_mobile/blocs/qr/qr_bloc.dart'; import 'package:ocbo_esign_mobile/blocs/qr/qr_bloc.dart';
import 'package:ocbo_esign_mobile/blocs/user/user_bloc.dart'; import 'package:ocbo_esign_mobile/blocs/user/user_bloc.dart';
import 'package:ocbo_esign_mobile/pages/application_info_page.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';
@ -67,6 +69,21 @@ final _router = GoRouter(
}, },
), ),
), ),
GoRoute(
name: 'info',
path: '/info',
builder: (context, state) => const ApplicationInfoPage(),
pageBuilder: (BuildContext context, GoRouterState state) => CustomTransitionPage<void>(
key: state.pageKey,
child: const ApplicationInfoPage(),
transitionsBuilder: (context, animation, secondaryAnimation, child) {
return SlideTransition(
position: Tween<Offset>(begin: Offset(0.0, -1.0), end: Offset.zero).animate(animation),
child: child,
);
},
),
),
], ],
); );
@ -79,6 +96,7 @@ class MyApp extends StatelessWidget {
providers: [ providers: [
BlocProvider(create: (context) => UserBloc()), BlocProvider(create: (context) => UserBloc()),
BlocProvider(create: (context) => QrBloc()), BlocProvider(create: (context) => QrBloc()),
BlocProvider(create: (context) => ApplicationBloc()),
], ],
child: MaterialApp.router( child: MaterialApp.router(
debugShowCheckedModeBanner: false, debugShowCheckedModeBanner: false,

View file

@ -0,0 +1,65 @@
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/widgets/box_widget.dart';
import 'package:ocbo_esign_mobile/widgets/text_widget.dart';
class ApplicationInfoPage extends StatefulWidget {
const ApplicationInfoPage({super.key});
@override
State<ApplicationInfoPage> createState() => _ApplicationInfoPageState();
}
class _ApplicationInfoPageState extends State<ApplicationInfoPage> {
late String _applicationNo = '';
void _getInfo() async {
final applicationBloc = await blocGetApplication(context);
setState(() {
_applicationNo = applicationBloc;
});
}
@override
void initState() {
_getInfo();
super.initState();
}
@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),
],
),
),
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

@ -61,7 +61,7 @@ class IndexPage extends StatelessWidget {
], ],
), ),
), ),
const Gap(184), const Gap(168),
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
spacing: 32, spacing: 32,

View file

@ -1,12 +1,11 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_dotenv/flutter_dotenv.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:go_router/go_router.dart';
import 'package:hashlib/hashlib.dart'; // import 'package:hashlib/hashlib.dart';
import 'package:ocbo_esign_mobile/blocs/user/functions/bloc_setuser.dart'; // import 'package:ocbo_esign_mobile/blocs/user/functions/bloc_setuser.dart';
import 'package:ocbo_esign_mobile/functions/get_api.dart'; // import 'package:ocbo_esign_mobile/functions/get_api.dart';
import 'package:ocbo_esign_mobile/functions/modal.dart'; // import 'package:ocbo_esign_mobile/functions/modal.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/button_widget.dart';
import 'package:ocbo_esign_mobile/widgets/image_widget.dart'; import 'package:ocbo_esign_mobile/widgets/image_widget.dart';
import 'package:ocbo_esign_mobile/widgets/input_widget.dart'; import 'package:ocbo_esign_mobile/widgets/input_widget.dart';
@ -23,7 +22,7 @@ class LoginPage extends StatefulWidget {
class _LoginPageState extends State<LoginPage> { class _LoginPageState extends State<LoginPage> {
final _passwordController = TextEditingController(); final _passwordController = TextEditingController();
final _approver = dotenv.env['HEAD']!; final _approver = dotenv.env['HEAD']!;
final _approverId = dotenv.env['HEADID']!; // final _approverId = dotenv.env['HEADID']!;
late ValueNotifier<String> passwordNotifier; late ValueNotifier<String> passwordNotifier;
@override @override
@ -53,13 +52,13 @@ class _LoginPageState extends State<LoginPage> {
// } // }
// } // }
Future<String> _securePassword(String password) async { // Future<String> _securePassword(String password) async {
final firstHash = sha1.string(password); // final firstHash = sha1.string(password);
final secondHash = sha384.string(firstHash.toString()); // final secondHash = sha384.string(firstHash.toString());
final thirdHash = sha1.string(secondHash.toString()); // final thirdHash = sha1.string(secondHash.toString());
return thirdHash.toString(); // return thirdHash.toString();
} // }
// void _login() async { // void _login() async {
// final connected = await _checkConnection(); // final connected = await _checkConnection();
@ -79,14 +78,14 @@ class _LoginPageState extends State<LoginPage> {
// } // }
// } // }
void _setLogin() { // void _setLogin() {
blocSetUser(context, _approver); // blocSetUser(context, _approver);
context.push('/approval'); // context.push('/approval');
} // }
void _showDialog() { // void _showDialog() {
showModal(context, 'Error', 'Invalid password, try again.', true); // showModal(context, 'Error', 'Invalid password, try again.', true);
} // }
void _ignoreButton() {} void _ignoreButton() {}

View file

@ -1,7 +1,7 @@
import 'dart:developer';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gap/gap.dart'; import 'package:gap/gap.dart';
import 'package:go_router/go_router.dart';
import 'package:ocbo_esign_mobile/blocs/application/functions/bloc_setapplication.dart';
import 'package:ocbo_esign_mobile/blocs/qr/functions/bloc_getqr.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/functions/get_api.dart';
import 'package:ocbo_esign_mobile/widgets/box_widget.dart'; import 'package:ocbo_esign_mobile/widgets/box_widget.dart';
@ -22,11 +22,19 @@ class _ValidateDetailPageState extends State<ValidateDetailPage> {
final NumberFormat formatter = NumberFormat('#,###.##'); final NumberFormat formatter = NumberFormat('#,###.##');
final dateFormatter = DateFormat('yyyy-MM-dd'); final dateFormatter = DateFormat('yyyy-MM-dd');
// final Color greenColor = const Color(0xFF4CCE51); // final Color greenColor = const Color(0xFF4CCE51);
late bool isLoading = false;
late int _total = 0; late int _total = 0;
late List _applicationList = []; late List _applicationList = [];
late List _dateList = []; late List _dateList = [];
late List _timeList = [];
late String _name = '';
late int _count = 0;
void _getTotalSigned() async { void _getTotalSigned() async {
setState(() {
isLoading = true;
});
final name = await blocGetQr(context); final name = await blocGetQr(context);
final responseCount = await getApi('get-transactions-count', name, null); final responseCount = await getApi('get-transactions-count', name, null);
final total = responseCount['result']; final total = responseCount['result'];
@ -34,21 +42,62 @@ class _ValidateDetailPageState extends State<ValidateDetailPage> {
final response = await getApi('get-transactions', name, null); final response = await getApi('get-transactions', name, null);
final applicationNoList = response['result']; final applicationNoList = response['result'];
final dateList = response['result2']; final dateList = response['result2'];
final timeList = response['result3'];
_name = name;
setState(() { setState(() {
isLoading = false;
_total = double.parse(total).toInt(); _total = double.parse(total).toInt();
_count = applicationNoList.length;
_applicationList = applicationNoList; _applicationList = applicationNoList;
_dateList = dateList; _dateList = dateList;
_timeList = timeList;
}); });
} }
void _filterSigned(String application) async {
final response = await getApi('get-transactions-filter', _name, application);
final applicationNoList = response['result'];
final dateList = response['result2'];
final timeList = response['result3'];
setState(() {
// isLoading = false;
// _total = double.parse(total).toInt();
_count = applicationNoList.length;
_applicationList = applicationNoList;
_dateList = dateList;
_timeList = timeList;
});
}
void _onTextChanged() {
_filterSigned(_searchController.text);
}
void _gotoInfo() {
context.push('/info');
}
void _showDetails(String application) async {
await blocSetApplication(context, application);
_gotoInfo();
}
@override @override
void initState() { void initState() {
_getTotalSigned(); _getTotalSigned();
_searchController.addListener(_onTextChanged);
super.initState(); super.initState();
} }
@override
void dispose() {
_searchController.removeListener(_onTextChanged);
super.dispose();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -73,162 +122,63 @@ class _ValidateDetailPageState extends State<ValidateDetailPage> {
width: MediaQuery.of(context).size.width - 112, width: MediaQuery.of(context).size.width - 112,
child: Column( child: Column(
children: [ children: [
const Gap(88), const Gap(72),
BoxWidget( BoxWidget(
circular: 16, circular: 16,
content: Row( content: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Column( isLoading
children: [ ? TextWidget(text: 'Loading Data, please wait', size: 20, bold: false)
TextWidget(text: formatter.format(_total), size: 50, bold: true), : Column(
const TextWidget(text: 'Total Signed Applications', size: 16), children: [
], TextWidget(text: formatter.format(_total), size: 50, bold: true),
), const TextWidget(text: 'Total Signed Applications', size: 16),
],
),
], ],
), ),
), ),
const Gap(16), const Gap(16),
ClipRRect( InputWidget(controller: _searchController, password: false, placeholder: 'Filter Application Number'),
// borderRadius: BorderRadius.circular(36), const Gap(16),
child: InputWidget(
controller: _searchController,
password: false,
placeholder: 'Search Application Number',
),
),
const Gap(24),
// ListView(
// scrollDirection: Axis.horizontal,
// padding: EdgeInsets.symmetric(horizontal: 16),
// children: [
// // BoxWidget(
// // alignment: CrossAxisAlignment.center,
// // circular: 16,
// // content: Row(
// // children: [
// // const ImageWidget(imagePath: 'assets/esign.webp', size: 48, measureByHeight: true),
// // const Gap(16),
// // Column(
// // crossAxisAlignment: CrossAxisAlignment.start,
// // children: [
// // TextWidget(text: '23-000123', size: 18, bold: true),
// // const Gap(4),
// // TextWidget(text: 'Total Signed Applications', size: 12),
// // ],
// // ),
// // ],
// // ),
// // ),
// ],
// ),
Expanded( Expanded(
flex: 1,
child: ListView.builder( child: ListView.builder(
itemCount: _total, padding: EdgeInsets.only(bottom: 16),
itemCount: _count,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return Column( return InkWell(
crossAxisAlignment: CrossAxisAlignment.stretch, onTap: () => _showDetails(_applicationList[index]),
mainAxisAlignment: MainAxisAlignment.start, child: BoxWidget(
children: [ alignment: CrossAxisAlignment.center,
BoxWidget( circular: 16,
alignment: CrossAxisAlignment.center, content: Row(
circular: 16, children: [
content: Row( const ImageWidget(imagePath: 'assets/esign-check.webp', size: 40, measureByHeight: true),
children: [ const Gap(16),
const ImageWidget(imagePath: 'assets/esign-check.webp', size: 40, measureByHeight: true), Column(
const Gap(16), crossAxisAlignment: CrossAxisAlignment.start,
Column( children: [
crossAxisAlignment: CrossAxisAlignment.start, TextWidget(text: _applicationList[index], size: 18, bold: true),
children: [ const Gap(4),
TextWidget(text: _applicationList[index], size: 18, bold: true), SizedBox(
const Gap(4), width: 180,
SizedBox( child: TextWidget(text: 'Date Signed: ${_dateList[index]}', size: 10, opacity: 1),
width: 190, ),
child: TextWidget(text: '8990 Housing Development Corporation', size: 10), const Gap(4),
), TextWidget(text: 'Time: ${_timeList[index]}', size: 10, opacity: 1),
const Gap(4), const Gap(4),
TextWidget(text: _dateList[index], size: 10, opacity: 0.8), TextWidget(text: 'Tap to show details', size: 9, opacity: 0.6),
], ],
), ),
], ],
),
), ),
const Gap(8), ),
],
); );
}, },
), ),
), ),
// Column(
// crossAxisAlignment: CrossAxisAlignment.center,
// children: [
// BoxWidget(
// alignment: CrossAxisAlignment.center,
// circular: 16,
// content: Row(
// children: [
// const ImageWidget(imagePath: 'assets/esign.webp', size: 48, measureByHeight: true),
// const Gap(16),
// Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// TextWidget(text: '23-000123', size: 18, bold: true),
// const Gap(4),
// TextWidget(text: 'Total Signed Applications', size: 12),
// ],
// ),
// ],
// ),
// ),
// // const Gap(8),
// // BoxWidget(
// // alignment: CrossAxisAlignment.center,
// // circular: 16,
// // content: Row(
// // children: [
// // const ImageWidget(imagePath: 'assets/esign.webp', size: 48, measureByHeight: true),
// // const Gap(16),
// // Column(
// // crossAxisAlignment: CrossAxisAlignment.start,
// // children: [
// // TextWidget(text: '23-000123', size: 18, bold: true),
// // const Gap(4),
// // TextWidget(text: 'Total Signed Applications', size: 12),
// // const Gap(4),
// // Expanded(
// // child: Row(
// // mainAxisAlignment: MainAxisAlignment.end,
// // children: [TextWidget(text: 'Dates', size: 8)],
// // ),
// // ),
// // ],
// // ),
// // ],
// // ),
// // ),
// // const Gap(8),
// // BoxWidget(
// // alignment: CrossAxisAlignment.center,
// // circular: 16,
// // content: Row(
// // children: [
// // const ImageWidget(imagePath: 'assets/esign.webp', size: 48, measureByHeight: true),
// // const Gap(16),
// // Column(
// // crossAxisAlignment: CrossAxisAlignment.start,
// // children: [
// // TextWidget(text: '23-000123', size: 18, bold: true),
// // const Gap(4),
// // TextWidget(text: 'Total Signed Applications', size: 12),
// // ],
// // ),
// // ],
// // ),
// // ),
// ],
// ),
], ],
), ),
), ),

View file

@ -1,5 +1,3 @@
import 'dart:developer';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gap/gap.dart'; import 'package:gap/gap.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
@ -27,12 +25,12 @@ class BarcodeScannerScreen extends StatefulWidget {
} }
class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> { class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
late String qrResult = ''; final Color _redColorShade = const Color.fromRGBO(86, 38, 38, 0.2);
late String qrResultSub = ''; final Color _redColor = const Color.fromRGBO(235, 88, 115, 0.91);
final Color redColorShade = const Color.fromARGB(26, 225, 82, 103); final Color _greenColorShade = const Color.fromARGB(51, 41, 115, 43);
final Color redColor = const Color.fromARGB(255, 229, 89, 115); final Color _greenColor = const Color.fromRGBO(76, 206, 81, 0.91);
final Color greenColorShade = const Color.fromRGBO(69, 191, 73, 0.1);
final Color greenColor = const Color.fromRGBO(76, 206, 81, 1); late String _qrResult = '';
void readQr(String value) async { void readQr(String value) async {
if (value.contains('OCBO e-Sign')) { if (value.contains('OCBO e-Sign')) {
@ -42,21 +40,21 @@ class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
if (result != '') { if (result != '') {
setState(() { setState(() {
qrResult = result; _qrResult = result;
}); });
} else { } else {
setState(() { setState(() {
qrResult = 'non-exist'; _qrResult = 'non-exist';
}); });
} }
} else { } else {
setState(() { setState(() {
qrResult = 'invalid'; _qrResult = 'invalid';
}); });
Future.delayed(Duration(seconds: 3), () { Future.delayed(Duration(seconds: 3), () {
setState(() { setState(() {
qrResult = ''; _qrResult = '';
}); });
}); });
} }
@ -72,38 +70,42 @@ class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
if (result != null) { if (result != null) {
setState(() { setState(() {
qrResult = result; _qrResult = result;
}); });
} else { } else {
setState(() { setState(() {
qrResult = 'non-exist'; _qrResult = 'non-exist';
}); });
Future.delayed(Duration(seconds: 3), () { Future.delayed(Duration(seconds: 3), () {
setState(() { setState(() {
qrResult = ''; _qrResult = '';
}); });
}); });
} }
} else { } else {
setState(() { setState(() {
qrResult = 'invalid'; _qrResult = 'invalid';
}); });
Future.delayed(Duration(seconds: 3), () { Future.delayed(Duration(seconds: 3), () {
setState(() { setState(() {
qrResult = ''; _qrResult = '';
}); });
}); });
} }
} }
void updateBlockQr() async { void updateBlockQr() async {
await blocSetQr(context, qrResult); await blocSetQr(context, _qrResult);
} }
void gotoDetails() { void gotoDetails() {
updateBlockQr(); updateBlockQr();
setState(() {
_qrResult = '';
});
context.push('/details'); context.push('/details');
} }
@ -140,7 +142,7 @@ class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
), ),
child: const TextWidget(text: 'Scan OCBO e-Sign QR Code', size: 14, bold: true), child: const TextWidget(text: 'Scan OCBO e-Sign QR Code', size: 14, bold: true),
), ),
const Gap(24), const Gap(16),
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(36), borderRadius: BorderRadius.circular(36),
@ -158,8 +160,8 @@ class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
// ), // ),
// ], // ],
), ),
height: 330, height: 308,
width: 340, width: 318,
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.circular(36), // Adjust the radius as needed borderRadius: BorderRadius.circular(36), // Adjust the radius as needed
child: MobileScanner( child: MobileScanner(
@ -178,11 +180,11 @@ class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
), ),
), ),
const Gap(24), const Gap(24),
ButtonWidget(text: 'Try API', disabled: false, onPressed: tryQR), // ButtonWidget(text: 'Try API', disabled: false, onPressed: tryQR),
if (qrResult.isNotEmpty) if (_qrResult.isNotEmpty)
Column( Column(
children: [ children: [
if (qrResult == 'invalid') if (_qrResult == 'invalid')
Column( Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
@ -190,32 +192,32 @@ class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
width: 220, width: 220,
padding: const EdgeInsets.fromLTRB(0, 16, 0, 32), padding: const EdgeInsets.fromLTRB(0, 16, 0, 32),
decoration: BoxDecoration( decoration: BoxDecoration(
border: BoxBorder.all(color: redColor), border: BoxBorder.all(color: _redColor),
color: redColorShade, color: _redColorShade,
borderRadius: BorderRadius.circular(32), borderRadius: BorderRadius.circular(32),
), ),
child: Column( child: Column(
children: [ children: [
TextWidget(text: 'Invalid', bold: true, size: 24, color: redColor), TextWidget(text: 'Invalid', bold: true, size: 24, color: _redColor),
const Gap(16), const Gap(16),
Container( Container(
width: 90, width: 90,
height: 90, height: 90,
decoration: BoxDecoration( decoration: BoxDecoration(
color: redColorShade, color: _redColorShade,
border: Border.all(color: redColor, width: 2), border: Border.all(color: _redColor, width: 2),
borderRadius: BorderRadius.circular(99), borderRadius: BorderRadius.circular(99),
), ),
child: Icon(Icons.close, color: redColor, size: 48), child: Icon(Icons.close, color: _redColor, size: 48),
), ),
], ],
), ),
), ),
const Gap(16), const Gap(16),
TextWidget(text: 'Not valid OCBO e-Sign QR', bold: true, size: 20, color: redColor), TextWidget(text: 'QR Detected is not OCBO e-Sign', bold: true, size: 20, color: _redColor),
], ],
) )
else if (qrResult == 'non-exist') else if (_qrResult == 'non-exist')
Column( Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
@ -223,29 +225,34 @@ class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
width: 220, width: 220,
padding: const EdgeInsets.fromLTRB(0, 16, 0, 32), padding: const EdgeInsets.fromLTRB(0, 16, 0, 32),
decoration: BoxDecoration( decoration: BoxDecoration(
border: BoxBorder.all(color: redColor), border: BoxBorder.all(color: _redColor),
color: redColorShade, color: _redColorShade,
borderRadius: BorderRadius.circular(32), borderRadius: BorderRadius.circular(32),
), ),
child: Column( child: Column(
children: [ children: [
TextWidget(text: 'Unregistered', bold: true, size: 24, color: redColor), TextWidget(text: 'Unregistered', bold: true, size: 24, color: _redColor),
const Gap(16), const Gap(16),
Container( Container(
width: 90, width: 90,
height: 90, height: 90,
decoration: BoxDecoration( decoration: BoxDecoration(
color: redColorShade, color: _redColorShade,
border: Border.all(color: redColor, width: 2), border: Border.all(color: _redColor, width: 2),
borderRadius: BorderRadius.circular(99), borderRadius: BorderRadius.circular(99),
), ),
child: Icon(Icons.close, color: redColor, size: 48), child: Icon(Icons.close, color: _redColor, size: 48),
), ),
], ],
), ),
), ),
const Gap(16), const Gap(16),
TextWidget(text: 'OCBO e-Sign QR is not registered', bold: true, size: 20, color: redColor), TextWidget(
text: 'OCBO e-Sign QR is not registered',
bold: true,
size: 20,
color: _redColor,
),
], ],
) )
else else
@ -256,32 +263,32 @@ class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
width: 220, width: 220,
padding: const EdgeInsets.fromLTRB(0, 16, 0, 32), padding: const EdgeInsets.fromLTRB(0, 16, 0, 32),
decoration: BoxDecoration( decoration: BoxDecoration(
border: BoxBorder.all(color: greenColor), border: BoxBorder.all(color: _greenColor),
color: greenColorShade, color: _greenColorShade,
borderRadius: BorderRadius.circular(32), borderRadius: BorderRadius.circular(32),
), ),
child: Column( child: Column(
children: [ children: [
TextWidget(text: 'Valid', bold: true, size: 24, color: greenColor), TextWidget(text: 'Valid', bold: true, size: 24, color: _greenColor),
const Gap(16), const Gap(16),
Container( Container(
padding: EdgeInsets.all(0), padding: EdgeInsets.all(0),
width: 90, width: 90,
height: 90, height: 90,
decoration: BoxDecoration( decoration: BoxDecoration(
color: greenColorShade, color: _greenColorShade,
border: Border.all(color: greenColor, width: 2), border: Border.all(color: _greenColor, width: 2),
borderRadius: BorderRadius.circular(99), borderRadius: BorderRadius.circular(99),
), ),
child: Icon(Icons.check, color: greenColor, size: 48), child: Icon(Icons.check, color: _greenColor, size: 48),
), ),
], ],
), ),
), ),
const Gap(24), const Gap(16),
TextWidget(text: qrResult, bold: true, size: 20, color: greenColor), TextWidget(text: _qrResult, bold: true, size: 18, color: _greenColor),
const Gap(24), const Gap(16),
ButtonWidget(text: "Check Signed Applications", disabled: false, onPressed: gotoDetails), ButtonWidget(text: "Validate Applications", disabled: false, onPressed: gotoDetails),
], ],
), ),
], ],

View file

@ -17,7 +17,7 @@ class MenuWidget extends StatelessWidget {
padding: EdgeInsets.all(16), padding: EdgeInsets.all(16),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(24), borderRadius: BorderRadius.circular(24),
color: Color.fromARGB(149, 16, 22, 28), color: Color.fromRGBO(16, 22, 28, 0.58),
border: Border.all(color: const Color.fromRGBO(41, 60, 78, 0.914)), border: Border.all(color: const Color.fromRGBO(41, 60, 78, 0.914)),
), ),
width: 120, width: 120,

View file

@ -117,10 +117,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: dbus name: dbus
sha256: "79e0c23480ff85dc68de79e2cd6334add97e48f7f4865d17686dd6ea81a47e8c" sha256: d0c98dcd4f5169878b6cf8f6e0a52403a9dff371a3e2f019697accbf6f44a270
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.7.11" version: "0.7.12"
device_info_plus: device_info_plus:
dependency: transitive dependency: transitive
description: description:
@ -268,10 +268,10 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: google_fonts name: google_fonts
sha256: bf1fe61d4a53420a94cbbd4326e07702d247757926f6955af9667765a8324413 sha256: c30eef5e7cd26eb89cc8065b4390ac86ce579f2fcdbe35220891c6278b5460da
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "8.0.0" version: "8.0.1"
hashlib: hashlib:
dependency: "direct main" dependency: "direct main"
description: description:
@ -569,10 +569,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: source_span name: source_span
sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c" sha256: "56a02f1f4cd1a2d96303c0144c93bd6d909eea6bee6bf5a0e0b685edbd4c47ab"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.10.1" version: "1.10.2"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description: