Giter Club home page Giter Club logo

fnx_gallery's Introduction

fnx_gallery

Easy to use AngularDart gallery component.

Getting started

First of all, in a Dart app you have to prepare list of images and optionally some caption provider:

List<Image> images = [];

List<String> names = [
  "butterfly.jpg",
  "tunnel.jpg",
  "coast.jpg",
  "flower.jpg",
  "meadow.jpg",
];

ExampleComponent() {
  for (var name in names) {
    name = "imgs/$name";
    Image i = Image(name, thumbSrc: name+"?thumg=1", htmlCaptionProvider: () => name);
    images.add(i);
  }
}

In your template, you can use the component like this:

<fnx-gallery
    [images]="images"
    [withCaptions]="true"
    [withThumbnails]="true"></fnx-gallery>
    ...

Caption provider

htmlCaptionProvider is a function which returns FutureOr<String> and you can use is to fetch your image caption from an asynchronous source (server, etc.).

Caption is handled as HTML, and is displayed using innerHtml with NodeTreeSanitizer.trusted, please make sure your caption can be TRUSTED!

Navigation

Your user can navigate through your gallery by simply pressing the left/right buttons or on mobile also by swiping to left or right.

fnx-gallery element

fnx_gallery package contains <fnx-gallery> element. It's a simple position: fixed; element which you can use as a gallery.

Specify dependency in pubspec.yaml:

dependencies:
  fnx_gallery: ^1.0.0

Run pub get and in your "index.dart" (or whatever is the name of your main script):

import 'package:fnx_gallery/fnx_gallery.dart';

Closing the gallery

We recommended to use *ngIf to show and hide the gallery. <fnx-gallery> emits (close) event, which indicates that the user clicked on the close button (or pressed ESC key etc.). Hide the gallery after this event.

Element inputs

You use some of these AngularDart inputs to modify the element:

input name data type purpose
images List<Image> List of images of the gallery.
selectedImage Image Selected image object, default 0th.
withCaptions bool Show captions bellow the images.
withThumbnails bool Show thumbnails at the bottom of the gallery.

Contact

Fill-in a bugreport or feature request on Github issue tracking.

fnx_gallery's People

Contributors

tomucha avatar

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.