提交 8ee3be51 作者: liangjialin

新增Demo、Toask工具类

上级 90444998
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutterpro/liangjialin/liangjialin_container.dart'; import 'package:flutterpro/liangjialin/liangjialin_container.dart';
import 'package:flutterpro/liangjialin/liangjialin_router_widget.dart';
import 'liangjialin_image.dart'; import 'liangjialin_image.dart';
import 'liangjialin_image_local.dart'; import 'liangjialin_image_local.dart';
...@@ -55,6 +56,17 @@ class LiangjialinHome extends StatelessWidget { ...@@ -55,6 +56,17 @@ class LiangjialinHome extends StatelessWidget {
)); ));
}, },
child: Text("Scaffold、Container、padding演示"), child: Text("Scaffold、Container、padding演示"),
),RaisedButton(
color: Theme.of(context).primaryColor,
textColor: Colors.white,
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => liangjialin_router_widget(),
));
},
child: Text("底部导航、TabBar演示"),
), ),
], ],
), ),
......
import 'package:flutter/material.dart';
import 'package:oktoast/oktoast.dart';
class liangjialin_router_widget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: AppBar(
title: Text("底部导航、TabBar演示"),
centerTitle: true,
actions: <Widget>[
//导航栏右侧菜单
IconButton(
icon: Icon(Icons.four_k),
onPressed: () {
showDialog(
context: context,
builder: (ctx) {
return Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
buildButton("分享到QQ", () {
showToast("已分享至QQ");
Navigator.pop(context, false); //关闭Dialog
}),
buildButton("分享到微信", () {
showToast("已分享至微信");
Navigator.pop(context, false); //关闭Dialog
}),
],
),
);
},
);
}), // 新增分享按钮
],
),
drawer: MyDrawer(),
body: ImageDemoSection(),
);
}
}
class ImageDemoSection extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new Center(
child: new Container(
// transform: Matrix4.skewY(0.3),
padding: EdgeInsets.all(50),
width: 300,
height: 300,
decoration: BoxDecoration(
color: Colors.red,
),
child: new Text(
"左上角是抽屉菜单,右上角是分享菜单,点点试试。",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 20,
color: Colors.white
),
),
));
}
}
Widget buildButton(
String text,
Function onPressed, {
Color color = Colors.white,
}) {
return FlatButton(
color: color,
child: Text(text),
onPressed: onPressed,
);
}
class MyDrawer extends StatelessWidget {
@override
Widget build(BuildContext context) {
// TODO: implement build
return new Drawer(
child: new Container(
padding: EdgeInsets.fromLTRB(0, 150, 0, 0),
child: new Column(
children: <Widget>[
new RaisedButton(
onPressed: (){
showToast("选项一");
Navigator.pop(context);
},
child: new Text(
"选项一",
style: TextStyle(
color: Colors.white,
),
),
color: Colors.blue,
),new RaisedButton(
onPressed: (){
showToast("选项二");
Navigator.pop(context);
},
child: new Text(
"选项二",
style: TextStyle(
color: Colors.white,
),
),
color: Colors.blue,
),
],
),
)
);
}
}
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutterpro/router_path.dart'; import 'package:flutterpro/router_path.dart';
import 'package:flutterpro/yangjunlei/yangjunlei.dart'; import 'package:flutterpro/yangjunlei/yangjunlei.dart';
import 'package:oktoast/oktoast.dart';
import 'dingbaojie/FirstDay/DbjMain.dart'; import 'dingbaojie/FirstDay/DbjMain.dart';
import 'jiexifeng/jiexifeng.dart'; import 'jiexifeng/jiexifeng.dart';
...@@ -14,14 +15,16 @@ class MyApp extends StatelessWidget { ...@@ -14,14 +15,16 @@ class MyApp extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
// TODO: implement build // TODO: implement build
return new MaterialApp( return OKToast(
home: new Scaffold( child:new MaterialApp(
appBar: AppBar( home: new Scaffold(
title: Text("原生开发组Flutter学习成果展示"), appBar: AppBar(
title: Text("原生开发组Flutter学习成果展示"),
),
body: MyAppBody(),
),
routes: RouterPath.generateRoute(),
), ),
body: MyAppBody(),
),
routes: Router.generateRoute(),
); );
} }
} }
...@@ -75,11 +78,10 @@ class MyAppBody extends StatelessWidget { ...@@ -75,11 +78,10 @@ class MyAppBody extends StatelessWidget {
color: Theme.of(context).primaryColor, color: Theme.of(context).primaryColor,
textColor: Colors.white, textColor: Colors.white,
onPressed: () { onPressed: () {
Navigator.push( Navigator.pushNamed(context, RouterName.liangjialin,arguments: <String, String>{
context, 'city': 'Berlin',
MaterialPageRoute( 'country': 'Germany',
builder: (context) => liangjialin(), });
));
}, },
child: Text("梁佳霖"), child: Text("梁佳霖"),
), ),
......
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutterpro/liangjialin/liangjialin_container.dart'; import 'package:flutterpro/liangjialin/liangjialin_container.dart';
import 'package:flutterpro/liangjialin/liangjialin_router_widget.dart';
import 'package:flutterpro/yangjunlei/yangjunlei.dart'; import 'package:flutterpro/yangjunlei/yangjunlei.dart';
import 'dingbaojie/FirstDay/PaddingDemo.dart'; import 'dingbaojie/FirstDay/PaddingDemo.dart';
...@@ -17,9 +18,10 @@ class RouterName { ...@@ -17,9 +18,10 @@ class RouterName {
static const String image_liangjialin = 'liangjialin/image'; static const String image_liangjialin = 'liangjialin/image';
static const String image_liangjialin_local = 'liangjialin/image_local'; static const String image_liangjialin_local = 'liangjialin/image_local';
static const String liangjialin_container = 'liangjialin/container'; static const String liangjialin_container = 'liangjialin/container';
static const String liangjialin_router_widget = 'liangjialin/liangjialin_router_widget';
} }
class Router { class RouterPath {
static Map<String, WidgetBuilder> generateRoute() { static Map<String, WidgetBuilder> generateRoute() {
Map<String, WidgetBuilder> routes = { Map<String, WidgetBuilder> routes = {
RouterName.dingbaojie: (context) => new PaddingDemo(), RouterName.dingbaojie: (context) => new PaddingDemo(),
...@@ -29,6 +31,7 @@ class Router { ...@@ -29,6 +31,7 @@ class Router {
RouterName.image_liangjialin: (context) => new liangjialin_image(), RouterName.image_liangjialin: (context) => new liangjialin_image(),
RouterName.image_liangjialin_local: (context) => new liangjialin_image_local(), RouterName.image_liangjialin_local: (context) => new liangjialin_image_local(),
RouterName.liangjialin_container: (context) => new liangjialin_container(), RouterName.liangjialin_container: (context) => new liangjialin_container(),
RouterName.liangjialin_router_widget: (context) => new liangjialin_router_widget(),
}; };
return routes; return routes;
} }
......
...@@ -5,63 +5,63 @@ packages: ...@@ -5,63 +5,63 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: archive name: archive
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.11" version: "2.0.11"
args: args:
dependency: transitive dependency: transitive
description: description:
name: args name: args
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.5.2" version: "1.5.2"
async: async:
dependency: transitive dependency: transitive
description: description:
name: async name: async
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.4.0" version: "2.4.0"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:
name: boolean_selector name: boolean_selector
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.5" version: "1.0.5"
charcode: charcode:
dependency: transitive dependency: transitive
description: description:
name: charcode name: charcode
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.1.2" version: "1.1.2"
collection: collection:
dependency: transitive dependency: transitive
description: description:
name: collection name: collection
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.14.11" version: "1.14.11"
convert: convert:
dependency: transitive dependency: transitive
description: description:
name: convert name: convert
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.1" version: "2.1.1"
crypto: crypto:
dependency: transitive dependency: transitive
description: description:
name: crypto name: crypto
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.3" version: "2.1.3"
cupertino_icons: cupertino_icons:
dependency: "direct main" dependency: "direct main"
description: description:
name: cupertino_icons name: cupertino_icons
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.1.3" version: "0.1.3"
flutter: flutter:
...@@ -78,49 +78,56 @@ packages: ...@@ -78,49 +78,56 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: image name: image
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.4" version: "2.1.4"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:
name: matcher name: matcher
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.12.6" version: "0.12.6"
meta: meta:
dependency: transitive dependency: transitive
description: description:
name: meta name: meta
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.1.8" version: "1.1.8"
oktoast:
dependency: "direct main"
description:
name: oktoast
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.3.1+1"
path: path:
dependency: transitive dependency: transitive
description: description:
name: path name: path
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.6.4" version: "1.6.4"
pedantic: pedantic:
dependency: transitive dependency: transitive
description: description:
name: pedantic name: pedantic
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.8.0+1" version: "1.8.0+1"
petitparser: petitparser:
dependency: transitive dependency: transitive
description: description:
name: petitparser name: petitparser
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.4.0" version: "2.4.0"
quiver: quiver:
dependency: transitive dependency: transitive
description: description:
name: quiver name: quiver
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.5" version: "2.0.5"
sky_engine: sky_engine:
...@@ -132,64 +139,65 @@ packages: ...@@ -132,64 +139,65 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: source_span name: source_span
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.5.5" version: "1.5.5"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
name: stack_trace name: stack_trace
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.9.3" version: "1.9.3"
stream_channel: stream_channel:
dependency: transitive dependency: transitive
description: description:
name: stream_channel name: stream_channel
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.0" version: "2.0.0"
string_scanner: string_scanner:
dependency: transitive dependency: transitive
description: description:
name: string_scanner name: string_scanner
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.5" version: "1.0.5"
term_glyph: term_glyph:
dependency: transitive dependency: transitive
description: description:
name: term_glyph name: term_glyph
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.1.0" version: "1.1.0"
test_api: test_api:
dependency: transitive dependency: transitive
description: description:
name: test_api name: test_api
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.2.11" version: "0.2.11"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
name: typed_data name: typed_data
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.1.6" version: "1.1.6"
vector_math: vector_math:
dependency: transitive dependency: transitive
description: description:
name: vector_math name: vector_math
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.8" version: "2.0.8"
xml: xml:
dependency: transitive dependency: transitive
description: description:
name: xml name: xml
url: "https://pub.dartlang.org" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "3.5.0" version: "3.5.0"
sdks: sdks:
dart: ">=2.4.0 <3.0.0" dart: ">=2.4.0 <3.0.0"
flutter: ">=0.3.0 <2.0.0"
...@@ -19,6 +19,7 @@ environment: ...@@ -19,6 +19,7 @@ environment:
dependencies: dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
oktoast: ^2.1.7
# The following adds the Cupertino Icons font to your application. # The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons. # Use with the CupertinoIcons class for iOS style icons.
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论