Skip to content

Commit

Permalink
Merge pull request #59 from icapps/feature/EnhanceTouchFeedback
Browse files Browse the repository at this point in the history
Adds extra options for controlling the shape of the touch feedback material layer
  • Loading branch information
NicolaVerbeeck committed Nov 12, 2021
2 parents 6e67cb2 + 761618f commit 7a7ec6b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,4 +1,8 @@
# Changelog
## [0.4.4] - 2021-10-11
### Added
- Adds more options to the TouchFeedback widget to control the material layer

## [0.4.3] - 2021-09-29
### Added
- Add .value constructor for BaseProviderWidget
Expand Down
18 changes: 17 additions & 1 deletion lib/src/widget/touch_feedback/touch_feedback.dart
Expand Up @@ -11,13 +11,17 @@ class TouchFeedBack extends StatelessWidget {
final Color? androidSplashColor;
final Color color;
final BorderRadius? borderRadius;
final double elevation;
final ShapeBorder? shapeBorder;

const TouchFeedBack({
required this.child,
required this.onClick,
this.borderRadius,
this.androidSplashColor,
this.color = Colors.transparent,
this.elevation = 0,
this.shapeBorder,
Key? key,
}) : super(key: key);

Expand All @@ -31,16 +35,21 @@ class TouchFeedBack extends StatelessWidget {
onClick: onClick,
color: color,
borderRadius: borderRadius,
elevation: elevation,
shapeBorder: shapeBorder,
);
}

Widget _buildAndroid() {
return Material(
borderRadius: borderRadius,
color: color,
elevation: elevation,
shape: shapeBorder,
child: onClick == null
? child
: InkWell(
customBorder: shapeBorder,
borderRadius: borderRadius,
splashColor: androidSplashColor,
onTap: onClick,
Expand All @@ -55,13 +64,18 @@ class TouchFeedBackIOS extends StatefulWidget {
final VoidCallback? onClick;
final Color color;
final BorderRadius? borderRadius;
final ShapeBorder? shapeBorder;
final double elevation;

const TouchFeedBackIOS({
required this.child,
required this.onClick,
this.borderRadius,
this.color = Colors.transparent,
});
this.shapeBorder,
this.elevation = 0,
Key? key,
}) : super(key: key);

@override
_TouchFeedBackIOSState createState() => _TouchFeedBackIOSState();
Expand All @@ -86,6 +100,8 @@ class _TouchFeedBackIOSState extends State<TouchFeedBackIOS> {
borderRadius: widget.borderRadius,
color: widget.color,
child: widget.child,
shape: widget.shapeBorder,
elevation: widget.elevation,
),
),
);
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Expand Up @@ -3,7 +3,7 @@ description: icapps architecture components for flutter projects. Contains commo
homepage: https://github.com/icapps/flutter-icapps-architecture
repository: https://github.com/icapps/flutter-icapps-architecture

version: 0.4.3
version: 0.4.4

environment:
sdk: '>=2.12.0 <3.0.0'
Expand Down

0 comments on commit 7a7ec6b

Please sign in to comment.