Widget buildSpecialEffects() {
return StatefulBuilder(builder: (context, setState) {
return Container(
width: 1920.w,
height: 844.w,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(
margin: EdgeInsets.only(bottom: 17.w),
height: 125.w,
width: 1183.w,
alignment: Alignment.center,
child: Slider(
activeColor: Color(0xFFFFFFFF),
inactiveColor: Color(0x80FFFFFF),
max: 100,
min: 0,
value: specialEffectsSliderIndex,
onChanged: (double value) {
setState(() {
specialEffectsSliderIndex = value.toInt().toDouble();
});
},
),
),
///底下白色布局
Expanded(
child: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(58.w),
topRight: Radius.circular(58.w))),
padding: EdgeInsets.only(left: 78.w, right: 78.w),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
///清除
Container(
height: 255.w,
child: Row(
mainAxisSize: MainAxisSize.max,
children: [
Row(
children: [
Image.asset(
'image/icon57.png',
width: 68.w,
),
Container(
width: 29.w,
),
Text(
'清除',
style: TextStyle(fontSize: 71.w),
),
Container(
width: 78.w,
),
Container(
width: 2.w,
height: 96.w,
color: const Color(0xFFEEEEEE),
)
],
mainAxisSize: MainAxisSize.min,
),
Expanded(
child: Container(
margin: EdgeInsets.only(left: 39.w),
child: ListView.builder(
controller: specialTypeController,
scrollDirection: Axis.horizontal,
itemCount: specialEffectsTypeList.length,
itemBuilder: (context, index) {
return GestureDetector(
onTap: (){
if(widget.methodListener != null){
widget.methodListener('onSpecialTypeIndex',index);
}
setState((){
specialEffectsTypeIndex = index;
});
},
child: Container(
color: Colors.transparent,
padding: EdgeInsets.only(
left: 39.w,
right: 39.w,
bottom: 78.w,
top: 78.w),
child: Text(
'${specialEffectsTypeList[index].name}',
style: TextStyle(
fontSize: 71.sp,
color: (index == specialEffectsTypeIndex)
? Colors.red
: Colors.black,
fontWeight: (index == specialEffectsTypeIndex)
? FontWeight.bold
: FontWeight.w400,
),
),
),
);
}),
))
],
),
),
///分类列表
Expanded(
child: ListView.builder(
padding: EdgeInsets.only(top: 0),
scrollDirection: Axis.horizontal,
itemCount: specialEffectsList.length,
itemBuilder: (context, index) {
return GestureDetector(
onTap: (){
if(widget.methodListener != null){
widget.methodListener('onSpecialIndex',index);
}
},
child: Container(
margin: EdgeInsets.only(right: 39.w,bottom: 21.w),
child: Column(
children: [
Container(
decoration: BoxDecoration(
image: DecorationImage(
image: NetworkImage(Request.assertUrl + specialEffectsList[index].cover)
),
borderRadius: BorderRadius.circular(28.w),
border: (index == specialEffectsContentIndex)?Border.all(color: Colors.red,width: 3.w):null
),
width: 286.w,
height: 286.w,
),
Container(
height: 25.w,
),
Text('${specialEffectsList[index].name}',style: TextStyle(fontSize: 61.w,color: Colors.black),)
],
),
),
);
}),
)
],
),
),
)
],
),
);
});
}
在setState不生效的情况下,可使用StatefulBuilder
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- React不使用生命周期以及setstate的情况下可以通过forceUpdate()方法来进行render的渲染...
- 直接开始!不唠叨✌️ 1.登录GitHub,创建仓库 2.填写仓库信息,创建仓库 3.生成仓库地址 4.Xcode...
- 按照下面的代码封装完轮播组件后,在微信小程序模拟器中可以实现圆角效果,But运行到真机上,圆角效果没了!!! 轮播...
- 写在前面: 大家好,这是光堂兄的第一篇文章,其实很早之前就有将自己学习python的点滴记录下来的想法,只是没有找...