diff --git a/lib/api/admin_configuration_api_client.dart b/lib/api/admin_configuration_api_client.dart index c3ea326..cdd309c 100644 --- a/lib/api/admin_configuration_api_client.dart +++ b/lib/api/admin_configuration_api_client.dart @@ -6,7 +6,9 @@ import 'api_client.dart'; class AdminConfigurationApiClient { static final AdminConfigurationApiClient _instance = AdminConfigurationApiClient._internal(); + AdminConfigurationApiClient._internal(); + factory AdminConfigurationApiClient() => _instance; Future addDiscussion(String discussionText, String ayaTangheemTypeId) async { diff --git a/lib/api/api_client.dart b/lib/api/api_client.dart index 332d7ad..0a73738 100644 --- a/lib/api/api_client.dart +++ b/lib/api/api_client.dart @@ -49,7 +49,9 @@ APIException _throwAPIException(Response response) { class ApiClient { static final ApiClient _instance = ApiClient._internal(); + ApiClient._internal(); + factory ApiClient() => _instance; Future postJsonForObject(FactoryConstructor factoryConstructor, String url, T jsonObject, diff --git a/lib/api/authentication_api_client.dart b/lib/api/authentication_api_client.dart index 886688b..a390c40 100644 --- a/lib/api/authentication_api_client.dart +++ b/lib/api/authentication_api_client.dart @@ -1,10 +1,13 @@ import 'package:tangheem/classes/consts.dart'; import 'package:tangheem/models/authentication_user_model.dart'; + import 'api_client.dart'; class AuthenticationApiClient { static final AuthenticationApiClient _instance = AuthenticationApiClient._internal(); + AuthenticationApiClient._internal(); + factory AuthenticationApiClient() => _instance; Future authenticateUser(String email, String password) async { diff --git a/lib/api/tangheem_user_api_client.dart b/lib/api/tangheem_user_api_client.dart index fd55bd2..7a4a0a1 100644 --- a/lib/api/tangheem_user_api_client.dart +++ b/lib/api/tangheem_user_api_client.dart @@ -1,5 +1,7 @@ import 'dart:async'; +import 'package:tangheem/classes/consts.dart'; +import 'package:tangheem/models/aya_model.dart'; import 'package:tangheem/models/aya_tangheem_property.dart'; import 'package:tangheem/models/aya_tangheem_type.dart'; import 'package:tangheem/models/aya_tangheem_type_mapped.dart'; @@ -10,15 +12,16 @@ import 'package:tangheem/models/general_response_model.dart'; import 'package:tangheem/models/member_model.dart'; import 'package:tangheem/models/navigation_model.dart'; import 'package:tangheem/models/quick_links_model.dart'; +import 'package:tangheem/models/surah_model.dart'; import 'package:tangheem/models/tangheem_type_model.dart'; + import 'api_client.dart'; -import 'package:tangheem/classes/consts.dart'; -import 'package:tangheem/models/aya_model.dart'; -import 'package:tangheem/models/surah_model.dart'; class TangheemUserApiClient { static final TangheemUserApiClient _instance = TangheemUserApiClient._internal(); + TangheemUserApiClient._internal(); + factory TangheemUserApiClient() => _instance; Future getSurahs() async { diff --git a/lib/api/user_api_client.dart b/lib/api/user_api_client.dart index 1696b14..858cb3f 100644 --- a/lib/api/user_api_client.dart +++ b/lib/api/user_api_client.dart @@ -1,11 +1,14 @@ import 'package:tangheem/classes/consts.dart'; import 'package:tangheem/models/country_model.dart'; import 'package:tangheem/models/general_response_model.dart'; + import 'api_client.dart'; class UserApiClient { static final UserApiClient _instance = UserApiClient._internal(); + UserApiClient._internal(); + factory UserApiClient() => _instance; Future registerUser( diff --git a/lib/app_state/app_state.dart b/lib/app_state/app_state.dart index 0b6b918..1b40ebf 100644 --- a/lib/app_state/app_state.dart +++ b/lib/app_state/app_state.dart @@ -1,34 +1,45 @@ +import 'package:tangheem/models/authentication_user_model.dart'; import 'package:tangheem/models/content_info_model.dart'; import 'package:tangheem/models/navigation_model.dart'; import 'package:tangheem/models/surah_model.dart'; -import 'package:tangheem/models/authentication_user_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; } AuthenticationUserModel _authenticationUser; + bool get isUserLogin => _authenticationUser != null; + String get token => _authenticationUser?.result?.data?.token; + void setAuthenticationModel(AuthenticationUserModel _authenticationUser) { this._authenticationUser = _authenticationUser; } NavigationModel _navigationModel; + NavigationModel get getNavigationModel => _navigationModel; + void setNavigationModel(NavigationModel _navigationModel) { this._navigationModel = _navigationModel; } diff --git a/lib/classes/utils.dart b/lib/classes/utils.dart index 2349075..a897ba9 100644 --- a/lib/classes/utils.dart +++ b/lib/classes/utils.dart @@ -2,11 +2,14 @@ import 'package:flutter/material.dart'; import 'package:fluttertoast/fluttertoast.dart'; import 'package:tangheem/exceptions/api_exception.dart'; import 'package:tangheem/ui/dialogs/loading_dialog.dart'; + import 'colors.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); diff --git a/lib/exceptions/api_exception.dart b/lib/exceptions/api_exception.dart index 8c05a83..45a9bc7 100644 --- a/lib/exceptions/api_exception.dart +++ b/lib/exceptions/api_exception.dart @@ -1,4 +1,5 @@ import 'dart:convert'; + import 'package:tangheem/api/api_client.dart'; class APIException implements Exception { diff --git a/lib/main.dart b/lib/main.dart index 75f075b..5cef62a 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -7,14 +7,15 @@ import 'package:tangheem/ui/screens/contact_us_screen.dart'; import 'package:tangheem/ui/screens/content_info_screen.dart'; import 'package:tangheem/ui/screens/member_screen.dart'; import 'package:tangheem/ui/screens/pdf_viewer_screen.dart'; + +import 'classes/colors.dart'; import 'ui/common_appbar.dart'; import 'ui/screens/forgot_password_screen.dart'; import 'ui/screens/home_screen.dart'; import 'ui/screens/login_screen.dart'; -import 'ui/screens/registration_screen.dart'; import 'ui/screens/quran_screen.dart'; +import 'ui/screens/registration_screen.dart'; import 'ui/screens/tangheem_detail_screen.dart'; -import 'classes/colors.dart'; import 'ui/screens/tangheem_screen.dart'; void main() { diff --git a/lib/models/aya_tangheem_property.dart b/lib/models/aya_tangheem_property.dart index 1d7cfb0..d2f1b96 100644 --- a/lib/models/aya_tangheem_property.dart +++ b/lib/models/aya_tangheem_property.dart @@ -4,8 +4,7 @@ class AyaTangheemProperty { String message; List data; - AyaTangheemProperty( - {this.totalItemsCount, this.statusCode, this.message, this.data}); + AyaTangheemProperty({this.totalItemsCount, this.statusCode, this.message, this.data}); AyaTangheemProperty.fromJson(Map json) { totalItemsCount = json['totalItemsCount']; @@ -47,17 +46,17 @@ class AyaTangheemPropertyData { AyaTangheemPropertyData( {this.ayaTangheemTypePropertyId, - this.ayaTangheemTypeId, - this.tangheemTypePropertyId, - this.propertyValue, - this.surahNo, - this.ayaNo, - this.ayaText, - this.propertyText, - this.tangheemTypeName, - this.tangheemTypeId, - this.isInsideTable, - this.orderNo}); + this.ayaTangheemTypeId, + this.tangheemTypePropertyId, + this.propertyValue, + this.surahNo, + this.ayaNo, + this.ayaText, + this.propertyText, + this.tangheemTypeName, + this.tangheemTypeId, + this.isInsideTable, + this.orderNo}); AyaTangheemPropertyData.fromJson(Map json) { ayaTangheemTypePropertyId = json['ayaTangheemTypePropertyId']; diff --git a/lib/models/content_info_model.dart b/lib/models/content_info_model.dart index 73ddd01..172477b 100644 --- a/lib/models/content_info_model.dart +++ b/lib/models/content_info_model.dart @@ -4,8 +4,7 @@ class ContentInfoModel { String message; List data; - ContentInfoModel( - {this.totalItemsCount, this.statusCode, this.message, this.data}); + ContentInfoModel({this.totalItemsCount, this.statusCode, this.message, this.data}); ContentInfoModel.fromJson(Map json) { totalItemsCount = json['totalItemsCount']; @@ -40,14 +39,7 @@ class ContentInfoDataModel { String fileName; String exposeFilePath; - ContentInfoDataModel( - {this.contentInfoId, - this.contentTypeId, - this.content, - this.contentTypeNameEn, - this.contentTypeNameAr, - this.fileName, - this.exposeFilePath}); + ContentInfoDataModel({this.contentInfoId, this.contentTypeId, this.content, this.contentTypeNameEn, this.contentTypeNameAr, this.fileName, this.exposeFilePath}); ContentInfoDataModel.fromJson(Map json) { contentInfoId = json['contentInfoId']; diff --git a/lib/models/country_model.dart b/lib/models/country_model.dart index f72b70b..202ad83 100644 --- a/lib/models/country_model.dart +++ b/lib/models/country_model.dart @@ -4,8 +4,7 @@ class CountryModel { String message; List data; - CountryModel( - {this.totalItemsCount, this.statusCode, this.message, this.data}); + CountryModel({this.totalItemsCount, this.statusCode, this.message, this.data}); CountryModel.fromJson(Map json) { totalItemsCount = json['totalItemsCount']; @@ -38,12 +37,7 @@ class CountryModelData { String countryNameAr; String countryFlag; - CountryModelData( - {this.countryId, - this.countryCode, - this.countryNameEn, - this.countryNameAr, - this.countryFlag}); + CountryModelData({this.countryId, this.countryCode, this.countryNameEn, this.countryNameAr, this.countryFlag}); CountryModelData.fromJson(Map json) { countryId = json['countryId']; diff --git a/lib/models/discussion_model.dart b/lib/models/discussion_model.dart index a9a9b9c..8c8e834 100644 --- a/lib/models/discussion_model.dart +++ b/lib/models/discussion_model.dart @@ -4,8 +4,7 @@ class DiscussionModel { String message; List data; - DiscussionModel( - {this.totalItemsCount, this.statusCode, this.message, this.data}); + DiscussionModel({this.totalItemsCount, this.statusCode, this.message, this.data}); DiscussionModel.fromJson(Map json) { totalItemsCount = json['totalItemsCount']; @@ -48,18 +47,18 @@ class DiscussionModelData { DiscussionModelData( {this.discussionId, - this.discussionText, - this.ayaTangheemTypeId, - this.statusId, - this.status, - this.isResponse, - this.responseId, - this.userName, - this.ayaText, - this.highlightText, - this.adminResponse, - this.adminDiscussionId, - this.date}); + this.discussionText, + this.ayaTangheemTypeId, + this.statusId, + this.status, + this.isResponse, + this.responseId, + this.userName, + this.ayaText, + this.highlightText, + this.adminResponse, + this.adminDiscussionId, + this.date}); DiscussionModelData.fromJson(Map json) { discussionId = json['discussionId']; diff --git a/lib/models/member_model.dart b/lib/models/member_model.dart index cc03d21..9b5e4ba 100644 --- a/lib/models/member_model.dart +++ b/lib/models/member_model.dart @@ -38,13 +38,7 @@ class MemberDataModel { String picture; int orderNo; - MemberDataModel( - {this.committeeId, - this.firstName, - this.lastName, - this.description, - this.picture, - this.orderNo}); + MemberDataModel({this.committeeId, this.firstName, this.lastName, this.description, this.picture, this.orderNo}); MemberDataModel.fromJson(Map json) { committeeId = json['committeeId']; diff --git a/lib/models/navigation_model.dart b/lib/models/navigation_model.dart index 631e897..1707673 100644 --- a/lib/models/navigation_model.dart +++ b/lib/models/navigation_model.dart @@ -4,8 +4,7 @@ class NavigationModel { String message; List data; - NavigationModel( - {this.totalItemsCount, this.statusCode, this.message, this.data}); + NavigationModel({this.totalItemsCount, this.statusCode, this.message, this.data}); NavigationModel.fromJson(Map json) { totalItemsCount = json['totalItemsCount']; @@ -44,16 +43,7 @@ class NavigationDataModel { int roleId; NavigationDataModel( - {this.navigationId, - this.navigationText, - this.navigationUrl, - this.mobileNavigationUrl, - this.categoryName, - this.fontIcon, - this.mobileFontIcon, - this.parentId, - this.orderNo, - this.roleId}); + {this.navigationId, this.navigationText, this.navigationUrl, this.mobileNavigationUrl, this.categoryName, this.fontIcon, this.mobileFontIcon, this.parentId, this.orderNo, this.roleId}); NavigationDataModel.fromJson(Map json) { navigationId = json['navigationId']; diff --git a/lib/models/quick_links_model.dart b/lib/models/quick_links_model.dart index 6b0318b..2d3d6f8 100644 --- a/lib/models/quick_links_model.dart +++ b/lib/models/quick_links_model.dart @@ -40,15 +40,7 @@ class QuickLinksData { String fileName; String exposeFilePath; - QuickLinksData( - {this.quickLinksId, - this.displayText, - this.description, - this.imageUrl, - this.position, - this.orderNo, - this.fileName, - this.exposeFilePath}); + QuickLinksData({this.quickLinksId, this.displayText, this.description, this.imageUrl, this.position, this.orderNo, this.fileName, this.exposeFilePath}); QuickLinksData.fromJson(Map json) { quickLinksId = json['quickLinksId']; diff --git a/lib/models/surah_model.dart b/lib/models/surah_model.dart index ffb364f..52adaea 100644 --- a/lib/models/surah_model.dart +++ b/lib/models/surah_model.dart @@ -42,17 +42,7 @@ class SurahModelData { 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({this.id, this.surahID, this.nameAR, this.nameEN, this.numberOfAyahs, this.englishNameTranslation, this.revelationID, this.revelationType, this.startPageNo, this.endPageNo}); SurahModelData.fromJson(Map json) { id = json['id']; diff --git a/lib/models/tangheem_type_model.dart b/lib/models/tangheem_type_model.dart index 390c00c..dce0d9e 100644 --- a/lib/models/tangheem_type_model.dart +++ b/lib/models/tangheem_type_model.dart @@ -4,8 +4,7 @@ class TangheemType { String message; List data; - TangheemType( - {this.totalItemsCount, this.statusCode, this.message, this.data}); + TangheemType({this.totalItemsCount, this.statusCode, this.message, this.data}); TangheemType.fromJson(Map json) { totalItemsCount = json['totalItemsCount']; diff --git a/lib/ui/bottom_sheets/country_selection_bottom_sheet.dart b/lib/ui/bottom_sheets/country_selection_bottom_sheet.dart index 4fbee18..b30a531 100644 --- a/lib/ui/bottom_sheets/country_selection_bottom_sheet.dart +++ b/lib/ui/bottom_sheets/country_selection_bottom_sheet.dart @@ -6,6 +6,7 @@ import 'package:tangheem/widgets/common_textfield_widget.dart'; class CountrySelectionBottomSheet extends StatefulWidget { final List countryList; final Function(CountryModelData) onSelectCountry; + CountrySelectionBottomSheet({Key key, this.countryList, this.onSelectCountry}) : super(key: key); @override diff --git a/lib/ui/common_appbar.dart b/lib/ui/common_appbar.dart index 91d7308..ef23cc3 100644 --- a/lib/ui/common_appbar.dart +++ b/lib/ui/common_appbar.dart @@ -10,10 +10,8 @@ import 'package:tangheem/models/content_info_model.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/contact_us_screen.dart'; import 'package:tangheem/ui/screens/content_info_screen.dart'; import 'package:tangheem/ui/screens/login_screen.dart'; -import 'package:tangheem/ui/screens/quran_screen.dart'; import 'package:url_launcher/url_launcher.dart'; class CommonAppbar extends StatefulWidget { @@ -78,7 +76,7 @@ class _CommonAppbarState extends State { if (widget.showDrawer) { try { quickLinks = (await TangheemUserApiClient().quickLinks())?.data ?? []; - quickLinks = quickLinks.where((element) => element.position=="down").toList(); + quickLinks = quickLinks.where((element) => element.position == "down").toList(); quickLinks.sort((a, b) => a.orderNo.compareTo(b.orderNo)); } catch (ex) {} setState(() {}); @@ -87,6 +85,7 @@ class _CommonAppbarState extends State { int fontSize; SharedPreferences prefs; + void getPrefs() async { prefs = await SharedPreferences.getInstance(); fontSize = prefs.getInt(GlobalConsts.fontZoomSize) ?? 18; diff --git a/lib/ui/dialogs/change_password_dialog.dart b/lib/ui/dialogs/change_password_dialog.dart index 4304b51..f30135b 100644 --- a/lib/ui/dialogs/change_password_dialog.dart +++ b/lib/ui/dialogs/change_password_dialog.dart @@ -1,14 +1,13 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; -import 'package:tangheem/api/user_api_client.dart'; import 'package:tangheem/classes/colors.dart'; import 'package:tangheem/classes/utils.dart'; import 'package:tangheem/widgets/common_textfield_widget.dart'; -import 'package:tangheem/widgets/otp_widget.dart'; class ChangePasswordDialog extends StatefulWidget { final Function(String) onPassword; + ChangePasswordDialog({Key key, this.onPassword}) : super(key: key); @override diff --git a/lib/ui/dialogs/discussion_input_dialog.dart b/lib/ui/dialogs/discussion_input_dialog.dart index 03ceb49..f074c0c 100644 --- a/lib/ui/dialogs/discussion_input_dialog.dart +++ b/lib/ui/dialogs/discussion_input_dialog.dart @@ -1,14 +1,13 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; -import 'package:tangheem/api/user_api_client.dart'; import 'package:tangheem/classes/colors.dart'; import 'package:tangheem/classes/utils.dart'; import 'package:tangheem/widgets/common_textfield_widget.dart'; -import 'package:tangheem/widgets/otp_widget.dart'; class DiscussionInputDialog extends StatefulWidget { final Function(String) onCommentPress; + DiscussionInputDialog({Key key, this.onCommentPress}) : super(key: key); @override diff --git a/lib/ui/dialogs/loading_dialog.dart b/lib/ui/dialogs/loading_dialog.dart index e52cedb..11f1e4a 100644 --- a/lib/ui/dialogs/loading_dialog.dart +++ b/lib/ui/dialogs/loading_dialog.dart @@ -1,4 +1,4 @@ -import 'dart:io'; + import 'package:flutter/cupertino.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; diff --git a/lib/ui/dialogs/otp_dialog.dart b/lib/ui/dialogs/otp_dialog.dart index 89c2247..50c3629 100644 --- a/lib/ui/dialogs/otp_dialog.dart +++ b/lib/ui/dialogs/otp_dialog.dart @@ -1,13 +1,13 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; -import 'package:tangheem/api/user_api_client.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 diff --git a/lib/ui/screens/bookmark_screen.dart b/lib/ui/screens/bookmark_screen.dart index 7d96fe8..00ae99d 100644 --- a/lib/ui/screens/bookmark_screen.dart +++ b/lib/ui/screens/bookmark_screen.dart @@ -13,6 +13,7 @@ class BookmarkScreen extends StatefulWidget { final String tangheemQuery; final String tangheemTypeName; final SurahModelData surah; + BookmarkScreen({Key key, this.surah, this.tangheemQuery, this.tangheemTypeName}) : super(key: key); @override @@ -46,6 +47,7 @@ class _BookmarkScreenState extends State { // _fabColor = isOpen! ? Colors.green : Colors.blue; // }); } + void getBookMark() async { Utils.showLoading(context); _bookMarkList = await BookMarkModel.getFromPrefs(); diff --git a/lib/ui/screens/contact_us_screen.dart b/lib/ui/screens/contact_us_screen.dart index cc796da..420e27e 100644 --- a/lib/ui/screens/contact_us_screen.dart +++ b/lib/ui/screens/contact_us_screen.dart @@ -8,6 +8,7 @@ import 'package:tangheem/widgets/common_textfield_widget.dart'; class ContactUsScreen extends StatefulWidget { static const String routeName = "/contact_us"; + ContactUsScreen({Key key}) : super(key: key); @override diff --git a/lib/ui/screens/content_info_screen.dart b/lib/ui/screens/content_info_screen.dart index 7e08d32..872473d 100644 --- a/lib/ui/screens/content_info_screen.dart +++ b/lib/ui/screens/content_info_screen.dart @@ -1,4 +1,3 @@ -import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; @@ -6,12 +5,12 @@ import 'package:tangheem/api/tangheem_user_api_client.dart'; import 'package:tangheem/classes/colors.dart'; import 'package:tangheem/classes/utils.dart'; import 'package:tangheem/models/content_info_model.dart'; -import 'package:tangheem/models/member_model.dart'; import 'package:tangheem/ui/misc/no_data_ui.dart'; class ContentInfoScreen extends StatefulWidget { static const String routeName = "/content_info"; final int contentId; + ContentInfoScreen({Key key, this.contentId}) : super(key: key); @override diff --git a/lib/ui/screens/forgot_password_screen.dart b/lib/ui/screens/forgot_password_screen.dart index ed78e77..d359d07 100644 --- a/lib/ui/screens/forgot_password_screen.dart +++ b/lib/ui/screens/forgot_password_screen.dart @@ -3,11 +3,11 @@ import 'package:flutter_svg/svg.dart'; import 'package:tangheem/api/user_api_client.dart'; import 'package:tangheem/classes/colors.dart'; import 'package:tangheem/classes/utils.dart'; +import 'package:tangheem/extensions/string_extensions.dart'; import 'package:tangheem/models/general_response_model.dart'; import 'package:tangheem/ui/dialogs/change_password_dialog.dart'; import 'package:tangheem/ui/dialogs/otp_dialog.dart'; import 'package:tangheem/widgets/common_textfield_widget.dart'; -import 'package:tangheem/extensions/string_extensions.dart'; class ForgotPasswordScreen extends StatefulWidget { static const String routeName = "/forgot_password"; @@ -23,6 +23,7 @@ class ForgotPasswordScreen extends StatefulWidget { class _ForgotPasswordScreenState extends State { TextEditingController _emailController = TextEditingController(); GeneralResponseModel _generalResponse; + @override void initState() { super.initState(); diff --git a/lib/ui/screens/login_screen.dart b/lib/ui/screens/login_screen.dart index b50e2d7..7967f7b 100644 --- a/lib/ui/screens/login_screen.dart +++ b/lib/ui/screens/login_screen.dart @@ -6,11 +6,11 @@ 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/authentication_user_model.dart'; import 'package:tangheem/ui/screens/forgot_password_screen.dart'; import 'package:tangheem/ui/screens/registration_screen.dart'; import 'package:tangheem/widgets/common_textfield_widget.dart'; -import 'package:tangheem/extensions/string_extensions.dart'; class LoginScreen extends StatefulWidget { static const String routeName = "/login"; diff --git a/lib/ui/screens/member_screen.dart b/lib/ui/screens/member_screen.dart index b0e91f9..e1e7dcd 100644 --- a/lib/ui/screens/member_screen.dart +++ b/lib/ui/screens/member_screen.dart @@ -10,6 +10,7 @@ import 'package:tangheem/ui/misc/no_data_ui.dart'; class MemberScreen extends StatefulWidget { static const String routeName = "/members"; + MemberScreen({Key key}) : super(key: key); @override diff --git a/lib/ui/screens/pdf_viewer_screen.dart b/lib/ui/screens/pdf_viewer_screen.dart index f94a5a0..537021a 100644 --- a/lib/ui/screens/pdf_viewer_screen.dart +++ b/lib/ui/screens/pdf_viewer_screen.dart @@ -3,6 +3,7 @@ import 'package:syncfusion_flutter_pdfviewer/pdfviewer.dart'; class PdfViewerScreen extends StatefulWidget { static const String routeName = "/tangheem_pdf"; + PdfViewerScreen({Key key}) : super(key: key); @override @@ -13,6 +14,7 @@ class PdfViewerScreen extends StatefulWidget { class _PdfViewerScreenState extends State { final GlobalKey _pdfViewerKey = GlobalKey(); + @override void initState() { super.initState(); diff --git a/lib/ui/screens/quran_screen.dart b/lib/ui/screens/quran_screen.dart index 354daec..68effee 100644 --- a/lib/ui/screens/quran_screen.dart +++ b/lib/ui/screens/quran_screen.dart @@ -13,17 +13,15 @@ import 'package:tangheem/models/aya_model.dart'; import 'package:tangheem/models/aya_tangheem_type_mapped.dart'; import 'package:tangheem/models/bookmark_model.dart'; import 'package:tangheem/models/surah_model.dart'; -import 'package:tangheem/widgets/auto_scroll_view/aya_scroll_view.dart'; import 'package:tangheem/widgets/auto_scroll_view/scroll_id.dart'; -import 'package:tangheem/widgets/aya_player_widget.dart'; import 'package:tangheem/widgets/common_dropdown_button.dart'; -import 'package:tangheem/widgets/text_highlight_widget.dart'; import 'tangheem_detail_screen.dart'; class QuranScreen extends StatefulWidget { static const String routeName = "/quran"; final BookMarkModel bookmark; + QuranScreen({Key key, this.bookmark}) : super(key: key); @override @@ -65,6 +63,7 @@ class _QuranScreenState extends State { double fontSize = 18; SharedPreferences prefs; + void getPrefs() async { prefs = await SharedPreferences.getInstance(); fontSize = (prefs.getInt(GlobalConsts.fontZoomSize) ?? 18) + 0.0; @@ -95,6 +94,7 @@ class _QuranScreenState extends State { } List _bookMark = []; + void getBookMark() async { _bookMark = await BookMarkModel.getFromPrefs(); if (_bookMark.length == 1) { @@ -107,6 +107,7 @@ class _QuranScreenState extends State { int numberOfAyah = 0; var filteredAyahList = []; + void filterData() { numberOfAyah = _surahModel?.data[_selectedSurah]?.numberOfAyahs ?? 0; filteredAyahList = List.generate(getNextMultiple(numberOfAyah), (index) => index + 1).toList().where((element) => element == 1 || (element % 5) == 0).toList() ?? []; diff --git a/lib/ui/screens/registration_screen.dart b/lib/ui/screens/registration_screen.dart index 86ad5ed..cbdd350 100644 --- a/lib/ui/screens/registration_screen.dart +++ b/lib/ui/screens/registration_screen.dart @@ -4,10 +4,10 @@ import 'package:flutter_svg/svg.dart'; import 'package:tangheem/api/user_api_client.dart'; import 'package:tangheem/classes/colors.dart'; import 'package:tangheem/classes/utils.dart'; +import 'package:tangheem/extensions/string_extensions.dart'; import 'package:tangheem/models/country_model.dart'; import 'package:tangheem/ui/bottom_sheets/country_selection_bottom_sheet.dart'; import 'package:tangheem/widgets/common_textfield_widget.dart'; -import 'package:tangheem/extensions/string_extensions.dart'; class RegistrationScreen extends StatefulWidget { static const String routeName = "/registration"; diff --git a/lib/ui/screens/tangheem_detail_screen.dart b/lib/ui/screens/tangheem_detail_screen.dart index 55ccd43..de1d662 100644 --- a/lib/ui/screens/tangheem_detail_screen.dart +++ b/lib/ui/screens/tangheem_detail_screen.dart @@ -8,18 +8,20 @@ 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 'package:tangheem/extensions/string_extensions.dart'; + import 'login_screen.dart'; class TangheemDetailScreen extends StatefulWidget { static const String routeName = "/tangheem_detail"; final List ayatTangheemTypeMappedDataList; + // final AyatTangheemTypeMappedData ayatTangheemTypeMappedData; TangheemDetailScreen({Key key, this.ayatTangheemTypeMappedDataList}) : super(key: key); @@ -54,6 +56,7 @@ class _TangheemDetailScreenState extends State { double fontSize = 18; SharedPreferences prefs; + void getPrefs() async { prefs = await SharedPreferences.getInstance(); fontSize = (prefs.getInt(GlobalConsts.fontZoomSize) ?? 18) + 0.0; diff --git a/lib/ui/screens/tangheem_screen.dart b/lib/ui/screens/tangheem_screen.dart index b660725..aeaaed6 100644 --- a/lib/ui/screens/tangheem_screen.dart +++ b/lib/ui/screens/tangheem_screen.dart @@ -7,7 +7,6 @@ import 'package:tangheem/models/aya_tangheem_type_mapped.dart'; import 'package:tangheem/models/surah_model.dart'; import 'package:tangheem/ui/misc/no_data_ui.dart'; import 'package:tangheem/ui/screens/tangheem_detail_screen.dart'; -import 'package:tangheem/widgets/aya_record_widget.dart'; import 'package:tangheem/widgets/text_highlight_widget.dart'; class TangheemScreen extends StatefulWidget { @@ -15,6 +14,7 @@ class TangheemScreen extends StatefulWidget { final String tangheemQuery; final String tangheemTypeName; final SurahModelData surah; + TangheemScreen({Key key, this.surah, this.tangheemQuery, this.tangheemTypeName}) : super(key: key); @override diff --git a/lib/widgets/aya_player_widget.dart b/lib/widgets/aya_player_widget.dart index ff2e722..4ae46e1 100644 --- a/lib/widgets/aya_player_widget.dart +++ b/lib/widgets/aya_player_widget.dart @@ -3,6 +3,7 @@ import 'dart:io'; import 'dart:math' as math; import 'dart:typed_data'; import 'dart:ui' as ui; + import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter/services.dart'; @@ -21,6 +22,7 @@ class AyaPlayerWidget extends StatefulWidget { final String surahName; final GlobalKey globalKey; final List voiceNoteList; + AyaPlayerWidget({Key key, this.surahName, this.voiceNoteList, @required this.globalKey}) : super(key: key); @override diff --git a/lib/widgets/common_textfield_widget.dart b/lib/widgets/common_textfield_widget.dart index eecd221..3f73cea 100644 --- a/lib/widgets/common_textfield_widget.dart +++ b/lib/widgets/common_textfield_widget.dart @@ -1,4 +1,3 @@ -import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; import 'package:tangheem/classes/colors.dart'; diff --git a/lib/widgets/text_highlight_widget.dart b/lib/widgets/text_highlight_widget.dart index 932e4f6..27916f5 100644 --- a/lib/widgets/text_highlight_widget.dart +++ b/lib/widgets/text_highlight_widget.dart @@ -1,4 +1,5 @@ import 'dart:math'; + import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:tangheem/classes/colors.dart';