Fireship · @fireship

Reflectly-Inspired Animated Slideshow with Flutter + Firebase

Uploaded March 21, 2019 · Length 9:50

Reflectly-Inspired Animated Slideshow with Flutter + Firebase

Summary

Build an animated slideshow with Flutter and Firebase, inspired by Reflectly, with fluid transitions and Firestore data filtering.

  • flutter animated slideshow
  • firebase data filtering
  • reflectly inspiration
  • flutter firestore integration
  • animated ui design

Transcript preview

The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.

  1. 0:00

    One of the most popular showcase apps for Flutter is Reflectly. It's an AI-powered journal,

  2. 0:10

    and the developers did a really awesome job designing the UI. In today's video,

  3. 0:14

    we'll build our own animated slideshow from scratch using this app as our inspiration.

  4. 0:18

    Not only will it have this fluid transition between pages, but it will also be wired up

  5. 0:22

    with Firestore so we can filter the data on the backend. And we'll do the entire thing in about

  6. 0:26

    a hundred lines of code. If you're new to the channel, like and subscribe, and you can find

  7. 0:29

    full source code on Fireship.io.

  8. 0:31

    Let's take a closer look at the demo.

  9. 0:33

    When the user swipes, they can see a preview of the next page on the right and a preview

  10. 0:37

    of the previous page on the left.

  11. 0:38

    The active page in the middle will animate into the view by increasing its height and

  12. 0:42

    also add a box shadow to give it depth.

  13. 0:45

    The buttons on the first card will actually make a query to Firestore so we can filter

  14. 0:48

    the number of pages that are shown in the list.

  15. 0:51

    Everything stays synced up in real time, so if we want to add another page, all we do

  16. 0:54

    is add some data to Firestore and it's automatically reflected in the UI.

  17. 0:58

    We're going to look at a handful of important widgets here, but the single most important

  18. 1:02

    one is the page view.

  19. 1:03

    It's a built-in widget that comes with gesture detection and animation, allowing the user

  20. 1:07

    to swipe between a linear set of pages or widgets.

  21. 1:10

    I want to show you how the page view works before we get into the main feature.

  22. 1:13

    When we jump into a basic Flutter app, the first thing we'll do is set up a page controller.

  23. 1:17

    The controller allows you to navigate between pages manually and also gives you information

  24. 1:20

    about the state of the page view.

  25. 1:23

    For a basic slider, you actually don't really need to do anything with the controller.

  26. 1:26

    You just need to pass it in as an argument to the page view widget in the widget tree.

  27. 1:30

    The next thing we'll do is add the page view widget as the body of our scaffold.

  28. 1:34

    And a cool little side note is that you can control the scroll direction as either vertical

  29. 1:37

    or horizontal.

  30. 1:39

    From there we'll pass our controller, and then we'll define an array of children widgets.

  31. 1:42

    I'm just going to hard code a few containers in here to show you the effect.

  32. 1:46

    Because we have the scroll direction set to vertical, we can swipe from top to bottom

  33. 1:49

    to navigate between the pages.

  34. 1:51

    So now that you know how a page view works, you can go ahead and delete all that code,

  35. 1:54

    we're going to build something a lot more advanced. At this point I'm assuming

  36. 1:57

    that you have Firebase installed in your Flutter project. If not you'll want to