ZCM 5 年之前
父節點
當前提交
581dc9fd8b
共有 2 個檔案被更改,包括 47 行新增1 行删除
  1. +1
    -1
      lib/chat/ChatPage.dart
  2. +46
    -0
      lib/home/coin_anim.dart

+ 1
- 1
lib/chat/ChatPage.dart 查看文件

@@ -617,7 +617,7 @@ class _ChatPageState extends State<ChatPage> {
double zoomButtonSizeHeight = 74;
void dragEvent(DragUpdateDetails details) {
final RenderObject box = context.findRenderObject();
final RenderObject F = context.findRenderObject();
// 获得自定义Widget的大小,用来计算Widget的中心锚点
dx = details.globalPosition.dx - mykey.currentContext.size.width / 2;
dy = details.globalPosition.dy - mykey.currentContext.size.height / 2;


+ 46
- 0
lib/home/coin_anim.dart 查看文件

@@ -0,0 +1,46 @@
import 'package:flutter/material.dart';

import '../r.dart';

class CoinAnim extends StatefulWidget {
@override
_CoinAnimState createState() => _CoinAnimState();
}

class _CoinAnimState extends State<CoinAnim>
with SingleTickerProviderStateMixin {
Animation<double> _animation;
AnimationController _controller;
double begin = 100;
double end = 20;

@override
void initState() {
super.initState();
// 启动动画controller
_controller = new AnimationController(
duration: Duration(milliseconds: 500), vsync: this);
_controller.addStatusListener((AnimationStatus status) {});

_animation = new Tween<double>(begin: begin, end: end).animate(_controller)
..addListener(() {
setState(() {});
});

_controller.forward(from: begin);
}

@override
void dispose() {
_controller.stop();
_controller.dispose();
super.dispose();
}

@override
Widget build(BuildContext context) {
return Positioned(
child: Container(
height: _animation.value, child: Image.asset(R.assetsImagesCoin)));
}
}

正在載入中…
取消
儲存