相关疑难解决方法(0)

使用偏移的容器动画-颤振

我试图通过提供offsetfrom 和end的方式(例如from)在屏幕上移动容器Offset(0.0,0.0) to Offset(400.0,300.0)。我正在使用“幻灯片过渡”为容器设置动画Tween<Offset>(begin: const Offset(3.0, 4.0), end: Offset(0.0, 0.0)),并在屏幕上移动该容器,我希望通过这些 容器 Offset(400.0,300.0)并对其进行动画处理。

这是我的代码

class MoveContainer extends StatefulWidget {


  MoveContainer({Key key, }) : super(key: key);

  @override
  State<StatefulWidget> createState() {
    return new _MyMoveContainer();
  }
}

class _MyMoveContainer extends State<MoveContainer>
    with TickerProviderStateMixin {
  GlobalKey _globalKey = new GlobalKey();
  AnimationController _controller;
  Animation<Offset> _offset;
  Offset local;

  @override
  void initState() {
    super.initState();
    _controller = AnimationController(
      vsync: this,
      duration: const Duration(seconds: 3),
    );
    _offset =
        Tween<Offset>(begin: const Offset(3.0, 4.0), end: …
Run Code Online (Sandbox Code Playgroud)

dart flutter flutter-layout flutter-animation

5
推荐指数
1
解决办法
772
查看次数

标签 统计

dart ×1

flutter ×1

flutter-animation ×1

flutter-layout ×1