Skip to content

Commit

Permalink
updateed with some of the parameters from gesture detector
Browse files Browse the repository at this point in the history
  • Loading branch information
Daviiddoo committed Jun 1, 2024
1 parent 7262a91 commit bee7736
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion forui/lib/src/widgets/button/tappable.dart
Original file line number Diff line number Diff line change
@@ -1,18 +1,31 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';

/// A [FTappable] creates a scale animation that mimics a tap.
class FTappable extends StatefulWidget {
/// The callback for when this [FTappable] is pressed.
final VoidCallback? onPressed;

/// The behavior
final HitTestBehavior behavior;

/// Determines the way that drag start behavior is handled.
final DragStartBehavior dragStartBehavior;

/// The callback for when this [FTappable] is pressed.
final bool excludeFromSemantics;

/// This child.
final Widget child;

/// Creates a [FTappable] widget.
const FTappable({
required this.child,
this.onPressed,
this.behavior = HitTestBehavior.deferToChild,
this.dragStartBehavior = DragStartBehavior.start,
this.excludeFromSemantics = false,
super.key,
});

Expand All @@ -22,6 +35,9 @@ class FTappable extends StatefulWidget {
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties.add(ObjectFlagProperty<VoidCallback?>.has('onPressed', onPressed));
properties.add(EnumProperty<HitTestBehavior?>('behavior', behavior));
properties.add(EnumProperty<DragStartBehavior?>('dragStartBehavior', dragStartBehavior));
properties.add(DiagnosticsProperty<bool>('excludeFromSemantics', excludeFromSemantics));
}
}

Expand Down Expand Up @@ -49,7 +65,9 @@ class _FTappableState extends State<FTappable> with SingleTickerProviderStateMix
Widget build(BuildContext context) => ScaleTransition(
scale: _animation,
child: GestureDetector(
behavior: HitTestBehavior.deferToChild,
behavior: widget.behavior,
dragStartBehavior: widget.dragStartBehavior,
excludeFromSemantics: widget.excludeFromSemantics,
onTap: widget.onPressed == null
? null
: () {
Expand Down

0 comments on commit bee7736

Please sign in to comment.