Updated pages
This commit is contained in:
parent
58a104b772
commit
ea51af0eb9
4 changed files with 168 additions and 212 deletions
|
|
@ -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),
|
||||
],
|
||||
),
|
||||
],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue