transparent_image_button 1.0.0 copy "transparent_image_button: ^1.0.0" to clipboard
transparent_image_button: ^1.0.0 copied to clipboard

This package is used to click on Transparent Image as a Gesture, but it's OnTap function works only when it was clicked on the image or photo itself not on the transparent parts.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:transparent_image_button/transparent_image_button.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Transparent Image Button Ex',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Transparent Image Button Ex'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);
  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            TransparentImageButton.assets(
              "assets/images/egg.png",
              width: 200,
              opacityThreshold: 0.8,
              onTapInside: () => print("You tapped the image."),
              onTapOutside: () => print("You tapped outside the image."),
              onHoverInside: () => print("You're hovering inside the image."),
              onHoverOutside: () => print("You're hovering outside the image."),
            ),
          ],
        ),
      ),
    );
  }
}
6
likes
120
pub points
58%
popularity

Publisher

verified publishershadyboshra.com

This package is used to click on Transparent Image as a Gesture, but it's OnTap function works only when it was clicked on the image or photo itself not on the transparent parts.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, image

More

Packages that depend on transparent_image_button