From 25e0f0905f511d524ad68f4a7153fb9c7632bb55 Mon Sep 17 00:00:00 2001 From: rodolfobacuinjr Date: Tue, 20 Dec 2022 14:26:37 +0800 Subject: [PATCH] stable version 3.3.9 --- unit2/lib/main.dart | 2 +- .../docsms/components/doc_info_tile.dart | 3 - unit2/lib/screens/docsms/request_receipt.dart | 22 +- unit2/lib/screens/sos/add_mobile.dart | 201 +++++++++--------- unit2/lib/screens/sos/request_sos.dart | 6 +- unit2/lib/screens/sos/sos_received.dart | 4 +- .../unit2/homepage.dart/components/menu.dart | 1 - unit2/lib/screens/unit2/login/login.dart | 27 ++- unit2/lib/screens/unit2/login/register.dart | 23 +- unit2/lib/screens/unit2/profile/profile.dart | 135 ++++++------ .../roles/qr_code_scanner.dart/scan.dart | 6 +- .../qr_code_scanner.dart/settings_screen.dart | 26 +-- unit2/lib/screens/unit2/signature/pad.dart | 0 .../unit2/signature/signature_pad.dart | 47 ++++ unit2/lib/theme-data.dart/form-style.dart | 2 + unit2/lib/utils/alerts.dart | 64 ++++-- unit2/lib/utils/router.dart | 17 +- unit2/lib/utils/text_container.dart | 29 ++- unit2/lib/utils/validators.dart | 2 +- unit2/pubspec.lock | 56 +++-- unit2/pubspec.yaml | 3 +- 21 files changed, 406 insertions(+), 270 deletions(-) delete mode 100644 unit2/lib/screens/unit2/signature/pad.dart create mode 100644 unit2/lib/screens/unit2/signature/signature_pad.dart diff --git a/unit2/lib/main.dart b/unit2/lib/main.dart index f87f8ef..9b80a31 100644 --- a/unit2/lib/main.dart +++ b/unit2/lib/main.dart @@ -40,7 +40,7 @@ class MyApp extends StatelessWidget { // locale: DevicePreview.locale(context), // builder: DevicePreview.appBuilder, routeInformationParser: goRouter.routeInformationParser, - routerDelegate: goRouter.routerDelegate, + routerDelegate: goRouter.routerDelegate, // routeInformationProvider: goRouter.routeInformationProvider, title: 'uniT2 - Universal Tracker and Tracer', theme: ThemeData( diff --git a/unit2/lib/screens/docsms/components/doc_info_tile.dart b/unit2/lib/screens/docsms/components/doc_info_tile.dart index a209c76..f34f219 100644 --- a/unit2/lib/screens/docsms/components/doc_info_tile.dart +++ b/unit2/lib/screens/docsms/components/doc_info_tile.dart @@ -1,7 +1,4 @@ import 'package:flutter/material.dart'; -import 'package:flutter/src/widgets/container.dart'; -import 'package:flutter/src/widgets/framework.dart'; - import '../../../theme-data.dart/text-styles.dart'; import '../../../utils/global.dart'; diff --git a/unit2/lib/screens/docsms/request_receipt.dart b/unit2/lib/screens/docsms/request_receipt.dart index 338cb98..b72897a 100644 --- a/unit2/lib/screens/docsms/request_receipt.dart +++ b/unit2/lib/screens/docsms/request_receipt.dart @@ -1,7 +1,5 @@ -import 'package:flutter/cupertino.dart'; + import 'package:flutter/material.dart'; -import 'package:flutter/src/widgets/container.dart'; -import 'package:flutter/src/widgets/framework.dart'; import 'package:flutter_form_builder/flutter_form_builder.dart'; import 'package:fluttericon/entypo_icons.dart'; import 'package:form_builder_validators/form_builder_validators.dart'; @@ -61,7 +59,7 @@ class _RequetAutoReceiptState extends State { height: 8, ), Text( - "Source Remarks", + sourceRemarks, style: Theme.of(context).textTheme.caption, ), const SizedBox( @@ -69,15 +67,13 @@ class _RequetAutoReceiptState extends State { ), FormBuilderTextField( name: "remarks", - validator: FormBuilderValidators.compose([ - FormBuilderValidators.required( - errorText: "Remarks is required") - ]), + validator: FormBuilderValidators.required( + errorText: remarksRequired), autovalidateMode: AutovalidateMode.onUserInteraction, maxLines: 5, decoration: normalTextFieldStyle( - "Enter your remarks", "..."), + enterRemarks, "..."), ), const SizedBox( height: 8, @@ -92,7 +88,7 @@ class _RequetAutoReceiptState extends State { autofocus: false, validator: FormBuilderValidators.compose([ FormBuilderValidators.required( - errorText: "Department is required") + errorText: departmentRequired) ]), decoration: normalTextFieldStyle("Department", ""), @@ -106,11 +102,11 @@ class _RequetAutoReceiptState extends State { height: 12, ), FormBuilderDropdown( - name: 'purok', + name: 'substation', autofocus: false, validator: FormBuilderValidators.compose([ FormBuilderValidators.required( - errorText: "Purok is required") + errorText: substationRequired) ]), decoration: normalTextFieldStyle("Substation", ""), @@ -130,7 +126,7 @@ class _RequetAutoReceiptState extends State { style: secondaryBtnStyle( second, Colors.transparent, Colors.white54), child: const Text( - "Request Auto Receipt", + requestAutoReceipt, style: TextStyle(color: Colors.white), ), onPressed: () { diff --git a/unit2/lib/screens/sos/add_mobile.dart b/unit2/lib/screens/sos/add_mobile.dart index 4d7ee6a..185d003 100644 --- a/unit2/lib/screens/sos/add_mobile.dart +++ b/unit2/lib/screens/sos/add_mobile.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_form_builder/flutter_form_builder.dart'; import 'package:flutter_svg/svg.dart'; import 'package:fluttericon/font_awesome_icons.dart'; +import 'package:form_builder_validators/form_builder_validators.dart'; import 'package:go_router/go_router.dart'; import 'package:unit2/theme-data.dart/text-styles.dart'; import 'package:unit2/utils/screen_info.dart'; @@ -22,111 +23,107 @@ class AddMobile extends StatelessWidget { onWillPop: () async { return true; }, - child: Scaffold( - appBar: AppBar( - backgroundColor: Colors.transparent, - elevation: 0, - leading: IconButton( - icon: const Icon( - FontAwesome.left_big, - ), - onPressed: () { - context.go(context.namedLocation('login')); - }, - color: primary, + child: SafeArea( + child: Scaffold( + appBar: AppBar( + backgroundColor: primary, + elevation: 0, ), - ), - resizeToAvoidBottomInset: true, - body: SingleChildScrollView( - child: SizedBox( - height: screenHeight * .89, - child: Stack( - children: [ - Positioned( - bottom: 0, - right: 0, - child: WaveReverse(height: blockSizeVertical * 8)), - Container( - height: screenHeight, - padding: isMobile() - ? const EdgeInsets.symmetric(horizontal: 24) - : const EdgeInsets.symmetric(horizontal: 60), - width: double.infinity, - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SizedBox( + resizeToAvoidBottomInset: true, + body: SingleChildScrollView( + child: SizedBox( + height: screenHeight * .90, + child: Stack( + children: [ + Wave(height: blockSizeVertical * 8), + Positioned( + bottom: 0, + right: 0, + child: WaveReverse(height: blockSizeVertical * 8)), + Container( + height: screenHeight, + padding: isMobile() + ? const EdgeInsets.symmetric(horizontal: 24) + : const EdgeInsets.symmetric(horizontal: 60), + width: double.infinity, + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox( + height: isMobile() + ? screenHeight * .12 + : screenHeight * .20), + SvgPicture.asset( + 'assets/svgs/add_mobile.svg', height: isMobile() - ? screenHeight * .12 - : screenHeight * .20), - SvgPicture.asset( - 'assets/svgs/add_mobile.svg', - height: isMobile() - ? blockSizeVertical * 22 - : blockSizeVertical * 30, - allowDrawingOutsideViewBox: true, - ), - const SizedBox( - height: 24, - ), - Text(addMobile, style: titleTextStyle()), - const SizedBox( - height: 8, - ), - Text(addMobileCaption, - textAlign: TextAlign.center, - style: Theme.of(context).textTheme.caption), - const SizedBox( - height: 24, - ), - FormBuilder( - key: _formKey, - child: Column( - children: [ - // Mobile number 1 - FormBuilderTextField( - name: 'mobile1', - validator: mobileNumberValidator, - decoration: normalTextFieldStyle( - "mobile number 1", "+63")), - const SizedBox( - height: 12, - ), - FormBuilderTextField( - name: 'mobile2', - decoration: normalTextFieldStyle( - "mobile number 2", "+63")), - - SizedBox( - height: isMobile() - ? blockSizeVertical * 3 - : blockSizeHorizontal * 5), - SizedBox( - width: double.infinity, - height: screenHeight * .06, - child: ElevatedButton( - style: secondaryBtnStyle(second, - Colors.transparent, Colors.white54), - child: const Text( - submit, - style: TextStyle(color: Colors.white), - ), - onPressed: () { - if (_formKey.currentState! - .saveAndValidate()) { - context.go(context - .namedLocation('request-sos')); - } - - // } - }, + ? blockSizeVertical * 22 + : blockSizeVertical * 30, + allowDrawingOutsideViewBox: true, + ), + const SizedBox( + height: 24, + ), + Text(addMobile, style: titleTextStyle()), + const SizedBox( + height: 8, + ), + Text(addMobileCaption, + textAlign: TextAlign.center, + style: Theme.of(context).textTheme.caption), + const SizedBox( + height: 24, + ), + FormBuilder( + key: _formKey, + child: Column( + children: [ + // Mobile number 1 + FormBuilderTextField( + name: 'mobile1', + validator: mobileNumberValidator, + maxLength: 11, + decoration: + normalTextFieldStyle(mobile1, "+63")), + const SizedBox( + height: 12, ), - ), - ], - )) - ]), - ), - ], + FormBuilderTextField( + name: 'mobile2', + maxLength: 11, + decoration: + normalTextFieldStyle(mobile2, "+63")), + + SizedBox( + height: isMobile() + ? blockSizeVertical * 3 + : blockSizeHorizontal * 5), + SizedBox( + width: double.infinity, + height: screenHeight * .06, + child: ElevatedButton( + style: secondaryBtnStyle(second, + Colors.transparent, Colors.white54), + child: const Text( + submit, + style: TextStyle(color: Colors.white), + ), + onPressed: () { + if (_formKey.currentState! + .saveAndValidate()) { + context.go(context + .namedLocation('request-sos')); + } + + // } + }, + ), + ), + ], + )) + ]), + ), + ], + ), ), ), ), diff --git a/unit2/lib/screens/sos/request_sos.dart b/unit2/lib/screens/sos/request_sos.dart index 76cab37..a98b654 100644 --- a/unit2/lib/screens/sos/request_sos.dart +++ b/unit2/lib/screens/sos/request_sos.dart @@ -70,13 +70,13 @@ class _RequestSOSState extends State { name: "message", validator: FormBuilderValidators.compose([ FormBuilderValidators.required( - errorText: "Message is required") + errorText: messageRequired) ]), autovalidateMode: AutovalidateMode.onUserInteraction, maxLines: 5, - decoration: normalTextFieldStyle("", "SOS message.."), + decoration: normalTextFieldStyle("", sosMessage), ), - Expanded( + const Expanded( child: SizedBox(), ), SizedBox( diff --git a/unit2/lib/screens/sos/sos_received.dart b/unit2/lib/screens/sos/sos_received.dart index 8a2de78..b25cd14 100644 --- a/unit2/lib/screens/sos/sos_received.dart +++ b/unit2/lib/screens/sos/sos_received.dart @@ -77,7 +77,7 @@ class SOSreceived extends StatelessWidget { SlideInUp( from: 50, child: AutoSizeText( - "SOS Received!", + sosReceived, textAlign: TextAlign.center, style: Theme.of(context).textTheme.displayMedium!.copyWith( fontSize: 40, @@ -117,7 +117,7 @@ class SOSreceived extends StatelessWidget { child: TextButton( style: mainBtnStyle(second, Colors.transparent, second), onPressed: () {}, - child: const Text("Cancel request", + child: const Text(cancelRequest, style: TextStyle( color: Colors.white, )), diff --git a/unit2/lib/screens/unit2/homepage.dart/components/menu.dart b/unit2/lib/screens/unit2/homepage.dart/components/menu.dart index ec3a330..cdfbd44 100644 --- a/unit2/lib/screens/unit2/homepage.dart/components/menu.dart +++ b/unit2/lib/screens/unit2/homepage.dart/components/menu.dart @@ -1,7 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_zoom_drawer/flutter_zoom_drawer.dart'; import 'package:go_router/go_router.dart'; -import 'package:cool_alert/cool_alert.dart'; import 'package:unit2/utils/alerts.dart'; import '../../../../theme-data.dart/colors.dart'; diff --git a/unit2/lib/screens/unit2/login/login.dart b/unit2/lib/screens/unit2/login/login.dart index c3d2e58..1ad705a 100644 --- a/unit2/lib/screens/unit2/login/login.dart +++ b/unit2/lib/screens/unit2/login/login.dart @@ -89,12 +89,12 @@ class _UniT2LoginState extends State { FormBuilderTextField( name: 'username', validator: FormBuilderValidators.required( - errorText: "Username is required"), + errorText: usernameRequired), autofocus: false, style: const TextStyle( fontWeight: FontWeight.bold, color: Colors.black87), - decoration: loginTextFieldStyle()), + decoration: loginTextFieldStyle().copyWith()), SizedBox( height: blockSizeVertical * 1.5, ), @@ -102,7 +102,7 @@ class _UniT2LoginState extends State { FormBuilderTextField( name: 'password', validator: FormBuilderValidators.required( - errorText: "Password is required"), + errorText: passwordRequired), // initialValue: state.password, onChanged: (value) { @@ -148,9 +148,12 @@ class _UniT2LoginState extends State { .displayLarge ?.color)), ), - prefixIcon: const Icon(Icons.lock), + prefixIcon: const Icon( + Icons.lock, + color: primary, + ), labelText: "Password", - hintText: "Enter Password..."), + hintText: enterPassword), obscureText: _showPassword ? true : false, ), SizedBox( @@ -173,6 +176,7 @@ class _UniT2LoginState extends State { progress?.showWithText( 'Logging in...', ); + FocusScope.of(context).unfocus(); Future.delayed(const Duration(seconds: 5), () { progress!.dismiss(); @@ -215,13 +219,14 @@ class _UniT2LoginState extends State { style: TextStyle(color: second), ), onPressed: () async { - ScanResult result = - await QRCodeBarCodeScanner.instance - .scanner(); + context.goNamed('register'); + // ScanResult result = + // await QRCodeBarCodeScanner.instance + // .scanner(); - debugPrint(result.type.toString()); - debugPrint( - result.rawContent.toString()); + // debugPrint(result.type.toString()); + // debugPrint( + // result.rawContent.toString()); // BlocProvider.of(context) // .add(QRCodelogin()); }, diff --git a/unit2/lib/screens/unit2/login/register.dart b/unit2/lib/screens/unit2/login/register.dart index 3d4e614..0468000 100644 --- a/unit2/lib/screens/unit2/login/register.dart +++ b/unit2/lib/screens/unit2/login/register.dart @@ -5,7 +5,9 @@ import 'package:flutter/src/widgets/framework.dart'; import 'package:flutter_form_builder/flutter_form_builder.dart'; import 'package:flutter_svg/svg.dart'; import 'package:fluttericon/font_awesome5_icons.dart'; +import 'package:fluttericon/font_awesome_icons.dart'; import 'package:form_builder_validators/form_builder_validators.dart'; +import 'package:go_router/go_router.dart'; import 'package:unit2/theme-data.dart/btn-style.dart'; import 'package:unit2/widgets/wave.dart'; @@ -31,6 +33,13 @@ class _RegisterState extends State { return SafeArea( child: Scaffold( resizeToAvoidBottomInset: true, + appBar: AppBar( + backgroundColor: primary, + elevation: 0, + automaticallyImplyLeading: true, + title: const Text("Register password"), + centerTitle: true, + ), body: SingleChildScrollView( child: Stack( children: [ @@ -38,7 +47,7 @@ class _RegisterState extends State { Positioned( bottom: 0, child: WaveReverse(height: blockSizeVertical * 8)), Container( - height: screenHeight * .97, + height: screenHeight * .90, padding: const EdgeInsets.symmetric(horizontal: 15), child: FormBuilder( key: _formKey, @@ -118,7 +127,7 @@ class _RegisterState extends State { ), prefixIcon: const Icon(Icons.lock), labelText: "Password", - hintText: "Enter Password..."), + hintText: enterPassword), obscureText: _showPassword ? true : false, ), const SizedBox( @@ -171,8 +180,8 @@ class _RegisterState extends State { ?.color)), ), prefixIcon: const Icon(Icons.lock), - labelText: "Confirm Password", - hintText: "Confirm Password..."), + labelText: confirmPassword, + hintText: enterConfirmPassword), obscureText: _showPassword ? true : false, ), const SizedBox( @@ -185,9 +194,11 @@ class _RegisterState extends State { style: secondaryBtnStyle( second, Colors.transparent, primary), onPressed: () { - if (_formKey.currentState!.saveAndValidate()) {} + if (_formKey.currentState!.saveAndValidate()) { + context.goNamed('home'); + } }, - child: const Text("Register")), + child: const Text(register)), ) ], ), diff --git a/unit2/lib/screens/unit2/profile/profile.dart b/unit2/lib/screens/unit2/profile/profile.dart index 8228e25..33cfec9 100644 --- a/unit2/lib/screens/unit2/profile/profile.dart +++ b/unit2/lib/screens/unit2/profile/profile.dart @@ -7,6 +7,7 @@ import 'package:qr_flutter/qr_flutter.dart'; import 'package:unit2/test_data.dart'; import 'package:unit2/theme-data.dart/btn-style.dart'; import 'package:unit2/utils/global.dart'; +import 'package:unit2/utils/text_container.dart'; import '../../../theme-data.dart/colors.dart'; import './components/cover-image.dart'; @@ -23,36 +24,62 @@ class Profile extends StatelessWidget { child: Scaffold( body: SizedBox( width: screenWidth, - child: Stack( - clipBehavior: Clip.none, - alignment: Alignment.center, + child: Column( children: [ - const CoverImage(), - const Positioned(top: 125, child: BuildProfileImage()), - Positioned( - top: 10, - left: 20, - child: IconButton( - onPressed: () { - context.go(context.namedLocation('home')); - }, - icon: const Icon( - FontAwesome5.arrow_left, - size: 24, - color: Colors.white, + Stack( + clipBehavior: Clip.none, + alignment: Alignment.center, + children: [ + const CoverImage(), + Positioned( + top: blockSizeVertical * 17.5, + child: Stack( + alignment: Alignment.center, + children: [ + const CircleAvatar( + radius: 72, + backgroundColor: Colors.white, + ), + CircleAvatar( + radius: 69, + backgroundColor: Colors.grey.shade800, + child: SvgPicture.asset( + 'assets/svgs/male.svg', + ), + ), + ], ), - )), - Positioned( - top: 10, - right: 20, - child: IconButton( - onPressed: () {}, - icon: const Icon( - Icons.edit, - size: 24, - color: Colors.white, - ), - )), + ), + Positioned( + top: 10, + left: 20, + child: IconButton( + onPressed: () { + context.go(context.namedLocation('home')); + }, + icon: const Icon( + FontAwesome5.arrow_left, + size: 24, + color: Colors.white, + ), + )), + Positioned( + top: 10, + right: 20, + child: IconButton( + onPressed: () {}, + icon: const Icon( + Icons.edit, + size: 24, + color: Colors.white, + ), + )), + ], + ), + SizedBox( + height: blockSizeVertical * 5, + ), + const BuildInformation(), ], ), ), @@ -95,19 +122,24 @@ class BuildInformation extends StatelessWidget { data: uuid, size: blockSizeVertical * 30, ), - SizedBox( + const SizedBox( height: 25, ), SizedBox( - height: blockSizeVertical * 6, width: screenWidth * .60, - child: ElevatedButton.icon( - label: const Text("Signature pad"), - icon: const Icon( - FontAwesome5.signature, - ), - style: mainBtnStyle(third, Colors.transparent, Colors.white54), - onPressed: () {}, + height: blockSizeVertical * 6, + child: SizedBox( + child: ElevatedButton.icon( + style: + mainBtnStyle(third, Colors.transparent, Colors.white54), + onPressed: () { + context.goNamed('signature'); + }, + icon: const Icon( + FontAwesome5.signature, + size: 15, + ), + label: const Text(signature)), ), ), const SizedBox( @@ -118,32 +150,3 @@ class BuildInformation extends StatelessWidget { ); } } - -class BuildProfileImage extends StatelessWidget { - const BuildProfileImage({super.key}); - - @override - Widget build(BuildContext context) { - return Column( - children: [ - Stack( - alignment: Alignment.center, - children: [ - const CircleAvatar( - radius: 72, - backgroundColor: Colors.white, - ), - CircleAvatar( - radius: 69, - backgroundColor: Colors.grey.shade800, - child: SvgPicture.asset( - 'assets/svgs/male.svg', - ), - ), - ], - ), - BuildInformation(), - ], - ); - } -} diff --git a/unit2/lib/screens/unit2/roles/qr_code_scanner.dart/scan.dart b/unit2/lib/screens/unit2/roles/qr_code_scanner.dart/scan.dart index 8908e49..8a26cb8 100644 --- a/unit2/lib/screens/unit2/roles/qr_code_scanner.dart/scan.dart +++ b/unit2/lib/screens/unit2/roles/qr_code_scanner.dart/scan.dart @@ -1,6 +1,4 @@ import 'package:flutter/material.dart'; -import 'package:flutter/src/widgets/container.dart'; -import 'package:flutter/src/widgets/framework.dart'; import 'package:fluttericon/entypo_icons.dart'; import 'package:unit2/utils/text_container.dart'; @@ -40,7 +38,7 @@ class QRCodeScanner extends StatelessWidget { height: 8, ), Text( - "TAP TO SCAN QR CODE", + tapToScanQR, textAlign: TextAlign.center, style: Theme.of(context) .textTheme @@ -60,7 +58,7 @@ class QRCodeScanner extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, children: [ Text( - "INCOMING", + incoming, textAlign: TextAlign.center, style: Theme.of(context) .textTheme diff --git a/unit2/lib/screens/unit2/roles/qr_code_scanner.dart/settings_screen.dart b/unit2/lib/screens/unit2/roles/qr_code_scanner.dart/settings_screen.dart index 7f3e4a4..72b3f18 100644 --- a/unit2/lib/screens/unit2/roles/qr_code_scanner.dart/settings_screen.dart +++ b/unit2/lib/screens/unit2/roles/qr_code_scanner.dart/settings_screen.dart @@ -53,7 +53,7 @@ class _QRCodeScannerSettingsState extends State { ), ListTile( title: Text( - "Set QR Scanner Settings", + setQRScannerSettings, style: Theme.of(context) .textTheme .headline6! @@ -61,10 +61,10 @@ class _QRCodeScannerSettingsState extends State { textAlign: TextAlign.center, ), ), - Text("Include other inputs?", + Text(includeOtherInputs, style: Theme.of(context).textTheme.subtitle1), Text( - "inputs such as body temperature, etc.", + includeOtherInputsSubTitle, style: Theme.of(context).textTheme.caption, ), SizedBox( @@ -86,10 +86,10 @@ class _QRCodeScannerSettingsState extends State { ), ), // Incoming or outgoing - Text("Incoming or Outgoing? ", + Text(incomingORoutgoing, style: Theme.of(context).textTheme.subtitle1), Text( - "incoming for entrance outgoing for exit.", + incomingORoutgoingSubTitle, style: Theme.of(context).textTheme.caption, ), FittedBox( @@ -117,12 +117,12 @@ class _QRCodeScannerSettingsState extends State { FormBuilderDropdown( name: 'level', validator: FormBuilderValidators.required( - errorText: "This field is required"), - decoration: normalTextFieldStyle("Select level", "level"), + errorText: fieldIsRequired), + decoration: normalTextFieldStyle(selectLevel, "level"), items: levels .map((level) => DropdownMenuItem( - child: Text(level), value: level, + child: Text(level), )) .toList(), // value: selectedLevel, @@ -138,12 +138,14 @@ class _QRCodeScannerSettingsState extends State { FormBuilderDropdown( name: 'establishment', decoration: normalTextFieldStyle( - "Select establishment", "establishments"), + selectedEstablishment, "establishments"), isExpanded: true, + validator: FormBuilderValidators.required( + errorText: fieldIsRequired), items: establishments .map((est) => DropdownMenuItem( - child: Text(est), value: est, + child: Text(est), )) .toList(), // value: selectedArea, @@ -155,12 +157,12 @@ class _QRCodeScannerSettingsState extends State { ), DropdownButtonFormField( decoration: normalTextFieldStyle( - "Select establishment", "establishments"), + selectEstablishment, "establishments"), isExpanded: true, items: establishments .map((est) => DropdownMenuItem( - child: Text(est), value: est, + child: Text(est), )) .toList(), // value: selectedArea, diff --git a/unit2/lib/screens/unit2/signature/pad.dart b/unit2/lib/screens/unit2/signature/pad.dart deleted file mode 100644 index e69de29..0000000 diff --git a/unit2/lib/screens/unit2/signature/signature_pad.dart b/unit2/lib/screens/unit2/signature/signature_pad.dart new file mode 100644 index 0000000..2a4b404 --- /dev/null +++ b/unit2/lib/screens/unit2/signature/signature_pad.dart @@ -0,0 +1,47 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/src/widgets/container.dart'; +import 'package:flutter/src/widgets/framework.dart'; +import 'package:signature/signature.dart'; +import 'package:unit2/theme-data.dart/colors.dart'; + +class SignaturePad extends StatefulWidget { + const SignaturePad({super.key}); + + @override + State createState() => _SignaturePadState(); +} + +class _SignaturePadState extends State { + SignatureController? _signatureController; + + @override + void initState() { + _signatureController = SignatureController( + penStrokeWidth: 3, + penColor: Colors.black87, + ); + super.initState(); + } + + @override + void dispose() { + _signatureController!.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text("Create Signature"), + centerTitle: true, + backgroundColor: second, + automaticallyImplyLeading: true, + ), + body: Signature( + controller: _signatureController!, + backgroundColor: Colors.white, + ), + ); + } +} diff --git a/unit2/lib/theme-data.dart/form-style.dart b/unit2/lib/theme-data.dart/form-style.dart index 6fbcc4c..7089e98 100644 --- a/unit2/lib/theme-data.dart/form-style.dart +++ b/unit2/lib/theme-data.dart/form-style.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:unit2/theme-data.dart/colors.dart'; InputDecoration normalTextFieldStyle(String labelText, String hintText) { return InputDecoration( @@ -53,6 +54,7 @@ InputDecoration loginTextFieldStyle() { floatingLabelBehavior: FloatingLabelBehavior.never, prefixIcon: const Icon( Icons.person, + color: primary, ), labelText: 'Username', hintText: 'Enter your username...', diff --git a/unit2/lib/utils/alerts.dart b/unit2/lib/utils/alerts.dart index 39c65f6..a9d488d 100644 --- a/unit2/lib/utils/alerts.dart +++ b/unit2/lib/utils/alerts.dart @@ -1,29 +1,51 @@ -import 'package:cool_alert/cool_alert.dart'; +import 'package:awesome_dialog/awesome_dialog.dart'; import 'package:flutter/material.dart'; import 'package:unit2/theme-data.dart/colors.dart'; +import 'package:unit2/utils/global.dart'; confirmAlert(context, Function() yes) { - CoolAlert.show( - loopAnimation: true, - context: context, - type: CoolAlertType.confirm, - title: 'LOGOUT!', - text: 'Are you sure you want to logout?', - cancelBtnText: 'No', - confirmBtnText: 'Yes', - confirmBtnColor: second, - showCancelBtn: true, - barrierDismissible: false, - onConfirmBtnTap: yes); + AwesomeDialog( + context: context, + dialogType: DialogType.question, + borderSide: const BorderSide( + color: Colors.green, + width: 0, + ), + width: blockSizeHorizontal * 90, + buttonsBorderRadius: const BorderRadius.all( + Radius.circular(2), + ), + dismissOnTouchOutside: false, + dismissOnBackKeyPress: false, + // onDismissCallback: (type) { + // ScaffoldMessenger.of(context).showSnackBar( + // SnackBar( + // content: Text('Dismissed by $type'), + // ), + // ); + // }, + headerAnimationLoop: false, + animType: AnimType.bottomSlide, + title: 'LOGOUT!', + desc: 'Are you sure you want to logout?', + btnOkText: "Yes", + btnCancelText: "No", + showCloseIcon: false, + btnCancelOnPress: () {}, + btnOkOnPress: yes, + ).show(); } -errorAlert(context) { - CoolAlert.show( +errorAlert(context, title, description) { + AwesomeDialog( + width: blockSizeHorizontal * 90, context: context, - type: CoolAlertType.error, - confirmBtnColor: second, - title: 'Login Failed!', - text: 'username or password is incorrect.', - loopAnimation: false, - ); + dialogType: DialogType.error, + animType: AnimType.scale, + headerAnimationLoop: false, + title: title, + desc: description, + btnOkOnPress: () {}, + btnOkColor: Colors.red, + ).show(); } diff --git a/unit2/lib/utils/router.dart b/unit2/lib/utils/router.dart index 37864e3..97d210b 100644 --- a/unit2/lib/utils/router.dart +++ b/unit2/lib/utils/router.dart @@ -1,5 +1,9 @@ import 'package:go_router/go_router.dart'; import 'package:unit2/screens/unit2/login/register.dart'; +import 'package:unit2/screens/unit2/roles/qr_code_scanner.dart/scan.dart'; +import 'package:unit2/screens/unit2/roles/qr_code_scanner.dart/settings_screen.dart'; +import 'package:unit2/screens/unit2/signature/signature_pad.dart'; +import 'package:unit2/utils/scanner.dart'; import '../screens/docsms/components/doc_info_tile.dart'; import '../screens/docsms/request_receipt.dart'; import '../screens/sos/add_mobile.dart'; @@ -15,6 +19,10 @@ final GoRouter goRouter = GoRouter(routes: [ name: 'login', builder: (context, state) => UniT2Login(), routes: [ + GoRoute( + name: 'register', + path: 'register', + builder: ((context, state) => const Register())), GoRoute( name: 'home', path: 'home', @@ -23,7 +31,14 @@ final GoRouter goRouter = GoRouter(routes: [ GoRoute( name: 'profile', path: 'profile', - builder: (context, state) => const Profile()) + builder: (context, state) => const Profile(), + routes: [ + GoRoute( + name: 'signature', + path: 'signature', + builder: (context, state) => const SignaturePad(), + ) + ]) ]), GoRoute( name: 'add-mobile', diff --git a/unit2/lib/utils/text_container.dart b/unit2/lib/utils/text_container.dart index 3fcd534..e102dbb 100644 --- a/unit2/lib/utils/text_container.dart +++ b/unit2/lib/utils/text_container.dart @@ -36,7 +36,34 @@ const String documentTitle = "Document Title"; const String documentSubject = "Document Subject"; const String documentType = "Document Type"; const String registerToContinue = "Create your password to register"; +const String sourceRemarks = "Source Remarks"; +const String remarksRequired = "Remarks is required"; +const String enterRemarks = "Enter your remarks"; +const String departmentRequired = "Department is required"; +const String substationRequired = "Substation is required"; +const String requestAutoReceipt = "Request Auto Receipt"; +const String messageRequired = "Message is required"; +const String sosMessage = "SOS message ..."; +const String sosReceived = "SOS Received!"; +const String cancelRequest = "Cancel Request"; +const String usernameRequired = "Username is required"; +const String passwordRequired = "Password is required"; +const String enterPassword = "Enter Password ..."; +const String confirmPassword = "Confirm Password"; +const String enterConfirmPassword = "Enter Confirm Password ..."; +const String register = "Register"; +const String signature = "Signature pad"; +const String tapToScanQR = "TAP TO SCAN QR CODE"; +const String incoming = "INCOMING"; +const String setQRScannerSettings = "Set QR Scanner Settings"; +const String includeOtherInputs = "Include other inputs?"; +const String includeOtherInputsSubTitle = "Inputs such as body temperature, etc."; +const String incomingORoutgoing = "Incoming or Outgoing?"; +const String incomingORoutgoingSubTitle = "incoming for entrance outgoing for exit."; +const String fieldIsRequired = "This field is required"; +const String selectLevel = "Select level"; +const String selectEstablishment = "Select Establishment"; // // // -// \ No newline at end of file + diff --git a/unit2/lib/utils/validators.dart b/unit2/lib/utils/validators.dart index f647b4d..52f4c1f 100644 --- a/unit2/lib/utils/validators.dart +++ b/unit2/lib/utils/validators.dart @@ -2,7 +2,7 @@ import 'package:form_builder_validators/form_builder_validators.dart'; import '../utils/text_container.dart'; final mobileNumberValidator = FormBuilderValidators.compose([ - FormBuilderValidators.minLength(11), + FormBuilderValidators.equalLength(11), FormBuilderValidators.required(errorText: mobileNumberRequired), FormBuilderValidators.numeric(errorText: numericValidator) ]); diff --git a/unit2/pubspec.lock b/unit2/pubspec.lock index e19a094..d52d27b 100644 --- a/unit2/pubspec.lock +++ b/unit2/pubspec.lock @@ -29,6 +29,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "3.0.0" + awesome_dialog: + dependency: "direct main" + description: + name: awesome_dialog + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.2" azlistview: dependency: "direct main" description: @@ -106,13 +113,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "3.1.0+1" - cool_alert: - dependency: "direct main" - description: - name: cool_alert - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.0" crypto: dependency: transitive description: @@ -176,13 +176,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.1" - flare_flutter: - dependency: transitive - description: - name: flare_flutter - url: "https://pub.dartlang.org" - source: hosted - version: "3.0.2" flutter: dependency: "direct main" description: flutter @@ -301,6 +294,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "3.1.1" + graphs: + dependency: transitive + description: + name: graphs + url: "https://pub.dartlang.org" + source: hosted + version: "2.2.0" http: dependency: transitive description: @@ -315,6 +315,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "4.0.2" + image: + dependency: transitive + description: + name: image + url: "https://pub.dartlang.org" + source: hosted + version: "3.2.2" intl: dependency: "direct main" description: @@ -350,13 +357,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.0" - lottie: - dependency: transitive - description: - name: lottie - url: "https://pub.dartlang.org" - source: hosted - version: "1.4.3" matcher: dependency: transitive description: @@ -532,6 +532,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "4.0.0" + rive: + dependency: transitive + description: + name: rive + url: "https://pub.dartlang.org" + source: hosted + version: "0.9.1" rxdart: dependency: transitive description: @@ -602,6 +609,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.1" + signature: + dependency: "direct main" + description: + name: signature + url: "https://pub.dartlang.org" + source: hosted + version: "5.3.0" sky_engine: dependency: transitive description: flutter diff --git a/unit2/pubspec.yaml b/unit2/pubspec.yaml index 6947ded..e6afd2a 100644 --- a/unit2/pubspec.yaml +++ b/unit2/pubspec.yaml @@ -56,8 +56,9 @@ dependencies: date_time_picker: ^2.1.0 flutter_progress_hud: ^2.0.2 barcode_scan2: ^4.2.1 - cool_alert: ^1.1.0 qr_flutter: ^4.0.0 + signature: ^5.3.0 + awesome_dialog: ^3.0.2 dev_dependencies: flutter_test: