navigation drawer improvement.

development
Sikander Saleem 5 years ago
parent a30ed559c8
commit a572a7c592

@ -217,30 +217,34 @@ class _CommonAppbarState extends State<CommonAppbar> {
itemCount: navigationList.length, itemCount: navigationList.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
String icon = "assets/icons/${navigationList[index].mobileFontIcon}.svg"; String icon = "assets/icons/${navigationList[index].mobileFontIcon}.svg";
if (navigationList[index].parentId == 1) { var subList = navigationList.where((element) => element.parentId == navigationList[index].navigationId).toList();
return myListItem(icon, navigationList[index].navigationText, navigationList[index].orderNo == 1 ? true : false, onTap: () { return Column(
mainAxisSize: MainAxisSize.min,
children: [
if (navigationList[index].parentId == 1)
myListItem(icon, navigationList[index].navigationText, navigationList[index].orderNo == 1 ? true : false, onTap: () {
String url = navigationList[index]?.mobileNavigationUrl ?? ""; String url = navigationList[index]?.mobileNavigationUrl ?? "";
if (url.isEmpty || url.length < 2) { if (url.isEmpty || url.length < 2) {
return; return;
} }
Navigator.pushNamed(context, url, arguments: null); Navigator.pushNamed(context, url, arguments: null);
}); }),
} else { for (var subItem in subList)
return Container( Container(
width: double.infinity, width: double.infinity,
child: Row( child: Row(
children: [ children: [
Expanded( Expanded(
child: myListItem(icon, navigationList[index].navigationText, false, onTap: () { child: myListItem("assets/icons/${subItem.mobileFontIcon}.svg", subItem.navigationText, false, onTap: () {
String url = navigationList[index]?.mobileNavigationUrl ?? ""; String url = subItem.mobileNavigationUrl ?? "";
if (url.isEmpty) { if (url.isEmpty) {
return; return;
} }
var contentId; var contentId;
if (navigationList[index].mobileNavigationUrl == "/introduction") { if (subItem.mobileNavigationUrl == "/introduction") {
url = ContentInfoScreen.routeName; url = ContentInfoScreen.routeName;
contentId = 2; contentId = 2;
} else if (navigationList[index].mobileNavigationUrl == "/encyclopedia") { } else if (subItem.mobileNavigationUrl == "/encyclopedia") {
url = ContentInfoScreen.routeName; url = ContentInfoScreen.routeName;
contentId = 1; contentId = 1;
} }
@ -254,9 +258,11 @@ class _CommonAppbarState extends State<CommonAppbar> {
), ),
], ],
), ),
)
],
); );
} }),
})), ),
Container( Container(
margin: EdgeInsets.only(top: 16, bottom: 12), margin: EdgeInsets.only(top: 16, bottom: 12),
padding: EdgeInsets.only(left: 32, right: 32), padding: EdgeInsets.only(left: 32, right: 32),

Loading…
Cancel
Save