Static Nav Drawer in landscape

This commit is contained in:
Sewmina
2022-04-25 15:01:05 +05:30
parent 9f5ef1a7f1
commit 8af736fab1
11 changed files with 507 additions and 366 deletions

View File

@@ -68,6 +68,7 @@ class _TodosPageState extends State<TodosPage> {
simpleTodos.add(todo);
}
}
bool landscape=((MediaQuery.of(context).size.width / MediaQuery.of(context).size.height) > 1);
return Scaffold(
floatingActionButton: FloatingActionButton.extended(
onPressed: () {
@@ -121,112 +122,122 @@ class _TodosPageState extends State<TodosPage> {
],
),
),
drawer: navDrawer(context, 9),
body: SingleChildScrollView(
// margin: EdgeInsets.fromLTRB(2, 10, 0, 10),
child: Column(
children: [
Container(
margin: EdgeInsets.all(8),
padding: EdgeInsets.symmetric(vertical: 10),
decoration: BoxDecoration(color: Colors.black26, borderRadius: BorderRadius.circular(10)),
child: (projects.length <=0) ?Row(
mainAxisAlignment: MainAxisAlignment.center,
drawer: landscape ? null : navDrawer(context, 9),
body: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.start,
children: [
landscape?navDrawer(context, 9) : Container(),
Expanded(
child: SingleChildScrollView(
// margin: EdgeInsets.fromLTRB(2, 10, 0, 10),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text('No Todos Related to Projects'),
],
) :ScrollablePositionedList.builder(
shrinkWrap: true,
itemCount: projects.length,
itemBuilder: (context, i) {
String thisProject= projects.keys.toList()[i];
return Container(
margin: EdgeInsets.symmetric(horizontal: 0,vertical: 8),
Container(
margin: EdgeInsets.all(8),
padding: EdgeInsets.symmetric(vertical: 10),
decoration: BoxDecoration(color: Colors.black26, borderRadius: BorderRadius.circular(10)),
child: (projects.length <=0) ?Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('No Todos Related to Projects'),
],
) :ScrollablePositionedList.builder(
shrinkWrap: true,
itemCount: projects.length,
itemBuilder: (context, i) {
String thisProject= projects.keys.toList()[i];
return Container(
margin: EdgeInsets.symmetric(horizontal: 0,vertical: 8),
child: Column(
children: [
InkWell(
onTap: (){
if(expandedProjects.contains(thisProject)){
expandedProjects.remove(thisProject);
}else{
expandedProjects.add(thisProject);
}
setState(() {
});
},
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Icon((!expandedProjects.contains(thisProject)) ? Icons.keyboard_arrow_right_outlined : Icons.keyboard_arrow_down_outlined),
Text('${projects.keys.toList()[i]} (${projects.values.toList()[i].length})',style: TextStyle(fontSize: 18)),
],
),
Container(),
],
),
),
if(expandedProjects.contains(thisProject))Container(
padding: EdgeInsets.fromLTRB(8, 0, 8, 0),
child: ScrollablePositionedList.builder(
shrinkWrap: true,
itemCount: projects.values.toList()[i].length,
itemBuilder: (context, index) {
int maxCharCount = 100;
Todo todo = projects.values.toList()[i][index];
print('$i : $index');
return todoCard(todo);
}),
),
],
),
);
}
),
),
Container(
margin: EdgeInsets.all(8),
padding: EdgeInsets.symmetric(vertical: 10),
decoration: BoxDecoration(color: Colors.black26, borderRadius: BorderRadius.circular(15)),
child: Column(
children: [
InkWell(
onTap: (){
if(expandedProjects.contains(thisProject)){
expandedProjects.remove(thisProject);
}else{
expandedProjects.add(thisProject);
onTap: (){expandedSimpleTodos=!expandedSimpleTodos;setState(() {
}
setState(() {
});
},
});},
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Icon((!expandedProjects.contains(thisProject)) ? Icons.keyboard_arrow_right_outlined : Icons.keyboard_arrow_down_outlined),
Text('${projects.keys.toList()[i]} (${projects.values.toList()[i].length})',style: TextStyle(fontSize: 18)),
],
),
Row(
children: [
Icon((!expandedSimpleTodos) ? Icons.keyboard_arrow_right_outlined : Icons.keyboard_arrow_down_outlined),
Text('Typical Todos (${simpleTodos.length})',style: TextStyle(fontSize: 18)),
],
),
Container(),
],
),
),
if(expandedProjects.contains(thisProject))Container(
if(expandedSimpleTodos)Container(
padding: EdgeInsets.fromLTRB(8, 0, 8, 0),
child: ScrollablePositionedList.builder(
shrinkWrap: true,
itemCount: projects.values.toList()[i].length,
itemCount: simpleTodos.length,
itemBuilder: (context, index) {
int maxCharCount = 100;
Todo todo = projects.values.toList()[i][index];
print('$i : $index');
Todo todo = simpleTodos[index];
return todoCard(todo);
}),
),
],
),
);
}
),
),
Container(
margin: EdgeInsets.all(8),
padding: EdgeInsets.symmetric(vertical: 10),
decoration: BoxDecoration(color: Colors.black26, borderRadius: BorderRadius.circular(15)),
child: Column(
children: [
InkWell(
onTap: (){expandedSimpleTodos=!expandedSimpleTodos;setState(() {
});},
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Icon((!expandedSimpleTodos) ? Icons.keyboard_arrow_right_outlined : Icons.keyboard_arrow_down_outlined),
Text('Typical Todos (${simpleTodos.length})',style: TextStyle(fontSize: 18)),
],
),
Container(),
],
),
),
if(expandedSimpleTodos)Container(
padding: EdgeInsets.fromLTRB(8, 0, 8, 0),
child: ScrollablePositionedList.builder(
shrinkWrap: true,
itemCount: simpleTodos.length,
itemBuilder: (context, index) {
int maxCharCount = 100;
Todo todo = simpleTodos[index];
return todoCard(todo);
}),
),
],
),
),
],
),
),
],
),
);
}