Flutter:更改APP Bar顏色



const PrimaryColor = const Color(0xFF151026);
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primaryColor: PrimaryColor,
home: MyApp(),
appBar: AppBar(
backgroundColor: PrimaryColor,


Image for post
Image for post
new Scaffold(
appBar: AppBar(
title: Center(child: Text('Awesome AppBar')),
flexibleSpace: Container(
decoration: new BoxDecoration(
gradient: new LinearGradient(
colors: [
const Color(0xFF3366FF),
const Color(0xFF00CCFF),
begin: const FractionalOffset(0.0, 0.0),
end: const FractionalOffset(1.0, 0.0),
stops: [0.0, 1.0],
tileMode: TileMode.clamp),
body: ...,

Written by

Machine Learning / Deep Learning / Python / Flutter cakeresume.com/yanwei-liu

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store