diff --git a/example/android/build.gradle b/example/android/build.gradle index 58a8c74..713d7f6 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -26,6 +26,6 @@ subprojects { project.evaluationDependsOn(':app') } -task clean(type: Delete) { +tasks.register("clean", Delete) { delete rootProject.buildDir } diff --git a/lib/src/group_button_base.dart b/lib/src/group_button_base.dart index 0242620..6fef152 100644 --- a/lib/src/group_button_base.dart +++ b/lib/src/group_button_base.dart @@ -123,8 +123,10 @@ class GroupButton extends StatelessWidget { selectedBorderColor: options.selectedBorderColor, unselectedBorderColor: options.unselectedBorderColor, borderRadius: options.borderRadius, + borderWidth: options.borderWidth, selectedShadow: options.selectedShadow, unselectedShadow: options.unselectedShadow, + tappingShadowColor: options.tappingShadowColor, buttonWidth: options.buttonWidth, buttonHeight: options.buttonHeight, mainGroupAlignment: options.mainGroupAlignment, diff --git a/lib/src/group_button_body.dart b/lib/src/group_button_body.dart index 5672928..249ac2a 100644 --- a/lib/src/group_button_body.dart +++ b/lib/src/group_button_body.dart @@ -27,8 +27,10 @@ class GroupButtonBody extends StatefulWidget { this.selectedColor, this.unselectedColor, this.borderRadius = BorderRadius.zero, + this.borderWidth, this.selectedShadow = const [], this.unselectedShadow = const [], + this.tappingShadowColor, this.buttonWidth, this.buttonHeight, this.mainGroupAlignment = MainGroupAlignment.center, @@ -59,8 +61,10 @@ class GroupButtonBody extends StatefulWidget { final Color? selectedBorderColor; final Color? unselectedBorderColor; final BorderRadius? borderRadius; + final double? borderWidth; final List selectedShadow; final List unselectedShadow; + final Color? tappingShadowColor; final double? buttonWidth; final double? buttonHeight; final GroupingType? groupingType; @@ -186,8 +190,10 @@ class _GroupButtonBodyState extends State> { selectedBorderColor: widget.selectedBorderColor, unselectedBorderColor: widget.unselectedBorderColor, borderRadius: widget.borderRadius, + borderWidth: widget.borderWidth, selectedShadow: widget.selectedShadow, unselectedShadow: widget.unselectedShadow, + tappingShadowColor: widget.tappingShadowColor, height: widget.buttonHeight, width: widget.buttonWidth, textAlign: widget.textAlign, diff --git a/lib/src/group_button_item.dart b/lib/src/group_button_item.dart index 0036eae..16655c3 100644 --- a/lib/src/group_button_item.dart +++ b/lib/src/group_button_item.dart @@ -14,8 +14,10 @@ class GroupButtonItem extends StatelessWidget { this.selectedColor, this.unselectedColor, this.borderRadius, + this.borderWidth, this.selectedShadow, this.unselectedShadow, + this.tappingShadowColor, this.height, this.width, this.textAlign, @@ -35,8 +37,10 @@ class GroupButtonItem extends StatelessWidget { final Color? selectedBorderColor; final Color? unselectedBorderColor; final BorderRadius? borderRadius; + final double? borderWidth; final List? selectedShadow; final List? unselectedShadow; + final Color? tappingShadowColor; final double? height; final double? width; final TextAlign? textAlign; @@ -64,6 +68,8 @@ class GroupButtonItem extends StatelessWidget { ? unselectedBorderColor : null; + double get _borderWidth => borderWidth ?? 1.0; + @override Widget build(BuildContext context) { return Container( @@ -87,6 +93,7 @@ class GroupButtonItem extends StatelessWidget { return ElevatedButton( onPressed: onPressed, style: ElevatedButton.styleFrom( + shadowColor: tappingShadowColor ?? _getBackgroundColor(theme), elevation: elevation ?? 0.0, backgroundColor: _getBackgroundColor(theme), shape: _buildShape(), @@ -136,7 +143,7 @@ class GroupButtonItem extends StatelessWidget { BorderSide buildBorderSide(Color? color) { if (color != null) { - return BorderSide(color: color); + return BorderSide(color: color, width: _borderWidth); } return BorderSide.none; } diff --git a/lib/src/options/group_button_options.dart b/lib/src/options/group_button_options.dart index 47b9dc2..3496afb 100644 --- a/lib/src/options/group_button_options.dart +++ b/lib/src/options/group_button_options.dart @@ -1,5 +1,4 @@ import 'package:flutter/material.dart'; - import 'package:group_button/group_button.dart'; import 'package:group_button/src/options/defaults.dart'; @@ -17,8 +16,10 @@ class GroupButtonOptions { this.selectedBorderColor, this.unselectedBorderColor, this.borderRadius, + this.borderWidth, this.selectedShadow = defaultShadow, this.unselectedShadow = defaultShadow, + this.tappingShadowColor, this.buttonHeight, this.buttonWidth, this.mainGroupAlignment = MainGroupAlignment.center, @@ -74,12 +75,18 @@ class GroupButtonOptions { /// How much the button will be rounded final BorderRadius? borderRadius; + /// The width of the button's border + final double? borderWidth; + /// list of selected button(s) [BoxShadow] final List selectedShadow; /// list of unselected buttons [BoxShadow] final List unselectedShadow; + /// shadow [Color] shown when performing an onTap() + final Color? tappingShadowColor; + /// Height of Group button final double? buttonHeight;