1.Android 手機(jī)設(shè)置狀態(tài)欄透明
如果想實(shí)現(xiàn)在 Android 手機(jī)上實(shí)現(xiàn)透明狀態(tài)欄的需求翔悠,可以在 main() 中采用如下代碼:
void main() {
runApp(MyApp());
// 設(shè)置透明狀態(tài)欄
if (Platform.isAndroid) {
SystemUiOverlayStyle systemUiOverlayStyle =
SystemUiOverlayStyle(statusBarColor: Colors.transparent);
SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);
}
}
2.判斷系統(tǒng)
代碼書寫中涩惑,有時候需要分系統(tǒng)實(shí)現(xiàn)不同的 UI,比如 iOS 的小菊花栽烂,Android 的??仑荐,F(xiàn)lutter 其實(shí)已經(jīng)提供了,那就是 Platform~如下使用:
Platform.isAndroid
Platform.isIOS
持續(xù)整理中...