下面的这段设置的是全局的主题,以Hello World为例
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Welcome to Flutter',
theme: new ThemeData(
brightness: Brightness.dark,
primaryColor: Colors.lightBlue[800],
accentColor: Colors.cyan[600],
),
home: Scaffold(
appBar: AppBar(
title: Text('Welcome to Flutter '),
),
body: Center(
child: Text('Hello World'),
),
),
);
}
}
效果图

更多文章资源,欢迎关注:程序猿阵线联盟
