diff --git a/android/local.properties b/android/local.properties index c5ea3f8..a32620b 100644 --- a/android/local.properties +++ b/android/local.properties @@ -1,5 +1,5 @@ sdk.dir=/Users/sikandersaleem/Library/Android/sdk flutter.sdk=/Users/sikandersaleem/sdks/flutter -flutter.buildMode=profile +flutter.buildMode=debug flutter.versionName=1.0.0 flutter.versionCode=1 \ No newline at end of file diff --git a/lib/app_state/app_state.dart b/lib/app_state/app_state.dart index 7b77c14..34546f6 100644 --- a/lib/app_state/app_state.dart +++ b/lib/app_state/app_state.dart @@ -3,6 +3,7 @@ import 'package:tangheem/models/authentication_user_model.dart'; import 'package:tangheem/models/content_info_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'; class AppState { @@ -73,4 +74,6 @@ class AppState { List tareefAlMosasa; String tangheemDiscription; + + List quickLinks; } diff --git a/lib/new_ui/common_home_parent.dart b/lib/new_ui/common_home_parent.dart index 94a339a..38f4775 100644 --- a/lib/new_ui/common_home_parent.dart +++ b/lib/new_ui/common_home_parent.dart @@ -111,8 +111,11 @@ class _CommonHomeParentState extends State { @override Widget build(BuildContext context) { + bool isPortrait = MediaQuery.of(context).orientation == Orientation.portrait; + return Scaffold( backgroundColor: Color(0xffF4F4F4), + resizeToAvoidBottomInset: true, body: SafeArea( bottom: true, left: false, @@ -127,7 +130,7 @@ class _CommonHomeParentState extends State { mainAxisSize: MainAxisSize.min, children: [ Container( - height: 58, + height: isPortrait ? 58 : 42, decoration: BoxDecoration( borderRadius: BorderRadius.circular(29.0), color: Colors.white, @@ -136,12 +139,12 @@ class _CommonHomeParentState extends State { padding: EdgeInsets.only(left: 30, right: 30), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [for (int i = 0; i < icons.length; i++) getBottomNavigationItem(i)], + children: [for (int i = 0; i < icons.length; i++) getBottomNavigationItem(i, isPortrait ? 0 : 6)], ), ), Container( height: 26, - margin: EdgeInsets.only(top: 16), + margin: EdgeInsets.only(top: isPortrait ? 16 : 8), padding: EdgeInsets.only(right: 16, left: 12), decoration: BoxDecoration( borderRadius: BorderRadius.circular(29.0), @@ -178,21 +181,21 @@ class _CommonHomeParentState extends State { ]; List sizes = [26, 26, 36, 26, 26]; - Widget getBottomNavigationItem(int _index) { + Widget getBottomNavigationItem(int _index, int minusValue) { return Column( mainAxisSize: MainAxisSize.min, children: [ SvgPicture.asset( icons[_index], - width: sizes[_index], - height: sizes[_index], + width: sizes[_index] - minusValue, + height: sizes[_index] - minusValue, color: index == _index ? ColorConsts.brownColor : ColorConsts.darkText, ).expanded, if (index == _index) Container( height: 3, color: ColorConsts.brownColor, - width: sizes[_index], + width: sizes[_index] - minusValue, ), ], ).onPress(() { diff --git a/lib/new_ui/screens/home_screen.dart b/lib/new_ui/screens/home_screen.dart index c2e64b3..673bfff 100644 --- a/lib/new_ui/screens/home_screen.dart +++ b/lib/new_ui/screens/home_screen.dart @@ -15,12 +15,14 @@ import 'package:tangheem/extensions/string_extensions.dart'; import 'package:tangheem/extensions/widget_extensions.dart'; import 'package:tangheem/models/aya_tangheem_type.dart'; import 'package:tangheem/models/content_info_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 'package:tangheem/ui/dialogs/general_dialog.dart'; import 'package:tangheem/ui/screens/tangheem_screen.dart'; import 'package:tangheem/widgets/common_dropdown_button.dart'; import 'package:tangheem/widgets/video_player_widget.dart'; +import 'package:url_launcher/url_launcher.dart'; class HomeScreen extends StatefulWidget { static const String routeName = "/"; @@ -46,6 +48,7 @@ class _HomeScreenState extends State { SurahModel _surahModel; TangheemType _tangheemType; String _tangheemDiscription; + List quickLinks; @override void initState() { @@ -65,6 +68,15 @@ class _HomeScreenState extends State { _tangheemDiscription = AppState().tangheemDiscription; } + if (AppState().quickLinks == null) { + quickLinks = (await TangheemUserApiClient().quickLinks())?.data ?? []; + quickLinks = quickLinks.where((element) => element.position == "down").toList(); + quickLinks.sort((a, b) => a.orderNo.compareTo(b.orderNo)); + AppState().quickLinks = quickLinks; + } else { + quickLinks = AppState().quickLinks; + } + if (AppState().getSurahModel == null) { _surahModel = await TangheemUserApiClient().getSurahs(); AppState().setSurahModel(_surahModel); @@ -185,6 +197,8 @@ class _HomeScreenState extends State { @override Widget build(BuildContext context) { + bool isPortrait = MediaQuery.of(context).orientation == Orientation.portrait; + return SizedBox( width: double.infinity, child: Stack( @@ -193,10 +207,11 @@ class _HomeScreenState extends State { "assets/icons/new/home_light.jpg", fit: BoxFit.cover, height: double.infinity, + width: double.infinity, opacity: const AlwaysStoppedAnimation(.73), ), SingleChildScrollView( - padding: EdgeInsets.fromLTRB(45, 138, 45, 138), + padding: EdgeInsets.fromLTRB(45, isPortrait ? 138 : 45, 45, 138), physics: BouncingScrollPhysics(), child: Column( crossAxisAlignment: CrossAxisAlignment.center, @@ -282,14 +297,14 @@ class _HomeScreenState extends State { child: TextField( controller: _searchController, focusNode: _searchFocusNode, - style: TextStyle(color: Colors.white, fontSize: 14), + style: TextStyle(color: Colors.white, fontSize: 14,fontFamily: "Montserrat"), textAlign: TextAlign.end, decoration: InputDecoration( contentPadding: EdgeInsets.fromLTRB(2, 2, 24, 2), alignLabelWithHint: true, fillColor: ColorConsts.darkText.withOpacity(.65), filled: true, - hintStyle: TextStyle(color: Colors.white, fontSize: 14), + hintStyle: TextStyle(color: Colors.white, fontSize: 14,fontFamily: "Montserrat"), hintText: "البحث عن آية", prefixIconConstraints: BoxConstraints(maxHeight: 20), prefixIcon: InkWell( @@ -324,7 +339,21 @@ class _HomeScreenState extends State { ), ), ), - ) + ), + 30.height, + "شارك هذه الصفحة".toText(13, color: Color(0xffa2a2a2)), + 30.height, + if(quickLinks!=null && quickLinks.isNotEmpty) + 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), + ], + ), ], ), ), @@ -333,6 +362,20 @@ class _HomeScreenState extends State { ); } + 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 iconButton(String title, String icon, VoidCallback callback) { return InkWell( splashColor: Colors.transparent, diff --git a/lib/ui/dialogs/app_menu_dialog.dart b/lib/ui/dialogs/app_menu_dialog.dart index 12e53ac..ae54426 100644 --- a/lib/ui/dialogs/app_menu_dialog.dart +++ b/lib/ui/dialogs/app_menu_dialog.dart @@ -21,6 +21,8 @@ class AppMenuDialog extends StatelessWidget { @override Widget build(BuildContext context) { + bool isPortrait = MediaQuery.of(context).orientation == Orientation.portrait; + return BackdropFilter( filter: ImageFilter.blur(sigmaX: 4, sigmaY: 4), child: Dialog( @@ -32,61 +34,64 @@ class AppMenuDialog extends StatelessWidget { backgroundColor: Colors.transparent, child: Container( width: MediaQuery.of(context).size.width * 245 / 375, - padding: EdgeInsets.all(12), decoration: BoxDecoration( color: Colors.white.withOpacity(.91), borderRadius: BorderRadius.circular(20), ), - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - 58.height, - menuItem("الرئيسية", "assets/icons/new/home.svg", 0), - Container(width: 50, height: 1, color: ColorConsts.greyB5Color).paddingOnly(top: 16, bottom: 16), - menuItem("عن الموسوعة", "assets/icons/new/intro.svg", 1), - Container(width: 50, height: 1, color: ColorConsts.greyB5Color).paddingOnly(top: 16, bottom: 16), - menuItem("اللجنة الإشرافية", "assets/icons/new/members.svg", 4), - Container(width: 50, height: 1, color: ColorConsts.greyB5Color).paddingOnly(top: 16, bottom: 16), - menuItem("قراءة القرآن الكريم", "assets/icons/new/quran.svg", 2), - Row( - mainAxisSize: MainAxisSize.min, - children: [ - menuOptions("assets/icons/new/bookmark.svg").onPress(() { - Navigator.pop(context); - Navigator.pushNamed(context, BookmarkScreen.routeName); - }), - 14.width, - menuOptions("assets/icons/new/zoom_in.svg").onPress(onFontIncrease), - 14.width, - menuOptions("assets/icons/new/zoom_out.svg").onPress(onFontDecrease), - 14.width, - menuOptions("assets/icons/new/user_acount.svg").onPress(() { - Navigator.pop(context); - if (AppState().isUserLogin) { - Navigator.pushNamed(context, UserProfileScreen.routeName); - } else - Navigator.pushNamed(context, LoginScreen.routeName); - }), - ], - ).paddingOnly(top: 32, bottom: 32), - Container( - height: 26, - padding: EdgeInsets.only(right: 16, left: 12), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(32.0), - color: ColorConsts.brownLightColor, - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + child: SingleChildScrollView( + padding: EdgeInsets.all(12), + physics: BouncingScrollPhysics(), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + isPortrait ? 58.height : 24.height, + menuItem("الرئيسية", "assets/icons/new/home.svg", 0), + Container(width: 50, height: 1, color: ColorConsts.greyB5Color).paddingOnly(top: 16, bottom: 16), + menuItem("عن الموسوعة", "assets/icons/new/intro.svg", 1), + Container(width: 50, height: 1, color: ColorConsts.greyB5Color).paddingOnly(top: 16, bottom: 16), + menuItem("اللجنة الإشرافية", "assets/icons/new/members.svg", 4), + Container(width: 50, height: 1, color: ColorConsts.greyB5Color).paddingOnly(top: 16, bottom: 16), + menuItem("قراءة القرآن الكريم", "assets/icons/new/quran.svg", 2), + Row( + mainAxisSize: MainAxisSize.min, children: [ - Icon(Icons.play_arrow_outlined, size: 20, color: Colors.white), - "تصفح وتحميل الموسوعة".toText(13), + menuOptions("assets/icons/new/bookmark.svg").onPress(() { + Navigator.pop(context); + Navigator.pushNamed(context, BookmarkScreen.routeName); + }), + 14.width, + menuOptions("assets/icons/new/zoom_in.svg").onPress(onFontIncrease), + 14.width, + menuOptions("assets/icons/new/zoom_out.svg").onPress(onFontDecrease), + 14.width, + menuOptions("assets/icons/new/user_acount.svg").onPress(() { + Navigator.pop(context); + if (AppState().isUserLogin) { + Navigator.pushNamed(context, UserProfileScreen.routeName); + } else + Navigator.pushNamed(context, LoginScreen.routeName); + }), ], - ), - ).onPress(() { - goToIndex(5); - }) - ], + ).paddingOnly(top: 32, bottom: 32), + Container( + height: 26, + padding: EdgeInsets.only(right: 16, left: 12), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(32.0), + color: ColorConsts.brownLightColor, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Icon(Icons.play_arrow_outlined, size: 20, color: Colors.white), + "تصفح وتحميل الموسوعة".toText(13), + ], + ), + ).onPress(() { + goToIndex(5); + }) + ], + ), ), ), ), diff --git a/lib/ui/screens/contact_us_screen.dart b/lib/ui/screens/contact_us_screen.dart index 6b77547..48ed842 100644 --- a/lib/ui/screens/contact_us_screen.dart +++ b/lib/ui/screens/contact_us_screen.dart @@ -52,6 +52,8 @@ class _ContactUsScreenState extends State { @override Widget build(BuildContext context) { + bool isPortrait = MediaQuery.of(context).orientation == Orientation.portrait; + return Scaffold( backgroundColor: ColorConsts.greyF4Color, body: SingleChildScrollView( diff --git a/lib/ui/screens/login_screen.dart b/lib/ui/screens/login_screen.dart index 1e2c873..92960ac 100644 --- a/lib/ui/screens/login_screen.dart +++ b/lib/ui/screens/login_screen.dart @@ -84,13 +84,15 @@ class _LoginScreenState extends State { @override Widget build(BuildContext context) { + bool isPortrait = MediaQuery.of(context).orientation == Orientation.portrait; + return Scaffold( backgroundColor: ColorConsts.darkText, body: SafeArea( child: Directionality( textDirection: TextDirection.rtl, child: SingleChildScrollView( - padding: EdgeInsets.only(top: 140, bottom: 50, left: 40, right: 40), + padding: EdgeInsets.only(top: isPortrait ? 140 : 40, bottom: 50, left: 40, right: 40), physics: BouncingScrollPhysics(), child: Column( crossAxisAlignment: CrossAxisAlignment.center, diff --git a/lib/ui/screens/pdf_viewer_screen.dart b/lib/ui/screens/pdf_viewer_screen.dart index d69ef55..775064e 100644 --- a/lib/ui/screens/pdf_viewer_screen.dart +++ b/lib/ui/screens/pdf_viewer_screen.dart @@ -1,7 +1,11 @@ +import 'dart:async'; +import 'dart:io'; import 'dart:ui'; +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; +import 'package:path_provider/path_provider.dart'; import 'package:syncfusion_flutter_pdfviewer/pdfviewer.dart'; import 'package:tangheem/api/tangheem_user_api_client.dart'; import 'package:tangheem/app_state/app_state.dart'; @@ -85,6 +89,7 @@ class _PdfListScreenState extends State { height: double.infinity, child: SingleChildScrollView( physics: const AlwaysScrollableScrollPhysics(), + padding: EdgeInsets.only(bottom: 140), child: Column( children: [ CommonHeader("التصفح والتحميل", "assets/icons/new/pdf_bg.jpg", Color(0xffAE8646)), @@ -178,21 +183,17 @@ class PdfViewerScreen extends StatelessWidget { @override Widget build(BuildContext context) { - return Column( - children: [ - CommonHeader(pdfDetail.fileName, "assets/icons/new/pdf_bg.jpg", Color(0xffAE8646)), - SfPdfViewer.network( - ApiConsts.baseUrl + pdfDetail.exposeFilePath, - key: _pdfViewerKey, - canShowScrollHead: false, - enableTextSelection: false, - enableDocumentLinkAnnotation: false, - canShowPaginationDialog: false, - canShowScrollStatus: false, - pageSpacing: 0, - // pageLayoutMode:PdfPageLayoutMode.single - ).expanded, - ], + return SfPdfViewer.network( + ApiConsts.baseUrl + pdfDetail.exposeFilePath, + key: _pdfViewerKey, + canShowScrollHead: false, + enableTextSelection: false, + enableDocumentLinkAnnotation: false, + canShowPaginationDialog: false, + canShowScrollStatus: false, + pageSpacing: 0, + // pageLayoutMode:PdfPageLayoutMode.single ); + } } diff --git a/lib/ui/screens/quran_screen.dart b/lib/ui/screens/quran_screen.dart index 5cf5d17..c0d1aff 100644 --- a/lib/ui/screens/quran_screen.dart +++ b/lib/ui/screens/quran_screen.dart @@ -187,6 +187,8 @@ class _QuranScreenState extends State { @override Widget build(BuildContext context) { + bool isPortrait = MediaQuery.of(context).orientation == Orientation.portrait; + var tempList = _ayaModel?.data?.map((e) => e.surahNameAR)?.toList()?.toSet()?.toList() ?? []; String _surahName = ""; _surahName = tempList.isEmpty ? "" : tempList?.last ?? ""; @@ -413,7 +415,7 @@ class _QuranScreenState extends State { // } multiModeView = SingleChildScrollView( - padding: EdgeInsets.fromLTRB(24, 96, 24, 140), + padding: EdgeInsets.fromLTRB(24, isPortrait ? 96 : 50, 24, 140), physics: BouncingScrollPhysics(), child: Column(children: finalViewList), ); @@ -422,9 +424,16 @@ class _QuranScreenState extends State { width: double.infinity, child: Stack( children: [ - AspectRatio( - aspectRatio: 375 / 345, - child: Image.asset("assets/icons/new/quran_bg.jpg", fit: BoxFit.cover, alignment: Alignment(-0.7, 0.5)), + SizedBox( + width: double.infinity, + child: AspectRatio( + aspectRatio: 375 / 345, + child: Image.asset( + "assets/icons/new/quran_bg.jpg", + fit: BoxFit.cover, + alignment: Alignment(-0.7, 0.5), + ), + ), ), multiModeView ], diff --git a/lib/ui/screens/tangheem_detail_screen.dart b/lib/ui/screens/tangheem_detail_screen.dart index e1e6272..25baec9 100644 --- a/lib/ui/screens/tangheem_detail_screen.dart +++ b/lib/ui/screens/tangheem_detail_screen.dart @@ -452,7 +452,7 @@ class _TangheemDetailScreenState extends State { ), ), ), - if (MediaQuery.of(context).orientation == Orientation.portrait) + // if (MediaQuery.of(context).orientation == Orientation.portrait) AyaPlayerWidget( surahName: _ayatTangheemTypeMappedFirstData?.surahNameAr ?? "", ayaTangheemTypeId: _ayatTangheemTypeMappedFirstData?.tangheemTypeId ?? "", @@ -470,7 +470,7 @@ class _TangheemDetailScreenState extends State { ], ), ), - if (MediaQuery.of(context).orientation == Orientation.landscape) + if (false) Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/ui/screens/tangheem_screen.dart b/lib/ui/screens/tangheem_screen.dart index 9f08fb3..fee0e36 100644 --- a/lib/ui/screens/tangheem_screen.dart +++ b/lib/ui/screens/tangheem_screen.dart @@ -112,23 +112,29 @@ class _TangheemScreenState extends State { Widget build(BuildContext context) { return _dataList == null ? SizedBox() - : Stack( + : ListView( + controller: _controller, + //physics: BouncingScrollPhysics(), children: [ Stack( alignment: Alignment.center, children: [ - AspectRatio( - aspectRatio: 375 / 215, - child: Image.asset("assets/icons/new/quran_bg.jpg", fit: BoxFit.cover, alignment: Alignment(-0.3, 0.5)), + SizedBox( + // height: double.infinity, + width: double.infinity, + child: AspectRatio( + aspectRatio: 375 / 215, + child: Image.asset("assets/icons/new/quran_bg.jpg", fit: BoxFit.cover, alignment: Alignment(-0.3, 0.5)), + ), ), Column( mainAxisSize: MainAxisSize.min, children: [ Image.asset('assets/icons/new/Tangeem-logo-W.png', width: 50), 26.height, - widget.tangheemTypeName.toText(30), + (widget.tangheemTypeName ?? "").toText(30), 8.height, - "${widget.surah.nameAR}".toText(12, color: ColorConsts.brownB6CColor), + "${widget.surah?.nameAR ?? ""}".toText(12, color: ColorConsts.brownB6CColor), ], ).paddingOnly(top: 16), ], @@ -136,9 +142,11 @@ class _TangheemScreenState extends State { _dataList.isEmpty ? NoDataUI().paddingOnly(top: 215) : ListView.separated( - controller: _controller, - physics: BouncingScrollPhysics(), - padding: EdgeInsets.only(left: 24, right: 24, top: 215, bottom: 138), + // controller: _controller, + // physics: BouncingScrollPhysics(), + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + padding: EdgeInsets.only(left: 24, right: 24, top: 24, bottom: 24), itemCount: _dataList.length, separatorBuilder: (context, index) { return SizedBox(height: 12); diff --git a/lib/widgets/aya_record_widget.dart b/lib/widgets/aya_record_widget.dart index e3854b7..e3be5b7 100644 --- a/lib/widgets/aya_record_widget.dart +++ b/lib/widgets/aya_record_widget.dart @@ -102,6 +102,8 @@ class _AyaRecordWidgetState extends State { @override Widget build(BuildContext context) { + bool isPortrait = MediaQuery.of(context).orientation == Orientation.portrait; + return Column( children: [ Container( @@ -229,8 +231,8 @@ class _AyaRecordWidgetState extends State { }, child: Container( height: 31, - width: 125, - padding: EdgeInsets.only(left: 24, right: 24), + width: 135, + padding: EdgeInsets.only(left: 12, right: 12), alignment: Alignment.center, decoration: BoxDecoration( borderRadius: BorderRadius.circular(20), diff --git a/lib/widgets/common_dropdown_button.dart b/lib/widgets/common_dropdown_button.dart index d0ddbbb..e2316ab 100644 --- a/lib/widgets/common_dropdown_button.dart +++ b/lib/widgets/common_dropdown_button.dart @@ -26,7 +26,7 @@ class CommonDropDownButton extends StatelessWidget { child: Container( height: 48, decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(10), border: Border.all(color: ColorConsts.brownColor, width: .5)), - padding: EdgeInsets.fromLTRB(24, 15, 24, 15), + padding: EdgeInsets.fromLTRB(24, 12, 24, 12), child: DropdownButtonHideUnderline( child: DropdownButton( isExpanded: isDropDown, @@ -52,7 +52,7 @@ class CommonDropDownButton extends StatelessWidget { (list.isEmpty || index < 0) ? hintText : list[index], maxLines: 1, overflow: TextOverflow.ellipsis, - style: TextStyle(fontSize: 14, color: ColorConsts.brownColor), + style: TextStyle(fontSize: 14, color: ColorConsts.brownColor, height: 14 / 17), ), ], ), diff --git a/pubspec.yaml b/pubspec.yaml index 56f0cbf..ce3409e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -54,7 +54,6 @@ dependencies: flutter_html: ^2.2.1 flutter_inappwebview: ^5.7.2+3 dotted_border: ^2.0.0+1 - dev_dependencies: flutter_test: sdk: flutter