|
@@ -1,4 +1,5 @@
|
|
|
import 'package:flutter/material.dart';
|
|
|
+import 'package:english_words/english_words.dart';
|
|
|
|
|
|
void main() {
|
|
|
runApp(MyApp());
|
|
@@ -135,7 +136,8 @@ class _MyHomePageState extends State<MyHomePage> {
|
|
|
// fullscreenDialog: false));
|
|
|
},
|
|
|
),
|
|
|
- RouterTestRoute()
|
|
|
+ RouterTestRoute(),
|
|
|
+ RandomWordsWidget()
|
|
|
],
|
|
|
),
|
|
|
),
|
|
@@ -154,13 +156,35 @@ class NewRoute extends StatelessWidget {
|
|
|
Widget build(BuildContext context) {
|
|
|
//获取路由参数
|
|
|
var args = ModalRoute.of(context).settings.arguments;
|
|
|
+
|
|
|
return Scaffold(
|
|
|
appBar: AppBar(
|
|
|
title: Text("New route" + args),
|
|
|
),
|
|
|
body: Center(
|
|
|
- child: Text("This is new route" + args),
|
|
|
- ),
|
|
|
+ child: Column(
|
|
|
+ children: [
|
|
|
+ Text("This is new route" + args),
|
|
|
+ RandomWordsWidget(),
|
|
|
+ Image(
|
|
|
+ image: AssetImage("images/avatar.png"),
|
|
|
+ width: 100.0,
|
|
|
+ color: Colors.blue,
|
|
|
+ colorBlendMode: BlendMode.difference,
|
|
|
+ ),
|
|
|
+ // Image(
|
|
|
+ // image: NetworkImage(
|
|
|
+ // "https://avatars2.githubusercontent.com/u/20411648?s=460&v=4"),
|
|
|
+ // width: 100.0,
|
|
|
+ // color: Colors.blue,
|
|
|
+ // // colorBlendMode: BlendMode.difference,
|
|
|
+ // ),
|
|
|
+ // Image.network(
|
|
|
+ // "https://avatars2.githubusercontent.com/u/20411648?s=460&v=4",
|
|
|
+ // width: 100.0,
|
|
|
+ // )
|
|
|
+ ],
|
|
|
+ )),
|
|
|
);
|
|
|
}
|
|
|
}
|
|
@@ -222,3 +246,15 @@ class RouterTestRoute extends StatelessWidget {
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+class RandomWordsWidget extends StatelessWidget {
|
|
|
+ @override
|
|
|
+ Widget build(BuildContext context) {
|
|
|
+ // 生成随机字符串
|
|
|
+ final wordPair = new WordPair.random();
|
|
|
+ return Padding(
|
|
|
+ padding: const EdgeInsets.all(8.0),
|
|
|
+ child: new Text(wordPair.toString()),
|
|
|
+ );
|
|
|
+ }
|
|
|
+}
|