Compare commits
7 commits
908308b62e
...
cb69b25b98
| Author | SHA1 | Date | |
|---|---|---|---|
| cb69b25b98 | |||
| 486c8acbdd | |||
| f52ead3e9d | |||
| 5c55580272 | |||
| ea51af0eb9 | |||
| 58a104b772 | |||
| 93ad62fe27 |
17 changed files with 318 additions and 224 deletions
|
|
@ -6,7 +6,7 @@ plugins {
|
|||
}
|
||||
|
||||
android {
|
||||
namespace = "com.example.ocbo_esign_validator"
|
||||
namespace = "com.example.ocbo_esign_mobile"
|
||||
compileSdk = flutter.compileSdkVersion
|
||||
ndkVersion = flutter.ndkVersion
|
||||
|
||||
|
|
@ -21,7 +21,7 @@ android {
|
|||
|
||||
defaultConfig {
|
||||
// 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.
|
||||
// For more information, see: https://flutter.dev/to/review-gradle-config.
|
||||
minSdk = flutter.minSdkVersion
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<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">
|
||||
<!-- Specifies an Android theme to apply to this Activity as soon as
|
||||
the Android process has started. This theme is visible to the user
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package com.example.ocbo_esign_validator
|
||||
package com.example.ocbo_esign_mobile
|
||||
|
||||
import io.flutter.embedding.android.FlutterActivity
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>ocbo_esign_validator</string>
|
||||
<string>ocbo_esign_mobile</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
|
|
|
|||
14
lib/blocs/application/application_bloc.dart
Normal file
14
lib/blocs/application/application_bloc.dart
Normal 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);
|
||||
});
|
||||
}
|
||||
}
|
||||
8
lib/blocs/application/application_event.dart
Normal file
8
lib/blocs/application/application_event.dart
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
abstract class ApplicationEvent {}
|
||||
|
||||
class ApplicationSetValue extends ApplicationEvent {
|
||||
final String value;
|
||||
ApplicationSetValue(this.value);
|
||||
}
|
||||
|
||||
class ApplicationGetValue extends ApplicationEvent {}
|
||||
5
lib/blocs/application/application_state.dart
Normal file
5
lib/blocs/application/application_state.dart
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
class ApplicationState {
|
||||
final String value;
|
||||
|
||||
ApplicationState(this.value);
|
||||
}
|
||||
14
lib/blocs/application/functions/bloc_getapplication.dart
Normal file
14
lib/blocs/application/functions/bloc_getapplication.dart
Normal 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 '';
|
||||
}
|
||||
}
|
||||
14
lib/blocs/application/functions/bloc_setapplication.dart
Normal file
14
lib/blocs/application/functions/bloc_setapplication.dart
Normal 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;
|
||||
}
|
||||
}
|
||||
|
|
@ -2,8 +2,10 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.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/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/index_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: [
|
||||
BlocProvider(create: (context) => UserBloc()),
|
||||
BlocProvider(create: (context) => QrBloc()),
|
||||
BlocProvider(create: (context) => ApplicationBloc()),
|
||||
],
|
||||
child: MaterialApp.router(
|
||||
debugShowCheckedModeBanner: false,
|
||||
|
|
|
|||
65
lib/pages/application_info_page.dart
Normal file
65
lib/pages/application_info_page.dart
Normal 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)),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -61,7 +61,7 @@ class IndexPage extends StatelessWidget {
|
|||
],
|
||||
),
|
||||
),
|
||||
const Gap(184),
|
||||
const Gap(168),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
spacing: 32,
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:hashlib/hashlib.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/modal.dart';
|
||||
import 'package:ocbo_esign_mobile/widgets/box_widget.dart';
|
||||
// import 'package:go_router/go_router.dart';
|
||||
// import 'package:hashlib/hashlib.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/modal.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/input_widget.dart';
|
||||
|
|
@ -23,7 +22,7 @@ class LoginPage extends StatefulWidget {
|
|||
class _LoginPageState extends State<LoginPage> {
|
||||
final _passwordController = TextEditingController();
|
||||
final _approver = dotenv.env['HEAD']!;
|
||||
final _approverId = dotenv.env['HEADID']!;
|
||||
// final _approverId = dotenv.env['HEADID']!;
|
||||
late ValueNotifier<String> passwordNotifier;
|
||||
|
||||
@override
|
||||
|
|
@ -53,13 +52,13 @@ class _LoginPageState extends State<LoginPage> {
|
|||
// }
|
||||
// }
|
||||
|
||||
Future<String> _securePassword(String password) async {
|
||||
final firstHash = sha1.string(password);
|
||||
final secondHash = sha384.string(firstHash.toString());
|
||||
final thirdHash = sha1.string(secondHash.toString());
|
||||
// Future<String> _securePassword(String password) async {
|
||||
// final firstHash = sha1.string(password);
|
||||
// final secondHash = sha384.string(firstHash.toString());
|
||||
// final thirdHash = sha1.string(secondHash.toString());
|
||||
|
||||
return thirdHash.toString();
|
||||
}
|
||||
// return thirdHash.toString();
|
||||
// }
|
||||
|
||||
// void _login() async {
|
||||
// final connected = await _checkConnection();
|
||||
|
|
@ -79,14 +78,14 @@ class _LoginPageState extends State<LoginPage> {
|
|||
// }
|
||||
// }
|
||||
|
||||
void _setLogin() {
|
||||
blocSetUser(context, _approver);
|
||||
context.push('/approval');
|
||||
}
|
||||
// void _setLogin() {
|
||||
// blocSetUser(context, _approver);
|
||||
// context.push('/approval');
|
||||
// }
|
||||
|
||||
void _showDialog() {
|
||||
showModal(context, 'Error', 'Invalid password, try again.', true);
|
||||
}
|
||||
// void _showDialog() {
|
||||
// showModal(context, 'Error', 'Invalid password, try again.', true);
|
||||
// }
|
||||
|
||||
void _ignoreButton() {}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/material.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/functions/get_api.dart';
|
||||
import 'package:ocbo_esign_mobile/widgets/box_widget.dart';
|
||||
|
|
@ -22,11 +22,19 @@ class _ValidateDetailPageState extends State<ValidateDetailPage> {
|
|||
final NumberFormat formatter = NumberFormat('#,###.##');
|
||||
final dateFormatter = DateFormat('yyyy-MM-dd');
|
||||
// final Color greenColor = const Color(0xFF4CCE51);
|
||||
late bool isLoading = false;
|
||||
late int _total = 0;
|
||||
late List _applicationList = [];
|
||||
late List _dateList = [];
|
||||
late List _timeList = [];
|
||||
late String _name = '';
|
||||
late int _count = 0;
|
||||
|
||||
void _getTotalSigned() async {
|
||||
setState(() {
|
||||
isLoading = true;
|
||||
});
|
||||
|
||||
final name = await blocGetQr(context);
|
||||
final responseCount = await getApi('get-transactions-count', name, null);
|
||||
final total = responseCount['result'];
|
||||
|
|
@ -34,21 +42,62 @@ class _ValidateDetailPageState extends State<ValidateDetailPage> {
|
|||
final response = await getApi('get-transactions', name, null);
|
||||
final applicationNoList = response['result'];
|
||||
final dateList = response['result2'];
|
||||
final timeList = response['result3'];
|
||||
|
||||
_name = name;
|
||||
|
||||
setState(() {
|
||||
isLoading = false;
|
||||
_total = double.parse(total).toInt();
|
||||
_count = applicationNoList.length;
|
||||
_applicationList = applicationNoList;
|
||||
_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
|
||||
void initState() {
|
||||
_getTotalSigned();
|
||||
|
||||
_searchController.addListener(_onTextChanged);
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_searchController.removeListener(_onTextChanged);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
|
|
@ -73,162 +122,63 @@ class _ValidateDetailPageState extends State<ValidateDetailPage> {
|
|||
width: MediaQuery.of(context).size.width - 112,
|
||||
child: Column(
|
||||
children: [
|
||||
const Gap(88),
|
||||
const Gap(72),
|
||||
BoxWidget(
|
||||
circular: 16,
|
||||
content: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
TextWidget(text: formatter.format(_total), size: 50, bold: true),
|
||||
const TextWidget(text: 'Total Signed Applications', size: 16),
|
||||
],
|
||||
),
|
||||
isLoading
|
||||
? TextWidget(text: 'Loading Data, please wait', size: 20, bold: false)
|
||||
: Column(
|
||||
children: [
|
||||
TextWidget(text: formatter.format(_total), size: 50, bold: true),
|
||||
const TextWidget(text: 'Total Signed Applications', size: 16),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const Gap(16),
|
||||
ClipRRect(
|
||||
// borderRadius: BorderRadius.circular(36),
|
||||
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),
|
||||
// // ],
|
||||
// // ),
|
||||
// // ],
|
||||
// // ),
|
||||
// // ),
|
||||
// ],
|
||||
// ),
|
||||
InputWidget(controller: _searchController, password: false, placeholder: 'Filter Application Number'),
|
||||
const Gap(16),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: ListView.builder(
|
||||
itemCount: _total,
|
||||
padding: EdgeInsets.only(bottom: 16),
|
||||
itemCount: _count,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
BoxWidget(
|
||||
alignment: CrossAxisAlignment.center,
|
||||
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: 190,
|
||||
child: TextWidget(text: '8990 Housing Development Corporation', size: 10),
|
||||
),
|
||||
const Gap(4),
|
||||
TextWidget(text: _dateList[index], size: 10, opacity: 0.8),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
return InkWell(
|
||||
onTap: () => _showDetails(_applicationList[index]),
|
||||
child: BoxWidget(
|
||||
alignment: CrossAxisAlignment.center,
|
||||
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: 'Date Signed: ${_dateList[index]}', size: 10, opacity: 1),
|
||||
),
|
||||
const Gap(4),
|
||||
TextWidget(text: 'Time: ${_timeList[index]}', size: 10, opacity: 1),
|
||||
const Gap(4),
|
||||
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),
|
||||
// // ],
|
||||
// // ),
|
||||
// // ],
|
||||
// // ),
|
||||
// // ),
|
||||
// ],
|
||||
// ),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
|
@ -27,12 +25,12 @@ class BarcodeScannerScreen extends StatefulWidget {
|
|||
}
|
||||
|
||||
class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
|
||||
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);
|
||||
final Color _redColorShade = const Color.fromRGBO(86, 38, 38, 0.2);
|
||||
final Color _redColor = const Color.fromRGBO(235, 88, 115, 0.91);
|
||||
final Color _greenColorShade = const Color.fromARGB(51, 41, 115, 43);
|
||||
final Color _greenColor = const Color.fromRGBO(76, 206, 81, 0.91);
|
||||
|
||||
late String _qrResult = '';
|
||||
|
||||
void readQr(String value) async {
|
||||
if (value.contains('OCBO e-Sign')) {
|
||||
|
|
@ -42,21 +40,21 @@ class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
|
|||
|
||||
if (result != '') {
|
||||
setState(() {
|
||||
qrResult = result;
|
||||
_qrResult = result;
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
qrResult = 'non-exist';
|
||||
_qrResult = 'non-exist';
|
||||
});
|
||||
}
|
||||
} else {
|
||||
setState(() {
|
||||
qrResult = 'invalid';
|
||||
_qrResult = 'invalid';
|
||||
});
|
||||
|
||||
Future.delayed(Duration(seconds: 3), () {
|
||||
setState(() {
|
||||
qrResult = '';
|
||||
_qrResult = '';
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
@ -72,38 +70,42 @@ class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
|
|||
|
||||
if (result != null) {
|
||||
setState(() {
|
||||
qrResult = result;
|
||||
_qrResult = result;
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
qrResult = 'non-exist';
|
||||
_qrResult = 'non-exist';
|
||||
});
|
||||
|
||||
Future.delayed(Duration(seconds: 3), () {
|
||||
setState(() {
|
||||
qrResult = '';
|
||||
_qrResult = '';
|
||||
});
|
||||
});
|
||||
}
|
||||
} else {
|
||||
setState(() {
|
||||
qrResult = 'invalid';
|
||||
_qrResult = 'invalid';
|
||||
});
|
||||
|
||||
Future.delayed(Duration(seconds: 3), () {
|
||||
setState(() {
|
||||
qrResult = '';
|
||||
_qrResult = '';
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void updateBlockQr() async {
|
||||
await blocSetQr(context, qrResult);
|
||||
await blocSetQr(context, _qrResult);
|
||||
}
|
||||
|
||||
void gotoDetails() {
|
||||
updateBlockQr();
|
||||
setState(() {
|
||||
_qrResult = '';
|
||||
});
|
||||
|
||||
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),
|
||||
),
|
||||
const Gap(24),
|
||||
const Gap(16),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(36),
|
||||
|
|
@ -158,8 +160,8 @@ class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
|
|||
// ),
|
||||
// ],
|
||||
),
|
||||
height: 330,
|
||||
width: 340,
|
||||
height: 308,
|
||||
width: 318,
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(36), // Adjust the radius as needed
|
||||
child: MobileScanner(
|
||||
|
|
@ -178,11 +180,11 @@ class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
|
|||
),
|
||||
),
|
||||
const Gap(24),
|
||||
ButtonWidget(text: 'Try API', disabled: false, onPressed: tryQR),
|
||||
if (qrResult.isNotEmpty)
|
||||
// ButtonWidget(text: 'Try API', disabled: false, onPressed: tryQR),
|
||||
if (_qrResult.isNotEmpty)
|
||||
Column(
|
||||
children: [
|
||||
if (qrResult == 'invalid')
|
||||
if (_qrResult == 'invalid')
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
|
|
@ -190,32 +192,32 @@ class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
|
|||
width: 220,
|
||||
padding: const EdgeInsets.fromLTRB(0, 16, 0, 32),
|
||||
decoration: BoxDecoration(
|
||||
border: BoxBorder.all(color: redColor),
|
||||
color: redColorShade,
|
||||
border: BoxBorder.all(color: _redColor),
|
||||
color: _redColorShade,
|
||||
borderRadius: BorderRadius.circular(32),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
TextWidget(text: 'Invalid', bold: true, size: 24, color: redColor),
|
||||
TextWidget(text: 'Invalid', 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),
|
||||
color: _redColorShade,
|
||||
border: Border.all(color: _redColor, width: 2),
|
||||
borderRadius: BorderRadius.circular(99),
|
||||
),
|
||||
child: Icon(Icons.close, color: redColor, size: 48),
|
||||
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),
|
||||
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(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
|
|
@ -223,29 +225,34 @@ class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
|
|||
width: 220,
|
||||
padding: const EdgeInsets.fromLTRB(0, 16, 0, 32),
|
||||
decoration: BoxDecoration(
|
||||
border: BoxBorder.all(color: redColor),
|
||||
color: redColorShade,
|
||||
border: BoxBorder.all(color: _redColor),
|
||||
color: _redColorShade,
|
||||
borderRadius: BorderRadius.circular(32),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
TextWidget(text: 'Unregistered', bold: true, size: 24, color: redColor),
|
||||
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),
|
||||
color: _redColorShade,
|
||||
border: Border.all(color: _redColor, width: 2),
|
||||
borderRadius: BorderRadius.circular(99),
|
||||
),
|
||||
child: Icon(Icons.close, color: redColor, size: 48),
|
||||
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),
|
||||
TextWidget(
|
||||
text: 'OCBO e-Sign QR is not registered',
|
||||
bold: true,
|
||||
size: 20,
|
||||
color: _redColor,
|
||||
),
|
||||
],
|
||||
)
|
||||
else
|
||||
|
|
@ -256,32 +263,32 @@ class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
|
|||
width: 220,
|
||||
padding: const EdgeInsets.fromLTRB(0, 16, 0, 32),
|
||||
decoration: BoxDecoration(
|
||||
border: BoxBorder.all(color: greenColor),
|
||||
color: greenColorShade,
|
||||
border: BoxBorder.all(color: _greenColor),
|
||||
color: _greenColorShade,
|
||||
borderRadius: BorderRadius.circular(32),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
TextWidget(text: 'Valid', bold: true, size: 24, color: greenColor),
|
||||
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),
|
||||
color: _greenColorShade,
|
||||
border: Border.all(color: _greenColor, width: 2),
|
||||
borderRadius: BorderRadius.circular(99),
|
||||
),
|
||||
child: Icon(Icons.check, color: greenColor, size: 48),
|
||||
child: Icon(Icons.check, color: _greenColor, size: 48),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const Gap(24),
|
||||
TextWidget(text: qrResult, bold: true, size: 20, color: greenColor),
|
||||
const Gap(24),
|
||||
ButtonWidget(text: "Check Signed Applications", disabled: false, onPressed: gotoDetails),
|
||||
const Gap(16),
|
||||
TextWidget(text: _qrResult, bold: true, size: 18, color: _greenColor),
|
||||
const Gap(16),
|
||||
ButtonWidget(text: "Validate Applications", disabled: false, onPressed: gotoDetails),
|
||||
],
|
||||
),
|
||||
],
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class MenuWidget extends StatelessWidget {
|
|||
padding: EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
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)),
|
||||
),
|
||||
width: 120,
|
||||
|
|
|
|||
12
pubspec.lock
12
pubspec.lock
|
|
@ -117,10 +117,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: dbus
|
||||
sha256: "79e0c23480ff85dc68de79e2cd6334add97e48f7f4865d17686dd6ea81a47e8c"
|
||||
sha256: d0c98dcd4f5169878b6cf8f6e0a52403a9dff371a3e2f019697accbf6f44a270
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.7.11"
|
||||
version: "0.7.12"
|
||||
device_info_plus:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -268,10 +268,10 @@ packages:
|
|||
dependency: "direct main"
|
||||
description:
|
||||
name: google_fonts
|
||||
sha256: bf1fe61d4a53420a94cbbd4326e07702d247757926f6955af9667765a8324413
|
||||
sha256: c30eef5e7cd26eb89cc8065b4390ac86ce579f2fcdbe35220891c6278b5460da
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "8.0.0"
|
||||
version: "8.0.1"
|
||||
hashlib:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
@ -569,10 +569,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: source_span
|
||||
sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c"
|
||||
sha256: "56a02f1f4cd1a2d96303c0144c93bd6d909eea6bee6bf5a0e0b685edbd4c47ab"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.10.1"
|
||||
version: "1.10.2"
|
||||
stack_trace:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue