GitHub - 2d-inc/HistoryOfEverything: Flutter Launch Timeline Demo
source link: https://github.com/2d-inc/HistoryOfEverything
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
README.md
The History of Everything
The History of Everything is a vertical timeline that allows you to navigate, explore, and compare events from the Big Bang to the birth of the Internet. Events are beautifully illustrated and animated.
The concept for this app was inspired by the Kurzgesagt video, Time: The History & Future of Everything.
The app was built with Flutter by 2Dimensions and it's available on Android and iOS.
Usage
Make sure you have Flutter installed on your local machine. For more instructions on how to install flutter, look here.
git clone https://github.com/2d-inc/HistoryOfEverything.git
cd HistoryOfEverything/app
git submodule init
git submodule update
flutter run
Overview
The app consists of three main views:
-
Main Menu - /app/lib/main_menu
This is the initial view for the app when it opens up. It shows a search bar on top, three menu sections for each major time era, and three buttons on the bottom for accessing favorites, sharing a link to the store, and the about page. -
Timeline - /app/lib/timeline
This view is displayed when an item from the menu is selected: the user is presented with a vertical timeline. It can be scrolled up and down, zoomed in and out.
When an event is in view, a bubble will be shown on screen with a custom animated widget right next to it. By tapping on either, the user can access the ArticlePage. -
ArticlePage - /app/lib/article
The ArticlePage displays the event animation, together with a full description of the event.
Animated Widgets
This relies heavily on the animations built on 2dimensions and they are seamlessly integrated with Flutter by using the Flare and Nima libraries.
One of Flutter's biggest strengths is its flexibility, because it exposes the architecture of its components, which can be built entirely from scratch: it's possible to create custom widgets out of the SDK's most basic elements.
An example can be found in /app/lib/article/timeline_entry_widget.dart
This file contains two classes:
TimelineEntryWidget
that extendsLeafRenderObjectWidget
- VignetteRenderObject that extends
RenderBox
LeafRenderObjectWidget
This class (docs) is a Widget
: it can be inserted in any widget tree without any other default component:
Container(
child: TimelineEntryWidget(
isActive: true,
timelineEntry: widget.article,
interactOffset: _interactOffset
)
)
This snippet is used in /app/lib/article/article_widget.dart
The LeafRenderObjectWidget
is responsible for having a constructor and encapsulating the values that the RenderObject
needs.
The following two overrides are also fundamental:
createRenderObject()
Instantiates the actualRenderObject
in the Widget Tree;updateRenderObject()
Any change to the parameters that are passed to the Widget can be reflected also on the UI, if needed. Updating aRenderObject
will cause the object to redraw.
RenderObject
As specified in the docs, this is an object in the render tree, and it defines what and how its creator Widget will paint on the screen.
The key override here is paint()
:
the current PaintingContext
exposes the canvas
, and this class can draw, taking full advantage of the exposed API.
The Flare library, granted access to the canvas
, draws the animation.
To have the animation reproduce correctly, it's also necessary to call advance(elapsed)
on the current FlutterActor
each frame. Moreover, the current ActorAnimation
requires that the function apply(time)
is called on it to display it's correct interpolated values.
This is all made possible by relying on Flutter's SchedulerBinding.scheduleFrameCallback()
.
This is just a brief overview of how the Flare widgets can be customized for every experience.
Recommend
-
70
README.md Flare-Flutter Flutter runtime written in Dart with SKIA based rendering. Installation Download the repository and add f...
-
50
Flutter 是 Google 研发的一套移动端开发框架,也是 Google 正在研发的下一代操作系统 Fuchsia 的 App 开发框架(Web 和 Desktop 也都在进行积极的尝试),前几天刚发布了 1.0 正式版。关于 Flutter 的原理和介绍可以参考美团的...
-
12
master ocelotgui/windows.txt
-
9
README.md Ocelot ocelotgui A GUI for Tarantool Version 1.2.0 The Ocelot GUI (ocelotgui), a database client, allows users to connect to a Tarantool (tm) server, enter...
-
9
株式会社ゆめみ iOS研修 業務に近いかたちでアプリ開発を行いながら、 iOSアプリ開発の基礎復習、実務スキルを身に付けるための研修です。 天気予報アプリを開発していただきます。 Xcode 12.4 Swift 5.3.2 天気...
-
2
Overview PortBender is a TCP port redirection utility that allows a red team operator to redirect inbound traffic destined for one TCP port (e.g., 445/TCP) to another TCP port (e.g., 8445/TCP). PortBender includes an aggressor script...
-
3
Flutter自定义时间轴timeline在业务开发中经常会使用到timeline时间轴,来记录数据操作记录等,在这本人封装了一个相对较通用的时间轴组件。参数类型必填说明timelineListList是时间轴...
-
3
Create a Shimmer Loading Effect in Flutter with Demo AppLoaded: 0.78%00:07Remaining Time -23:55Create a Shimmer Loading Effect in Flutter...
-
3
OneFlow OneFlow is a performance-centered and open-source deep learning framework. Latest News Version 0.7.0 is out! Introducing global tensor Semi-auto parallelization has landed
-
3
DevClad
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK