From 4266dc3f77a0ee7de3e800303bb6438f8723aa2f Mon Sep 17 00:00:00 2001 From: Nicola Verbeeck Date: Mon, 11 Oct 2021 13:32:02 +0200 Subject: [PATCH 1/2] Adds extra options for controlling the shape of the touch feedback material layer. Fixes #58 --- CHANGELOG.md | 4 +++ .../widget/touch_feedback/touch_feedback.dart | 28 +++++++++++++++---- pubspec.yaml | 2 +- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e4c56a5..e190712 100644 --- a/CHANGELOG.md +++ b/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 diff --git a/lib/src/widget/touch_feedback/touch_feedback.dart b/lib/src/widget/touch_feedback/touch_feedback.dart index 027ec78..e622a47 100644 --- a/lib/src/widget/touch_feedback/touch_feedback.dart +++ b/lib/src/widget/touch_feedback/touch_feedback.dart @@ -11,6 +11,8 @@ class TouchFeedBack extends StatelessWidget { final Color? androidSplashColor; final Color color; final BorderRadius? borderRadius; + final double elevation; + final ShapeBorder? shapeBorder; const TouchFeedBack({ required this.child, @@ -18,6 +20,8 @@ class TouchFeedBack extends StatelessWidget { this.borderRadius, this.androidSplashColor, this.color = Colors.transparent, + this.elevation = 0, + this.shapeBorder, Key? key, }) : super(key: key); @@ -31,6 +35,8 @@ class TouchFeedBack extends StatelessWidget { onClick: onClick, color: color, borderRadius: borderRadius, + elevation: elevation, + shapeBorder: shapeBorder, ); } @@ -38,9 +44,12 @@ class TouchFeedBack extends StatelessWidget { return Material( borderRadius: borderRadius, color: color, + elevation: elevation, + shape: shapeBorder, child: onClick == null ? child : InkWell( + customBorder: shapeBorder, borderRadius: borderRadius, splashColor: androidSplashColor, onTap: onClick, @@ -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, - }); + 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(); @@ -86,6 +100,8 @@ class _TouchFeedBackIOSState extends State { borderRadius: widget.borderRadius, color: widget.color, child: widget.child, + shape: widget.shapeBorder, + elevation: widget.elevation, ), ), ); diff --git a/pubspec.yaml b/pubspec.yaml index 418421f..fe44171 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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' From 761618f7b499acd52c827eaa8772126ba571a3d9 Mon Sep 17 00:00:00 2001 From: Nicola Verbeeck Date: Fri, 12 Nov 2021 08:58:53 +0100 Subject: [PATCH 2/2] Fixed formatting --- .../widget/touch_feedback/touch_feedback.dart | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/src/widget/touch_feedback/touch_feedback.dart b/lib/src/widget/touch_feedback/touch_feedback.dart index e622a47..edfe90e 100644 --- a/lib/src/widget/touch_feedback/touch_feedback.dart +++ b/lib/src/widget/touch_feedback/touch_feedback.dart @@ -67,15 +67,15 @@ class TouchFeedBackIOS extends StatefulWidget { 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); + 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();