Created
February 28, 2020 13:09
-
-
Save amanjaymariner/a581d9377571ea925259da3e5f8386e2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:marinepedia_app/src/Mmd_Exams.dart'; | |
import 'package:marinepedia_app/src/Mmdexam.dart'; | |
import 'package:marinepedia_app/utils/marinepediaicons_icons.dart'; | |
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; | |
class HomeScreen extends StatefulWidget { | |
@override | |
_HomeScreenState createState() => _HomeScreenState(); | |
} | |
class _HomeScreenState extends State<HomeScreen>{ | |
Material myitems(IconData icon,String heading, int color){ | |
return Material( | |
color: Colors.deepPurpleAccent, | |
elevation: 14.0, | |
shadowColor: Color(0x802196F3), | |
borderRadius: BorderRadius.circular(24.0), | |
child: Center( | |
child: Padding( | |
padding: const EdgeInsets.all(8.0), | |
child: Row( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: <Widget>[ | |
Column( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: <Widget>[ | |
//text | |
Padding( | |
padding: const EdgeInsets.all(8.0), | |
child: Text(heading, | |
style: TextStyle( | |
color: new Color(color), | |
fontSize: 20.0, | |
), | |
), | |
), | |
//Icon | |
Material( | |
color: new Color(color), | |
borderRadius: BorderRadius.circular(24.0), | |
child: Padding( | |
padding: const EdgeInsets.all(10.0), | |
child: Icon( | |
icon, | |
color: Colors.deepPurple, | |
size: 40.0, | |
), | |
), | |
) | |
], | |
) | |
], | |
), | |
), | |
), | |
); | |
} | |
Widget appbarTitle = Text("Marinepedia"); | |
GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey(); | |
@override | |
Widget build(BuildContext context){ | |
return Scaffold( | |
key: _scaffoldKey, | |
appBar: AppBar( | |
leading: IconButton( | |
icon:Icon(Icons.menu), | |
onPressed: () { | |
_scaffoldKey.currentState.openDrawer(); | |
}), | |
title: appbarTitle, | |
centerTitle: true, | |
backgroundColor: Colors.deepPurpleAccent, | |
actions:<Widget>[ | |
IconButton(icon: Icon(Icons.scatter_plot), onPressed: () {}) | |
] | |
), | |
body:Padding( | |
padding :const EdgeInsets.all(2.0), | |
child:StaggeredGridView.count( | |
crossAxisCount: 2, | |
crossAxisSpacing: 5.0, | |
mainAxisSpacing: 5.0, | |
padding: EdgeInsets.symmetric(horizontal: 5.0,vertical: 15.0), | |
children:<Widget>[ | |
InkWell( | |
onTap:(){ | |
Navigator.push(context, | |
MaterialPageRoute(builder:(context)=>MmdExams()), | |
); | |
}, | |
child: myitems(Icons.graphic_eq,"Recent Updates",0xffffffff), | |
), | |
InkWell ( | |
onTap:(){ | |
Navigator.push(context, | |
MaterialPageRoute(builder:(context)=>MmdExams()), | |
); | |
}, | |
child: myitems(Icons.library_books,"MMD Exams",0xffffffff), | |
), | |
GestureDetector( | |
onTap:(){ | |
Navigator.push(context, | |
MaterialPageRoute(builder:(context)=>MmdExams()), | |
); | |
}, | |
child: myitems(Icons.border_color,"Blogs",0xffffffff), | |
), | |
myitems(Icons.ondemand_video,"Video Tutorials",0xffffffff), | |
myitems(Icons.chrome_reader_mode,"Calculator",0xffffffff), | |
myitems(Icons.equalizer,"Quiz",0xffffffff), | |
myitems(Icons.youtube_searched_for,"Dictionary",0xffffffff), | |
myitems(Icons.group_add,"Join Marinepedia Community",0xffffffff), | |
], | |
staggeredTiles: [ | |
StaggeredTile.extent(2, 120.0), | |
StaggeredTile.extent(1, 120.0), | |
StaggeredTile.extent(1, 120.0), | |
StaggeredTile.extent(1, 120.0), | |
StaggeredTile.extent(1, 120.0), | |
StaggeredTile.extent(1, 120.0), | |
StaggeredTile.extent(1, 120.0), | |
StaggeredTile.extent(2, 120.0), | |
], | |
), | |
), | |
drawer: Drawer( | |
child:ListView( | |
padding: EdgeInsets.zero, | |
children:<Widget>[ | |
UserAccountsDrawerHeader( | |
accountName: Text("Mariners Menu"), | |
accountEmail: Text("Support - marinepediadeveloper@gmail.com"), | |
currentAccountPicture: CircleAvatar( | |
backgroundColor: Colors.deepPurpleAccent, | |
radius: 50.0, | |
child: Icon(Marinepediaicons.ship_wheel, | |
size: 95.0, | |
color: Colors.white, | |
), | |
), | |
), | |
ListTile( | |
title:Text("Homepage"), | |
trailing: Icon(Icons.home), | |
onTap:(){ | |
Navigator.push(context,MaterialPageRoute(builder: (context)=>MMDexam()), | |
); | |
} , | |
), | |
ListTile( | |
title:Text("Marine Ebooks"), | |
trailing: Icon(Icons.collections_bookmark), | |
onTap:(){ | |
Navigator.pop(context); | |
}, | |
), | |
ListTile( | |
title:Text("To Do List"), | |
trailing: Icon(Icons.playlist_add), | |
onTap:(){ | |
Navigator.pop(context); | |
}, | |
), | |
ListTile( | |
title:Text("Request for Printing"), | |
trailing: Icon(Icons.chrome_reader_mode), | |
onTap:(){ | |
Navigator.pop(context); | |
}, | |
), | |
ListTile( | |
title:Text("Share Your Notes"), | |
trailing: Icon(Icons.note_add), | |
onTap:(){ | |
Navigator.pop(context); | |
}, | |
), | |
Divider(), | |
ListTile( | |
title:Text("Donate"), | |
trailing: Icon(Icons.monetization_on), | |
onTap:(){ | |
Navigator.pop(context); | |
}, | |
), | |
ListTile( | |
title:Text("About us"), | |
trailing: Icon(Icons.account_box), | |
onTap:(){ | |
Navigator.pop(context); | |
}, | |
), | |
ListTile( | |
title:Text("Rate Us"), | |
trailing: Icon(Icons.rate_review), | |
onTap:(){ | |
Navigator.pop(context); | |
}, | |
), | |
ListTile( | |
title:Text("Share with Friends"), | |
trailing: Icon(Icons.share), | |
onTap:(){ | |
Navigator.pop(context); | |
}, | |
), | |
] | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment