学习日志(平台Android Studio)
1、图片
flutter加载图片,需要在pubspec.yaml里添加支持:
assets:
- images/
最好不要删除原来注释。直接在上方加。
images是新建文件夹名。不过,我试了一下,这个文件夹名好像不能是其它的名字,比如myImages。就算其它地方,都改过来了,加载图片,还是不成功,也没看见报错,APP也启动不了。暂不清楚啥原因。
弄张png格式的图片进去,亦同。
2、新建无状态、有状态类。
只需要输入s,就会的提示,根据需要选择—stful、stless
3、按钮设置背影颜色和字体颜色:
ElevatedButton(
onPressed: () {},
style: ElevatedButton.styleFrom(backgroundColor: Colors.yellow),
child: const Text(
"漂浮按钮",
style: TextStyle(color: Colors.red),
),
),
TextButton(
onPressed: () {},
style: TextButton.styleFrom(backgroundColor: Colors.red),
child: const Text(
"扁平按钮",
style: TextStyle(color: Colors.yellow),
),
),