Dashstrap Icon Button
Drop in widget to be used for buttons with icons to indicate actions to your users or when you want to add floating action buttons with a different visual feedback style.
Installation
Using command line:
flutter pub add dashstrap_iconbutton
As a dependency in your pubspec.yaml file
dependencies:
dashstrap_iconbutton: ^1.0.0
You can also follow the instructions on pub.dev
Usage
Simple Usage
Import the package
import 'package:dashstrap_iconbutton/dashstrap_iconbutton.dart';
Create the button
DSIconButton(
icon: Icons.add,
),
Modifying the appearance
DSIconButton(
icon: Icons.add,
style: DSIconButtonStyle.outline,
),
All properties
* - Required
Property Name | Type | Description | Default Value |
---|---|---|---|
icon* | IconData | Icon to use | null |
color | Color? | Background color for the button | accentColor of Theme |
iconColor | Color | Tint color of the icon | White |
style | DSIconButtonStyle | Render style of the button | DSIconButtonStyle.normal |
size | DSIconButtonSize | Defines the icon size and padding of the button | DSIconButtonSize.normal |
feedbackStyle | DSIconButtonFeedbackStyle | The visual feedback to use when the button receives pointer events | DSIconButtonFeedbackStyle.normal |
onTapUp | Function(TapUpDetails)? | Function to call when a pointer up event is received | null |
onTapDown | Function(TapDownDetails)? | Function to call when a pointer down event is received | null |
activeOpacity | double | Opacity of the button when a pointer down event is active, only applicable for feedbackStyle opacity | 0.3 |
disabled | bool | Whether or not the button is disabled (will ignore pointer events) | false |
disabledColor | Color? | Color of button in disabled state | Color(0xFFEAEAEA) |
iconSize | double? | Custom icon size to use regardless of button size | null |
shape | DSIconButtonShape | Shape of the button | DSIconButtonShape.round |
Enumerations
enum DSIconButtonSize { small, normal, large }
enum DSIconButtonFeedbackStyle { normal, opacity }
enum DSIconButtonStyle { normal, outline }
enum DSIconButtonShape { round, square }
Factory methods
Round buttons
DSIconButton.rounded()
Square buttons
DSIconButton.square()
Floating action buttons
These are round buttons with a shadow, can be used to render on top of other elements.
DSIconButton.fab()
Troubleshooting
For any issues or questions create an issue in the issue tracker
Contributors
Contributions are always welcome, you can find the steps to setup the project and the steps involved in making contributions here