confirm login screen added & structure improvement.
							parent
							
								
									761b5abbab
								
							
						
					
					
						commit
						311ebd9c13
					
				
											
												Binary file not shown.
											
										
									
								| Before Width: | Height: | Size: 43 KiB | 
| @ -0,0 +1,9 @@ | ||||
| <svg xmlns="http://www.w3.org/2000/svg" width="38.595" height="38.024" viewBox="0 0 38.595 38.024"> | ||||
|   <g id="fingerprint1-scan" transform="translate(0.342 0.655)"> | ||||
|     <path id="Path_4539" data-name="Path 4539" d="M38.892,0H33.378A1.379,1.379,0,0,0,32,1.378v8.27a1.378,1.378,0,0,0,2.757,0V2.757h4.135a1.378,1.378,0,1,0,0-2.757Z" transform="translate(-32.342 -0.655)" fill="#28323a"/> | ||||
|     <path id="Path_4540" data-name="Path 4540" d="M38.892,200.27H34.757v-6.892a1.378,1.378,0,1,0-2.757,0v8.27a1.379,1.379,0,0,0,1.378,1.378h5.514a1.378,1.378,0,1,0,0-2.757Z" transform="translate(-32.342 -165.658)" fill="#28323a"/> | ||||
|     <path id="Path_4541" data-name="Path 4541" d="M390.892,0h-5.514a1.378,1.378,0,0,0,0,2.757h4.135V9.649a1.378,1.378,0,0,0,2.757,0V1.378A1.379,1.379,0,0,0,390.892,0Z" transform="translate(-354.018 -0.655)" fill="#28323a"/> | ||||
|     <path id="Path_4542" data-name="Path 4542" d="M390.892,192a1.379,1.379,0,0,0-1.378,1.378v6.892h-4.135a1.378,1.378,0,0,0,0,2.757h5.514a1.379,1.379,0,0,0,1.378-1.378v-8.27A1.379,1.379,0,0,0,390.892,192Z" transform="translate(-354.018 -165.658)" fill="#28323a"/> | ||||
|     <path id="Path_4648" data-name="Path 4648" d="M13.343,0A13.343,13.343,0,1,0,26.686,13.343,13.343,13.343,0,0,0,13.343,0Zm4.924,8.9a1.911,1.911,0,1,1-1.911,1.911A1.912,1.912,0,0,1,18.267,8.9Zm-9.849,0a1.911,1.911,0,1,1-1.911,1.911A1.912,1.912,0,0,1,8.418,8.9Zm12.124,9.083a8.733,8.733,0,0,1-14.4,0A1.169,1.169,0,1,1,8.07,16.657a6.4,6.4,0,0,0,10.55,0,1.168,1.168,0,1,1,1.923,1.325Z" transform="translate(5.611 4.855)" fill="#28323a"/> | ||||
|   </g> | ||||
| </svg> | ||||
| After Width: | Height: | Size: 1.5 KiB | 
| @ -0,0 +1,11 @@ | ||||
| <svg xmlns="http://www.w3.org/2000/svg" width="38.595" height="38.024" viewBox="0 0 38.595 38.024"> | ||||
|   <g id="sms-speech-bubble" transform="translate(-1 1.645)"> | ||||
|     <g id="textsms"> | ||||
|       <path id="Path_4529" data-name="Path 4529" d="M21.992,0H2.444A2.451,2.451,0,0,0,0,2.444V24.436l4.887-4.887h17.1A2.451,2.451,0,0,0,24.436,17.1V2.444A2.451,2.451,0,0,0,21.992,0ZM8.552,11H6.109V8.552H8.552Zm4.887,0H11V8.552H13.44Zm4.887,0H15.883V8.552h2.444Z" transform="translate(8.144 5.013)" fill="#28323a"/> | ||||
|       <path id="Path_4543" data-name="Path 4543" d="M38.892,0H33.378A1.379,1.379,0,0,0,32,1.378v8.27a1.378,1.378,0,0,0,2.757,0V2.757h4.135a1.378,1.378,0,1,0,0-2.757Z" transform="translate(-31 -1.645)" fill="#28323a"/> | ||||
|       <path id="Path_4544" data-name="Path 4544" d="M38.892,200.27H34.757v-6.892a1.378,1.378,0,1,0-2.757,0v8.27a1.379,1.379,0,0,0,1.378,1.378h5.514a1.378,1.378,0,1,0,0-2.757Z" transform="translate(-31 -166.648)" fill="#28323a"/> | ||||
|       <path id="Path_4545" data-name="Path 4545" d="M390.892,0h-5.514a1.378,1.378,0,0,0,0,2.757h4.135V9.649a1.378,1.378,0,0,0,2.757,0V1.378A1.379,1.379,0,0,0,390.892,0Z" transform="translate(-352.676 -1.645)" fill="#28323a"/> | ||||
|       <path id="Path_4546" data-name="Path 4546" d="M390.892,192a1.379,1.379,0,0,0-1.378,1.378v6.892h-4.135a1.378,1.378,0,0,0,0,2.757h5.514a1.379,1.379,0,0,0,1.378-1.378v-8.27A1.379,1.379,0,0,0,390.892,192Z" transform="translate(-352.676 -166.648)" fill="#28323a"/> | ||||
|     </g> | ||||
|   </g> | ||||
| </svg> | ||||
| After Width: | Height: | Size: 1.4 KiB | 
| @ -0,0 +1,9 @@ | ||||
| <svg xmlns="http://www.w3.org/2000/svg" width="38.595" height="38.024" viewBox="0 0 38.595 38.024"> | ||||
|   <g id="fingerprint-scan" transform="translate(0.342 0.655)"> | ||||
|     <path id="Path_4535" data-name="Path 4535" d="M24,0H2.909A2.913,2.913,0,0,0,0,2.909V24a2.913,2.913,0,0,0,2.909,2.909H24A2.913,2.913,0,0,0,26.913,24V2.909A2.913,2.913,0,0,0,24,0ZM5,5.182c5.592-4.061,11.49-4.018,17,.072a.789.789,0,0,1-.47,1.422c-.894,0-6.986-6.478-15.607-.218A.788.788,0,0,1,5,5.182Zm7.349,20.277a.788.788,0,0,1-1.1-.2c-1.111-1.606-3.634-3.4-3.634-6.757a6.063,6.063,0,0,1,5.835-6.255A6.063,6.063,0,0,1,19.291,18.5v.841a.788.788,0,0,1-1.577,0V18.5a4.488,4.488,0,0,0-4.258-4.678A4.488,4.488,0,0,0,9.2,18.5C9.2,22.3,14.037,24.294,12.353,25.459Zm9.8-4.08a4.132,4.132,0,0,1-7.8-2.035c0-3.4-2.327-2.255-1.811-.191a.788.788,0,0,1-1.53.383c-1.074-4.295,4.917-6.037,4.917-.191A2.544,2.544,0,0,0,17.9,21.971c3.65.861,4.733-5.161,1.093-9.037-5.033-5.363-13.16-1.227-13.16,5.148A6.378,6.378,0,0,0,6.95,22.25a.788.788,0,0,1-1.284.916,8.033,8.033,0,0,1-1.408-5.084,9.351,9.351,0,0,1,9.2-9.2c6.8,0,11.128,7.628,8.7,12.5Zm.527-9.761a.788.788,0,0,1-1.075-.293C20.033,8.578,16.234,7.1,13.457,7.1a11.282,11.282,0,0,0-8.175,4.275A.788.788,0,0,1,3.97,10.5a12.781,12.781,0,0,1,9.487-4.977c5.841,0,11.056,5.05,9.222,6.1Z" transform="translate(5.793 4.943)" fill="#28323a"/> | ||||
|     <path id="Path_4539" data-name="Path 4539" d="M38.892,0H33.378A1.379,1.379,0,0,0,32,1.378v8.27a1.378,1.378,0,0,0,2.757,0V2.757h4.135a1.378,1.378,0,1,0,0-2.757Z" transform="translate(-32.342 -0.655)" fill="#28323a"/> | ||||
|     <path id="Path_4540" data-name="Path 4540" d="M38.892,200.27H34.757v-6.892a1.378,1.378,0,1,0-2.757,0v8.27a1.379,1.379,0,0,0,1.378,1.378h5.514a1.378,1.378,0,1,0,0-2.757Z" transform="translate(-32.342 -165.658)" fill="#28323a"/> | ||||
|     <path id="Path_4541" data-name="Path 4541" d="M390.892,0h-5.514a1.378,1.378,0,0,0,0,2.757h4.135V9.649a1.378,1.378,0,0,0,2.757,0V1.378A1.379,1.379,0,0,0,390.892,0Z" transform="translate(-354.018 -0.655)" fill="#28323a"/> | ||||
|     <path id="Path_4542" data-name="Path 4542" d="M390.892,192a1.379,1.379,0,0,0-1.378,1.378v6.892h-4.135a1.378,1.378,0,0,0,0,2.757h5.514a1.379,1.379,0,0,0,1.378-1.378v-8.27A1.379,1.379,0,0,0,390.892,192Z" transform="translate(-354.018 -165.658)" fill="#28323a"/> | ||||
|   </g> | ||||
| </svg> | ||||
| After Width: | Height: | Size: 2.2 KiB | 
| @ -0,0 +1,12 @@ | ||||
| <svg xmlns="http://www.w3.org/2000/svg" width="38.595" height="38.024" viewBox="0 0 38.595 38.024"> | ||||
|   <g id="whatsapp_1_" data-name="whatsapp (1)" transform="translate(0.233 -4.309)"> | ||||
|     <g id="Group_7424" data-name="Group 7424" transform="translate(4.808 8.729)"> | ||||
|       <path id="Path_4537" data-name="Path 4537" d="M0,28.186l2.424-7.271a13.848,13.848,0,1,1,5.468,5.195Z" fill="#2cb742"/> | ||||
|       <path id="Path_4538" data-name="Path 4538" d="M29.341,23.6c-.64-1.209-3-2.591-3-2.591-.534-.3-1.177-.338-1.482.2a12.215,12.215,0,0,1-.961,1.051,1.791,1.791,0,0,1-2.547-.253l-1.935-1.935-1.935-1.935A1.791,1.791,0,0,1,17.23,15.6a12.216,12.216,0,0,1,1.051-.961c.542-.3.508-.948.2-1.482,0,0-1.382-2.358-2.591-3a1.325,1.325,0,0,0-1.557.234l-.854.854c-2.71,2.71-1.376,5.77,1.334,8.48L17.3,22.2l2.477,2.477c2.71,2.71,5.77,4.045,8.48,1.334l.854-.854A1.326,1.326,0,0,0,29.341,23.6Z" transform="translate(-6.169 -5.141)" fill="#fff"/> | ||||
|     </g> | ||||
|     <path id="Path_4547" data-name="Path 4547" d="M38.892,0H33.378A1.379,1.379,0,0,0,32,1.378v8.27a1.378,1.378,0,0,0,2.757,0V2.757h4.135a1.378,1.378,0,1,0,0-2.757Z" transform="translate(-32.233 4.309)" fill="#28323a"/> | ||||
|     <path id="Path_4548" data-name="Path 4548" d="M38.892,200.27H34.757v-6.892a1.378,1.378,0,1,0-2.757,0v8.27a1.379,1.379,0,0,0,1.378,1.378h5.514a1.378,1.378,0,1,0,0-2.757Z" transform="translate(-32.233 -160.693)" fill="#28323a"/> | ||||
|     <path id="Path_4549" data-name="Path 4549" d="M390.892,0h-5.514a1.378,1.378,0,0,0,0,2.757h4.135V9.649a1.378,1.378,0,0,0,2.757,0V1.378A1.379,1.379,0,0,0,390.892,0Z" transform="translate(-353.909 4.309)" fill="#28323a"/> | ||||
|     <path id="Path_4550" data-name="Path 4550" d="M390.892,192a1.379,1.379,0,0,0-1.378,1.378v6.892h-4.135a1.378,1.378,0,0,0,0,2.757h5.514a1.379,1.379,0,0,0,1.378-1.378v-8.27A1.379,1.379,0,0,0,390.892,192Z" transform="translate(-353.909 -160.693)" fill="#28323a"/> | ||||
|   </g> | ||||
| </svg> | ||||
| After Width: | Height: | Size: 1.8 KiB | 
| @ -1,9 +1,9 @@ | ||||
| import 'dart:async'; | ||||
| 
 | ||||
| import 'package:mohem_flutter_app/sikander_later_will_remove_to_parent_directory/classes/consts.dart'; | ||||
| import 'package:mohem_flutter_app/sikander_later_will_remove_to_parent_directory/models/content_info_model.dart'; | ||||
| import 'package:mohem_flutter_app/sikander_later_will_remove_to_parent_directory/models/member_model.dart'; | ||||
| import 'package:mohem_flutter_app/sikander_later_will_remove_to_parent_directory/models/surah_model.dart'; | ||||
| import 'package:mohem_flutter_app/classes/consts.dart'; | ||||
| import 'package:mohem_flutter_app/models/content_info_model.dart'; | ||||
| import 'package:mohem_flutter_app/models/member_model.dart'; | ||||
| import 'package:mohem_flutter_app/models/surah_model.dart'; | ||||
| 
 | ||||
| import 'api_client.dart'; | ||||
| 
 | ||||
| @ -1,5 +1,5 @@ | ||||
| import 'package:mohem_flutter_app/sikander_later_will_remove_to_parent_directory/models/content_info_model.dart'; | ||||
| import 'package:mohem_flutter_app/sikander_later_will_remove_to_parent_directory/models/surah_model.dart'; | ||||
| import 'package:mohem_flutter_app/models/content_info_model.dart'; | ||||
| import 'package:mohem_flutter_app/models/surah_model.dart'; | ||||
| 
 | ||||
| class AppState { | ||||
|   static final AppState _instance = AppState._internal(); | ||||
| @ -1,7 +1,7 @@ | ||||
| import 'package:flutter/material.dart'; | ||||
| 
 | ||||
| // import 'package:fluttertoast/fluttertoast.dart'; | ||||
| import 'package:mohem_flutter_app/sikander_later_will_remove_to_parent_directory/exceptions/api_exception.dart'; | ||||
| import 'package:mohem_flutter_app/exceptions/api_exception.dart'; | ||||
| 
 | ||||
| class Utils { | ||||
|   static bool _isLoadingVisible = false; | ||||
| @ -1,34 +0,0 @@ | ||||
| //class which loads components "in the background", i.e. ui does not depend on it | ||||
| 
 | ||||
| import 'package:mohem_flutter_app/services/shared_preferences.dart'; | ||||
| import 'package:injector/injector.dart'; | ||||
| //import 'package:revocheckapp/services/firebase_service.dart'; | ||||
| 
 | ||||
| 
 | ||||
| class BackgroundLoader { | ||||
|   Future loadBackgroundData() async { | ||||
|     //init notification setting | ||||
|     try { | ||||
|       /* | ||||
|       final isPromotionNotificationEnabled = await Injector.appInstance | ||||
|           .getDependency<ISharedPreferences>() | ||||
|           .promotionNotificationsEnabled; | ||||
|       if (isPromotionNotificationEnabled == null) { | ||||
|         await Injector.appInstance | ||||
|             .getDependency<ISharedPreferences>() | ||||
|             .setPromotionNotificationEnabled(true); | ||||
|         Injector.appInstance | ||||
|             .getDependency<IFirebaseService>() | ||||
|             .subscribeForPromotions(); | ||||
|       } */ | ||||
|     } catch (_) { | ||||
|       //something wend wrong, set it to true | ||||
|       await Injector.appInstance | ||||
|           .getDependency<ISharedPreferences>() | ||||
|           .setPromotionNotificationEnabled(true); | ||||
|       /*Injector.appInstance | ||||
|           .getDependency<IFirebaseService>() | ||||
|           .subscribeForPromotions();*/ | ||||
|     } | ||||
|   } | ||||
| } | ||||
| @ -1,8 +0,0 @@ | ||||
| enum YesOrNo { | ||||
|   no, | ||||
|   yes, | ||||
| } | ||||
| 
 | ||||
| const String icons = "assets/icons/"; | ||||
| const String categorySvgIcons = "assets/category/svg/"; | ||||
| const String svgIcons = "assets/svg/"; | ||||
| @ -1,36 +0,0 @@ | ||||
| // import 'package:firebase_crashlytics/firebase_crashlytics.dart'; | ||||
| // import 'package:flutter/material.dart'; | ||||
| 
 | ||||
| import 'package:mohem_flutter_app/config/background_loader.dart'; | ||||
| import 'package:mohem_flutter_app/repo/account_repository.dart'; | ||||
| import 'package:injector/injector.dart'; | ||||
| 
 | ||||
| class AppDependencies { | ||||
|   static void addDependencies() { | ||||
|     Injector injector = Injector.appInstance; | ||||
| 
 | ||||
|     //add dependencies as needed | ||||
|     injector.registerSingleton<IAcRepository>(() => AcRepository()); | ||||
| 
 | ||||
|     // injector.registerSingleton<IAcRepository>((injector) => AcRepository()); | ||||
| 
 | ||||
|     _addCrashlytics(); | ||||
|     _loadBackgroundTasksNonBlocking(); | ||||
|   } | ||||
| 
 | ||||
|   static void _addCrashlytics() { | ||||
|     // Set `enableInDevMode` to true to see reports while in debug mode | ||||
|     // This is only to be used for confirming that reports are being | ||||
|     // submitted as expected. It is not intended to be used for everyday | ||||
|     // development. | ||||
|     //Crashlytics.instance.enableInDevMode = true; | ||||
| 
 | ||||
|     // Pass all uncaught errors from the framework to Crashlytics. | ||||
|     // FlutterError.onError = Crashlytics.instance.recordFlutterError; | ||||
|   } | ||||
| 
 | ||||
|   static void _loadBackgroundTasksNonBlocking() { | ||||
|     final backgroundLoader = BackgroundLoader(); | ||||
|     backgroundLoader.loadBackgroundData(); | ||||
|   } | ||||
| } | ||||
| @ -0,0 +1,235 @@ | ||||
| import 'dart:async'; | ||||
| 
 | ||||
| import 'package:easy_localization/src/public_ext.dart'; | ||||
| import 'package:flutter/material.dart'; | ||||
| import 'package:flutter_svg/svg.dart'; | ||||
| import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; | ||||
| import 'package:mohem_flutter_app/classes/colors.dart'; | ||||
| import 'package:mohem_flutter_app/extensions/int_extensions.dart'; | ||||
| import 'package:mohem_flutter_app/extensions/string_extensions.dart'; | ||||
| import 'package:mohem_flutter_app/widgets/otp_widget.dart'; | ||||
| 
 | ||||
| class OtpDialog { | ||||
|   final int type; | ||||
|   final int mobileNo; | ||||
|   final Function(String) onSuccess; | ||||
|   final Function onFailure; | ||||
|   final BuildContext context; | ||||
| 
 | ||||
|   int remainingTime = 120; | ||||
| 
 | ||||
|   Future<Null>? timer; | ||||
| 
 | ||||
|   static BuildContext? _context; | ||||
| 
 | ||||
|   static bool? _loading; | ||||
| 
 | ||||
|   OtpDialog( | ||||
|     this.context, | ||||
|     this.type, | ||||
|     this.mobileNo, | ||||
|     this.onSuccess, | ||||
|     this.onFailure, | ||||
|   ); | ||||
| 
 | ||||
|   GlobalKey? verifyAccountForm = GlobalKey<FormState>(); | ||||
| 
 | ||||
|   final TextEditingController _pinPutController = TextEditingController(); | ||||
| 
 | ||||
|   TextEditingController digit1 = TextEditingController(text: ""); | ||||
|   TextEditingController digit2 = TextEditingController(text: ""); | ||||
|   TextEditingController digit3 = TextEditingController(text: ""); | ||||
|   TextEditingController digit4 = TextEditingController(text: ""); | ||||
| 
 | ||||
|   Map verifyAccountFormValue = { | ||||
|     'digit1': '', | ||||
|     'digit2': '', | ||||
|     'digit3': '', | ||||
|     'digit4': '', | ||||
|   }; | ||||
|   final focusD1 = FocusNode(); | ||||
|   final focusD2 = FocusNode(); | ||||
|   final focusD3 = FocusNode(); | ||||
|   final focusD4 = FocusNode(); | ||||
|   String? errorMsg; | ||||
| 
 | ||||
|   // ProjectViewModel projectProvider; | ||||
|   String displayTime = ''; | ||||
|   String? _code; | ||||
|   dynamic setState; | ||||
| 
 | ||||
|   // static String signature; | ||||
| 
 | ||||
|   displayDialog(BuildContext context) async { | ||||
|     return showDialog( | ||||
|         context: context, | ||||
|         barrierColor: Colors.black.withOpacity(0.63), | ||||
|         builder: (context) { | ||||
|           // projectProvider = Provider.of(context); | ||||
|           return Dialog( | ||||
|             backgroundColor: Colors.white, | ||||
|             shape: RoundedRectangleBorder(), | ||||
|             insetPadding: EdgeInsets.only(left: 21, right: 21), | ||||
|             child: StatefulBuilder(builder: (context, setState) { | ||||
|               if (displayTime == '') { | ||||
|                 startTimer(setState); | ||||
|               } | ||||
| 
 | ||||
|               return Container( | ||||
|                 padding: EdgeInsets.only(left: 21, right: 18, top: 39, bottom: 59), | ||||
|                 child: Column( | ||||
|                   mainAxisSize: MainAxisSize.min, | ||||
|                   crossAxisAlignment: CrossAxisAlignment.start, | ||||
|                   children: [ | ||||
|                     Row( | ||||
|                       crossAxisAlignment: CrossAxisAlignment.start, | ||||
|                       mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||||
|                       children: [ | ||||
|                         SvgPicture.asset( | ||||
|                           type == 1 ? "assets/images/verify_sms.svg" : "assets/images/verify_whatsapp.svg", | ||||
|                           height: 50, | ||||
|                           width: 50, | ||||
|                         ), | ||||
|                         IconButton( | ||||
|                           padding: EdgeInsets.zero, | ||||
|                           icon: const Icon(Icons.close), | ||||
|                           constraints: const BoxConstraints(), | ||||
|                           onPressed: () { | ||||
|                             Navigator.pop(context); | ||||
|                             this.onFailure(); | ||||
|                           }, | ||||
|                         ) | ||||
|                       ], | ||||
|                     ), | ||||
|                     22.height, | ||||
|                     (LocaleKeys.pleaseEnterTheVerificationCodeSentTo.tr() + ' xxxxxxxx' + mobileNo.toString().substring(mobileNo.toString().length - 3)).toText16, | ||||
|                     18.height, | ||||
|                     Directionality( | ||||
|                       textDirection: TextDirection.ltr, | ||||
|                       child: Center( | ||||
|                         child: OTPWidget( | ||||
|                           autoFocus: true, | ||||
|                           controller: _pinPutController, | ||||
|                           defaultBorderColor: const Color(0xffD8D8D8), | ||||
|                           maxLength: 4, | ||||
|                           onTextChanged: (text) {}, | ||||
|                           pinBoxColor: Colors.white, | ||||
|                           onDone: (code) => _onOtpCallBack(code, null), | ||||
|                           textBorderColor: const Color(0xffD8D8D8), | ||||
|                           pinBoxWidth: 60, | ||||
|                           pinBoxHeight: 60, | ||||
|                           pinTextStyle: const TextStyle(fontSize: 24.0, color: MyColors.darkTextColor), | ||||
|                           pinTextAnimatedSwitcherTransition: ProvidedPinBoxTextAnimation.scalingTransition, | ||||
|                           pinTextAnimatedSwitcherDuration: const Duration(milliseconds: 300), | ||||
|                           pinBoxRadius: 10, | ||||
|                           keyboardType: TextInputType.number, | ||||
|                         ), | ||||
|                       ), | ||||
|                     ), | ||||
|                     30.height, | ||||
|                     RichText( | ||||
|                       text: TextSpan( | ||||
|                         text: LocaleKeys.theVerificationCodeWillExpireIn.tr() + '\n', | ||||
|                         style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: MyColors.darkTextColor, letterSpacing: -0.48), | ||||
|                         children: <TextSpan>[ | ||||
|                           TextSpan( | ||||
|                             text: displayTime, | ||||
|                             style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: MyColors.textMixColor, letterSpacing: -0.48), | ||||
|                           ), | ||||
|                         ], | ||||
|                       ), | ||||
|                     ), | ||||
|                   ], | ||||
|                 ), | ||||
|               ); | ||||
|             }), | ||||
|           ); | ||||
|         }); | ||||
|   } | ||||
| 
 | ||||
|   InputDecoration buildInputDecoration(BuildContext context) { | ||||
|     return InputDecoration( | ||||
|       counterText: " ", | ||||
|       // ts/images/password_icon.png | ||||
|       // contentPadding: EdgeInsets.only(top: 20, bottom: 20), | ||||
|       enabledBorder: OutlineInputBorder( | ||||
|         borderRadius: BorderRadius.all(Radius.circular(10)), | ||||
|         borderSide: BorderSide(color: Colors.black), | ||||
|       ), | ||||
|       focusedBorder: OutlineInputBorder( | ||||
|         borderRadius: BorderRadius.all(Radius.circular(10.0)), | ||||
|         borderSide: BorderSide(color: Theme.of(context).primaryColor), | ||||
|       ), | ||||
|       errorBorder: OutlineInputBorder( | ||||
|         borderRadius: BorderRadius.all(Radius.circular(10.0)), | ||||
|         borderSide: BorderSide(color: Theme.of(context).errorColor), | ||||
|       ), | ||||
|       focusedErrorBorder: OutlineInputBorder( | ||||
|         borderRadius: BorderRadius.all(Radius.circular(10.0)), | ||||
|         borderSide: BorderSide(color: Theme.of(context).errorColor), | ||||
|       ), | ||||
|     ); | ||||
|   } | ||||
| 
 | ||||
|   // String validateCodeDigit(value) { | ||||
|   //   if (value.isEmpty) { | ||||
|   //     return ' '; | ||||
|   //   } else if (value.length == 3) { | ||||
|   //     print(value); | ||||
|   //   } else { | ||||
|   //     return null; | ||||
|   //   } | ||||
|   // } | ||||
| 
 | ||||
|   checkValue() { | ||||
|     //print(verifyAccountFormValue); | ||||
|     // if (verifyAccountForm?.currentState!.validate()) { | ||||
|     //   onSuccess(digit1.text.toString() + digit2.text.toString() + digit3.text.toString() + digit4.text.toString()); | ||||
|     // } | ||||
|   } | ||||
| 
 | ||||
|   getSecondsAsDigitalClock(int inputSeconds) { | ||||
|     var sec_num = int.parse(inputSeconds.toString()); // don't forget the second param | ||||
|     var hours = (sec_num / 3600).floor(); | ||||
|     var minutes = ((sec_num - hours * 3600) / 60).floor(); | ||||
|     var seconds = sec_num - hours * 3600 - minutes * 60; | ||||
|     var minutesString = ""; | ||||
|     var secondsString = ""; | ||||
|     minutesString = minutes < 10 ? "0" + minutes.toString() : minutes.toString(); | ||||
|     secondsString = seconds < 10 ? "0" + seconds.toString() : seconds.toString(); | ||||
|     return minutesString + ":" + secondsString; | ||||
|   } | ||||
| 
 | ||||
|   startTimer(setState) { | ||||
|     this.remainingTime--; | ||||
|     setState(() { | ||||
|       displayTime = this.getSecondsAsDigitalClock(this.remainingTime); | ||||
|     }); | ||||
| 
 | ||||
|     timer = Future.delayed(Duration(seconds: 1), () { | ||||
|       if (this.remainingTime > 0) { | ||||
|         startTimer(setState); | ||||
|       } else { | ||||
|         Navigator.pop(context); | ||||
|       } | ||||
|     }); | ||||
|   } | ||||
| 
 | ||||
|   static void hideSMSBox(context) { | ||||
|     Navigator.pop(context); | ||||
|   } | ||||
| 
 | ||||
|   _onOtpCallBack(String otpCode, bool? isAutofill) { | ||||
|     if (otpCode.length == 4) { | ||||
|       onSuccess(otpCode); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   static getSignature() async { | ||||
|     // if (Platform.isAndroid) { | ||||
|     //   return await SmsRetriever.getAppSignature(); | ||||
|     // } else { | ||||
|     //   return null; | ||||
|     // } | ||||
|   } | ||||
| } | ||||
| @ -1,6 +1,6 @@ | ||||
| import 'dart:convert'; | ||||
| 
 | ||||
| import 'package:mohem_flutter_app/sikander_later_will_remove_to_parent_directory/api/api_client.dart'; | ||||
| import 'package:mohem_flutter_app/api/api_client.dart'; | ||||
| 
 | ||||
| class APIException implements Exception { | ||||
|   static const String BAD_REQUEST = 'api_common_bad_request'; | ||||
| @ -0,0 +1,72 @@ | ||||
| import 'package:flutter/cupertino.dart'; | ||||
| import 'package:intl/intl.dart'; | ||||
| import 'package:mohem_flutter_app/classes/colors.dart'; | ||||
| 
 | ||||
| extension EmailValidator on String { | ||||
|   Widget get toWidget => Text(this); | ||||
| 
 | ||||
|   Widget toText10({Color? color}) => Text( | ||||
|         this, | ||||
|         style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: color ?? MyColors.darkTextColor, letterSpacing: -0.4), | ||||
|       ); | ||||
| 
 | ||||
|   Widget toText12({Color? color, bool isUnderLine = false}) => Text( | ||||
|         this, | ||||
|         style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: color ?? MyColors.darkTextColor, letterSpacing: -0.72, decoration: isUnderLine ? TextDecoration.underline : null), | ||||
|       ); | ||||
| 
 | ||||
|   Widget get toText14 => Text( | ||||
|         this, | ||||
|         style: const TextStyle(color: MyColors.darkTextColor, fontSize: 14, letterSpacing: -0.48, fontWeight: FontWeight.w600), | ||||
|       ); | ||||
| 
 | ||||
|   Widget get toText16 => Text( | ||||
|         this, | ||||
|         style: const TextStyle(color: MyColors.darkTextColor, fontSize: 16, letterSpacing: -0.64, fontWeight: FontWeight.w600), | ||||
|       ); | ||||
| 
 | ||||
|   Widget toText24({bool isBold = false}) => Text( | ||||
|         this, | ||||
|         style: TextStyle(color: MyColors.darkTextColor, fontSize: 24, letterSpacing: -1.44, fontWeight: isBold ? FontWeight.bold : FontWeight.w600), | ||||
|       ); | ||||
| 
 | ||||
|   bool isValidEmail() { | ||||
|     return RegExp(r'^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$').hasMatch(this); | ||||
|   } | ||||
| 
 | ||||
|   String toFormattedDate() { | ||||
|     String date = this.split("T")[0]; | ||||
|     String time = this.split("T")[1]; | ||||
|     var dates = date.split("-"); | ||||
|     return "${dates[2]} ${getMonth(int.parse(dates[1]))} ${dates[0]} ${DateFormat('hh:mm a').format(DateFormat('hh:mm:ss').parse(time))}"; | ||||
|   } | ||||
| 
 | ||||
|   getMonth(int month) { | ||||
|     switch (month) { | ||||
|       case 1: | ||||
|         return "January"; | ||||
|       case 2: | ||||
|         return "February"; | ||||
|       case 3: | ||||
|         return "March"; | ||||
|       case 4: | ||||
|         return "April"; | ||||
|       case 5: | ||||
|         return "May"; | ||||
|       case 6: | ||||
|         return "June"; | ||||
|       case 7: | ||||
|         return "July"; | ||||
|       case 8: | ||||
|         return "August"; | ||||
|       case 9: | ||||
|         return "September"; | ||||
|       case 10: | ||||
|         return "October"; | ||||
|       case 11: | ||||
|         return "November"; | ||||
|       case 12: | ||||
|         return "December"; | ||||
|     } | ||||
|   } | ||||
| } | ||||
| @ -0,0 +1,11 @@ | ||||
| import 'package:flutter/material.dart'; | ||||
| import 'package:flutter/widgets.dart'; | ||||
| 
 | ||||
| extension WidgetExtensions on Widget { | ||||
|   Widget onPress(VoidCallback onTap) => InkWell(onTap: onTap, child: this); | ||||
| 
 | ||||
|   Widget paddingAll(double _value) => Padding(padding: EdgeInsets.all(_value), child: this); | ||||
| 
 | ||||
|   Widget paddingOnly({double left = 0.0, double right = 0.0, double top = 0.0, double bottom = 0.0}) => | ||||
|       Padding(padding: EdgeInsets.only(left: left, right: right, top: top, bottom: bottom), child: this); | ||||
| } | ||||
| @ -1,43 +0,0 @@ | ||||
| // To parse this JSON data, do | ||||
| // | ||||
| //     final account = accountFromJson(jsonString); | ||||
| 
 | ||||
| import 'dart:convert'; | ||||
| 
 | ||||
| import 'package:mohem_flutter_app/models/parent_list.dart'; | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| Account accountFromJson(String str) => Account.fromJson(json.decode(str)); | ||||
| 
 | ||||
| String accountToJson(Account data) => json.encode(data.toJson()); | ||||
| 
 | ||||
| class Account { | ||||
|   Account({ | ||||
|     required this.parentList, | ||||
|     required this.selectedItem, | ||||
|   }); | ||||
| 
 | ||||
|   List<ParentList>? parentList; | ||||
|   int selectedItem; | ||||
| 
 | ||||
|   factory Account.fromJson(Map<String, dynamic> json) => Account( | ||||
|         parentList: json["parentList"] == null | ||||
|             ? null | ||||
|             : List<ParentList>.from( | ||||
|                 json["parentList"].map((x) => ParentList.fromJson(x))), | ||||
|         selectedItem: | ||||
|             json["selectedItem"] == null ? null : json["selectedItem"], | ||||
|       ); | ||||
| 
 | ||||
|   Map<String, dynamic> toJson() => { | ||||
|         "parentList": parentList == null | ||||
|             ? null | ||||
|             : List<dynamic>.from(parentList!.map((x) => x.toJson())), | ||||
|         "selectedItem": selectedItem == null ? null : selectedItem, | ||||
|       }; | ||||
| 
 | ||||
|   Map<String, dynamic> toJsonData() => { | ||||
|         "selectedItem": selectedItem == null ? null : selectedItem, | ||||
|       }; | ||||
| } | ||||
| @ -1,12 +0,0 @@ | ||||
| class ConfigModel { | ||||
|   ConfigModel(this.endpoint, this.organizationName); | ||||
| 
 | ||||
|   String endpoint; | ||||
| 
 | ||||
|   String organizationName; | ||||
| 
 | ||||
|   factory ConfigModel.fromJson(Map<String, dynamic> json) => | ||||
|       ConfigModel("", ""); | ||||
| 
 | ||||
| // Map<String, dynamic> toJson() => _$ConfigModelToJson(this); | ||||
| } | ||||
| @ -1,26 +0,0 @@ | ||||
| class ParentList { | ||||
|   ParentList({ | ||||
|     required this.dbId, | ||||
|     required this.text, | ||||
|     required this.path, | ||||
|     required this.isSelected, | ||||
|   }); | ||||
| 
 | ||||
|   int dbId; | ||||
|   String text; | ||||
|   String path; | ||||
|   bool isSelected; | ||||
| 
 | ||||
|   factory ParentList.fromJson(Map<String, dynamic> json) => ParentList( | ||||
|         dbId: json["dbId"] == null ? null : json["dbId"], | ||||
|         text: json["text"] == null ? null : json["text"], | ||||
|         path: json["path"] == null ? null : json["path"], | ||||
|         isSelected: false, | ||||
|       ); | ||||
| 
 | ||||
|   Map<String, dynamic> toJson() => { | ||||
|         "dbId": dbId == null ? null : dbId, | ||||
|         "text": text == null ? null : text, | ||||
|         "path": path == null ? null : path, | ||||
|       }; | ||||
| } | ||||
| @ -1,34 +0,0 @@ | ||||
| /// | ||||
| /// This example was taken from | ||||
| /// https://flutter.dev/docs/development/data-and-backend/json | ||||
| /// | ||||
| 
 | ||||
| /// This allows the `User` class to access private members in | ||||
| /// the generated file. The value for this is *.g.dart, where | ||||
| /// the star denotes the source file name. | ||||
| 
 | ||||
| /// An annotation for the code generator to know that this class needs the | ||||
| /// JSON serialization logic to be generated. | ||||
| 
 | ||||
| class BackendResponse { | ||||
|   BackendResponse({required this.id, required this.isOk, required this.result}); | ||||
| 
 | ||||
|   int id; | ||||
|   bool isOk; | ||||
|   dynamic result; | ||||
| 
 | ||||
|   /// A necessary factory constructor for creating a new User instance | ||||
|   /// from a map. Pass the map to the generated `_$UserFromJson()` constructor. | ||||
|   /// The constructor is named after the source class, in this case, User. | ||||
|   factory BackendResponse.fromJson(Map<String, dynamic> json) => | ||||
|       BackendResponse( | ||||
|         id: 1, | ||||
|         isOk: false, | ||||
|         result: null, | ||||
|       ); | ||||
| // | ||||
| // /// `toJson` is the convention for a class to declare support for serialization | ||||
| // /// to JSON. The implementation simply calls the private, generated | ||||
| // /// helper method `_$UserToJson`. | ||||
| // Map<String, dynamic> toJson() => _$BackendResponseToJson(this); | ||||
| } | ||||
| @ -1,9 +0,0 @@ | ||||
| class User { | ||||
|   int id; | ||||
| 
 | ||||
|   User(this.id, this.userName, this.userImage, this.createdDate); | ||||
| 
 | ||||
|   String userName; | ||||
|   String userImage; | ||||
|   String createdDate; | ||||
| } | ||||
| @ -1,48 +0,0 @@ | ||||
| import 'dart:async'; | ||||
| 
 | ||||
| import 'package:mohem_flutter_app/config/routes.dart'; | ||||
| import 'package:mohem_flutter_app/utils/navigator.dart'; | ||||
| import 'package:mohem_flutter_app/utils/utils.dart'; | ||||
| import 'package:mohem_flutter_app/widgets/txt.dart'; | ||||
| import 'package:flutter/material.dart'; | ||||
| 
 | ||||
| class SplashPage extends StatelessWidget { | ||||
|   @override | ||||
|   Widget build(BuildContext context) { | ||||
|     return Scaffold( | ||||
|       body: Container( | ||||
|         width: double.infinity, | ||||
|         height: double.infinity, | ||||
|         child: Column( | ||||
|           children: [ | ||||
|             mFlex(5), | ||||
|             Txt( | ||||
|               "Logo", | ||||
|               fontSize: 45, | ||||
|               bold: true, | ||||
|             ), | ||||
|             mFlex(3), | ||||
|             Txt( | ||||
|               "First Time Log In", | ||||
|               txtType: TxtType.heading1, | ||||
|               isFlatButton: true, | ||||
|               onTap: () { | ||||
|                 navigateWithName(context, AppRoutes.registerSelection); | ||||
|               }, | ||||
|             ), | ||||
|             mFlex(1), | ||||
|             Txt( | ||||
|               "Already Signed Up and Logged In", | ||||
|               txtType: TxtType.heading1, | ||||
|               isFlatButton: true, | ||||
|               onTap: () { | ||||
|                 navigateWithName(context, AppRoutes.loginVerification); | ||||
|               }, | ||||
|             ), | ||||
|             mFlex(5), | ||||
|           ], | ||||
|         ), | ||||
|       ), | ||||
|     ); | ||||
|   } | ||||
| } | ||||
| @ -1,20 +0,0 @@ | ||||
| import 'package:flutter/foundation.dart'; | ||||
| import 'package:flutter/material.dart'; | ||||
| 
 | ||||
| class Counter with ChangeNotifier, DiagnosticableTreeMixin { | ||||
|   int _count = 0; | ||||
| 
 | ||||
|   int get count => _count; | ||||
| 
 | ||||
|   void increment() { | ||||
|     _count++; | ||||
|     notifyListeners(); | ||||
|   } | ||||
| 
 | ||||
|   /// Makes `Counter` readable inside the devtools by listing all of its properties | ||||
|   @override | ||||
|   void debugFillProperties(DiagnosticPropertiesBuilder properties) { | ||||
|     super.debugFillProperties(properties); | ||||
|     properties.add(IntProperty('count', count)); | ||||
|   } | ||||
| } | ||||
| @ -1,49 +0,0 @@ | ||||
| import 'dart:convert'; | ||||
| import 'dart:io'; | ||||
| 
 | ||||
| import 'package:mohem_flutter_app/models/account.dart'; | ||||
| import 'package:mohem_flutter_app/models/response_models.dart'; | ||||
| import 'package:mohem_flutter_app/services/backend_service.dart'; | ||||
| import 'package:injector/injector.dart'; | ||||
| 
 | ||||
| abstract class IAcRepository { | ||||
|   Future<Account> getAccountList(); | ||||
| 
 | ||||
|   Future<BackendResponse> updateAccount(String dataAsJson); | ||||
| } | ||||
| 
 | ||||
| class AcRepository implements IAcRepository { | ||||
|   static const String ACCOUNT_API_CONTROLLER_MOBILE = | ||||
|       "AccountApiControllerMobile/"; | ||||
| 
 | ||||
|   static const String ACCOUNT_LIST = ACCOUNT_API_CONTROLLER_MOBILE + "list"; | ||||
|   static const String UPDATE_LIST = | ||||
|       ACCOUNT_API_CONTROLLER_MOBILE + "saveaccountselected"; | ||||
| 
 | ||||
|   @override | ||||
|   Future<Account> getAccountList() async { | ||||
|     BackendResponse response = await Injector.appInstance | ||||
|         .getDependency<IBackendApiService>() | ||||
|         .getAuthenticatedAPI(ACCOUNT_LIST); | ||||
| 
 | ||||
|     if (response != null && response.isOk) { | ||||
|       return Account.fromJson(response.result); | ||||
|     } else { | ||||
|       throw Exception(); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   @override | ||||
|   Future<BackendResponse> updateAccount(String dataAsJson) async { | ||||
|     BackendResponse response = await Injector.appInstance | ||||
|         .getDependency<IBackendApiService>() | ||||
|         .postAuthenticatedAPI(UPDATE_LIST, dataAsJson); | ||||
| 
 | ||||
|     if (response != null && response.isOk) { | ||||
|       //if parsing failed, throw exception | ||||
|       return response; | ||||
|     } else { | ||||
|       throw Exception(); | ||||
|     } | ||||
|   } | ||||
| } | ||||
| @ -1,127 +0,0 @@ | ||||
| import 'dart:convert'; | ||||
| import 'dart:io'; | ||||
| import 'package:mohem_flutter_app/models/response_models.dart'; | ||||
| import 'package:mohem_flutter_app/services/secure_storage.dart'; | ||||
| import 'package:http/http.dart'; | ||||
| import 'package:injector/injector.dart'; | ||||
| 
 | ||||
| import 'http_service.dart'; | ||||
| import 'network_service.dart'; | ||||
| 
 | ||||
| abstract class IBackendApiService { | ||||
|   Future<BackendResponse> getUnauthenticatedAPI(String route); | ||||
| 
 | ||||
|   Future<BackendResponse> getAuthenticatedAPI(String route); | ||||
| 
 | ||||
|   Future<BackendResponse> postUnauthenticatedAPI( | ||||
|       String route, String dataAsJson); | ||||
| 
 | ||||
|   Future<BackendResponse> postAuthenticatedAPI(String route, String dataAsJson); | ||||
| 
 | ||||
|   Future<BackendResponse> deleteAuthenticatedAPI(String route, String id); | ||||
| } | ||||
| 
 | ||||
| class BackendApiService implements IBackendApiService { | ||||
|   static String _homeUrl = "https://check.revotec.eu/check2/"; | ||||
|   static String _serverApiBaseUrl = _homeUrl + "mapi/v1/"; | ||||
| 
 | ||||
|   static String get homeUrl => _homeUrl; | ||||
| 
 | ||||
|   final ISecureStorage _secureStorage = | ||||
|       Injector.appInstance.getDependency<ISecureStorage>(); | ||||
|   final IHttpService _httpService = | ||||
|       Injector.appInstance.getDependency<IHttpService>(); | ||||
| 
 | ||||
|   ///internal helper functions which executes the given api call | ||||
|   ///and wraps the response | ||||
|   Future<BackendResponse> _callApi(Future<dynamic> callback) async { | ||||
|     Response response; | ||||
|     try { | ||||
|       //execute future | ||||
|       response = await callback; | ||||
|       //check response code, and if not ok return isOk = false | ||||
|       //200 for Get | ||||
|       //201 for Post | ||||
| 
 | ||||
|       // print("res121: " + | ||||
|       //     response.statusCode.toString() + | ||||
|       //     " Body:" + | ||||
|       //     response.body.toString()); | ||||
|       //if delete request sent so server is returning 204 in case of success. | ||||
|       if (response.statusCode == 204) | ||||
|         return BackendResponse(id: 1, isOk: true, result: null); | ||||
| 
 | ||||
|       if (response.statusCode != 200 && response.statusCode != 201) | ||||
|         return BackendResponse(id: -1, isOk: false, result: null); | ||||
|       //if response code is good then parse message and return parsed response | ||||
|       return BackendResponse.fromJson(json.decode(response.body)); | ||||
|       //return BackendResponse.fromJson(dioResponse.body); | ||||
|     } catch (e) { | ||||
|       return BackendResponse(id: -1, isOk: false, result: null); | ||||
|       // try { | ||||
|       //   return BackendResponse.fromJson(json.decode(response.body)); | ||||
|       // } catch (e) { | ||||
|       //   return BackendResponse(id:-1, isOk:false,result: null); | ||||
|       // } | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   @override | ||||
|   Future<BackendResponse> getAuthenticatedAPI(String route) async { | ||||
|     await checkConnection(); | ||||
|     final token = await _secureStorage.readBearerToken(); | ||||
|     return _callApi(_httpService.get(_serverApiBaseUrl + route, headers: { | ||||
|       'Content-Type': 'application/json', | ||||
|       'Accept': '*/*', | ||||
|       HttpHeaders.authorizationHeader: "Bearer $token" | ||||
|     })); | ||||
|   } | ||||
| 
 | ||||
|   @override | ||||
|   Future<BackendResponse> getUnauthenticatedAPI(String route) async { | ||||
|     await checkConnection(); | ||||
|     return _callApi(_httpService.get(_serverApiBaseUrl + route, | ||||
|         headers: {'Content-Type': 'application/json', 'Accept': '*/*'})); | ||||
|   } | ||||
| 
 | ||||
|   @override | ||||
|   Future<BackendResponse> postAuthenticatedAPI( | ||||
|       String route, String dataAsJson) async { | ||||
|     await checkConnection(); | ||||
|     final token = await _secureStorage.readBearerToken(); | ||||
|     // print("res121: " + _serverApiBaseUrl + route); | ||||
|     return _callApi(_httpService | ||||
|         .post(_serverApiBaseUrl + route, body: dataAsJson, headers: { | ||||
|       'Content-Type': 'application/json', | ||||
|       'Accept': '*/*', | ||||
|       HttpHeaders.authorizationHeader: "Bearer $token" | ||||
|     })); | ||||
|   } | ||||
| 
 | ||||
|   @override | ||||
|   Future<BackendResponse> postUnauthenticatedAPI( | ||||
|       String route, String dataAsJson) async { | ||||
|     await checkConnection(); | ||||
|     return _callApi(_httpService.post(_serverApiBaseUrl + route, | ||||
|         body: dataAsJson, headers: {'Content-Type': 'application/json'})); | ||||
|   } | ||||
| 
 | ||||
|   Future<void> checkConnection() async { | ||||
|     if (!(await Injector.appInstance | ||||
|         .getDependency<INetworkService>() | ||||
|         .isHostAvailable(_homeUrl))) throw NetworkException(); | ||||
|   } | ||||
| 
 | ||||
|   @override | ||||
|   Future<BackendResponse> deleteAuthenticatedAPI( | ||||
|       String route, String id) async { | ||||
|     await checkConnection(); | ||||
|     final token = await _secureStorage.readBearerToken(); | ||||
|     return _callApi( | ||||
|         _httpService.delete(_serverApiBaseUrl + route + "/" + id, headers: { | ||||
|       'Content-Type': 'application/json', | ||||
|       'Accept': '*/*', | ||||
|       HttpHeaders.authorizationHeader: "Bearer $token" | ||||
|     })); | ||||
|   } | ||||
| } | ||||
| @ -1,180 +0,0 @@ | ||||
| /* | ||||
| import 'dart:io' show Platform; | ||||
| import 'package:firebase_messaging/firebase_messaging.dart'; | ||||
| import 'package:flutter/material.dart'; | ||||
| import 'package:flutter_local_notifications/flutter_local_notifications.dart'; | ||||
| 
 | ||||
| abstract class IFirebaseService { | ||||
|   Future<String> get token; | ||||
| 
 | ||||
|   Future<dynamic> backgroundMessageHandler(Map<String, dynamic> message); | ||||
| 
 | ||||
|   Future<dynamic> messageHandler(Map<String, dynamic> message); | ||||
| 
 | ||||
|   Future<dynamic> onLaunch(Map<String, dynamic> message); | ||||
| 
 | ||||
|   Future<dynamic> onResume(Map<String, dynamic> message); | ||||
| 
 | ||||
|   void subscribeForPromotions(); | ||||
| 
 | ||||
|   void unsubscribeFromPromotions(); | ||||
| } | ||||
| 
 | ||||
| //https://medium.com/@SebastianEngel/easy-push-notifications-with-flutter-and-firebase-cloud-messaging-d96084f5954f | ||||
| class FirebaseService implements IFirebaseService { | ||||
|   FirebaseMessaging _firebaseMessaging; | ||||
| 
 | ||||
|   FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin; | ||||
| 
 | ||||
|   FirebaseService() {. | ||||
|     _firebaseMessaging = FirebaseMessaging(); | ||||
| 
 | ||||
|     //https://github.com/FirebaseExtended/flutterfire/issues/1695 | ||||
|     _firebaseMessaging.configure( | ||||
|       onMessage: messageHandler, | ||||
|       onBackgroundMessage: | ||||
|       Platform.isAndroid ? myBackgroundMessageHandler : null, | ||||
|       onLaunch: onLaunch, | ||||
|       onResume: onResume, | ||||
|     ); | ||||
| 
 | ||||
|     //monitor firebase token changes | ||||
|     //https://firebase.google.com/docs/cloud-messaging/android/client#sample-register | ||||
|     ///The registration token may change when: | ||||
|     // | ||||
|     //The app deletes Instance ID | ||||
|     //The app is restored on a new device | ||||
|     //The user uninstalls/reinstall the app | ||||
|     //The user clears app data. | ||||
|     /// | ||||
| 
 | ||||
|     //for the first release we don't care about token refreshes | ||||
|     /*Stream<String> fcmStream = _firebaseMessaging.onTokenRefresh; | ||||
|     fcmStream.listen((token) { | ||||
| 
 | ||||
|     });*/ | ||||
| 
 | ||||
|     //ios specific settings | ||||
|     //taken from https://github.com/FirebaseExtended/flutterfire/blob/master/packages/firebase_messaging/example/lib/main.dart | ||||
|     _firebaseMessaging.requestNotificationPermissions( | ||||
|         const IosNotificationSettings( | ||||
|             sound: true, badge: true, alert: true, provisional: true)); | ||||
|     _firebaseMessaging.onIosSettingsRegistered | ||||
|         .listen((IosNotificationSettings settings) { | ||||
|       print("Settings registered: $settings"); | ||||
|     }); | ||||
| 
 | ||||
|     var initializationSettingsAndroid = | ||||
|     AndroidInitializationSettings('app_icon'); | ||||
|     var initializationSettingsIOS = | ||||
|     IOSInitializationSettings(onDidReceiveLocalNotification: onDidReceiveLocalNotification); | ||||
|     var initializationSettings = InitializationSettings( | ||||
|         initializationSettingsAndroid, initializationSettingsIOS); | ||||
|     flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin(); | ||||
|     flutterLocalNotificationsPlugin.initialize(initializationSettings, | ||||
|         onSelectNotification: selectNotification); | ||||
|   } | ||||
| 
 | ||||
|   Future<dynamic> onDidReceiveLocalNotification(int id, String title, String body, String payload)  async{ | ||||
|     var androidPlatformChannelSpecifics = AndroidNotificationDetails( | ||||
|         'new_message_channel_id', | ||||
|         'Neue Nachricht', | ||||
|         'Channel für neue Nachrichten', | ||||
|         importance: Importance.Max, | ||||
|         priority: Priority.High, | ||||
|         ticker: 'ticker'); | ||||
|     var iOSPlatformChannelSpecifics = IOSNotificationDetails(); | ||||
|     var platformChannelSpecifics = NotificationDetails( | ||||
|         androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); | ||||
|     await flutterLocalNotificationsPlugin.show( | ||||
|         0, | ||||
|         title, | ||||
|         body, | ||||
|         platformChannelSpecifics); | ||||
|   } | ||||
| 
 | ||||
|   @override | ||||
|   Future backgroundMessageHandler(Map<String, dynamic> message) async { | ||||
|     await myBackgroundMessageHandler(message); | ||||
|   } | ||||
| 
 | ||||
|   @override | ||||
|   Future messageHandler(Map<String, dynamic> message) async { | ||||
|     print("onMessage: $message"); | ||||
| 
 | ||||
| // initialise the plugin. app_icon needs to be a added as a drawable resource to the Android head project | ||||
| 
 | ||||
|     var androidPlatformChannelSpecifics = AndroidNotificationDetails( | ||||
|         'new_message_channel_id', | ||||
|         'Neue Nachricht', | ||||
|         'Channel für neue Nachrichten', | ||||
|         importance: Importance.Max, | ||||
|         priority: Priority.High, | ||||
|         ticker: 'ticker'); | ||||
|     var iOSPlatformChannelSpecifics = IOSNotificationDetails(); | ||||
|     var platformChannelSpecifics = NotificationDetails( | ||||
|         androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); | ||||
| 
 | ||||
|     if(Platform.isAndroid) { | ||||
|       await flutterLocalNotificationsPlugin.show( | ||||
|           0, | ||||
|           message["notification"]["title"], | ||||
|           message["notification"]["body"], | ||||
|           platformChannelSpecifics); | ||||
|     }else if(Platform.isIOS){ | ||||
|       await flutterLocalNotificationsPlugin.show( | ||||
|           0, | ||||
|           message["aps"]["alert"]["title"], | ||||
|           message["aps"]["alert"]["body"], | ||||
|           platformChannelSpecifics); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   Future selectNotification(String payload) async { | ||||
|     if (payload != null) { | ||||
|       debugPrint('notification payload: ' + payload); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   @override | ||||
|   Future onLaunch(Map<String, dynamic> message) async { | ||||
|     print("onLaunch: $message"); | ||||
|   } | ||||
| 
 | ||||
|   @override | ||||
|   Future onResume(Map<String, dynamic> message) async { | ||||
|     print("onResume: $message"); | ||||
|   } | ||||
| 
 | ||||
|   @override | ||||
|   Future<String> get token => _firebaseMessaging.getToken(); | ||||
| 
 | ||||
|   @override | ||||
|   void subscribeForPromotions() { | ||||
|     _firebaseMessaging.subscribeToTopic("promotions"); | ||||
|   } | ||||
| 
 | ||||
|   @override | ||||
|   void unsubscribeFromPromotions() { | ||||
|     _firebaseMessaging.unsubscribeFromTopic("promotions"); | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| Future<dynamic> myBackgroundMessageHandler(Map<String, dynamic> message) { | ||||
|   debugPrint("BACKGROUND MESSAGE RECEIVED"); | ||||
|   print("BACKGROUND MESSAGE RECEIVED"); | ||||
|   return Future.value(() => true); | ||||
| 
 | ||||
|   /*if (message.containsKey('data')) { | ||||
|     // Handle data message | ||||
|     final dynamic data = message['data']; | ||||
|   } | ||||
| 
 | ||||
|   if (message.containsKey('notification')) { | ||||
|     // Handle notification message | ||||
|     final dynamic notification = message['notification']; | ||||
|   }*/ | ||||
| 
 | ||||
|   // Or do other work. | ||||
| } | ||||
| */ | ||||
| @ -1,34 +0,0 @@ | ||||
| import 'dart:convert'; | ||||
| import 'dart:io'; | ||||
| import 'dart:async'; | ||||
| 
 | ||||
| 
 | ||||
| import 'package:http/http.dart' as http; | ||||
| import 'package:http/http.dart'; | ||||
| 
 | ||||
| abstract class IHttpService { | ||||
|   Future<Response> post(url, | ||||
|       {Map<String, String> headers, body, Encoding encoding}); | ||||
| 
 | ||||
|   Future<Response> get(url, {Map<String, String> headers}); | ||||
| 
 | ||||
|   Future<Response> delete(url, {Map<String, String> headers}); | ||||
| } | ||||
| 
 | ||||
| class HttpService implements IHttpService { | ||||
|   @override | ||||
|   Future<Response> delete(url, {Map<String, String>? headers}) { | ||||
|     return http.delete(url, headers: headers); | ||||
|   } | ||||
| 
 | ||||
|   @override | ||||
|   Future<Response> get(url, {Map<String, String>? headers}) { | ||||
|     return http.get(url, headers: headers); | ||||
|   } | ||||
| 
 | ||||
|   @override | ||||
|   Future<Response> post(url, | ||||
|       {Map<String, String>? headers, body, Encoding? encoding}) { | ||||
|     return http.post(url, headers: headers, body: body, encoding: encoding); | ||||
|   } | ||||
| } | ||||
| @ -1,26 +0,0 @@ | ||||
| // import 'dart:io'; | ||||
| // | ||||
| // import 'package:image_picker/image_picker.dart'; | ||||
| // | ||||
| // abstract class IMediaService { | ||||
| //   Future<File?> takePicture(); | ||||
| // | ||||
| //   Future<File?> openImageFromGallery(); | ||||
| // } | ||||
| // | ||||
| // class MediaService implements IMediaService { | ||||
| //   @override | ||||
| //   Future<File?> openImageFromGallery() async { | ||||
| //     final pickedFile = | ||||
| //     await ImagePicker().getImage(source: ImageSource.gallery); | ||||
| //     if (pickedFile == null) return null; | ||||
| //     return File(pickedFile.path); | ||||
| //   } | ||||
| // | ||||
| //   @override | ||||
| //   Future<File?> takePicture() async { | ||||
| //     final pickedFile = await ImagePicker().getImage(source: ImageSource.camera); | ||||
| //     if (pickedFile == null) return null; | ||||
| //     return File(pickedFile.path); | ||||
| //   } | ||||
| // } | ||||
| @ -1,25 +0,0 @@ | ||||
| 
 | ||||
| import 'dart:io'; | ||||
| 
 | ||||
| abstract class INetworkService { | ||||
|   Future<bool> isHostAvailable(String endpoint); | ||||
| } | ||||
| 
 | ||||
| class NetworkService implements INetworkService{ | ||||
|   @override | ||||
|   Future<bool> isHostAvailable(String endpoint) async { | ||||
|     try { | ||||
|       final result = await InternetAddress.lookup(endpoint.substring(endpoint.indexOf('//')+2).substring(0,endpoint.substring(endpoint.indexOf('//')+2).indexOf('/'))); | ||||
|       if (result.isNotEmpty && result[0].rawAddress.isNotEmpty) { | ||||
|         return true; | ||||
|       } else{ | ||||
|         return false; | ||||
|       } | ||||
|     } on SocketException catch (_) { | ||||
|       return false; | ||||
|     } | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| class NetworkException implements  Exception { | ||||
| } | ||||
| @ -1,33 +0,0 @@ | ||||
| abstract class ISecureStorage { | ||||
|   Future<String> readBearerToken(); | ||||
| 
 | ||||
|   Future<void> clearUserCredentials(); | ||||
| } | ||||
| 
 | ||||
| class SecureStorage implements ISecureStorage { | ||||
|   ///return bearer token if present, or null if not | ||||
|   @override | ||||
|   Future<String> readBearerToken() async { | ||||
|     try { | ||||
|       return ""; | ||||
|     } catch (_) { | ||||
|       //an error occured returning null | ||||
|       return ""; | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   ///returns true if write was successful, false otherwise | ||||
|   @override | ||||
|   Future<bool> writeBearerToken(String token) async { | ||||
|     try { | ||||
|       await ""; | ||||
|       return true; | ||||
|     } catch (_) { | ||||
|       //an error occured returning false | ||||
|       return false; | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   @override | ||||
|   Future<void> clearUserCredentials() async {} | ||||
| } | ||||
| @ -1,119 +0,0 @@ | ||||
| import 'dart:convert'; | ||||
| 
 | ||||
| import 'package:mohem_flutter_app/models/config_model.dart'; | ||||
| 
 | ||||
| import 'package:shared_preferences/shared_preferences.dart' | ||||
| as SharedPrefsPlugin; | ||||
| 
 | ||||
| /// | ||||
| /// Taken from AlarmGuide Project | ||||
| /// | ||||
| 
 | ||||
| abstract class ISharedPreferences { | ||||
|   Future<int?> get authState; | ||||
| 
 | ||||
|   Future<void> setAuthState(int authState); | ||||
| 
 | ||||
|   Future<int?> get configState; | ||||
| 
 | ||||
|   Future<void> setConfigState(int confState); | ||||
| 
 | ||||
|   Future<ConfigModel?> get config; | ||||
| 
 | ||||
|   Future<void> setConfig(ConfigModel config); | ||||
| 
 | ||||
|   Future<bool?> get promotionNotificationsEnabled; | ||||
| 
 | ||||
|   Future<void> setPromotionNotificationEnabled(bool newSetting); | ||||
| 
 | ||||
|   Future<bool?> get helpAlreadyShown; | ||||
| 
 | ||||
|   Future<void> setHelpAlreadyShown(); | ||||
| 
 | ||||
|   Future<int?> get useS3; | ||||
| 
 | ||||
|   Future<void> setUseS3(int value); | ||||
| } | ||||
| 
 | ||||
| class SharedPreferences implements ISharedPreferences { | ||||
|   static const String _AUTH_STATE_KEY = "auth_key"; | ||||
|   static const String _CONFIG_KEY = "config"; | ||||
|   static const String _CONFIG_STATE_KEY = "config_key"; | ||||
|   static const String _PROMOTION_NOTIFICATION_KEY = "promotion"; | ||||
|   static const String _HELP_ALREADY_SHOWN = "help_shown"; | ||||
|   static const String _USE_S3 = "s3"; | ||||
| 
 | ||||
|   @override | ||||
|   Future<int?> get authState async { | ||||
|     final sharedPrefs = await SharedPrefsPlugin.SharedPreferences.getInstance(); | ||||
|     return sharedPrefs.getInt(_AUTH_STATE_KEY); | ||||
|   } | ||||
| 
 | ||||
|   @override | ||||
|   Future<void> setAuthState(int authState) async { | ||||
|     final sharedPrefs = await SharedPrefsPlugin.SharedPreferences.getInstance(); | ||||
|     sharedPrefs.setInt(_AUTH_STATE_KEY, authState); | ||||
|   } | ||||
| 
 | ||||
|   @override | ||||
|   Future<ConfigModel?> get config async { | ||||
|     final sharedPrefs = await SharedPrefsPlugin.SharedPreferences.getInstance(); | ||||
|     final configAsJson = sharedPrefs.getString(_CONFIG_KEY); | ||||
|     return ConfigModel.fromJson(jsonDecode(configAsJson!)); | ||||
|   } | ||||
| 
 | ||||
|   @override | ||||
|   Future<void> setConfig(ConfigModel config) async { | ||||
|     final sharedPrefs = await SharedPrefsPlugin.SharedPreferences.getInstance(); | ||||
|     sharedPrefs.setString(_CONFIG_KEY, jsonEncode(config)); | ||||
|     setConfigState(1); | ||||
|   } | ||||
| 
 | ||||
|   @override | ||||
|   Future<bool?> get promotionNotificationsEnabled async { | ||||
|     final sharedPrefs = await SharedPrefsPlugin.SharedPreferences.getInstance(); | ||||
|     return sharedPrefs.getBool(_PROMOTION_NOTIFICATION_KEY); | ||||
|   } | ||||
| 
 | ||||
|   @override | ||||
|   Future<void> setPromotionNotificationEnabled(bool newSetting) async { | ||||
|     final sharedPrefs = await SharedPrefsPlugin.SharedPreferences.getInstance(); | ||||
|     sharedPrefs.setBool(_PROMOTION_NOTIFICATION_KEY, newSetting); | ||||
|   } | ||||
| 
 | ||||
|   @override | ||||
|   Future<bool?> get helpAlreadyShown async { | ||||
|     final sharedPrefs = await SharedPrefsPlugin.SharedPreferences.getInstance(); | ||||
|     return sharedPrefs.getBool(_HELP_ALREADY_SHOWN); | ||||
|   } | ||||
| 
 | ||||
|   @override | ||||
|   Future<void> setHelpAlreadyShown() async { | ||||
|     final sharedPrefs = await SharedPrefsPlugin.SharedPreferences.getInstance(); | ||||
|     sharedPrefs.setBool(_HELP_ALREADY_SHOWN, true); | ||||
|   } | ||||
| 
 | ||||
|   @override | ||||
|   Future<int?> get configState async { | ||||
|     final sharedPrefs = await SharedPrefsPlugin.SharedPreferences.getInstance(); | ||||
|     return sharedPrefs.getInt(_CONFIG_STATE_KEY); | ||||
|   } | ||||
| 
 | ||||
|   @override | ||||
|   Future<void> setConfigState(int confState) async { | ||||
|     final sharedPrefs = await SharedPrefsPlugin.SharedPreferences.getInstance(); | ||||
|     sharedPrefs.setInt(_CONFIG_STATE_KEY, confState); | ||||
|   } | ||||
| 
 | ||||
|   @override | ||||
|   Future<void> setUseS3(int value) async { | ||||
|     final sharedPrefs = await SharedPrefsPlugin.SharedPreferences.getInstance(); | ||||
|     sharedPrefs.setInt(_USE_S3, value); | ||||
|   } | ||||
| 
 | ||||
|   @override | ||||
|   Future<int?> get useS3 async { | ||||
|     final sharedPrefs = await SharedPrefsPlugin.SharedPreferences.getInstance(); | ||||
|     return sharedPrefs.getInt(_USE_S3); | ||||
|   } | ||||
| } | ||||
| @ -1,46 +0,0 @@ | ||||
| import 'package:flutter/cupertino.dart'; | ||||
| import 'package:intl/intl.dart'; | ||||
| 
 | ||||
| extension EmailValidator on String { | ||||
|   Widget toWidget() => Text(this); | ||||
| 
 | ||||
|   bool isValidEmail() { | ||||
|     return RegExp(r'^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$').hasMatch(this); | ||||
|   } | ||||
| 
 | ||||
|   String toFormattedDate() { | ||||
|     String date = this.split("T")[0]; | ||||
|     String time = this.split("T")[1]; | ||||
|     var dates = date.split("-"); | ||||
|     return "${dates[2]} ${getMonth(int.parse(dates[1]))} ${dates[0]} ${DateFormat('hh:mm a').format(DateFormat('hh:mm:ss').parse(time))}"; | ||||
|   } | ||||
| 
 | ||||
|   getMonth(int month) { | ||||
|     switch (month) { | ||||
|       case 1: | ||||
|         return "January"; | ||||
|       case 2: | ||||
|         return "February"; | ||||
|       case 3: | ||||
|         return "March"; | ||||
|       case 4: | ||||
|         return "April"; | ||||
|       case 5: | ||||
|         return "May"; | ||||
|       case 6: | ||||
|         return "June"; | ||||
|       case 7: | ||||
|         return "July"; | ||||
|       case 8: | ||||
|         return "August"; | ||||
|       case 9: | ||||
|         return "September"; | ||||
|       case 10: | ||||
|         return "October"; | ||||
|       case 11: | ||||
|         return "November"; | ||||
|       case 12: | ||||
|         return "December"; | ||||
|     } | ||||
|   } | ||||
| } | ||||
| @ -1,9 +0,0 @@ | ||||
| import 'package:flutter/material.dart'; | ||||
| import 'package:flutter/widgets.dart'; | ||||
| 
 | ||||
| extension WidgetExtensions on Widget { | ||||
|   Widget onPress(VoidCallback onTap) => InkWell( | ||||
|         onTap: onTap, | ||||
|         child: this, | ||||
|       ); | ||||
| } | ||||
| @ -1,373 +0,0 @@ | ||||
| // import 'dart:async'; | ||||
| // | ||||
| // import 'package:flutter/animation.dart'; | ||||
| // import 'package:flutter/foundation.dart'; | ||||
| // import 'package:flutter/material.dart'; | ||||
| // import 'package:flutter/rendering.dart'; | ||||
| // import 'package:flutter/services.dart'; | ||||
| // | ||||
| // typedef OnDone = void Function(String text); | ||||
| // | ||||
| // class ProvidedPinBoxTextAnimation { | ||||
| //   static AnimatedSwitcherTransitionBuilder scalingTransition = (child, animation) { | ||||
| //     return ScaleTransition( | ||||
| //       child: child, | ||||
| //       scale: animation, | ||||
| //     ); | ||||
| //   }; | ||||
| // | ||||
| //   static AnimatedSwitcherTransitionBuilder defaultNoTransition = (Widget child, Animation<double> animation) { | ||||
| //     return child; | ||||
| //   }; | ||||
| // } | ||||
| // | ||||
| // class OTPWidget extends StatefulWidget { | ||||
| //   final int maxLength; | ||||
| //   final TextEditingController controller; | ||||
| // | ||||
| //   final Color defaultBorderColor; | ||||
| //   final Color pinBoxColor; | ||||
| //   final double pinBoxBorderWidth; | ||||
| //   final double pinBoxRadius; | ||||
| //   final bool hideDefaultKeyboard; | ||||
| // | ||||
| //   final TextStyle pinTextStyle; | ||||
| //   final double pinBoxHeight; | ||||
| //   final double pinBoxWidth; | ||||
| //   final OnDone onDone; | ||||
| //   final bool hasError; | ||||
| //   final Color errorBorderColor; | ||||
| //   final Color textBorderColor; | ||||
| //   final Function(String) onTextChanged; | ||||
| //   final bool autoFocus; | ||||
| //   final FocusNode focusNode; | ||||
| //   final AnimatedSwitcherTransitionBuilder pinTextAnimatedSwitcherTransition; | ||||
| //   final Duration pinTextAnimatedSwitcherDuration; | ||||
| //   final TextDirection textDirection; | ||||
| //   final TextInputType keyboardType; | ||||
| //   final EdgeInsets pinBoxOuterPadding; | ||||
| // | ||||
| //   const OTPWidget({ | ||||
| //     Key key, | ||||
| //     this.maxLength: 4, | ||||
| //     this.controller, | ||||
| //     this.pinBoxWidth: 70.0, | ||||
| //     this.pinBoxHeight: 70.0, | ||||
| //     this.pinTextStyle, | ||||
| //     this.onDone, | ||||
| //     this.defaultBorderColor: Colors.black, | ||||
| //     this.textBorderColor: Colors.black, | ||||
| //     this.pinTextAnimatedSwitcherTransition, | ||||
| //     this.pinTextAnimatedSwitcherDuration: const Duration(), | ||||
| //     this.hasError: false, | ||||
| //     this.errorBorderColor: Colors.red, | ||||
| //     this.onTextChanged, | ||||
| //     this.autoFocus: false, | ||||
| //     this.focusNode, | ||||
| //     this.textDirection: TextDirection.ltr, | ||||
| //     this.keyboardType: TextInputType.number, | ||||
| //     this.pinBoxOuterPadding = const EdgeInsets.symmetric(horizontal: 4.0), | ||||
| //     this.pinBoxColor = Colors.white, | ||||
| //     this.pinBoxBorderWidth = 2.0, | ||||
| //     this.pinBoxRadius = 0, | ||||
| //     this.hideDefaultKeyboard = false, | ||||
| //   }) : super(key: key); | ||||
| // | ||||
| //   @override | ||||
| //   State<StatefulWidget> createState() { | ||||
| //     return OTPWidgetState(); | ||||
| //   } | ||||
| // } | ||||
| // | ||||
| // class OTPWidgetState extends State<OTPWidget> with SingleTickerProviderStateMixin { | ||||
| //   AnimationController _highlightAnimationController; | ||||
| //   FocusNode focusNode; | ||||
| //   String text = ""; | ||||
| //   int currentIndex = 0; | ||||
| //   List<String> strList = []; | ||||
| //   bool hasFocus = false; | ||||
| // | ||||
| //   @override | ||||
| //   void didUpdateWidget(OTPWidget oldWidget) { | ||||
| //     super.didUpdateWidget(oldWidget); | ||||
| //     focusNode = widget.focusNode ?? focusNode; | ||||
| // | ||||
| //     if (oldWidget.maxLength < widget.maxLength) { | ||||
| //       setState(() { | ||||
| //         currentIndex = text.length; | ||||
| //       }); | ||||
| //       widget.controller?.text = text; | ||||
| //       widget.controller?.selection = TextSelection.collapsed(offset: text.length); | ||||
| //     } else if (oldWidget.maxLength > widget.maxLength && widget.maxLength > 0 && text.length > 0 && text.length > widget.maxLength) { | ||||
| //       setState(() { | ||||
| //         text = text.substring(0, widget.maxLength); | ||||
| //         currentIndex = text.length; | ||||
| //       }); | ||||
| //       widget.controller?.text = text; | ||||
| //       widget.controller?.selection = TextSelection.collapsed(offset: text.length); | ||||
| //     } | ||||
| //   } | ||||
| // | ||||
| //   _calculateStrList() { | ||||
| //     if (strList.length > widget.maxLength) { | ||||
| //       strList.length = widget.maxLength; | ||||
| //     } | ||||
| //     while (strList.length < widget.maxLength) { | ||||
| //       strList.add(""); | ||||
| //     } | ||||
| //   } | ||||
| // | ||||
| //   @override | ||||
| //   void initState() { | ||||
| //     super.initState(); | ||||
| //     focusNode = widget.focusNode ?? FocusNode(); | ||||
| // | ||||
| //     _initTextController(); | ||||
| //     _calculateStrList(); | ||||
| //     widget.controller?.addListener(_controllerListener); | ||||
| //     focusNode?.addListener(_focusListener); | ||||
| //   } | ||||
| // | ||||
| //   void _controllerListener() { | ||||
| //     if (mounted == true) { | ||||
| //       setState(() { | ||||
| //         _initTextController(); | ||||
| //       }); | ||||
| //       var onTextChanged = widget.onTextChanged; | ||||
| //       if (onTextChanged != null) { | ||||
| //         onTextChanged(widget.controller?.text ?? ""); | ||||
| //       } | ||||
| //     } | ||||
| //   } | ||||
| // | ||||
| //   void _focusListener() { | ||||
| //     if (mounted == true) { | ||||
| //       setState(() { | ||||
| //         hasFocus = focusNode?.hasFocus ?? false; | ||||
| //       }); | ||||
| //     } | ||||
| //   } | ||||
| // | ||||
| //   void _initTextController() { | ||||
| //     if (widget.controller == null) { | ||||
| //       return; | ||||
| //     } | ||||
| //     strList.clear(); | ||||
| //     var text = widget.controller?.text ?? ""; | ||||
| //     if (text.isNotEmpty) { | ||||
| //       if (text.length > widget.maxLength) { | ||||
| //         throw Exception("TextEditingController length exceeded maxLength!"); | ||||
| //       } | ||||
| //     } | ||||
| //     for (var i = 0; i < text.length; i++) { | ||||
| //       strList.add(text[i]); | ||||
| //     } | ||||
| //   } | ||||
| // | ||||
| //   double get _width { | ||||
| //     var width = 0.0; | ||||
| //     for (var i = 0; i < widget.maxLength; i++) { | ||||
| //       width += widget.pinBoxWidth; | ||||
| //       if (i == 0) { | ||||
| //         width += widget.pinBoxOuterPadding.left; | ||||
| //       } else if (i + 1 == widget.maxLength) { | ||||
| //         width += widget.pinBoxOuterPadding.right; | ||||
| //       } else { | ||||
| //         width += widget.pinBoxOuterPadding.left; | ||||
| //       } | ||||
| //     } | ||||
| //     return width; | ||||
| //   } | ||||
| // | ||||
| //   @override | ||||
| //   void dispose() { | ||||
| //     if (widget.focusNode == null) { | ||||
| //       focusNode?.dispose(); | ||||
| //     } else { | ||||
| //       focusNode?.removeListener(_focusListener); | ||||
| //     } | ||||
| //     _highlightAnimationController?.dispose(); | ||||
| //     widget.controller?.removeListener(_controllerListener); | ||||
| // | ||||
| //     super.dispose(); | ||||
| //   } | ||||
| // | ||||
| //   @override | ||||
| //   Widget build(BuildContext context) { | ||||
| //     return Stack( | ||||
| //       children: <Widget>[ | ||||
| //         _otpTextInput(), | ||||
| //         _touchPinBoxRow(), | ||||
| //       ], | ||||
| //     ); | ||||
| //   } | ||||
| // | ||||
| //   Widget _touchPinBoxRow() { | ||||
| //     return widget.hideDefaultKeyboard | ||||
| //         ? _pinBoxRow(context) | ||||
| //         : GestureDetector( | ||||
| //             behavior: HitTestBehavior.opaque, | ||||
| //             onTap: () { | ||||
| //               if (hasFocus) { | ||||
| //                 FocusScope.of(context).requestFocus(FocusNode()); | ||||
| //                 Future.delayed(Duration(milliseconds: 100), () { | ||||
| //                   FocusScope.of(context).requestFocus(focusNode); | ||||
| //                 }); | ||||
| //               } else { | ||||
| //                 FocusScope.of(context).requestFocus(focusNode); | ||||
| //               } | ||||
| //             }, | ||||
| //             child: _pinBoxRow(context), | ||||
| //           ); | ||||
| //   } | ||||
| // | ||||
| //   Widget _otpTextInput() { | ||||
| //     var transparentBorder = OutlineInputBorder( | ||||
| //       borderSide: BorderSide( | ||||
| //         color: Colors.transparent, | ||||
| //         width: 0.0, | ||||
| //       ), | ||||
| //     ); | ||||
| //     return Container( | ||||
| //       width: _width, | ||||
| //       height: widget.pinBoxHeight, | ||||
| //       child: TextField( | ||||
| //         autofocus: !kIsWeb ? widget.autoFocus : false, | ||||
| //         enableInteractiveSelection: false, | ||||
| //         focusNode: focusNode, | ||||
| //         controller: widget.controller, | ||||
| //         keyboardType: widget.keyboardType, | ||||
| //         inputFormatters: widget.keyboardType == TextInputType.number ? <TextInputFormatter>[FilteringTextInputFormatter.digitsOnly] : null, | ||||
| //         style: TextStyle( | ||||
| //           height: 0.1, | ||||
| //           color: Colors.transparent, | ||||
| //         ), | ||||
| //         decoration: InputDecoration( | ||||
| //           contentPadding: EdgeInsets.all(0), | ||||
| //           focusedErrorBorder: transparentBorder, | ||||
| //           errorBorder: transparentBorder, | ||||
| //           disabledBorder: transparentBorder, | ||||
| //           enabledBorder: transparentBorder, | ||||
| //           focusedBorder: transparentBorder, | ||||
| //           counterText: null, | ||||
| //           counterStyle: null, | ||||
| //           helperStyle: TextStyle( | ||||
| //             height: 0.0, | ||||
| //             color: Colors.transparent, | ||||
| //           ), | ||||
| //           labelStyle: TextStyle(height: 0.1), | ||||
| //           fillColor: Colors.transparent, | ||||
| //           border: InputBorder.none, | ||||
| //         ), | ||||
| //         cursorColor: Colors.transparent, | ||||
| //         showCursor: false, | ||||
| //         maxLength: widget.maxLength, | ||||
| //         onChanged: _onTextChanged, | ||||
| //       ), | ||||
| //     ); | ||||
| //   } | ||||
| // | ||||
| //   void _onTextChanged(text) { | ||||
| //     var onTextChanged = widget.onTextChanged; | ||||
| //     if (onTextChanged != null) { | ||||
| //       onTextChanged(text); | ||||
| //     } | ||||
| //     setState(() { | ||||
| //       this.text = text; | ||||
| //       if (text.length >= currentIndex) { | ||||
| //         for (int i = currentIndex; i < text.length; i++) { | ||||
| //           strList[i] = text[i]; | ||||
| //         } | ||||
| //       } | ||||
| //       currentIndex = text.length; | ||||
| //     }); | ||||
| //     if (text.length == widget.maxLength) { | ||||
| //       FocusScope.of(context).requestFocus(FocusNode()); | ||||
| //       var onDone = widget.onDone; | ||||
| //       if (onDone != null) { | ||||
| //         onDone(text); | ||||
| //       } | ||||
| //     } | ||||
| //   } | ||||
| // | ||||
| //   Widget _pinBoxRow(BuildContext context) { | ||||
| //     _calculateStrList(); | ||||
| //     List<Widget> pinCodes = List.generate(widget.maxLength, (int i) { | ||||
| //       return _buildPinCode(i, context); | ||||
| //     }); | ||||
| //     return Row(children: pinCodes, mainAxisSize: MainAxisSize.min); | ||||
| //   } | ||||
| // | ||||
| //   Widget _buildPinCode(int i, BuildContext context) { | ||||
| //     Color borderColor; | ||||
| //     Color pinBoxColor = widget.pinBoxColor; | ||||
| // | ||||
| //     if (widget.hasError) { | ||||
| //       borderColor = widget.errorBorderColor; | ||||
| //     } else if (i < text.length) { | ||||
| //       borderColor = widget.textBorderColor; | ||||
| //     } else { | ||||
| //       borderColor = widget.defaultBorderColor; | ||||
| //       pinBoxColor = widget.pinBoxColor; | ||||
| //     } | ||||
| // | ||||
| //     EdgeInsets insets; | ||||
| //     if (i == 0) { | ||||
| //       insets = EdgeInsets.only( | ||||
| //         left: 0, | ||||
| //         top: widget.pinBoxOuterPadding.top, | ||||
| //         right: widget.pinBoxOuterPadding.right, | ||||
| //         bottom: widget.pinBoxOuterPadding.bottom, | ||||
| //       ); | ||||
| //     } else if (i == strList.length - 1) { | ||||
| //       insets = EdgeInsets.only( | ||||
| //         left: widget.pinBoxOuterPadding.left, | ||||
| //         top: widget.pinBoxOuterPadding.top, | ||||
| //         right: 0, | ||||
| //         bottom: widget.pinBoxOuterPadding.bottom, | ||||
| //       ); | ||||
| //     } else { | ||||
| //       insets = widget.pinBoxOuterPadding; | ||||
| //     } | ||||
| //     return Container( | ||||
| //       key: ValueKey<String>("container$i"), | ||||
| //       alignment: Alignment.center, | ||||
| //       padding: EdgeInsets.symmetric(vertical: 4.0, horizontal: 1.0), | ||||
| //       margin: insets, | ||||
| //       child: _animatedTextBox(strList[i], i), | ||||
| //       decoration: BoxDecoration( | ||||
| //         border: Border.all( | ||||
| //           color: borderColor, | ||||
| //           width: widget.pinBoxBorderWidth, | ||||
| //         ), | ||||
| //         color: pinBoxColor, | ||||
| //         borderRadius: BorderRadius.circular(widget.pinBoxRadius), | ||||
| //       ), | ||||
| //       width: widget.pinBoxWidth, | ||||
| //       height: widget.pinBoxHeight, | ||||
| //     ); | ||||
| //   } | ||||
| // | ||||
| //   Widget _animatedTextBox(String text, int i) { | ||||
| //     if (widget.pinTextAnimatedSwitcherTransition != null) { | ||||
| //       return AnimatedSwitcher( | ||||
| //         duration: widget.pinTextAnimatedSwitcherDuration, | ||||
| //         transitionBuilder: widget.pinTextAnimatedSwitcherTransition ?? | ||||
| //             (Widget child, Animation<double> animation) { | ||||
| //               return child; | ||||
| //             }, | ||||
| //         child: Text( | ||||
| //           text, | ||||
| //           key: ValueKey<String>("$text$i"), | ||||
| //           style: widget.pinTextStyle, | ||||
| //         ), | ||||
| //       ); | ||||
| //     } else { | ||||
| //       return Text( | ||||
| //         text, | ||||
| //         key: ValueKey<String>("${strList[i]}$i"), | ||||
| //         style: widget.pinTextStyle, | ||||
| //       ); | ||||
| //     } | ||||
| //   } | ||||
| // } | ||||
| @ -0,0 +1,27 @@ | ||||
| import 'package:flutter/material.dart'; | ||||
| 
 | ||||
| class Dashboard extends StatefulWidget { | ||||
|   Dashboard({Key? key}) : super(key: key); | ||||
| 
 | ||||
|   @override | ||||
|   _DashboardState createState() { | ||||
|     return _DashboardState(); | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| class _DashboardState extends State<Dashboard> { | ||||
|   @override | ||||
|   void initState() { | ||||
|     super.initState(); | ||||
|   } | ||||
| 
 | ||||
|   @override | ||||
|   void dispose() { | ||||
|     super.dispose(); | ||||
|   } | ||||
| 
 | ||||
|   @override | ||||
|   Widget build(BuildContext context) { | ||||
|     return Scaffold(); | ||||
|   } | ||||
| } | ||||
| @ -0,0 +1,700 @@ | ||||
| import 'package:easy_localization/src/public_ext.dart'; | ||||
| import 'package:flutter/material.dart'; | ||||
| import 'package:flutter/services.dart'; | ||||
| import 'package:flutter_svg/svg.dart'; | ||||
| import 'package:local_auth/local_auth.dart'; | ||||
| import 'package:mohem_flutter_app/classes/colors.dart'; | ||||
| import 'package:mohem_flutter_app/config/routes.dart'; | ||||
| import 'package:mohem_flutter_app/dialogs/otp_dialog.dart'; | ||||
| import 'package:mohem_flutter_app/extensions/int_extensions.dart'; | ||||
| import 'package:mohem_flutter_app/extensions/string_extensions.dart'; | ||||
| import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; | ||||
| import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; | ||||
| import 'package:mohem_flutter_app/widgets/button/default_button.dart'; | ||||
| 
 | ||||
| class VerifyLoginScreen extends StatefulWidget { | ||||
|   VerifyLoginScreen({Key? key}) : super(key: key); | ||||
| 
 | ||||
|   @override | ||||
|   _VerifyLoginScreenState createState() { | ||||
|     return _VerifyLoginScreenState(); | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| class _VerifyLoginScreenState extends State<VerifyLoginScreen> { | ||||
|   final LocalAuthentication auth = LocalAuthentication(); | ||||
|   List<BiometricType> _availableBioMetricType = []; | ||||
| 
 | ||||
|   @override | ||||
|   void initState() { | ||||
|     _getAvailableBiometrics(); | ||||
|     // setDefault(); | ||||
|     super.initState(); | ||||
|   } | ||||
| 
 | ||||
|   @override | ||||
|   Widget build(BuildContext context) { | ||||
|     return Scaffold( | ||||
|       appBar: AppBar( | ||||
|         backgroundColor: Colors.transparent, | ||||
|         leading: IconButton( | ||||
|           icon: const Icon(Icons.arrow_back_ios, color: MyColors.darkIconColor), | ||||
|           onPressed: () => Navigator.pop(context), | ||||
|         ), | ||||
|         actions: [Center(child: "Employee Digital ID".toText12(color: MyColors.textMixColor, isUnderLine: true).onPress(() {})), 21.width], | ||||
|       ), | ||||
|       body: Column( | ||||
|         children: [ | ||||
|           Expanded( | ||||
|             child: ListView( | ||||
|               padding: const EdgeInsets.all(21), | ||||
|               physics: const BouncingScrollPhysics(), | ||||
|               children: [ | ||||
|                 //12.height, | ||||
|                 if (true) | ||||
|                   Column( | ||||
|                     mainAxisSize: MainAxisSize.min, | ||||
|                     crossAxisAlignment: CrossAxisAlignment.start, | ||||
|                     children: [ | ||||
|                       LocaleKeys.welcomeBack.tr().toText12(), | ||||
|                       "Mohammad Hussain".toText24(isBold: true), | ||||
|                       10.height, | ||||
|                       LocaleKeys.wouldYouLikeToLoginWithCurrentUsername.tr().toText16, | ||||
|                       Container( | ||||
|                         height: 72, | ||||
|                         margin: const EdgeInsets.only(top: 23, bottom: 23), | ||||
|                         alignment: Alignment.center, | ||||
|                         padding: EdgeInsets.only(left: 17, right: 12), | ||||
|                         decoration: BoxDecoration( | ||||
|                           borderRadius: BorderRadius.circular(10), | ||||
|                           color: Colors.white, | ||||
|                           border: Border.all( | ||||
|                             color: Color(0xffefefef), | ||||
|                             width: 1, | ||||
|                           ), | ||||
|                         ), | ||||
|                         child: Column( | ||||
|                           mainAxisSize: MainAxisSize.min, | ||||
|                           children: [ | ||||
|                             Row( | ||||
|                               mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||||
|                               crossAxisAlignment: CrossAxisAlignment.center, | ||||
|                               children: [ | ||||
|                                 LocaleKeys.lastLoginDetails.tr().toText16, | ||||
|                                 // Text( | ||||
|                                 //   user.editedOn != null | ||||
|                                 //       ? DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(user.editedOn)) | ||||
|                                 //       : user.createdOn != null | ||||
|                                 //           ? DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(user.createdOn)) | ||||
|                                 //           : '--', | ||||
|                                 //   style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48), | ||||
|                                 // ), | ||||
|                               ], | ||||
|                             ), | ||||
|                             Row( | ||||
|                               mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||||
|                               crossAxisAlignment: CrossAxisAlignment.center, | ||||
|                               children: [ | ||||
|                                 LocaleKeys.verificationType.tr().toText10(color: MyColors.greyColor), | ||||
|                                 Text( | ||||
|                                   "SMS", | ||||
|                                   // " " + getType(user.logInType, context), | ||||
|                                   style: TextStyle( | ||||
|                                     fontSize: 12, | ||||
|                                     fontWeight: FontWeight.w600, | ||||
|                                     color: Color(0xff2B353E), | ||||
|                                   ), | ||||
|                                 ), | ||||
|                                 Expanded(child: SizedBox()), | ||||
|                                 // Text( | ||||
|                                 //   user.editedOn != null | ||||
|                                 //       ? DateUtil.formatDateToTimeLang(DateUtil.convertStringToDate(user.editedOn), false) | ||||
|                                 //       : user.createdOn != null | ||||
|                                 //           ? DateUtil.formatDateToTimeLang(DateUtil.convertStringToDate(user.createdOn), false) | ||||
|                                 //           : '--', | ||||
|                                 //   style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.48), | ||||
|                                 // ), | ||||
|                               ], | ||||
|                             ) | ||||
|                           ], | ||||
|                         ), | ||||
|                       ), | ||||
|                       LocaleKeys.pleaseVerify.tr().toText16, | ||||
|                       GridView( | ||||
|                         gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, crossAxisSpacing: 13, mainAxisSpacing: 9), | ||||
|                         physics: const NeverScrollableScrollPhysics(), | ||||
|                         padding: const EdgeInsets.only(top: 9), | ||||
|                         shrinkWrap: true, | ||||
|                         children: [ | ||||
|                           getButton(3), | ||||
|                           getButton(2), | ||||
|                           getButton(1), | ||||
|                           getButton(4), | ||||
|                         ], | ||||
|                       ) | ||||
|                     ], | ||||
|                   ) | ||||
|                 // else | ||||
|                 //   Column(mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ | ||||
|                 //     Image.asset( | ||||
|                 //       'assets/images/habib-logo.png', | ||||
|                 //       height: 90, | ||||
|                 //       width: 90, | ||||
|                 //     ), | ||||
|                 //     SizedBox(height: 23), | ||||
|                 //     this.onlySMSBox == false | ||||
|                 //         ? Text( | ||||
|                 //             TranslationBase.of(context).verifyLoginWith, | ||||
|                 //             style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 25 / 16), | ||||
|                 //           ) | ||||
|                 //         : Text( | ||||
|                 //             TranslationBase.of(context).verifyFingerprint2, | ||||
|                 //             style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 25 / 16), | ||||
|                 //           ), | ||||
|                 //     SizedBox(height: 23), | ||||
|                 //     Text( | ||||
|                 //       TranslationBase.of(context).pleaseVerify, | ||||
|                 //       style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64), | ||||
|                 //     ), | ||||
|                 //     GridView( | ||||
|                 //       gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, crossAxisSpacing: 13, mainAxisSpacing: 9), | ||||
|                 //       physics: NeverScrollableScrollPhysics(), | ||||
|                 //       padding: EdgeInsets.only(top: 9), | ||||
|                 //       shrinkWrap: true, | ||||
|                 //       children: [ | ||||
|                 //         if (onlySMSBox == false) getButton(3), | ||||
|                 //         if (onlySMSBox == false) getButton(2), | ||||
|                 //         getButton(1), | ||||
|                 //         getButton(4), | ||||
|                 //       ], | ||||
|                 //     ), | ||||
|                 //   ]), | ||||
|               ], | ||||
|             ), | ||||
|           ), | ||||
|           12.height, | ||||
|           DefaultButton( | ||||
|             LocaleKeys.useAnotherAccount.tr(), | ||||
|             () => { | ||||
|               //Navigator.of(context).pushNamed(LOGIN_TYPE) | ||||
|             }, | ||||
|           ).insideContainer, | ||||
|         ], | ||||
|       ), | ||||
|     ); | ||||
|   } | ||||
| 
 | ||||
|   Future<void> _getAvailableBiometrics() async { | ||||
|     try { | ||||
|       _availableBioMetricType = await auth.getAvailableBiometrics(); | ||||
|     } on PlatformException catch (e) { | ||||
|       // AppToast.showErrorToast(message: e.message); | ||||
|       print(e); | ||||
|     } | ||||
|     if (mounted) setState(() {}); | ||||
|   } | ||||
| 
 | ||||
|   // authenticateUser(int type, {int isActive}) { | ||||
|   //   GifLoaderDialogUtils.showMyDialog(context); | ||||
|   //   if (type == 2 || type == 3) { | ||||
|   //     fingrePrintBefore = type; | ||||
|   //   } | ||||
|   //   this.selectedOption = fingrePrintBefore != null ? fingrePrintBefore : type; | ||||
|   // | ||||
|   //   switch (type) { | ||||
|   //     case 1: | ||||
|   //       this.loginWithSMS(type); | ||||
|   //       break; | ||||
|   //     case 2: | ||||
|   //       this.loginWithFingurePrintFace(type, isActive); | ||||
|   //       break; | ||||
|   //     case 3: | ||||
|   //       this.loginWithFingurePrintFace(type, isActive); | ||||
|   //       break; | ||||
|   //     case 4: | ||||
|   //       this.loginWithSMS(type); | ||||
|   //       break; | ||||
|   //     default: | ||||
|   //       break; | ||||
|   //   } | ||||
|   //   sharedPref.setInt(LAST_LOGIN, this.selectedOption); //this.cs.sharedService.setStorage(this.selectedOption, AuthenticationService.LAST_LOGIN); | ||||
|   // } | ||||
| // | ||||
| //   loginWithSMS(type) { | ||||
| //     //if (!el.disabled) { | ||||
| //     if (this.user != null && this.registerd_data == null) { | ||||
| //       this.checkUserAuthentication(type); | ||||
| //     } else { | ||||
| //       if (this.loginTokenID != null) { | ||||
| //         // Future.delayed(Duration(seconds: 1), () { | ||||
| //         this.sendActivationCode(type); | ||||
| //         //  }); | ||||
| //       } else { | ||||
| //         this.checkUserAuthentication(type); | ||||
| //       } | ||||
| //     } | ||||
| //   } | ||||
| // | ||||
| //   checkUserAuthentication(type) { | ||||
| //     showLoader(true); | ||||
| //     var req = getCommonRequest(type: type); | ||||
| //     req.logInTokenID = ""; | ||||
| // | ||||
| //     var request = CheckPatientAuthenticationReq.fromJson(req.toJson()); | ||||
| // | ||||
| //     sharedPref.setObject(REGISTER_DATA_FOR_REGISTER, request); | ||||
| //     authService | ||||
| //         .checkPatientAuthentication(request) | ||||
| //         .then((value) => { | ||||
| //               GifLoaderDialogUtils.hideDialog(context), | ||||
| //               if (value['isSMSSent']) | ||||
| //                 { | ||||
| //                   sharedPref.setString(LOGIN_TOKEN_ID, value['LogInTokenID']), | ||||
| //                   this.loginTokenID = value['LogInTokenID'], | ||||
| //                   sharedPref.setObject(REGISTER_DATA_FOR_LOGIIN, request), | ||||
| //                   // Future.delayed(Duration(seconds: 1), () { | ||||
| //                   this.sendActivationCode(type) | ||||
| //                   //  }) | ||||
| //                 } | ||||
| //               else | ||||
| //                 { | ||||
| //                   if (value['IsAuthenticated']) {this.checkActivationCode()} | ||||
| //                 } | ||||
| //             }) | ||||
| //         .catchError((err) { | ||||
| //       print(err); | ||||
| //       GifLoaderDialogUtils.hideDialog(context); | ||||
| //     }); | ||||
| //   } | ||||
| // | ||||
| //   sendActivationCode(type) async { | ||||
| //     var request = this.getCommonRequest(type: type); | ||||
| //     request.sMSSignature = await SMSOTP.getSignature(); | ||||
| //     GifLoaderDialogUtils.showMyDialog(context); | ||||
| //     if (healthId != null) { | ||||
| //       // final DateFormat dateFormat = DateFormat('MM/dd/yyyy'); | ||||
| //       // final DateFormat dateFormat2 = DateFormat('dd/MM/yyyy'); | ||||
| //       request.dob = dob; //isHijri == 1 ? dob : dateFormat2.format(dateFormat.parse(dob)); | ||||
| //       request.healthId = healthId; | ||||
| //       request.isHijri = isHijri; | ||||
| //       await this.authService.sendActivationCodeRegister(request).then((result) { | ||||
| //         GifLoaderDialogUtils.hideDialog(context); | ||||
| //         if (result != null && result['isSMSSent'] == true) { | ||||
| //           this.startSMSService(type); | ||||
| //         } | ||||
| //       }).catchError((r) { | ||||
| //         GifLoaderDialogUtils.hideDialog(context); | ||||
| //       }); | ||||
| //     } else { | ||||
| //       request.dob = ""; | ||||
| //       request.healthId = ""; | ||||
| //       request.isHijri = 0; | ||||
| //       await this.authService.sendActivationCode(request).then((result) { | ||||
| //         GifLoaderDialogUtils.hideDialog(context); | ||||
| //         if (result != null && result['isSMSSent'] == true) { | ||||
| //           this.startSMSService(type); | ||||
| //         } | ||||
| //       }).catchError((r) { | ||||
| //         GifLoaderDialogUtils.hideDialog(context); | ||||
| //       }); | ||||
| //     } | ||||
| //   } | ||||
| // | ||||
| //   var tempType; | ||||
| // | ||||
| //   startSMSService(type) { | ||||
| //     tempType = type; | ||||
| //     new SMSOTP( | ||||
| //       context, | ||||
| //       type, | ||||
| //       this.mobileNumber, | ||||
| //       (value) { | ||||
| //         this.checkActivationCode(value: value); | ||||
| //       }, | ||||
| //       () => { | ||||
| //         Navigator.pop(context), | ||||
| //       }, | ||||
| //     ).displayDialog(context); | ||||
| //   } | ||||
| // | ||||
| //   loginWithFingurePrintFace(type, int isActive) async { | ||||
| //     if (isActive == 1 || isActive == 0) { | ||||
| //       const iosStrings = | ||||
| //           const IOSAuthMessages(cancelButton: 'cancel', goToSettingsButton: 'settings', goToSettingsDescription: 'Please set up your Touch ID.', lockOut: 'Please reenable your Touch ID'); | ||||
| // | ||||
| //       try { | ||||
| //         authenticated = await auth.authenticateWithBiometrics(localizedReason: 'Scan your fingerprint to authenticate', useErrorDialogs: true, stickyAuth: true, iOSAuthStrings: iosStrings); | ||||
| //       } on PlatformException catch (e) { | ||||
| //         GifLoaderDialogUtils.hideDialog(context); | ||||
| //         AppToast.showErrorToast(message: 'Please enable your Touch or Face ID'); | ||||
| //       } | ||||
| // | ||||
| //       if (authenticated == true) { | ||||
| //         // if (user != null && (user.logInType == 2 || user.logInType == 3)) { | ||||
| //         //   this.checkActivationCode(); | ||||
| //         // } else { | ||||
| // | ||||
| //         var request = this.getCommonRequest(type: type); | ||||
| //         this.getMobileInfo(request); | ||||
| //         //} | ||||
| //       } | ||||
| //     } | ||||
| //   } | ||||
| // | ||||
| //   getMobileInfo(request) { | ||||
| //     // GifLoaderDialogUtils.showMyDialog(context); | ||||
| //     this.authService.getLoginInfo(request).then((result) { | ||||
| //       GifLoaderDialogUtils.hideDialog(context); | ||||
| //       if (result['SMSLoginRequired'] == false) { | ||||
| //         this.loginTokenID = result['LogInTokenID']; | ||||
| //         this.patientOutSA = result['PatientOutSA']; | ||||
| //         // sms for register the biometric | ||||
| //         if (result['isSMSSent']) { | ||||
| //           setState(() { | ||||
| //             isMoreOption = true; | ||||
| //             this.onlySMSBox = true; | ||||
| //             // this.fingrePrintBefore = true; | ||||
| //           }); | ||||
| //           //this.button(); | ||||
| //         } else { | ||||
| //           setDefault(); | ||||
| //           checkActivationCode(); | ||||
| //         } | ||||
| //       } else { | ||||
| //         if (result['IsAuthenticated'] == true) { | ||||
| //           setState(() { | ||||
| //             isMoreOption = true; | ||||
| //             this.onlySMSBox = true; | ||||
| //             // this.fingrePrintBefore = true; | ||||
| //           }); | ||||
| //         } | ||||
| //       } | ||||
| //     }).catchError((err) { | ||||
| //       GifLoaderDialogUtils.hideDialog(context); | ||||
| //       print(err); | ||||
| //     }); | ||||
| //   } | ||||
| // | ||||
| //   setDefault() async { | ||||
| //     if (await sharedPref.getObject(IMEI_USER_DATA) != null) user = SelectDeviceIMEIRES.fromJson(await sharedPref.getObject(IMEI_USER_DATA)); | ||||
| // | ||||
| //     if (await sharedPref.getObject(REGISTER_DATA_FOR_LOGIIN) != null) { | ||||
| //       isMoreOption = true; | ||||
| //       this.registerd_data = CheckPatientAuthenticationReq.fromJson(await sharedPref.getObject(REGISTER_DATA_FOR_LOGIIN)); | ||||
| //     } | ||||
| // | ||||
| //     this.mobileNumber = this.registerd_data != null ? this.registerd_data.patientMobileNumber : int.parse(this.user.mobile); | ||||
| //     this.zipCode = this.registerd_data != null | ||||
| //         ? this.registerd_data.zipCode | ||||
| //         : this.user.outSA == true | ||||
| //             ? "971" | ||||
| //             : "966"; | ||||
| //     this.patientOutSA = this.registerd_data != null | ||||
| //         ? this.registerd_data.zipCode == "966" | ||||
| //             ? 0 | ||||
| //             : 1 | ||||
| //         : this.user.outSA; | ||||
| //     if (this.registerd_data != null) { | ||||
| //       this.loginTokenID = await sharedPref.getString(LOGIN_TOKEN_ID); | ||||
| //       this.loginType = this.registerd_data.searchType; | ||||
| //     } | ||||
| //     var nhic = await sharedPref.getObject(NHIC_DATA); | ||||
| //     if (nhic != null) { | ||||
| //       final DateFormat dateFormat = DateFormat('MM/dd/yyyy'); | ||||
| //       final DateFormat dateFormat2 = DateFormat('dd/MM/yyyy'); | ||||
| //       dob = nhic['IsHijri'] ? nhic['DateOfBirth'] : dateFormat2.format(dateFormat.parse(nhic['DateOfBirth'])); | ||||
| // | ||||
| //       isHijri = nhic['IsHijri'] ? 1 : 0; | ||||
| //       healthId = nhic['HealthId']; | ||||
| //     } | ||||
| //     this.deviceToken = await sharedPref.getString(PUSH_TOKEN); | ||||
| //     this.lastLogin = await sharedPref.getInt(LAST_LOGIN) != null | ||||
| //         ? await sharedPref.getInt(LAST_LOGIN) | ||||
| //         : user != null | ||||
| //             ? user.logInType | ||||
| //             : null; | ||||
| // | ||||
| //     //this.cs.sharedService.getStorage(AuthenticationService.LAST_LOGIN); | ||||
| //   } | ||||
| // | ||||
| //   getCommonRequest({type}) { | ||||
| //     var request = SendActivationRequest(); | ||||
| //     request.patientMobileNumber = this.mobileNumber; | ||||
| //     request.mobileNo = '0' + this.mobileNumber.toString(); | ||||
| //     request.deviceToken = this.deviceToken; | ||||
| //     request.projectOutSA = this.patientOutSA == true ? true : false; | ||||
| //     request.loginType = this.selectedOption; | ||||
| //     request.oTPSendType = type == 1 ? type : 2; //this.selectedOption == 1 ? 1 : 2; | ||||
| //     request.zipCode = this.zipCode; | ||||
| // | ||||
| //     request.logInTokenID = this.loginTokenID ?? ""; | ||||
| // | ||||
| //     if (this.registerd_data != null) { | ||||
| //       request.searchType = this.registerd_data.searchType != null ? this.registerd_data.searchType : 1; | ||||
| //       request.patientID = this.registerd_data.patientID != null ? this.registerd_data.patientID : 0; | ||||
| //       request.patientIdentificationID = request.nationalID = this.registerd_data.patientIdentificationID != null ? this.registerd_data.patientIdentificationID : '0'; | ||||
| // | ||||
| //       request.isRegister = this.registerd_data.isRegister; | ||||
| //     } else { | ||||
| //       request.searchType = request.searchType != null ? request.searchType : 2; | ||||
| //       request.patientID = this.user.patientID != null ? this.user.patientID : 0; | ||||
| //       request.nationalID = request.nationalID != null ? request.nationalID : '0'; | ||||
| //       request.patientIdentificationID = request.patientIdentificationID != null ? request.patientIdentificationID : '0'; | ||||
| //       request.isRegister = false; | ||||
| //     } | ||||
| //     request.deviceTypeID = request.searchType; | ||||
| //     return request; | ||||
| //   } | ||||
| // | ||||
| //   // checkActivationCode({value}) async { | ||||
| //   //   // Navigator.pop(context); | ||||
| //   //   GifLoaderDialogUtils.showMyDialog(context); | ||||
| //   //   var request = this.getCommonRequest().toJson(); | ||||
| //   //   dynamic res; | ||||
| //   //   if (healthId != null) { | ||||
| //   //     request['DOB'] = dob; | ||||
| //   //     request['HealthId'] = healthId; | ||||
| //   //     request['IsHijri'] = isHijri; | ||||
| //   // | ||||
| //   //     authService | ||||
| //   //         .checkActivationCodeRegister(request, value) | ||||
| //   //         .then((result) => { | ||||
| //   //       res = result, | ||||
| //   //       if (result is Map) | ||||
| //   //         { | ||||
| //   //           result = CheckActivationCode.fromJson(result), | ||||
| //   //           if (this.registerd_data != null && this.registerd_data.isRegister == true) | ||||
| //   //             { | ||||
| //   //               widget.changePageViewIndex(1), | ||||
| //   //               Navigator.popUntil(context, (route) => Utils.route(route, equalsTo: RegisterNew)), | ||||
| //   //             } | ||||
| //   //         } | ||||
| //   //       else | ||||
| //   //         { | ||||
| //   //           // Navigator.of(context).pop(), | ||||
| //   //           GifLoaderDialogUtils.hideDialog(context), | ||||
| //   //           Future.delayed(Duration(seconds: 1), () { | ||||
| //   //             AppToast.showErrorToast(message: result); | ||||
| //   //           }), | ||||
| //   //         } | ||||
| //   //     }) | ||||
| //   //         .catchError((err) { | ||||
| //   //       print(err); | ||||
| //   //       GifLoaderDialogUtils.hideDialog(context); | ||||
| //   //       Future.delayed(Duration(seconds: 1), () { | ||||
| //   //         AppToast.showErrorToast(message: err); | ||||
| //   //         startSMSService(tempType); | ||||
| //   //       }); | ||||
| //   //     }); | ||||
| //   //   } else { | ||||
| //   //     authService | ||||
| //   //         .checkActivationCode(request, value) | ||||
| //   //         .then((result) => { | ||||
| //   //       res = result, | ||||
| //   //       if (result is Map) | ||||
| //   //         { | ||||
| //   //           result = CheckActivationCode.fromJson(result), | ||||
| //   //           if (this.registerd_data != null && this.registerd_data.isRegister == true) | ||||
| //   //             { | ||||
| //   //               widget.changePageViewIndex(1), | ||||
| //   //               Navigator.popUntil(context, (route) => Utils.route(route, equalsTo: RegisterNew)), | ||||
| //   //             } | ||||
| //   //           else | ||||
| //   //             { | ||||
| //   //               sharedPref.remove(FAMILY_FILE), | ||||
| //   //               result.list.isFamily = false, | ||||
| //   //               userData = result.list, | ||||
| //   //               sharedPref.setString(BLOOD_TYPE, result.patientBloodType), | ||||
| //   //               authenticatedUserObject.user = result.list, | ||||
| //   //               projectViewModel.setPrivilege(privilegeList: res), | ||||
| //   //               sharedPref.setObject(MAIN_USER, result.list), | ||||
| //   //               sharedPref.setObject(USER_PROFILE, result.list), | ||||
| //   //               loginTokenID = result.logInTokenID, | ||||
| //   //               sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID), | ||||
| //   //               sharedPref.setString(TOKEN, result.authenticationTokenID), | ||||
| //   //               checkIfUserAgreedBefore(result), | ||||
| //   //             } | ||||
| //   //         } | ||||
| //   //       else | ||||
| //   //         { | ||||
| //   //           // // Navigator.of(context).pop(), | ||||
| //   //           // GifLoaderDialogUtils.hideDialog(context), | ||||
| //   //           // Future.delayed(Duration(seconds: 1), () { | ||||
| //   //           //   AppToast.showErrorToast(message: result); | ||||
| //   //           //   startSMSService(tempType); | ||||
| //   //           // }), | ||||
| //   //         } | ||||
| //   //     }) | ||||
| //   //         .catchError((err) { | ||||
| //   //       // print(err); | ||||
| //   //       // GifLoaderDialogUtils.hideDialog(context); | ||||
| //   //       // Future.delayed(Duration(seconds: 1), () { | ||||
| //   //       //   AppToast.showErrorToast(message: err); | ||||
| //   //       //   startSMSService(tempType); | ||||
| //   //       // }); | ||||
| //   //     }); | ||||
| //   //   } | ||||
| //   // } | ||||
| // | ||||
| //   // checkIfUserAgreedBefore(CheckActivationCode result) { | ||||
| //   //   if (result.isNeedUserAgreement == true) { | ||||
| //   //     //move to agreement page. | ||||
| //   //   } else { | ||||
| //   //     goToHome(); | ||||
| //   //   } | ||||
| //   // } | ||||
| // | ||||
| //   insertIMEI() { | ||||
| //     authService.insertDeviceImei(selectedOption).then((value) => {}).catchError((err) { | ||||
| //       print(err); | ||||
| //     }); | ||||
| //   } | ||||
| // | ||||
| //   // getToDoCount() { | ||||
| //   //   toDoProvider.setState(0, true, "0"); | ||||
| //   //   ClinicListService service = new ClinicListService(); | ||||
| //   //   service.getActiveAppointmentNo(context).then((res) { | ||||
| //   //     if (res['MessageStatus'] == 1) { | ||||
| //   //       toDoProvider.setState(res['AppointmentActiveNumber'], true, "0"); | ||||
| //   //     } else {} | ||||
| //   //   }).catchError((err) { | ||||
| //   //     print(err); | ||||
| //   //   }); | ||||
| //   // } | ||||
| // | ||||
| //   // goToHome() async { | ||||
| //   //   authenticatedUserObject.isLogin = true; | ||||
| //   //   appointmentRateViewModel.isLogin = true; | ||||
| //   //   projectViewModel.isLogin = true; | ||||
| //   //   projectViewModel.user = authenticatedUserObject.user; | ||||
| //   //   await authenticatedUserObject.getUser(getUser: true); | ||||
| //   // | ||||
| //   //   // getToDoCount(); | ||||
| //   // | ||||
| //   //   appointmentRateViewModel | ||||
| //   //       .getIsLastAppointmentRatedList() | ||||
| //   //       .then((value) => { | ||||
| //   //     getToDoCount(), | ||||
| //   //     GifLoaderDialogUtils.hideDialog(AppGlobal.context), | ||||
| //   //     if (appointmentRateViewModel.isHaveAppointmentNotRate) | ||||
| //   //       { | ||||
| //   //         Navigator.pushAndRemoveUntil( | ||||
| //   //             context, | ||||
| //   //             FadePage( | ||||
| //   //               page: RateAppointmentDoctor(), | ||||
| //   //             ), | ||||
| //   //                 (r) => false) | ||||
| //   //       } | ||||
| //   //     else | ||||
| //   //       { | ||||
| //   //         Navigator.pushAndRemoveUntil( | ||||
| //   //             context, | ||||
| //   //             FadePage( | ||||
| //   //               page: LandingPage(), | ||||
| //   //             ), | ||||
| //   //                 (r) => false) | ||||
| //   //       }, | ||||
| //   //     insertIMEI() | ||||
| //   //   }) | ||||
| //   //       .catchError((err) { | ||||
| //   //     print(err); | ||||
| //   //   }); | ||||
| //   // } | ||||
| // | ||||
| //   loading(flag) { | ||||
| //     // setState(() { | ||||
| //     //   isLoading = flag; | ||||
| //     // }); | ||||
| //   } | ||||
| // | ||||
|   Widget _loginOptionButton(String _title, String _icon, int _flag, int? _loginIndex) { | ||||
|     bool isDisable = ((_flag == 3 && !checkBiometricIsAvailable(BiometricType.face)) || (_flag == 2 && !checkBiometricIsAvailable(BiometricType.fingerprint))); | ||||
|     print("$_title:$isDisable"); | ||||
|     return InkWell( | ||||
|       onTap: isDisable | ||||
|           ? null | ||||
|           : () { | ||||
|               if (_flag == 0) { | ||||
|                 setState(() { | ||||
|                   //  isMoreOption = true; | ||||
|                 }); | ||||
|               } else { | ||||
|                 OtpDialog( | ||||
|                   context, | ||||
|                   _flag, | ||||
|                   //this.mobileNumber | ||||
|                   0554870506, | ||||
|                   (value) { | ||||
|                     Navigator.pushReplacementNamed(context, AppRoutes.dashboard); | ||||
|                     //  this.checkActivationCode(value: value); | ||||
|                   }, | ||||
|                   () => { | ||||
|                     Navigator.pop(context), | ||||
|                   }, | ||||
|                 ).displayDialog(context); | ||||
| 
 | ||||
|                 //    authenticateUser(_flag, isActive: _loginIndex); | ||||
|               } | ||||
|             }, | ||||
|       child: Container( | ||||
|         padding: const EdgeInsets.only(left: 20, right: 20, bottom: 15, top: 28), | ||||
|         decoration: BoxDecoration( | ||||
|           borderRadius: BorderRadius.circular(15), | ||||
|           color: isDisable ? Colors.grey.withOpacity(0.3) : Colors.white, | ||||
|           border: Border.all(color: MyColors.lightGreyColor, width: 1), | ||||
|         ), | ||||
|         child: Column( | ||||
|           crossAxisAlignment: CrossAxisAlignment.start, | ||||
|           mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||||
|           children: <Widget>[ | ||||
|             SvgPicture.asset( | ||||
|               _icon, | ||||
|               height: 38, | ||||
|               width: 38, | ||||
|               color: isDisable ? MyColors.darkTextColor.withOpacity(0.7) : null, | ||||
|             ), | ||||
|             _title.toText16 | ||||
|           ], | ||||
|         ), | ||||
|       ), | ||||
|     ); | ||||
|   } | ||||
| 
 | ||||
|   Widget getButton(int flag) { | ||||
|     switch (flag) { | ||||
|       case 4: | ||||
|         return _loginOptionButton(LocaleKeys.verifyThroughWhatsapp.tr(), 'assets/images/verify_whatsapp.svg', flag, null); | ||||
|       case 1: | ||||
|         return _loginOptionButton(LocaleKeys.verifyThroughSMS.tr(), 'assets/images/verify_sms.svg', flag, null); | ||||
|       case 2: | ||||
|         return _loginOptionButton(LocaleKeys.verifyThroughFingerprint.tr(), 'assets/images/verify_thumb.svg', flag, BiometricType.fingerprint.index); | ||||
|       case 3: | ||||
|         return _loginOptionButton(LocaleKeys.verifyThroughFace.tr(), 'assets/images/verify_face.svg', flag, BiometricType.face.index); | ||||
|       default: | ||||
|         return const SizedBox(); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   bool checkBiometricIsAvailable(BiometricType biometricType) { | ||||
|     bool isAvailable = false; | ||||
|     for (int i = 0; i < _availableBioMetricType.length; i++) { | ||||
|       if (biometricType == _availableBioMetricType[i]) { | ||||
|         isAvailable = true; | ||||
|         break; | ||||
|       } | ||||
|     } | ||||
|     return isAvailable; | ||||
|   } | ||||
| // | ||||
| //   formatDate(date) { | ||||
| //     return date; | ||||
| //     return DateFormat('MMM dd, yyy, kk:mm').format(date); | ||||
| //   } | ||||
| // | ||||
| //   showLoader(bool isTrue) { | ||||
| //     setState(() { | ||||
| //       // isLoading = isTrue; | ||||
| //     }); | ||||
| //   } | ||||
| 
 | ||||
| } | ||||
| @ -1,6 +1,6 @@ | ||||
| import 'package:flutter/material.dart'; | ||||
| import 'package:flutter_svg/svg.dart'; | ||||
| import 'package:mohem_flutter_app/sikander_later_will_remove_to_parent_directory/classes/colors.dart'; | ||||
| import 'package:mohem_flutter_app/classes/colors.dart'; | ||||
| 
 | ||||
| class NoDataUI extends StatelessWidget { | ||||
|   NoDataUI({Key? key}) : super(key: key); | ||||
| @ -1,36 +0,0 @@ | ||||
| import 'package:permission_handler/permission_handler.dart'; | ||||
| 
 | ||||
| import 'dialogs.dart'; | ||||
| 
 | ||||
| enum ConfirmAction { CANCEL, ACCEPT } | ||||
| 
 | ||||
| Future<bool> requestPermissionGranted( | ||||
|     context, Permission requestPermissions) async { | ||||
|   var result = await requestPermissions.request(); | ||||
| 
 | ||||
|   switch (result) { | ||||
|     case PermissionStatus.granted: | ||||
|       // Application has been given permission to use the feature. | ||||
|       return true; | ||||
|     case PermissionStatus.denied: | ||||
|       // Application has been denied permission to use the feature. | ||||
|       return false; | ||||
|     case PermissionStatus.permanentlyDenied: | ||||
|       ConfirmAction? res = await showConfirmDialogs( | ||||
|           context, | ||||
|           'You was denied Permission. You have give manual permission from app setting. ', | ||||
|           'Open App Setting', | ||||
|           'Cancel'); | ||||
|       if (res == ConfirmAction.ACCEPT) { | ||||
|         return false; | ||||
|       } else if (res == ConfirmAction.CANCEL) { | ||||
|         return false; | ||||
|       } | ||||
|       return false; | ||||
|     case PermissionStatus.restricted: | ||||
|       // iOS has restricted access to a specific feature. | ||||
|       return false; | ||||
|     default: | ||||
|       return false; | ||||
|   } | ||||
| } | ||||
| @ -1,35 +0,0 @@ | ||||
| import 'package:flutter/material.dart'; | ||||
| 
 | ||||
| import 'AppPermissionHandler.dart'; | ||||
| 
 | ||||
| Future<ConfirmAction?> showConfirmDialogs( | ||||
|     context, msg, positiveText, negativeText) async { | ||||
|   return showDialog<ConfirmAction>( | ||||
|     context: context, | ||||
|     barrierDismissible: false, | ||||
|     builder: (context) { | ||||
|       return AlertDialog( | ||||
|         backgroundColor: Colors.white, | ||||
|         title: Text(msg, style: TextStyle(fontSize: 16)), | ||||
|         actions: <Widget>[ | ||||
|           TextButton( | ||||
|             child: Text( | ||||
|               negativeText, | ||||
|             ), | ||||
|             onPressed: () { | ||||
|               Navigator.of(context).pop(ConfirmAction.CANCEL); | ||||
|             }, | ||||
|           ), | ||||
|           TextButton( | ||||
|             child: Text( | ||||
|               positiveText, | ||||
|             ), | ||||
|             onPressed: () { | ||||
|               Navigator.of(context).pop(ConfirmAction.ACCEPT); | ||||
|             }, | ||||
|           ) | ||||
|         ], | ||||
|       ); | ||||
|     }, | ||||
|   ); | ||||
| } | ||||
| @ -1,9 +0,0 @@ | ||||
| import 'package:flutter/material.dart'; | ||||
| 
 | ||||
| navigateWithName(BuildContext context, String routeName, {Object? arguments}) { | ||||
|   Navigator.pushNamed(context, routeName, arguments: arguments); | ||||
| } | ||||
| 
 | ||||
| pop(BuildContext context) { | ||||
|   Navigator.of(context).pop(); | ||||
| } | ||||
| @ -1,311 +0,0 @@ | ||||
| import 'dart:convert'; | ||||
| import 'dart:io'; | ||||
| import 'dart:typed_data'; | ||||
| import 'dart:ui'; | ||||
| 
 | ||||
| import 'package:mohem_flutter_app/config/constants.dart'; | ||||
| import 'package:mohem_flutter_app/theme/colors.dart'; | ||||
| import 'package:mohem_flutter_app/widgets/txt.dart'; | ||||
| import 'package:flutter/material.dart'; | ||||
| import 'package:flutter_svg/svg.dart'; | ||||
| 
 | ||||
| import 'package:sizer/sizer.dart'; | ||||
| 
 | ||||
| Color getColorFromHex(String hexColor) { | ||||
|   hexColor = hexColor.toUpperCase().replaceAll('#', ''); | ||||
| 
 | ||||
|   if (hexColor.length == 6) { | ||||
|     hexColor = 'FF' + hexColor; | ||||
|   } | ||||
| 
 | ||||
|   return Color(int.parse(hexColor, radix: 16)); | ||||
| } | ||||
| 
 | ||||
| Widget spacerVertical(double v) { | ||||
|   return Container( | ||||
|     height: v, | ||||
|     width: double.infinity, | ||||
|   ); | ||||
| } | ||||
| Future delay(int millis) async { | ||||
|   return await Future.delayed(Duration(milliseconds: millis)); | ||||
| } | ||||
| 
 | ||||
| inkWellCorner({double? r}) { | ||||
|   return RoundedRectangleBorder( | ||||
|     borderRadius: BorderRadius.circular(r ?? 4), | ||||
|   ); | ||||
| } | ||||
| 
 | ||||
| Widget spacerHorizontal(double v) { | ||||
|   return Container( | ||||
|     height: v, | ||||
|     width: v, | ||||
|   ); | ||||
| } | ||||
| 
 | ||||
| Widget mHeight(double f) { | ||||
|   return Container( | ||||
|     width: f, | ||||
|     height: f, | ||||
|   ); | ||||
| } | ||||
| 
 | ||||
| Widget mDivider(Color color, {double? h}) { | ||||
|   return Container( | ||||
|     width: double.infinity, | ||||
|     height: h ?? 1, | ||||
|     color: color, | ||||
|   ); | ||||
| } | ||||
| 
 | ||||
| Widget mDivider3({double? h}) { | ||||
|   return Container( | ||||
|     width: double.infinity, | ||||
|     height: h ?? 1, | ||||
|     color: borderLightColor!.withOpacity(0.7) | ||||
|   ); | ||||
| } | ||||
| 
 | ||||
| Widget mDivider2(Color color, double w) { | ||||
|   return Container( | ||||
|     width: w, | ||||
|     height: 1, | ||||
|     color: color, | ||||
|   ); | ||||
| } | ||||
| 
 | ||||
| InputDecoration txtField(String label) { | ||||
|   return new InputDecoration( | ||||
|     border: InputBorder.none, | ||||
|     focusedBorder: InputBorder.none, | ||||
|     enabledBorder: InputBorder.none, | ||||
|     errorBorder: InputBorder.none, | ||||
|     hintText: label, | ||||
|     hintStyle: TextStyle(color: Colors.grey), | ||||
|     disabledBorder: InputBorder.none, | ||||
|     isDense: false, | ||||
|     contentPadding: EdgeInsets.only(left: 15, right: 15), | ||||
|   ); | ||||
| } | ||||
| 
 | ||||
| Widget mWidth(double f) { | ||||
|   return Container( | ||||
|     width: f, | ||||
|     height: f, | ||||
|   ); | ||||
| } | ||||
| 
 | ||||
| Widget mFlex(int f) { | ||||
|   return Flexible( | ||||
|     flex: f, | ||||
|     child: Container( | ||||
|       width: double.infinity, | ||||
|       height: double.infinity, | ||||
|     ), | ||||
|   ); | ||||
| } | ||||
| Widget mExp(int f) { | ||||
|   return Expanded( | ||||
|     flex: f, | ||||
|     child: Container( | ||||
|       width: double.infinity, | ||||
|     ), | ||||
|   ); | ||||
| } | ||||
| 
 | ||||
| spacer() { | ||||
|   return SizedBox( | ||||
|     height: 8, | ||||
|   ); | ||||
| } | ||||
| 
 | ||||
| Widget floatButton(String icon, {Color? color, required Function onClick, String? title}) { | ||||
|   return Padding( | ||||
|     padding: const EdgeInsets.only(top: 12, bottom: 12), | ||||
|     child: Column( | ||||
|       crossAxisAlignment: CrossAxisAlignment.center, | ||||
|       mainAxisAlignment: MainAxisAlignment.center, | ||||
|       children: [ | ||||
|         FloatingActionButton( | ||||
|           onPressed: () { | ||||
|             onClick(); | ||||
|           }, | ||||
|           heroTag: icon, | ||||
|           backgroundColor: accentColor, | ||||
|           elevation: 4, | ||||
|           child: Container( | ||||
|             child: SvgPicture.asset( | ||||
|               categorySvgIcons + icon, | ||||
|               color: color, | ||||
|             ), | ||||
|             width: double.infinity, | ||||
|             height: double.infinity, | ||||
|             decoration: containerRadius(Colors.white, 200), | ||||
|             clipBehavior: Clip.antiAlias, | ||||
|             padding: EdgeInsets.all(15), | ||||
|             margin: EdgeInsets.all(1), | ||||
|           ), | ||||
|         ), | ||||
|         if (title != null) mHeight(2.w), | ||||
|         if (title != null) | ||||
|           Txt( | ||||
|             title, | ||||
|             fontSize: 12.sp, | ||||
|             bold: true, | ||||
|             color: headingColor, | ||||
|           ) | ||||
|       ], | ||||
|     ), | ||||
|   ); | ||||
| } | ||||
| 
 | ||||
| navigateTo(context, page) { | ||||
|   Navigator.push(context, MaterialPageRoute(builder: (context) => page)); | ||||
| } | ||||
| 
 | ||||
| circularImage(String im, double width, double height) { | ||||
|   return new Container(width: 190.0, height: 190.0, decoration: new BoxDecoration(shape: BoxShape.circle, image: new DecorationImage(fit: BoxFit.fill, image: new AssetImage(im)))); | ||||
| } | ||||
| 
 | ||||
| circularImage2(String im, double width, double height) { | ||||
|   return new Container(width: width, height: height, decoration: new BoxDecoration(shape: BoxShape.circle, image: new DecorationImage(fit: BoxFit.fill, image: new AssetImage(im)))); | ||||
| } | ||||
| 
 | ||||
| cardRadius(double radius) { | ||||
|   return RoundedRectangleBorder( | ||||
|     side: BorderSide(color: Colors.transparent, width: 1), | ||||
|     borderRadius: BorderRadius.circular(radius), | ||||
|   ); | ||||
| } | ||||
| 
 | ||||
| cardRadiusWithoutBorder(double radius) { | ||||
|   return RoundedRectangleBorder( | ||||
|     side: BorderSide(color: Colors.transparent, width: 1), | ||||
|     borderRadius: BorderRadius.circular(radius), | ||||
|   ); | ||||
| } | ||||
| 
 | ||||
| Image imageFromBase64String(String base64String) { | ||||
|   return Image.memory(base64Decode(base64String)); | ||||
| } | ||||
| 
 | ||||
| Uint8List dataFromBase64String(String base64String) { | ||||
|   return base64Decode(base64String); | ||||
| } | ||||
| 
 | ||||
| String base64String(Uint8List data) { | ||||
|   return base64Encode(data); | ||||
| } | ||||
| 
 | ||||
| Widget overLayWidget({double? width, double? height,List<Color>? color}) { | ||||
|   return Container( | ||||
|     width: width ?? double.infinity, | ||||
|     height: height ?? 60, | ||||
|     decoration: BoxDecoration( | ||||
|       gradient: LinearGradient( | ||||
|         colors: color!=null?color:[ | ||||
|           Colors.black.withOpacity(0.2), | ||||
|           Colors.black.withOpacity(0.1), | ||||
|           Colors.black.withOpacity(0.004), | ||||
|         ], | ||||
|         begin: Alignment.topCenter, | ||||
|         end: Alignment.bottomCenter, | ||||
|         tileMode: TileMode.clamp, | ||||
|       ), | ||||
|     ), | ||||
|   ); | ||||
| } | ||||
| 
 | ||||
| Decoration containerRadius(Color color, double r) { | ||||
|   return BoxDecoration( | ||||
|     color: color, | ||||
|     borderRadius: BorderRadius.all(Radius.circular(r)), | ||||
|   ); | ||||
| } | ||||
| 
 | ||||
| Decoration containerRadiusTop({Color? color, double? r}) { | ||||
|   return BoxDecoration( | ||||
|     color: color ?? Colors.white, | ||||
|     borderRadius: BorderRadius.only(topRight: Radius.circular(r ?? 12), topLeft: Radius.circular(r ?? 12)), | ||||
|   ); | ||||
| } | ||||
| 
 | ||||
| Decoration containerRadiusBorder(Color color, double r) { | ||||
|   return BoxDecoration( | ||||
|     color: Colors.transparent, | ||||
|     border: Border.all(color: color, width: 1), | ||||
|     borderRadius: BorderRadius.all(Radius.circular(r)), | ||||
|   ); | ||||
| } | ||||
| 
 | ||||
| Decoration containerRadiusBottom(Color color, double r) { | ||||
|   return BoxDecoration( | ||||
|     color: color, | ||||
|     borderRadius: BorderRadius.only(bottomLeft: Radius.circular(r), bottomRight: Radius.circular(r)), | ||||
|   ); | ||||
| } | ||||
| 
 | ||||
| ShapeBorder cardRadiusTop(double radius) { | ||||
|   return RoundedRectangleBorder( | ||||
|     side: BorderSide(color: Colors.transparent, width: 0), | ||||
|     borderRadius: BorderRadius.only(topLeft: Radius.circular(radius), topRight: Radius.circular(radius)), | ||||
|   ); | ||||
| } | ||||
| 
 | ||||
| Decoration containerColorRadiusBorderWidth(Color background, double radius, Color color, double w) { | ||||
|   return BoxDecoration( | ||||
|     color: background, | ||||
|     border: Border.all( | ||||
|         width: w, // | ||||
|         color: color //                  <--- border width here | ||||
|         ), | ||||
|     borderRadius: BorderRadius.circular(radius), | ||||
|   ); | ||||
| } | ||||
| 
 | ||||
| ShapeBorder cardRadiusTop2(double radius) { | ||||
|   return RoundedRectangleBorder( | ||||
|     borderRadius: BorderRadius.only(topLeft: Radius.circular(radius), topRight: Radius.circular(radius)), | ||||
|   ); | ||||
| } | ||||
| 
 | ||||
| ShapeBorder cardRadiusBottom(double radius) { | ||||
|   return RoundedRectangleBorder( | ||||
|     borderRadius: BorderRadius.only(bottomLeft: Radius.circular(radius), bottomRight: Radius.circular(radius)), | ||||
|   ); | ||||
| } | ||||
| 
 | ||||
| Decoration containerColorRadiusBorder(Color background, double radius, Color color) { | ||||
|   return BoxDecoration( | ||||
|     color: background, | ||||
|     border: Border.all( | ||||
|         width: 1, // | ||||
|         color: color //                  <--- border width here | ||||
|         ), | ||||
|     borderRadius: BorderRadius.circular(radius), | ||||
|   ); | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| //Decoration appGradient = BoxDecoration( | ||||
| //  gradient: LinearGradient( | ||||
| //    colors: [ | ||||
| //      Colors.green[200], | ||||
| //      Colors.green, | ||||
| //    ], | ||||
| //    begin: Alignment.topCenter, | ||||
| //    end: Alignment.bottomCenter, | ||||
| //  ), | ||||
| //); | ||||
| // launchURL(String url) async { | ||||
| //   if (await canLaunch(url)) { | ||||
| //     await launch(url); | ||||
| //   } else { | ||||
| //     throw 'Could not launch $url'; | ||||
| //   } | ||||
| // } | ||||
| @ -1,28 +0,0 @@ | ||||
| import 'package:mohem_flutter_app/theme/colors.dart'; | ||||
| import 'package:mohem_flutter_app/widgets/txt.dart'; | ||||
| import 'package:flutter/material.dart'; | ||||
| import 'package:sizer/sizer.dart'; | ||||
| 
 | ||||
| AppBar appBar({ | ||||
|   Color? backgroundColor, | ||||
|   double? elevation, | ||||
|   String? title, | ||||
|   Color? titleColor, | ||||
|   bool? isTitleCenter, | ||||
|   Color? backIconColor, | ||||
|   List<Widget>? actions, | ||||
| }) { | ||||
|   return AppBar( | ||||
|     backgroundColor: backgroundColor ?? appBackgroundColor, | ||||
|     elevation: elevation ?? 0, | ||||
|     centerTitle: isTitleCenter ?? true, | ||||
|     iconTheme: IconThemeData( | ||||
|       color: backIconColor ?? Colors.black, //change your color here | ||||
|     ), | ||||
|     actions: actions, | ||||
|     title: Txt( | ||||
|       title ?? "", | ||||
|       txtType: TxtType.appBar, | ||||
|     ), | ||||
|   ); | ||||
| } | ||||
| @ -1,62 +0,0 @@ | ||||
| import 'dart:ui'; | ||||
| 
 | ||||
| import 'package:flutter/material.dart'; | ||||
| 
 | ||||
| const kDemoText = Center( | ||||
|   child: Text( | ||||
|     '', | ||||
|     style: TextStyle( | ||||
|       fontSize: 25, | ||||
|       color: Colors.white, | ||||
|       letterSpacing: 2, | ||||
|     ), | ||||
|     textAlign: TextAlign.center, | ||||
|   ), | ||||
| ); | ||||
| const double kBlur = 1.0; | ||||
| const EdgeInsetsGeometry kDefaultPadding = EdgeInsets.all(16); | ||||
| const Color kDefaultColor = Colors.transparent; | ||||
| const BorderRadius kBorderRadius = BorderRadius.all(Radius.circular(20)); | ||||
| const double kColorOpacity = 0.0; | ||||
| 
 | ||||
| class BlurryContainer extends StatelessWidget { | ||||
|   final Widget child; | ||||
|   final double blur; | ||||
|   final double? height, width; | ||||
|   final EdgeInsetsGeometry padding; | ||||
|   final Color bgColor; | ||||
| 
 | ||||
|   final BorderRadius borderRadius; | ||||
| 
 | ||||
|   //final double colorOpacity; | ||||
| 
 | ||||
|   BlurryContainer({ | ||||
|     this.child = kDemoText, | ||||
|     this.blur = 5, | ||||
|     required this.height, | ||||
|     required this.width, | ||||
|     this.padding = kDefaultPadding, | ||||
|     this.bgColor = kDefaultColor, | ||||
|     this.borderRadius = kBorderRadius, | ||||
|     //this.colorOpacity = kColorOpacity, | ||||
|   }); | ||||
| 
 | ||||
|   @override | ||||
|   Widget build(BuildContext context) { | ||||
|     return ClipRRect( | ||||
|       borderRadius: borderRadius, | ||||
|       child: BackdropFilter( | ||||
|         filter: ImageFilter.blur(sigmaX: blur, sigmaY: blur), | ||||
|         child: Container( | ||||
|           height: height!, | ||||
|           width: width!, | ||||
|           padding: padding, | ||||
|           color: bgColor == Colors.transparent | ||||
|               ? bgColor | ||||
|               : bgColor.withOpacity(0.5), | ||||
|           child: child, | ||||
|         ), | ||||
|       ), | ||||
|     ); | ||||
|   } | ||||
| } | ||||
| @ -1,23 +0,0 @@ | ||||
| import 'package:mohem_flutter_app/utils/utils.dart'; | ||||
| import 'package:flutter/material.dart'; | ||||
| 
 | ||||
| class ShowCircularButton extends StatelessWidget { | ||||
|   VoidCallback onPressed; | ||||
|   IconData? iconData; | ||||
|   ShowCircularButton({this.iconData,required this.onPressed}); | ||||
|   @override | ||||
|   Widget build(BuildContext context) { | ||||
|     return Card( | ||||
|       shape: cardRadius(1000), | ||||
|       color: Colors.black.withOpacity(0.2), | ||||
|       margin: EdgeInsets.all(12), | ||||
|       child: IconButton( | ||||
|         onPressed: onPressed, | ||||
|         icon: Icon( | ||||
|           iconData?? Icons.amp_stories_outlined, | ||||
|           color: Colors.white, | ||||
|         ), | ||||
|       ), | ||||
|     ); | ||||
|   } | ||||
| } | ||||
| @ -1,43 +0,0 @@ | ||||
| import 'package:mohem_flutter_app/theme/colors.dart'; | ||||
| import 'package:mohem_flutter_app/utils/utils.dart'; | ||||
| import 'package:flutter/material.dart'; | ||||
| 
 | ||||
| import '../txt.dart'; | ||||
| 
 | ||||
| class ShowImageButton extends StatelessWidget { | ||||
|   String icon, title; | ||||
|   VoidCallback onClick; | ||||
| 
 | ||||
|   ShowImageButton( | ||||
|       {required this.icon, required this.title, required this.onClick}); | ||||
| 
 | ||||
|   @override | ||||
|   Widget build(BuildContext context) { | ||||
|     return InkWell( | ||||
|       onTap: onClick, | ||||
|       child: Container( | ||||
|         width: double.infinity, | ||||
|         child: Column( | ||||
|           children: [ | ||||
|             Container( | ||||
|               width: double.infinity, | ||||
|               height: 120, | ||||
|               color: accentColor, | ||||
|               padding: EdgeInsets.all(30), | ||||
|               child: Image.asset( | ||||
|                 icon, | ||||
|                 color: Colors.white, | ||||
|               ), | ||||
|             ), | ||||
|             mHeight(12), | ||||
|             Txt( | ||||
|               title, | ||||
|               txtType: TxtType.heading2, | ||||
|               color: Colors.blue, | ||||
|             ) | ||||
|           ], | ||||
|         ), | ||||
|       ), | ||||
|     ); | ||||
|   } | ||||
| } | ||||
| @ -1,16 +0,0 @@ | ||||
| import 'package:flutter/material.dart'; | ||||
| 
 | ||||
| void showMDialog( | ||||
|   context, { | ||||
|   Widget? child, | ||||
| }) async { | ||||
|   return showDialog( | ||||
|     context: context, | ||||
|     barrierDismissible: true, | ||||
|     builder: (context) { | ||||
|       return Dialog( | ||||
|         child: child, | ||||
|       ); | ||||
|     }, | ||||
|   ); | ||||
| } | ||||
| @ -1,38 +0,0 @@ | ||||
| import 'package:mohem_flutter_app/theme/colors.dart'; | ||||
| import 'package:mohem_flutter_app/utils/navigator.dart'; | ||||
| import 'package:mohem_flutter_app/utils/utils.dart'; | ||||
| import 'package:mohem_flutter_app/widgets/show_fill_button.dart'; | ||||
| import 'package:mohem_flutter_app/widgets/txt.dart'; | ||||
| import 'package:flutter/material.dart'; | ||||
| 
 | ||||
| class MessageDialog extends StatelessWidget { | ||||
|   String? title, buttonTitle; | ||||
|   VoidCallback? onClick; | ||||
|   MessageDialog({this.title, this.buttonTitle,this.onClick}); | ||||
| 
 | ||||
|   @override | ||||
|   Widget build(BuildContext context) { | ||||
|     return Container( | ||||
|       color: Colors.white, | ||||
|       padding: EdgeInsets.all(30), | ||||
|       child: Column( | ||||
|         mainAxisSize: MainAxisSize.min, | ||||
|         crossAxisAlignment: CrossAxisAlignment.start, | ||||
|         children: [ | ||||
|           Txt( | ||||
|             title ?? "message", | ||||
|             txtType: TxtType.heading3, | ||||
|           ), | ||||
|           mHeight(40), | ||||
|           ShowFillButton( | ||||
|             title: buttonTitle ?? "Continue", | ||||
|             width: double.infinity, | ||||
|             onPressed: () { | ||||
|               onClick!(); | ||||
|             }, | ||||
|           ) | ||||
|         ], | ||||
|       ), | ||||
|     ); | ||||
|   } | ||||
| } | ||||
| @ -1,74 +0,0 @@ | ||||
| import 'package:mohem_flutter_app/theme/colors.dart'; | ||||
| import 'package:mohem_flutter_app/utils/navigator.dart'; | ||||
| import 'package:mohem_flutter_app/utils/utils.dart'; | ||||
| import 'package:mohem_flutter_app/widgets/show_fill_button.dart'; | ||||
| import 'package:mohem_flutter_app/widgets/txt.dart'; | ||||
| import 'package:flutter/material.dart'; | ||||
| 
 | ||||
| class OtpDialog extends StatelessWidget { | ||||
|   VoidCallback onClick; | ||||
| 
 | ||||
|   OtpDialog({required this.onClick}); | ||||
| 
 | ||||
|   @override | ||||
|   Widget build(BuildContext context) { | ||||
|     return Container( | ||||
|       color: Colors.white, | ||||
|       padding: EdgeInsets.all(30), | ||||
|       child: Column( | ||||
|         mainAxisSize: MainAxisSize.min, | ||||
|         crossAxisAlignment: CrossAxisAlignment.start, | ||||
|         children: [ | ||||
|           Txt( | ||||
|             "Please insert OTP Code", | ||||
|             txtType: TxtType.heading3, | ||||
|           ), | ||||
|           mHeight(20), | ||||
|           Row( | ||||
|             children: [ | ||||
|               Expanded( | ||||
|                 child: Container( | ||||
|                   width: double.infinity, | ||||
|                   height: 60, | ||||
|                   color: accentColor.withOpacity(0.3), | ||||
|                 ), | ||||
|               ), | ||||
|               mWidth(12), | ||||
|               Expanded( | ||||
|                 child: Container( | ||||
|                   width: double.infinity, | ||||
|                   height: 60, | ||||
|                   color: accentColor.withOpacity(0.3), | ||||
|                 ), | ||||
|               ), | ||||
|               mWidth(12), | ||||
|               Expanded( | ||||
|                 child: Container( | ||||
|                   width: double.infinity, | ||||
|                   height: 60, | ||||
|                   color: accentColor.withOpacity(0.3), | ||||
|                 ), | ||||
|               ), | ||||
|               mWidth(12), | ||||
|               Expanded( | ||||
|                 child: Container( | ||||
|                   width: double.infinity, | ||||
|                   height: 60, | ||||
|                   color: accentColor.withOpacity(0.3), | ||||
|                 ), | ||||
|               ), | ||||
|             ], | ||||
|           ), | ||||
|           mHeight(40), | ||||
|           ShowFillButton( | ||||
|             title: "Check Code", | ||||
|             width: double.infinity, | ||||
|             onPressed: () { | ||||
|               onClick(); | ||||
|             }, | ||||
|           ) | ||||
|         ], | ||||
|       ), | ||||
|     ); | ||||
|   } | ||||
| } | ||||
| @ -1,26 +0,0 @@ | ||||
| import 'package:flutter/cupertino.dart'; | ||||
| import 'package:flutter/material.dart'; | ||||
| 
 | ||||
| showDraggableDialog(BuildContext context, Widget child) { | ||||
|   showGeneralDialog( | ||||
|     barrierLabel: "Label", | ||||
|     barrierDismissible: false, | ||||
|     barrierColor: Colors.black.withOpacity(0.2), | ||||
|     transitionDuration: Duration(milliseconds: 200), | ||||
|     context: context, | ||||
|     pageBuilder: (context, anim1, anim2) { | ||||
|       return Dismissible( | ||||
|         direction: DismissDirection.vertical, | ||||
|         key: const Key('key'), | ||||
|         onDismissed: (_) => Navigator.of(context).pop(), | ||||
|         child: child, | ||||
|       ); | ||||
|     }, | ||||
|     transitionBuilder: (context, anim1, anim2, child) { | ||||
|       return SlideTransition( | ||||
|         position: Tween(begin: Offset(0, 1), end: Offset(0, 0)).animate(anim1), | ||||
|         child: child, | ||||
|       ); | ||||
|     }, | ||||
|   ); | ||||
| } | ||||
| @ -1,78 +0,0 @@ | ||||
| import 'package:mohem_flutter_app/theme/colors.dart'; | ||||
| import 'package:mohem_flutter_app/utils/utils.dart'; | ||||
| import 'package:flutter/material.dart'; | ||||
| import 'package:mohem_flutter_app/theme/colors.dart'; | ||||
| import 'package:mohem_flutter_app/utils/utils.dart'; | ||||
| 
 | ||||
| import '../txt.dart'; | ||||
| 
 | ||||
| class DropdownField extends StatefulWidget { | ||||
|   String? hint; | ||||
|   List<String>? list; | ||||
| 
 | ||||
|   DropdownField({this.hint, this.list}); | ||||
| 
 | ||||
|   @override | ||||
|   State<DropdownField> createState() => _DropdownFieldState(); | ||||
| } | ||||
| 
 | ||||
| class _DropdownFieldState extends State<DropdownField> { | ||||
|   String? dropdownValue; | ||||
| 
 | ||||
|   @override | ||||
|   Widget build(BuildContext context) { | ||||
|     return Container( | ||||
|       decoration: containerColorRadiusBorderWidth( | ||||
|         Colors.transparent, | ||||
|         4, | ||||
|         borderColor, | ||||
|         0.5, | ||||
|       ), | ||||
|       margin: EdgeInsets.all(2), | ||||
|       padding: EdgeInsets.only(left: 8, right: 8), | ||||
|       child: DropdownButton<String>( | ||||
|         value: dropdownValue, | ||||
|         icon: const Icon(Icons.keyboard_arrow_down_sharp), | ||||
|         elevation: 16, | ||||
|         iconSize: 16, | ||||
|         iconEnabledColor: borderColor, | ||||
|         iconDisabledColor: borderColor, | ||||
|         isExpanded: true, | ||||
|         style: const TextStyle(color: Colors.black), | ||||
|         hint: Txt( | ||||
|           widget.hint ?? "", | ||||
|           txtType: TxtType.heading1, | ||||
|           bold: false, | ||||
|           color: borderColor, | ||||
|         ), | ||||
|         underline: Container( | ||||
|           height: 0, | ||||
|         ), | ||||
|         onChanged: (String? newValue) { | ||||
|           setState(() { | ||||
|             dropdownValue = newValue!; | ||||
|           }); | ||||
|         }, | ||||
|         items: (widget.list ?? | ||||
|                 <String>[ | ||||
|                   'One', | ||||
|                   'Two', | ||||
|                   'Free', | ||||
|                   'Four', | ||||
|                 ]) | ||||
|             .map<DropdownMenuItem<String>>( | ||||
|           (String value) { | ||||
|             return DropdownMenuItem<String>( | ||||
|               value: value, | ||||
|               child: Txt( | ||||
|                 value, | ||||
|                 txtType: TxtType.heading1, | ||||
|                 bold: false, | ||||
|               ), | ||||
|             ); | ||||
|           }, | ||||
|         ).toList(), | ||||
|       ), | ||||
|     ); | ||||
|   } | ||||
| } | ||||
| @ -1,33 +0,0 @@ | ||||
| import 'package:flutter/material.dart'; | ||||
| import 'package:flutter_svg/flutter_svg.dart'; | ||||
| import 'package:mohem_flutter_app/config/constants.dart'; | ||||
| import 'package:mohem_flutter_app/theme/colors.dart'; | ||||
| import 'package:mohem_flutter_app/utils/utils.dart'; | ||||
| import 'package:mohem_flutter_app/widgets/txt.dart'; | ||||
| 
 | ||||
| class DropDownText extends StatelessWidget { | ||||
|   String title; | ||||
| 
 | ||||
|   DropDownText(this.title); | ||||
| 
 | ||||
|   @override | ||||
|   Widget build(BuildContext context) { | ||||
|     return Row( | ||||
|       crossAxisAlignment: CrossAxisAlignment.center, | ||||
|       mainAxisAlignment: MainAxisAlignment.center, | ||||
|       children: [ | ||||
|         Txt( | ||||
|           title, | ||||
|           txtType: TxtType.heading3, | ||||
|           color: accentColor, | ||||
|         ), | ||||
|         mWidth(16), | ||||
|         SvgPicture.asset( | ||||
|           svgIcons + "ic_arrow_down.svg", | ||||
|           width: 10, | ||||
|           height: 10, | ||||
|         ), | ||||
|       ], | ||||
|     ); | ||||
|   } | ||||
| } | ||||
| @ -1,235 +0,0 @@ | ||||
| import 'dart:math'; | ||||
| 
 | ||||
| import 'package:flutter/material.dart'; | ||||
| 
 | ||||
| extension ExtendedText on Widget { | ||||
|   showOverlay({double? width, double? height}){ | ||||
|     return Container( | ||||
|       width: width ?? double.infinity, | ||||
|       height: height ?? 60, | ||||
|       decoration: BoxDecoration( | ||||
|         gradient: LinearGradient(colors: [ | ||||
|           Colors.black.withOpacity(0.2), | ||||
|           Colors.black.withOpacity(0.1), | ||||
|           Colors.black.withOpacity(0.004), | ||||
|         ], begin: Alignment.topCenter, end: Alignment.bottomCenter, tileMode: TileMode.clamp), | ||||
|       ), | ||||
|       child: this, | ||||
|     ); | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| extension ImageExt on Image { | ||||
|   Widget circular() { | ||||
|     return ClipRRect( | ||||
|       clipBehavior: Clip.hardEdge, | ||||
|       borderRadius: BorderRadius.circular(100), | ||||
|       child: this, | ||||
|     ); | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| extension WidgetExt on Widget { | ||||
|   Widget toWidget() { | ||||
|     return this as Widget; | ||||
|   } | ||||
| 
 | ||||
|   Widget sized({double? width, double? height}) { | ||||
|     return SizedBox( | ||||
|       width: width, | ||||
|       height: height, | ||||
|       child: this, | ||||
|     ); | ||||
|   } | ||||
|   Widget inkWell({required VoidCallback onTap,double radius=0}){ | ||||
|     return InkWell( | ||||
|       child: Material(child: this,color: Colors.transparent,), | ||||
|       onTap: onTap, | ||||
|     ); | ||||
|   } | ||||
|   Widget sizeSq(double size) { | ||||
|     return SizedBox( | ||||
|       width: size, | ||||
|       height: size, | ||||
|       child: this, | ||||
|     ); | ||||
|   } | ||||
| 
 | ||||
|   Widget fillParent({double hFactor = 1, double? vFactor}) { | ||||
|     return FractionallySizedBox( | ||||
|       heightFactor: null, | ||||
|       widthFactor: hFactor, | ||||
|       child: this, | ||||
|     ); | ||||
|   } | ||||
| 
 | ||||
|   Widget margin( | ||||
|       {double top = 0, double bottom = 0, double left = 0, double right = 0}) { | ||||
|     var pad = | ||||
|     EdgeInsets.only(top: top, left: left, bottom: bottom, right: right); | ||||
|     try { | ||||
|       (this as dynamic).margin = pad; | ||||
|     } catch (err) { | ||||
|       return Padding( | ||||
|         padding: pad, | ||||
|         child: this, | ||||
|       ); | ||||
|     } | ||||
|     return this; | ||||
|   } | ||||
| 
 | ||||
|   Widget toClip({double r = 40}) { | ||||
|     return ClipRRect( | ||||
|       borderRadius: BorderRadius.all( | ||||
|         Radius.circular(r), | ||||
|       ), | ||||
|       clipBehavior: Clip.antiAlias, | ||||
|       child: this, | ||||
|     ); | ||||
|   } | ||||
| 
 | ||||
|   // Widget scrollable({Axis? direction, bool fadingEdge = true}) { | ||||
|   //   var scrollview = SingleChildScrollView( | ||||
|   //     child: this, | ||||
|   //     controller: ScrollController(), | ||||
|   //     scrollDirection: direction ?? Axis.vertical, | ||||
|   //   ); | ||||
|   //   return fadingEdge ? scrollview.fadingEdge() : scrollview; | ||||
|   // } | ||||
| 
 | ||||
|   Widget expand() { | ||||
|     return Expanded( | ||||
|       child: this, | ||||
|     ); | ||||
|   } | ||||
| 
 | ||||
|   Widget align(Alignment alignment) { | ||||
|     return Align( | ||||
|       alignment: alignment, | ||||
|       child: this, | ||||
|     ); | ||||
|   } | ||||
| 
 | ||||
|   Widget center() { | ||||
|     return Center( | ||||
|       child: this, | ||||
|     ); | ||||
|   } | ||||
| 
 | ||||
|   Widget padding(EdgeInsets padding) { | ||||
|     return Padding( | ||||
|       padding: padding, | ||||
|       child: this, | ||||
|     ); | ||||
|   } | ||||
| 
 | ||||
|   Widget paddingAll(double padding) { | ||||
|     return Padding( | ||||
|       padding: EdgeInsets.all(padding), | ||||
|       child: this, | ||||
|     ); | ||||
|   } | ||||
| 
 | ||||
|   // Widget onTap(VoidCallback onTap, {double corners = 0}) { | ||||
|   //   return Clickable.widget(child: this, corners: corners, onTap: onTap); | ||||
|   // } | ||||
| 
 | ||||
|   Widget ignoreInteraction() { | ||||
|     return IgnorePointer( | ||||
|       child: this, | ||||
|     ); | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| // extension xScrollView on ScrollView { | ||||
| //   Widget fadingEdge() => FadingEdgeScrollView.fromScrollView( | ||||
| //     child: this, | ||||
| //     gradientFractionOnEnd: 0.08, | ||||
| //     gradientFractionOnStart: 0.08, | ||||
| //     shouldDisposeScrollController: true, | ||||
| //   ); | ||||
| // } | ||||
| // | ||||
| // extension x2ScrollView on SingleChildScrollView { | ||||
| //   Widget fadingEdge() => FadingEdgeScrollView.fromSingleChildScrollView( | ||||
| //     child: this, | ||||
| //     gradientFractionOnEnd: 0.08, | ||||
| //     gradientFractionOnStart: 0.08, | ||||
| //     shouldDisposeScrollController: true, | ||||
| //   ); | ||||
| // } | ||||
| 
 | ||||
| class Position { | ||||
|   final double x, y, w, h; | ||||
| 
 | ||||
|   Position(this.x, this.y, this.w, this.h); | ||||
| } | ||||
| 
 | ||||
| extension KeyExt on GlobalKey { | ||||
|   Position globalPosition() { | ||||
|     RenderBox box = currentContext!.findRenderObject() as RenderBox; | ||||
|     Offset xy = box.localToGlobal(Offset.zero); | ||||
|     Size wh = box.size; | ||||
|     return Position(xy.dx, xy.dy, wh.width, wh.height); | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| extension StateExt on State { | ||||
|   reload({VoidCallback? b}) { | ||||
|     setState(b ?? () {}); | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| // extension LocatiionExt on Location { | ||||
| //   LatLng toLatLng() { | ||||
| //     return LatLng(lat!, lng!); | ||||
| //   } | ||||
| // } | ||||
| 
 | ||||
| // extension xList<T> on List<T> { | ||||
| //   T randomItem() { | ||||
| //     final random = new Random(); | ||||
| //     var i = random.nextInt(this.length); | ||||
| //     return this[i]; | ||||
| //   } | ||||
| // | ||||
| //   List<T> append(List<T> items) { | ||||
| //     this.addAll(items); | ||||
| //     return this; | ||||
| //   } | ||||
| // | ||||
| //   bool isFirst(T item) => first == item; | ||||
| // | ||||
| //   bool isLast(T item) => last == item; | ||||
| // | ||||
| //   getOneByOne( | ||||
| //       {required int delayMillis, | ||||
| //       required Function(T) callback, VoidCallback? complete}) async { | ||||
| //     for (var i in this) { | ||||
| //       await delay(delayMillis); | ||||
| //       callback(i); | ||||
| //     } | ||||
| //     complete!(); | ||||
| //   } | ||||
| // } | ||||
| 
 | ||||
| extension xFuture<T> on Future<T?> { | ||||
|   thenWithDelay(int millis, Function(T) thenBlock) { | ||||
|     then((value) { | ||||
|       Future.delayed(Duration(milliseconds: millis)) | ||||
|           .then((value) => thenBlock(value)); | ||||
|     }); | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| extension xDouble on int { | ||||
|   Duration durationMillis() => Duration(milliseconds: this); | ||||
| 
 | ||||
|   Duration durationSec() => Duration(seconds: this); | ||||
| 
 | ||||
|   Duration durationHour() => Duration(hours: this); | ||||
| } | ||||
| @ -1,63 +0,0 @@ | ||||
| import 'package:flutter/material.dart'; | ||||
| 
 | ||||
| class GradientAppBar extends StatelessWidget { | ||||
|   final String title; | ||||
|   final double barHeight = 50.0; | ||||
|   IconData? iconData; | ||||
| 
 | ||||
|   GradientAppBar(this.title, {this.iconData}); | ||||
| 
 | ||||
|   @override | ||||
|   Widget build(BuildContext context) { | ||||
|     final double statusbarHeight = MediaQuery.of(context).padding.top; | ||||
| 
 | ||||
|     return new Container( | ||||
|       padding: EdgeInsets.only(top: statusbarHeight), | ||||
|       height: statusbarHeight + barHeight, | ||||
|       child: Row( | ||||
|         children: [ | ||||
|           IconButton( | ||||
|             onPressed: () { | ||||
|               Navigator.pop(context); | ||||
|             }, | ||||
|             icon: Icon( | ||||
|               Icons.arrow_back_ios, | ||||
|               color: Colors.white, | ||||
|             ), | ||||
|           ), | ||||
|           Expanded( | ||||
|             child: Center( | ||||
|               child: Text( | ||||
|                 title, | ||||
|                 style: TextStyle( | ||||
|                     fontSize: 20.0, | ||||
|                     color: Colors.white, | ||||
|                     fontWeight: FontWeight.bold), | ||||
|               ), | ||||
|             ), | ||||
|           ), | ||||
|           if (iconData != null) | ||||
|             IconButton( | ||||
|               onPressed: () {}, | ||||
|               icon: Icon( | ||||
|                 iconData, | ||||
|                 color: Colors.white, | ||||
|               ), | ||||
|             ), | ||||
|         ], | ||||
|       ), | ||||
|       decoration: BoxDecoration( | ||||
|         gradient: LinearGradient( | ||||
|           colors: [ | ||||
|             Colors.black.withOpacity(0.4), | ||||
|             Colors.black.withOpacity(0.2), | ||||
|             Colors.black.withOpacity(0.0001), | ||||
|           ], | ||||
|           begin: Alignment.topCenter, | ||||
|           end: Alignment.bottomCenter, | ||||
|           tileMode: TileMode.clamp, | ||||
|         ), | ||||
|       ), | ||||
|     ); | ||||
|   } | ||||
| } | ||||
| @ -1,30 +0,0 @@ | ||||
| import 'package:mohem_flutter_app/config/constants.dart'; | ||||
| import 'package:mohem_flutter_app/utils/utils.dart'; | ||||
| import 'package:flutter/material.dart'; | ||||
| 
 | ||||
| class CircularImage extends StatelessWidget { | ||||
|   double? w, h, padding; | ||||
|   String? image; | ||||
| 
 | ||||
|   CircularImage({this.w, this.h, this.image, this.padding}); | ||||
| 
 | ||||
|   @override | ||||
|   Widget build(BuildContext context) { | ||||
|     return Container( | ||||
|       width: w ?? 120, | ||||
|       height: h ?? 120, | ||||
|       child: Card( | ||||
|         shape: cardRadius(2000), | ||||
|         clipBehavior: Clip.antiAlias, | ||||
|         elevation: 4, | ||||
|         child: Card( | ||||
|           shape: cardRadius(2000), | ||||
|           clipBehavior: Clip.antiAlias, | ||||
|           elevation: 0, | ||||
|           margin: EdgeInsets.all(padding ?? 0), | ||||
|           child: Image.asset(image ?? icons + "green.jpg"), | ||||
|         ), | ||||
|       ), | ||||
|     ); | ||||
|   } | ||||
| } | ||||
| @ -1,5 +1,5 @@ | ||||
| import 'package:flutter/material.dart'; | ||||
| import 'package:mohem_flutter_app/sikander_later_will_remove_to_parent_directory/classes/colors.dart'; | ||||
| import 'package:mohem_flutter_app/classes/colors.dart'; | ||||
| 
 | ||||
| class InputWidget extends StatelessWidget { | ||||
|   final String labelText; | ||||
| @ -0,0 +1,373 @@ | ||||
| import 'dart:async'; | ||||
| 
 | ||||
| import 'package:flutter/animation.dart'; | ||||
| import 'package:flutter/foundation.dart'; | ||||
| import 'package:flutter/material.dart'; | ||||
| import 'package:flutter/rendering.dart'; | ||||
| import 'package:flutter/services.dart'; | ||||
| 
 | ||||
| typedef OnDone = void Function(String text); | ||||
| 
 | ||||
| class ProvidedPinBoxTextAnimation { | ||||
|   static AnimatedSwitcherTransitionBuilder scalingTransition = (child, animation) { | ||||
|     return ScaleTransition( | ||||
|       child: child, | ||||
|       scale: animation, | ||||
|     ); | ||||
|   }; | ||||
| 
 | ||||
|   static AnimatedSwitcherTransitionBuilder defaultNoTransition = (Widget child, Animation<double> animation) { | ||||
|     return child; | ||||
|   }; | ||||
| } | ||||
| 
 | ||||
| class OTPWidget extends StatefulWidget { | ||||
|   final int maxLength; | ||||
|   final TextEditingController? controller; | ||||
| 
 | ||||
|   final Color defaultBorderColor; | ||||
|   final Color pinBoxColor; | ||||
|   final double pinBoxBorderWidth; | ||||
|   final double pinBoxRadius; | ||||
|   final bool hideDefaultKeyboard; | ||||
| 
 | ||||
|   final TextStyle? pinTextStyle; | ||||
|   final double pinBoxHeight; | ||||
|   final double pinBoxWidth; | ||||
|   final OnDone? onDone; | ||||
|   final bool hasError; | ||||
|   final Color errorBorderColor; | ||||
|   final Color textBorderColor; | ||||
|   final Function(String)? onTextChanged; | ||||
|   final bool autoFocus; | ||||
|   final FocusNode? focusNode; | ||||
|   final AnimatedSwitcherTransitionBuilder? pinTextAnimatedSwitcherTransition; | ||||
|   final Duration pinTextAnimatedSwitcherDuration; | ||||
|   final TextDirection textDirection; | ||||
|   final TextInputType keyboardType; | ||||
|   final EdgeInsets pinBoxOuterPadding; | ||||
| 
 | ||||
|   const OTPWidget({ | ||||
|     Key? key, | ||||
|     this.maxLength: 4, | ||||
|     this.controller, | ||||
|     this.pinBoxWidth: 70.0, | ||||
|     this.pinBoxHeight: 70.0, | ||||
|     this.pinTextStyle, | ||||
|     this.onDone, | ||||
|     this.defaultBorderColor: Colors.black, | ||||
|     this.textBorderColor: Colors.black, | ||||
|     this.pinTextAnimatedSwitcherTransition, | ||||
|     this.pinTextAnimatedSwitcherDuration: const Duration(), | ||||
|     this.hasError: false, | ||||
|     this.errorBorderColor: Colors.red, | ||||
|     this.onTextChanged, | ||||
|     this.autoFocus: false, | ||||
|     this.focusNode, | ||||
|     this.textDirection: TextDirection.ltr, | ||||
|     this.keyboardType: TextInputType.number, | ||||
|     this.pinBoxOuterPadding = const EdgeInsets.symmetric(horizontal: 4.0), | ||||
|     this.pinBoxColor = Colors.white, | ||||
|     this.pinBoxBorderWidth = 2.0, | ||||
|     this.pinBoxRadius = 0, | ||||
|     this.hideDefaultKeyboard = false, | ||||
|   }) : super(key: key); | ||||
| 
 | ||||
|   @override | ||||
|   State<StatefulWidget> createState() { | ||||
|     return OTPWidgetState(); | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| class OTPWidgetState extends State<OTPWidget> with SingleTickerProviderStateMixin { | ||||
|   AnimationController? _highlightAnimationController; | ||||
|   FocusNode? focusNode; | ||||
|   String text = ""; | ||||
|   int currentIndex = 0; | ||||
|   List<String> strList = []; | ||||
|   bool hasFocus = false; | ||||
| 
 | ||||
|   @override | ||||
|   void didUpdateWidget(OTPWidget oldWidget) { | ||||
|     super.didUpdateWidget(oldWidget); | ||||
|     focusNode = widget.focusNode ?? focusNode; | ||||
| 
 | ||||
|     if (oldWidget.maxLength < widget.maxLength) { | ||||
|       setState(() { | ||||
|         currentIndex = text.length; | ||||
|       }); | ||||
|       widget.controller?.text = text; | ||||
|       widget.controller?.selection = TextSelection.collapsed(offset: text.length); | ||||
|     } else if (oldWidget.maxLength > widget.maxLength && widget.maxLength > 0 && text.length > 0 && text.length > widget.maxLength) { | ||||
|       setState(() { | ||||
|         text = text.substring(0, widget.maxLength); | ||||
|         currentIndex = text.length; | ||||
|       }); | ||||
|       widget.controller?.text = text; | ||||
|       widget.controller?.selection = TextSelection.collapsed(offset: text.length); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   _calculateStrList() { | ||||
|     if (strList.length > widget.maxLength) { | ||||
|       strList.length = widget.maxLength; | ||||
|     } | ||||
|     while (strList.length < widget.maxLength) { | ||||
|       strList.add(""); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   @override | ||||
|   void initState() { | ||||
|     super.initState(); | ||||
|     focusNode = widget.focusNode ?? FocusNode(); | ||||
| 
 | ||||
|     _initTextController(); | ||||
|     _calculateStrList(); | ||||
|     widget.controller?.addListener(_controllerListener); | ||||
|     focusNode?.addListener(_focusListener); | ||||
|   } | ||||
| 
 | ||||
|   void _controllerListener() { | ||||
|     if (mounted == true) { | ||||
|       setState(() { | ||||
|         _initTextController(); | ||||
|       }); | ||||
|       var onTextChanged = widget.onTextChanged; | ||||
|       if (onTextChanged != null) { | ||||
|         onTextChanged(widget.controller?.text ?? ""); | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   void _focusListener() { | ||||
|     if (mounted == true) { | ||||
|       setState(() { | ||||
|         hasFocus = focusNode?.hasFocus ?? false; | ||||
|       }); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   void _initTextController() { | ||||
|     if (widget.controller == null) { | ||||
|       return; | ||||
|     } | ||||
|     strList.clear(); | ||||
|     var text = widget.controller?.text ?? ""; | ||||
|     if (text.isNotEmpty) { | ||||
|       if (text.length > widget.maxLength) { | ||||
|         throw Exception("TextEditingController length exceeded maxLength!"); | ||||
|       } | ||||
|     } | ||||
|     for (var i = 0; i < text.length; i++) { | ||||
|       strList.add(text[i]); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   double get _width { | ||||
|     var width = 0.0; | ||||
|     for (var i = 0; i < widget.maxLength; i++) { | ||||
|       width += widget.pinBoxWidth; | ||||
|       if (i == 0) { | ||||
|         width += widget.pinBoxOuterPadding.left; | ||||
|       } else if (i + 1 == widget.maxLength) { | ||||
|         width += widget.pinBoxOuterPadding.right; | ||||
|       } else { | ||||
|         width += widget.pinBoxOuterPadding.left; | ||||
|       } | ||||
|     } | ||||
|     return width; | ||||
|   } | ||||
| 
 | ||||
|   @override | ||||
|   void dispose() { | ||||
|     if (widget.focusNode == null) { | ||||
|       focusNode?.dispose(); | ||||
|     } else { | ||||
|       focusNode?.removeListener(_focusListener); | ||||
|     } | ||||
|     _highlightAnimationController?.dispose(); | ||||
|     widget.controller?.removeListener(_controllerListener); | ||||
| 
 | ||||
|     super.dispose(); | ||||
|   } | ||||
| 
 | ||||
|   @override | ||||
|   Widget build(BuildContext context) { | ||||
|     return Stack( | ||||
|       children: <Widget>[ | ||||
|         _otpTextInput(), | ||||
|         _touchPinBoxRow(), | ||||
|       ], | ||||
|     ); | ||||
|   } | ||||
| 
 | ||||
|   Widget _touchPinBoxRow() { | ||||
|     return widget.hideDefaultKeyboard | ||||
|         ? _pinBoxRow(context) | ||||
|         : GestureDetector( | ||||
|             behavior: HitTestBehavior.opaque, | ||||
|             onTap: () { | ||||
|               if (hasFocus) { | ||||
|                 FocusScope.of(context).requestFocus(FocusNode()); | ||||
|                 Future.delayed(Duration(milliseconds: 100), () { | ||||
|                   FocusScope.of(context).requestFocus(focusNode); | ||||
|                 }); | ||||
|               } else { | ||||
|                 FocusScope.of(context).requestFocus(focusNode); | ||||
|               } | ||||
|             }, | ||||
|             child: _pinBoxRow(context), | ||||
|           ); | ||||
|   } | ||||
| 
 | ||||
|   Widget _otpTextInput() { | ||||
|     var transparentBorder = OutlineInputBorder( | ||||
|       borderSide: BorderSide( | ||||
|         color: Colors.transparent, | ||||
|         width: 0.0, | ||||
|       ), | ||||
|     ); | ||||
|     return Container( | ||||
|       width: _width, | ||||
|       height: widget.pinBoxHeight, | ||||
|       child: TextField( | ||||
|         autofocus: !kIsWeb ? widget.autoFocus : false, | ||||
|         enableInteractiveSelection: false, | ||||
|         focusNode: focusNode, | ||||
|         controller: widget.controller, | ||||
|         keyboardType: widget.keyboardType, | ||||
|         inputFormatters: widget.keyboardType == TextInputType.number ? <TextInputFormatter>[FilteringTextInputFormatter.digitsOnly] : null, | ||||
|         style: TextStyle( | ||||
|           height: 0.1, | ||||
|           color: Colors.transparent, | ||||
|         ), | ||||
|         decoration: InputDecoration( | ||||
|           contentPadding: EdgeInsets.all(0), | ||||
|           focusedErrorBorder: transparentBorder, | ||||
|           errorBorder: transparentBorder, | ||||
|           disabledBorder: transparentBorder, | ||||
|           enabledBorder: transparentBorder, | ||||
|           focusedBorder: transparentBorder, | ||||
|           counterText: null, | ||||
|           counterStyle: null, | ||||
|           helperStyle: TextStyle( | ||||
|             height: 0.0, | ||||
|             color: Colors.transparent, | ||||
|           ), | ||||
|           labelStyle: TextStyle(height: 0.1), | ||||
|           fillColor: Colors.transparent, | ||||
|           border: InputBorder.none, | ||||
|         ), | ||||
|         cursorColor: Colors.transparent, | ||||
|         showCursor: false, | ||||
|         maxLength: widget.maxLength, | ||||
|         onChanged: _onTextChanged, | ||||
|       ), | ||||
|     ); | ||||
|   } | ||||
| 
 | ||||
|   void _onTextChanged(text) { | ||||
|     var onTextChanged = widget.onTextChanged; | ||||
|     if (onTextChanged != null) { | ||||
|       onTextChanged(text); | ||||
|     } | ||||
|     setState(() { | ||||
|       this.text = text; | ||||
|       if (text.length >= currentIndex) { | ||||
|         for (int i = currentIndex; i < text.length; i++) { | ||||
|           strList[i] = text[i]; | ||||
|         } | ||||
|       } | ||||
|       currentIndex = text.length; | ||||
|     }); | ||||
|     if (text.length == widget.maxLength) { | ||||
|       FocusScope.of(context).requestFocus(FocusNode()); | ||||
|       var onDone = widget.onDone; | ||||
|       if (onDone != null) { | ||||
|         onDone(text); | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   Widget _pinBoxRow(BuildContext context) { | ||||
|     _calculateStrList(); | ||||
|     List<Widget> pinCodes = List.generate(widget.maxLength, (int i) { | ||||
|       return _buildPinCode(i, context); | ||||
|     }); | ||||
|     return Row(children: pinCodes, mainAxisSize: MainAxisSize.min); | ||||
|   } | ||||
| 
 | ||||
|   Widget _buildPinCode(int i, BuildContext context) { | ||||
|     Color borderColor; | ||||
|     Color pinBoxColor = widget.pinBoxColor; | ||||
| 
 | ||||
|     if (widget.hasError) { | ||||
|       borderColor = widget.errorBorderColor; | ||||
|     } else if (i < text.length) { | ||||
|       borderColor = widget.textBorderColor; | ||||
|     } else { | ||||
|       borderColor = widget.defaultBorderColor; | ||||
|       pinBoxColor = widget.pinBoxColor; | ||||
|     } | ||||
| 
 | ||||
|     EdgeInsets insets; | ||||
|     if (i == 0) { | ||||
|       insets = EdgeInsets.only( | ||||
|         left: 0, | ||||
|         top: widget.pinBoxOuterPadding.top, | ||||
|         right: widget.pinBoxOuterPadding.right, | ||||
|         bottom: widget.pinBoxOuterPadding.bottom, | ||||
|       ); | ||||
|     } else if (i == strList.length - 1) { | ||||
|       insets = EdgeInsets.only( | ||||
|         left: widget.pinBoxOuterPadding.left, | ||||
|         top: widget.pinBoxOuterPadding.top, | ||||
|         right: 0, | ||||
|         bottom: widget.pinBoxOuterPadding.bottom, | ||||
|       ); | ||||
|     } else { | ||||
|       insets = widget.pinBoxOuterPadding; | ||||
|     } | ||||
|     return Container( | ||||
|       key: ValueKey<String>("container$i"), | ||||
|       alignment: Alignment.center, | ||||
|       padding: EdgeInsets.symmetric(vertical: 4.0, horizontal: 1.0), | ||||
|       margin: insets, | ||||
|       child: _animatedTextBox(strList[i], i), | ||||
|       decoration: BoxDecoration( | ||||
|         border: Border.all( | ||||
|           color: borderColor, | ||||
|           width: widget.pinBoxBorderWidth, | ||||
|         ), | ||||
|         color: pinBoxColor, | ||||
|         borderRadius: BorderRadius.circular(widget.pinBoxRadius), | ||||
|       ), | ||||
|       width: widget.pinBoxWidth, | ||||
|       height: widget.pinBoxHeight, | ||||
|     ); | ||||
|   } | ||||
| 
 | ||||
|   Widget _animatedTextBox(String text, int i) { | ||||
|     if (widget.pinTextAnimatedSwitcherTransition != null) { | ||||
|       return AnimatedSwitcher( | ||||
|         duration: widget.pinTextAnimatedSwitcherDuration, | ||||
|         transitionBuilder: widget.pinTextAnimatedSwitcherTransition ?? | ||||
|             (Widget child, Animation<double> animation) { | ||||
|               return child; | ||||
|             }, | ||||
|         child: Text( | ||||
|           text, | ||||
|           key: ValueKey<String>("$text$i"), | ||||
|           style: widget.pinTextStyle, | ||||
|         ), | ||||
|       ); | ||||
|     } else { | ||||
|       return Text( | ||||
|         text, | ||||
|         key: ValueKey<String>("${strList[i]}$i"), | ||||
|         style: widget.pinTextStyle, | ||||
|       ); | ||||
|     } | ||||
|   } | ||||
| } | ||||
| @ -1,32 +0,0 @@ | ||||
| import 'package:mohem_flutter_app/theme/colors.dart'; | ||||
| import 'package:mohem_flutter_app/widgets/show_fill_button.dart'; | ||||
| import 'package:flutter/material.dart'; | ||||
| 
 | ||||
| class ShowCardButton extends StatelessWidget { | ||||
|   String title; | ||||
|   VoidCallback onPressed; | ||||
|   Color txtColor; | ||||
| 
 | ||||
|   ShowCardButton({ | ||||
|     required this.title, | ||||
|     required this.onPressed, | ||||
|     this.txtColor = Colors.white, | ||||
|   }); | ||||
| 
 | ||||
|   @override | ||||
|   Widget build(BuildContext context) { | ||||
|     return Card( | ||||
|       margin: EdgeInsets.zero, | ||||
|       elevation: 20, | ||||
|       child: Container( | ||||
|         width: double.infinity, | ||||
|         padding: EdgeInsets.all(12), | ||||
|         child: ShowFillButton( | ||||
|           title: title, | ||||
|           onPressed: onPressed, | ||||
|           txtColor: txtColor, | ||||
|         ), | ||||
|       ), | ||||
|     ); | ||||
|   } | ||||
| } | ||||
| @ -1,41 +0,0 @@ | ||||
| import 'package:mohem_flutter_app/theme/colors.dart'; | ||||
| import 'package:mohem_flutter_app/widgets/txt.dart'; | ||||
| import 'package:flutter/material.dart'; | ||||
| 
 | ||||
| class ShowFillButton extends StatelessWidget { | ||||
|   String title; | ||||
|   VoidCallback onPressed; | ||||
|   Color txtColor; | ||||
|   double elevation, radius,width; | ||||
| 
 | ||||
|   ShowFillButton({ | ||||
|     required this.title, | ||||
|     required this.onPressed, | ||||
|     this.txtColor = Colors.white, | ||||
|     this.elevation = 4, | ||||
|     this.radius = 6, | ||||
|     this.width=88, | ||||
|   }); | ||||
| 
 | ||||
|   @override | ||||
|   Widget build(BuildContext context) { | ||||
|     return ElevatedButton( | ||||
|       style: ElevatedButton.styleFrom( | ||||
|         onPrimary: Colors.black87, | ||||
|         primary: accentColor, | ||||
|         minimumSize: Size(width, 45), | ||||
|         padding: EdgeInsets.symmetric(horizontal: 16), | ||||
|         elevation: elevation, | ||||
|         shape: RoundedRectangleBorder( | ||||
|           borderRadius: BorderRadius.all(Radius.circular(radius)), | ||||
|         ), | ||||
|       ), | ||||
|       onPressed: onPressed, | ||||
|       child: Txt( | ||||
|         title.toUpperCase(), | ||||
|         color: txtColor, | ||||
|         txtType: TxtType.heading1, | ||||
|       ), | ||||
|     ); | ||||
|   } | ||||
| } | ||||
| @ -1,170 +0,0 @@ | ||||
| // import 'package:auto_size_text/auto_size_text.dart'; | ||||
| import 'package:mohem_flutter_app/theme/colors.dart'; | ||||
| import 'package:mohem_flutter_app/utils/utils.dart'; | ||||
| import 'package:flutter/material.dart'; | ||||
| import 'package:sizer/sizer.dart'; | ||||
| 
 | ||||
| enum TxtType { | ||||
|   small, | ||||
|   normal, | ||||
|   heading1, | ||||
|   heading2, | ||||
|   heading3, | ||||
|   appBar, | ||||
| } | ||||
| 
 | ||||
| class Txt extends StatelessWidget { | ||||
|   String text; | ||||
|   int? maxLines; | ||||
|   double? fontSize; | ||||
|   Color? color; | ||||
|   bool? bold; | ||||
|   bool? isUnderline; | ||||
|   bool? isFlatButton; | ||||
|   double? pedding; | ||||
|   TextAlign? textAlign; | ||||
|   FontWeight? fontWeight; | ||||
|   Function? onTap; | ||||
|   TxtType txtType; | ||||
| 
 | ||||
|   Txt(this.text, {this.maxLines, this.color, this.bold, this.fontSize, this.isUnderline, this.isFlatButton, this.pedding, this.textAlign, this.fontWeight, this.onTap, this.txtType = TxtType.normal}); | ||||
| 
 | ||||
|   @override | ||||
|   Widget build(BuildContext context) { | ||||
|     if (isFlatButton != null) | ||||
|       return Padding( | ||||
|         padding: EdgeInsets.only(right: pedding ?? 0, left: pedding ?? 0), | ||||
|         child: InkWell( | ||||
|           onTap: () { | ||||
|             onTap!(); | ||||
|           }, | ||||
|           customBorder: inkWellCorner(r: 4), | ||||
|           child: Padding( | ||||
|             padding: const EdgeInsets.only( | ||||
|               left: 14, | ||||
|               right: 14, | ||||
|               top: 6, | ||||
|               bottom: 6, | ||||
|             ), | ||||
|             child: getText(), | ||||
|           ), | ||||
|         ), | ||||
|       ); | ||||
|     else | ||||
|       return getText(); | ||||
|   } | ||||
| 
 | ||||
|   Widget getText() { | ||||
|     return Material( | ||||
|       type: MaterialType.transparency, | ||||
|       child: Text( | ||||
|         text, | ||||
|         maxLines: maxLines, | ||||
|         textAlign: textAlign, | ||||
|         overflow: maxLines != null ? TextOverflow.ellipsis : null, | ||||
|         style: TextStyle( | ||||
|           fontSize: fontSize ?? | ||||
|               (txtType == TxtType.small | ||||
|                   ? 8.sp | ||||
|                   : txtType == TxtType.normal | ||||
|                       ? 10.sp | ||||
|                       : txtType == TxtType.heading1 | ||||
|                           ? 11.sp | ||||
|                           : txtType == TxtType.heading2 | ||||
|                               ? 12.sp | ||||
|                               : txtType == TxtType.heading3 | ||||
|                                   ? 13.sp | ||||
|                                   : txtType == TxtType.appBar | ||||
|                                       ? 14.sp | ||||
|                                       : 8.sp), | ||||
|           color: color ?? | ||||
|               (txtType == TxtType.appBar | ||||
|                   ? Colors.black | ||||
|                   : txtType == TxtType.heading1 | ||||
|                       ? headingColor | ||||
|                       : txtType == TxtType.heading2 | ||||
|                           ? headingColor | ||||
|                           : txtType == TxtType.heading3 | ||||
|                               ? headingColor | ||||
|                               : null), | ||||
|           fontWeight: (fontWeight != null) | ||||
|               ? fontWeight | ||||
|               : ((bold != null) | ||||
|                   ? FontWeight.bold | ||||
|                   : (txtType == TxtType.appBar | ||||
|                       ? FontWeight.bold | ||||
|                       : txtType == TxtType.heading1 | ||||
|                           ? FontWeight.bold | ||||
|                           : txtType == TxtType.heading2 | ||||
|                               ? FontWeight.bold | ||||
|                               : txtType == TxtType.heading3 | ||||
|                                   ? FontWeight.bold | ||||
|                                   : null)), | ||||
|           decoration: (isUnderline != null) ? TextDecoration.underline : null, | ||||
|         ), | ||||
|       ), | ||||
|     ); | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| // class TxtAuto extends StatelessWidget { | ||||
| //   String text; | ||||
| //   int? maxLines; | ||||
| //   double? fontSize; | ||||
| //   Color? color; | ||||
| //   bool? bold; | ||||
| //   bool? isUnderline; | ||||
| //   bool? isFlatButton; | ||||
| //   double? pedding; | ||||
| //   TextAlign? textAlign; | ||||
| // | ||||
| //   TxtAuto( | ||||
| //       this.text, { | ||||
| //         this.maxLines, | ||||
| //         this.color, | ||||
| //         this.bold, | ||||
| //         this.fontSize, | ||||
| //         this.isUnderline, | ||||
| //         this.isFlatButton, | ||||
| //         this.pedding, | ||||
| //         this.textAlign, | ||||
| //       }); | ||||
| // | ||||
| //   @override | ||||
| //   Widget build(BuildContext context) { | ||||
| //     if (isFlatButton != null) | ||||
| //       return Padding( | ||||
| //         padding: EdgeInsets.only(right: pedding ?? 0, left: pedding ?? 0), | ||||
| //         child: InkWell( | ||||
| //           onTap: () {}, | ||||
| //           customBorder: inkWellCorner(r: 4), | ||||
| //           child: Padding( | ||||
| //             padding: const EdgeInsets.only( | ||||
| //               left: 14, | ||||
| //               right: 14, | ||||
| //               top: 6, | ||||
| //               bottom: 6, | ||||
| //             ), | ||||
| //             child: getText(), | ||||
| //           ), | ||||
| //         ), | ||||
| //       ); | ||||
| //     else | ||||
| //       return getText(); | ||||
| //   } | ||||
| // | ||||
| //   Widget getText() { | ||||
| //     return AutoSizeText( | ||||
| //       text, | ||||
| //       maxLines: maxLines, | ||||
| //       textAlign: textAlign, | ||||
| //       overflow: maxLines != null ? TextOverflow.ellipsis : null, | ||||
| //       style: TextStyle( | ||||
| //         fontSize: fontSize, | ||||
| //         color: color, | ||||
| //         fontWeight: (bold != null) ? FontWeight.bold : null, | ||||
| //         decoration: (isUnderline != null) ? TextDecoration.underline : null, | ||||
| //       ), | ||||
| //     ); | ||||
| //   } | ||||
| // } | ||||
| @ -1,155 +0,0 @@ | ||||
| import 'package:mohem_flutter_app/theme/colors.dart'; | ||||
| import 'package:mohem_flutter_app/utils/utils.dart'; | ||||
| import 'package:mohem_flutter_app/widgets/txt.dart'; | ||||
| import 'package:flutter/material.dart'; | ||||
| import 'package:sizer/sizer.dart'; | ||||
| 
 | ||||
| class TxtField extends StatelessWidget { | ||||
|   TextEditingController controller = new TextEditingController(); | ||||
|   String? title; | ||||
|   String? hint; | ||||
|   String? lable; | ||||
|   IconData? prefixData; | ||||
|   IconData? postfixData; | ||||
|   bool isNeedFilterButton; | ||||
|   bool isNeedClickAll; | ||||
|   bool isButtonEnable; | ||||
|   double? elevation; | ||||
|   Function? onTap; | ||||
|   String? buttonTitle; | ||||
|   int? maxLines; | ||||
|   bool isSidePaddingZero; | ||||
|   bool isNeedBorder; | ||||
| 
 | ||||
|   TxtField({ | ||||
|     this.title, | ||||
|     this.lable, | ||||
|     this.hint, | ||||
|     this.prefixData, | ||||
|     this.postfixData, | ||||
|     this.isNeedClickAll = false, | ||||
|     this.isNeedFilterButton = false, | ||||
|     this.elevation, | ||||
|     this.onTap, | ||||
|     this.isButtonEnable = false, | ||||
|     this.buttonTitle, | ||||
|     this.maxLines, | ||||
|     this.isSidePaddingZero = false, | ||||
|     this.isNeedBorder = true, | ||||
|   }); | ||||
| 
 | ||||
|   @override | ||||
|   Widget build(BuildContext context) { | ||||
|     controller.text = title ?? ""; | ||||
|     return InkWell( | ||||
|       onTap: isNeedClickAll == false | ||||
|           ? null | ||||
|           : () { | ||||
|               onTap!(); | ||||
|             }, | ||||
|       customBorder: inkWellCorner(), | ||||
|       child: Row( | ||||
|         children: [ | ||||
|           Expanded( | ||||
|             child: Card( | ||||
|               elevation: elevation, | ||||
|               margin: isSidePaddingZero ? EdgeInsets.zero : null, | ||||
|               child: TextField( | ||||
|                 autofocus: false, | ||||
|                 controller: controller, | ||||
|                 enabled: isNeedClickAll == true ? false : true, | ||||
|                 maxLines: maxLines, | ||||
|                 onTap: () {}, | ||||
|                 decoration: InputDecoration( | ||||
|                   labelText: lable, | ||||
|                   alignLabelWithHint: true, | ||||
|                   fillColor: Colors.white, | ||||
|                   focusedBorder: OutlineInputBorder( | ||||
|                     borderSide: BorderSide( | ||||
|                         color: accentColor, width: isNeedBorder ? 1.0 : 0), | ||||
|                     borderRadius: BorderRadius.circular(4.0), | ||||
|                   ), | ||||
|                   enabledBorder: OutlineInputBorder( | ||||
|                     borderSide: BorderSide( | ||||
|                         color: borderColor, width: isNeedBorder ? 1.0 : 0), | ||||
|                     borderRadius: BorderRadius.circular(4.0), | ||||
|                   ), | ||||
|                   disabledBorder: OutlineInputBorder( | ||||
|                     borderSide: BorderSide( | ||||
|                         color: borderColor, width: isNeedBorder ? 1.0 : 0), | ||||
|                     borderRadius: BorderRadius.circular(4.0), | ||||
|                   ), | ||||
|                   prefixIcon: prefixData != null | ||||
|                       ? Icon( | ||||
|                           Icons.search, | ||||
|                           color: borderColor, | ||||
|                         ) | ||||
|                       : null, | ||||
|                   labelStyle: TextStyle(color: borderColor, fontSize: 13.sp), | ||||
|                   hintStyle: TextStyle(color: borderColor, fontSize: 9.sp), | ||||
|                   hintText: hint ?? "", | ||||
|                   contentPadding: prefixData == null | ||||
|                       ? EdgeInsets.only( | ||||
|                           left: 12, | ||||
|                           right: 12, | ||||
|                           top: maxLines != null ? 12 : 0, | ||||
|                           bottom: maxLines != null ? 12 : 0, | ||||
|                         ) | ||||
|                       : EdgeInsets.zero, | ||||
|                 ), | ||||
|               ), | ||||
|             ), | ||||
|           ), | ||||
|           if (isNeedFilterButton) mWidth(8), | ||||
|           if (isNeedFilterButton) | ||||
|             InkWell( | ||||
|               onTap: isNeedClickAll | ||||
|                   ? null | ||||
|                   : () { | ||||
|                       controller.clear(); | ||||
|                     }, | ||||
|               child: Container( | ||||
|                 width: 55, | ||||
|                 height: 55, | ||||
|                 child: Card( | ||||
|                   color: accentColor, | ||||
|                   // margin: EdgeInsets.all(4), | ||||
|                   // shape: cardRadius(0), | ||||
|                   child: Icon( | ||||
|                     postfixData ?? Icons.filter_alt, | ||||
|                     color: Colors.white, | ||||
|                   ), | ||||
|                 ), | ||||
|               ), | ||||
|             ), | ||||
|           if (isButtonEnable) | ||||
|             Material( | ||||
|               child: InkWell( | ||||
|                 onTap: () {}, | ||||
|                 customBorder: inkWellCorner(), | ||||
|                 child: Container( | ||||
|                   height: 55, | ||||
|                   child: Card( | ||||
|                     color: accentColor, | ||||
|                     // margin: EdgeInsets.all(4), | ||||
|                     // shape: cardRadius(0), | ||||
|                     child: Center( | ||||
|                       child: Padding( | ||||
|                         padding: const EdgeInsets.only(left: 12, right: 12), | ||||
|                         child: Txt( | ||||
|                           buttonTitle ?? "Search", | ||||
|                           color: Colors.white, | ||||
|                           fontSize: 18, | ||||
|                           bold: true, | ||||
|                         ), | ||||
|                       ), | ||||
|                     ), | ||||
|                   ), | ||||
|                 ), | ||||
|               ), | ||||
|             ), | ||||
|         ], | ||||
|       ), | ||||
|     ); | ||||
|   } | ||||
| } | ||||
| @ -1,26 +0,0 @@ | ||||
| import 'package:mohem_flutter_app/config/constants.dart'; | ||||
| import 'package:mohem_flutter_app/utils/utils.dart'; | ||||
| import 'package:flutter/material.dart'; | ||||
| 
 | ||||
| class UserImage extends StatelessWidget { | ||||
|   double? size; | ||||
|   String? url; | ||||
| 
 | ||||
|   UserImage({this.size, this.url}); | ||||
| 
 | ||||
|   @override | ||||
|   Widget build(BuildContext context) { | ||||
|     return Container( | ||||
|       height: size ?? 60, | ||||
|       width: size ?? 60, | ||||
|       decoration: containerRadius(Colors.transparent, 1000), | ||||
|       clipBehavior: Clip.antiAlias, | ||||
|       child: Image.asset( | ||||
|         url ?? icons + "Blue Masked.jpg", | ||||
|         width: double.infinity, | ||||
|         height: double.infinity, | ||||
|         fit: BoxFit.cover, | ||||
|       ), | ||||
|     ); | ||||
|   } | ||||
| } | ||||
					Loading…
					
					
				
		Reference in New Issue