Giter Site home page Giter Site logo

dbilgin / swipe_image_gallery Goto Github PK

View Code? Open in Web Editor NEW
31.0 31.0 15.0 4.42 MB

A scrollable, dismissable by swiping, zoomable gallery for Flutter, on which you can add a dynamic overlay.

License: MIT License

Kotlin 0.15% Swift 2.14% Objective-C 0.05% Dart 40.27% HTML 2.28% CMake 24.00% C++ 29.37% C 1.76%

swipe_image_gallery's People

Contributors

dbilgin avatar garlicpasta avatar golfling avatar minhdanh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

swipe_image_gallery's Issues

show() method should return a Future

The show() method of SwipeImageGallery should return a Future so that callers can await it and know when the gallery is closed. The show() method is already an async function so the only that the needs to change is the return signature.

How do i achieve hero animations with GridTiles?

Tried this but no luck:

class FirstPage extends StatefulWidget {
  var wallpaperList = <Wallpaper>[];

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

class _FirstPageState extends State<FirstPage> {

  StreamController<Widget> overlayController =
  StreamController<Widget>.broadcast();

  @override
  void dispose() {
    overlayController.close();
    super.dispose();
  }
  
  Query<Map<String, dynamic>> firstWallieQuery = FirebaseFirestore.instance
      .collection('Wallies')
      .orderBy('timestamp', descending: false)
      .limit(20);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: _buildContents(),
    );
  }

  Widget _buildContents() {
    //THIS CODE IS USED TO RETRIEVE DATA FROM DB
    return FutureBuilder(
      future: firstWallieQuery.get(),
      builder: (BuildContext context, AsyncSnapshot<dynamic> snapshot) {
        if (snapshot.connectionState == ConnectionState.done) {
          if (snapshot.hasData) {
            print('DATA IS THERE ROXIN');
            var favWallManger =
                Provider.of<FavWallpaperManger>(context, listen: false);

            snapshot.data.docs.forEach((documentSnapshot) {
              var wallpaper = Wallpaper.fromDocumentSnapshot(documentSnapshot);

              if (favWallManger.isFavourite(wallpaper)) {
                wallpaper.isFavourite = true;
              }
              //THIS IS WHERE IM ADDING THE IMAGES TO A LIST AFTER RETRIEVING THEM FROM A DB
              widget.wallpaperList.add(wallpaper);
              print('ListHome: ${wallpaper.id}');
            });
          }
          print('GridRebuildHome');
          return GridView.builder(
            itemCount: widget.wallpaperList.length,
            itemBuilder: (BuildContext context, int indexx) {
              return InkResponse(
                //WHY I PUT SWIPE IMAGE GALLERY IN A STANDALONE METHOD IS BECAUSE IT WAS GETTING LONG AND MESSY
                onTap: () => swipeImageGallery(context, indexx).show(),
                child: GridTile(child: imageCache(indexx)),
              );
            },
            gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
              crossAxisCount: 3,
              childAspectRatio: 0.8,
            ),
          );
        } else {
          return Center(
            child: CircularProgressIndicator(),
          );
        }
      },
    );
  }

  SwipeImageGallery swipeImageGallery(BuildContext context, int indexx) {
    return SwipeImageGallery(
      context: context,
      initialIndex: indexx,
      hideStatusBar: true,
      transitionDuration: 600,
      //heroProperties: heroProperties,
      itemBuilder: (context, index) {
        return Image(
            image: CachedNetworkImageProvider(
                widget.wallpaperList.elementAt(index).url));
      },
      itemCount: widget.wallpaperList.length,
      onSwipe: (index) {
        overlayController.add(FullScreenOverlayButtons(
          wallpaperList: widget.wallpaperList,
          initialPage: index,
          currentIndex: index,
          fromHome: true,
        ));
      },
      initialOverlay: FullScreenOverlayButtons(
        wallpaperList: widget.wallpaperList,
        initialPage: indexx,
        currentIndex: indexx,
        fromHome: true,
      ),
      overlayController: overlayController,
    );
  }

  Widget imageCache(int indexx) {
    return CachedNetworkImage(
      imageUrl: widget.wallpaperList.elementAt(indexx).url,
      fit: BoxFit.cover,
    );
  }
}

Swipe not working on Linux build

Hello, while developing I am used to use the linux version of my app.

While the swipe image gallery works perfectly on android, I noticed that in linux it is malfunctioning.

Symptoms upon opening:

  • the first image of the gallery opens as it should
  • swipe does not work, the feeling is as if the gallery froze
  • dragging from the very top (or bottom) in the opposite direction closes the gallery
  • there is no way though, to see the other images

Do you experience the same issue.

Thanks for the nice library.

index of gallery

Hello, how can i set index to open up gallery at specific image when the specific image is clicked? thanks!

rror G9EFD8EEC: Member not found: 'trackpad'.

I tried to use the library you created on the Windows platform, and when I ran my program, I found an error like the following.

image

And I'm more focused on the error error G9EFD8EEC: Member not found: 'trackpad'.
It should be compatible with the Windows platform.

Cannot dismiss using back button

I tried using the back button to dismiss the gallery but it doesn't work.
I also tried using an overlay and use PopScope but didn't work either.
How can we handle the back button on Android in this case?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.