|
|
|
@ -6,26 +6,30 @@ import 'package:tangheem/api/tangheem_user_api_client.dart';
|
|
|
|
import 'package:tangheem/classes/colors.dart';
|
|
|
|
import 'package:tangheem/classes/colors.dart';
|
|
|
|
import 'package:tangheem/classes/utils.dart';
|
|
|
|
import 'package:tangheem/classes/utils.dart';
|
|
|
|
import 'package:tangheem/models/aya_model.dart';
|
|
|
|
import 'package:tangheem/models/aya_model.dart';
|
|
|
|
|
|
|
|
import 'package:tangheem/models/aya_tangheem_type_mapped.dart';
|
|
|
|
import 'package:tangheem/models/surah_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/aya_scroll_view.dart';
|
|
|
|
import 'package:tangheem/widgets/auto_scroll_view/scroll_id.dart';
|
|
|
|
import 'package:tangheem/widgets/auto_scroll_view/scroll_id.dart';
|
|
|
|
import 'package:tangheem/widgets/aya_player_widget.dart';
|
|
|
|
import 'package:tangheem/widgets/aya_player_widget.dart';
|
|
|
|
import 'package:tangheem/widgets/common_dropdown_button.dart';
|
|
|
|
import 'package:tangheem/widgets/common_dropdown_button.dart';
|
|
|
|
|
|
|
|
import 'package:tangheem/widgets/text_highlight_widget.dart';
|
|
|
|
|
|
|
|
|
|
|
|
class SurahScreen extends StatefulWidget {
|
|
|
|
import 'tangheem_detail_screen.dart';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class QuranScreen extends StatefulWidget {
|
|
|
|
static const String routeName = "/surah";
|
|
|
|
static const String routeName = "/surah";
|
|
|
|
final SurahModel surahModel;
|
|
|
|
final SurahModel surahModel;
|
|
|
|
final String query;
|
|
|
|
final String query;
|
|
|
|
|
|
|
|
|
|
|
|
SurahScreen({Key key, this.surahModel, @required this.query}) : super(key: key);
|
|
|
|
QuranScreen({Key key, this.surahModel, @required this.query}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
_SurahScreenState createState() {
|
|
|
|
_QuranScreenState createState() {
|
|
|
|
return _SurahScreenState();
|
|
|
|
return _QuranScreenState();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class _SurahScreenState extends State<SurahScreen> {
|
|
|
|
class _QuranScreenState extends State<QuranScreen> {
|
|
|
|
GlobalKey _globalKey = GlobalKey();
|
|
|
|
GlobalKey _globalKey = GlobalKey();
|
|
|
|
int _selectedSurah = 0;
|
|
|
|
int _selectedSurah = 0;
|
|
|
|
int _selectedFromAya = 0;
|
|
|
|
int _selectedFromAya = 0;
|
|
|
|
@ -38,8 +42,11 @@ class _SurahScreenState extends State<SurahScreen> {
|
|
|
|
List<int> _toAyaList = [];
|
|
|
|
List<int> _toAyaList = [];
|
|
|
|
|
|
|
|
|
|
|
|
SurahModel _surahModel;
|
|
|
|
SurahModel _surahModel;
|
|
|
|
|
|
|
|
AyatTangheemTypeMapped _ayatTangheemTypeMapped;
|
|
|
|
AyaModel _ayaModel;
|
|
|
|
AyaModel _ayaModel;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<String> _tangheemWords = [];
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
super.initState();
|
|
|
|
@ -73,6 +80,19 @@ class _SurahScreenState extends State<SurahScreen> {
|
|
|
|
_currentPage = 0;
|
|
|
|
_currentPage = 0;
|
|
|
|
_selectedFromAya = 0;
|
|
|
|
_selectedFromAya = 0;
|
|
|
|
_selectedToAya = 0;
|
|
|
|
_selectedToAya = 0;
|
|
|
|
|
|
|
|
getTangheemBySurahId();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void getTangheemBySurahId() async {
|
|
|
|
|
|
|
|
Utils.showLoading(context);
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
_ayatTangheemTypeMapped = await TangheemUserApiClient().getTangheemBySurah(_selectedSurah + 1);
|
|
|
|
|
|
|
|
_tangheemWords = _ayatTangheemTypeMapped?.data?.map((e) => e.highlightText)?.toList() ?? [];
|
|
|
|
|
|
|
|
} catch (ex, tr) {
|
|
|
|
|
|
|
|
Utils.handleException(ex, null);
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
|
|
|
}
|
|
|
|
getAyaByRange();
|
|
|
|
getAyaByRange();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -207,12 +227,20 @@ class _SurahScreenState extends State<SurahScreen> {
|
|
|
|
SizedBox(height: 8),
|
|
|
|
SizedBox(height: 8),
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
padding: EdgeInsets.only(left: 4, right: 4),
|
|
|
|
padding: EdgeInsets.only(left: 4, right: 4),
|
|
|
|
child: Text(
|
|
|
|
child: TextHighLightWidget(
|
|
|
|
_surahAya,
|
|
|
|
text: _surahAya,
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
valueColor: ColorConsts.primaryBlue,
|
|
|
|
|
|
|
|
highlights: _tangheemWords,
|
|
|
|
|
|
|
|
onTap: (value) {
|
|
|
|
|
|
|
|
List<AyatTangheemTypeMappedData> _ayatList = _ayatTangheemTypeMapped.data?.where((element) => element.highlightText == value)?.toList() ?? [];
|
|
|
|
|
|
|
|
if (_ayatList.length > 1) {
|
|
|
|
|
|
|
|
_selectTangheemType(_ayatList);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
Navigator.pushNamed(context, TangheemDetailScreen.routeName, arguments: _ayatList.first);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
style: TextStyle(
|
|
|
|
style: TextStyle(
|
|
|
|
fontFamily: "UthmanicHafs",
|
|
|
|
fontFamily: "UthmanicHafs",
|
|
|
|
color: ColorConsts.primaryBlue,
|
|
|
|
|
|
|
|
fontSize: 18,
|
|
|
|
fontSize: 18,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
@ -271,7 +299,7 @@ class _SurahScreenState extends State<SurahScreen> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
AyaPlayerWidget(surahName: _surahList.isNotEmpty ? _surahList[_selectedSurah] : "", globalKey: _globalKey)
|
|
|
|
// AyaPlayerWidget(surahName: _surahList.isNotEmpty ? _surahList[_selectedSurah] : "", globalKey: _globalKey)
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
@ -297,6 +325,36 @@ class _SurahScreenState extends State<SurahScreen> {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void _selectTangheemType(List<AyatTangheemTypeMappedData> list) async {
|
|
|
|
|
|
|
|
SimpleDialog dialog = SimpleDialog(
|
|
|
|
|
|
|
|
title: Text(
|
|
|
|
|
|
|
|
'اختر نوع تنغيم',
|
|
|
|
|
|
|
|
textDirection: TextDirection.rtl,
|
|
|
|
|
|
|
|
style: TextStyle(color: ColorConsts.primaryBlack),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
children: list
|
|
|
|
|
|
|
|
.map((e) => SimpleDialogOption(
|
|
|
|
|
|
|
|
child: Text(
|
|
|
|
|
|
|
|
e.tangheemTypeName,
|
|
|
|
|
|
|
|
textDirection: TextDirection.rtl,
|
|
|
|
|
|
|
|
style: TextStyle(color: ColorConsts.primaryBlue),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
onPressed: () {
|
|
|
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
|
|
|
Navigator.pushNamed(context, TangheemDetailScreen.routeName, arguments: e);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
))
|
|
|
|
|
|
|
|
.toList(),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
showDialog(
|
|
|
|
|
|
|
|
context: context,
|
|
|
|
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
|
|
|
|
return dialog;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Widget previousOptionButton(String icon, String text, VoidCallback onPressed) {
|
|
|
|
Widget previousOptionButton(String icon, String text, VoidCallback onPressed) {
|
|
|
|
return InkWell(
|
|
|
|
return InkWell(
|
|
|
|
onTap: onPressed,
|
|
|
|
onTap: onPressed,
|