Compare commits
No commits in common. "a60d6284ca9746abe586e70a9214a11de10d0483" and "4a522a38d926076b0efa71cbcdc9c586f526fc04" have entirely different histories.
a60d6284ca
...
4a522a38d9
12 changed files with 78 additions and 238 deletions
|
|
@ -1,14 +0,0 @@
|
|||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:ocbo_esign_validator/blocs/user/user_bloc.dart';
|
||||
import 'package:ocbo_esign_validator/blocs/user/user_event.dart';
|
||||
|
||||
Future<String> blocGetUser(BuildContext context) async {
|
||||
try {
|
||||
final userBloc = context.read<UserBloc>();
|
||||
userBloc.add(UserGetValue());
|
||||
return userBloc.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_validator/blocs/user/user_bloc.dart';
|
||||
import 'package:ocbo_esign_validator/blocs/user/user_event.dart';
|
||||
|
||||
Future<bool> blocSetUser(BuildContext context, String value) async {
|
||||
try {
|
||||
final userBloc = context.read<UserBloc>();
|
||||
userBloc.add(UserSetValue(value));
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:ocbo_esign_validator/blocs/user/user_event.dart';
|
||||
import 'package:ocbo_esign_validator/blocs/user/user_state.dart';
|
||||
|
||||
class UserBloc extends Bloc<UserEvent, UserState> {
|
||||
UserBloc() : super(UserState('')) {
|
||||
on<UserSetValue>((event, emit) {
|
||||
emit(UserState(event.value));
|
||||
});
|
||||
on<UserGetValue>((event, emit) {
|
||||
emit(state);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
abstract class UserEvent {}
|
||||
|
||||
class UserSetValue extends UserEvent {
|
||||
final String value;
|
||||
UserSetValue(this.value);
|
||||
}
|
||||
|
||||
class UserGetValue extends UserEvent {}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
class UserState {
|
||||
final String value;
|
||||
|
||||
UserState(this.value);
|
||||
}
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:ocbo_esign_validator/widgets/text_widget.dart';
|
||||
|
||||
void showModal(BuildContext context, String title, String message, bool error) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => Theme(
|
||||
data: ThemeData(
|
||||
dialogTheme: DialogThemeData(
|
||||
backgroundColor: error
|
||||
? const Color.fromRGBO(72, 30, 31, 0.919)
|
||||
: Color.fromRGBO(18, 44, 31, 0.919), // Check the value of `error`
|
||||
),
|
||||
),
|
||||
child: AlertDialog(
|
||||
title: TextWidget(text: title, color: Color.fromRGBO(244, 244, 244, 1), bold: true, size: 24),
|
||||
content: SizedBox(
|
||||
height: 48,
|
||||
child: Column(
|
||||
children: [
|
||||
const Gap(24),
|
||||
TextWidget(text: message, color: Color.fromRGBO(244, 244, 244, 1), size: 16),
|
||||
],
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: const TextWidget(text: 'OK', color: Colors.white, bold: true, size: 16),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
@ -1,8 +1,6 @@
|
|||
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_validator/blocs/user/user_bloc.dart';
|
||||
import 'package:ocbo_esign_validator/pages/approval_page.dart';
|
||||
import 'package:ocbo_esign_validator/pages/index_page.dart';
|
||||
import 'package:ocbo_esign_validator/pages/login_page.dart';
|
||||
|
|
@ -30,13 +28,10 @@ class MyApp extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MultiBlocProvider(
|
||||
providers: [BlocProvider(create: (context) => UserBloc())],
|
||||
child: MaterialApp.router(
|
||||
debugShowCheckedModeBanner: false,
|
||||
theme: ThemeData(useMaterial3: true),
|
||||
routerConfig: _router,
|
||||
),
|
||||
return MaterialApp.router(
|
||||
debugShowCheckedModeBanner: false,
|
||||
theme: ThemeData(useMaterial3: true),
|
||||
routerConfig: _router,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,71 +1,10 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:ocbo_esign_validator/blocs/user/functions/bloc_getuser.dart';
|
||||
import 'package:ocbo_esign_validator/widgets/image_widget.dart';
|
||||
import 'package:ocbo_esign_validator/widgets/text_widget.dart';
|
||||
|
||||
class ApprovalPage extends StatefulWidget {
|
||||
class ApprovalPage extends StatelessWidget {
|
||||
const ApprovalPage({super.key});
|
||||
|
||||
@override
|
||||
State<ApprovalPage> createState() => _ApprovalPageState();
|
||||
}
|
||||
|
||||
class _ApprovalPageState extends State<ApprovalPage> {
|
||||
late String blocUser = '';
|
||||
|
||||
Future<String> _getUser() async {
|
||||
final user = await blocGetUser(context);
|
||||
return user;
|
||||
}
|
||||
|
||||
void _initUser() async {
|
||||
blocUser = await _getUser();
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_initUser();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
body: Container(
|
||||
alignment: Alignment.center,
|
||||
height: MediaQuery.of(context).size.height,
|
||||
decoration: const BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [
|
||||
Color.fromRGBO(39, 26, 47, 1),
|
||||
Color.fromRGBO(22, 33, 44, 1),
|
||||
Color.fromRGBO(22, 33, 44, 1),
|
||||
Color.fromRGBO(24, 45, 40, 1),
|
||||
],
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
const Gap(76),
|
||||
Row(
|
||||
children: [
|
||||
const Gap(16),
|
||||
const ImageWidget(imagePath: 'assets/logo.png', size: 32, measureByHeight: true),
|
||||
const Gap(8),
|
||||
TextWidget(text: blocUser, size: 16, bold: true),
|
||||
const MaxGap(80),
|
||||
Icon(Icons.menu, size: 20, color: Colors.white),
|
||||
],
|
||||
),
|
||||
const Gap(32),
|
||||
TextWidget(text: blocUser, size: 16, bold: true),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
return Scaffold();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,11 +3,8 @@ import 'dart:developer';
|
|||
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_validator/blocs/user/functions/bloc_setuser.dart';
|
||||
import 'package:ocbo_esign_validator/functions/get_api.dart';
|
||||
import 'package:ocbo_esign_validator/functions/modal.dart';
|
||||
import 'package:ocbo_esign_validator/widgets/box_widget.dart';
|
||||
import 'package:ocbo_esign_validator/widgets/button_widget.dart';
|
||||
import 'package:ocbo_esign_validator/widgets/image_widget.dart';
|
||||
|
|
@ -69,26 +66,14 @@ class _LoginPageState extends State<LoginPage> {
|
|||
final employeeid = _approverId;
|
||||
final dbpassword = await _getPassword(employeeid);
|
||||
final hashPassword = await _securePassword(_passwordController.text);
|
||||
|
||||
if (context.mounted) {
|
||||
if (dbpassword == hashPassword) {
|
||||
_setLogin();
|
||||
} else {
|
||||
_showDialog();
|
||||
}
|
||||
if (dbpassword == hashPassword) {
|
||||
log('yeah');
|
||||
} else {
|
||||
log('no');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void _setLogin() {
|
||||
blocSetUser(context, _approver);
|
||||
context.push('/approval');
|
||||
}
|
||||
|
||||
void _showDialog() {
|
||||
showModal(context, 'Error', 'Invalid password, try again.', true);
|
||||
}
|
||||
|
||||
void _ignoreButton() {}
|
||||
|
||||
@override
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class BarcodeScannerScreen extends StatefulWidget {
|
|||
}
|
||||
|
||||
class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
|
||||
late String qrResult = '';
|
||||
String barcodeResult = "Point the camera at a barcode";
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
|
@ -54,7 +54,7 @@ class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
|
|||
),
|
||||
child: TextWidget(text: 'Scan OCBO e-Sign QR Code', size: 14, bold: true),
|
||||
),
|
||||
const Gap(50),
|
||||
Gap(50),
|
||||
SizedBox(
|
||||
height: 350,
|
||||
child: ClipRRect(
|
||||
|
|
@ -65,31 +65,13 @@ class _BarcodeScannerScreenState extends State<BarcodeScannerScreen> {
|
|||
final List<Barcode> barcodes = capture.barcodes;
|
||||
if (barcodes.isNotEmpty && barcodes.first.rawValue != null) {
|
||||
setState(() {
|
||||
qrResult = barcodes.first.rawValue!;
|
||||
barcodeResult = barcodes.first.rawValue!;
|
||||
});
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
const Gap(40),
|
||||
Container(
|
||||
padding: EdgeInsets.all(0),
|
||||
width: 120,
|
||||
height: 120,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: Color.fromRGBO(59, 169, 62, 1),
|
||||
width: 2,
|
||||
), // Background color of the container
|
||||
borderRadius: BorderRadius.circular(99), // Optional: rounded corners
|
||||
),
|
||||
child: Icon(Icons.thumb_up, color: const Color.fromRGBO(59, 169, 62, 1), size: 80),
|
||||
),
|
||||
const Gap(16),
|
||||
const TextWidget(text: 'Verified', size: 20, bold: true, color: Color.fromRGBO(59, 169, 62, 1)),
|
||||
const Gap(16),
|
||||
TextWidget(text: qrResult, size: 20, bold: true),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
|||
96
pubspec.lock
96
pubspec.lock
|
|
@ -1,6 +1,30 @@
|
|||
# Generated by pub
|
||||
# See https://dart.dev/tools/pub/glossary#lockfile
|
||||
packages:
|
||||
adaptive_dialog:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: adaptive_dialog
|
||||
sha256: "46e235feb99475d36a55fb6a424fe4e4aea1235c41089b847c4a20087582f029"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.6.0"
|
||||
animations:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: animations
|
||||
sha256: "18938cefd7dcc04e1ecac0db78973761a01e4bc2d6bfae0cfa596bfeac9e96ab"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
appkit_ui_element_colors:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: appkit_ui_element_colors
|
||||
sha256: b88a7c35d440fa3ac75222d0e2b7e3259200e531e33b5d2468e358119f3481dc
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
args:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -17,14 +41,6 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.13.0"
|
||||
bloc:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: bloc
|
||||
sha256: a2cebb899f91d36eeeaa55c7b20b5915db5a9df1b8fd4a3c9c825e22e474537d
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "9.1.0"
|
||||
boolean_selector:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -113,6 +129,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
dynamic_color:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: dynamic_color
|
||||
sha256: "43a5a6679649a7731ab860334a5812f2067c2d9ce6452cf069c5e0c25336c17c"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.8.1"
|
||||
equatable:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -142,14 +166,6 @@ packages:
|
|||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_bloc:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_bloc
|
||||
sha256: cf51747952201a455a1c840f8171d273be009b932c75093020f9af64f2123e38
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "9.1.1"
|
||||
flutter_dotenv:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
@ -200,6 +216,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.3.3"
|
||||
gradient_borders:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: gradient_borders
|
||||
sha256: "492bc88ab8d88a4117a7f00e525a669b65f19973bea7ee677f9d9de7603bf037"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.2"
|
||||
hashlib:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
@ -240,6 +264,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.1"
|
||||
intersperse:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: intersperse
|
||||
sha256: "2f8a905c96f6cbba978644a3d5b31b8d86ddc44917662df7d27a61f3df66a576"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
leak_tracker:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -280,6 +312,22 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.3.0"
|
||||
macos_ui:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: macos_ui
|
||||
sha256: "09fb51d65b6a2d328ba5aa429ba0f7aabad5bc770193ea6e49da9f29bf95d835"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.2"
|
||||
macos_window_utils:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: macos_window_utils
|
||||
sha256: d4df3501fd32ac0d2d7590cb6a8e4758337d061c8fa0db816fdd636be63a8438
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.9.0"
|
||||
matcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -320,14 +368,6 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "7.1.3"
|
||||
nested:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: nested
|
||||
sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
nm:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -416,14 +456,6 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.8"
|
||||
provider:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: provider
|
||||
sha256: "4e82183fa20e5ca25703ead7e05de9e4cceed1fbd1eadc1ac3cb6f565a09f272"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.1.5+1"
|
||||
sky_engine:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ dependencies:
|
|||
flutter_dotenv: ^6.0.0
|
||||
dio_smart_retry: ^7.0.1
|
||||
hashlib: ^2.2.0
|
||||
flutter_bloc: ^9.1.1
|
||||
adaptive_dialog: ^2.6.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue