diff --git a/lib/pages/login_page.dart b/lib/pages/login_page.dart index 9fbf443..682dc17 100644 --- a/lib/pages/login_page.dart +++ b/lib/pages/login_page.dart @@ -14,29 +14,20 @@ class LoginPage extends StatefulWidget { } class _LoginPageState extends State { + // final List _ =; + // ["Cluj-Napoca", "Bucuresti", "Timisoara", "Brasov", "Constanta"]; + final _passwordController = TextEditingController(); final _approver = "ARCH. KHASHAYAR L. TOGHYANI"; - late ValueNotifier passwordNotifier; - - @override - void initState() { - super.initState(); - passwordNotifier = ValueNotifier(_passwordController.text); - _passwordController.addListener(() { - passwordNotifier.value = _passwordController.text; - }); - } void _login() { - debugPrint("Login button clicked"); + // Add your login logic here + print("Login button clicked"); } - void _ignoreButton() {} - @override void dispose() { _passwordController.dispose(); - passwordNotifier.dispose(); super.dispose(); } @@ -63,7 +54,7 @@ class _LoginPageState extends State { children: [ const Gap(88), const ImageWidget(imagePath: 'assets/logo.png', size: 100, measureByHeight: true), - const Gap(58), + const Gap(50), BoxWidget( title: 'Login', content: Column( @@ -72,21 +63,12 @@ class _LoginPageState extends State { const TextWidget(text: 'Name', bold: true, size: 16), const Gap(8), TextWidget(text: _approver, bold: false, size: 16), - const Gap(16), + const Gap(8), const TextWidget(text: 'Password', bold: true, size: 16), const Gap(8), - InputWidget(controller: _passwordController, password: true), - const Gap(24), - ValueListenableBuilder( - valueListenable: passwordNotifier, - builder: (context, password, child) { - return ButtonWidget( - text: password.isNotEmpty ? 'Login' : 'Required password', - onPressed: password.isNotEmpty ? _login : _ignoreButton, - disabled: password.isEmpty, - ); - }, - ), + InputWidget(controller: _passwordController, placeholder: 'placeholder'), + const Gap(16), + ButtonWidget(text: 'Login', onPressed: _login), ], ), ), diff --git a/lib/pages/validate_page.dart b/lib/pages/validate_page.dart index d1eca99..3f58f21 100644 --- a/lib/pages/validate_page.dart +++ b/lib/pages/validate_page.dart @@ -1,5 +1,4 @@ import 'package:flutter/material.dart'; -import 'package:gap/gap.dart'; import 'package:mobile_scanner/mobile_scanner.dart'; import 'package:ocbo_esign_validator/widgets/text_widget.dart'; @@ -42,41 +41,89 @@ class _BarcodeScannerScreenState extends State { ), ), child: Center( - child: Padding( - padding: const EdgeInsets.only(top: 64, left: 16, right: 16), - child: Column( - children: [ - Expanded( - flex: 2, - child: ClipRRect( - borderRadius: BorderRadius.circular(20), // Adjust the radius as needed - child: MobileScanner( - fit: BoxFit.cover, - onDetect: (BarcodeCapture capture) { - final List barcodes = capture.barcodes; - if (barcodes.isNotEmpty && barcodes.first.rawValue != null) { - setState(() { - barcodeResult = barcodes.first.rawValue!; - }); - } - }, - ), - ), + child: Column( + children: [ + Expanded( + flex: 3, + child: MobileScanner( + onDetect: (BarcodeCapture capture) { + final List barcodes = capture.barcodes; + if (barcodes.isNotEmpty && barcodes.first.rawValue != null) { + setState(() { + barcodeResult = barcodes.first.rawValue!; + }); + } + }, ), - Expanded( - flex: 2, - child: Column( - children: [ - Gap(20), - TextWidget(text: 'Scan OCBO e-Sign QR', size: 20, bold: true), - ], - ), + ), + Expanded( + flex: 1, + child: Center( + child: Center(child: TextWidget(text: barcodeResult, bold: false, size: 18)), ), - ], - ), + ), + ], ), ), ), ); } } + +// class ValidatePage extends StatefulWidget { +// const ValidatePage({super.key}); + +// @override +// State createState() => _ValidatePageState(); +// } + +// class _ValidatePageState extends State { +// final qrKey = GlobalKey(debugLabel: 'QR'); +// String barcodeResult = "Point the camera at a barcode"; + +// @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: Center( +// child: Column( +// children: [ +// Expanded( +// flex: 2, +// child: MobileScanner( +// onDetect: (BarcodeCapture capture) { +// final List barcodes = capture.barcodes; +// if (barcodes.isNotEmpty && barcodes.first.rawValue != null) { +// setState(() { +// barcodeResult = barcodes.first.rawValue!; +// }); +// } +// }, +// ), +// ), +// Expanded( +// flex: 1, +// child: Center(child: TextWidget(text: barcodeResult, bold: false, size: 18)), +// ), +// ], +// ), +// ), +// ), +// ); +// } +// } diff --git a/lib/widgets/box_widget.dart b/lib/widgets/box_widget.dart index d992392..e35d944 100644 --- a/lib/widgets/box_widget.dart +++ b/lib/widgets/box_widget.dart @@ -14,11 +14,11 @@ class BoxWidget extends StatelessWidget { padding: EdgeInsets.all(16), decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), - color: Color.fromRGBO(16, 22, 28, 0.584), + color: Color.fromARGB(149, 16, 22, 28), border: Border.all(color: const Color.fromRGBO(32, 47, 61, 1)), ), - width: MediaQuery.of(context).size.width - 30, - // height: MediaQuery.of(context).size.height / 2.2, + width: MediaQuery.of(context).size.width - 100, + height: MediaQuery.of(context).size.height / 2.2, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ diff --git a/lib/widgets/button_widget.dart b/lib/widgets/button_widget.dart index 348bf4f..7778db8 100644 --- a/lib/widgets/button_widget.dart +++ b/lib/widgets/button_widget.dart @@ -1,33 +1,53 @@ import 'package:flutter/material.dart'; -import 'package:ocbo_esign_validator/widgets/text_widget.dart'; +import 'package:google_fonts/google_fonts.dart'; class ButtonWidget extends StatelessWidget { final String text; - final VoidCallback? onPressed; + final VoidCallback onPressed; + final bool? outline; final double? width; - final bool disabled; - const ButtonWidget({super.key, required this.text, this.onPressed, this.width, required this.disabled}); + const ButtonWidget({super.key, required this.text, required this.onPressed, this.outline, this.width}); @override Widget build(BuildContext context) { return ElevatedButton( - style: ElevatedButton.styleFrom( - foregroundColor: const Color.fromRGBO(250, 250, 250, 1), // text color - backgroundColor: disabled ? const Color.fromARGB(112, 13, 109, 253) : const Color(0xff0d6efd), - elevation: disabled ? 0 : 4, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(8), // rounded corners - ), - minimumSize: Size( - width ?? (MediaQuery.of(context).size.width <= 768 ? MediaQuery.of(context).size.width - 96 : 320), - 44, - ), + style: outline == true + ? OutlinedButton.styleFrom( + foregroundColor: const Color.fromRGBO(0, 0, 0, 1), + backgroundColor: Colors.transparent, + side: const BorderSide(color: Color.fromRGBO(198, 133, 232, 1)), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)), + minimumSize: Size( + MediaQuery.of(context).size.width <= 768 ? MediaQuery.of(context).size.width - 96 : 320, + 44, + ), + padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 16), + ) + : ElevatedButton.styleFrom( + foregroundColor: const Color.fromRGBO(0, 0, 0, 1), // text color + backgroundColor: const Color.fromRGBO(198, 133, 232, 1), + side: const BorderSide(color: Color.fromRGBO(79, 51, 94, 0.4)), // border color + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(20), // rounded corners + ), + minimumSize: Size( + width ?? (MediaQuery.of(context).size.width <= 768 ? MediaQuery.of(context).size.width - 96 : 320), + 44, + ), - padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 16), - ), + padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 16), + ), onPressed: onPressed, - child: TextWidget(text: text, size: 16), + child: Text(text, style: _textStyle(outline)), ); } + + TextStyle _textStyle(bool? outline) { + if (outline == true) { + return GoogleFonts.roboto(textStyle: const TextStyle(fontSize: 14, color: Color.fromRGBO(198, 133, 232, 1))); + } else { + return GoogleFonts.roboto(textStyle: const TextStyle(fontSize: 14, color: Color.fromRGBO(0, 0, 0, 1))); + } + } } diff --git a/lib/widgets/input_widget.dart b/lib/widgets/input_widget.dart index e77af5a..fd0b3b5 100644 --- a/lib/widgets/input_widget.dart +++ b/lib/widgets/input_widget.dart @@ -1,20 +1,17 @@ import 'package:flutter/material.dart'; +import 'package:gap/gap.dart'; import 'package:google_fonts/google_fonts.dart'; class InputWidget extends StatelessWidget { final TextEditingController controller; - final String? placeholder; - final bool password; + final String placeholder; - const InputWidget({super.key, required this.controller, this.placeholder, required this.password}); + const InputWidget({super.key, required this.controller, required this.placeholder}); @override Widget build(BuildContext context) { return TextField( controller: controller, - obscureText: password, - enableSuggestions: !password, - autocorrect: !password, decoration: InputDecoration( filled: true, fillColor: const Color.fromRGBO(255, 255, 255, 1), diff --git a/lib/widgets/menu_widget.dart b/lib/widgets/menu_widget.dart index b342438..1a5bec4 100644 --- a/lib/widgets/menu_widget.dart +++ b/lib/widgets/menu_widget.dart @@ -18,7 +18,7 @@ class MenuWidget extends StatelessWidget { decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), color: Color.fromARGB(149, 16, 22, 28), - border: Border.all(color: const Color.fromRGBO(32, 47, 61, 1)), + border: Border.all(color: const Color(0xff202f3d)), ), width: 120, height: 120, diff --git a/pubspec.lock b/pubspec.lock index d92b9b9..e2e4dd8 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -81,22 +81,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.7.11" - dio: - dependency: "direct main" - description: - name: dio - sha256: d90ee57923d1828ac14e492ca49440f65477f4bb1263575900be731a3dac66a9 - url: "https://pub.dev" - source: hosted - version: "5.9.0" - dio_web_adapter: - dependency: transitive - description: - name: dio_web_adapter - sha256: "7586e476d70caecaf1686d21eee7247ea43ef5c345eab9e0cc3583ff13378d78" - url: "https://pub.dev" - source: hosted - version: "2.1.1" equatable: dependency: transitive description: @@ -256,14 +240,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.17.0" - mime: - dependency: transitive - description: - name: mime - sha256: "41a20518f0cb1256669420fdba0cd90d21561e560ac240f26ef8322e45bb7ed6" - url: "https://pub.dev" - source: hosted - version: "2.0.0" mobile_scanner: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index 2720231..5b8d86a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -18,7 +18,6 @@ dependencies: qr_flutter: ^4.1.0 qr_code_scanner_plus: ^2.0.14 mobile_scanner: ^7.1.3 - dio: ^5.9.0 dev_dependencies: flutter_test: