AnimatedContainerWidget(毎日フラッターウィジェット)

AnimatedContainerWidget

AnimatedContainer({ 
キーキー、
this.alignment、
this.padding、
カラー色、
装飾装飾、
this.foregroundDecoration、
ダブル幅、
ダブル高さ、
BoxConstraints制約、
this.margin、
this.transform、
this.child、
曲線カーブ=曲線。線形、
@required時間期間、
})
インポート'パッケージ:フラッター/ material.dart'; 

クラスAnimatedContainerWidgetが延びるStatefulWidget {
AnimatedContainerWidget({キーキー}):スーパー(キー:キー)

_AnimatedContainerWidgetState createState()=>
_AnimatedContainerWidgetState();
}

クラス_AnimatedContainerWidgetState状態が延びる<AnimatedContainerWidget> {
ダブル_opacity = 1.0。
Matrix4 _transform = Matrix4.translationValues(0、0、0);

ボイド_onTapHandle(){
SETSTATE((){
_opacity = _opacity == 1.0 0.0:1.0;
_transform = _opacity == 0.0
?Matrix4.translationValues(-300、0、0)
:Matrix4.translationValues(0、0、0) ;
});
}

@Override
ウィジェットのビルド(BuildContextコンテキスト){
リターンスタック(
<ウィジェット> [:子ども
センター(
子:カラム(子供:<ウィジェット> [
AnimatedContainer(
アライメント:Alignment.center、
パディング:EdgeInsets.all(5)、
foregroundDecoration:BoxDecoration (
色:Colors.transparent)、
幅:200、
高さ:200、
制約:BoxConstraints(minHeightプロパティ:200)、
曲線:Curves.easeInToLinear、
持続時間:時間(ミリ秒:500)、
変換:_transform、
子:コンテナ(
アラインメント:Alignment.center、
幅:100、
高さ:50、
色:Colors.blue、
))
])
)、
位置づけ(
底:1、
右:1、
子供:インクつぼ(
子:コンテナ(
幅:30、
高さ:30、
マージン:EdgeInsets.fromLTRB(0、0、10、10)、
デコレーション:BoxDecoration(
borderRadius:BorderRadius.circular(30)、
色:Colors.pink、
)、
子供:アイコン(
Icons.play_arrow 、
色:Colors.white、
)、
)、
ONTAP:_onTapHandle、 )
] )。 } }




 

 

おすすめ

転載: www.cnblogs.com/wjw334/p/12560508.html