i am using GestureDetector and onTap() in flutter i have
an error:
(Handler: "onTap" Recognizer: TapGestureRecognizer")
when clicking the onTap()
Event
I cannot show the next Screen
I Used route method:
Navigator.of(context).pushNamed('AboutUsScreen');
and MaterialPageRoute method this `
Navigator.of(context).push(MaterialPageRoute(builder: (context) => AboutUsScreen()));`
Expanded(
child: ListView(
shrinkWrap: true,
// scrollDirection: Axis.horizontal,
//shrinkWrap: bool.fromEnvironment("true"),
children: <Widget>[
GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: () {
// Navigator.of(context).pushNamed('AboutUsScreen1111111');
Navigator.of(context).push(MaterialPageRoute(
builder: (context) => AboutUsScreen()));
Navigator.pushNamed(context, '/about');
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
new AboutUsScreen1111111()));
},
child: const Card(
elevation: 10,
color: Colors.blueAccent,
child: Padding(
padding: EdgeInsets.all(5),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
Icon(Icons.document_scanner,
fill: BorderSide.strokeAlignCenter),
Text(
"AboutUS",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontSize: 28,
),
),
],
),
),
),
),
),
],
),
)
What is the problem?
2
Answers
The solution was strange I have separated the body of my widget out of main widget (type of widget statelesswidget) and run it. it is very strange .
The Error Was About BuildContext But I Can't know if it has Any RelationShip. thank for all
Kindly run this, it works:
kindly let me know if this helps you.