Static Nav Drawer in landscape
This commit is contained in:
@@ -44,6 +44,7 @@ class _ProjectsState extends State<Projects> {
|
||||
int selectedPage = 0;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
bool landscape=((MediaQuery.of(context).size.width / MediaQuery.of(context).size.height) > 1);
|
||||
return SafeArea(child: Scaffold(
|
||||
floatingActionButton: FloatingActionButton.extended(
|
||||
onPressed: () {
|
||||
@@ -97,106 +98,128 @@ class _ProjectsState extends State<Projects> {
|
||||
//Container(color: Colors.red,child: Text("Offline",style:TextStyle(fontSize: 5))),
|
||||
],
|
||||
)),
|
||||
drawer: navDrawer(context, 7),
|
||||
drawer: landscape ? null : navDrawer(context, 7),
|
||||
body:
|
||||
(User.projects.isEmpty)? Container(child: Image.asset(('images/project.png'),color: Colors.white.withOpacity(0.6), colorBlendMode: BlendMode.modulate,)) :
|
||||
(selectedPage == 0) ?
|
||||
Container(
|
||||
padding: EdgeInsets.all(15),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Card(child:
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
FaIcon(FontAwesomeIcons.cogs, color: Colors.yellow),
|
||||
SizedBox(width: 15,),
|
||||
Text('Active Projects (${User.projects.length})',style:TextStyle(fontSize: 18)),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
Container(
|
||||
height: 200,
|
||||
child: ListView.builder(
|
||||
itemCount: User.projects.length,
|
||||
itemBuilder: (context,index){
|
||||
return InkWell(
|
||||
onTap: (){
|
||||
Navigator.of(context).push(MaterialPageRoute(builder: (context)=> ProjectDetails(project: User.projects[index],)));
|
||||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(color: Colors.black26, borderRadius: BorderRadius.circular(10)),
|
||||
padding:EdgeInsets.all(8),
|
||||
margin: EdgeInsets.all(1),
|
||||
child:
|
||||
Row(mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(flex:3,child: Text(User.projects[index].name)),
|
||||
Expanded(flex:2,child: Text('20% [200h]')),
|
||||
Expanded(
|
||||
flex:2,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
color: User.projects[index].cat!.productive ? Colors.green : Colors.redAccent,
|
||||
),
|
||||
padding:EdgeInsets.symmetric(horizontal: 8),
|
||||
child:Text(User.projects[index].cat!.name)
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
landscape?navDrawer(context, 7) : Container(),
|
||||
Expanded(
|
||||
child: (User.projects.isEmpty)? Container(child: Image.asset(('images/project.png'),color: Colors.white.withOpacity(0.6), colorBlendMode: BlendMode.modulate,)) :
|
||||
(selectedPage == 0) ?
|
||||
SingleChildScrollView(
|
||||
scrollDirection: Axis.vertical,
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(15),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Card(child:
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
FaIcon(FontAwesomeIcons.cogs, color: Colors.yellow),
|
||||
SizedBox(width: 15,),
|
||||
Text('Active Projects (${User.projects.length})',style:TextStyle(fontSize: 18)),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
Container(
|
||||
height: 200,
|
||||
child: ListView.builder(
|
||||
itemCount: User.projects.length,
|
||||
itemBuilder: (context,index){
|
||||
int progress = 0;
|
||||
for (var value in User.projects[index].steps) {
|
||||
if(value.finishedDate!=null){
|
||||
progress += value.progress;
|
||||
}
|
||||
}
|
||||
|
||||
return InkWell(
|
||||
onTap: (){
|
||||
Navigator.of(context).push(MaterialPageRoute(builder: (context)=> ProjectDetails(project: User.projects[index],)));
|
||||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(color: Colors.black26, borderRadius: BorderRadius.circular(10)),
|
||||
padding:EdgeInsets.all(8),
|
||||
margin: EdgeInsets.all(1),
|
||||
child:
|
||||
Row(mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(flex:3,child: Text(User.projects[index].name)),
|
||||
Expanded(flex:2,child: Text('$progress%')),
|
||||
Expanded(
|
||||
flex:2,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
color: User.projects[index].cat!.productive ? Colors.green : Colors.redAccent,
|
||||
),
|
||||
padding:EdgeInsets.symmetric(horizontal: 8),
|
||||
child:Text(User.projects[index].cat!.name)
|
||||
)
|
||||
],),
|
||||
)
|
||||
],
|
||||
)
|
||||
],),
|
||||
)
|
||||
],
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
),
|
||||
);
|
||||
}
|
||||
),
|
||||
)
|
||||
)
|
||||
|
||||
],
|
||||
),
|
||||
)),
|
||||
SizedBox(height: 30,),
|
||||
Card(child:
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
],
|
||||
),
|
||||
)),
|
||||
SizedBox(height: 30,),
|
||||
Card(child:
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
FaIcon(FontAwesomeIcons.check,color: Colors.green,),
|
||||
SizedBox(width: 15,),
|
||||
Text('Finished Projects (0)',style:TextStyle(fontSize: 18)),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
Container(
|
||||
height: 50,
|
||||
)
|
||||
|
||||
],
|
||||
),
|
||||
)),
|
||||
],
|
||||
)),
|
||||
)
|
||||
:
|
||||
SingleChildScrollView(
|
||||
scrollDirection: Axis.vertical,
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(10),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
FaIcon(FontAwesomeIcons.check,color: Colors.green,),
|
||||
SizedBox(width: 15,),
|
||||
Text('Finished Projects (0)',style:TextStyle(fontSize: 18)),
|
||||
],
|
||||
Column(
|
||||
children: printProjects(),
|
||||
),
|
||||
Divider(),
|
||||
Container(
|
||||
height: 50,
|
||||
)
|
||||
|
||||
],
|
||||
),
|
||||
)),
|
||||
],
|
||||
))
|
||||
:
|
||||
Container(
|
||||
padding: EdgeInsets.all(10),
|
||||
child: Column(
|
||||
children: [
|
||||
Column(
|
||||
children: printProjects(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user