简单使用
简单示例帮助你快速上手。
倾斜
Tilt widget widget 默认有倾斜、阴影和光照的效果。
/// 导入 flutter_tilt
import 'package:flutter_tilt/flutter_tilt.dart';
...
Tilt(
child: Container(
width: 150.0,
height: 300.0,
color: Colors.grey,
),
),
...
视差
TiltParallax widget 只能在 Tilt widget 的 childLayout 中使用。
/// 导入 flutter_tilt
import 'package:flutter_tilt/flutter_tilt.dart';
...
Tilt(
childLayout: const ChildLayout(
outer: [
/// 此处为视差
Positioned(
child: TiltParallax(
child: Text('Parallax'),
),
),
/// 此处为视差
Positioned(
top: 20.0,
left: 20.0,
child: TiltParallax(
size: Offset(-10.0, -10.0),
child: Text('Tilt'),
),
),
],
),
child: Container(
width: 150.0,
height: 300.0,
color: Colors.brown,
),
),
...