Flutter 學(xué)習(xí)打卡 2020-11-03 02
1. 快速創(chuàng)建 Widget
stle ------> 快速創(chuàng)建StatelessWidget
class haahh extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
);
}
}
stful ------> 快速創(chuàng)建StatefulWidget
class 輸入類名稱自動填充 extends StatefulWidget {
@override
_輸入類名稱自動填充State createState() => _輸入類名稱自動填充State();
}
class _輸入類名稱自動填充State extends State<輸入類名稱自動填充> {
@override
Widget build(BuildContext context) {
return Container(
);
}
}
2. 方法名, widget等等 光標(biāo)選中, command + ., 可以進(jìn)行快捷操作

image.png

image.png
wrap 相關(guān)快捷操作, 意為將現(xiàn)有代碼塊放入新的代碼塊中
extract 為 提取當(dāng)前代碼, 獨(dú)立出來成為一個(gè)新的方法/變量/widget
convert 為, 將當(dāng)前類或widget, 轉(zhuǎn)換成其他的, 比如statelesswidget轉(zhuǎn)換成statefulwidget
3. listView布局
list進(jìn)行列布局時(shí),要考慮到需要撐起足夠的大小,否則代碼運(yùn)行報(bào)錯(cuò)
children: [
Text("let me see see"),
Expanded(
child: ListView(
children: list,
),
)
],