picture_button 0.0.2 picture_button: ^0.0.2 copied to clipboard
Flutter PictureButton Widget, If you just put the image inside PictureButton, you can use it like a other button
PictureButton is setting only Image(ImageProvider type) and onPressed. like ButtonStyle.
I am very happy that I somehow seem to have deployed a useful widget.
Features ๐ #
Getting started ๐ฑ #
my example image(google sign image)
path : [project]/example/assets/
grant assets path from pubspec.yaml
path : [project]/example/pubspec.yaml
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
assets:
- assets/
add
flutter pub add image_button
import
import 'package:image_button/picture_button.dart';
Usage ๐ #
parameter | required | type | default |
---|---|---|---|
onPressed | โ๏ธ | VoidCallback | |
onLongPressed | โ | VoidCallback? | |
image | โ๏ธ | ImageProvider | |
width | โ | double? | imageWidth |
height | โ | double? | imageHieght |
fit | โ | BoxFit | BoxFit.contain |
opacity | โ | double | 1.0 |
border | โ | Border? | |
borderRadius | โ | BorderRadius? | |
borderRadiusInk | โ | BorderRadius? | |
paddingInk | โ | EdgeInsetGeometry | EdgeInsets.zero |
imageBacgroundColor | โ | Color? | |
splashColor | โ | Color? | |
highlightColor | โ | Color? | |
focusColor | โ | Color? | |
hoverColor | โ | Color? | |
enabled | โ | bool | true |
useBubbleEffect | โ | bool | false |
bubbleEffect | โ | PictureBubbleEffect? | PictureBubbleEffect.shrink |
child | โ | Widget? |
๐จโ๐ฉโ๐งโ๐ฆ AssetImage, NetworkImage, FileImage, MemoryIamge
PictureButton(
onPressed: () {
},
image: const AssetImage("assets/google_sign_image.png"),
),
๐จโ๐จโ๐งโ๐ฆ Image.asset(..), Image.network(..), Image.file(..), Image.memory(..)
use later .image
getter function.
PictureButton(
onPressed: () {
},
image: Image.asset("assets/google_sign_image.png").image,
),
๐ Bubble Effect(Ripple)
useBubbleEffect: true
PictureButton(
onPressed: () {
},
image: Image.asset("assets/google_sign_image.png").image,
bubbleEffect: true,
),