提交 8ee3be51 作者: liangjialin

新增Demo、Toask工具类

上级 90444998
import 'package:flutter/material.dart';
import 'package:flutterpro/liangjialin/liangjialin_container.dart';
import 'package:flutterpro/liangjialin/liangjialin_router_widget.dart';
import 'liangjialin_image.dart';
import 'liangjialin_image_local.dart';
......@@ -55,6 +56,17 @@ class LiangjialinHome extends StatelessWidget {
));
},
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:flutterpro/router_path.dart';
import 'package:flutterpro/yangjunlei/yangjunlei.dart';
import 'package:oktoast/oktoast.dart';
import 'dingbaojie/FirstDay/DbjMain.dart';
import 'jiexifeng/jiexifeng.dart';
......@@ -14,14 +15,16 @@ class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
// TODO: implement build
return new MaterialApp(
home: new Scaffold(
appBar: AppBar(
title: Text("原生开发组Flutter学习成果展示"),
return OKToast(
child:new MaterialApp(
home: new Scaffold(
appBar: AppBar(
title: Text("原生开发组Flutter学习成果展示"),
),
body: MyAppBody(),
),
routes: RouterPath.generateRoute(),
),
body: MyAppBody(),
),
routes: Router.generateRoute(),
);
}
}
......@@ -75,11 +78,10 @@ class MyAppBody extends StatelessWidget {
color: Theme.of(context).primaryColor,
textColor: Colors.white,
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => liangjialin(),
));
Navigator.pushNamed(context, RouterName.liangjialin,arguments: <String, String>{
'city': 'Berlin',
'country': 'Germany',
});
},
child: Text("梁佳霖"),
),
......
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutterpro/liangjialin/liangjialin_container.dart';
import 'package:flutterpro/liangjialin/liangjialin_router_widget.dart';
import 'package:flutterpro/yangjunlei/yangjunlei.dart';
import 'dingbaojie/FirstDay/PaddingDemo.dart';
......@@ -17,9 +18,10 @@ class RouterName {
static const String image_liangjialin = 'liangjialin/image';
static const String image_liangjialin_local = 'liangjialin/image_local';
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() {
Map<String, WidgetBuilder> routes = {
RouterName.dingbaojie: (context) => new PaddingDemo(),
......@@ -29,6 +31,7 @@ class Router {
RouterName.image_liangjialin: (context) => new liangjialin_image(),
RouterName.image_liangjialin_local: (context) => new liangjialin_image_local(),
RouterName.liangjialin_container: (context) => new liangjialin_container(),
RouterName.liangjialin_router_widget: (context) => new liangjialin_router_widget(),
};
return routes;
}
......
......@@ -5,63 +5,63 @@ packages:
dependency: transitive
description:
name: archive
url: "https://pub.dartlang.org"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.11"
args:
dependency: transitive
description:
name: args
url: "https://pub.dartlang.org"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.5.2"
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.4.0"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.5"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.2"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.14.11"
convert:
dependency: transitive
description:
name: convert
url: "https://pub.dartlang.org"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.1"
crypto:
dependency: transitive
description:
name: crypto
url: "https://pub.dartlang.org"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.3"
cupertino_icons:
dependency: "direct main"
description:
name: cupertino_icons
url: "https://pub.dartlang.org"
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.3"
flutter:
......@@ -78,49 +78,56 @@ packages:
dependency: transitive
description:
name: image
url: "https://pub.dartlang.org"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.4"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.dartlang.org"
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.12.6"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
url: "https://pub.flutter-io.cn"
source: hosted
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:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.6.4"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.dartlang.org"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.8.0+1"
petitparser:
dependency: transitive
description:
name: petitparser
url: "https://pub.dartlang.org"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.4.0"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.dartlang.org"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.5"
sky_engine:
......@@ -132,64 +139,65 @@ packages:
dependency: transitive
description:
name: source_span
url: "https://pub.dartlang.org"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.5.5"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.dartlang.org"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.9.3"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.dartlang.org"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.dartlang.org"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.5"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.0"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.2.11"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.6"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.8"
xml:
dependency: transitive
description:
name: xml
url: "https://pub.dartlang.org"
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.5.0"
sdks:
dart: ">=2.4.0 <3.0.0"
flutter: ">=0.3.0 <2.0.0"
......@@ -19,6 +19,7 @@ environment:
dependencies:
flutter:
sdk: flutter
oktoast: ^2.1.7
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论