往googler的路上day9 day10
Feb 16, 2021
今天練習之後要使用專案的flutter軟體開發套件,主要使用dart語言。
附上筆記:
import 'package:flutter/material.dart'; //引入dart來使用
void main() => runApp(MaterialApp(
home : Home(),
));
class Home extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar : AppBar(
title: Text('my first flutter app'),
centerTitle: true,
),
body: Center(
child: RaisedButton.icon( // if RaisedButton is wrong .
onPressed: () {},
icon: Icon(
Icons.add_box
),
color: Colors.amber,
label: Text('Show you'),
)
),
floatingActionButton: FloatingActionButton(
onPressed: (){
print('try your best.');
},
child: Text('click'),
),
);;
}
}
關於row的Axis筆記
- 如何抄GITHUB CODE
2.(Alt+Enter | Inject language or reference | <SQL dialect>)
3.每個widget間的’,’非常重要
4.調整顏色字形//https://reurl.cc/a5a6Ml
5. 底部輸入”stless” 會有StatelessWidget,裡面return widget 即為介面
(因為你要return的東西是一個不能更改的介面)
6.插入圖片 // https://reurl.cc/7yj6Yd
7.在widget中使用widget要用child:
8.再介面中新增 Icons & Buttons //https://reurl.cc/8y51Lg
9.padding is inside the container and margin is around the container
10.Row && Column的使用重點:
(1) 你可以藉由 mainAxisAlignment 以及 crossAxisAlignment來對Row或Coulumn中的Widgets進行排版
(2) 你的AxisAlignment:要放在 children: <Widget>[內容]外面
(3) Row中可以包Column, Column中也可以包Row
11.flutter shortcuts
ex:假設三個widgets放在同個空間中,可以按左邊的燈泡讓你更改裡面,無論是add padding 或是上下widget
swap等等都可以
12.Expanded Widgets
(1)先點小燈泡 wrap with widgets 然後 將”widgets” 改成Expanded.
(2)可以藉由flex來調配空間比例
今天的最後看了"刻意自學"這本書,有時間再補上筆記。