Контроллер пересылки анимации всегда приводит к линейному изменению значения контроллера.Это не зависит от параметра кривой CurvedAnimation.Изменение типа кривой тоже не помогло.Кроме того, я попытался изменить продолжительность до 40 секунд, но это все еще был линейный вывод.Параметр кривой ничего не меняет, он остается одинаковым для всех типов кривых.
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp>
with SingleTickerProviderStateMixin {
AnimationController animationController;
@override
void initState() {
super.initState();
animationController =
AnimationController(vsync: this, duration: Duration(milliseconds: 300));
CurvedAnimation(parent: animationController, curve: Curves.bounceIn)
.addListener(() {
print(animationController.value);
});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: GestureDetector(
onTap: () {
animationController.forward(from: 0.0);
},
child: Center(
child: Container(
child: Text("forward from 0.0"),
),
)),
),
);
}
}
Выход всегда линейный.Выход после нажатия кнопки:
I/flutter (19637): 0.0
I/flutter (19637): 0.0
I/flutter (19637): 0.05566000000000001
I/flutter (19637): 0.11121666666666667
I/flutter (19637): 0.16677333333333333
I/flutter (19637): 0.22233
I/flutter (19637): 0.27788666666666667
I/flutter (19637): 0.3340766666666667
I/flutter (19637): 0.3897666666666667
I/flutter (19637): 0.4454566666666667
I/flutter (19637): 0.5011433333333334
I/flutter (19637): 0.5568333333333334
I/flutter (19637): 0.6125233333333334
I/flutter (19637): 0.6682133333333333
I/flutter (19637): 0.7239033333333333
I/flutter (19637): 0.7795933333333334
I/flutter (19637): 0.8352799999999999
I/flutter (19637): 0.89097
I/flutter (19637): 0.94666
I/flutter (19637): 1.0