import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:landregapp/HomePage.dart';
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
import 'package:landregapp/TypeofLands.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: "landRegistration App",
theme: new ThemeData(primarySwatch: Colors.amber),
home: landReg(),
);
}
}
class landReg extends StatefulWidget {
@override
_landRegState createState() => _landRegState();
}
class _landRegState extends State<landReg> {
Material myItems(IconData icon, String heading )
{
return Material(
color: Colors.amber,
elevation: 14.0,
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>[
Padding(
padding: const EdgeInsets.all(1.0),
child: Icon(
icon,
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
heading,
style: TextStyle(
fontWeight: FontWeight.w700,
),
),
),
],
)
],
),
)
)
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: new AppBar(
title: new Text("Home page"),
elevation: 5.0,
),
drawer: new Drawer(
child: new ListView(
children: <Widget>[
new UserAccountsDrawerHeader(
accountName: new Text("MLHUD"),
accountEmail: new Text("dennisfo@mlhud.go.ug"),
currentAccountPicture: new CircleAvatar(
radius: 90.0,
backgroundImage: AssetImage('asset/image/uganda.jpg'),
backgroundColor: Colors.transparent,
),
),
new ListTile(
leading: Icon(Icons.home),
title: new Text("Home"),
),
new ListTile(
leading: Icon(Icons.assignment),
title: new Text("Terms and Conditions"),
),
new ListTile(
leading: Icon(Icons.info),
title: new Text("About App"),
),
new ListTile(
leading: Icon(Icons.phone),
title: new Text("Contact Us"),
),
new ListTile(
leading: Icon(Icons.share),
title: new Text("Share"),
),
new ListTile(
leading: Icon(Icons.exit_to_app),
title: new Text("Exit"),
),
],
),
),
body:StaggeredGridView.count(
crossAxisCount: 2,
crossAxisSpacing: 12.0,
mainAxisSpacing: 12.0,
padding: EdgeInsets.symmetric(horizontal: 10.0,vertical: 8.0),
children: <Widget>[
InkWell(
onTap:(){
Navigator.push(context,
MaterialPageRoute(builder:(context)=>resetPage()),
);
},
child: myItems(Icons.graphic_eq,"Recent Updates"),
),
InkWell (
onTap:(){
Navigator.push(context,
MaterialPageRoute(builder:(context)=>HomePage()),
);
},
child: myItems(Icons.library_books,"MMD Exams"),
),
GestureDetector(
onTap:(){
Navigator.push(context,
MaterialPageRoute(builder:(context)=>resetPage()),
);
},
child: myItems(Icons.border_color,"Blogs"),
),
myItems(Icons.assignment,"APPLICATION STATUS"),
myItems(Icons.event_note,"REGISTRATION STATUS"),
myItems(Icons.location_on,"PARCEL LOCATOR"),
myItems(Icons.crop_square,"AREASIZE CONVERTER"),
myItems(Icons.help,"HELP"),
],
staggeredTiles: [
StaggeredTile.extent(1, 170.0),
StaggeredTile.extent(1, 170.0),
StaggeredTile.extent(1, 170.0),
StaggeredTile.extent(1, 170.0),
StaggeredTile.extent(1, 170.0),
StaggeredTile.extent(1, 170.0),
],
)
);
}
}
Здесь ontap не работает на StaggeredgridviewTile
. В чем проблема в моем коде?
GestureDetector(
onTap:(){
Navigator.push(context,
MaterialPageRoute(builder:(context)=>resetPage()),
);
},
child: myItems(Icons.border_color,"Blogs"),
),
gridview не работает с onTap()
. В чем проблема?