Flutter開發 側滑刪除

2021-09-25 12:01:26 字數 4177 閱讀 3661

昨天的乙個需求,需要完成側滑刪除這個功能,現在dismissible的功能需求滿足不了現在的專案需求,就自己封裝乙個小組將

涉及到疊層,動畫,狀態管理

,//底部的列表

operationarea

(context,index)

//控制按鈕的區域],

),

//控制操作區域是否開啟

widget operationarea

(context,index)

else

}

class

attentionoperation

extends

statefulwidget):

super

(key: key)

; _attentionoperationstate createstate()

=>

_attentionoperationstate()

;}class

_attentionoperationstate

extends

state

with singletickerproviderstatemixin);

}); controller.

forward()

;//執行動畫}

@override

widget build

(buildcontext context)

, child:

container

( width:

100,

color: colors.blue,

child:

center

( child:

text

('置頂'

, style:

textstyle

( color: colors.white

),),),)

,),inkwell

( ontap:()

, child:

container

( width:

100,

color: colors.red,

child:

center

( child:

text

('刪除'

, style:

textstyle

( color: colors.white

),),),)

,)],

)),);}}

class

attpage

extends

statefulwidget):

super

(key: key)

; _attpagestate createstate()

=>

_attpagestate()

;}class

_attpagestate

extends

state

},child:

stack

( children:

[_item

(context,index,imagelist)

,operationarea

(context,index)],

),);

},);

}),)

;}}widget _item

(context,index,imagelist)

, child:

container

( margin: edgeinsets.

fromltrb(10

,20,0

,0),

child:

column

( children:

[row

( children:

[container

(//區域

width:

100,

height:

100,

child: image.

network

(imagelist[index]),

),/****************start 資訊區域************************/

container

( margin: edgeinsets.

only

(left:5)

, child:

column

( children:

[container

( margin: edgeinsets.

fromltrb(5

,10,0

,0),

child:

row(

children:

[text

('sku:123456'),

container

( margin: edgeinsets.

only

(left:15)

, child:

text

('sku:123456'),

)],)

),container

( margin: edgeinsets.

fromltrb(5

,10,0

,0),

child:

row(

children:

[text

('sku:123456'),

container

( margin: edgeinsets.

only

(left:15)

, child:

text

('sku:123456'),

)],)

),container

( margin: edgeinsets.

fromltrb(5

,10,0

,0),

child:

row(

children:

[text

('sku:123456'),

container

( margin: edgeinsets.

only

(left:15)

, child:

text

('sku:123456'),

)],)

),/****************end 資訊區域************************/],

)),]

,),divider()

],))

,);}

//控制操作區域是否開啟

widget operationarea

(context,index)

else

}

Flutter 側滑刪除側滑操作控制項

簡單的側滑操作控制項,支援左滑和右滑以及三種滑出樣式,互斥事件使用了eventbus,可換成其它方式實現。其中 screenmanager.getinstance screenwidth 是螢幕的寬度。側滑控制項 class sideslidewidget extends statefulwidge...

RecyclerView 側滑刪除實現 一

前段時間因為專案需求,實現乙個側滑刪除的功能,就自己實現了乙個。這篇部落格要介紹的是側滑的一些基礎知識,也是在實際的開發過程中,較難以理解的部分。一.關於view 的 scrollto,getscrollx 和 getscrolly 當利用 scroller 去滑動螢幕或者擴充套件 scrollvi...

微信小程式側滑刪除

直接上乾貨吧 wxml 刪除wxss view,label,textarea,input hd con hd con listitem hd con list hd con listitem.active list hd con list info hd con list info toph hd ...