Flutter:更改APP背景顏色

Yanwei Liu
1 min readSep 2, 2019

--

三種方法:

1.Using backgroundColor

Scaffold(
backgroundColor: Colors.black,
body: Center(...),
)

2.Using Container in SizedBox.expand

Scaffold(
body: SizedBox.expand(
child: Container(
color: Colors.black,
child: Center(...)
),
),
)

3.Using Theme

Theme(
data: Theme.of(context).copyWith(scaffoldBackgroundColor: Colors.black),
child: Scaffold(
body: Center(...),
),
)

--

--

No responses yet