Reputation: 5788
I'm trying to record a video when a button is pressed long (in flutter)
This is my code:
GestureDetector(
onLongPressStart: () {print("START VIDEO");}
onLongPressEnd: () {print("END VIDEO");}
onTap: () {print("take photo");},
child: Container(
width: 40,
height: 40,
color: Colors.red,
child: Text("BUTTON"),
),
),
But it gives an error:
... can't be assigned to the parameter type 'void Function(LongPressEndDetails)'.
What is LongPressEndDetails
?
Upvotes: 0
Views: 2210
Reputation: 268494
onLongPressStart
requires you to pass LongPressStartDetails
, so
Instead of
onLongPressStart: () {...}
use
onLongPressStart: (LongPressStartDetails details) {...}
or simply
onLongPressStart: (details) {...}
Upvotes: 2
Reputation: 5788
Tried this and it's working...
onLongPress: () {
print('start recording');
},
onLongPressUp: () {
print('stop recording');
},
Upvotes: 0