button feedback

merge-requests/140/head
Sultan Khan 5 years ago
parent 29eaa26b36
commit 857fc813cd

@ -23,12 +23,19 @@ class PermissionService extends BaseService {
isVibrationEnabled() {
return storage.getItem('isVibration') ==null ? false :true;
}
vibrate() async{
vibrate(callback, context) async{
if (callback == null)
return null;
if(isVibrationEnabled() ==true){
if (await Vibration.hasVibrator()) {
Vibration.vibrate(duration: 100);
callback();
}
}else{
callback();
}
}

@ -90,7 +90,7 @@ class _ButtonState extends State<Button> with TickerProviderStateMixin {
onTapCancel: () {
_animationController.forward();
},
onTap: (){Feedback.wrapForTap(widget.onTap, context); permission.vibrate();},
onTap: (){permission.vibrate(widget.onTap, context);},
behavior: HitTestBehavior.opaque,
child: Transform.scale(
scale: _buttonSize,

@ -24,6 +24,6 @@ class DefaultButton extends StatelessWidget {
this.text,
style: TextStyle(fontSize: SizeConfig.textMultiplier * 2),
),
onPressed: () =>{ this.onPress(), permission.vibrate()}));
onPressed:(){permission.vibrate(this.onPress, context); }));
}
}

@ -63,7 +63,7 @@ class _FloatingButtonState extends State<FloatingButton>
onTapCancel: () {
_animationController.forward();
},
onTap:(){ Feedback.wrapForTap(widget.onTap, context); permission.vibrate();},
onTap: (){permission.vibrate(widget.onTap, context);},
behavior: HitTestBehavior.opaque,
child: Transform.scale(
scale: _buttonSize,

@ -88,7 +88,7 @@ class _MiniButtonState extends State<MiniButton> with TickerProviderStateMixin {
_animationController.forward();
},
// onTap: Feedback.wrapForTap(widget.onTap, context),
onTap: () =>{ widget.onTap(), permission.vibrate()},
onTap: (){permission.vibrate(widget.onTap, context);},
behavior: HitTestBehavior.opaque,
child: Transform.scale(
scale: _buttonSize,

@ -144,7 +144,7 @@ class _SecondaryButtonState extends State<SecondaryButton>
onTapCancel: () {
_animationController.forward();
},
onTap: () =>{ widget.disabled ? null : widget.onTap(), permission.vibrate()},
onTap: () =>{ widget.disabled ? null : permission.vibrate(widget.onTap, context)},
// onTap: widget.disabled?null:Feedback.wrapForTap(widget.onTap, context),
behavior: HitTestBehavior.opaque,
child: Transform.scale(

Loading…
Cancel
Save