improvements.

development
Sikander Saleem 5 years ago
parent f7b967c30d
commit 47de629081

@ -8,7 +8,7 @@ extension EmailValidator on String {
String toFormattedDate() { String toFormattedDate() {
DateFormat inputFormat = DateFormat('yyyy-mm-ddThh:mm:ss'); DateFormat inputFormat = DateFormat('yyyy-mm-ddThh:mm:ss');
DateTime inputDate = inputFormat.parse(this); 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); return outputFormat.format(inputDate);
} }
} }

@ -73,7 +73,7 @@ class Application extends StatelessWidget {
break; break;
case TangheemDetailScreen.routeName: case TangheemDetailScreen.routeName:
className = CommonAppbar( className = CommonAppbar(
child: TangheemDetailScreen(ayatTangheemTypeMappedDataList: settings.arguments), child: TangheemDetailScreen(tangheemDetailParams: settings.arguments),
); );
break; break;
case QuranScreen.routeName: case QuranScreen.routeName:

@ -53,7 +53,7 @@ class _OTPDialogState extends State<OTPDialog> {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Text( Text(
"الرجاء ادخال الرقم المرسل الى جوالك", "الرجاء ادخال الرقم المرسل إلى جوالك",
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle(color: Colors.white), style: TextStyle(color: Colors.white),
), ),

@ -170,7 +170,6 @@ class _QuranScreenState extends State<QuranScreen> {
return "" + _surahName + "\n"; return "" + _surahName + "\n";
} }
void _clearFilterAndRefreshData() { void _clearFilterAndRefreshData() {
_selectedSurah = -1; _selectedSurah = -1;
_selectedFromAya = -1; _selectedFromAya = -1;
@ -224,7 +223,7 @@ class _QuranScreenState extends State<QuranScreen> {
), ),
SizedBox(width: 4), SizedBox(width: 4),
Expanded( 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) { if (_selectedFromAya != index) {
_selectedFromAya = index; _selectedFromAya = index;
filteredAyahList.indexOf(_selectedFromAya); filteredAyahList.indexOf(_selectedFromAya);
@ -235,7 +234,7 @@ class _QuranScreenState extends State<QuranScreen> {
), ),
SizedBox(width: 4), SizedBox(width: 4),
Expanded( 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) { if (_selectedToAya != index) {
_selectedToAya = index; _selectedToAya = index;
setState(() {}); setState(() {});
@ -408,8 +407,11 @@ class _QuranScreenState extends State<QuranScreen> {
), ),
onPressed: () { onPressed: () {
Navigator.pop(context); Navigator.pop(context);
var list = _ayatTangheemTypeMapped?.data?.where((element) => element.tangheemTypeName == e)?.toList() ?? []; var list = dataList.where((element) => element.tangheemTypeName == e)?.toList() ?? [];
Navigator.pushNamed(context, TangheemDetailScreen.routeName, arguments: list); 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(), .toList(),
@ -528,7 +530,7 @@ class _QuranScreenState extends State<QuranScreen> {
list = _ayatTangheemTypeMapped?.data?.where((element) => element.ayahNo == _selectedAyaForBookmark.ayahID)?.toList() ?? []; list = _ayatTangheemTypeMapped?.data?.where((element) => element.ayahNo == _selectedAyaForBookmark.ayahID)?.toList() ?? [];
if (list.isEmpty) { if (list.isEmpty) {
Utils.showToast("لا توجد أساليب تنغيم في هذه الأية"); Utils.showToast("لا توجد أساليب تنغيم في هذه الآية");
return; return;
} }
@ -538,10 +540,14 @@ class _QuranScreenState extends State<QuranScreen> {
_selectTangheemType(tempList, list); _selectTangheemType(tempList, list);
return; 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( child: Row(
children: [Text("تفاصيل التنغيم")], children: [Text("تفاصيل الأساليب")],
), ),
), ),
SizedBox(height: 8), SizedBox(height: 8),
@ -550,15 +556,15 @@ class _QuranScreenState extends State<QuranScreen> {
Navigator.pop(context); Navigator.pop(context);
var temp = _bookMark.firstWhere((element) => element.ayahID == _selectedAyaForBookmark.ayahID, orElse: () => null); var temp = _bookMark.firstWhere((element) => element.ayahID == _selectedAyaForBookmark.ayahID, orElse: () => null);
if (temp != null) { if (temp != null) {
Utils.showToast("هذه الأية مضافة سابقا"); Utils.showToast("هذه الآية مضافة سابقا");
return; return;
} }
_bookMark.add(_selectedAyaForBookmark); _bookMark.add(_selectedAyaForBookmark);
BookMarkModel.saveToPrefs(_bookMark); BookMarkModel.saveToPrefs(_bookMark);
Utils.showToast("تم اضافة الأية كمرجع"); Utils.showToast("تم إضافة الآية كمرجع");
}, },
child: Row( child: Row(
children: [Text("اضافة الأية كمرجع؟")], children: [Text("إضافة الآية كمرجع")],
), ),
), ),
], ],
@ -568,3 +574,9 @@ class _QuranScreenState extends State<QuranScreen> {
}); });
} }
} }
class TangheemTemp {
final String tangheemName;
final String ayaTangheemId;
TangheemTemp(this.tangheemName, this.ayaTangheemId);
}

@ -18,11 +18,17 @@ import 'package:tangheem/widgets/text_highlight_widget.dart';
import 'login_screen.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 { class TangheemDetailScreen extends StatefulWidget {
static const String routeName = "/tangheem_detail"; static const String routeName = "/tangheem_detail";
final List<AyatTangheemTypeMappedData> ayatTangheemTypeMappedDataList; final TangheemDetailParams tangheemDetailParams;
TangheemDetailScreen({Key key, this.ayatTangheemTypeMappedDataList}) : super(key: key); TangheemDetailScreen({Key key, this.tangheemDetailParams}) : super(key: key);
@override @override
_TangheemDetailScreenState createState() { _TangheemDetailScreenState createState() {
@ -45,7 +51,7 @@ class _TangheemDetailScreenState extends State<TangheemDetailScreen> {
void initState() { void initState() {
super.initState(); super.initState();
ayatTangheemTypeMappedDataList = widget.ayatTangheemTypeMappedDataList; ayatTangheemTypeMappedDataList = widget.tangheemDetailParams.ayatTangheemTypeMappedDataList;
_ayatTangheemTypeMappedFirstData = ayatTangheemTypeMappedDataList.first; _ayatTangheemTypeMappedFirstData = ayatTangheemTypeMappedDataList.first;
filterVoiceListData(); filterVoiceListData();
getPrefs(); getPrefs();
@ -80,7 +86,7 @@ class _TangheemDetailScreenState extends State<TangheemDetailScreen> {
void getTangheemDiscussion() async { void getTangheemDiscussion() async {
Utils.showLoading(context); Utils.showLoading(context);
try { try {
_discussionModel = await TangheemUserApiClient().getDiscussionByTangheemID(_discussionPage, _ayatTangheemTypeMappedFirstData.ayaTangheemTypeId); _discussionModel = await TangheemUserApiClient().getDiscussionByTangheemID(_discussionPage, widget.tangheemDetailParams.selectedTangheemTypeId);
Utils.hideLoading(context); Utils.hideLoading(context);
setState(() {}); setState(() {});
} catch (ex) { } catch (ex) {
@ -512,7 +518,7 @@ class _TangheemDetailScreenState extends State<TangheemDetailScreen> {
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
), ),
child: _discussionList.length > 1 child: _discussionList.length > 0
? ListView.separated( ? ListView.separated(
padding: EdgeInsets.only(top: 4, bottom: 24), padding: EdgeInsets.only(top: 4, bottom: 24),
shrinkWrap: true, shrinkWrap: true,
@ -541,9 +547,12 @@ class _TangheemDetailScreenState extends State<TangheemDetailScreen> {
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16, color: ColorConsts.primaryBlue, height: 1.5), style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16, color: ColorConsts.primaryBlue, height: 1.5),
), ),
SizedBox(height: 4), SizedBox(height: 4),
Text( Directionality(
_discussionList[index].date.toFormattedDate(), textDirection: TextDirection.ltr,
style: TextStyle(fontSize: 12, color: ColorConsts.textGrey, height: 1), child: Text(
_discussionList[index].date.toFormattedDate(),
style: TextStyle(fontSize: 12, color: ColorConsts.textGrey, height: 1),
),
), ),
], ],
) )
@ -564,7 +573,7 @@ class _TangheemDetailScreenState extends State<TangheemDetailScreen> {
if ((_discussionList[index]?.adminResponse ?? "").isNotEmpty) SizedBox(height: 4), if ((_discussionList[index]?.adminResponse ?? "").isNotEmpty) SizedBox(height: 4),
if ((_discussionList[index]?.adminResponse ?? "").isNotEmpty) if ((_discussionList[index]?.adminResponse ?? "").isNotEmpty)
Text( Text(
"تعليق من: " + _discussionList[index].adminResponse, "رد من المسؤول: " + _discussionList[index].adminResponse,
style: TextStyle(fontSize: 14, color: ColorConsts.textGrey, height: 1.4), style: TextStyle(fontSize: 14, color: ColorConsts.textGrey, height: 1.4),
), ),
], ],

@ -71,7 +71,8 @@ class _TangheemScreenState extends State<TangheemScreen> {
List<AyatTangheemTypeMappedData> list = []; List<AyatTangheemTypeMappedData> list = [];
list = list =
_ayatTangheemTypeMapped?.data?.where((element) => (element.ayahNo == _dataList[index].ayahNo) && (element.tangheemTypeId == _dataList[index].tangheemTypeId))?.toList() ?? []; _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), borderRadius: BorderRadius.circular(4),
child: Container( child: Container(

@ -190,7 +190,7 @@ class _AyaPlayerWidgetState extends State<AyaPlayerWidget> {
commonIconButton("assets/icons/download_aya.svg", () async { commonIconButton("assets/icons/download_aya.svg", () async {
if (await _requestPermission()) { if (await _requestPermission()) {
if (await _saveAya()) { if (await _saveAya()) {
Utils.showToast("تم حفظ الأية بنجاح"); Utils.showToast("تم حفظ الآية بنجاح");
} else { } else {
Utils.showToast("خطأ في حفظ الآية"); Utils.showToast("خطأ في حفظ الآية");
} }

Loading…
Cancel
Save