1
This commit is contained in:
@@ -15,9 +15,13 @@ class _AvatarCardState extends State<AvatarCard> with SingleTickerProviderStateM
|
||||
late AnimationController _controller;
|
||||
late Animation<double> _animation;
|
||||
|
||||
///对话框值
|
||||
String _dialog = "";
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
//初始化动画
|
||||
_controller = AnimationController(
|
||||
vsync: this,
|
||||
duration: Duration(milliseconds: 300),
|
||||
@@ -28,6 +32,7 @@ class _AvatarCardState extends State<AvatarCard> with SingleTickerProviderStateM
|
||||
curve: Curves.easeInOut,
|
||||
),
|
||||
);
|
||||
_initDialog();
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -36,8 +41,31 @@ class _AvatarCardState extends State<AvatarCard> with SingleTickerProviderStateM
|
||||
_controller.dispose();
|
||||
}
|
||||
|
||||
///初始化是否显示对话
|
||||
void _initDialog() {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
final store = context.read<PlanDetailStore>();
|
||||
|
||||
void listener() {
|
||||
if (store.planDetail.dialog != null && !store.showRoleTalk) {
|
||||
setState(() {
|
||||
_dialog = store.planDetail.dialog!;
|
||||
});
|
||||
_toggleShow();
|
||||
store.removeListener(listener);
|
||||
}
|
||||
}
|
||||
|
||||
store.addListener(listener);
|
||||
});
|
||||
}
|
||||
|
||||
///切换显示show
|
||||
void _toggleShow() {
|
||||
var store = context.read<PlanDetailStore>();
|
||||
if (store.planDetail.dialog == null) {
|
||||
return;
|
||||
}
|
||||
setState(() {
|
||||
store.showRoleTalk = !store.showRoleTalk;
|
||||
if (store.showRoleTalk) {
|
||||
@@ -71,10 +99,7 @@ class _AvatarCardState extends State<AvatarCard> with SingleTickerProviderStateM
|
||||
borderRadius: BorderRadius.circular(3),
|
||||
border: Border.all(color: Colors.black, width: 1),
|
||||
),
|
||||
child: Text(
|
||||
"好的,让我们把学习软件开发这个目标分解成最简单的小步骤,这样你明天就能轻松开始行动",
|
||||
style: TextStyle(fontSize: 12),
|
||||
),
|
||||
child: Text(_dialog, style: TextStyle(fontSize: 12)),
|
||||
),
|
||||
Positioned(
|
||||
bottom: 0,
|
||||
|
||||
Reference in New Issue
Block a user