flippable_box
一個雙面容器,翻轉後可顯示兩側內容。
gskinnerTeam/flutter-flippable-box open-source repository details.
以下為英文專案原文快照,最新內容請造訪 GitHub。
FlippableBox is a double-sided Container, that holds two pieces of content and automatically re-sizes to match its content, whenever its flipped over.
First import the package into your class:
import 'package:flippable_box/flippable_box.dart';
Create a FlippableBox with two child Containers. Change the isFlipped property to trigger the internal flip animation.
GestureDetector(
onTap: () => setState(() => _isFlipped = !_isFlipped),
child: FlippableBox(
front: Container(width: 200, height: 200, color: Colors.white),
back: Container(width: 300, height: 300, color: Colors.white),
isFlipped: _isFlipped,
),
)
NOTE: It is required that the children are Containers, and have their size or constraints set manually, as shown in the example above. This is so the Box knows what its target size is when animating.
To control the flip animation, you can set duration, curve and flipVt which will cause the flip to be in the vertical axis rather than horizontal.
You can also specify a bg which takes a BoxDecoration, and a borderRadius in case you'd like to clip the child contents.
FlippableBox(
front: child1,
back: child2,
isFlipped: _isFlipped,
borderRadius: 32, //Uses a ClipRRect to clip contents of child containers
bg: BoxDecoration(color: Colors.white), //Paints the box itself with a shared background
duration: 0.5, //half second duration
flipVt: true, //Flip vertically instead of horizontal
curve: Curves.easeOut,
)
See the example directory for a simple example.
依賴清單 2 項
{"sdk":"flutter"}{"sdk":"flutter"}先依使用情境篩選,再比較專案活躍情況,最後到原始儲存庫確認使用要求。
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗