menu dialog & pdf screen, landscape ui changed.

development-design-2.0
Sikander Saleem 3 years ago
parent 2083f496b9
commit a1041637d0

@ -23,6 +23,46 @@ class AppMenuDialog extends StatelessWidget {
Widget build(BuildContext context) {
bool isPortrait = MediaQuery.of(context).orientation == Orientation.portrait;
Widget _operationButtons = Row(
mainAxisSize: MainAxisSize.min,
children: [
menuOptions("assets/icons/new/bookmark.svg", isPortrait).onPress(() {
Navigator.pop(context);
Navigator.pushNamed(context, BookmarkScreen.routeName);
}),
14.width,
menuOptions("assets/icons/new/zoom_in.svg", isPortrait).onPress(onFontIncrease),
14.width,
menuOptions("assets/icons/new/zoom_out.svg", isPortrait).onPress(onFontDecrease),
14.width,
menuOptions("assets/icons/new/user_acount.svg", isPortrait).onPress(() {
Navigator.pop(context);
if (AppState().isUserLogin) {
Navigator.pushNamed(context, UserProfileScreen.routeName);
} else
Navigator.pushNamed(context, LoginScreen.routeName);
}),
],
);
Widget _pdfButton = 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(isPortrait ? 13 : 16),
],
),
).onPress(() {
goToIndex(5);
});
return BackdropFilter(
filter: ImageFilter.blur(sigmaX: 4, sigmaY: 4),
child: Dialog(
@ -38,86 +78,71 @@ class AppMenuDialog extends StatelessWidget {
color: Colors.white.withOpacity(.91),
borderRadius: BorderRadius.circular(20),
),
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: [
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: isPortrait
? SingleChildScrollView(
padding: EdgeInsets.all(12),
physics: BouncingScrollPhysics(),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Icon(Icons.play_arrow_outlined, size: 20, color: Colors.white),
"تصفح وتحميل الموسوعة".toText(13),
isPortrait ? 58.height : 24.height,
menuItem("الرئيسية", "assets/icons/new/home.svg", 0, isPortrait),
Container(width: 50, height: 1, color: ColorConsts.greyB5Color).paddingOnly(top: 16, bottom: 16),
menuItem("عن الموسوعة", "assets/icons/new/intro.svg", 1, isPortrait),
Container(width: 50, height: 1, color: ColorConsts.greyB5Color).paddingOnly(top: 16, bottom: 16),
menuItem("اللجنة الإشرافية", "assets/icons/new/members.svg", 4, isPortrait),
Container(width: 50, height: 1, color: ColorConsts.greyB5Color).paddingOnly(top: 16, bottom: 16),
menuItem("قراءة القرآن الكريم", "assets/icons/new/quran.svg", 2, isPortrait),
_operationButtons.paddingOnly(top: 32, bottom: 32),
_pdfButton
],
),
).onPress(() {
goToIndex(5);
})
],
),
),
)
: Column(
mainAxisSize: MainAxisSize.min,
children: [
_operationButtons.paddingOnly(top: 20, bottom: 32),
Row(
mainAxisSize: MainAxisSize.min,
children: [
menuItem("الرئيسية", "assets/icons/new/home.svg", 0, isPortrait),
Container(width: 1, height: 50, color: ColorConsts.greyB5Color).paddingOnly(left: 20, right: 20),
menuItem("عن الموسوعة", "assets/icons/new/intro.svg", 1, isPortrait),
Container(width: 1, height: 50, color: ColorConsts.greyB5Color).paddingOnly(left: 20, right: 20),
menuItem("اللجنة الإشرافية", "assets/icons/new/members.svg", 4, isPortrait),
Container(width: 1, height: 50, color: ColorConsts.greyB5Color).paddingOnly(left: 20, right: 20),
menuItem("قراءة القرآن الكريم", "assets/icons/new/quran.svg", 2, isPortrait),
],
),
32.height,
_pdfButton
],
).paddingAll(12),
),
),
);
}
Widget menuOptions(String icon) {
Widget menuOptions(String icon, bool isPortrait) {
return SvgPicture.asset(
icon,
width: 25,
height: 25,
width: isPortrait ? 25 : 30,
height: isPortrait ? 25 : 30,
color: ColorConsts.greyBAColor,
);
}
Widget menuItem(String title, String icon, int index) {
Widget menuItem(String title, String icon, int index, bool isPortrait) {
return Column(
children: [
SvgPicture.asset(
icon,
width: 25,
height: 25,
width: isPortrait ? 25 : 30,
height: isPortrait ? 25 : 30,
color: ColorConsts.darkText,
),
6.height,
title.toText(13, color: ColorConsts.darkText)
isPortrait ? 6.height : 12.height,
title.toText(isPortrait ? 13 : 16, color: ColorConsts.darkText)
],
).onPress(() => goToIndex(index));
}

@ -93,98 +93,111 @@ class _PdfListScreenState extends State<PdfListScreen> {
@override
Widget build(BuildContext context) {
return SizedBox(
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)),
contentList == null
? SizedBox()
: contentList.isEmpty
? NoDataUI()
: ListView.separated(
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
padding: EdgeInsets.only(left: 35, right: 35, top: 35, bottom: 0),
itemCount: contentList.length,
separatorBuilder: (context, index) {
return Divider(color: Color(0xffC7C7C7), height: 1, thickness: 1).paddingOnly(top: 14, bottom: 14);
},
itemBuilder: (context, index) {
return SizedBox(
height: 50,
child: Row(
children: [
SvgPicture.asset(
"assets/icons/new/download_pdf.svg",
width: 44,
height: 50,
).onPress(() async {
if (Platform.isAndroid && (await DeviceInfoPlugin().androidInfo).version.sdkInt > 29) {
savePdfToAboveAndroid32(contentList[index].exposeFilePath, contentList[index].fileName);
} else {
if (await _requestStoragePermission()) {
startFileDownload(contentList[index].exposeFilePath, contentList[index].fileName);
} else {
Utils.showToast("يجب أن تعطي الإذن للتنزيل.");
}
}
}),
7.width,
ClipRRect(
borderRadius: BorderRadius.circular(7),
child: Container(
height: 50,
alignment: Alignment.centerRight,
decoration: BoxDecoration(
color: Colors.white,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
width: 44,
height: 50,
alignment: Alignment.center,
decoration: BoxDecoration(
color: ColorConsts.darkText,
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Icon(Icons.zoom_out_map_rounded, color: Colors.white),
"تصفع".toText(10),
],
),
),
Directionality(
textDirection: TextDirection.rtl,
child: (contentList[index].fileName?.trim() ?? "").toText(18, color: ColorConsts.darkText).paddingOnly(left: 12, right: 12),
).expanded,
],
),
),
).onPress(() {
Navigator.pushNamed(context, PdfViewerScreen.routeName, arguments: contentList[index]);
}).expanded,
],
bool isPortrait = MediaQuery.of(context).orientation == Orientation.portrait;
Widget _header = SizedBox(height: isPortrait ? null : double.infinity, width: double.infinity, child: CommonHeader("التصفح والتحميل", "assets/icons/new/pdf_bg.jpg", Color(0xffAE8646)));
Widget _dataListView = contentList?.isEmpty ?? true
? NoDataUI()
: ListView.separated(
physics: isPortrait ? const NeverScrollableScrollPhysics() : const AlwaysScrollableScrollPhysics(),
shrinkWrap: isPortrait,
padding: EdgeInsets.only(left: isPortrait ? 35 : 0, right: isPortrait ? 35 : 24, top: 35, bottom: 0),
itemCount: contentList.length,
separatorBuilder: (context, index) {
return Divider(color: Color(0xffC7C7C7), height: 1, thickness: 1).paddingOnly(top: 14, bottom: 14);
},
itemBuilder: (context, index) {
return SizedBox(
height: 50,
child: Row(
children: [
SvgPicture.asset(
"assets/icons/new/download_pdf.svg",
width: 44,
height: 50,
).onPress(() async {
if (Platform.isAndroid && (await DeviceInfoPlugin().androidInfo).version.sdkInt > 29) {
savePdfToAboveAndroid32(contentList[index].exposeFilePath, contentList[index].fileName);
} else {
if (await _requestStoragePermission()) {
startFileDownload(contentList[index].exposeFilePath, contentList[index].fileName);
} else {
Utils.showToast("يجب أن تعطي الإذن للتنزيل.");
}
}
}),
7.width,
ClipRRect(
borderRadius: BorderRadius.circular(7),
child: Container(
height: 50,
alignment: Alignment.centerRight,
decoration: BoxDecoration(
color: Colors.white,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
width: 44,
height: 50,
alignment: Alignment.center,
decoration: BoxDecoration(
color: ColorConsts.darkText,
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Icon(Icons.zoom_out_map_rounded, color: Colors.white),
"تصفع".toText(10),
],
),
),
);
},
Directionality(
textDirection: TextDirection.rtl,
child: (contentList[index].fileName?.trim() ?? "").toText(18, color: ColorConsts.darkText).paddingOnly(left: 12, right: 12),
).expanded,
],
),
),
if ((haqooqAlMosasa?.length ?? 0) > 0)
Column(
).onPress(() {
Navigator.pushNamed(context, PdfViewerScreen.routeName, arguments: contentList[index]);
}).expanded,
],
),
);
},
);
Widget _aboutView = Column(
mainAxisSize: MainAxisSize.min,
children: [
"حقوق الموسوعة".toText(isPortrait ? 13 : 16, color: ColorConsts.greyLightColor),
for (ContentInfoDataModel text in haqooqAlMosasa) text.content.toText(13, color: ColorConsts.greyLightColor, textAlign: TextAlign.center)
],
);
return SizedBox(
height: double.infinity,
child: isPortrait
? SingleChildScrollView(
physics: const AlwaysScrollableScrollPhysics(),
padding: EdgeInsets.only(bottom: 140),
child: Column(
children: [
"حقوق الموسوعة".toText(13, color: ColorConsts.greyLightColor),
for (ContentInfoDataModel text in haqooqAlMosasa) text.content.toText(13, color: ColorConsts.greyLightColor, textAlign: TextAlign.center)
_header,
contentList == null ? SizedBox() : _dataListView,
if ((haqooqAlMosasa?.length ?? 0) > 0) _aboutView.paddingOnly(left: 35, right: 35, top: 35),
],
).paddingOnly(left: 35, right: 35, top: 35),
],
),
),
),
)
: Row(
children: [
Expanded(child: ((haqooqAlMosasa?.length ?? 0) > 0) ? _aboutView.paddingOnly(left: 35, right: isPortrait ? 35 : 24, top: isPortrait ? 35 : 24) : SizedBox(), flex: 3),
Expanded(child: contentList == null ? SizedBox() : _dataListView, flex: 3),
Expanded(child: _header, flex: 4),
],
),
);
}
@ -194,7 +207,7 @@ class _PdfListScreenState extends State<PdfListScreen> {
UriPermission permissionUri = _persistedPermissionUris.first;
startFileDownloadAboveAndroid32(pathUrl, fileName, permissionUri.uri);
} else {
Uri selectedDocumentUris = await openDocumentTree();
Uri selectedDocumentUris = await openDocumentTree();
if (selectedDocumentUris == null) return;
savePdfToAboveAndroid32(pathUrl, fileName);
}

Loading…
Cancel
Save