一年半前玩过flutter,忘光光...现在是时候重新拾取了。~
启动页一般只放图片或者加几行文字。
1、创建好flutter项目之后,在lib文件下面新建launch.dart或xx.dart.

2、在根目录下新建images文件夹,如已有直接放入图片

3、flutter_yijiake.iml中加入注入该图片,并注意空格

4、在根目录下的test/widget_test.dart中更改默认的启动页为当前的启动页路径

5、最后重新设置启动时的页面

6、非常简单的启动页面放logo图片
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.cyan,
),
home: new Scaffold(
backgroundColor: Colors.cyan,
body: new Center(
child: new Image(image:AssetImage("images/ic_app.jpg"),width: 100,height: 100,),
),
),
);
}
}
值得一说的是,flutter框架的UI组件需要已new 组件的形式展开。
网友评论