Comments (2)
1.banner每次切换的时候,回调中改变了currentIndex,调用了notifyListeners,首页并不会重新build一次,首页会多build一次,是因为AppBar加了actions属性导致,你可以测试一下
2.底部导航每次切换的时候,首页也会build一次的原因是因为下标改变时,原先的代码代码使用了setState导致,这块已做了优化
from flutter_eyepetizer.
1.banner每次切换的时候,回调中改变了currentIndex,调用了notifyListeners,首页并不会重新build一次,首页会多build一次,是因为AppBar加了actions属性导致,你可以测试一下
2.底部导航每次切换的时候,首页也会build一次的原因是因为下标改变时,原先的代码代码使用了setState导致,这块已做了优化
第二个问题已经确认了下,没问题了,第一个问题应该不是actions属性的问题,我现在是这样做的,将banner的文字部分也放到banner的itemBuilder里,onIndexChanged回调就不需要了
Swiper(
autoplay: true,
pagination: SwiperPagination(alignment: Alignment.bottomRight),
itemCount: model.bannerList.length,
// onIndexChanged: (index) {
// model.changeBanner(index);
// },
onTap: (index) {
NavigatorManager.to(VideoDetailPage(data: model.bannerList[index].data,));
},
itemBuilder: (BuildContext context, int index) {
return Stack(
children: [
Container(
width: MediaQuery.of(context).size.width,
child: CachedNetworkImage(
imageUrl: model.bannerList[index].data.cover.feed,
fit: BoxFit.cover,
),
),
Positioned(
width: MediaQuery.of(context).size.width - 30,
bottom: 0,
child: Container(
padding: EdgeInsets.fromLTRB(15, 10, 0, 15),
child: Text(
model.bannerList[index].data.title,
style: TextStyle(fontSize: 12, color: Colors.white),
),
decoration: BoxDecoration(
color: Colors.black12,
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(8),
bottomRight: Radius.circular(8))),
))
],
);
},
),
from flutter_eyepetizer.
Related Issues (14)
- 发现--->推荐,向下滑动图片加载异常,闪烁,卡顿,然后多向下滑动几屏会crash HOT 9
- tabview和pageView之间的滑动冲突咋办 HOT 2
- F-Droid
- 构建失败 HOT 1
- 模块化如何实现通信? 比你A module 交互 B module 在互相不依赖的情况下 HOT 1
- 推荐一款flutter组件化管理工具flutter_manager
- banner显示细节问题 HOT 1
- 构建失败
- 这里改好了 HOT 1
- 啥时候升Flutter2.0 HOT 2
- ios可以 安卓一直网络请求不通 HOT 3
- 大佬, customer_video_controlls.dart 里面自定义播放空间找不到 HOT 1
- 带佬 运行不了啊 HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter_eyepetizer.