I am trying in vain to add onLongPress
to an image button along with onPressed
. I get error: The named parameter 'onDoubleTap' isn't defined.
I have multiple rows of 2 horizontal image buttons using rows and expanded. Everything works except onLongPress
(or onDoubleTap
). What am I doing wrong, do I have to rebuild the entire code in a different format, or am I overcomplicating this?
I also tried to add a new child (error: already defined), GestureDetector
, InkWell
, with no success.
body: SingleChildScrollView(
child: Container(
child: Column(
children: <Widget>[
Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Expanded(
child: FlatButton(
onPressed: () {
setState(() {
launchURL();
});
},
//Trying to add onLongPress , error: "onLongPress not defined
//If I try add a new child it says child already defined
onLongPress: () => _showAlertMessage(context, "message"),
padding: EdgeInsets.all(6.0),
child: Image.asset(
'images/image1.png',
))),
Expanded(
child: FlatButton(
onPressed: () {
setState(() {
launchURL();
});
},
padding: EdgeInsets.all(6.0),
child: Image.asset(
'images/image2.png',
)
)//flat button
),//expanded
])), //row-center
//Repeat above for rows of 2 more image buttons
The code runs with a single onPressed
for each button and does not display any errors, but adding any second click event displays errors.