model improvements
							parent
							
								
									8470495332
								
							
						
					
					
						commit
						761b5abbab
					
				| @ -1,5 +1,13 @@ | ||||
| { | ||||
|   "mohemm": "Mohemm", | ||||
|   "english": "English", | ||||
|   "arabic": "Arabic", | ||||
|   "login": "Login", | ||||
|   "pleaseEnterLoginDetails": "Please enter the detail below to login", | ||||
|   "username": "Username", | ||||
|   "password": "Password", | ||||
|   "title": "Hello", | ||||
|   "forgotPassword": "Forgot Password", | ||||
|   "msg": "Hello {} in the {} world ", | ||||
|   "msg_named": "{} are written in the {lang} language", | ||||
|   "clickMe": "Click me", | ||||
| @ -1,5 +1,13 @@ | ||||
| { | ||||
|   "mohemm": "Mohemm", | ||||
|   "english": "English", | ||||
|   "arabic": "Arabic", | ||||
|   "login": "Login", | ||||
|   "pleaseEnterLoginDetails": "Please enter the detail below to login", | ||||
|   "username": "Username", | ||||
|   "password": "Password", | ||||
|   "title": "Hello", | ||||
|   "forgotPassword": "Forgot Password", | ||||
|   "msg": "Hello {} in the {} world ", | ||||
|   "msg_named": "{} are written in the {lang} language", | ||||
|   "clickMe": "Click me", | ||||
| @ -1,18 +0,0 @@ | ||||
| import 'package:flutter/material.dart'; | ||||
| 
 | ||||
| import 'package:flutter_localizations/flutter_localizations.dart'; | ||||
| 
 | ||||
| class AppLocalizations { | ||||
|   static const Iterable<LocalizationsDelegate<dynamic>> localizationsDelegates = | ||||
|       [ | ||||
|     // ... app-specific localization delegate[s] here | ||||
|     // S.delegate, | ||||
|     GlobalMaterialLocalizations.delegate, | ||||
|     GlobalWidgetsLocalizations.delegate, | ||||
|     GlobalCupertinoLocalizations.delegate | ||||
|   ]; | ||||
| 
 | ||||
|   static const List<Locale> supportedLocales = [ | ||||
|     const Locale("en", "US") | ||||
|   ]; | ||||
| } | ||||
| @ -0,0 +1,155 @@ | ||||
| import 'dart:async'; | ||||
| import 'dart:convert'; | ||||
| import 'dart:io'; | ||||
| 
 | ||||
| import 'package:flutter/foundation.dart'; | ||||
| import 'package:http/http.dart'; | ||||
| import 'package:http/io_client.dart'; | ||||
| import 'package:mohem_flutter_app/sikander_later_will_remove_to_parent_directory/exceptions/api_exception.dart'; | ||||
| 
 | ||||
| typedef FactoryConstructor<U> = U Function(dynamic); | ||||
| 
 | ||||
| class APIError { | ||||
|   int errorCode; | ||||
|   String errorMessage; | ||||
| 
 | ||||
|   APIError(this.errorCode, this.errorMessage); | ||||
| 
 | ||||
|   Map<String, dynamic> toJson() => {'errorCode': errorCode, 'errorMessage': errorMessage}; | ||||
| 
 | ||||
|   @override | ||||
|   String toString() { | ||||
|     return jsonEncode(this); | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| APIException _throwAPIException(Response response) { | ||||
|   switch (response.statusCode) { | ||||
|     case 400: | ||||
|       APIError? apiError; | ||||
|       if (response.body != null && response.body.isNotEmpty) { | ||||
|         var jsonError = jsonDecode(response.body); | ||||
|         apiError = APIError(jsonError['errorCode'], jsonError['errorMessage']); | ||||
|       } | ||||
|       return APIException(APIException.BAD_REQUEST, error: apiError); | ||||
|     case 401: | ||||
|       return APIException(APIException.UNAUTHORIZED); | ||||
|     case 403: | ||||
|       return APIException(APIException.FORBIDDEN); | ||||
|     case 404: | ||||
|       return APIException(APIException.NOT_FOUND); | ||||
|     case 500: | ||||
|       return APIException(APIException.INTERNAL_SERVER_ERROR); | ||||
|     case 444: | ||||
|       var downloadUrl = response.headers["location"]; | ||||
|       return APIException(APIException.UPGRADE_REQUIRED, arguments: downloadUrl); | ||||
|     default: | ||||
|       return APIException(APIException.OTHER); | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| class ApiClient { | ||||
|   static final ApiClient _instance = ApiClient._internal(); | ||||
| 
 | ||||
|   ApiClient._internal(); | ||||
| 
 | ||||
|   factory ApiClient() => _instance; | ||||
| 
 | ||||
|   Future<U> postJsonForObject<T, U>(FactoryConstructor<U> factoryConstructor, String url, T jsonObject, | ||||
|       {String? token, Map<String, dynamic>? queryParameters, Map<String, String>? headers, int retryTimes = 0}) async { | ||||
|     var _headers = {'Accept': 'application/json'}; | ||||
|     if (headers != null && headers.isNotEmpty) { | ||||
|       _headers.addAll(headers); | ||||
|     } | ||||
|     if (!kReleaseMode) { | ||||
|       print("Url:$url"); | ||||
|       print("body:$jsonObject"); | ||||
|     } | ||||
|     var response = await postJsonForResponse(url, jsonObject, token: token, queryParameters: queryParameters, headers: _headers, retryTimes: retryTimes); | ||||
|     try { | ||||
|       var jsonData = jsonDecode(response.body); | ||||
|       return factoryConstructor(jsonData); | ||||
|     } catch (ex) { | ||||
|       throw APIException(APIException.BAD_RESPONSE_FORMAT, arguments: ex); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   Future<Response> postJsonForResponse<T>(String url, T jsonObject, {String? token, Map<String, dynamic>? queryParameters, Map<String, String>? headers, int retryTimes = 0}) async { | ||||
|     String? requestBody; | ||||
|     if (jsonObject != null) { | ||||
|       requestBody = jsonEncode(jsonObject); | ||||
|       if (headers == null) { | ||||
|         headers = {'Content-Type': 'application/json'}; | ||||
|       } else { | ||||
|         headers['Content-Type'] = 'application/json'; | ||||
|       } | ||||
|     } | ||||
| 
 | ||||
|     return await _postForResponse(url, requestBody, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes); | ||||
|   } | ||||
| 
 | ||||
|   Future<Response> _postForResponse(String url, requestBody, {String? token, Map<String, dynamic>? queryParameters, Map<String, String>? headers, int retryTimes = 0}) async { | ||||
|     try { | ||||
|       var _headers = <String, String>{}; | ||||
|       if (token != null) { | ||||
|         _headers['Authorization'] = 'Bearer $token'; | ||||
|       } | ||||
| 
 | ||||
|       if (headers != null && headers.isNotEmpty) { | ||||
|         _headers.addAll(headers); | ||||
|       } | ||||
| 
 | ||||
|       if (queryParameters != null) { | ||||
|         var queryString = new Uri(queryParameters: queryParameters).query; | ||||
|         url = url + '?' + queryString; | ||||
|       } | ||||
|       var response = await _post(Uri.parse(url), body: requestBody, headers: _headers).timeout(Duration(seconds: 15)); | ||||
| 
 | ||||
|       if (response.statusCode >= 200 && response.statusCode < 300) { | ||||
|         return response; | ||||
|       } else { | ||||
|         throw _throwAPIException(response); | ||||
|       } | ||||
|     } on SocketException catch (e) { | ||||
|       if (retryTimes > 0) { | ||||
|         print('will retry after 3 seconds...'); | ||||
|         await Future.delayed(Duration(seconds: 3)); | ||||
|         return await _postForResponse(url, requestBody, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes - 1); | ||||
|       } else { | ||||
|         throw APIException(APIException.OTHER, arguments: e); | ||||
|       } | ||||
|     } on HttpException catch (e) { | ||||
|       if (retryTimes > 0) { | ||||
|         print('will retry after 3 seconds...'); | ||||
|         await Future.delayed(Duration(seconds: 3)); | ||||
|         return await _postForResponse(url, requestBody, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes - 1); | ||||
|       } else { | ||||
|         throw APIException(APIException.OTHER, arguments: e); | ||||
|       } | ||||
|     } on TimeoutException catch (e) { | ||||
|       throw APIException(APIException.TIMEOUT, arguments: e); | ||||
|     } on ClientException catch (e) { | ||||
|       if (retryTimes > 0) { | ||||
|         print('will retry after 3 seconds...'); | ||||
|         await Future.delayed(Duration(seconds: 3)); | ||||
|         return await _postForResponse(url, requestBody, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes - 1); | ||||
|       } else { | ||||
|         throw APIException(APIException.OTHER, arguments: e); | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   bool _certificateCheck(X509Certificate cert, String host, int port) => true; | ||||
| 
 | ||||
|   Future<T> _withClient<T>(Future<T> Function(Client) fn) async { | ||||
|     var httpClient = HttpClient()..badCertificateCallback = _certificateCheck; | ||||
|     var client = IOClient(httpClient); | ||||
|     try { | ||||
|       return await fn(client); | ||||
|     } finally { | ||||
|       client.close(); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   Future<Response> _post(url, {Map<String, String>? headers, body, Encoding? encoding}) => _withClient((client) => client.post(url, headers: headers, body: body, encoding: encoding)); | ||||
| } | ||||
| @ -0,0 +1,34 @@ | ||||
| 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 'api_client.dart'; | ||||
| 
 | ||||
| class TangheemUserApiClient { | ||||
|   static final TangheemUserApiClient _instance = TangheemUserApiClient._internal(); | ||||
| 
 | ||||
|   TangheemUserApiClient._internal(); | ||||
| 
 | ||||
|   factory TangheemUserApiClient() => _instance; | ||||
| 
 | ||||
|   Future<SurahModel> getSurahs() async { | ||||
|     String url = "${ApiConsts.tangheemUsers}AlSuar_Get"; | ||||
|     var postParams = {}; | ||||
|     return await ApiClient().postJsonForObject((json) => SurahModel.fromJson(json), url, postParams); | ||||
|   } | ||||
| 
 | ||||
|   Future<MemberModel> getMembers() async { | ||||
|     String url = "${ApiConsts.tangheemUsers}Committee_Get"; | ||||
|     var postParams = {}; | ||||
|     return await ApiClient().postJsonForObject((json) => MemberModel.fromJson(json), url, postParams); | ||||
|   } | ||||
| 
 | ||||
|   Future<ContentInfoModel> getContentInfo(int contentId) async { | ||||
|     String url = "${ApiConsts.tangheemUsers}ContentInfo_Get"; | ||||
|     var postParams = {"contentTypeId": contentId}; | ||||
|     return await ApiClient().postJsonForObject((json) => ContentInfoModel.fromJson(json), url, postParams); | ||||
|   } | ||||
| } | ||||
| @ -0,0 +1,26 @@ | ||||
| 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'; | ||||
| 
 | ||||
| class AppState { | ||||
|   static final AppState _instance = AppState._internal(); | ||||
| 
 | ||||
|   AppState._internal(); | ||||
| 
 | ||||
|   factory AppState() => _instance; | ||||
| 
 | ||||
|   SurahModel? _surahModel; | ||||
| 
 | ||||
|   SurahModel? get getSurahModel => _surahModel; | ||||
| 
 | ||||
|   void setSurahModel(SurahModel _surahModel) { | ||||
|     this._surahModel = _surahModel; | ||||
|   } | ||||
| 
 | ||||
|   ContentInfoDataModel? _copyRight; | ||||
| 
 | ||||
|   ContentInfoDataModel? get getContentInfoModel => _copyRight; | ||||
| 
 | ||||
|   void setContentInfoModel(ContentInfoDataModel _copyRight) { | ||||
|     this._copyRight = _copyRight; | ||||
|   } | ||||
| } | ||||
| @ -0,0 +1,13 @@ | ||||
| import 'package:flutter/cupertino.dart'; | ||||
| 
 | ||||
| class MyColors { | ||||
|   static const Color darkIconColor = Color(0xff28323A); | ||||
|   static const Color darkTextColor = Color(0xff2B353E); | ||||
|   static const Color gradiantStartColor = Color(0xff32D892); | ||||
|   static const Color gradiantEndColor = Color(0xff259CB8); | ||||
|   static const Color textMixColor = Color(0xff2BB8A6); | ||||
|   static const Color backgroundColor = Color(0xffF8F8F8); | ||||
|   static const Color greyColor = Color(0xff575757); | ||||
|   static const Color lightGreyColor = Color(0xffEFEFEF); | ||||
|   static const Color darkWhiteColor = Color(0xffE0E0E0); | ||||
| } | ||||
| @ -0,0 +1,20 @@ | ||||
| class ApiConsts { | ||||
|   //static String baseUrl = "http://10.200.204.20:2801/"; // Local server | ||||
|   static String baseUrl = "http://20.203.25.82"; // production server | ||||
|   static String baseUrlServices = baseUrl + "/services/"; // production server | ||||
|   // static String baseUrlServices = "https://api.cssynapses.com/tangheem/"; // Live server | ||||
|   static String authentication = baseUrlServices + "api/Authentication/"; | ||||
|   static String tangheemUsers = baseUrlServices + "api/TangheemUsers/"; | ||||
|   static String adminConfiguration = baseUrlServices + "api/AdminConfiguration/"; | ||||
|   static String user = baseUrlServices + "api/User/"; | ||||
| } | ||||
| 
 | ||||
| class GlobalConsts { | ||||
|   static String isRememberMe = "remember_me"; | ||||
|   static String email = "email"; | ||||
|   static String password = "password"; | ||||
|   static String bookmark = "bookmark"; | ||||
|   static String fontZoomSize = "font_zoom_size"; | ||||
|   static String welcomeVideoUrl = "welcomeVideoUrl"; | ||||
|   static String doNotShowWelcomeVideo = "doNotShowWelcomeVideo"; | ||||
| } | ||||
| @ -0,0 +1,70 @@ | ||||
| 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'; | ||||
| 
 | ||||
| class Utils { | ||||
|   static bool _isLoadingVisible = false; | ||||
| 
 | ||||
|   static bool get isLoading => _isLoadingVisible; | ||||
| 
 | ||||
|   static void showToast(String message) { | ||||
|     // Fluttertoast.showToast( | ||||
|     //     msg: message, toastLength: Toast.LENGTH_SHORT, gravity: ToastGravity.BOTTOM, timeInSecForIosWeb: 1, backgroundColor: Colors.black54, textColor: Colors.white, fontSize: 16.0); | ||||
|   } | ||||
| 
 | ||||
|   static dynamic getNotNullValue(List<dynamic> list, int index) { | ||||
|     try { | ||||
|       return list[index]; | ||||
|     } catch (ex) { | ||||
|       return null; | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   static int stringToHex(String colorCode) { | ||||
|     try { | ||||
|       return int.parse(colorCode.replaceAll("#", "0xff")); | ||||
|     } catch (ex) { | ||||
|       return (0xff000000); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   static void showLoading(BuildContext context) { | ||||
|     WidgetsBinding.instance?.addPostFrameCallback((_) { | ||||
|       _isLoadingVisible = true; | ||||
|       // showDialog( | ||||
|       //   context: context, | ||||
|       //   barrierColor: ColorConsts.primaryBlack.withOpacity(0.5), | ||||
|       //   builder: (BuildContext context) => LoadingDialog(), | ||||
|       // ).then((value) { | ||||
|       //   _isLoadingVisible = false; | ||||
|       // }); | ||||
|     }); | ||||
|   } | ||||
| 
 | ||||
|   static void hideLoading(BuildContext context) { | ||||
|     if (_isLoadingVisible) { | ||||
|       _isLoadingVisible = false; | ||||
|       Navigator.of(context).pop(); | ||||
|     } | ||||
|     _isLoadingVisible = false; | ||||
|   } | ||||
| 
 | ||||
|   static void handleException(dynamic exception, Function(String)? onErrorMessage) { | ||||
|     String errorMessage; | ||||
|     if (exception is APIException) { | ||||
|       if (exception.message == APIException.UNAUTHORIZED) { | ||||
|         return; | ||||
|       } else { | ||||
|         errorMessage = exception.error?.errorMessage ?? exception.message; | ||||
|       } | ||||
|     } else { | ||||
|       errorMessage = APIException.UNKNOWN; | ||||
|     } | ||||
|     if (onErrorMessage != null) { | ||||
|       onErrorMessage(errorMessage); | ||||
|     } else { | ||||
|       showToast(errorMessage); | ||||
|     } | ||||
|   } | ||||
| } | ||||
| @ -0,0 +1,29 @@ | ||||
| import 'dart:convert'; | ||||
| 
 | ||||
| import 'package:mohem_flutter_app/sikander_later_will_remove_to_parent_directory/api/api_client.dart'; | ||||
| 
 | ||||
| class APIException implements Exception { | ||||
|   static const String BAD_REQUEST = 'api_common_bad_request'; | ||||
|   static const String UNAUTHORIZED = 'api_common_unauthorized'; | ||||
|   static const String FORBIDDEN = 'api_common_forbidden'; | ||||
|   static const String NOT_FOUND = 'api_common_not_found'; | ||||
|   static const String INTERNAL_SERVER_ERROR = 'api_common_internal_server_error'; | ||||
|   static const String UPGRADE_REQUIRED = 'api_common_upgrade_required'; | ||||
|   static const String BAD_RESPONSE_FORMAT = 'api_common_bad_response_format'; | ||||
|   static const String OTHER = 'api_common_http_error'; | ||||
|   static const String TIMEOUT = 'api_common_http_timeout'; | ||||
|   static const String UNKNOWN = 'unexpected_error'; | ||||
| 
 | ||||
|   final String message; | ||||
|   final APIError? error; | ||||
|   final arguments; | ||||
| 
 | ||||
|   const APIException(this.message, {this.arguments, this.error}); | ||||
| 
 | ||||
|   Map<String, dynamic> toJson() => {'message': message, 'error': error, 'arguments': '$arguments'}; | ||||
| 
 | ||||
|   @override | ||||
|   String toString() { | ||||
|     return jsonEncode(this); | ||||
|   } | ||||
| } | ||||
| @ -0,0 +1,7 @@ | ||||
| import 'package:flutter/cupertino.dart'; | ||||
| 
 | ||||
| extension IntExtensions on int { | ||||
|   Widget get height => SizedBox(height: toDouble()); | ||||
| 
 | ||||
|   Widget get width => SizedBox(width: toDouble()); | ||||
| } | ||||
| @ -0,0 +1,46 @@ | ||||
| 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"; | ||||
|     } | ||||
|   } | ||||
| } | ||||
| @ -0,0 +1,9 @@ | ||||
| import 'package:flutter/material.dart'; | ||||
| import 'package:flutter/widgets.dart'; | ||||
| 
 | ||||
| extension WidgetExtensions on Widget { | ||||
|   Widget onPress(VoidCallback onTap) => InkWell( | ||||
|         onTap: onTap, | ||||
|         child: this, | ||||
|       ); | ||||
| } | ||||
| @ -0,0 +1,65 @@ | ||||
| class ContentInfoModel { | ||||
|   int? totalItemsCount; | ||||
|   int? statusCode; | ||||
|   String? message; | ||||
|   List<ContentInfoDataModel>? data; | ||||
| 
 | ||||
|   ContentInfoModel({this.totalItemsCount, this.statusCode, this.message, this.data}); | ||||
| 
 | ||||
|   ContentInfoModel.fromJson(Map<String, dynamic> json) { | ||||
|     totalItemsCount = json['totalItemsCount']; | ||||
|     statusCode = json['statusCode']; | ||||
|     message = json['message']; | ||||
|     if (json['data'] != null) { | ||||
|       data = []; | ||||
|       json['data'].forEach((v) { | ||||
|         data?.add(new ContentInfoDataModel.fromJson(v)); | ||||
|       }); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   Map<String, dynamic> toJson() { | ||||
|     final Map<String, dynamic> data = new Map<String, dynamic>(); | ||||
|     data['totalItemsCount'] = this.totalItemsCount; | ||||
|     data['statusCode'] = this.statusCode; | ||||
|     data['message'] = this.message; | ||||
|     if (this.data != null) { | ||||
|       data['data'] = this.data?.map((v) => v.toJson()).toList(); | ||||
|     } | ||||
|     return data; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| class ContentInfoDataModel { | ||||
|   int? contentInfoId; | ||||
|   int? contentTypeId; | ||||
|   String? content; | ||||
|   String? contentTypeNameEn; | ||||
|   String? contentTypeNameAr; | ||||
|   String? fileName; | ||||
|   String? exposeFilePath; | ||||
| 
 | ||||
|   ContentInfoDataModel({this.contentInfoId, this.contentTypeId, this.content, this.contentTypeNameEn, this.contentTypeNameAr, this.fileName, this.exposeFilePath}); | ||||
| 
 | ||||
|   ContentInfoDataModel.fromJson(Map<String, dynamic> json) { | ||||
|     contentInfoId = json['contentInfoId']; | ||||
|     contentTypeId = json['contentTypeId']; | ||||
|     content = json['content']; | ||||
|     contentTypeNameEn = json['contentTypeNameEn']; | ||||
|     contentTypeNameAr = json['contentTypeNameAr']; | ||||
|     fileName = json['fileName']; | ||||
|     exposeFilePath = json['exposeFilePath']; | ||||
|   } | ||||
| 
 | ||||
|   Map<String, dynamic> toJson() { | ||||
|     final Map<String, dynamic> data = new Map<String, dynamic>(); | ||||
|     data['contentInfoId'] = this.contentInfoId; | ||||
|     data['contentTypeId'] = this.contentTypeId; | ||||
|     data['content'] = this.content; | ||||
|     data['contentTypeNameEn'] = this.contentTypeNameEn; | ||||
|     data['contentTypeNameAr'] = this.contentTypeNameAr; | ||||
|     data['fileName'] = this.fileName; | ||||
|     data['exposeFilePath'] = this.exposeFilePath; | ||||
|     return data; | ||||
|   } | ||||
| } | ||||
| @ -0,0 +1,62 @@ | ||||
| class MemberModel { | ||||
|   int? totalItemsCount; | ||||
|   int? statusCode; | ||||
|   String? message; | ||||
|   List<MemberDataModel>? data; | ||||
| 
 | ||||
|   MemberModel({this.totalItemsCount, this.statusCode, this.message, this.data}); | ||||
| 
 | ||||
|   MemberModel.fromJson(Map<String, dynamic> json) { | ||||
|     totalItemsCount = json['totalItemsCount']; | ||||
|     statusCode = json['statusCode']; | ||||
|     message = json['message']; | ||||
|     if (json['data'] != null) { | ||||
|       data = []; | ||||
|       json['data'].forEach((v) { | ||||
|         data?.add(new MemberDataModel.fromJson(v)); | ||||
|       }); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   Map<String, dynamic> toJson() { | ||||
|     final Map<String, dynamic> data = new Map<String, dynamic>(); | ||||
|     data['totalItemsCount'] = this.totalItemsCount; | ||||
|     data['statusCode'] = this.statusCode; | ||||
|     data['message'] = this.message; | ||||
|     if (this.data != null) { | ||||
|       data['data'] = this.data?.map((v) => v.toJson()).toList(); | ||||
|     } | ||||
|     return data; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| class MemberDataModel { | ||||
|   int? committeeId; | ||||
|   String? firstName; | ||||
|   String? lastName; | ||||
|   String? description; | ||||
|   String? picture; | ||||
|   int? orderNo; | ||||
| 
 | ||||
|   MemberDataModel({this.committeeId, this.firstName, this.lastName, this.description, this.picture, this.orderNo}); | ||||
| 
 | ||||
|   MemberDataModel.fromJson(Map<String, dynamic> json) { | ||||
|     committeeId = json['committeeId']; | ||||
|     firstName = json['firstName']; | ||||
|     lastName = json['lastName']; | ||||
|     description = json['description']; | ||||
|     picture = json['picture']; | ||||
|     orderNo = json['orderNo']; | ||||
|   } | ||||
| 
 | ||||
|   Map<String, dynamic> toJson() { | ||||
|     final Map<String, dynamic> data = new Map<String, dynamic>(); | ||||
|     data['committeeId'] = this.committeeId; | ||||
|     data['firstName'] = this.firstName; | ||||
|     data['lastName'] = this.lastName; | ||||
|     data['description'] = this.description; | ||||
|     data['picture'] = this.picture; | ||||
|     data['orderNo'] = this.orderNo; | ||||
|     return data; | ||||
|   } | ||||
| } | ||||
| @ -0,0 +1,74 @@ | ||||
| class SurahModel { | ||||
|   int? totalItemsCount; | ||||
|   int? statusCode; | ||||
|   String? message; | ||||
|   List<SurahModelData>? data; | ||||
| 
 | ||||
|   SurahModel({this.totalItemsCount, this.statusCode, this.message, this.data}); | ||||
| 
 | ||||
|   SurahModel.fromJson(Map<String, dynamic> json) { | ||||
|     totalItemsCount = json['totalItemsCount']; | ||||
|     statusCode = json['statusCode']; | ||||
|     message = json['message']; | ||||
|     if (json['data'] != null) { | ||||
|       data = []; | ||||
|       json['data'].forEach((v) { | ||||
|         data?.add(SurahModelData.fromJson(v)); | ||||
|       }); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   Map<String, dynamic> toJson() { | ||||
|     final Map<String, dynamic> data = new Map<String, dynamic>(); | ||||
|     data['totalItemsCount'] = totalItemsCount; | ||||
|     data['statusCode'] = statusCode; | ||||
|     data['message'] = message; | ||||
|     if (this.data != null) { | ||||
|       data['data'] = this.data?.map((v) => v.toJson()).toList(); | ||||
|     } | ||||
|     return data; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| class SurahModelData { | ||||
|   int? id; | ||||
|   int? surahID; | ||||
|   String? nameAR; | ||||
|   String? nameEN; | ||||
|   int? numberOfAyahs; | ||||
|   String? englishNameTranslation; | ||||
|   int? revelationID; | ||||
|   String? revelationType; | ||||
|   int? startPageNo; | ||||
|   int? endPageNo; | ||||
| 
 | ||||
|   SurahModelData({this.id, this.surahID, this.nameAR, this.nameEN, this.numberOfAyahs, this.englishNameTranslation, this.revelationID, this.revelationType, this.startPageNo, this.endPageNo}); | ||||
| 
 | ||||
|   SurahModelData.fromJson(Map<String, dynamic> json) { | ||||
|     id = json['id']; | ||||
|     surahID = json['surahID']; | ||||
|     nameAR = json['nameAR']; | ||||
|     nameEN = json['nameEN']; | ||||
|     numberOfAyahs = json['numberOfAyahs']; | ||||
|     englishNameTranslation = json['englishNameTranslation']; | ||||
|     revelationID = json['revelation_ID']; | ||||
|     revelationType = json['revelationType']; | ||||
|     startPageNo = json['startPageNo']; | ||||
|     endPageNo = json['endPageNo']; | ||||
|   } | ||||
| 
 | ||||
|   Map<String, dynamic> toJson() { | ||||
|     final Map<String, dynamic> data = new Map<String, dynamic>(); | ||||
|     data['id'] = this.id; | ||||
|     data['surahID'] = this.surahID; | ||||
|     data['nameAR'] = this.nameAR; | ||||
|     data['nameEN'] = this.nameEN; | ||||
|     data['numberOfAyahs'] = this.numberOfAyahs; | ||||
|     data['englishNameTranslation'] = this.englishNameTranslation; | ||||
|     data['revelation_ID'] = this.revelationID; | ||||
|     data['revelationType'] = this.revelationType; | ||||
|     data['startPageNo'] = this.startPageNo; | ||||
|     data['endPageNo'] = this.endPageNo; | ||||
|     return data; | ||||
|   } | ||||
| } | ||||
| @ -0,0 +1,103 @@ | ||||
| // import 'package:flutter/material.dart'; | ||||
| // import 'package:tangheem/classes/colors.dart'; | ||||
| // import 'package:tangheem/models/country_model.dart'; | ||||
| // import 'package:tangheem/widgets/common_textfield_widget.dart'; | ||||
| // | ||||
| // class CountrySelectionBottomSheet extends StatefulWidget { | ||||
| //   final List<CountryModelData> countryList; | ||||
| //   final Function(CountryModelData) onSelectCountry; | ||||
| // | ||||
| //   CountrySelectionBottomSheet({Key key, this.countryList, this.onSelectCountry}) : super(key: key); | ||||
| // | ||||
| //   @override | ||||
| //   _CountrySelectionBottomSheetState createState() { | ||||
| //     return _CountrySelectionBottomSheetState(); | ||||
| //   } | ||||
| // } | ||||
| // | ||||
| // class _CountrySelectionBottomSheetState extends State<CountrySelectionBottomSheet> { | ||||
| //   TextEditingController _searchCountryController = TextEditingController(); | ||||
| //   List<CountryModelData> _filteredCountryList = []; | ||||
| // | ||||
| //   @override | ||||
| //   void initState() { | ||||
| //     super.initState(); | ||||
| //     _searchCountryController.addListener(_onTextChange); | ||||
| //     _filterList(""); | ||||
| //   } | ||||
| // | ||||
| //   void _filterList(String _query) { | ||||
| //     _filteredCountryList = []; | ||||
| //     if (_query.isEmpty) { | ||||
| //       _filteredCountryList = widget.countryList; | ||||
| //     } else { | ||||
| //       _filteredCountryList = widget.countryList.where((element) => element.countryNameAr.contains(_query) || element.countryNameEn.toLowerCase().contains(_query.toLowerCase()))?.toList() ?? []; | ||||
| //     } | ||||
| //     setState(() {}); | ||||
| //   } | ||||
| // | ||||
| //   void _onTextChange() { | ||||
| //     var _searchText = _searchCountryController.text; | ||||
| //     _filterList(_searchText); | ||||
| //   } | ||||
| // | ||||
| //   @override | ||||
| //   void dispose() { | ||||
| //     super.dispose(); | ||||
| //   } | ||||
| // | ||||
| //   @override | ||||
| //   Widget build(BuildContext context) { | ||||
| //     return Directionality( | ||||
| //       textDirection: TextDirection.rtl, | ||||
| //       child: Container( | ||||
| //         height: MediaQuery.of(context).size.height * 0.75, | ||||
| //         padding: EdgeInsets.all(16), | ||||
| //         decoration: BoxDecoration( | ||||
| //           color: Colors.white, | ||||
| //           borderRadius: BorderRadius.only( | ||||
| //             topLeft: Radius.circular(16), | ||||
| //             topRight: Radius.circular(16), | ||||
| //           ), | ||||
| //         ), | ||||
| //         child: Column( | ||||
| //           children: [ | ||||
| //             Container( | ||||
| //               padding: EdgeInsets.all(8), | ||||
| //               height: 54, | ||||
| //               decoration: BoxDecoration( | ||||
| //                 color: ColorConsts.primaryBlue, | ||||
| //                 borderRadius: BorderRadius.only( | ||||
| //                   topLeft: Radius.circular(12), | ||||
| //                   topRight: Radius.circular(12), | ||||
| //                   bottomRight: Radius.circular(12), | ||||
| //                   bottomLeft: Radius.circular(12), | ||||
| //                 ), | ||||
| //               ), | ||||
| //               child: CommonTextFieldWidget(hint: "البحث في البلد", controller: _searchCountryController), | ||||
| //             ), | ||||
| //             Expanded( | ||||
| //               child: ListView.separated( | ||||
| //                 padding: EdgeInsets.only(left: 8, right: 8), | ||||
| //                 itemCount: _filteredCountryList.length, | ||||
| //                 physics: BouncingScrollPhysics(), | ||||
| //                 separatorBuilder: (context, index) => Divider( | ||||
| //                   height: 1, | ||||
| //                   color: Colors.black87.withOpacity(0.3), | ||||
| //                 ), | ||||
| //                 itemBuilder: (context, index) => ListTile( | ||||
| //                   title: Text(_filteredCountryList[index].countryNameAr + " (" + _filteredCountryList[index].countryCode + ")"), | ||||
| //                   dense: true, | ||||
| //                   onTap: () { | ||||
| //                     Navigator.pop(context); | ||||
| //                     widget.onSelectCountry(_filteredCountryList[index]); | ||||
| //                   }, | ||||
| //                 ), | ||||
| //               ), | ||||
| //             ) | ||||
| //           ], | ||||
| //         ), | ||||
| //       ), | ||||
| //     ); | ||||
| //   } | ||||
| // } | ||||
| @ -0,0 +1,364 @@ | ||||
| // import 'package:flutter/material.dart'; | ||||
| // import 'package:flutter_svg/flutter_svg.dart'; | ||||
| // import 'package:shared_preferences/shared_preferences.dart'; | ||||
| // import 'package:tangheem/api/tangheem_user_api_client.dart'; | ||||
| // import 'package:tangheem/app_state/app_state.dart'; | ||||
| // import 'package:tangheem/classes/colors.dart'; | ||||
| // import 'package:tangheem/classes/consts.dart'; | ||||
| // import 'package:tangheem/classes/utils.dart'; | ||||
| // import 'package:tangheem/models/navigation_model.dart'; | ||||
| // import 'package:tangheem/models/quick_links_model.dart'; | ||||
| // import 'package:tangheem/ui/screens/bookmark_screen.dart'; | ||||
| // import 'package:tangheem/ui/screens/content_info_screen.dart'; | ||||
| // import 'package:tangheem/ui/screens/login_screen.dart'; | ||||
| // import 'package:tangheem/ui/screens/pdf_viewer_screen.dart'; | ||||
| // import 'package:url_launcher/url_launcher.dart'; | ||||
| // | ||||
| // class CommonAppbar extends StatefulWidget { | ||||
| //   final bool showDrawer; | ||||
| //   final Widget child; | ||||
| //   final bool isFirst; | ||||
| // | ||||
| //   CommonAppbar({Key key, this.showDrawer = false, @required this.child, this.isFirst = false}) : super(key: key); | ||||
| // | ||||
| //   @override | ||||
| //   _CommonAppbarState createState() { | ||||
| //     return _CommonAppbarState(); | ||||
| //   } | ||||
| // } | ||||
| // | ||||
| // class _CommonAppbarState extends State<CommonAppbar> { | ||||
| //   final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>(); | ||||
| //   List<QuickLinksData> quickLinks = []; | ||||
| //   List<NavigationDataModel> navigationList = []; | ||||
| // | ||||
| //   @override | ||||
| //   void initState() { | ||||
| //     super.initState(); | ||||
| //     getPrefs(); | ||||
| //     getNavigation(); | ||||
| //     getQuickLinks(); | ||||
| //     //getCopyRight(); | ||||
| //   } | ||||
| // | ||||
| //   // void getCopyRight() async { | ||||
| //   //   if (AppState().getContentInfoModel == null) { | ||||
| //   //     try { | ||||
| //   //       var model = await TangheemUserApiClient().getContentInfo(3); | ||||
| //   //       var contentList = model?.data ?? []; | ||||
| //   //       if (contentList.length > 0) { | ||||
| //   //         _copyRight = contentList.first; | ||||
| //   //         AppState().setContentInfoModel(_copyRight); | ||||
| //   //       } | ||||
| //   //     } catch (ex) {} | ||||
| //   //   } else { | ||||
| //   //     _copyRight = AppState().getContentInfoModel; | ||||
| //   //   } | ||||
| //   //   setState(() {}); | ||||
| //   // } | ||||
| // | ||||
| //   void getNavigation() async { | ||||
| //     if (AppState().getNavigationModel?.data == null) { | ||||
| //       try { | ||||
| //         var model = await TangheemUserApiClient().getNavigation(); | ||||
| //         navigationList = model?.data ?? []; | ||||
| //         navigationList.sort((a, b) => a.orderNo.compareTo(b.orderNo)); | ||||
| //         AppState().setNavigationModel(model); | ||||
| //       } catch (ex) {} | ||||
| //     } else { | ||||
| //       navigationList = AppState().getNavigationModel.data; | ||||
| //     } | ||||
| //     setState(() {}); | ||||
| //   } | ||||
| // | ||||
| //   void getQuickLinks() async { | ||||
| //     if (widget.showDrawer) { | ||||
| //       try { | ||||
| //         quickLinks = (await TangheemUserApiClient().quickLinks())?.data ?? []; | ||||
| //         quickLinks = quickLinks.where((element) => element.position == "down").toList(); | ||||
| //         quickLinks.sort((a, b) => a.orderNo.compareTo(b.orderNo)); | ||||
| //       } catch (ex) {} | ||||
| //       setState(() {}); | ||||
| //     } | ||||
| //   } | ||||
| // | ||||
| //   int fontSize; | ||||
| //   SharedPreferences prefs; | ||||
| // | ||||
| //   void getPrefs() async { | ||||
| //     prefs = await SharedPreferences.getInstance(); | ||||
| //     fontSize = prefs.getInt(GlobalConsts.fontZoomSize) ?? 18; | ||||
| //   } | ||||
| // | ||||
| //   @override | ||||
| //   void dispose() { | ||||
| //     super.dispose(); | ||||
| //   } | ||||
| // | ||||
| //   @override | ||||
| //   Widget build(BuildContext context) { | ||||
| //     return Scaffold( | ||||
| //       key: widget.showDrawer ? _scaffoldKey : null, | ||||
| //       drawer: widget.showDrawer ? drawerView() : null, | ||||
| //       resizeToAvoidBottomInset: true, | ||||
| //       drawerScrimColor: Colors.black.withOpacity(.3), | ||||
| //       body: SafeArea( | ||||
| //         child: Column( | ||||
| //           children: [ | ||||
| //             Container( | ||||
| //               color: Colors.white, | ||||
| //               height: 100, | ||||
| //               padding: EdgeInsets.only(top: 8, bottom: 8, right: 16), | ||||
| //               child: Row( | ||||
| //                 crossAxisAlignment: CrossAxisAlignment.center, | ||||
| //                 children: [ | ||||
| //                   if (!widget.isFirst) | ||||
| //                     IconButton( | ||||
| //                       icon: Icon(widget.showDrawer ? Icons.menu : Icons.arrow_back_ios, color: ColorConsts.textGrey), | ||||
| //                       padding: EdgeInsets.only(left: 16), | ||||
| //                       onPressed: () { | ||||
| //                         if (widget.showDrawer) { | ||||
| //                           _scaffoldKey.currentState.openDrawer(); | ||||
| //                         } else { | ||||
| //                           Navigator.pop(context); | ||||
| //                         } | ||||
| //                       }, | ||||
| //                     ), | ||||
| //                   Expanded(child: SizedBox()), | ||||
| //                   Hero( | ||||
| //                     tag: "logo", | ||||
| //                     child: SvgPicture.asset( | ||||
| //                       "assets/logos/tangheem_logo.svg", | ||||
| //                       height: 100, | ||||
| //                       width: 100, | ||||
| //                       alignment: Alignment.centerRight, | ||||
| //                     ), | ||||
| //                   ) | ||||
| //                 ], | ||||
| //               ), | ||||
| //             ), | ||||
| //             Expanded( | ||||
| //               child: Directionality(textDirection: TextDirection.rtl, child: widget.child), | ||||
| //             ), | ||||
| //           ], | ||||
| //         ), | ||||
| //       ), | ||||
| //     ); | ||||
| //   } | ||||
| // | ||||
| //   Widget drawerView() { | ||||
| //     var height = MediaQuery.of(context).padding.top; | ||||
| //     return Drawer( | ||||
| //       elevation: 0, | ||||
| //       child: Container( | ||||
| //         color: Colors.white, | ||||
| //         child: SafeArea( | ||||
| //           bottom: true, | ||||
| //           top: false, | ||||
| //           right: false, | ||||
| //           left: false, | ||||
| //           maintainBottomViewPadding: true, | ||||
| //           child: Builder( | ||||
| //             builder: (context) { | ||||
| //               bool isPortrait = MediaQuery.of(context).orientation == Orientation.portrait; | ||||
| //               Widget listContents = ListView.builder( | ||||
| //                   shrinkWrap: true, | ||||
| //                   physics: BouncingScrollPhysics(), | ||||
| //                   padding: EdgeInsets.only(left: 24, right: 24), | ||||
| //                   itemCount: navigationList.length, | ||||
| //                   itemBuilder: (context, index) { | ||||
| //                     String icon = "assets/icons/${navigationList[index].mobileFontIcon}.svg"; | ||||
| //                     var subList = navigationList.where((element) => element.parentId == navigationList[index].navigationId).toList(); | ||||
| //                     return Column( | ||||
| //                       mainAxisSize: MainAxisSize.min, | ||||
| //                       children: [ | ||||
| //                         if (navigationList[index].parentId == 1) | ||||
| //                           myListItem(icon, navigationList[index].navigationText, navigationList[index].orderNo == 1 ? true : false, onTap: () { | ||||
| //                             String url = navigationList[index]?.mobileNavigationUrl ?? ""; | ||||
| //                             if (url.isEmpty || url.length < 2) { | ||||
| //                               return; | ||||
| //                             } | ||||
| //                             Navigator.pushNamed(context, url, arguments: null); | ||||
| //                           }), | ||||
| //                         for (var subItem in subList) | ||||
| //                           Container( | ||||
| //                             width: double.infinity, | ||||
| //                             child: Row( | ||||
| //                               children: [ | ||||
| //                                 Expanded( | ||||
| //                                   child: myListItem("assets/icons/${subItem.mobileFontIcon}.svg", subItem.navigationText, false, onTap: () { | ||||
| //                                     String url = subItem.mobileNavigationUrl ?? ""; | ||||
| //                                     if (url.isEmpty) { | ||||
| //                                       return; | ||||
| //                                     } | ||||
| //                                     var contentId; | ||||
| //                                     if (subItem.mobileNavigationUrl == "/introduction") { | ||||
| //                                       url = ContentInfoScreen.routeName; | ||||
| //                                       contentId = 2; | ||||
| //                                     } else if (subItem.mobileNavigationUrl == "/encyclopedia") { | ||||
| //                                       url = ContentInfoScreen.routeName; | ||||
| //                                       contentId = 1; | ||||
| //                                     } else if (subItem.mobileNavigationUrl == "/tangheempdf") { | ||||
| //                                       url = PdfListScreen.routeName; | ||||
| //                                       contentId = 8; | ||||
| //                                     } | ||||
| //                                     Navigator.pushNamed(context, url, arguments: contentId); | ||||
| //                                   }), | ||||
| //                                 ), | ||||
| //                                 Container( | ||||
| //                                   height: 40, | ||||
| //                                   margin: EdgeInsets.only(right: 17, left: 10), | ||||
| //                                   child: VerticalDivider(color: ColorConsts.primaryBlack, thickness: .7, width: 1), | ||||
| //                                 ), | ||||
| //                               ], | ||||
| //                             ), | ||||
| //                           ) | ||||
| //                       ], | ||||
| //                     ); | ||||
| //                   }); | ||||
| //               if (isPortrait) { | ||||
| //                 listContents = Expanded(child: listContents); | ||||
| //               } | ||||
| //               List<Widget> list = [ | ||||
| //                 Container( | ||||
| //                   height: 100 + height, | ||||
| //                   padding: EdgeInsets.only(left: 0, top: height), | ||||
| //                   alignment: Alignment.centerLeft, | ||||
| //                   child: IconButton( | ||||
| //                     icon: Icon(Icons.clear, color: ColorConsts.textGrey), | ||||
| //                     onPressed: () { | ||||
| //                       if (_scaffoldKey.currentState.isDrawerOpen) { | ||||
| //                         Navigator.pop(context); | ||||
| //                       } | ||||
| //                     }, | ||||
| //                   ), | ||||
| //                 ), | ||||
| //                 Container( | ||||
| //                   margin: EdgeInsets.only(top: 8, bottom: 16), | ||||
| //                   padding: EdgeInsets.only(left: 16, right: 16), | ||||
| //                   child: Row( | ||||
| //                     mainAxisAlignment: MainAxisAlignment.spaceEvenly, | ||||
| //                     children: [ | ||||
| //                       commonIconButton("assets/icons/bookmark.svg", () { | ||||
| //                         Navigator.pushNamed(context, BookmarkScreen.routeName); | ||||
| //                       }), | ||||
| //                       commonIconButton("assets/icons/increase_size.svg", () { | ||||
| //                         if (fontSize >= 36) { | ||||
| //                           Utils.showToast("وصل حجم الخط إلى الحد الأقصى للحجم"); | ||||
| //                           return; | ||||
| //                         } | ||||
| //                         fontSize += 2; | ||||
| //                         prefs.setInt(GlobalConsts.fontZoomSize, fontSize); | ||||
| //                         Utils.showToast("زيادة حجم الخط"); | ||||
| //                       }), | ||||
| //                       commonIconButton("assets/icons/reduce_size.svg", () { | ||||
| //                         if (fontSize <= 12) { | ||||
| //                           Utils.showToast("وصل حجم الخط إلى الحد الأدنى للحجم"); | ||||
| //                           return; | ||||
| //                         } | ||||
| //                         fontSize -= 2; | ||||
| //                         prefs.setInt(GlobalConsts.fontZoomSize, fontSize); | ||||
| //                         Utils.showToast("تم تقليل حجم الخط"); | ||||
| //                       }), | ||||
| //                       commonIconButton("assets/icons/user_logged.svg", () { | ||||
| //                         if (AppState().isUserLogin) { | ||||
| //                           Utils.showToast("أنت بالفعل تسجيل الدخول"); | ||||
| //                           return; | ||||
| //                         } | ||||
| //                         Navigator.pushNamed(context, LoginScreen.routeName); | ||||
| //                       }), | ||||
| //                     ], | ||||
| //                   ), | ||||
| //                 ), | ||||
| //                 listContents, | ||||
| //                 Container( | ||||
| //                   margin: EdgeInsets.only(top: 16, bottom: 12), | ||||
| //                   padding: EdgeInsets.only(left: 32, right: 32), | ||||
| //                   child: Row( | ||||
| //                     children: [ | ||||
| //                       for (QuickLinksData _quickLink in quickLinks) | ||||
| //                        commonIconButton(ApiConsts.baseUrl + _quickLink.exposeFilePath, () { //for live production server | ||||
| //                     //     commonIconButton( _quickLink.exposeFilePath, () { | ||||
| //                           _launchURL(_quickLink.imageUrl); | ||||
| //                         }, size: 35, isAsset: false), | ||||
| //                     ], | ||||
| //                   ), | ||||
| //                 ), | ||||
| //                 Padding( | ||||
| //                   padding: EdgeInsets.only(left: 32, right: 32, bottom: 8), | ||||
| //                   child: Row( | ||||
| //                     crossAxisAlignment: CrossAxisAlignment.center, | ||||
| //                     mainAxisAlignment: MainAxisAlignment.center, | ||||
| //                     children: [ | ||||
| //                       Text( | ||||
| //                         "Powered by Cloud Solutions", | ||||
| //                         maxLines: 1, | ||||
| //                         textAlign: TextAlign.right, | ||||
| //                         style: TextStyle(fontSize: 14, color: Colors.black87), | ||||
| //                       ), | ||||
| //                       SizedBox(width: 8), | ||||
| //                       SvgPicture.asset("assets/logos/cloud_logo.svg", width: 30, height: 30) | ||||
| //                     ], | ||||
| //                   ), | ||||
| //                 ) | ||||
| //               ]; | ||||
| //               return isPortrait ? Column(children: list) : ListView(children: list); | ||||
| //             }, | ||||
| //           ), | ||||
| //         ), | ||||
| //       ), | ||||
| //     ); | ||||
| //   } | ||||
| // | ||||
| //   void _launchURL(String _url) async => await canLaunch(_url) ? await launch(_url) : throw 'Could not launch $_url'; | ||||
| // | ||||
| //   Widget commonIconButton(String icon, VoidCallback onPressed, {double size, bool isAsset = true}) { | ||||
| //     return Expanded( | ||||
| //       child: IconButton( | ||||
| //           padding: EdgeInsets.zero, | ||||
| //           icon: isAsset ? SvgPicture.asset(icon, height: size ?? 25, width: size ?? 30) : Image.network(icon, height: size ?? 25, width: size ?? 30), | ||||
| //           onPressed: () { | ||||
| //             Navigator.pop(context); | ||||
| //             Future.delayed(Duration(milliseconds: 200), () => onPressed()); | ||||
| //           }), | ||||
| //     ); | ||||
| //   } | ||||
| // | ||||
| //   Widget myListItem(String icon, String title, bool isSelected, {VoidCallback onTap}) { | ||||
| //     return InkWell( | ||||
| //       onTap: () { | ||||
| //         Navigator.pop(context); | ||||
| //         if (onTap != null) { | ||||
| //           Future.delayed(Duration(milliseconds: 200), () => onTap()); | ||||
| //         } | ||||
| //       }, | ||||
| //       child: Container( | ||||
| //         height: 40, | ||||
| //         padding: EdgeInsets.only(left: 8, right: 8), | ||||
| //         alignment: Alignment.centerRight, | ||||
| //         decoration: BoxDecoration( | ||||
| //           borderRadius: BorderRadius.circular(6), | ||||
| //           gradient: isSelected | ||||
| //               ? LinearGradient( | ||||
| //                   stops: [0.0, 0.5], | ||||
| //                   begin: Alignment.topCenter, | ||||
| //                   end: Alignment.bottomCenter, | ||||
| //                   colors: [ColorConsts.gradientPink, ColorConsts.gradientOrange], | ||||
| //                 ) | ||||
| //               : null, | ||||
| //         ), | ||||
| //         child: Row( | ||||
| //           mainAxisSize: MainAxisSize.min, | ||||
| //           children: [ | ||||
| //             Text( | ||||
| //               title, | ||||
| //               style: TextStyle(fontSize: 14, color: isSelected ? Colors.white : ColorConsts.textGrey), | ||||
| //             ), | ||||
| //             SizedBox(width: 8), | ||||
| //             SvgPicture.asset(icon, height: 20, width: 20, color: isSelected ? Colors.white : ColorConsts.textGrey), | ||||
| //           ], | ||||
| //         ), | ||||
| //       ), | ||||
| //     ); | ||||
| //   } | ||||
| // } | ||||
| @ -0,0 +1,101 @@ | ||||
| // import 'package:flutter/cupertino.dart'; | ||||
| // import 'package:flutter/material.dart'; | ||||
| // import 'package:flutter/rendering.dart'; | ||||
| // import 'package:tangheem/classes/colors.dart'; | ||||
| // import 'package:tangheem/classes/utils.dart'; | ||||
| // import 'package:tangheem/widgets/common_textfield_widget.dart'; | ||||
| // | ||||
| // class ChangePasswordDialog extends StatefulWidget { | ||||
| //   final Function(String) onPassword; | ||||
| // | ||||
| //   ChangePasswordDialog({Key key, this.onPassword}) : super(key: key); | ||||
| // | ||||
| //   @override | ||||
| //   _ChangePasswordDialogState createState() { | ||||
| //     return _ChangePasswordDialogState(); | ||||
| //   } | ||||
| // } | ||||
| // | ||||
| // class _ChangePasswordDialogState extends State<ChangePasswordDialog> { | ||||
| //   final TextEditingController _passwordController = TextEditingController(); | ||||
| //   final TextEditingController _confirmPasswordController = TextEditingController(); | ||||
| // | ||||
| //   @override | ||||
| //   void initState() { | ||||
| //     super.initState(); | ||||
| //   } | ||||
| // | ||||
| //   @override | ||||
| //   void dispose() { | ||||
| //     super.dispose(); | ||||
| //   } | ||||
| // | ||||
| //   @override | ||||
| //   Widget build(BuildContext context) { | ||||
| //     return Dialog( | ||||
| //       insetPadding: EdgeInsets.symmetric(horizontal: 60.0, vertical: 24.0), | ||||
| //       shape: RoundedRectangleBorder( | ||||
| //         borderRadius: BorderRadius.circular(12), | ||||
| //       ), | ||||
| //       elevation: 0, | ||||
| //       backgroundColor: Colors.transparent, | ||||
| //       child: Directionality( | ||||
| //         textDirection: TextDirection.rtl, | ||||
| //         child: Container( | ||||
| //           width: double.infinity, | ||||
| //           decoration: BoxDecoration( | ||||
| //             color: ColorConsts.primaryBlue, | ||||
| //             borderRadius: BorderRadius.circular(16), | ||||
| //           ), | ||||
| //           padding: EdgeInsets.symmetric(vertical: 32, horizontal: 16), | ||||
| //           child: Column( | ||||
| //             mainAxisSize: MainAxisSize.min, | ||||
| //             children: [ | ||||
| //               Text( | ||||
| //                 "تغيير كلمة المرور", | ||||
| //                 textAlign: TextAlign.center, | ||||
| //                 style: TextStyle(color: Colors.white, fontSize: 22), | ||||
| //               ), | ||||
| //               SizedBox(height: 16), | ||||
| //               CommonTextFieldWidget(hint: "كلمة المرور الجديدة", controller: _passwordController, prefixIcon: "assets/icons/password.svg"), | ||||
| //               SizedBox(height: 8), | ||||
| //               CommonTextFieldWidget(hint: "تأكيد كلمة المرور الجديدة", controller: _confirmPasswordController, prefixIcon: "assets/icons/password.svg"), | ||||
| //               SizedBox(height: 16), | ||||
| //               SizedBox( | ||||
| //                 width: double.infinity, | ||||
| //                 height: 40, | ||||
| //                 child: TextButton( | ||||
| //                   onPressed: () { | ||||
| //                     if (_passwordController.text.length < 1) { | ||||
| //                       Utils.showToast("يرجى إاخال كلمة المرور"); | ||||
| //                       return; | ||||
| //                     } | ||||
| //                     if (_confirmPasswordController.text.length < 1) { | ||||
| //                       Utils.showToast("يرجى تأكيد كلمة المرور"); | ||||
| //                       return; | ||||
| //                     } | ||||
| //                     if (_passwordController.text != _confirmPasswordController.text) { | ||||
| //                       Utils.showToast("خطأ في تطابق كلمات المرور"); | ||||
| //                       return; | ||||
| //                     } | ||||
| //                     widget.onPassword(_passwordController.text); | ||||
| //                   }, | ||||
| //                   style: TextButton.styleFrom( | ||||
| //                     primary: Colors.white, | ||||
| //                     padding: EdgeInsets.all(2), | ||||
| //                     backgroundColor: ColorConsts.secondaryPink, | ||||
| //                     textStyle: TextStyle(fontSize: 14, fontFamily: "DroidKufi"), | ||||
| //                     shape: RoundedRectangleBorder( | ||||
| //                       borderRadius: BorderRadius.circular(6.0), | ||||
| //                     ), | ||||
| //                   ), | ||||
| //                   child: Text("إعادة تعيين كلمة المرور"), | ||||
| //                 ), | ||||
| //               ), | ||||
| //             ], | ||||
| //           ), | ||||
| //         ), | ||||
| //       ), | ||||
| //     ); | ||||
| //   } | ||||
| // } | ||||
| @ -0,0 +1,55 @@ | ||||
| // import 'package:flutter/material.dart'; | ||||
| // import 'package:tangheem/classes/colors.dart'; | ||||
| // | ||||
| // class GeneralDialog extends StatelessWidget { | ||||
| //   final String message; | ||||
| //   GeneralDialog({Key key, this.message}) : super(key: key); | ||||
| // | ||||
| //   @override | ||||
| //   Widget build(BuildContext context) { | ||||
| //     return Dialog( | ||||
| //       insetPadding: EdgeInsets.symmetric(horizontal: 60.0, vertical: 24.0), | ||||
| //       shape: RoundedRectangleBorder( | ||||
| //         borderRadius: BorderRadius.circular(12), | ||||
| //       ), | ||||
| //       elevation: 0, | ||||
| //       backgroundColor: Colors.transparent, | ||||
| //       child: Container( | ||||
| //         width: double.infinity, | ||||
| //         decoration: BoxDecoration( | ||||
| //           color: ColorConsts.primaryBlue, | ||||
| //           borderRadius: BorderRadius.circular(16), | ||||
| //         ), | ||||
| //         padding: EdgeInsets.symmetric(vertical: 32, horizontal: 16), | ||||
| //         child: Column( | ||||
| //           mainAxisSize: MainAxisSize.min, | ||||
| //           children: [ | ||||
| //             Text( | ||||
| //               message ?? "للحصول على تجربة أفضل ، يرجى إمالة هاتفك واستخدام التطبيق في الوضع الأفقي", | ||||
| //               textAlign: TextAlign.center, | ||||
| //               style: TextStyle(color: Colors.white), | ||||
| //             ), | ||||
| //             SizedBox(height: 32), | ||||
| //             SizedBox( | ||||
| //               width: double.infinity, | ||||
| //               height: 40, | ||||
| //               child: TextButton( | ||||
| //                 onPressed: () => Navigator.pop(context), | ||||
| //                 style: TextButton.styleFrom( | ||||
| //                   primary: Colors.white, | ||||
| //                   padding: EdgeInsets.all(2), | ||||
| //                   backgroundColor: ColorConsts.secondaryPink, | ||||
| //                   textStyle: TextStyle(fontSize: 14, fontFamily: "DroidKufi"), | ||||
| //                   shape: RoundedRectangleBorder( | ||||
| //                     borderRadius: BorderRadius.circular(6.0), | ||||
| //                   ), | ||||
| //                 ), | ||||
| //                 child: Text("نعم"), | ||||
| //               ), | ||||
| //             ), | ||||
| //           ], | ||||
| //         ), | ||||
| //       ), | ||||
| //     ); | ||||
| //   } | ||||
| // } | ||||
| @ -0,0 +1,58 @@ | ||||
| // import 'package:flutter/cupertino.dart'; | ||||
| // import 'package:flutter/foundation.dart'; | ||||
| // import 'package:flutter/material.dart'; | ||||
| // import 'package:flutter/rendering.dart'; | ||||
| // import 'package:tangheem/classes/colors.dart'; | ||||
| // | ||||
| // class LoadingDialog extends StatefulWidget { | ||||
| //   LoadingDialog({Key key}) : super(key: key); | ||||
| // | ||||
| //   @override | ||||
| //   _LoadingDialogState createState() { | ||||
| //     return _LoadingDialogState(); | ||||
| //   } | ||||
| // } | ||||
| // | ||||
| // class _LoadingDialogState extends State<LoadingDialog> { | ||||
| //   @override | ||||
| //   void initState() { | ||||
| //     super.initState(); | ||||
| //   } | ||||
| // | ||||
| //   @override | ||||
| //   void dispose() { | ||||
| //     super.dispose(); | ||||
| //   } | ||||
| // | ||||
| //   @override | ||||
| //   Widget build(BuildContext context) { | ||||
| //     return Dialog( | ||||
| //       insetPadding: EdgeInsets.symmetric(horizontal: 60.0, vertical: 24.0), | ||||
| //       shape: RoundedRectangleBorder( | ||||
| //         borderRadius: BorderRadius.circular(16), | ||||
| //       ), | ||||
| //       elevation: 0, | ||||
| //       backgroundColor: Colors.transparent, | ||||
| //       child: Directionality( | ||||
| //         textDirection: TextDirection.rtl, | ||||
| //         child: Center( | ||||
| //           child: Container( | ||||
| //             decoration: BoxDecoration( | ||||
| //               color: Colors.white, | ||||
| //               borderRadius: BorderRadius.circular(16), | ||||
| //             ), | ||||
| //             padding: EdgeInsets.symmetric(vertical: 12, horizontal: 12), | ||||
| //             child: SizedBox( | ||||
| //               height: 32, | ||||
| //               width: 32, | ||||
| //               child: CircularProgressIndicator( | ||||
| //                 strokeWidth: 2, | ||||
| //                 valueColor: AlwaysStoppedAnimation<Color>(ColorConsts.textGrey), | ||||
| //               ), | ||||
| //             ), | ||||
| //           ), | ||||
| //         ), | ||||
| //       ), | ||||
| //     ); | ||||
| //   } | ||||
| // } | ||||
| @ -0,0 +1,116 @@ | ||||
| // import 'package:flutter/cupertino.dart'; | ||||
| // import 'package:flutter/material.dart'; | ||||
| // import 'package:flutter/rendering.dart'; | ||||
| // import 'package:tangheem/classes/colors.dart'; | ||||
| // import 'package:tangheem/classes/utils.dart'; | ||||
| // import 'package:tangheem/widgets/otp_widget.dart'; | ||||
| // | ||||
| // class OTPDialog extends StatefulWidget { | ||||
| //   final Function(int) onOTP; | ||||
| // | ||||
| //   OTPDialog({Key key, this.onOTP}) : super(key: key); | ||||
| // | ||||
| //   @override | ||||
| //   _OTPDialogState createState() { | ||||
| //     return _OTPDialogState(); | ||||
| //   } | ||||
| // } | ||||
| // | ||||
| // class _OTPDialogState extends State<OTPDialog> { | ||||
| //   final TextEditingController _pinPutController = TextEditingController(); | ||||
| // | ||||
| //   bool hasError = false; | ||||
| //   String errorMessage; | ||||
| //   String otpMessage = ""; | ||||
| // | ||||
| //   @override | ||||
| //   void initState() { | ||||
| //     super.initState(); | ||||
| //   } | ||||
| // | ||||
| //   @override | ||||
| //   void dispose() { | ||||
| //     super.dispose(); | ||||
| //   } | ||||
| // | ||||
| //   @override | ||||
| //   Widget build(BuildContext context) { | ||||
| //     return Dialog( | ||||
| //       insetPadding: EdgeInsets.symmetric(horizontal: 60.0, vertical: 24.0), | ||||
| //       shape: RoundedRectangleBorder( | ||||
| //         borderRadius: BorderRadius.circular(12), | ||||
| //       ), | ||||
| //       elevation: 0, | ||||
| //       backgroundColor: Colors.transparent, | ||||
| //       child: Container( | ||||
| //         width: double.infinity, | ||||
| //         decoration: BoxDecoration( | ||||
| //           color: ColorConsts.primaryBlue, | ||||
| //           borderRadius: BorderRadius.circular(16), | ||||
| //         ), | ||||
| //         padding: EdgeInsets.symmetric(vertical: 32, horizontal: 16), | ||||
| //         child: Column( | ||||
| //           mainAxisSize: MainAxisSize.min, | ||||
| //           children: [ | ||||
| //             Text( | ||||
| //               "الرجاء إدخال الرقم المرسل إلى جوالك", | ||||
| //               textAlign: TextAlign.center, | ||||
| //               style: TextStyle(color: Colors.white), | ||||
| //             ), | ||||
| //             Container( | ||||
| //               margin: EdgeInsets.only(top: 8, bottom: 8), | ||||
| //               padding: EdgeInsets.all(6), | ||||
| //               decoration: BoxDecoration( | ||||
| //                 border: Border.all(width: 1, color: Colors.white), | ||||
| //               ), | ||||
| //               child: OTPWidget( | ||||
| //                 autoFocus: true, | ||||
| //                 controller: _pinPutController, | ||||
| //                 defaultBorderColor: Colors.transparent, | ||||
| //                 maxLength: 4, | ||||
| //                 hasError: hasError, | ||||
| //                 onTextChanged: (text) { | ||||
| //                   setState(() { | ||||
| //                     hasError = false; | ||||
| //                   }); | ||||
| //                 }, | ||||
| //                 pinBoxColor: ColorConsts.secondaryWhite.withOpacity(0.2), | ||||
| //                 onDone: (text) => otpMessage = text, | ||||
| //                 textBorderColor: Colors.transparent, | ||||
| //                 pinBoxWidth: 40, | ||||
| //                 pinBoxHeight: 40, | ||||
| //                 pinTextStyle: TextStyle(fontSize: 20.0, color: Colors.white), | ||||
| //                 pinTextAnimatedSwitcherTransition: ProvidedPinBoxTextAnimation.scalingTransition, | ||||
| //                 pinTextAnimatedSwitcherDuration: Duration(milliseconds: 300), | ||||
| //                 keyboardType: TextInputType.number, | ||||
| //               ), | ||||
| //             ), | ||||
| //             SizedBox( | ||||
| //               width: double.infinity, | ||||
| //               height: 40, | ||||
| //               child: TextButton( | ||||
| //                 onPressed: () { | ||||
| //                   if (otpMessage.length < 4) { | ||||
| //                     Utils.showToast("الرقم الذي قمت بإدخاله غير صحيح"); | ||||
| //                     return; | ||||
| //                   } | ||||
| //                   widget.onOTP(int.parse(otpMessage)); | ||||
| //                 }, | ||||
| //                 style: TextButton.styleFrom( | ||||
| //                   primary: Colors.white, | ||||
| //                   padding: EdgeInsets.all(2), | ||||
| //                   backgroundColor: ColorConsts.secondaryPink, | ||||
| //                   textStyle: TextStyle(fontSize: 14, fontFamily: "DroidKufi"), | ||||
| //                   shape: RoundedRectangleBorder( | ||||
| //                     borderRadius: BorderRadius.circular(6.0), | ||||
| //                   ), | ||||
| //                 ), | ||||
| //                 child: Text("تحقق من الرقم"), | ||||
| //               ), | ||||
| //             ), | ||||
| //           ], | ||||
| //         ), | ||||
| //       ), | ||||
| //     ); | ||||
| //   } | ||||
| // } | ||||
| @ -0,0 +1,26 @@ | ||||
| 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'; | ||||
| 
 | ||||
| class NoDataUI extends StatelessWidget { | ||||
|   NoDataUI({Key? key}) : super(key: key); | ||||
| 
 | ||||
|   @override | ||||
|   Widget build(BuildContext context) { | ||||
|     return Container( | ||||
|       alignment: Alignment.center, | ||||
|       padding: const EdgeInsets.only(top: 100), | ||||
|       child: Column( | ||||
|         children: [ | ||||
|           SvgPicture.asset("assets/icons/no_data.svg", width: 75, height: 75), | ||||
|           const SizedBox(height: 8), | ||||
|           Text( | ||||
|             "لا توجد بيانات", | ||||
|             style: TextStyle(fontSize: 16, color: MyColors.darkTextColor.withOpacity(0.7), fontWeight: FontWeight.w600), | ||||
|           ), | ||||
|           const SizedBox(height: 16), | ||||
|         ], | ||||
|       ), | ||||
|     ); | ||||
|   } | ||||
| } | ||||
| @ -0,0 +1,819 @@ | ||||
| // import 'package:flutter/cupertino.dart'; | ||||
| // import 'package:flutter/material.dart'; | ||||
| // import 'package:flutter_html/flutter_html.dart'; | ||||
| // import 'package:flutter_svg/flutter_svg.dart'; | ||||
| // import 'package:shared_preferences/shared_preferences.dart'; | ||||
| // import 'package:tangheem/api/admin_configuration_api_client.dart'; | ||||
| // import 'package:tangheem/api/tangheem_user_api_client.dart'; | ||||
| // import 'package:tangheem/app_state/app_state.dart'; | ||||
| // import 'package:tangheem/classes/colors.dart'; | ||||
| // import 'package:tangheem/classes/consts.dart'; | ||||
| // import 'package:tangheem/classes/utils.dart'; | ||||
| // import 'package:tangheem/extensions/string_extensions.dart'; | ||||
| // import 'package:tangheem/models/aya_tangheem_type_mapped.dart'; | ||||
| // import 'package:tangheem/models/discussion_model.dart'; | ||||
| // import 'package:tangheem/ui/dialogs/discussion_input_dialog.dart'; | ||||
| // import 'package:tangheem/widgets/aya_player_widget.dart'; | ||||
| // import 'package:tangheem/widgets/aya_record_widget.dart'; | ||||
| // import 'package:tangheem/widgets/text_highlight_widget.dart'; | ||||
| // | ||||
| // import 'login_screen.dart'; | ||||
| // | ||||
| // class TangheemDetailParams { | ||||
| //   final String selectedTangheemTypeId; | ||||
| //   final List<AyatTangheemTypeMappedData> ayatTangheemTypeMappedDataList; | ||||
| // | ||||
| //   TangheemDetailParams({@required this.selectedTangheemTypeId, @required this.ayatTangheemTypeMappedDataList}); | ||||
| // } | ||||
| // | ||||
| // class TangheemDetailScreen extends StatefulWidget { | ||||
| //   static const String routeName = "/tangheem_detail"; | ||||
| //   final TangheemDetailParams tangheemDetailParams; | ||||
| // | ||||
| //   TangheemDetailScreen({Key key, this.tangheemDetailParams}) : super(key: key); | ||||
| // | ||||
| //   @override | ||||
| //   _TangheemDetailScreenState createState() { | ||||
| //     return _TangheemDetailScreenState(); | ||||
| //   } | ||||
| // } | ||||
| // | ||||
| // class _TangheemDetailScreenState extends State<TangheemDetailScreen> { | ||||
| //   GlobalKey _globalKey = GlobalKey(); | ||||
| // | ||||
| //   List<VoiceNote> voiceNoteList = []; | ||||
| // | ||||
| //   List<AyatTangheemTypeMappedData> ayatTangheemTypeMappedDataList = []; | ||||
| // | ||||
| //   List<AyatTangheemTypeMappedData> _dataList = []; | ||||
| // | ||||
| //   int _discussionPage = -1; | ||||
| //   AyatTangheemTypeMappedData _ayatTangheemTypeMappedFirstData; | ||||
| //   DiscussionModel _discussionModel; | ||||
| // | ||||
| //   bool showAyaPlayer = false; | ||||
| // | ||||
| //   @override | ||||
| //   void initState() { | ||||
| //     super.initState(); | ||||
| //     ayatTangheemTypeMappedDataList = widget.tangheemDetailParams.ayatTangheemTypeMappedDataList; | ||||
| //     _ayatTangheemTypeMappedFirstData = ayatTangheemTypeMappedDataList.first; | ||||
| //     filterVoiceListData(); | ||||
| //     getPrefs(); | ||||
| //     getTangheemDiscussionAndRelatedData(); | ||||
| //   } | ||||
| // | ||||
| //   double fontSize = 18; | ||||
| // | ||||
| //   SharedPreferences prefs; | ||||
| // | ||||
| //   void getPrefs() async { | ||||
| //     prefs = await SharedPreferences.getInstance(); | ||||
| //     fontSize = (prefs.getInt(GlobalConsts.fontZoomSize) ?? 18) + 0.0; | ||||
| //     setState(() {}); | ||||
| //   } | ||||
| // | ||||
| //   String getArabicIndexWord(int index) { | ||||
| //     if (index == 0) { | ||||
| //       return 'الأولى'; | ||||
| //     } else if (index == 1) { | ||||
| //       return 'الثانية'; | ||||
| //     } else if (index == 2) { | ||||
| //       return 'الثالثة'; | ||||
| //     } else if (index == 3) { | ||||
| //       return 'الرابعة'; | ||||
| //     } else if (index == 4) { | ||||
| //       return 'الخامسة'; | ||||
| //     } | ||||
| //     return ""; | ||||
| //   } | ||||
| // | ||||
| //   void getTangheemDiscussionAndRelatedData() async { | ||||
| //     Utils.showLoading(context); | ||||
| //     try { | ||||
| //       _discussionModel = await TangheemUserApiClient().getDiscussionByTangheemID(_discussionPage, widget.tangheemDetailParams.selectedTangheemTypeId); | ||||
| //       if (!_ayatTangheemTypeMappedFirstData.ayatNumberInSurahs.contains(",")) { | ||||
| //         _dataList = await getTangheemRelatedData(); | ||||
| //       } | ||||
| //       Utils.hideLoading(context); | ||||
| //       setState(() {}); | ||||
| //     } catch (ex) { | ||||
| //       print(ex); | ||||
| //       Utils.handleException(ex, null); | ||||
| //       Utils.hideLoading(context); | ||||
| //     } | ||||
| //   } | ||||
| // | ||||
| //   Future<List<AyatTangheemTypeMappedData>> getTangheemRelatedData() async { | ||||
| //     _dataList = []; | ||||
| //     AyatTangheemTypeMapped _ayatTangheemTypeMapped = | ||||
| //         await TangheemUserApiClient().getAyaTangheemTypeMappedRelated(_ayatTangheemTypeMappedFirstData.surahNo, _ayatTangheemTypeMappedFirstData.ayatNumberInSurahs); | ||||
| //     _dataList = _ayatTangheemTypeMapped?.data ?? []; | ||||
| //     if (_dataList.isNotEmpty) { | ||||
| //       _dataList = _dataList.where((element) => element.tangheemTypeId != _ayatTangheemTypeMappedFirstData.tangheemTypeId)?.toList() ?? []; | ||||
| //       var _tempList = _dataList.map((e) => e.tangheemTypeId).toList().toSet().toList(); | ||||
| //       var _dataTempList = <AyatTangheemTypeMappedData>[]; | ||||
| //       _tempList.forEach((_tempElement) { | ||||
| //         _dataTempList.add(_dataList.firstWhere((element) { | ||||
| //           return !element.ayatNumberInSurahs.contains(",") && (element.tangheemTypeId == _tempElement); | ||||
| //         }, orElse: null)); | ||||
| //       }); | ||||
| //       _dataList = _dataTempList; | ||||
| //     } | ||||
| // | ||||
| //     return _dataList; | ||||
| //   } | ||||
| // | ||||
| //   void sendComment(String discussionText) async { | ||||
| //     Utils.showLoading(context); | ||||
| //     try { | ||||
| //       await AdminConfigurationApiClient().addDiscussion(discussionText, _ayatTangheemTypeMappedFirstData.ayaTangheemTypeId); | ||||
| //       Utils.showToast("تم إرسال التعليق ، سيكون مرئيًا بمجرد موافقة المسؤول عليه"); | ||||
| //       Utils.hideLoading(context); | ||||
| //       Navigator.pop(context); | ||||
| //     } catch (ex) { | ||||
| //       Utils.handleException(ex, null); | ||||
| //       Utils.hideLoading(context); | ||||
| //     } | ||||
| //   } | ||||
| // | ||||
| //   void filterVoiceListData() { | ||||
| //     ayatTangheemTypeMappedDataList.forEach((element) { | ||||
| //       voiceNoteList.addAll(element.voiceNote); | ||||
| //     }); | ||||
| //   } | ||||
| // | ||||
| //   @override | ||||
| //   void dispose() { | ||||
| //     super.dispose(); | ||||
| //   } | ||||
| // | ||||
| //   @override | ||||
| //   Widget build(BuildContext context) { | ||||
| //     return Container( | ||||
| //       padding: EdgeInsets.fromLTRB(16, 0, 16, 0), | ||||
| //       width: double.infinity, | ||||
| //       child: _ayatTangheemTypeMappedFirstData == null | ||||
| //           ? SizedBox() | ||||
| //           : Column( | ||||
| //               crossAxisAlignment: CrossAxisAlignment.start, | ||||
| //               children: [ | ||||
| //                 Expanded( | ||||
| //                   child: ListView( | ||||
| //                     physics: BouncingScrollPhysics(), | ||||
| //                     padding: EdgeInsets.only(bottom: 16, top: 16), | ||||
| //                     children: [ | ||||
| //                       Text( | ||||
| //                         _ayatTangheemTypeMappedFirstData.tangheemTypeName ?? "", | ||||
| //                         style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20, color: ColorConsts.primaryBlue, height: 1.5), | ||||
| //                       ), | ||||
| //                       SizedBox(height: 8), | ||||
| //                       Text( | ||||
| //                         _ayatTangheemTypeMappedFirstData.tangheemTypeDescription ?? "", | ||||
| //                         style: TextStyle(fontSize: 14, color: ColorConsts.textGrey, height: 1), | ||||
| //                       ), | ||||
| //                       SizedBox(height: 8), | ||||
| //                       Container( | ||||
| //                         margin: EdgeInsets.only(top: 4, bottom: 4), | ||||
| //                         padding: EdgeInsets.only(top: 8, bottom: 8, right: 4, left: 4), | ||||
| //                         decoration: BoxDecoration( | ||||
| //                           color: Colors.white, | ||||
| //                           borderRadius: BorderRadius.circular(8), | ||||
| //                         ), | ||||
| //                         child: SingleChildScrollView( | ||||
| //                           physics: NeverScrollableScrollPhysics(), | ||||
| //                           child: RepaintBoundary( | ||||
| //                             key: _globalKey, | ||||
| //                             child: Material( | ||||
| //                               color: Colors.white, | ||||
| //                               child: ListView.builder( | ||||
| //                                   physics: NeverScrollableScrollPhysics(), | ||||
| //                                   shrinkWrap: true, | ||||
| //                                   itemCount: ayatTangheemTypeMappedDataList.length > 5 ? 5 : ayatTangheemTypeMappedDataList.length, | ||||
| //                                   itemBuilder: (context, index) { | ||||
| //                                     var _ayatTangheemTypeMappedData = ayatTangheemTypeMappedDataList[index]; | ||||
| //                                     List<TangheemProperty> _tangheemInsideTableList = []; | ||||
| //                                     List<TangheemProperty> _tangheemAboveTableList = []; | ||||
| //                                     List<TangheemProperty> _tangheemBelowTableList = []; | ||||
| //                                     List<String> _tangheemWords = []; | ||||
| // | ||||
| //                                     List<TangheemProperty> _tempPropertyList = List<TangheemProperty>() + _ayatTangheemTypeMappedData?.property ?? []; | ||||
| //                                     int firstIndex = _tempPropertyList.indexWhere((element) => element.isInsideTable); | ||||
| //                                     if (firstIndex >= 0) { | ||||
| //                                       var _tempPropertyListTop = _tempPropertyList.take(firstIndex); | ||||
| //                                       _tempPropertyListTop = _tempPropertyListTop.where((element) => (element.propertyValue ?? "").isNotEmpty)?.toList() ?? []; | ||||
| //                                       _tangheemAboveTableList = _tempPropertyListTop; | ||||
| //                                       _tempPropertyListTop.forEach((element) { | ||||
| //                                         _tempPropertyList.remove(element); | ||||
| //                                       }); | ||||
| //                                       var _tempPropertyListInside = _tempPropertyList?.where((element) => (element.isInsideTable))?.toList() ?? []; | ||||
| //                                       _tempPropertyListInside.forEach((element) { | ||||
| //                                         _tempPropertyList.remove(element); | ||||
| //                                       }); | ||||
| //                                       _tempPropertyListInside = _tempPropertyListInside.where((element) => (element.propertyValue ?? "").isNotEmpty)?.toList() ?? []; | ||||
| //                                       _tangheemInsideTableList = _tempPropertyListInside; | ||||
| //                                       var _tempPropertyListBelow = _tempPropertyList; | ||||
| //                                       _tempPropertyListBelow = _tempPropertyListBelow.where((element) => (element.propertyValue ?? "").isNotEmpty)?.toList() ?? []; | ||||
| //                                       _tangheemBelowTableList = _tempPropertyListBelow; | ||||
| //                                     } | ||||
| // | ||||
| //                                     _tangheemWords.add(_ayatTangheemTypeMappedData.highlightText ?? ""); | ||||
| //                                     // _tangheemInsideTableList = | ||||
| //                                     //     _ayatTangheemTypeMappedData?.property?.where((element) => (element.isInsideTable) && (element.propertyValue ?? "").isNotEmpty)?.toList() ?? []; | ||||
| //                                     // _tangheemAboveTableList = | ||||
| //                                     //     _ayatTangheemTypeMappedData?.property?.where((element) => (!element.isInsideTable) && (element.propertyValue ?? "").isNotEmpty)?.toList() ?? []; | ||||
| //                                     // | ||||
| //                                     // | ||||
| // | ||||
| //                                     var _tempTangheemIndexWord = ""; | ||||
| //                                     if (ayatTangheemTypeMappedDataList.length == 1) { | ||||
| //                                       _tempTangheemIndexWord = ""; | ||||
| //                                     } else { | ||||
| //                                       _tempTangheemIndexWord = getArabicIndexWord(index) + " "; | ||||
| //                                     } | ||||
| // | ||||
| //                                     return ListView( | ||||
| //                                       physics: NeverScrollableScrollPhysics(), | ||||
| //                                       shrinkWrap: true, | ||||
| //                                       padding: EdgeInsets.all(4), | ||||
| //                                       children: [ | ||||
| //                                         Row( | ||||
| //                                           children: [ | ||||
| //                                             Text( | ||||
| //                                               " جملة ${_ayatTangheemTypeMappedData.tangheemTypeName} $_tempTangheemIndexWord", | ||||
| //                                               style: TextStyle(fontWeight: FontWeight.bold, color: Colors.white, backgroundColor: ColorConsts.primaryBlue), | ||||
| //                                             ), | ||||
| //                                             Expanded( | ||||
| //                                               child: Container(height: 2, color: ColorConsts.primaryBlue), | ||||
| //                                             ), | ||||
| //                                           ], | ||||
| //                                         ), | ||||
| //                                         SizedBox(height: 8), | ||||
| //                                         TextHighLightWidget( | ||||
| //                                           text: _ayatTangheemTypeMappedData.reverseAyatNumber() ?? "", | ||||
| //                                           valueColor: ColorConsts.primaryBlue, | ||||
| //                                           highlights: _tangheemWords, | ||||
| //                                           highLightFontSize: fontSize, | ||||
| //                                           style: TextStyle( | ||||
| //                                             fontFamily: "UthmanicHafs", | ||||
| //                                             fontSize: fontSize, | ||||
| //                                             fontWeight: FontWeight.bold, | ||||
| //                                           ), | ||||
| //                                         ), | ||||
| //                                         SizedBox(height: 16), | ||||
| //                                         ListView.separated( | ||||
| //                                             itemCount: _tangheemAboveTableList.length, | ||||
| //                                             physics: NeverScrollableScrollPhysics(), | ||||
| //                                             shrinkWrap: true, | ||||
| //                                             separatorBuilder: (context, index) { | ||||
| //                                               return Divider( | ||||
| //                                                 color: Colors.white, | ||||
| //                                                 height: 4, | ||||
| //                                                 thickness: 0, | ||||
| //                                               ); | ||||
| //                                             }, | ||||
| //                                             itemBuilder: (context, index) { | ||||
| //                                               return Row( | ||||
| //                                                 children: [ | ||||
| //                                                   Expanded( | ||||
| //                                                     child: Container( | ||||
| //                                                       height: 40, | ||||
| //                                                       padding: EdgeInsets.only(left: 4, right: 8), | ||||
| //                                                       alignment: Alignment.centerRight, | ||||
| //                                                       child: Text( | ||||
| //                                                         _tangheemAboveTableList[index].propertyText, | ||||
| //                                                         maxLines: 1, | ||||
| //                                                         style: TextStyle(fontWeight: FontWeight.bold, color: ColorConsts.secondaryOrange), | ||||
| //                                                       ), | ||||
| //                                                       color: ColorConsts.secondaryWhite, | ||||
| //                                                     ), | ||||
| //                                                   ), | ||||
| //                                                   SizedBox(width: 4), | ||||
| //                                                   Expanded( | ||||
| //                                                     child: Container( | ||||
| //                                                       color: ColorConsts.secondaryWhite, | ||||
| //                                                       padding: EdgeInsets.all(4), | ||||
| //                                                       child: Container( | ||||
| //                                                         color: Colors.white, | ||||
| //                                                         padding: EdgeInsets.only(left: 4, right: 8), | ||||
| //                                                         //   alignment: Alignment.centerRight, | ||||
| //                                                         child: Html( | ||||
| //                                                           data: _tangheemAboveTableList[index]?.propertyValue ?? "", | ||||
| //                                                           style: { | ||||
| //                                                             'html': Style(textAlign: TextAlign.left), | ||||
| //                                                           }, | ||||
| //                                                         ), | ||||
| // | ||||
| //                                                         // Text( | ||||
| //                                                         //   _tangheemAboveTableList[index].propertyValue, | ||||
| //                                                         //   maxLines: 1, | ||||
| //                                                         //   style: TextStyle( | ||||
| //                                                         //     color: Color( | ||||
| //                                                         //       Utils.stringToHex(_tangheemAboveTableList[index].textColor), | ||||
| //                                                         //     ), | ||||
| //                                                         //   ), | ||||
| //                                                         // ), | ||||
| //                                                       ), | ||||
| //                                                     ), | ||||
| //                                                   ) | ||||
| //                                                 ], | ||||
| //                                               ); | ||||
| //                                             }), | ||||
| //                                         if (_tangheemInsideTableList.isNotEmpty) | ||||
| //                                           Container( | ||||
| //                                             color: ColorConsts.primaryBlue, | ||||
| //                                             margin: EdgeInsets.only(top: 8, bottom: 8), | ||||
| //                                             padding: EdgeInsets.all(8), | ||||
| //                                             child: Column( | ||||
| //                                               children: [ | ||||
| //                                                 Text( | ||||
| //                                                   "خط النبر و التنغيم ل${_ayatTangheemTypeMappedData.tangheemTypeName ?? ""}", | ||||
| //                                                   style: TextStyle(fontWeight: FontWeight.bold, color: Colors.white), | ||||
| //                                                 ), | ||||
| //                                                 SizedBox(height: 8), | ||||
| //                                                 tangheemInsideTablePropertyView(_tangheemInsideTableList) | ||||
| //                                               ], | ||||
| //                                             ), | ||||
| //                                           ), | ||||
| //                                         tangheemOutSideTablePropertyView(_tangheemBelowTableList) | ||||
| //                                       ], | ||||
| //                                     ); | ||||
| //                                   }), | ||||
| //                             ), | ||||
| //                           ), | ||||
| //                         ), | ||||
| //                       ), | ||||
| //                       SizedBox(height: 8), | ||||
| //                       discussionView(_discussionModel?.data ?? []), | ||||
| //                       if (_dataList.isNotEmpty) | ||||
| //                         Container( | ||||
| //                           margin: EdgeInsets.only(top: 8), | ||||
| //                           padding: EdgeInsets.only(bottom: 20), | ||||
| //                           width: double.infinity, | ||||
| //                           decoration: BoxDecoration( | ||||
| //                             color: Colors.white, | ||||
| //                             borderRadius: BorderRadius.circular(8), | ||||
| //                           ), | ||||
| //                           child: Column( | ||||
| //                             children: [ | ||||
| //                               Container( | ||||
| //                                 height: 60, | ||||
| //                                 width: double.infinity, | ||||
| //                                 margin: EdgeInsets.only(bottom: 8), | ||||
| //                                 alignment: Alignment.center, | ||||
| //                                 decoration: BoxDecoration( | ||||
| //                                   color: ColorConsts.primaryBlue, | ||||
| //                                   borderRadius: BorderRadius.only( | ||||
| //                                     topLeft: Radius.circular(8), | ||||
| //                                     topRight: Radius.circular(8), | ||||
| //                                   ), | ||||
| //                                 ), | ||||
| //                                 child: Text( | ||||
| //                                   "قائمة الأساليب اللغوية في هذه الآية", | ||||
| //                                   style: TextStyle(fontSize: 16, color: Colors.white), | ||||
| //                                 ), | ||||
| //                               ), | ||||
| //                               ListView.separated( | ||||
| //                                 padding: EdgeInsets.fromLTRB(4, 8, 4, 4), | ||||
| //                                 shrinkWrap: true, | ||||
| //                                 physics: NeverScrollableScrollPhysics(), | ||||
| //                                 itemCount: _dataList.length, | ||||
| //                                 separatorBuilder: (context, index) => SizedBox(height: 16), | ||||
| //                                 itemBuilder: (context, index) { | ||||
| //                                   return InkWell( | ||||
| //                                     onTap: () { | ||||
| //                                       List<AyatTangheemTypeMappedData> list = _dataList; | ||||
| //                                       var removedData = list[index]; | ||||
| //                                       list.remove(removedData); | ||||
| //                                       list.insert(0, removedData); | ||||
| //                                       TangheemDetailParams tangheem = TangheemDetailParams(selectedTangheemTypeId: _dataList[index].ayaTangheemTypeId, ayatTangheemTypeMappedDataList: list); | ||||
| //                                       Navigator.pushNamed(context, TangheemDetailScreen.routeName, arguments: tangheem); | ||||
| //                                     }, | ||||
| //                                     child: Text( | ||||
| //                                       _dataList[index].tangheemTypeName, | ||||
| //                                       style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16, color: ColorConsts.secondaryOrange, height: 1.5), | ||||
| //                                     ), | ||||
| //                                   ); | ||||
| //                                 }, | ||||
| //                               ), | ||||
| //                             ], | ||||
| //                           ), | ||||
| //                         ), | ||||
| //                       SizedBox(height: 16), | ||||
| //                       AyaRecordWidget() | ||||
| //                     ], | ||||
| //                   ), | ||||
| //                 ), | ||||
| //                 if (MediaQuery.of(context).orientation == Orientation.portrait) | ||||
| //                   AyaPlayerWidget( | ||||
| //                       surahName: _ayatTangheemTypeMappedFirstData?.surahNameAr ?? "", | ||||
| //                       ayaTangheemTypeId: _ayatTangheemTypeMappedFirstData?.ayaTangheemTypeId ?? "", | ||||
| //                       globalKey: _globalKey, | ||||
| //                       ayaNo: _ayatTangheemTypeMappedFirstData?.ayahNo, | ||||
| //                       surahNo: _ayatTangheemTypeMappedFirstData?.surahNo, | ||||
| //                       voiceNoteList: voiceNoteList), | ||||
| //                 if (MediaQuery.of(context).orientation == Orientation.landscape) | ||||
| //                   Column( | ||||
| //                     mainAxisSize: MainAxisSize.min, | ||||
| //                     crossAxisAlignment: CrossAxisAlignment.start, | ||||
| //                     children: [ | ||||
| //                       Container( | ||||
| //                         height: 24, | ||||
| //                         margin: EdgeInsets.only(bottom: 8, top: 8), | ||||
| //                         // color: Colors.transparent, | ||||
| //                         child: TextButton( | ||||
| //                           onPressed: () { | ||||
| //                             setState(() { | ||||
| //                               showAyaPlayer = !showAyaPlayer; | ||||
| //                             }); | ||||
| //                           }, | ||||
| //                           child: Text( | ||||
| //                             showAyaPlayer ? "إخفاء التسجيلات" : "إظهار التسجيلات", | ||||
| //                             style: TextStyle(color: Colors.black87, fontSize: 12), | ||||
| //                           ), | ||||
| //                           style: TextButton.styleFrom( | ||||
| //                             backgroundColor: ColorConsts.gradientOrange, | ||||
| //                             primary: ColorConsts.primaryBlue, | ||||
| //                             padding: EdgeInsets.only(top: 4, bottom: 4, right: 8, left: 8), | ||||
| //                             textStyle: TextStyle(color: Colors.white, fontSize: 12), | ||||
| //                           ), | ||||
| //                         ), | ||||
| //                       ), | ||||
| //                       if (showAyaPlayer) | ||||
| //                         AyaPlayerWidget( | ||||
| //                             surahName: _ayatTangheemTypeMappedFirstData?.surahNameAr ?? "", | ||||
| //                             ayaTangheemTypeId: _ayatTangheemTypeMappedFirstData?.ayaTangheemTypeId ?? "", | ||||
| //                             ayaNo: _ayatTangheemTypeMappedFirstData?.ayahNo, | ||||
| //                             surahNo: _ayatTangheemTypeMappedFirstData?.surahNo, | ||||
| //                             globalKey: _globalKey, | ||||
| //                             voiceNoteList: voiceNoteList), | ||||
| //                     ], | ||||
| //                   ) | ||||
| //               ], | ||||
| //             ), | ||||
| //     ); | ||||
| //   } | ||||
| // | ||||
| //   Widget nextOptionButton(String icon, String text, VoidCallback onPressed) { | ||||
| //     return InkWell( | ||||
| //       onTap: onPressed, | ||||
| //       child: onPressed == null | ||||
| //           ? SizedBox() | ||||
| //           : Row( | ||||
| //               crossAxisAlignment: CrossAxisAlignment.center, | ||||
| //               mainAxisSize: MainAxisSize.min, | ||||
| //               children: [ | ||||
| //                 SvgPicture.asset(icon, height: 12, width: 12), | ||||
| //                 SizedBox(width: 4), | ||||
| //                 Text( | ||||
| //                   text, | ||||
| //                   style: TextStyle(color: ColorConsts.textGrey), | ||||
| //                 ), | ||||
| //               ], | ||||
| //             ), | ||||
| //     ); | ||||
| //   } | ||||
| // | ||||
| //   Widget previousOptionButton(String icon, String text, VoidCallback onPressed) { | ||||
| //     return InkWell( | ||||
| //       onTap: onPressed, | ||||
| //       child: onPressed == null | ||||
| //           ? SizedBox() | ||||
| //           : Row( | ||||
| //               crossAxisAlignment: CrossAxisAlignment.center, | ||||
| //               mainAxisSize: MainAxisSize.min, | ||||
| //               children: [ | ||||
| //                 Text( | ||||
| //                   text, | ||||
| //                   style: TextStyle(color: ColorConsts.textGrey), | ||||
| //                 ), | ||||
| //                 SizedBox(width: 4), | ||||
| //                 SvgPicture.asset(icon, height: 12, width: 12), | ||||
| //               ], | ||||
| //             ), | ||||
| //     ); | ||||
| //   } | ||||
| // | ||||
| //   Widget tangheemOutSideTablePropertyView(List<TangheemProperty> tangheemPropertyList) { | ||||
| //     return ListView.separated( | ||||
| //         itemCount: tangheemPropertyList.length, | ||||
| //         physics: NeverScrollableScrollPhysics(), | ||||
| //         shrinkWrap: true, | ||||
| //         separatorBuilder: (context, index) { | ||||
| //           return Divider( | ||||
| //             color: Colors.white, | ||||
| //             height: 4, | ||||
| //             thickness: 0, | ||||
| //           ); | ||||
| //         }, | ||||
| //         itemBuilder: (context, index) { | ||||
| //           return Row( | ||||
| //             children: [ | ||||
| //               Expanded( | ||||
| //                 child: Container( | ||||
| //                   height: 40, | ||||
| //                   padding: EdgeInsets.only(left: 4, right: 8), | ||||
| //                   alignment: Alignment.centerRight, | ||||
| //                   child: Text( | ||||
| //                     tangheemPropertyList[index].propertyText, | ||||
| //                     maxLines: 1, | ||||
| //                     style: TextStyle(fontWeight: FontWeight.bold, color: ColorConsts.secondaryOrange), | ||||
| //                   ), | ||||
| //                   color: ColorConsts.secondaryWhite, | ||||
| //                 ), | ||||
| //               ), | ||||
| //               SizedBox(width: 4), | ||||
| //               Expanded( | ||||
| //                 child: Container( | ||||
| //                   color: ColorConsts.secondaryWhite, | ||||
| //                   padding: EdgeInsets.all(4), | ||||
| //                   child: Container( | ||||
| //                     color: Colors.white, | ||||
| //                     padding: EdgeInsets.only(left: 4, right: 8), | ||||
| //                     //  alignment: Alignment.centerRight, | ||||
| //                     child: Html( | ||||
| //                       data: tangheemPropertyList[index]?.propertyValue ?? "", | ||||
| //                       style: { | ||||
| //                         'html': Style(textAlign: TextAlign.left), | ||||
| //                       }, | ||||
| //                     ), | ||||
| //                     // Text( | ||||
| //                     //   tangheemPropertyList[index].propertyValue, | ||||
| //                     //   maxLines: 1, | ||||
| //                     //   style: TextStyle( | ||||
| //                     //     color: Color( | ||||
| //                     //       Utils.stringToHex(tangheemPropertyList[index].textColor), | ||||
| //                     //     ), | ||||
| //                     //   ), | ||||
| //                     // ), | ||||
| //                   ), | ||||
| //                 ), | ||||
| //               ) | ||||
| //             ], | ||||
| //           ); | ||||
| //         }); | ||||
| //   } | ||||
| // | ||||
| //   Widget tangheemInsideTablePropertyView(List<TangheemProperty> tangheemPropertyList) { | ||||
| //     return Container( | ||||
| //         color: Colors.white, | ||||
| //         padding: EdgeInsets.all(2), | ||||
| //         child: Row( | ||||
| //           children: [ | ||||
| //             for (var property in tangheemPropertyList) | ||||
| //               Expanded( | ||||
| //                 child: Container( | ||||
| //                   //  color: ColorConsts.secondaryWhite, | ||||
| //                   //  padding: EdgeInsets.all(8), | ||||
| //                   margin: EdgeInsets.only(left: 2, right: 2), | ||||
| //                   child: Column( | ||||
| //                     mainAxisSize: MainAxisSize.min, | ||||
| //                     crossAxisAlignment: CrossAxisAlignment.start, | ||||
| //                     mainAxisAlignment: MainAxisAlignment.center, | ||||
| //                     children: [ | ||||
| //                       Container( | ||||
| //                         color: ColorConsts.secondaryWhite, | ||||
| //                         //height: 30, | ||||
| //                         alignment: Alignment.center, | ||||
| //                         padding: EdgeInsets.only(left: 2, right: 4), | ||||
| //                         width: double.infinity, | ||||
| //                         child: Text( | ||||
| //                           property.propertyText ?? "", | ||||
| //                           //  maxLines: 1, | ||||
| //                           style: TextStyle(fontWeight: FontWeight.bold, fontSize: 12, color: ColorConsts.secondaryOrange), | ||||
| //                         ), | ||||
| //                       ), | ||||
| //                       Container(width: double.infinity, height: 4, color: Colors.white), | ||||
| //                       Container( | ||||
| //                         color: ColorConsts.secondaryWhite, | ||||
| //                         padding: EdgeInsets.all(4), | ||||
| //                         child: Container( | ||||
| //                           color: Colors.white, | ||||
| //                           padding: EdgeInsets.only(left: 2, right: 4), | ||||
| //                           width: double.infinity, | ||||
| //                           child: Html( | ||||
| //                             data: property.propertyValue ?? "", | ||||
| //                             style: { | ||||
| //                               'html': Style(textAlign: TextAlign.left), | ||||
| //                             }, | ||||
| //                           ), | ||||
| // | ||||
| //                           // Text( | ||||
| //                           //   property.propertyValue ?? "", | ||||
| //                           //   maxLines: 1, | ||||
| //                           //   style: TextStyle( | ||||
| //                           //     fontSize: 12, | ||||
| //                           //     color: Color( | ||||
| //                           //       Utils.stringToHex(property.textColor), | ||||
| //                           //     ), | ||||
| //                           //   ), | ||||
| //                           // ), | ||||
| //                         ), | ||||
| //                       ), | ||||
| //                     ], | ||||
| //                   ), | ||||
| //                 ), | ||||
| //               ) | ||||
| //           ], | ||||
| //         ) | ||||
| // | ||||
| //         //@todo sikander :commented these line for later discussion | ||||
| //         // ListView.separated( | ||||
| //         //   itemCount: tangheemPropertyList.length, | ||||
| //         //   physics: NeverScrollableScrollPhysics(), | ||||
| //         //   padding: EdgeInsets.zero, | ||||
| //         //   shrinkWrap: true, | ||||
| //         //   separatorBuilder: (context, index) { | ||||
| //         //     return Divider( | ||||
| //         //       color: Colors.white, | ||||
| //         //       height: 1, | ||||
| //         //       thickness: 0, | ||||
| //         //     ); | ||||
| //         //   }, | ||||
| //         //   itemBuilder: (context, index) { | ||||
| //         //     return Container( | ||||
| //         //       color: ColorConsts.secondaryWhite, | ||||
| //         //       padding: EdgeInsets.all(8), | ||||
| //         //       child: Column( | ||||
| //         //         mainAxisSize: MainAxisSize.min, | ||||
| //         //         crossAxisAlignment: CrossAxisAlignment.start, | ||||
| //         //         mainAxisAlignment: MainAxisAlignment.center, | ||||
| //         //         children: [ | ||||
| //         //           Text( | ||||
| //         //             tangheemPropertyList[index].propertyText ?? "", | ||||
| //         //             style: TextStyle(fontWeight: FontWeight.bold, fontSize: 12, color: ColorConsts.secondaryOrange), | ||||
| //         //           ), | ||||
| //         //           SizedBox(height: 4), | ||||
| //         //           Text( | ||||
| //         //             tangheemPropertyList[index].propertyValue ?? "", | ||||
| //         //             style: TextStyle( | ||||
| //         //               fontSize: 12, | ||||
| //         //               color: Color( | ||||
| //         //                 Utils.stringToHex(tangheemPropertyList[index].textColor), | ||||
| //         //               ), | ||||
| //         //             ), | ||||
| //         //           ), | ||||
| //         //         ], | ||||
| //         //       ), | ||||
| //         //     ); | ||||
| //         //   }, | ||||
| //         // ), | ||||
| //         ); | ||||
| //   } | ||||
| // | ||||
| //   Widget discussionView(List<DiscussionModelData> _discussionList) { | ||||
| //     _discussionList = _discussionList.where((element) => element.status.toLowerCase() == "Accept".toLowerCase()).toList(); | ||||
| //     return Stack( | ||||
| //       alignment: Alignment.bottomCenter, | ||||
| //       children: [ | ||||
| //         Container( | ||||
| //           margin: EdgeInsets.only(top: 4, bottom: 25), | ||||
| //           padding: EdgeInsets.all(8), | ||||
| //           width: double.infinity, | ||||
| //           decoration: BoxDecoration( | ||||
| //             color: Colors.white, | ||||
| //             borderRadius: BorderRadius.circular(8), | ||||
| //           ), | ||||
| //           child: _discussionList.length > 0 | ||||
| //               ? ListView.separated( | ||||
| //                   padding: EdgeInsets.only(top: 4, bottom: 24), | ||||
| //                   shrinkWrap: true, | ||||
| //                   physics: NeverScrollableScrollPhysics(), | ||||
| //                   itemCount: _discussionList.length, | ||||
| //                   separatorBuilder: (context, index) => SizedBox(height: 16), | ||||
| //                   itemBuilder: (context, index) { | ||||
| //                     return Column( | ||||
| //                       crossAxisAlignment: CrossAxisAlignment.start, | ||||
| //                       mainAxisSize: MainAxisSize.min, | ||||
| //                       children: [ | ||||
| //                         Row( | ||||
| //                           children: [ | ||||
| //                             SvgPicture.asset( | ||||
| //                               "assets/icons/chat_user.svg", | ||||
| //                               width: 60, | ||||
| //                               height: 60, | ||||
| //                             ), | ||||
| //                             SizedBox(width: 8), | ||||
| //                             Column( | ||||
| //                               crossAxisAlignment: CrossAxisAlignment.start, | ||||
| //                               mainAxisAlignment: MainAxisAlignment.center, | ||||
| //                               children: [ | ||||
| //                                 Text( | ||||
| //                                   "تعليق على الآية ${_ayatTangheemTypeMappedFirstData.ayatNumberInSurahs}", | ||||
| //                                   style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16, color: ColorConsts.primaryBlue, height: 1.5), | ||||
| //                                 ), | ||||
| //                                 SizedBox(height: 4), | ||||
| //                                 Directionality( | ||||
| //                                   textDirection: TextDirection.ltr, | ||||
| //                                   child: Text( | ||||
| //                                     _discussionList[index].date.toFormattedDate(), | ||||
| //                                     style: TextStyle(fontSize: 12, color: ColorConsts.textGrey, height: 1), | ||||
| //                                   ), | ||||
| //                                 ), | ||||
| //                               ], | ||||
| //                             ) | ||||
| //                           ], | ||||
| //                         ), | ||||
| //                         SizedBox(height: 4), | ||||
| //                         Column( | ||||
| //                           crossAxisAlignment: CrossAxisAlignment.start, | ||||
| //                           children: [ | ||||
| //                             Text( | ||||
| //                               "تعليق من: " + _discussionList[index].userName, | ||||
| //                               style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14, color: ColorConsts.primaryBlue, height: 1.5), | ||||
| //                             ), | ||||
| //                             Text( | ||||
| //                               _discussionList[index].discussionText, | ||||
| //                               style: TextStyle(fontSize: 14, color: ColorConsts.textGrey, height: 1.4), | ||||
| //                             ), | ||||
| //                             if ((_discussionList[index]?.adminResponse ?? "").isNotEmpty) SizedBox(height: 4), | ||||
| //                             if ((_discussionList[index]?.adminResponse ?? "").isNotEmpty) | ||||
| //                               Text( | ||||
| //                                 "رد من المسؤول: " + _discussionList[index].adminResponse, | ||||
| //                                 style: TextStyle(fontSize: 14, color: ColorConsts.textGrey, height: 1.4), | ||||
| //                               ), | ||||
| //                           ], | ||||
| //                         ) | ||||
| //                       ], | ||||
| //                     ); | ||||
| //                   }, | ||||
| //                 ) | ||||
| //               : Text( | ||||
| //                   "لا يوجد تعليقات", | ||||
| //                   style: TextStyle(fontSize: 12, color: ColorConsts.primaryBlue, height: 1.5), | ||||
| //                 ), | ||||
| //         ), | ||||
| //         Positioned( | ||||
| //           bottom: 0, | ||||
| //           child: InkWell( | ||||
| //             borderRadius: BorderRadius.circular(30), | ||||
| //             onTap: () async { | ||||
| //               if (!AppState().isUserLogin) { | ||||
| //                 Widget cancelButton = FlatButton( | ||||
| //                   child: Text("أرغب بالتسجيل"), | ||||
| //                   onPressed: () async { | ||||
| //                     Navigator.pop(context); | ||||
| //                     await Navigator.pushNamed(context, LoginScreen.routeName); | ||||
| //                     if (!AppState().isUserLogin) { | ||||
| //                       return; | ||||
| //                     } | ||||
| //                   }, | ||||
| //                 ); | ||||
| //                 Widget continueButton = FlatButton( | ||||
| //                   child: Text("استمرار كضيف"), | ||||
| //                   onPressed: () { | ||||
| //                     Navigator.pop(context); | ||||
| //                     return; | ||||
| //                   }, | ||||
| //                 ); | ||||
| // | ||||
| //                 AlertDialog alert = AlertDialog( | ||||
| //                   content: Text("هذه الخاصية متاحه فقط للأعضاء المسجلين"), | ||||
| //                   actions: [ | ||||
| //                     cancelButton, | ||||
| //                     continueButton, | ||||
| //                   ], | ||||
| //                 ); | ||||
| // | ||||
| //                 showDialog( | ||||
| //                   context: context, | ||||
| //                   builder: (BuildContext context) { | ||||
| //                     return alert; | ||||
| //                   }, | ||||
| //                 ); | ||||
| // | ||||
| //                 return; | ||||
| //               } | ||||
| //               showDialog( | ||||
| //                 context: context, | ||||
| //                 barrierColor: ColorConsts.secondaryWhite.withOpacity(0.8), | ||||
| //                 builder: (BuildContext context) => DiscussionInputDialog(onCommentPress: (comment) { | ||||
| //                   sendComment(comment); | ||||
| //                 }), | ||||
| //               ); | ||||
| //             }, | ||||
| //             child: Container( | ||||
| //               height: 40, | ||||
| //               padding: EdgeInsets.only(left: 24, right: 24), | ||||
| //               alignment: Alignment.centerRight, | ||||
| //               decoration: BoxDecoration( | ||||
| //                 borderRadius: BorderRadius.circular(30), | ||||
| //                 color: ColorConsts.gradientPink, | ||||
| //                 gradient: LinearGradient( | ||||
| //                   stops: [0.0, 0.5], | ||||
| //                   begin: Alignment.topCenter, | ||||
| //                   end: Alignment.bottomCenter, | ||||
| //                   colors: [ColorConsts.gradientPink, ColorConsts.gradientOrange], | ||||
| //                 ), | ||||
| //               ), | ||||
| //               child: Text( | ||||
| //                 "إضافة تعليق", | ||||
| //                 style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14, color: Colors.white, height: 1.5), | ||||
| //               ), | ||||
| //             ), | ||||
| //           ), | ||||
| //         ), | ||||
| //       ], | ||||
| //     ); | ||||
| //   } | ||||
| // } | ||||
| @ -0,0 +1,92 @@ | ||||
| import 'package:flutter/material.dart'; | ||||
| import 'package:mohem_flutter_app/sikander_later_will_remove_to_parent_directory/classes/colors.dart'; | ||||
| 
 | ||||
| class InputWidget extends StatelessWidget { | ||||
|   final String labelText; | ||||
|   final String hintText; | ||||
|   final TextEditingController controller; | ||||
|   final VoidCallback? suffixTap; | ||||
|   final bool isEnable; | ||||
|   final bool hasSelection; | ||||
|   final int? lines; | ||||
|   final bool isInputTypeNum; | ||||
|   final bool isObscureText; | ||||
| 
 | ||||
|   InputWidget(this.labelText, this.hintText, this.controller, | ||||
|       {this.isObscureText = false, this.suffixTap, this.isEnable = true, this.hasSelection = false, this.lines = 1, this.isInputTypeNum = false}); | ||||
| 
 | ||||
|   @override | ||||
|   Widget build(BuildContext context) { | ||||
|     return Container( | ||||
|       padding: const EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), | ||||
|       alignment: Alignment.center, | ||||
|       decoration: BoxDecoration( | ||||
|         borderRadius: BorderRadius.circular(15), | ||||
|         color: Colors.white, | ||||
|         border: Border.all( | ||||
|           color: Color(0xffefefef), | ||||
|           width: 1, | ||||
|         ), | ||||
|       ), | ||||
|       child: InkWell( | ||||
|         onTap: hasSelection ? () {} : null, | ||||
|         child: Row( | ||||
|           children: [ | ||||
|             Expanded( | ||||
|               child: Column( | ||||
|                 mainAxisSize: MainAxisSize.min, | ||||
|                 crossAxisAlignment: CrossAxisAlignment.start, | ||||
|                 children: [ | ||||
|                   Text( | ||||
|                     labelText, | ||||
|                     style: const TextStyle( | ||||
|                       fontSize: 11, | ||||
|                       fontWeight: FontWeight.w600, | ||||
|                       color: Color(0xff2B353E), | ||||
|                       letterSpacing: -0.44, | ||||
|                     ), | ||||
|                   ), | ||||
|                   TextField( | ||||
|                     enabled: isEnable, | ||||
|                     scrollPadding: EdgeInsets.zero, | ||||
|                     keyboardType: isInputTypeNum ? TextInputType.number : TextInputType.text, | ||||
|                     controller: controller, | ||||
|                     maxLines: lines, | ||||
|                     obscuringCharacter: "*", | ||||
|                     obscureText: isObscureText, | ||||
|                     onChanged: (value) => {}, | ||||
|                     style: const TextStyle( | ||||
|                       fontSize: 14, | ||||
|                       height: 21 / 14, | ||||
|                       fontWeight: FontWeight.w400, | ||||
|                       color: Color(0xff2B353E), | ||||
|                       letterSpacing: -0.44, | ||||
|                     ), | ||||
|                     decoration: InputDecoration( | ||||
|                       isDense: true, | ||||
|                       hintText: hintText, | ||||
|                       hintStyle: const TextStyle( | ||||
|                         fontSize: 14, | ||||
|                         height: 21 / 14, | ||||
|                         fontWeight: FontWeight.w400, | ||||
|                         color: Color(0xff575757), | ||||
|                         letterSpacing: -0.56, | ||||
|                       ), | ||||
|                       suffixIconConstraints: const BoxConstraints(minWidth: 50), | ||||
|                       suffixIcon: suffixTap == null ? null : IconButton(icon: const Icon(Icons.mic, color: MyColors.darkTextColor), onPressed: suffixTap), | ||||
|                       contentPadding: EdgeInsets.zero, | ||||
|                       border: InputBorder.none, | ||||
|                       focusedBorder: InputBorder.none, | ||||
|                       enabledBorder: InputBorder.none, | ||||
|                     ), | ||||
|                   ), | ||||
|                 ], | ||||
|               ), | ||||
|             ), | ||||
|             if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined), | ||||
|           ], | ||||
|         ), | ||||
|       ), | ||||
|     ); | ||||
|   } | ||||
| } | ||||
| @ -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, | ||||
| //       ); | ||||
| //     } | ||||
| //   } | ||||
| // } | ||||
| @ -0,0 +1,80 @@ | ||||
| import 'package:flutter/material.dart'; | ||||
| import 'package:flutter_svg/svg.dart'; | ||||
| 
 | ||||
| extension WithContainer on Widget { | ||||
|   Widget get insideContainer => Container(color: Colors.white, padding: const EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), child: this); | ||||
| } | ||||
| 
 | ||||
| class DefaultButton extends StatelessWidget { | ||||
|   final String text; | ||||
|   final VoidCallback? onPress; | ||||
|   final Color textColor; | ||||
|   final Color? color; | ||||
|   final Color? disabledColor; | ||||
|   final IconData? iconData; | ||||
|   final String? svgIcon; | ||||
|   final double? fontSize; | ||||
|   final bool isTextExpanded; | ||||
|   final int count; | ||||
| 
 | ||||
|   DefaultButton(this.text, this.onPress, {this.color, this.isTextExpanded = true, this.svgIcon, this.disabledColor, this.count = 0, this.textColor = Colors.white, this.iconData, this.fontSize}); | ||||
| 
 | ||||
|   @override | ||||
|   Widget build(BuildContext context) { | ||||
|     return InkWell( | ||||
|       onTap: onPress, | ||||
|       child: Container( | ||||
|         height: 43, | ||||
|         decoration: BoxDecoration( | ||||
|           borderRadius: BorderRadius.circular(6.0), | ||||
|           gradient: onPress == null | ||||
|               ? const LinearGradient(colors: [Color(0xffEAEAEA), Color(0xffEAEAEA)]) | ||||
|               : const LinearGradient(transform: GradientRotation(.83), begin: Alignment.topLeft, end: Alignment.bottomRight, colors: [ | ||||
|                   Color(0xff32D892), | ||||
|                   Color(0xff259CB8), | ||||
|                 ]), | ||||
|         ), | ||||
|         child: Row( | ||||
|           mainAxisAlignment: MainAxisAlignment.center, | ||||
|           children: [ | ||||
|             if (iconData != null) Icon(iconData, color: textColor), | ||||
|             if (svgIcon != null) SvgPicture.asset(svgIcon ?? "", color: textColor), | ||||
|             if (!isTextExpanded) | ||||
|               Padding( | ||||
|                 padding: EdgeInsets.only(left: (iconData ?? svgIcon) != null ? 6 : 0), | ||||
|                 child: Text( | ||||
|                   text, | ||||
|                   textAlign: TextAlign.center, | ||||
|                   style: TextStyle(fontSize: fontSize ?? 16, fontWeight: FontWeight.w600, color: textColor, letterSpacing: -0.48), | ||||
|                 ), | ||||
|               ), | ||||
|             if (isTextExpanded) | ||||
|               Expanded( | ||||
|                 child: Text( | ||||
|                   text, | ||||
|                   textAlign: TextAlign.center, | ||||
|                   style: TextStyle(fontSize: fontSize ?? 16, fontWeight: FontWeight.w600, color: textColor, letterSpacing: -0.48), | ||||
|                 ), | ||||
|               ), | ||||
|             if (count > 0) | ||||
|               Align( | ||||
|                 alignment: Alignment.topCenter, | ||||
|                 child: Container( | ||||
|                   margin: const EdgeInsets.only(top: 6, bottom: 6), | ||||
|                   padding: const EdgeInsets.only(left: 5, right: 5), | ||||
|                   alignment: Alignment.center, | ||||
|                   height: 16, | ||||
|                   decoration: BoxDecoration(borderRadius: BorderRadius.circular(10.0), color: Colors.white), | ||||
|                   child: Text( | ||||
|                     "$count", | ||||
|                     textAlign: TextAlign.center, | ||||
|                     style: const TextStyle(fontSize: 12, fontWeight: FontWeight.w700, color: Color(0xffD02127), letterSpacing: -0.6), | ||||
|                   ), | ||||
|                 ), | ||||
|               ) | ||||
|           ], | ||||
|         ), | ||||
|       ), | ||||
|     ); | ||||
|   } | ||||
| } | ||||
					Loading…
					
					
				
		Reference in New Issue