diff --git a/lib/extensions/string_extensions.dart b/lib/extensions/string_extensions.dart index ddd1c6f..b56d98b 100644 --- a/lib/extensions/string_extensions.dart +++ b/lib/extensions/string_extensions.dart @@ -8,7 +8,7 @@ extension EmailValidator on String { String toFormattedDate() { DateFormat inputFormat = DateFormat('yyyy-mm-ddThh:mm:ss'); DateTime inputDate = inputFormat.parse(this); - DateFormat outputFormat = DateFormat('dd/MM/yyyy hh:mm:a'); + DateFormat outputFormat = DateFormat('DD MMMM yyyy hh:mm a'); return outputFormat.format(inputDate); } } diff --git a/lib/main.dart b/lib/main.dart index 5cef62a..0381438 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -73,7 +73,7 @@ class Application extends StatelessWidget { break; case TangheemDetailScreen.routeName: className = CommonAppbar( - child: TangheemDetailScreen(ayatTangheemTypeMappedDataList: settings.arguments), + child: TangheemDetailScreen(tangheemDetailParams: settings.arguments), ); break; case QuranScreen.routeName: diff --git a/lib/ui/dialogs/otp_dialog.dart b/lib/ui/dialogs/otp_dialog.dart index 96ea6a4..6836383 100644 --- a/lib/ui/dialogs/otp_dialog.dart +++ b/lib/ui/dialogs/otp_dialog.dart @@ -53,7 +53,7 @@ class _OTPDialogState extends State { mainAxisSize: MainAxisSize.min, children: [ Text( - "الرجاء ادخال الرقم المرسل الى جوالك", + "الرجاء ادخال الرقم المرسل إلى جوالك", textAlign: TextAlign.center, style: TextStyle(color: Colors.white), ), diff --git a/lib/ui/screens/quran_screen.dart b/lib/ui/screens/quran_screen.dart index 87ae01e..b2f5739 100644 --- a/lib/ui/screens/quran_screen.dart +++ b/lib/ui/screens/quran_screen.dart @@ -170,7 +170,6 @@ class _QuranScreenState extends State { return "" + _surahName + "\n"; } - void _clearFilterAndRefreshData() { _selectedSurah = -1; _selectedFromAya = -1; @@ -224,7 +223,7 @@ class _QuranScreenState extends State { ), SizedBox(width: 4), Expanded( - child: CommonDropDownButton(_selectedFromAya, hintText: "من الاية", list: _fromAyaList.map((e) => "من الاية" + " $e").toList(), onSelect: (index) { + child: CommonDropDownButton(_selectedFromAya, hintText: "من الآية", list: _fromAyaList.map((e) => "من الآية" + " $e").toList(), onSelect: (index) { if (_selectedFromAya != index) { _selectedFromAya = index; filteredAyahList.indexOf(_selectedFromAya); @@ -235,7 +234,7 @@ class _QuranScreenState extends State { ), SizedBox(width: 4), Expanded( - child: CommonDropDownButton(_selectedToAya, hintText: "الى الاية", list: _toAyaList.map((e) => "الى الاية" + " $e").toList(), onSelect: (index) { + child: CommonDropDownButton(_selectedToAya, hintText: "إلى الآية", list: _toAyaList.map((e) => "إلى الآية" + " $e").toList(), onSelect: (index) { if (_selectedToAya != index) { _selectedToAya = index; setState(() {}); @@ -408,8 +407,11 @@ class _QuranScreenState extends State { ), onPressed: () { Navigator.pop(context); - var list = _ayatTangheemTypeMapped?.data?.where((element) => element.tangheemTypeName == e)?.toList() ?? []; - Navigator.pushNamed(context, TangheemDetailScreen.routeName, arguments: list); + var list = dataList.where((element) => element.tangheemTypeName == e)?.toList() ?? []; + var name = dataList.firstWhere((element) => element.tangheemTypeName == e, orElse: null); + + TangheemDetailParams tangheem = TangheemDetailParams(selectedTangheemTypeId: name?.ayaTangheemTypeId ?? "", ayatTangheemTypeMappedDataList: list); + Navigator.pushNamed(context, TangheemDetailScreen.routeName, arguments: tangheem); }, )) .toList(), @@ -528,7 +530,7 @@ class _QuranScreenState extends State { list = _ayatTangheemTypeMapped?.data?.where((element) => element.ayahNo == _selectedAyaForBookmark.ayahID)?.toList() ?? []; if (list.isEmpty) { - Utils.showToast("لا توجد أساليب تنغيم في هذه الأية"); + Utils.showToast("لا توجد أساليب تنغيم في هذه الآية"); return; } @@ -538,10 +540,14 @@ class _QuranScreenState extends State { _selectTangheemType(tempList, list); return; } - Navigator.pushNamed(context, TangheemDetailScreen.routeName, arguments: list); + + var name = list.firstWhere((element) => element.tangheemTypeName == tempList.first, orElse: null); + TangheemDetailParams tangheem = TangheemDetailParams(selectedTangheemTypeId: name?.ayaTangheemTypeId ?? "", ayatTangheemTypeMappedDataList: list); + + Navigator.pushNamed(context, TangheemDetailScreen.routeName, arguments: tangheem); }, child: Row( - children: [Text("تفاصيل التنغيم")], + children: [Text("تفاصيل الأساليب")], ), ), SizedBox(height: 8), @@ -550,15 +556,15 @@ class _QuranScreenState extends State { Navigator.pop(context); var temp = _bookMark.firstWhere((element) => element.ayahID == _selectedAyaForBookmark.ayahID, orElse: () => null); if (temp != null) { - Utils.showToast("هذه الأية مضافة سابقا"); + Utils.showToast("هذه الآية مضافة سابقا"); return; } _bookMark.add(_selectedAyaForBookmark); BookMarkModel.saveToPrefs(_bookMark); - Utils.showToast("تم اضافة الأية كمرجع"); + Utils.showToast("تم إضافة الآية كمرجع"); }, child: Row( - children: [Text("اضافة الأية كمرجع؟")], + children: [Text("إضافة الآية كمرجع")], ), ), ], @@ -568,3 +574,9 @@ class _QuranScreenState extends State { }); } } + +class TangheemTemp { + final String tangheemName; + final String ayaTangheemId; + TangheemTemp(this.tangheemName, this.ayaTangheemId); +} diff --git a/lib/ui/screens/tangheem_detail_screen.dart b/lib/ui/screens/tangheem_detail_screen.dart index 703f65a..360e784 100644 --- a/lib/ui/screens/tangheem_detail_screen.dart +++ b/lib/ui/screens/tangheem_detail_screen.dart @@ -18,11 +18,17 @@ import 'package:tangheem/widgets/text_highlight_widget.dart'; import 'login_screen.dart'; +class TangheemDetailParams { + final String selectedTangheemTypeId; + final List ayatTangheemTypeMappedDataList; + TangheemDetailParams({@required this.selectedTangheemTypeId, @required this.ayatTangheemTypeMappedDataList}); +} + class TangheemDetailScreen extends StatefulWidget { static const String routeName = "/tangheem_detail"; - final List ayatTangheemTypeMappedDataList; + final TangheemDetailParams tangheemDetailParams; - TangheemDetailScreen({Key key, this.ayatTangheemTypeMappedDataList}) : super(key: key); + TangheemDetailScreen({Key key, this.tangheemDetailParams}) : super(key: key); @override _TangheemDetailScreenState createState() { @@ -45,7 +51,7 @@ class _TangheemDetailScreenState extends State { void initState() { super.initState(); - ayatTangheemTypeMappedDataList = widget.ayatTangheemTypeMappedDataList; + ayatTangheemTypeMappedDataList = widget.tangheemDetailParams.ayatTangheemTypeMappedDataList; _ayatTangheemTypeMappedFirstData = ayatTangheemTypeMappedDataList.first; filterVoiceListData(); getPrefs(); @@ -80,7 +86,7 @@ class _TangheemDetailScreenState extends State { void getTangheemDiscussion() async { Utils.showLoading(context); try { - _discussionModel = await TangheemUserApiClient().getDiscussionByTangheemID(_discussionPage, _ayatTangheemTypeMappedFirstData.ayaTangheemTypeId); + _discussionModel = await TangheemUserApiClient().getDiscussionByTangheemID(_discussionPage, widget.tangheemDetailParams.selectedTangheemTypeId); Utils.hideLoading(context); setState(() {}); } catch (ex) { @@ -512,7 +518,7 @@ class _TangheemDetailScreenState extends State { color: Colors.white, borderRadius: BorderRadius.circular(8), ), - child: _discussionList.length > 1 + child: _discussionList.length > 0 ? ListView.separated( padding: EdgeInsets.only(top: 4, bottom: 24), shrinkWrap: true, @@ -541,9 +547,12 @@ class _TangheemDetailScreenState extends State { style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16, color: ColorConsts.primaryBlue, height: 1.5), ), SizedBox(height: 4), - Text( - _discussionList[index].date.toFormattedDate(), - style: TextStyle(fontSize: 12, color: ColorConsts.textGrey, height: 1), + Directionality( + textDirection: TextDirection.ltr, + child: Text( + _discussionList[index].date.toFormattedDate(), + style: TextStyle(fontSize: 12, color: ColorConsts.textGrey, height: 1), + ), ), ], ) @@ -564,7 +573,7 @@ class _TangheemDetailScreenState extends State { if ((_discussionList[index]?.adminResponse ?? "").isNotEmpty) SizedBox(height: 4), if ((_discussionList[index]?.adminResponse ?? "").isNotEmpty) Text( - "تعليق من: " + _discussionList[index].adminResponse, + "رد من المسؤول: " + _discussionList[index].adminResponse, style: TextStyle(fontSize: 14, color: ColorConsts.textGrey, height: 1.4), ), ], diff --git a/lib/ui/screens/tangheem_screen.dart b/lib/ui/screens/tangheem_screen.dart index bcd3bb2..8de3cb8 100644 --- a/lib/ui/screens/tangheem_screen.dart +++ b/lib/ui/screens/tangheem_screen.dart @@ -71,7 +71,8 @@ class _TangheemScreenState extends State { List list = []; list = _ayatTangheemTypeMapped?.data?.where((element) => (element.ayahNo == _dataList[index].ayahNo) && (element.tangheemTypeId == _dataList[index].tangheemTypeId))?.toList() ?? []; - Navigator.pushNamed(context, TangheemDetailScreen.routeName, arguments: list); + TangheemDetailParams tangheem = TangheemDetailParams(selectedTangheemTypeId: _dataList[index].ayaTangheemTypeId, ayatTangheemTypeMappedDataList: list); + Navigator.pushNamed(context, TangheemDetailScreen.routeName, arguments: tangheem); }, borderRadius: BorderRadius.circular(4), child: Container( diff --git a/lib/widgets/aya_player_widget.dart b/lib/widgets/aya_player_widget.dart index ed8a7bf..e34589c 100644 --- a/lib/widgets/aya_player_widget.dart +++ b/lib/widgets/aya_player_widget.dart @@ -190,7 +190,7 @@ class _AyaPlayerWidgetState extends State { commonIconButton("assets/icons/download_aya.svg", () async { if (await _requestPermission()) { if (await _saveAya()) { - Utils.showToast("تم حفظ الأية بنجاح"); + Utils.showToast("تم حفظ الآية بنجاح"); } else { Utils.showToast("خطأ في حفظ الآية"); }