Compare commits
No commits in common. "89fdcce6139a1f5bb2c9c67196cb59df5f24ec9e" and "fd33a67b47e91023149ed3cb31d17f0e204c82f7" have entirely different histories.
89fdcce613
...
fd33a67b47
12 changed files with 50 additions and 225 deletions
|
|
@ -1,14 +0,0 @@
|
||||||
import 'package:flutter/widgets.dart';
|
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
||||||
import 'package:ocbo_esign_mobile/blocs/qr/qr_bloc.dart';
|
|
||||||
import 'package:ocbo_esign_mobile/blocs/qr/qr_event.dart';
|
|
||||||
|
|
||||||
Future<String> blocGetQr(BuildContext context) async {
|
|
||||||
try {
|
|
||||||
final qrBloc = context.read<QrBloc>();
|
|
||||||
qrBloc.add(QrGetValue());
|
|
||||||
return qrBloc.state.value;
|
|
||||||
} catch (e) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
import 'package:flutter/widgets.dart';
|
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
||||||
import 'package:ocbo_esign_mobile/blocs/qr/qr_bloc.dart';
|
|
||||||
import 'package:ocbo_esign_mobile/blocs/qr/qr_event.dart';
|
|
||||||
|
|
||||||
Future<bool> blocSetQr(BuildContext context, String value) async {
|
|
||||||
try {
|
|
||||||
final qrBloc = context.read<QrBloc>();
|
|
||||||
qrBloc.add(QrSetValue(value));
|
|
||||||
return true;
|
|
||||||
} catch (e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
||||||
import 'package:ocbo_esign_mobile/blocs/qr/qr_event.dart';
|
|
||||||
import 'package:ocbo_esign_mobile/blocs/qr/qr_state.dart';
|
|
||||||
|
|
||||||
class QrBloc extends Bloc<QrEvent, QrState> {
|
|
||||||
QrBloc() : super(QrState('')) {
|
|
||||||
on<QrSetValue>((event, emit) {
|
|
||||||
emit(QrState(event.value));
|
|
||||||
});
|
|
||||||
on<QrGetValue>((event, emit) {
|
|
||||||
emit(state);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
abstract class QrEvent {}
|
|
||||||
|
|
||||||
class QrSetValue extends QrEvent {
|
|
||||||
final String value;
|
|
||||||
QrSetValue(this.value);
|
|
||||||
}
|
|
||||||
|
|
||||||
class QrGetValue extends QrEvent {}
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
class QrState {
|
|
||||||
final String value;
|
|
||||||
|
|
||||||
QrState(this.value);
|
|
||||||
}
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:developer';
|
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||||
import 'package:dio_smart_retry/dio_smart_retry.dart';
|
import 'package:dio_smart_retry/dio_smart_retry.dart';
|
||||||
|
|
|
||||||
|
|
@ -44,8 +44,8 @@ class IndexPage extends StatelessWidget {
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
const Gap(88),
|
const Gap(88),
|
||||||
const ImageWidget(imagePath: 'assets/logo.webp', size: 160, measureByHeight: false),
|
const ImageWidget(imagePath: 'assets/logo.webp', size: 140, measureByHeight: false),
|
||||||
const Gap(20),
|
const Gap(24),
|
||||||
const TextWidget(
|
const TextWidget(
|
||||||
text: "OCBO e-Sign",
|
text: "OCBO e-Sign",
|
||||||
color: Color.fromARGB(255, 244, 243, 243),
|
color: Color.fromARGB(255, 244, 243, 243),
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ 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';
|
||||||
import 'package:ocbo_esign_mobile/widgets/login_box_widget.dart';
|
|
||||||
import 'package:ocbo_esign_mobile/widgets/text_widget.dart';
|
import 'package:ocbo_esign_mobile/widgets/text_widget.dart';
|
||||||
|
|
||||||
class LoginPage extends StatefulWidget {
|
class LoginPage extends StatefulWidget {
|
||||||
|
|
@ -122,7 +121,7 @@ class _LoginPageState extends State<LoginPage> {
|
||||||
const Gap(88),
|
const Gap(88),
|
||||||
const ImageWidget(imagePath: 'assets/logo.webp', size: 100, measureByHeight: true),
|
const ImageWidget(imagePath: 'assets/logo.webp', size: 100, measureByHeight: true),
|
||||||
const Gap(58),
|
const Gap(58),
|
||||||
LoginBoxWidget(
|
BoxWidget(
|
||||||
title: 'Login',
|
title: 'Login',
|
||||||
content: Column(
|
content: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
|
|
||||||
|
|
@ -1,43 +1,8 @@
|
||||||
import 'dart:developer';
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:gap/gap.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';
|
|
||||||
import 'package:ocbo_esign_mobile/widgets/input_widget.dart';
|
|
||||||
import 'package:ocbo_esign_mobile/widgets/text_widget.dart';
|
|
||||||
|
|
||||||
class ValidateDetailPage extends StatefulWidget {
|
class ValidateDetailPage extends StatelessWidget {
|
||||||
const ValidateDetailPage({super.key});
|
const ValidateDetailPage({super.key});
|
||||||
|
|
||||||
@override
|
|
||||||
State<ValidateDetailPage> createState() => _ValidateDetailPageState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _ValidateDetailPageState extends State<ValidateDetailPage> {
|
|
||||||
final _searchController = TextEditingController();
|
|
||||||
late double _total = 0;
|
|
||||||
|
|
||||||
void _getTotalSigned() async {
|
|
||||||
final name = await blocGetQr(context);
|
|
||||||
final response = await getApi('get-transactions-count', name, null);
|
|
||||||
log(name.toString());
|
|
||||||
log(response.toString());
|
|
||||||
final total = response['result'];
|
|
||||||
|
|
||||||
setState(() {
|
|
||||||
_total = double.parse(total);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
_getTotalSigned();
|
|
||||||
|
|
||||||
super.initState();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
|
@ -58,45 +23,6 @@ class _ValidateDetailPageState extends State<ValidateDetailPage> {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: SizedBox(
|
|
||||||
width: MediaQuery.of(context).size.width - 90,
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
const Gap(88),
|
|
||||||
InputWidget(controller: _searchController, password: false, placeholder: 'Specify Application Number'),
|
|
||||||
const Gap(24),
|
|
||||||
BoxWidget(
|
|
||||||
circular: 16,
|
|
||||||
content: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Column(
|
|
||||||
children: [
|
|
||||||
TextWidget(text: _total.toString(), size: 64, bold: true),
|
|
||||||
TextWidget(text: 'Total Signed Applications', size: 16),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const Gap(16),
|
|
||||||
const BoxWidget(
|
|
||||||
circular: 16,
|
|
||||||
content: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Column(
|
|
||||||
children: [
|
|
||||||
TextWidget(text: '23-000123', size: 24, bold: true),
|
|
||||||
TextWidget(text: 'Total Signed Applications', size: 20),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +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:go_router/go_router.dart';
|
||||||
import 'package:mobile_scanner/mobile_scanner.dart';
|
import 'package:mobile_scanner/mobile_scanner.dart';
|
||||||
import 'package:ocbo_esign_mobile/blocs/qr/functions/bloc_setqr.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/button_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';
|
||||||
|
|
@ -62,50 +59,37 @@ class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void tryQR() async {
|
// void tryQR() async {
|
||||||
final value = "Use OCBO e-Sign Validator - scanid=0918d59e";
|
// final value = "Use OCBO e-Sign Validator - scanid=0918d59e";
|
||||||
|
|
||||||
if (value.contains('OCBO e-Sign')) {
|
// if (value.contains('OCBO e-Sign')) {
|
||||||
final qr = value.substring(35);
|
// final qr = value.substring(35);
|
||||||
final response = await getApi('check-qr', qr, null);
|
// final response = await getApi('check-qr', qr, null);
|
||||||
final result = response["result"]?.toString();
|
// final result = response["result"].toString();
|
||||||
log('result: $result');
|
|
||||||
|
|
||||||
if (result != null) {
|
// if (result != '') {
|
||||||
setState(() {
|
// setState(() {
|
||||||
qrResult = result;
|
// qrResult = result;
|
||||||
});
|
// });
|
||||||
} else {
|
// } else {
|
||||||
setState(() {
|
// setState(() {
|
||||||
qrResult = 'non-exist';
|
// qrResult = 'result';
|
||||||
});
|
// });
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// setState(() {
|
||||||
|
// qrResult = 'invalid';
|
||||||
|
// });
|
||||||
|
|
||||||
Future.delayed(Duration(seconds: 3), () {
|
// Future.delayed(Duration(seconds: 3), () {
|
||||||
setState(() {
|
// setState(() {
|
||||||
qrResult = '';
|
// qrResult = '';
|
||||||
});
|
// });
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
} else {
|
// }
|
||||||
setState(() {
|
|
||||||
qrResult = 'invalid';
|
|
||||||
});
|
|
||||||
|
|
||||||
Future.delayed(Duration(seconds: 3), () {
|
void gotoDetails() {
|
||||||
setState(() {
|
|
||||||
qrResult = '';
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void updateBlockQr() async {
|
|
||||||
await blocSetQr(context, qrResult);
|
|
||||||
}
|
|
||||||
|
|
||||||
void gotoDetails() async {
|
|
||||||
log('qr $qrResult');
|
|
||||||
updateBlockQr();
|
|
||||||
context.push('/details');
|
context.push('/details');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -180,7 +164,7 @@ 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: [
|
||||||
|
|
@ -217,7 +201,7 @@ class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
|
||||||
TextWidget(text: 'Not valid OCBO e-Sign QR', bold: true, size: 20, color: redColor),
|
TextWidget(text: 'Not valid OCBO e-Sign QR', 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: [
|
||||||
|
|
|
||||||
|
|
@ -3,25 +3,37 @@ import 'package:gap/gap.dart';
|
||||||
import 'package:ocbo_esign_mobile/widgets/text_widget.dart';
|
import 'package:ocbo_esign_mobile/widgets/text_widget.dart';
|
||||||
|
|
||||||
class BoxWidget extends StatelessWidget {
|
class BoxWidget extends StatelessWidget {
|
||||||
|
final String title;
|
||||||
final Widget content;
|
final Widget content;
|
||||||
final double? circular;
|
|
||||||
// final double? titleSize;
|
|
||||||
|
|
||||||
const BoxWidget({super.key, required this.content, this.circular = 8});
|
const BoxWidget({super.key, required this.title, required this.content});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
padding: EdgeInsets.all(16),
|
padding: EdgeInsets.all(16),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(circular ?? 8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
color: Color.fromRGBO(16, 22, 28, 0.584),
|
color: Color.fromRGBO(16, 22, 28, 0.584),
|
||||||
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: MediaQuery.of(context).size.width - 30,
|
width: MediaQuery.of(context).size.width - 30,
|
||||||
|
// height: MediaQuery.of(context).size.height / 2.2,
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [Padding(padding: const EdgeInsets.all(16), child: content)],
|
children: [
|
||||||
|
if (title.isNotEmpty)
|
||||||
|
Column(
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [TextWidget(text: title, bold: true, size: 24)],
|
||||||
|
),
|
||||||
|
const Gap(16),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Padding(padding: const EdgeInsets.all(16), child: content),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,40 +0,0 @@
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:gap/gap.dart';
|
|
||||||
import 'package:ocbo_esign_mobile/widgets/text_widget.dart';
|
|
||||||
|
|
||||||
class LoginBoxWidget extends StatelessWidget {
|
|
||||||
final String title;
|
|
||||||
final Widget content;
|
|
||||||
|
|
||||||
const LoginBoxWidget({super.key, required this.title, required this.content});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Container(
|
|
||||||
padding: EdgeInsets.all(16),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
color: Color.fromRGBO(16, 22, 28, 0.584),
|
|
||||||
border: Border.all(color: const Color.fromRGBO(41, 60, 78, 0.914)),
|
|
||||||
),
|
|
||||||
width: MediaQuery.of(context).size.width - 30,
|
|
||||||
// height: MediaQuery.of(context).size.height / 2.2,
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
if (title.isNotEmpty)
|
|
||||||
Column(
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [TextWidget(text: title, bold: true, size: 24)],
|
|
||||||
),
|
|
||||||
const Gap(16),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Padding(padding: const EdgeInsets.all(16), child: content),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue