diff --git a/lib/blocs/qr/functions/bloc_getqr.dart b/lib/blocs/qr/functions/bloc_getqr.dart deleted file mode 100644 index e70a36c..0000000 --- a/lib/blocs/qr/functions/bloc_getqr.dart +++ /dev/null @@ -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 blocGetQr(BuildContext context) async { - try { - final qrBloc = context.read(); - qrBloc.add(QrGetValue()); - return qrBloc.state.value; - } catch (e) { - return ''; - } -} diff --git a/lib/blocs/qr/functions/bloc_setqr.dart b/lib/blocs/qr/functions/bloc_setqr.dart deleted file mode 100644 index b7baf11..0000000 --- a/lib/blocs/qr/functions/bloc_setqr.dart +++ /dev/null @@ -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 blocSetQr(BuildContext context, String value) async { - try { - final qrBloc = context.read(); - qrBloc.add(QrSetValue(value)); - return true; - } catch (e) { - return false; - } -} diff --git a/lib/blocs/qr/qr_bloc.dart b/lib/blocs/qr/qr_bloc.dart deleted file mode 100644 index a336e98..0000000 --- a/lib/blocs/qr/qr_bloc.dart +++ /dev/null @@ -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 { - QrBloc() : super(QrState('')) { - on((event, emit) { - emit(QrState(event.value)); - }); - on((event, emit) { - emit(state); - }); - } -} diff --git a/lib/blocs/qr/qr_event.dart b/lib/blocs/qr/qr_event.dart deleted file mode 100644 index 4277819..0000000 --- a/lib/blocs/qr/qr_event.dart +++ /dev/null @@ -1,8 +0,0 @@ -abstract class QrEvent {} - -class QrSetValue extends QrEvent { - final String value; - QrSetValue(this.value); -} - -class QrGetValue extends QrEvent {} diff --git a/lib/blocs/qr/qr_state.dart b/lib/blocs/qr/qr_state.dart deleted file mode 100644 index 05016e6..0000000 --- a/lib/blocs/qr/qr_state.dart +++ /dev/null @@ -1,5 +0,0 @@ -class QrState { - final String value; - - QrState(this.value); -} diff --git a/lib/functions/get_api.dart b/lib/functions/get_api.dart index 025b349..139d47e 100644 --- a/lib/functions/get_api.dart +++ b/lib/functions/get_api.dart @@ -1,5 +1,4 @@ import 'dart:convert'; -import 'dart:developer'; import 'package:dio/dio.dart'; import 'package:flutter_dotenv/flutter_dotenv.dart'; import 'package:dio_smart_retry/dio_smart_retry.dart'; diff --git a/lib/pages/index_page.dart b/lib/pages/index_page.dart index a3e9845..7a84d23 100644 --- a/lib/pages/index_page.dart +++ b/lib/pages/index_page.dart @@ -44,8 +44,8 @@ class IndexPage extends StatelessWidget { child: Column( children: [ const Gap(88), - const ImageWidget(imagePath: 'assets/logo.webp', size: 160, measureByHeight: false), - const Gap(20), + const ImageWidget(imagePath: 'assets/logo.webp', size: 140, measureByHeight: false), + const Gap(24), const TextWidget( text: "OCBO e-Sign", color: Color.fromARGB(255, 244, 243, 243), diff --git a/lib/pages/login_page.dart b/lib/pages/login_page.dart index 0f58031..dfa7526 100644 --- a/lib/pages/login_page.dart +++ b/lib/pages/login_page.dart @@ -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/image_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'; class LoginPage extends StatefulWidget { @@ -122,7 +121,7 @@ class _LoginPageState extends State { const Gap(88), const ImageWidget(imagePath: 'assets/logo.webp', size: 100, measureByHeight: true), const Gap(58), - LoginBoxWidget( + BoxWidget( title: 'Login', content: Column( crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/pages/validate_detail_page.dart b/lib/pages/validate_detail_page.dart index feffb12..2fddca8 100644 --- a/lib/pages/validate_detail_page.dart +++ b/lib/pages/validate_detail_page.dart @@ -1,43 +1,8 @@ -import 'dart:developer'; - 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}); - @override - State createState() => _ValidateDetailPageState(); -} - -class _ValidateDetailPageState extends State { - 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 Widget build(BuildContext context) { return Scaffold( @@ -58,45 +23,6 @@ class _ValidateDetailPageState extends State { ], ), ), - 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), - ], - ), - ], - ), - ), - ], - ), - ), ), ); } diff --git a/lib/pages/validate_page.dart b/lib/pages/validate_page.dart index d0ac073..04942b6 100644 --- a/lib/pages/validate_page.dart +++ b/lib/pages/validate_page.dart @@ -1,10 +1,7 @@ -import 'dart:developer'; - import 'package:flutter/material.dart'; import 'package:gap/gap.dart'; import 'package:go_router/go_router.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/widgets/button_widget.dart'; import 'package:ocbo_esign_mobile/widgets/text_widget.dart'; @@ -62,50 +59,37 @@ class _BarcodeScannerScreenState extends State { } } - void tryQR() async { - final value = "Use OCBO e-Sign Validator - scanid=0918d59e"; + // 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(); - log('result: $result'); + // 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 != null) { - setState(() { - qrResult = result; - }); - } else { - setState(() { - qrResult = 'non-exist'; - }); + // if (result != '') { + // setState(() { + // qrResult = result; + // }); + // } else { + // setState(() { + // qrResult = 'result'; + // }); + // } + // } else { + // setState(() { + // qrResult = 'invalid'; + // }); - Future.delayed(Duration(seconds: 3), () { - setState(() { - qrResult = ''; - }); - }); - } - } else { - setState(() { - qrResult = 'invalid'; - }); + // Future.delayed(Duration(seconds: 3), () { + // setState(() { + // qrResult = ''; + // }); + // }); + // } + // } - Future.delayed(Duration(seconds: 3), () { - setState(() { - qrResult = ''; - }); - }); - } - } - - void updateBlockQr() async { - await blocSetQr(context, qrResult); - } - - void gotoDetails() async { - log('qr $qrResult'); - updateBlockQr(); + void gotoDetails() { context.push('/details'); } @@ -180,7 +164,7 @@ class _BarcodeScannerScreenState extends State { ), ), const Gap(24), - ButtonWidget(text: 'Try API', disabled: false, onPressed: tryQR), + // ButtonWidget(text: 'Try API', disabled: false, onPressed: tryQR), if (qrResult.isNotEmpty) Column( children: [ @@ -217,7 +201,7 @@ class _BarcodeScannerScreenState extends State { 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( crossAxisAlignment: CrossAxisAlignment.center, children: [ diff --git a/lib/widgets/box_widget.dart b/lib/widgets/box_widget.dart index fa9eb85..94037a6 100644 --- a/lib/widgets/box_widget.dart +++ b/lib/widgets/box_widget.dart @@ -3,25 +3,37 @@ import 'package:gap/gap.dart'; import 'package:ocbo_esign_mobile/widgets/text_widget.dart'; class BoxWidget extends StatelessWidget { + final String title; 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 Widget build(BuildContext context) { return Container( padding: EdgeInsets.all(16), decoration: BoxDecoration( - borderRadius: BorderRadius.circular(circular ?? 8), + 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: [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), + ], ), ); } diff --git a/lib/widgets/login_box_widget.dart b/lib/widgets/login_box_widget.dart deleted file mode 100644 index a307bdc..0000000 --- a/lib/widgets/login_box_widget.dart +++ /dev/null @@ -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), - ], - ), - ); - } -}