|
|
|
@ -15,12 +15,14 @@ import 'package:tangheem/extensions/string_extensions.dart';
|
|
|
|
import 'package:tangheem/extensions/widget_extensions.dart';
|
|
|
|
import 'package:tangheem/extensions/widget_extensions.dart';
|
|
|
|
import 'package:tangheem/models/aya_tangheem_type.dart';
|
|
|
|
import 'package:tangheem/models/aya_tangheem_type.dart';
|
|
|
|
import 'package:tangheem/models/content_info_model.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/surah_model.dart';
|
|
|
|
import 'package:tangheem/models/tangheem_type_model.dart';
|
|
|
|
import 'package:tangheem/models/tangheem_type_model.dart';
|
|
|
|
import 'package:tangheem/ui/dialogs/general_dialog.dart';
|
|
|
|
import 'package:tangheem/ui/dialogs/general_dialog.dart';
|
|
|
|
import 'package:tangheem/ui/screens/tangheem_screen.dart';
|
|
|
|
import 'package:tangheem/ui/screens/tangheem_screen.dart';
|
|
|
|
import 'package:tangheem/widgets/common_dropdown_button.dart';
|
|
|
|
import 'package:tangheem/widgets/common_dropdown_button.dart';
|
|
|
|
import 'package:tangheem/widgets/video_player_widget.dart';
|
|
|
|
import 'package:tangheem/widgets/video_player_widget.dart';
|
|
|
|
|
|
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
|
|
|
|
|
|
|
|
|
|
class HomeScreen extends StatefulWidget {
|
|
|
|
class HomeScreen extends StatefulWidget {
|
|
|
|
static const String routeName = "/";
|
|
|
|
static const String routeName = "/";
|
|
|
|
@ -46,6 +48,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
|
|
|
SurahModel _surahModel;
|
|
|
|
SurahModel _surahModel;
|
|
|
|
TangheemType _tangheemType;
|
|
|
|
TangheemType _tangheemType;
|
|
|
|
String _tangheemDiscription;
|
|
|
|
String _tangheemDiscription;
|
|
|
|
|
|
|
|
List<QuickLinksData> quickLinks;
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
void initState() {
|
|
|
|
@ -65,6 +68,15 @@ class _HomeScreenState extends State<HomeScreen> {
|
|
|
|
_tangheemDiscription = AppState().tangheemDiscription;
|
|
|
|
_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) {
|
|
|
|
if (AppState().getSurahModel == null) {
|
|
|
|
_surahModel = await TangheemUserApiClient().getSurahs();
|
|
|
|
_surahModel = await TangheemUserApiClient().getSurahs();
|
|
|
|
AppState().setSurahModel(_surahModel);
|
|
|
|
AppState().setSurahModel(_surahModel);
|
|
|
|
@ -185,6 +197,8 @@ class _HomeScreenState extends State<HomeScreen> {
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
|
|
|
bool isPortrait = MediaQuery.of(context).orientation == Orientation.portrait;
|
|
|
|
|
|
|
|
|
|
|
|
return SizedBox(
|
|
|
|
return SizedBox(
|
|
|
|
width: double.infinity,
|
|
|
|
width: double.infinity,
|
|
|
|
child: Stack(
|
|
|
|
child: Stack(
|
|
|
|
@ -193,10 +207,11 @@ class _HomeScreenState extends State<HomeScreen> {
|
|
|
|
"assets/icons/new/home_light.jpg",
|
|
|
|
"assets/icons/new/home_light.jpg",
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
height: double.infinity,
|
|
|
|
height: double.infinity,
|
|
|
|
|
|
|
|
width: double.infinity,
|
|
|
|
opacity: const AlwaysStoppedAnimation(.73),
|
|
|
|
opacity: const AlwaysStoppedAnimation(.73),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SingleChildScrollView(
|
|
|
|
SingleChildScrollView(
|
|
|
|
padding: EdgeInsets.fromLTRB(45, 138, 45, 138),
|
|
|
|
padding: EdgeInsets.fromLTRB(45, isPortrait ? 138 : 45, 45, 138),
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
child: Column(
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
@ -282,14 +297,14 @@ class _HomeScreenState extends State<HomeScreen> {
|
|
|
|
child: TextField(
|
|
|
|
child: TextField(
|
|
|
|
controller: _searchController,
|
|
|
|
controller: _searchController,
|
|
|
|
focusNode: _searchFocusNode,
|
|
|
|
focusNode: _searchFocusNode,
|
|
|
|
style: TextStyle(color: Colors.white, fontSize: 14),
|
|
|
|
style: TextStyle(color: Colors.white, fontSize: 14,fontFamily: "Montserrat"),
|
|
|
|
textAlign: TextAlign.end,
|
|
|
|
textAlign: TextAlign.end,
|
|
|
|
decoration: InputDecoration(
|
|
|
|
decoration: InputDecoration(
|
|
|
|
contentPadding: EdgeInsets.fromLTRB(2, 2, 24, 2),
|
|
|
|
contentPadding: EdgeInsets.fromLTRB(2, 2, 24, 2),
|
|
|
|
alignLabelWithHint: true,
|
|
|
|
alignLabelWithHint: true,
|
|
|
|
fillColor: ColorConsts.darkText.withOpacity(.65),
|
|
|
|
fillColor: ColorConsts.darkText.withOpacity(.65),
|
|
|
|
filled: true,
|
|
|
|
filled: true,
|
|
|
|
hintStyle: TextStyle(color: Colors.white, fontSize: 14),
|
|
|
|
hintStyle: TextStyle(color: Colors.white, fontSize: 14,fontFamily: "Montserrat"),
|
|
|
|
hintText: "البحث عن آية",
|
|
|
|
hintText: "البحث عن آية",
|
|
|
|
prefixIconConstraints: BoxConstraints(maxHeight: 20),
|
|
|
|
prefixIconConstraints: BoxConstraints(maxHeight: 20),
|
|
|
|
prefixIcon: InkWell(
|
|
|
|
prefixIcon: InkWell(
|
|
|
|
@ -324,7 +339,21 @@ class _HomeScreenState extends State<HomeScreen> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
),
|
|
|
|
|
|
|
|
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<HomeScreen> {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) {
|
|
|
|
Widget iconButton(String title, String icon, VoidCallback callback) {
|
|
|
|
return InkWell(
|
|
|
|
return InkWell(
|
|
|
|
splashColor: Colors.transparent,
|
|
|
|
splashColor: Colors.transparent,
|
|
|
|
|