当前位置:网站首页>Flutter GridView Demo
Flutter GridView Demo
2022-04-22 08:30:00 【GuoXuan_ CHN】
GridView
Code
///2019.4.20 By GX
Widget _buildRechargeGridView() {
List<Widget> list = [];
for (int i = 0; i < (infoList == null ? 0 : this.infoList.length); i++) {
/// Initialize each unit
Widget view = _buildGridUnit();
list.add(view);
}
return Container(
height: (MediaQuery.of(context).size.width) / 3 + 44,
width: MediaQuery.of(context).size.width,
padding: EdgeInsets.only(
left: getWidthFromRatio(context, 20),
right: getWidthFromRatio(context, 20)),
child: GridView(
/// Model adaptation , If necessary , change SliverGridDelegateWithFixedCrossAxisCount
gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
maxCrossAxisExtent: (MediaQuery.of(context).size.width) / 3,
mainAxisSpacing: 22,
crossAxisSpacing: 20,
childAspectRatio: 2,
),
children: list,
),
);
}
Code instructions
infoList
infoList It's right GridView Initialization information of each unit List. In your code, it should be obtained from the network or other ways .
_buildGridUnit()
_buildGridUnit yes return One widget Private functions of , Create... In the function as required GridView General cell layout
Attribute specification
SliverGridDelegateWithMaxCrossAxisExtent
const SliverGridDelegateWithMaxCrossAxisExtent({
@required this.maxCrossAxisExtent, // Every Unit How wide
this.mainAxisSpacing = 0.0,// Spindle direction spacing
this.crossAxisSpacing = 0.0,// Longitudinal axis spacing
this.childAspectRatio = 1.0,// Spindle vertical axis scaling
})
SliverGridDelegateWithFixedCrossAxisCount
const SliverGridDelegateWithFixedCrossAxisCount({
@required this.crossAxisCount,// How many per line
this.mainAxisSpacing = 0.0,// Spindle direction spacing
this.crossAxisSpacing = 0.0,// Longitudinal axis spacing
this.childAspectRatio = 1.0,// Spindle vertical axis scaling
})
Small pit
GridView Make it out , There will be sliding effects , according to UI Schematic diagram and product requirements , You may need to add a container to release sliding
appreciate
If it helps you , Stand by me , Thank you for

版权声明
本文为[GuoXuan_ CHN]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220735463534.html
边栏推荐
- Redis entry required
- Typescript学习指南
- The integrated optical access equipment provides 16 E1 service ports, 4 100m isolated networks and 2 Gigabit isolated Ethernet optical terminals
- [跟着官方文档学JUnit5][二][WritingTests][学习笔记]
- 【优麒麟】22.04 LTS版本即将发布,终极预告来袭,你准备好了吗?
- Winsock编程接口实验:实现ipconfig
- 【论文阅读】【3d目标检测】Voxel Set Transformer: A Set-to-Set Approach to 3D Object Detection from Point Clouds
- Flutter 判断网络可用性
- Goweb Foundation
- NFT难道只是一场“美丽的泡沫”?
猜你喜欢

MySQL深入学习(三二):数据库其它调优策略

Flutter ListView 加载更多

What do you know about the well-known public DNS servers in China

【论文阅读】【3d目标检测】Voxel Set Transformer: A Set-to-Set Approach to 3D Object Detection from Point Clouds

实验四、数据预处理

Dynamic programming -- lc518 Change II

Simple use of fresco - simpledraweeview

【论文阅读】【3d目标检测】pvgnet

sonic云真机入门教程

Cloud computing learning 2 - keystone component operation and maintenance and testing
随机推荐
shell脚本学习笔记——shell对文件的操作sed
SQL requirements processing - count the number of Mondays to Sundays in a given year
原来PID是在老王头和老斯基的斗争中诞生的
如何用c语言实现【猜数字游戏】
Layer1 capacity expansion: fragmentation and composability
Winsock编程接口实验:实现ipconfig
NFT难道只是一场“美丽的泡沫”?
Fresco简单的使用—SimpleDraweeView
重启redis
Redis non relational database - redis high availability, persistence and performance management
Experiment 1: introduction to data science -- data science cognition
oh-my-notepro
Informatics Aosai yibentong 1317: [example 5.2] combined output
Flutter基础
centos7安装MySQL8.0
CAS: 36530-06-0 boron chloride phthalocyanine | phthalocyanine | boron chloride phthalocyanine | dichloroboron phthalocyanine dye | boron chloride phthalocyanine | boronsubphalocyaninichloride
npm发布一个项目到npm库?
Flutter 判断网络可用性
shell学习笔记——shell对输出流的处理awk
nacos基础(1):什么是配置中心&Nacos介绍