picture_button 0.0.3 copy "picture_button: ^0.0.3" to clipboard
picture_button: ^0.0.3 copied to clipboard

Flutter PictureButton Widget, If you just put the image inside PictureButton, you can use it like a other button

Pub Version

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 ๐Ÿœ #

GIF

Getting started ๐ŸŒฑ #

my example image(google sign image)
path : [project]/example/assets/

Screenshot


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(..), MemoryImage(..)

  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

useBubbleEffect: true

  PictureButton(
    onPressed: () {
      
    },
    image: Image.asset("assets/google_sign_image.png").image,
    useBubbleEffect: true,
    bubbleEffect: PictureBubbleEffect.shrink, // [shrink, expand]
  ),

๐Ÿ–Œ if you don't want Effect(Ripple) Color (I said 'Ink')

splashColor: Colors.transparent
highlightColor: Colors.transparent

  PictureButton(
    onPressed: () {
      
    },
    image: Image.asset("assets/google_sign_image.png").image,
    highlightColor: Colors.transparent,
    splashColor: Colors.transparent,
  ),

โœ‚ measure Effect(Ripple) BorderRadius

borderRadiusInk: BorderRadius.circular(8.0)

  PictureButton(
    onPressed: () {
      
    },
    image: Image.asset("assets/google_sign_image.png").image,
    borderRadiusInk: BorderRadius.circular(8.0),
    // paddingInk: EdgeInsets.all(8.0),   if you want measure 'Ink' padding.
  ),
3
likes
0
pub points
47%
popularity

Publisher

unverified uploader

Flutter PictureButton Widget, If you just put the image inside PictureButton, you can use it like a other button

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on picture_button