guanghuispark
4 年前
当前提交
3423bdc2
共有 8 个文件被更改,包括 165 次插入 和 36 次删除
-
22com.unity.uiwidgets.devtools/Editor/v2/src/inspector/inspector_screen.cs
-
8com.unity.uiwidgets.devtools/Editor/v2/src/inspector/inspector_tree.cs
-
12com.unity.uiwidgets.devtools/Editor/v2/src/inspector/inspector_tree_flutter.cs
-
3com.unity.uiwidgets/Runtime/widgets/focus_manager.cs
-
11com.unity.uiwidgets/Runtime/widgets/ticker_provider.cs
-
4com.unity.uiwidgets/Runtime/widgets/value_listenable_builder.cs
-
69com.unity.uiwidgets.devtools/Editor/v2/src/CollapsibleAnimationMixin.mixin.gen.cs
-
72com.unity.uiwidgets.devtools/Editor/v2/src/CollapsibleAnimationMixin.mixin.njk
|
|||
using System; |
|||
using Unity.UIWidgets.animation; |
|||
using Unity.UIWidgets.DevTools.inspector; |
|||
using Unity.UIWidgets.widgets; |
|||
|
|||
namespace Unity.UIWidgets.DevTools |
|||
{ |
|||
public abstract class CollapsibleAnimationMixinTickerProviderStateMixin<T> : TickerProviderStateMixin<T> where T : StatefulWidget { |
|||
|
|||
AnimationController expandController; |
|||
|
|||
Animation<float> expandArrowAnimation; |
|||
|
|||
Animation<float> expandCurve; |
|||
|
|||
bool shouldShow() |
|||
{ |
|||
return isExpanded; |
|||
} |
|||
|
|||
void onExpandChanged(bool expanded) |
|||
{ |
|||
|
|||
} |
|||
|
|||
public bool isExpanded |
|||
{ |
|||
get; |
|||
} |
|||
|
|||
public override void initState() { |
|||
base.initState(); |
|||
expandArrowAnimation = new CurvedAnimation(curve: Curves.easeInOutCubic, parent: new AnimationController( |
|||
duration: new TimeSpan(0,0,0,0,200), |
|||
vsync: this, |
|||
value: 0.0f |
|||
)); |
|||
} |
|||
|
|||
|
|||
|
|||
public override void dispose() { |
|||
expandController.dispose(); |
|||
base.dispose(); |
|||
} |
|||
|
|||
public void setExpanded(bool expanded) { |
|||
setState(() => { |
|||
if (expanded) { |
|||
expandController.forward(); |
|||
} else { |
|||
expandController.reverse(); |
|||
} |
|||
onExpandChanged(expanded); |
|||
}); |
|||
} |
|||
|
|||
public override void didUpdateWidget(StatefulWidget oldWidget) { |
|||
base.didUpdateWidget(oldWidget); |
|||
if (isExpanded) { |
|||
expandController.forward(); |
|||
} else { |
|||
expandController.reverse(); |
|||
} |
|||
} |
|||
|
|||
} |
|||
|
|||
} |
|
|||
using System; |
|||
using Unity.UIWidgets.animation; |
|||
using Unity.UIWidgets.DevTools.inspector; |
|||
using Unity.UIWidgets.widgets; |
|||
|
|||
namespace Unity.UIWidgets.DevTools |
|||
{ |
|||
{% macro CollapsibleAnimationMixin(with) %} |
|||
{% set className = 'CollapsibleAnimationMixin' + with %} |
|||
public abstract class {{className | safe}} : {{with | safe}} where T : StatefulWidget { |
|||
|
|||
AnimationController expandController; |
|||
|
|||
Animation<float> expandArrowAnimation; |
|||
|
|||
Animation<float> expandCurve; |
|||
|
|||
bool shouldShow() |
|||
{ |
|||
return isExpanded; |
|||
} |
|||
|
|||
void onExpandChanged(bool expanded) |
|||
{ |
|||
|
|||
} |
|||
|
|||
public bool isExpanded |
|||
{ |
|||
get; |
|||
} |
|||
|
|||
public override void initState() { |
|||
base.initState(); |
|||
expandArrowAnimation = new CurvedAnimation(curve: Curves.easeInOutCubic, parent: new AnimationController( |
|||
duration: new TimeSpan(0,0,0,0,200), |
|||
vsync: this, |
|||
value: 0.0f |
|||
)); |
|||
} |
|||
|
|||
|
|||
|
|||
public override void dispose() { |
|||
expandController.dispose(); |
|||
base.dispose(); |
|||
} |
|||
|
|||
public void setExpanded(bool expanded) { |
|||
setState(() => { |
|||
if (expanded) { |
|||
expandController.forward(); |
|||
} else { |
|||
expandController.reverse(); |
|||
} |
|||
onExpandChanged(expanded); |
|||
}); |
|||
} |
|||
|
|||
public override void didUpdateWidget(StatefulWidget oldWidget) { |
|||
base.didUpdateWidget(oldWidget); |
|||
if (isExpanded) { |
|||
expandController.forward(); |
|||
} else { |
|||
expandController.reverse(); |
|||
} |
|||
} |
|||
|
|||
} |
|||
{% endmacro %} |
|||
{{ CollapsibleAnimationMixin('TickerProviderStateMixin<T>') }} |
|||
} |
撰写
预览
正在加载...
取消
保存
Reference in new issue