mirror of
https://github.com/alibaba/flutter-go.git
synced 2025-05-21 06:46:23 +08:00
Merge branch 'develop' into dev/yisheng
* develop: fix:code
This commit is contained in:
@ -10,7 +10,6 @@
|
|||||||
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
|
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
|
||||||
333E5DAE7FC10AC69FEC26C0 /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DDA792F029EDD7A11295D192 /* libPods-Runner.a */; };
|
333E5DAE7FC10AC69FEC26C0 /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DDA792F029EDD7A11295D192 /* libPods-Runner.a */; };
|
||||||
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
|
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
|
||||||
2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */ = {isa = PBXBuildFile; fileRef = 2D5378251FAA1A9400D5DBA9 /* flutter_assets */; };
|
|
||||||
3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; };
|
3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; };
|
||||||
3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||||
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; };
|
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; };
|
||||||
@ -41,7 +40,6 @@
|
|||||||
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
|
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
|
||||||
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
|
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
|
||||||
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
|
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
|
||||||
2D5378251FAA1A9400D5DBA9 /* flutter_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter_assets; path = Flutter/flutter_assets; sourceTree = SOURCE_ROOT; };
|
|
||||||
3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = "<group>"; };
|
3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = "<group>"; };
|
||||||
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
|
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
|
||||||
7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
|
7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
|
||||||
@ -92,7 +90,6 @@
|
|||||||
children = (
|
children = (
|
||||||
3B80C3931E831B6300D905FE /* App.framework */,
|
3B80C3931E831B6300D905FE /* App.framework */,
|
||||||
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
|
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
|
||||||
2D5378251FAA1A9400D5DBA9 /* flutter_assets */,
|
|
||||||
9740EEBA1CF902C7004384FC /* Flutter.framework */,
|
9740EEBA1CF902C7004384FC /* Flutter.framework */,
|
||||||
9740EEB21CF90195004384FC /* Debug.xcconfig */,
|
9740EEB21CF90195004384FC /* Debug.xcconfig */,
|
||||||
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
|
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
|
||||||
@ -209,7 +206,6 @@
|
|||||||
files = (
|
files = (
|
||||||
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
|
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
|
||||||
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
|
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
|
||||||
2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */,
|
|
||||||
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
|
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
|
||||||
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
|
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
|
||||||
);
|
);
|
||||||
|
@ -9,7 +9,7 @@ class WidgetNotFound extends StatelessWidget {
|
|||||||
title: Text("widget not found"),
|
title: Text("widget not found"),
|
||||||
),
|
),
|
||||||
body: Container(
|
body: Container(
|
||||||
child: new Text("widget not found")
|
child: Text("widget not found")
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -30,8 +30,8 @@ class _AppBarLessDefaultComplex extends State with SingleTickerProviderStateMixi
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_scrollViewController = new ScrollController();
|
_scrollViewController = ScrollController();
|
||||||
_tabController = new TabController(vsync: this, length: 6);// 和下面的 TabBar.tabs 数量对应
|
_tabController = TabController(vsync: this, length: 6);// 和下面的 TabBar.tabs 数量对应
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -46,26 +46,26 @@ class _AppBarLessDefaultComplex extends State with SingleTickerProviderStateMixi
|
|||||||
// 如果省略了 leading ,但 AppBar 在带有 Drawer 的 Scaffold 中,则会插入一个 button 以打开 Drawer。
|
// 如果省略了 leading ,但 AppBar 在带有 Drawer 的 Scaffold 中,则会插入一个 button 以打开 Drawer。
|
||||||
// 否则,如果最近的 Navigator 具有任何先前的 router ,则会插入BackButton。
|
// 否则,如果最近的 Navigator 具有任何先前的 router ,则会插入BackButton。
|
||||||
// 这种行为可以通过设置来关闭automaticallyImplyLeading 为false。在这种情况下,空的 leading widget 将导致 middle/title widget 拉伸开始。
|
// 这种行为可以通过设置来关闭automaticallyImplyLeading 为false。在这种情况下,空的 leading widget 将导致 middle/title widget 拉伸开始。
|
||||||
return new SizedBox(
|
return SizedBox(
|
||||||
height: 500,
|
height: 500,
|
||||||
child:new AppBar( // 大量配置属性参考 SliverAppBar 示例
|
child: AppBar( // 大量配置属性参考 SliverAppBar 示例
|
||||||
title: new Text('title'),
|
title: Text('title'),
|
||||||
leading: new Icon(Icons.home),
|
leading: Icon(Icons.home),
|
||||||
backgroundColor: Colors.amber[500],
|
backgroundColor: Colors.amber[500],
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
new IconButton(
|
IconButton(
|
||||||
icon: new Icon(Icons.add_alarm),
|
icon: Icon(Icons.add_alarm),
|
||||||
tooltip: 'Add Alarm',
|
tooltip: 'Add Alarm',
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
// do nothing
|
// do nothing
|
||||||
}),
|
}),
|
||||||
new PopupMenuButton<String>(
|
PopupMenuButton<String>(
|
||||||
itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
|
itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
|
||||||
new PopupMenuItem<String>(
|
PopupMenuItem<String>(
|
||||||
value: "price", child: new Text('Sort by price')),
|
value: "price", child: Text('Sort by price')),
|
||||||
new PopupMenuItem<String>(
|
PopupMenuItem<String>(
|
||||||
value: "time", child: new Text('Sort by time')),
|
value: "time", child: Text('Sort by time')),
|
||||||
],
|
],
|
||||||
onSelected: (String action) {
|
onSelected: (String action) {
|
||||||
switch (action) {
|
switch (action) {
|
||||||
@ -78,16 +78,16 @@ class _AppBarLessDefaultComplex extends State with SingleTickerProviderStateMixi
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
bottom: new TabBar(
|
bottom: TabBar(
|
||||||
isScrollable: true,
|
isScrollable: true,
|
||||||
controller: _tabController,
|
controller: _tabController,
|
||||||
tabs: <Widget>[
|
tabs: <Widget>[
|
||||||
new Tab(text: "Tabs 1"),
|
Tab(text: "Tabs 1"),
|
||||||
new Tab(text: "Tabs 2"),
|
Tab(text: "Tabs 2"),
|
||||||
new Tab(text: "Tabs 3"),
|
Tab(text: "Tabs 3"),
|
||||||
new Tab(text: "Tabs 4"),
|
Tab(text: "Tabs 4"),
|
||||||
new Tab(text: "Tabs 5"),
|
Tab(text: "Tabs 5"),
|
||||||
new Tab(text: "Tabs 6"),
|
Tab(text: "Tabs 6"),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -107,7 +107,7 @@ class AppBarLessDefaultSimple extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return new SizedBox(
|
return SizedBox(
|
||||||
height: 200,
|
height: 200,
|
||||||
child:AppBar(
|
child:AppBar(
|
||||||
title: Text('My Fancy Dress'),
|
title: Text('My Fancy Dress'),
|
||||||
|
@ -62,7 +62,7 @@ class _DemoState extends State<Demo> {
|
|||||||
*/
|
*/
|
||||||
Widget allDomes(BuildContext context, _DemoState that) {
|
Widget allDomes(BuildContext context, _DemoState that) {
|
||||||
return Container(
|
return Container(
|
||||||
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||||
child: Column(
|
child: Column(
|
||||||
//mainAxisSize: MainAxisSize.max,
|
//mainAxisSize: MainAxisSize.max,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
@ -84,7 +84,7 @@ Widget allDomes(BuildContext context, _DemoState that) {
|
|||||||
* 带align的text
|
* 带align的text
|
||||||
* */
|
* */
|
||||||
Widget textAlignBar(String txt) {
|
Widget textAlignBar(String txt) {
|
||||||
return new Align(
|
return Align(
|
||||||
alignment: FractionalOffset.centerLeft,
|
alignment: FractionalOffset.centerLeft,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
@ -21,7 +21,7 @@ class AppBarLessDefaultSimple extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return new SizedBox(
|
return SizedBox(
|
||||||
height: 100,
|
height: 100,
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
//appBar: AppBar(title: const Text('Bottom App Bar')),
|
//appBar: AppBar(title: const Text('Bottom App Bar')),
|
||||||
|
@ -52,7 +52,7 @@ class _DemoState extends State<Demo> {
|
|||||||
*/
|
*/
|
||||||
Widget allDomes(BuildContext context, _DemoState that) {
|
Widget allDomes(BuildContext context, _DemoState that) {
|
||||||
return Container(
|
return Container(
|
||||||
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||||
child: Column(
|
child: Column(
|
||||||
//mainAxisSize: MainAxisSize.max,
|
//mainAxisSize: MainAxisSize.max,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
@ -44,9 +44,9 @@ class ButtonBarLessDefault extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
margin: new EdgeInsets.symmetric(vertical: 0.0),
|
margin: EdgeInsets.symmetric(vertical: 0.0),
|
||||||
height: 100.0,
|
height: 100.0,
|
||||||
child: new Scrollbar(child:ListView(
|
child: Scrollbar(child:ListView(
|
||||||
scrollDirection: Axis.horizontal, // 水平listView
|
scrollDirection: Axis.horizontal, // 水平listView
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
ButtonBar(
|
ButtonBar(
|
||||||
|
@ -55,7 +55,7 @@ class _DemoState extends State<Demo> {
|
|||||||
*/
|
*/
|
||||||
Widget allDomes(BuildContext context, _DemoState that) {
|
Widget allDomes(BuildContext context, _DemoState that) {
|
||||||
return Container(
|
return Container(
|
||||||
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||||
child: Column(
|
child: Column(
|
||||||
//mainAxisSize: MainAxisSize.max,
|
//mainAxisSize: MainAxisSize.max,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
@ -54,7 +54,7 @@ class _DemoState extends State<Demo> {
|
|||||||
*/
|
*/
|
||||||
Widget allDomes(BuildContext context, _DemoState that) {
|
Widget allDomes(BuildContext context, _DemoState that) {
|
||||||
return Container(
|
return Container(
|
||||||
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||||
child: Column(
|
child: Column(
|
||||||
//mainAxisSize: MainAxisSize.max,
|
//mainAxisSize: MainAxisSize.max,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
@ -44,9 +44,9 @@ class SliverAppBarLessDefault extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
for (int i = 0; i < 20; i++) {
|
for (int i = 0; i < 20; i++) {
|
||||||
listData.add(new ListItem("我是测试标题$i", Icons.cake));
|
listData.add( ListItem("我是测试标题$i", Icons.cake));
|
||||||
}
|
}
|
||||||
return new SizedBox(
|
return SizedBox(
|
||||||
height: 500.0,
|
height: 500.0,
|
||||||
child: NestedScrollView(
|
child: NestedScrollView(
|
||||||
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
|
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
|
||||||
@ -89,7 +89,7 @@ class SliverAppBarLessDefault extends StatelessWidget {
|
|||||||
// SliverPersistentHeader(
|
// SliverPersistentHeader(
|
||||||
// delegate: _SliverAppBarDelegate(
|
// delegate: _SliverAppBarDelegate(
|
||||||
// TabBar(
|
// TabBar(
|
||||||
// controller: new TabController(length: 2, vsync: this),
|
// controller: TabController(length: 2, vsync: this),
|
||||||
// labelColor: Colors.black87,
|
// labelColor: Colors.black87,
|
||||||
// unselectedLabelColor: Colors.grey,
|
// unselectedLabelColor: Colors.grey,
|
||||||
// tabs: [
|
// tabs: [
|
||||||
@ -101,10 +101,10 @@ class SliverAppBarLessDefault extends StatelessWidget {
|
|||||||
];
|
];
|
||||||
},
|
},
|
||||||
body: Center(
|
body: Center(
|
||||||
child: new ListView.builder(
|
child: ListView.builder(
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
itemBuilder: (BuildContext context, int index) {
|
itemBuilder: (BuildContext context, int index) {
|
||||||
return new ListItemWidget(listData[index]);
|
return ListItemWidget(listData[index]);
|
||||||
},
|
},
|
||||||
itemCount: listData.length,
|
itemCount: listData.length,
|
||||||
),
|
),
|
||||||
@ -127,10 +127,10 @@ class ListItemWidget extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return new InkWell(
|
return InkWell(
|
||||||
child: new ListTile(
|
child: ListTile(
|
||||||
leading: new Icon(listItem.iconData),
|
leading: Icon(listItem.iconData),
|
||||||
title: new Text(listItem.title),
|
title: Text(listItem.title),
|
||||||
),
|
),
|
||||||
onTap: () {},
|
onTap: () {},
|
||||||
);
|
);
|
||||||
|
@ -54,7 +54,7 @@ class _DemoState extends State<Demo> {
|
|||||||
*/
|
*/
|
||||||
Widget allDomes(BuildContext context, _DemoState that) {
|
Widget allDomes(BuildContext context, _DemoState that) {
|
||||||
return Container(
|
return Container(
|
||||||
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||||
child: Column(
|
child: Column(
|
||||||
//mainAxisSize: MainAxisSize.max,
|
//mainAxisSize: MainAxisSize.max,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
@ -71,7 +71,7 @@ Widget allDomes(BuildContext context, _DemoState that) {
|
|||||||
* 带align的text
|
* 带align的text
|
||||||
* */
|
* */
|
||||||
Widget textAlignBar(String txt) {
|
Widget textAlignBar(String txt) {
|
||||||
return new Align(
|
return Align(
|
||||||
alignment: FractionalOffset.centerLeft,
|
alignment: FractionalOffset.centerLeft,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
@ -23,15 +23,15 @@ class SnackBarLessDefault extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
// 当BuildContext在Scaffold之前时,调用Scaffold.of(context)会报错。这时可以通过Builder Widget来解决
|
// 当BuildContext在Scaffold之前时,调用Scaffold.of(context)会报错。这时可以通过Builder Widget来解决
|
||||||
return new Center(
|
return Center(
|
||||||
child: new Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
new GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
final snackBar = new SnackBar(
|
final snackBar = SnackBar(
|
||||||
content: new Text('这是一个SnackBar, 右侧有SnackBarAction'),
|
content: Text('这是一个SnackBar, 右侧有SnackBarAction'),
|
||||||
backgroundColor:Colors.red,
|
backgroundColor:Colors.red,
|
||||||
action: new SnackBarAction( // 提示信息上添加一个撤消的按钮
|
action: SnackBarAction( // 提示信息上添加一个撤消的按钮
|
||||||
textColor:Colors.black,
|
textColor:Colors.black,
|
||||||
label: '撤消',
|
label: '撤消',
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
@ -43,19 +43,19 @@ class SnackBarLessDefault extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
Scaffold.of(context).showSnackBar(snackBar);
|
Scaffold.of(context).showSnackBar(snackBar);
|
||||||
},
|
},
|
||||||
child: new Text('显示SnackBar'),
|
child: Text('显示SnackBar'),
|
||||||
),
|
),
|
||||||
new GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
final snackBar = new SnackBar(
|
final snackBar = SnackBar(
|
||||||
content: new Text('右侧无SnackBarAction'),
|
content: Text('右侧无SnackBarAction'),
|
||||||
backgroundColor:Colors.red,
|
backgroundColor:Colors.red,
|
||||||
duration:Duration(minutes: 1),// 持续时间
|
duration:Duration(minutes: 1),// 持续时间
|
||||||
//animation,
|
//animation,
|
||||||
);
|
);
|
||||||
Scaffold.of(context).showSnackBar(snackBar);
|
Scaffold.of(context).showSnackBar(snackBar);
|
||||||
},
|
},
|
||||||
child: new Text('显示无SnackBarAction的SnackBar'),
|
child: Text('显示无SnackBarAction的SnackBar'),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
@ -54,7 +54,7 @@ class _DemoState extends State<Demo> {
|
|||||||
*/
|
*/
|
||||||
Widget allDomes(BuildContext context, _DemoState that) {
|
Widget allDomes(BuildContext context, _DemoState that) {
|
||||||
return Container(
|
return Container(
|
||||||
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||||
child: Column(
|
child: Column(
|
||||||
//mainAxisSize: MainAxisSize.max,
|
//mainAxisSize: MainAxisSize.max,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
@ -72,7 +72,7 @@ Widget allDomes(BuildContext context, _DemoState that) {
|
|||||||
* 带align的text
|
* 带align的text
|
||||||
* */
|
* */
|
||||||
Widget textAlignBar(String txt) {
|
Widget textAlignBar(String txt) {
|
||||||
return new Align(
|
return Align(
|
||||||
alignment: FractionalOffset.centerLeft,
|
alignment: FractionalOffset.centerLeft,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
@ -16,15 +16,15 @@ class SnackBarActionDemo extends StatefulWidget {
|
|||||||
|
|
||||||
class _Demo extends State<SnackBarActionDemo> {
|
class _Demo extends State<SnackBarActionDemo> {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return new Center(
|
return Center(
|
||||||
child: new Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
new GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
final snackBar = new SnackBar(
|
final snackBar = SnackBar(
|
||||||
content: new Text('这是一个SnackBar, 右侧有SnackBarAction, 3秒后消失'),
|
content: Text('这是一个SnackBar, 右侧有SnackBarAction, 3秒后消失'),
|
||||||
backgroundColor:Color(0xffc91b3a),
|
backgroundColor:Color(0xffc91b3a),
|
||||||
action: new SnackBarAction( // 提示信息上添加一个撤消的按钮
|
action: SnackBarAction( // 提示信息上添加一个撤消的按钮
|
||||||
textColor:Colors.white,
|
textColor:Colors.white,
|
||||||
label: '撤消',
|
label: '撤消',
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
@ -37,19 +37,19 @@ class _Demo extends State<SnackBarActionDemo> {
|
|||||||
Scaffold.of(context).showSnackBar(snackBar);
|
Scaffold.of(context).showSnackBar(snackBar);
|
||||||
},
|
},
|
||||||
|
|
||||||
child: new Text('点我显示有action的SnackBar'),
|
child: Text('点我显示有action的SnackBar'),
|
||||||
),
|
),
|
||||||
new GestureDetector(
|
GestureDetector(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
final snackBar = new SnackBar(
|
final snackBar = SnackBar(
|
||||||
content: new Text('右侧无SnackBarAction, 3秒后消失'),
|
content: Text('右侧无SnackBarAction, 3秒后消失'),
|
||||||
backgroundColor:Color(0xffc91b3a),
|
backgroundColor:Color(0xffc91b3a),
|
||||||
duration:Duration(seconds: 3),// 持续时间
|
duration:Duration(seconds: 3),// 持续时间
|
||||||
//animation,
|
//animation,
|
||||||
);
|
);
|
||||||
Scaffold.of(context).showSnackBar(snackBar);
|
Scaffold.of(context).showSnackBar(snackBar);
|
||||||
},
|
},
|
||||||
child: new Text('点我显示无SnackBarAction的SnackBar'),
|
child: Text('点我显示无SnackBarAction的SnackBar'),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
@ -26,8 +26,8 @@ class _TabBarDemo extends State with SingleTickerProviderStateMixin {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_scrollViewController = new ScrollController();
|
_scrollViewController = ScrollController();
|
||||||
_tabController = new TabController(vsync: this, length: 6);// 和下面的 TabBar.tabs 数量对应
|
_tabController = TabController(vsync: this, length: 6);// 和下面的 TabBar.tabs 数量对应
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -42,27 +42,27 @@ class _TabBarDemo extends State with SingleTickerProviderStateMixin {
|
|||||||
// 如果省略了 leading ,但 AppBar 在带有 Drawer 的 Scaffold 中,则会插入一个 button 以打开 Drawer。
|
// 如果省略了 leading ,但 AppBar 在带有 Drawer 的 Scaffold 中,则会插入一个 button 以打开 Drawer。
|
||||||
// 否则,如果最近的 Navigator 具有任何先前的 router ,则会插入BackButton。
|
// 否则,如果最近的 Navigator 具有任何先前的 router ,则会插入BackButton。
|
||||||
// 这种行为可以通过设置来关闭automaticallyImplyLeading 为false。在这种情况下,空的 leading widget 将导致 middle/title widget 拉伸开始。
|
// 这种行为可以通过设置来关闭automaticallyImplyLeading 为false。在这种情况下,空的 leading widget 将导致 middle/title widget 拉伸开始。
|
||||||
return new SizedBox(
|
return SizedBox(
|
||||||
height: 500,
|
height: 500,
|
||||||
child:new Scaffold(
|
child: Scaffold(
|
||||||
appBar: new AppBar( // 大量配置属性参考 SliverAppBar 示例
|
appBar: AppBar( // 大量配置属性参考 SliverAppBar 示例
|
||||||
title: new Text('TabBar'),
|
title: Text('TabBar'),
|
||||||
leading: new Icon(Icons.home),
|
leading: Icon(Icons.home),
|
||||||
backgroundColor: Colors.amber[1000],
|
backgroundColor: Colors.amber[1000],
|
||||||
bottom: new TabBar(
|
bottom: TabBar(
|
||||||
isScrollable: true,
|
isScrollable: true,
|
||||||
controller: _tabController,
|
controller: _tabController,
|
||||||
tabs: <Widget>[
|
tabs: <Widget>[
|
||||||
new Tab(text: "Tabs 1"),
|
Tab(text: "Tabs 1"),
|
||||||
new Tab(text: "Tabs 2"),
|
Tab(text: "Tabs 2"),
|
||||||
new Tab(text: "Tabs 3"),
|
Tab(text: "Tabs 3"),
|
||||||
new Tab(text: "Tabs 4"),
|
Tab(text: "Tabs 4"),
|
||||||
new Tab(text: "Tabs 5"),
|
Tab(text: "Tabs 5"),
|
||||||
new Tab(text: "Tabs 6"),
|
Tab(text: "Tabs 6"),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
body: new TabBarView(controller: _tabController, children: <Widget>[
|
body: TabBarView(controller: _tabController, children: <Widget>[
|
||||||
Text('TabsView 1'),
|
Text('TabsView 1'),
|
||||||
Text('TabsView 2'),
|
Text('TabsView 2'),
|
||||||
Text('TabsView 3'),
|
Text('TabsView 3'),
|
||||||
|
@ -50,9 +50,9 @@ class CardLessDefault extends StatelessWidget {
|
|||||||
margin:EdgeInsets.all(20.0),
|
margin:EdgeInsets.all(20.0),
|
||||||
// margin: EdgeInsetsDirectional.only(bottom: 30.0, top: 30.0, start: 30.0),// 边距
|
// margin: EdgeInsetsDirectional.only(bottom: 30.0, top: 30.0, start: 30.0),// 边距
|
||||||
semanticContainer:true, // 表示单个语义容器,还是false表示单个语义节点的集合,接受单个child,但该child可以是Row,Column或其他包含子级列表的widget
|
semanticContainer:true, // 表示单个语义容器,还是false表示单个语义节点的集合,接受单个child,但该child可以是Row,Column或其他包含子级列表的widget
|
||||||
// shape:new Border.all(
|
// shape: Border.all(
|
||||||
// color: Colors.indigo, width: 1.0, style: BorderStyle.solid), // 卡片材质的形状,以及边框
|
// color: Colors.indigo, width: 1.0, style: BorderStyle.solid), // 卡片材质的形状,以及边框
|
||||||
shape:RoundedRectangleBorder(borderRadius: new BorderRadius.circular(20.0)), // 圆角
|
shape:RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0)), // 圆角
|
||||||
//borderRadius: BorderRadius.all(Radius.circular(8.0)),
|
//borderRadius: BorderRadius.all(Radius.circular(8.0)),
|
||||||
child: Column( //card里面的子控件
|
child: Column( //card里面的子控件
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
@ -52,7 +52,7 @@ class _DemoState extends State<Demo> {
|
|||||||
*/
|
*/
|
||||||
Widget allDomes(BuildContext context, _DemoState that) {
|
Widget allDomes(BuildContext context, _DemoState that) {
|
||||||
return Container(
|
return Container(
|
||||||
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||||
child: Column(
|
child: Column(
|
||||||
//mainAxisSize: MainAxisSize.max,
|
//mainAxisSize: MainAxisSize.max,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
@ -19,9 +19,9 @@ class _Demo extends State<AboutDialogDemo> {
|
|||||||
void showAlertDialog(BuildContext context) {
|
void showAlertDialog(BuildContext context) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (_) => new AboutDialog(
|
builder: (_) => AboutDialog(
|
||||||
applicationName: '名称',
|
applicationName: '名称',
|
||||||
applicationIcon: new Icon(Icons.ac_unit),
|
applicationIcon: Icon(Icons.ac_unit),
|
||||||
applicationVersion: 'V1.0',
|
applicationVersion: 'V1.0',
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text('我是一个关于的dialog')
|
Text('我是一个关于的dialog')
|
||||||
@ -29,12 +29,12 @@ class _Demo extends State<AboutDialogDemo> {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return new RaisedButton(
|
return RaisedButton(
|
||||||
padding: new EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0),
|
padding: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0),
|
||||||
//padding
|
//padding
|
||||||
child: new Text(
|
child: Text(
|
||||||
'show aboutDialog',
|
'show aboutDialog',
|
||||||
style: new TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 18.0, //textsize
|
fontSize: 18.0, //textsize
|
||||||
color: Colors.white, // textcolor
|
color: Colors.white, // textcolor
|
||||||
),
|
),
|
||||||
|
@ -119,12 +119,12 @@ class AlertDialogDemo extends StatelessWidget{
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return new RaisedButton(
|
return RaisedButton(
|
||||||
padding: new EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0),
|
padding: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0),
|
||||||
//padding
|
//padding
|
||||||
child: new Text(
|
child: Text(
|
||||||
'点我显示 AlertDialog',
|
'点我显示 AlertDialog',
|
||||||
style: new TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 18.0, //textsize
|
fontSize: 18.0, //textsize
|
||||||
color: Colors.white, // textcolor
|
color: Colors.white, // textcolor
|
||||||
),
|
),
|
||||||
|
@ -42,12 +42,12 @@ class _Demo extends State<DialogDemo> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return new RaisedButton(
|
return RaisedButton(
|
||||||
padding: new EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0),
|
padding: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0),
|
||||||
//padding
|
//padding
|
||||||
child: new Text(
|
child: Text(
|
||||||
'点我显示 Dialog',
|
'点我显示 Dialog',
|
||||||
style: new TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 18.0, //textsize
|
fontSize: 18.0, //textsize
|
||||||
color: Colors.white, // textcolor
|
color: Colors.white, // textcolor
|
||||||
),
|
),
|
||||||
@ -108,14 +108,14 @@ class _DialogMoreDemo extends State<DialogMoreDemo> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return new Column(
|
return Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
new RaisedButton(
|
RaisedButton(
|
||||||
padding: new EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0),
|
padding: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0),
|
||||||
//padding
|
//padding
|
||||||
child: new Text(
|
child: Text(
|
||||||
'点我显示Dialog',
|
'点我显示Dialog',
|
||||||
style: new TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 18.0, //textsize
|
fontSize: 18.0, //textsize
|
||||||
color: Colors.white, // textcolor
|
color: Colors.white, // textcolor
|
||||||
),
|
),
|
||||||
|
@ -20,17 +20,17 @@ class _Demo extends State<SimpleDialogDemo> {
|
|||||||
showDialog<Null>(
|
showDialog<Null>(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return new SimpleDialog(
|
return SimpleDialog(
|
||||||
title: new Text('选择'),
|
title: Text('选择'),
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
new SimpleDialogOption(
|
SimpleDialogOption(
|
||||||
child: new Text('选项 1'),
|
child: Text('选项 1'),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
new SimpleDialogOption(
|
SimpleDialogOption(
|
||||||
child: new Text('选项 2'),
|
child: Text('选项 2'),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
},
|
},
|
||||||
@ -41,12 +41,12 @@ class _Demo extends State<SimpleDialogDemo> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return new RaisedButton(
|
return RaisedButton(
|
||||||
padding: new EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0),
|
padding: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0),
|
||||||
//padding
|
//padding
|
||||||
child: new Text(
|
child: Text(
|
||||||
'show SimpleDialog',
|
'show SimpleDialog',
|
||||||
style: new TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 18.0, //textsize
|
fontSize: 18.0, //textsize
|
||||||
color: Colors.white, // textcolor
|
color: Colors.white, // textcolor
|
||||||
),
|
),
|
||||||
|
@ -21,7 +21,7 @@ class _Demo extends State<GridPaperDemo> {
|
|||||||
return Container(
|
return Container(
|
||||||
height: 400,
|
height: 400,
|
||||||
color: Color(0xffc91b3a),
|
color: Color(0xffc91b3a),
|
||||||
child: new GridView.count(
|
child: GridView.count(
|
||||||
crossAxisCount: 2,
|
crossAxisCount: 2,
|
||||||
mainAxisSpacing: 10.0,
|
mainAxisSpacing: 10.0,
|
||||||
crossAxisSpacing: 4.0,
|
crossAxisSpacing: 4.0,
|
||||||
@ -40,21 +40,21 @@ class _Demo extends State<GridPaperDemo> {
|
|||||||
),
|
),
|
||||||
GridPaper(
|
GridPaper(
|
||||||
color: Colors.red,
|
color: Colors.red,
|
||||||
child: new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
child: Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
),
|
),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -21,7 +21,7 @@ class _Demo extends State<GridTileDemo> {
|
|||||||
return Container(
|
return Container(
|
||||||
height: 400,
|
height: 400,
|
||||||
color: Color(0xffc91b3a),
|
color: Color(0xffc91b3a),
|
||||||
child: new GridView.count(
|
child: GridView.count(
|
||||||
crossAxisCount: 2,
|
crossAxisCount: 2,
|
||||||
mainAxisSpacing: 10.0,
|
mainAxisSpacing: 10.0,
|
||||||
crossAxisSpacing: 4.0,
|
crossAxisSpacing: 4.0,
|
||||||
@ -36,21 +36,21 @@ class _Demo extends State<GridTileDemo> {
|
|||||||
),
|
),
|
||||||
footer: Text("GridTile footer", style: TextStyle(color: Colors.white)),
|
footer: Text("GridTile footer", style: TextStyle(color: Colors.white)),
|
||||||
),
|
),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -21,7 +21,7 @@ class _Demo extends State<GridTileDemo> {
|
|||||||
return Container(
|
return Container(
|
||||||
height: 400,
|
height: 400,
|
||||||
color: Color(0xffc91b3a),
|
color: Color(0xffc91b3a),
|
||||||
child: new GridView.count(
|
child: GridView.count(
|
||||||
crossAxisCount: 2,
|
crossAxisCount: 2,
|
||||||
mainAxisSpacing: 10.0,
|
mainAxisSpacing: 10.0,
|
||||||
crossAxisSpacing: 4.0,
|
crossAxisSpacing: 4.0,
|
||||||
@ -38,21 +38,21 @@ class _Demo extends State<GridTileDemo> {
|
|||||||
child: Container(),
|
child: Container(),
|
||||||
|
|
||||||
),
|
),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -21,7 +21,7 @@ class _Demo extends State<GridTileDemo> {
|
|||||||
return Container(
|
return Container(
|
||||||
height: 400,
|
height: 400,
|
||||||
color: Color(0xffc91b3a),
|
color: Color(0xffc91b3a),
|
||||||
child: new GridView.count(
|
child: GridView.count(
|
||||||
crossAxisCount: 2,
|
crossAxisCount: 2,
|
||||||
mainAxisSpacing: 10.0,
|
mainAxisSpacing: 10.0,
|
||||||
crossAxisSpacing: 4.0,
|
crossAxisSpacing: 4.0,
|
||||||
@ -38,21 +38,21 @@ class _Demo extends State<GridTileDemo> {
|
|||||||
child: Container(),
|
child: Container(),
|
||||||
|
|
||||||
),
|
),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -17,34 +17,34 @@ class SliverGridDemo extends StatefulWidget {
|
|||||||
class _Demo extends State<SliverGridDemo> {
|
class _Demo extends State<SliverGridDemo> {
|
||||||
|
|
||||||
Widget showCustomScrollView() {
|
Widget showCustomScrollView() {
|
||||||
return new CustomScrollView(
|
return CustomScrollView(
|
||||||
slivers: <Widget>[
|
slivers: <Widget>[
|
||||||
new SliverGrid(
|
SliverGrid(
|
||||||
gridDelegate: new SliverGridDelegateWithMaxCrossAxisExtent(
|
gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
|
||||||
maxCrossAxisExtent: 200.0,
|
maxCrossAxisExtent: 200.0,
|
||||||
mainAxisSpacing: 10.0,
|
mainAxisSpacing: 10.0,
|
||||||
crossAxisSpacing: 10.0,
|
crossAxisSpacing: 10.0,
|
||||||
childAspectRatio: 4.0,
|
childAspectRatio: 4.0,
|
||||||
),
|
),
|
||||||
delegate: new SliverChildBuilderDelegate(
|
delegate: SliverChildBuilderDelegate(
|
||||||
(BuildContext context, int index) {
|
(BuildContext context, int index) {
|
||||||
return new Container(
|
return Container(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
color: Colors.cyan[100 * (index % 5)],
|
color: Colors.cyan[100 * (index % 5)],
|
||||||
child: new Text('grid item $index'),
|
child: Text('grid item $index'),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
childCount: 20,
|
childCount: 20,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
// new SliverFixedExtentList(
|
// SliverFixedExtentList(
|
||||||
// itemExtent: 100.0,
|
// itemExtent: 100.0,
|
||||||
// delegate: new SliverChildBuilderDelegate(
|
// delegate: SliverChildBuilderDelegate(
|
||||||
// (BuildContext context, int index) {
|
// (BuildContext context, int index) {
|
||||||
// return new Container(
|
// return Container(
|
||||||
// alignment: Alignment.center,
|
// alignment: Alignment.center,
|
||||||
// color: Colors.lightBlue[100 * (index % 9)],
|
// color: Colors.lightBlue[100 * (index % 9)],
|
||||||
// child: new Text('list item $index'),
|
// child: Text('list item $index'),
|
||||||
// );
|
// );
|
||||||
// },
|
// },
|
||||||
// ),
|
// ),
|
||||||
|
@ -15,7 +15,7 @@ class AnimatedListFullDefault extends StatefulWidget {
|
|||||||
* AnimatedList 默认的实例,有状态
|
* AnimatedList 默认的实例,有状态
|
||||||
* */
|
* */
|
||||||
class _AnimatedListFullDefault extends State<AnimatedListFullDefault> {
|
class _AnimatedListFullDefault extends State<AnimatedListFullDefault> {
|
||||||
final GlobalKey<AnimatedListState> _listKey = new GlobalKey<AnimatedListState>();
|
final GlobalKey<AnimatedListState> _listKey = GlobalKey<AnimatedListState>();
|
||||||
ListModel<int> _list;
|
ListModel<int> _list;
|
||||||
int _selectedItem;
|
int _selectedItem;
|
||||||
int _nextItem; // The next item inserted when the user presses the '+' button.
|
int _nextItem; // The next item inserted when the user presses the '+' button.
|
||||||
@ -26,7 +26,7 @@ class _AnimatedListFullDefault extends State<AnimatedListFullDefault> {
|
|||||||
if (widget.parent is State) {
|
if (widget.parent is State) {
|
||||||
widget.parent.animatedList = this; // 修改父级的对象引用
|
widget.parent.animatedList = this; // 修改父级的对象引用
|
||||||
}
|
}
|
||||||
_list = new ListModel<int>(
|
_list = ListModel<int>(
|
||||||
listKey: _listKey,
|
listKey: _listKey,
|
||||||
initialItems: <int>[0, 1, 2],
|
initialItems: <int>[0, 1, 2],
|
||||||
removedItemBuilder: _buildRemovedItem,
|
removedItemBuilder: _buildRemovedItem,
|
||||||
@ -50,7 +50,7 @@ class _AnimatedListFullDefault extends State<AnimatedListFullDefault> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildItem(BuildContext context, int index, Animation<double> animation) {
|
Widget _buildItem(BuildContext context, int index, Animation<double> animation) {
|
||||||
return new CardItem(
|
return CardItem(
|
||||||
animation: animation,
|
animation: animation,
|
||||||
item: _list[index],
|
item: _list[index],
|
||||||
selected: _selectedItem == _list[index],
|
selected: _selectedItem == _list[index],
|
||||||
@ -63,7 +63,7 @@ class _AnimatedListFullDefault extends State<AnimatedListFullDefault> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildRemovedItem(int item, BuildContext context, Animation<double> animation) {
|
Widget _buildRemovedItem(int item, BuildContext context, Animation<double> animation) {
|
||||||
return new CardItem(
|
return CardItem(
|
||||||
animation: animation,
|
animation: animation,
|
||||||
item: item,
|
item: item,
|
||||||
selected: false,
|
selected: false,
|
||||||
@ -107,20 +107,20 @@ class CardItem extends StatelessWidget {
|
|||||||
TextStyle textStyle = Theme.of(context).textTheme.display1;
|
TextStyle textStyle = Theme.of(context).textTheme.display1;
|
||||||
if (selected)
|
if (selected)
|
||||||
textStyle = textStyle.copyWith(color: Colors.lightGreenAccent[400]);
|
textStyle = textStyle.copyWith(color: Colors.lightGreenAccent[400]);
|
||||||
return new Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.all(2.0),
|
padding: const EdgeInsets.all(2.0),
|
||||||
child: new SizeTransition(
|
child: SizeTransition(
|
||||||
axis: Axis.vertical,
|
axis: Axis.vertical,
|
||||||
sizeFactor: animation,
|
sizeFactor: animation,
|
||||||
child: new GestureDetector(
|
child: GestureDetector(
|
||||||
behavior: HitTestBehavior.opaque,
|
behavior: HitTestBehavior.opaque,
|
||||||
onTap: onTap,
|
onTap: onTap,
|
||||||
child: new SizedBox(
|
child: SizedBox(
|
||||||
height: 128.0,
|
height: 128.0,
|
||||||
child: new Card(
|
child: Card(
|
||||||
color: Colors.primaries[item % Colors.primaries.length],
|
color: Colors.primaries[item % Colors.primaries.length],
|
||||||
child: new Center(
|
child: Center(
|
||||||
child: new Text('Item $item', style: textStyle),
|
child: Text('Item $item', style: textStyle),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -58,7 +58,7 @@ class _DemoState extends State<Demo> {
|
|||||||
*/
|
*/
|
||||||
Widget allDemoBoxs(BuildContext context, _DemoState that) {
|
Widget allDemoBoxs(BuildContext context, _DemoState that) {
|
||||||
return Container(
|
return Container(
|
||||||
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||||
child: Column(
|
child: Column(
|
||||||
//mainAxisSize: MainAxisSize.max,
|
//mainAxisSize: MainAxisSize.max,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
@ -25,7 +25,7 @@ class ListModel<E> {
|
|||||||
Iterable<E> initialItems,
|
Iterable<E> initialItems,
|
||||||
}) : assert(listKey != null),
|
}) : assert(listKey != null),
|
||||||
assert(removedItemBuilder != null),
|
assert(removedItemBuilder != null),
|
||||||
_items = new List<E>.from(initialItems ?? <E>[]);
|
_items = List<E>.from(initialItems ?? <E>[]);
|
||||||
|
|
||||||
final GlobalKey<AnimatedListState> listKey;
|
final GlobalKey<AnimatedListState> listKey;
|
||||||
final dynamic removedItemBuilder;
|
final dynamic removedItemBuilder;
|
||||||
|
@ -55,7 +55,7 @@ class _DemoState extends State<Demo> {
|
|||||||
*/
|
*/
|
||||||
Widget allCheckboxs(BuildContext context, _DemoState that) {
|
Widget allCheckboxs(BuildContext context, _DemoState that) {
|
||||||
return Container(
|
return Container(
|
||||||
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||||
child: Column(
|
child: Column(
|
||||||
//mainAxisSize: MainAxisSize.max,
|
//mainAxisSize: MainAxisSize.max,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
@ -81,7 +81,7 @@ class _DemoState extends State<Demo> {
|
|||||||
*/
|
*/
|
||||||
Widget allCheckboxs(BuildContext context, _DemoState that) {
|
Widget allCheckboxs(BuildContext context, _DemoState that) {
|
||||||
return Container(
|
return Container(
|
||||||
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||||
child: Column(
|
child: Column(
|
||||||
//mainAxisSize: MainAxisSize.max,
|
//mainAxisSize: MainAxisSize.max,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
@ -107,7 +107,7 @@ Widget allCheckboxs(BuildContext context, _DemoState that) {
|
|||||||
* 带align的text
|
* 带align的text
|
||||||
* */
|
* */
|
||||||
Widget textAlignBar(String txt) {
|
Widget textAlignBar(String txt) {
|
||||||
return new Align(
|
return Align(
|
||||||
alignment: FractionalOffset.centerLeft,
|
alignment: FractionalOffset.centerLeft,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
@ -36,8 +36,8 @@ class _CheckedPopupMenuItemDemoState extends State<CheckedPopupMenuItemDemo> {
|
|||||||
_checkedValues.add(value);
|
_checkedValues.add(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
Scaffold.of(context).showSnackBar(new SnackBar(
|
Scaffold.of(context).showSnackBar( SnackBar(
|
||||||
content: new Text('Checked $_checkedValues')));
|
content: Text('Checked $_checkedValues')));
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -19,8 +19,8 @@ class _PopupMenuButtonDemoState extends State<PopupMenuButtonDemo> {
|
|||||||
void showMenuSelection(String value) {
|
void showMenuSelection(String value) {
|
||||||
if (<String>[_simpleValue1, _simpleValue2, _simpleValue3].contains(value))
|
if (<String>[_simpleValue1, _simpleValue2, _simpleValue3].contains(value))
|
||||||
_simpleValue = value;
|
_simpleValue = value;
|
||||||
Scaffold.of(context).showSnackBar(new SnackBar(
|
Scaffold.of(context).showSnackBar( SnackBar(
|
||||||
content: new Text('You selected: $value')));
|
content: Text('You selected: $value')));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ class PopupMenuDividerDemo extends StatefulWidget {
|
|||||||
class _PopupMenuDividerDemoState extends State<PopupMenuDividerDemo> {
|
class _PopupMenuDividerDemoState extends State<PopupMenuDividerDemo> {
|
||||||
void showInSnackBar(String value) {
|
void showInSnackBar(String value) {
|
||||||
Scaffold.of(context)
|
Scaffold.of(context)
|
||||||
.showSnackBar(new SnackBar(content: new Text('You selected: $value')));
|
.showSnackBar( SnackBar(content: Text('You selected: $value')));
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -18,7 +18,7 @@ const String content0 = '''
|
|||||||
const String content1 = '''
|
const String content1 = '''
|
||||||
### **基本用法**
|
### **基本用法**
|
||||||
> 此widget通过调整Divider widget 来适应于弹出菜单中
|
> 此widget通过调整Divider widget 来适应于弹出菜单中
|
||||||
- 在 PopupMenuButton 中直接 new PopupMenuDivider() 即可
|
- 在 PopupMenuButton 中直接 PopupMenuDivider() 即可
|
||||||
''';
|
''';
|
||||||
|
|
||||||
class Demo extends StatefulWidget {
|
class Demo extends StatefulWidget {
|
||||||
|
@ -40,17 +40,17 @@ class _BottomNavigationBarFullDefault extends State {
|
|||||||
fixedColor: Colors.deepPurple, // 如果 type 类型为 fixed,则通过 fixedColor 设置选中 item 的颜色
|
fixedColor: Colors.deepPurple, // 如果 type 类型为 fixed,则通过 fixedColor 设置选中 item 的颜色
|
||||||
items: <BottomNavigationBarItem> [
|
items: <BottomNavigationBarItem> [
|
||||||
BottomNavigationBarItem(
|
BottomNavigationBarItem(
|
||||||
title: new Text("Home"), icon: new Icon(Icons.home)),
|
title: Text("Home"), icon: Icon(Icons.home)),
|
||||||
BottomNavigationBarItem(
|
BottomNavigationBarItem(
|
||||||
title: new Text("List"), icon: new Icon(Icons.list)),
|
title: Text("List"), icon: Icon(Icons.list)),
|
||||||
BottomNavigationBarItem(
|
BottomNavigationBarItem(
|
||||||
title: new Text("Message"), icon: new Icon(Icons.message)),
|
title: Text("Message"), icon: Icon(Icons.message)),
|
||||||
BottomNavigationBarItem(
|
BottomNavigationBarItem(
|
||||||
title: new Text("add"), icon: new Icon(Icons.add)),
|
title: Text("add"), icon: Icon(Icons.add)),
|
||||||
BottomNavigationBarItem(
|
BottomNavigationBarItem(
|
||||||
title: new Text("menu"), icon: new Icon(Icons.menu)),
|
title: Text("menu"), icon: Icon(Icons.menu)),
|
||||||
BottomNavigationBarItem(
|
BottomNavigationBarItem(
|
||||||
title: new Text("other"), icon: new Icon(Icons.devices_other)),
|
title: Text("other"), icon: Icon(Icons.devices_other)),
|
||||||
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
@ -57,7 +57,7 @@ class _DemoState extends State<Demo> {
|
|||||||
*/
|
*/
|
||||||
Widget allDemoBoxs(BuildContext context, _DemoState that) {
|
Widget allDemoBoxs(BuildContext context, _DemoState that) {
|
||||||
return Container(
|
return Container(
|
||||||
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||||
child: Column(
|
child: Column(
|
||||||
//mainAxisSize: MainAxisSize.max,
|
//mainAxisSize: MainAxisSize.max,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
@ -79,7 +79,7 @@ Widget allDemoBoxs(BuildContext context, _DemoState that) {
|
|||||||
* 带align的text
|
* 带align的text
|
||||||
* */
|
* */
|
||||||
Widget textAlignBar(String txt) {
|
Widget textAlignBar(String txt) {
|
||||||
return new Align(
|
return Align(
|
||||||
alignment: FractionalOffset.centerLeft,
|
alignment: FractionalOffset.centerLeft,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
@ -21,20 +21,20 @@ class BottomNavigationBarItemLessDefault extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return new SizedBox(
|
return SizedBox(
|
||||||
height: 100,
|
height: 100,
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
bottomNavigationBar: new BottomNavigationBar(items: [
|
bottomNavigationBar: BottomNavigationBar(items: [
|
||||||
new BottomNavigationBarItem(
|
BottomNavigationBarItem(
|
||||||
icon: new Icon(Icons.laptop_chromebook),
|
icon: Icon(Icons.laptop_chromebook),
|
||||||
title: new Text("主页"),
|
title: Text("主页"),
|
||||||
backgroundColor: Colors.red
|
backgroundColor: Colors.red
|
||||||
),
|
),
|
||||||
new BottomNavigationBarItem(
|
BottomNavigationBarItem(
|
||||||
icon: new Icon(Icons.list), title: new Text("分类"),backgroundColor: Colors.grey),
|
icon: Icon(Icons.list), title: Text("分类"),backgroundColor: Colors.grey),
|
||||||
new BottomNavigationBarItem(
|
BottomNavigationBarItem(
|
||||||
icon: new Icon(Icons.local_grocery_store), title: new Text("购物车")),
|
icon: Icon(Icons.local_grocery_store), title: Text("购物车")),
|
||||||
new BottomNavigationBarItem(icon: new Icon(Icons.person), title: new Text("我的"))
|
BottomNavigationBarItem(icon: Icon(Icons.person), title: Text("我的"))
|
||||||
],
|
],
|
||||||
//onTap: onTap,
|
//onTap: onTap,
|
||||||
//currentIndex: page
|
//currentIndex: page
|
||||||
@ -46,13 +46,13 @@ class BottomNavigationBarItemLessDefault extends StatelessWidget {
|
|||||||
|
|
||||||
//backgroundColor: Colors.grey,
|
//backgroundColor: Colors.grey,
|
||||||
//
|
//
|
||||||
//// body: new PageView(
|
//// body: PageView(
|
||||||
////
|
////
|
||||||
//// children: [
|
//// children: [
|
||||||
//// new Index(),
|
//// Index(),
|
||||||
//// new Classify(),
|
//// Classify(),
|
||||||
//// new Shopping(),
|
//// Shopping(),
|
||||||
//// new Myself()
|
//// Myself()
|
||||||
//// ],
|
//// ],
|
||||||
////
|
////
|
||||||
//// controller: pageController,
|
//// controller: pageController,
|
||||||
|
@ -52,7 +52,7 @@ class _DemoState extends State<Demo> {
|
|||||||
*/
|
*/
|
||||||
Widget allCheckboxs(BuildContext context, _DemoState that) {
|
Widget allCheckboxs(BuildContext context, _DemoState that) {
|
||||||
return Container(
|
return Container(
|
||||||
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||||
child: Column(
|
child: Column(
|
||||||
//mainAxisSize: MainAxisSize.max,
|
//mainAxisSize: MainAxisSize.max,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
@ -70,7 +70,7 @@ Widget allCheckboxs(BuildContext context, _DemoState that) {
|
|||||||
* 带align的text
|
* 带align的text
|
||||||
* */
|
* */
|
||||||
Widget textAlignBar(String txt) {
|
Widget textAlignBar(String txt) {
|
||||||
return new Align(
|
return Align(
|
||||||
alignment: FractionalOffset.centerLeft,
|
alignment: FractionalOffset.centerLeft,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
@ -14,8 +14,8 @@ class DayPickerDemo extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _DayPickerState extends State<DayPickerDemo> {
|
class _DayPickerState extends State<DayPickerDemo> {
|
||||||
DateTime _date = new DateTime.now();
|
DateTime _date = DateTime.now();
|
||||||
TimeOfDay _time = new TimeOfDay.now();
|
TimeOfDay _time = TimeOfDay.now();
|
||||||
|
|
||||||
Future<void> _selectDate(BuildContext context) async {
|
Future<void> _selectDate(BuildContext context) async {
|
||||||
final DateTime picked = await showDatePicker(
|
final DateTime picked = await showDatePicker(
|
||||||
@ -29,7 +29,7 @@ class _DayPickerState extends State<DayPickerDemo> {
|
|||||||
_date = picked;
|
_date = picked;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (picked == null) _date = new DateTime.now();
|
if (picked == null) _date = DateTime.now();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _selectTime(BuildContext context) async {
|
Future<void> _selectTime(BuildContext context) async {
|
||||||
@ -40,23 +40,23 @@ class _DayPickerState extends State<DayPickerDemo> {
|
|||||||
setState(() {
|
setState(() {
|
||||||
_time = picked;
|
_time = picked;
|
||||||
});
|
});
|
||||||
if (picked == null) _time = new TimeOfDay.now();
|
if (picked == null) _time = TimeOfDay.now();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return new Column(
|
return Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
new Text('日期选择'),
|
Text('日期选择'),
|
||||||
new RaisedButton(
|
RaisedButton(
|
||||||
child: new Text('date selected:${_date.toString()}'),
|
child: Text('date selected:${_date.toString()}'),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
_selectDate(context);
|
_selectDate(context);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
new Text('时间选择'),
|
Text('时间选择'),
|
||||||
new RaisedButton(
|
RaisedButton(
|
||||||
child: new Text('date selected:${_time.toString()}'),
|
child: Text('date selected:${_time.toString()}'),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
_selectTime(context);
|
_selectTime(context);
|
||||||
},
|
},
|
||||||
|
@ -14,7 +14,7 @@ class MothPickerDemo extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _MothPickerState extends State<MothPickerDemo> {
|
class _MothPickerState extends State<MothPickerDemo> {
|
||||||
DateTime _date = new DateTime.now();
|
DateTime _date = DateTime.now();
|
||||||
|
|
||||||
Future<void> _selectDate(BuildContext context) async {
|
Future<void> _selectDate(BuildContext context) async {
|
||||||
final DateTime picked = await showDatePicker(
|
final DateTime picked = await showDatePicker(
|
||||||
@ -28,16 +28,16 @@ class _MothPickerState extends State<MothPickerDemo> {
|
|||||||
_date = picked;
|
_date = picked;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (picked == null) _date = new DateTime.now();
|
if (picked == null) _date = DateTime.now();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return new Column(
|
return Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
new Text('日期选择'),
|
Text('日期选择'),
|
||||||
new RaisedButton(
|
RaisedButton(
|
||||||
child: new Text('date selected:${_date.toString()}'),
|
child: Text('date selected:${_date.toString()}'),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
_selectDate(context);
|
_selectDate(context);
|
||||||
},
|
},
|
||||||
|
@ -14,8 +14,8 @@ class ShowDatePickerDemo extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _ShowDatePickerState extends State<ShowDatePickerDemo> {
|
class _ShowDatePickerState extends State<ShowDatePickerDemo> {
|
||||||
DateTime _date = new DateTime.now();
|
DateTime _date = DateTime.now();
|
||||||
TimeOfDay _time = new TimeOfDay.now();
|
TimeOfDay _time = TimeOfDay.now();
|
||||||
|
|
||||||
Future<void> _selectDate(BuildContext context) async {
|
Future<void> _selectDate(BuildContext context) async {
|
||||||
final DateTime picked = await showDatePicker(
|
final DateTime picked = await showDatePicker(
|
||||||
@ -29,7 +29,7 @@ class _ShowDatePickerState extends State<ShowDatePickerDemo> {
|
|||||||
_date = picked;
|
_date = picked;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (picked == null) _date = new DateTime.now();
|
if (picked == null) _date = DateTime.now();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _selectTime(BuildContext context) async {
|
Future<void> _selectTime(BuildContext context) async {
|
||||||
@ -40,23 +40,23 @@ class _ShowDatePickerState extends State<ShowDatePickerDemo> {
|
|||||||
setState(() {
|
setState(() {
|
||||||
_time = picked;
|
_time = picked;
|
||||||
});
|
});
|
||||||
if (picked == null) _time = new TimeOfDay.now();
|
if (picked == null) _time = TimeOfDay.now();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return new Column(
|
return Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
new Text('日期选择'),
|
Text('日期选择'),
|
||||||
new RaisedButton(
|
RaisedButton(
|
||||||
child: new Text('date selected:${_date.toString()}'),
|
child: Text('date selected:${_date.toString()}'),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
_selectDate(context);
|
_selectDate(context);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
new Text('时间选择'),
|
Text('时间选择'),
|
||||||
new RaisedButton(
|
RaisedButton(
|
||||||
child: new Text('date selected:${_time.toString()}'),
|
child: Text('date selected:${_time.toString()}'),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
_selectTime(context);
|
_selectTime(context);
|
||||||
},
|
},
|
||||||
|
@ -14,7 +14,7 @@ class YearPickerDemo extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _YearPickerDemoState extends State<YearPickerDemo> {
|
class _YearPickerDemoState extends State<YearPickerDemo> {
|
||||||
DateTime _date = new DateTime.now();
|
DateTime _date = DateTime.now();
|
||||||
|
|
||||||
Future<void> _selectDate(BuildContext context) async {
|
Future<void> _selectDate(BuildContext context) async {
|
||||||
final DateTime picked = await showDatePicker(
|
final DateTime picked = await showDatePicker(
|
||||||
@ -28,16 +28,16 @@ class _YearPickerDemoState extends State<YearPickerDemo> {
|
|||||||
_date = picked;
|
_date = picked;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (picked == null) _date = new DateTime.now();
|
if (picked == null) _date = DateTime.now();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return new Column(
|
return Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
new Text('日期选择'),
|
Text('日期选择'),
|
||||||
new RaisedButton(
|
RaisedButton(
|
||||||
child: new Text('date selected:${_date.toString()}'),
|
child: Text('date selected:${_date.toString()}'),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
_selectDate(context);
|
_selectDate(context);
|
||||||
},
|
},
|
||||||
|
@ -37,9 +37,9 @@ class _ScaffoldDemo extends State with SingleTickerProviderStateMixin {
|
|||||||
// 如果省略了 leading ,但 AppBar 在带有 Drawer 的 Scaffold 中,则会插入一个 button 以打开 Drawer。
|
// 如果省略了 leading ,但 AppBar 在带有 Drawer 的 Scaffold 中,则会插入一个 button 以打开 Drawer。
|
||||||
// 否则,如果最近的 Navigator 具有任何先前的 router ,则会插入BackButton。
|
// 否则,如果最近的 Navigator 具有任何先前的 router ,则会插入BackButton。
|
||||||
// 这种行为可以通过设置来关闭automaticallyImplyLeading 为false。在这种情况下,空的 leading widget 将导致 middle/title widget 拉伸开始。
|
// 这种行为可以通过设置来关闭automaticallyImplyLeading 为false。在这种情况下,空的 leading widget 将导致 middle/title widget 拉伸开始。
|
||||||
return new SizedBox(
|
return SizedBox(
|
||||||
height: 500,
|
height: 500,
|
||||||
child: new Scaffold(
|
child: Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text('Sample Code'),
|
title: Text('Sample Code'),
|
||||||
),
|
),
|
||||||
|
@ -56,7 +56,7 @@ class _DemoState extends State<Demo> {
|
|||||||
codeUrl: 'components/Scaffold/Scaffold/demo.dart',
|
codeUrl: 'components/Scaffold/Scaffold/demo.dart',
|
||||||
contentList: [
|
contentList: [
|
||||||
_Text0,
|
_Text0,
|
||||||
new ScaffoldDemo(),
|
ScaffoldDemo(),
|
||||||
],
|
],
|
||||||
docUrl: 'https://docs.flutter.io/flutter/material/Scaffold-class.html',
|
docUrl: 'https://docs.flutter.io/flutter/material/Scaffold-class.html',
|
||||||
);
|
);
|
||||||
|
@ -28,9 +28,9 @@ class _ScaffoldStateDemo extends State with SingleTickerProviderStateMixin {
|
|||||||
// 如果省略了 leading ,但 AppBar 在带有 Drawer 的 Scaffold 中,则会插入一个 button 以打开 Drawer。
|
// 如果省略了 leading ,但 AppBar 在带有 Drawer 的 Scaffold 中,则会插入一个 button 以打开 Drawer。
|
||||||
// 否则,如果最近的 Navigator 具有任何先前的 router ,则会插入BackButton。
|
// 否则,如果最近的 Navigator 具有任何先前的 router ,则会插入BackButton。
|
||||||
// 这种行为可以通过设置来关闭automaticallyImplyLeading 为false。在这种情况下,空的 leading widget 将导致 middle/title widget 拉伸开始。
|
// 这种行为可以通过设置来关闭automaticallyImplyLeading 为false。在这种情况下,空的 leading widget 将导致 middle/title widget 拉伸开始。
|
||||||
return new SizedBox(
|
return SizedBox(
|
||||||
height: 500,
|
height: 500,
|
||||||
child:new Scaffold(
|
child: Scaffold(
|
||||||
key:_scaffoldKey,
|
key:_scaffoldKey,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text('ScaffoldState Demo'),
|
title: Text('ScaffoldState Demo'),
|
||||||
|
@ -11,7 +11,7 @@ class ScrollPhysicsDemo extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _ScrollPhysicsDemoState extends State<ScrollPhysicsDemo> {
|
class _ScrollPhysicsDemoState extends State<ScrollPhysicsDemo> {
|
||||||
final PageController _pageController = new PageController();
|
final PageController _pageController = PageController();
|
||||||
double _currentPage = 0.0;
|
double _currentPage = 0.0;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -54,21 +54,21 @@ class _SimplePage extends StatelessWidget {
|
|||||||
final double parallaxOffset;
|
final double parallaxOffset;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) => new Center(
|
Widget build(BuildContext context) => Center(
|
||||||
child: Container(
|
child: Container(
|
||||||
color: Theme.of(context).primaryColor,
|
color: Theme.of(context).primaryColor,
|
||||||
child: new Center(
|
child: Center(
|
||||||
child: new Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
new Text(
|
Text(
|
||||||
data,
|
data,
|
||||||
style: const TextStyle(fontSize: 60.0,color: Colors.white),
|
style: const TextStyle(fontSize: 60.0,color: Colors.white),
|
||||||
),
|
),
|
||||||
new SizedBox(height: 40.0),
|
SizedBox(height: 40.0),
|
||||||
new Transform(
|
Transform(
|
||||||
transform:
|
transform:
|
||||||
new Matrix4.translationValues(parallaxOffset, 0.0, 0.0),
|
Matrix4.translationValues(parallaxOffset, 0.0, 0.0),
|
||||||
child: const Text('左右滑动,这是第二行滚动速度更快的小字',style: const TextStyle(fontSize: 16.0,color: Colors.white),),
|
child: const Text('左右滑动,这是第二行滚动速度更快的小字',style: const TextStyle(fontSize: 16.0,color: Colors.white),),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -17,15 +17,15 @@ var selectItemValue;
|
|||||||
|
|
||||||
class DropdownButtonDefault extends StatelessWidget {
|
class DropdownButtonDefault extends StatelessWidget {
|
||||||
List<DropdownMenuItem> generateItemList() {
|
List<DropdownMenuItem> generateItemList() {
|
||||||
final List<DropdownMenuItem> items = new List();
|
final List<DropdownMenuItem> items = List();
|
||||||
final DropdownMenuItem item1 = new DropdownMenuItem(
|
final DropdownMenuItem item1 = DropdownMenuItem(
|
||||||
value: '张三', child: new Text('张三'));
|
value: '张三', child: Text('张三'));
|
||||||
final DropdownMenuItem item2 = new DropdownMenuItem(
|
final DropdownMenuItem item2 = DropdownMenuItem(
|
||||||
value: '李四', child: new Text('李四'));
|
value: '李四', child: Text('李四'));
|
||||||
final DropdownMenuItem item3 = new DropdownMenuItem(
|
final DropdownMenuItem item3 = DropdownMenuItem(
|
||||||
value: '王二', child: new Text('王二'));
|
value: '王二', child: Text('王二'));
|
||||||
final DropdownMenuItem item4 = new DropdownMenuItem(
|
final DropdownMenuItem item4 = DropdownMenuItem(
|
||||||
value: '麻子', child: new Text('麻子'));
|
value: '麻子', child: Text('麻子'));
|
||||||
items.add(item1);
|
items.add(item1);
|
||||||
items.add(item2);
|
items.add(item2);
|
||||||
items.add(item3);
|
items.add(item3);
|
||||||
@ -36,7 +36,7 @@ class DropdownButtonDefault extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return DropdownButton(
|
return DropdownButton(
|
||||||
hint: new Text('下拉菜单选择一个人名'),
|
hint: Text('下拉菜单选择一个人名'),
|
||||||
//设置这个value之后,选中对应位置的item,
|
//设置这个value之后,选中对应位置的item,
|
||||||
//再次呼出下拉菜单,会自动定位item位置在当前按钮显示的位置处
|
//再次呼出下拉菜单,会自动定位item位置在当前按钮显示的位置处
|
||||||
value: selectItValue,
|
value: selectItValue,
|
||||||
@ -51,54 +51,54 @@ class DropdownButtonDefault extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<DropdownMenuItem> getListData(){
|
List<DropdownMenuItem> getListData(){
|
||||||
List<DropdownMenuItem> items=new List();
|
List<DropdownMenuItem> items= List();
|
||||||
DropdownMenuItem dropdownMenuItem1=new DropdownMenuItem(
|
DropdownMenuItem dropdownMenuItem1= DropdownMenuItem(
|
||||||
child:new Text('1'),
|
child: Text('1'),
|
||||||
value: '1',
|
value: '1',
|
||||||
);
|
);
|
||||||
items.add(dropdownMenuItem1);
|
items.add(dropdownMenuItem1);
|
||||||
DropdownMenuItem dropdownMenuItem2=new DropdownMenuItem(
|
DropdownMenuItem dropdownMenuItem2= DropdownMenuItem(
|
||||||
child:new Text('2'),
|
child: Text('2'),
|
||||||
value: '2',
|
value: '2',
|
||||||
);
|
);
|
||||||
items.add(dropdownMenuItem2);
|
items.add(dropdownMenuItem2);
|
||||||
DropdownMenuItem dropdownMenuItem3=new DropdownMenuItem(
|
DropdownMenuItem dropdownMenuItem3= DropdownMenuItem(
|
||||||
child:new Text('3'),
|
child: Text('3'),
|
||||||
value: '3',
|
value: '3',
|
||||||
);
|
);
|
||||||
items.add(dropdownMenuItem3);
|
items.add(dropdownMenuItem3);
|
||||||
DropdownMenuItem dropdownMenuItem4=new DropdownMenuItem(
|
DropdownMenuItem dropdownMenuItem4= DropdownMenuItem(
|
||||||
child:new Text('4'),
|
child: Text('4'),
|
||||||
value: '4',
|
value: '4',
|
||||||
);
|
);
|
||||||
items.add(dropdownMenuItem4);
|
items.add(dropdownMenuItem4);
|
||||||
DropdownMenuItem dropdownMenuItem5=new DropdownMenuItem(
|
DropdownMenuItem dropdownMenuItem5= DropdownMenuItem(
|
||||||
child:new Text('5'),
|
child: Text('5'),
|
||||||
value: '5',
|
value: '5',
|
||||||
);
|
);
|
||||||
items.add(dropdownMenuItem5);
|
items.add(dropdownMenuItem5);
|
||||||
DropdownMenuItem dropdownMenuItem6=new DropdownMenuItem(
|
DropdownMenuItem dropdownMenuItem6= DropdownMenuItem(
|
||||||
child:new Text('6'),
|
child: Text('6'),
|
||||||
value: '6',
|
value: '6',
|
||||||
);
|
);
|
||||||
items.add(dropdownMenuItem6);
|
items.add(dropdownMenuItem6);
|
||||||
DropdownMenuItem dropdownMenuItem7=new DropdownMenuItem(
|
DropdownMenuItem dropdownMenuItem7= DropdownMenuItem(
|
||||||
child:new Text('7'),
|
child: Text('7'),
|
||||||
value: '7',
|
value: '7',
|
||||||
);
|
);
|
||||||
items.add(dropdownMenuItem7);
|
items.add(dropdownMenuItem7);
|
||||||
DropdownMenuItem dropdownMenuItem8=new DropdownMenuItem(
|
DropdownMenuItem dropdownMenuItem8= DropdownMenuItem(
|
||||||
child:new Text('8'),
|
child: Text('8'),
|
||||||
value: '8',
|
value: '8',
|
||||||
);
|
);
|
||||||
items.add(dropdownMenuItem8);
|
items.add(dropdownMenuItem8);
|
||||||
DropdownMenuItem dropdownMenuItem9=new DropdownMenuItem(
|
DropdownMenuItem dropdownMenuItem9= DropdownMenuItem(
|
||||||
child:new Text('9'),
|
child: Text('9'),
|
||||||
value: '9',
|
value: '9',
|
||||||
);
|
);
|
||||||
items.add(dropdownMenuItem9);
|
items.add(dropdownMenuItem9);
|
||||||
DropdownMenuItem dropdownMenuItem10=new DropdownMenuItem(
|
DropdownMenuItem dropdownMenuItem10= DropdownMenuItem(
|
||||||
child:new Text('10'),
|
child: Text('10'),
|
||||||
value: '10',
|
value: '10',
|
||||||
);
|
);
|
||||||
items.add(dropdownMenuItem10);
|
items.add(dropdownMenuItem10);
|
||||||
|
@ -62,7 +62,7 @@ class _DemoState extends State<Demo> {
|
|||||||
*/
|
*/
|
||||||
Widget allDropdownButtons(BuildContext context,_DemoState that){
|
Widget allDropdownButtons(BuildContext context,_DemoState that){
|
||||||
return Container(
|
return Container(
|
||||||
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||||
child: Column(
|
child: Column(
|
||||||
//mainAxisSize: MainAxisSize.max,
|
//mainAxisSize: MainAxisSize.max,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
@ -87,14 +87,14 @@ Widget allDropdownButtons(BuildContext context,_DemoState that){
|
|||||||
* 带align的text
|
* 带align的text
|
||||||
* */
|
* */
|
||||||
Widget textAlignBar(String txt){
|
Widget textAlignBar(String txt){
|
||||||
//style: new TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
|
//style: TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
|
||||||
return new Align(
|
return Align(
|
||||||
alignment: FractionalOffset.centerLeft,
|
alignment: FractionalOffset.centerLeft,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
SizedBox(height: 20.0),
|
SizedBox(height: 20.0),
|
||||||
MarkdownBody(data: txt)
|
MarkdownBody(data: txt)
|
||||||
//new Text(txt, style: new TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
|
// Text(txt, style: TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -101,9 +101,9 @@ class FlatButtonCustom extends StatelessWidget {
|
|||||||
splashColor: Colors.deepPurple,
|
splashColor: Colors.deepPurple,
|
||||||
// 抗锯齿能力,抗锯齿等级依次递增,none(默认),hardEdge,antiAliasWithSaveLayer,antiAlias
|
// 抗锯齿能力,抗锯齿等级依次递增,none(默认),hardEdge,antiAliasWithSaveLayer,antiAlias
|
||||||
clipBehavior: Clip.antiAlias,
|
clipBehavior: Clip.antiAlias,
|
||||||
padding: new EdgeInsets.only(
|
padding: EdgeInsets.only(
|
||||||
bottom: 5.0, top: 5.0, left: 30.0, right: 30.0),
|
bottom: 5.0, top: 5.0, left: 30.0, right: 30.0),
|
||||||
shape: (shape is ShapeBorder) ? shape : new Border.all(
|
shape: (shape is ShapeBorder) ? shape : Border.all(
|
||||||
// 设置边框样式
|
// 设置边框样式
|
||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
width: 2.0,
|
width: 2.0,
|
||||||
|
@ -64,7 +64,7 @@ class _DemoState extends State<Demo> {
|
|||||||
*/
|
*/
|
||||||
Widget allFlatButtons(BuildContext context){
|
Widget allFlatButtons(BuildContext context){
|
||||||
return Container(
|
return Container(
|
||||||
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||||
child: Column(
|
child: Column(
|
||||||
//mainAxisSize: MainAxisSize.max,
|
//mainAxisSize: MainAxisSize.max,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
@ -109,7 +109,7 @@ Widget allFlatButtons(BuildContext context){
|
|||||||
flatButton.FlatButtonCustom('危险按钮',Colors.pink),
|
flatButton.FlatButtonCustom('危险按钮',Colors.pink),
|
||||||
SizedBox(height: 10.0),
|
SizedBox(height: 10.0),
|
||||||
flatButton.FlatButtonCustom('点击我试试!', Colors.red,
|
flatButton.FlatButtonCustom('点击我试试!', Colors.red,
|
||||||
new Border.all(color: Colors.brown, width: 5.0, style: BorderStyle.solid),
|
Border.all(color: Colors.brown, width: 5.0, style: BorderStyle.solid),
|
||||||
() => _showMessage('点击了 FLAT BUTTON ', context)),
|
() => _showMessage('点击了 FLAT BUTTON ', context)),
|
||||||
SizedBox(height: 20.0)
|
SizedBox(height: 20.0)
|
||||||
])
|
])
|
||||||
@ -126,16 +126,16 @@ void _showMessage(String name, BuildContext context) {
|
|||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: new Text('提示'),
|
title: Text('提示'),
|
||||||
content: new Text(name),
|
content: Text(name),
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
new FlatButton(
|
FlatButton(
|
||||||
// alert 的取消按钮
|
// alert 的取消按钮
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
// 取消的事件
|
// 取消的事件
|
||||||
Navigator.of(context).pop(true);
|
Navigator.of(context).pop(true);
|
||||||
},
|
},
|
||||||
child: new Text('取消'))
|
child: Text('取消'))
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -145,14 +145,14 @@ void _showMessage(String name, BuildContext context) {
|
|||||||
* 带align的text
|
* 带align的text
|
||||||
* */
|
* */
|
||||||
Widget textAlignBar(String txt){
|
Widget textAlignBar(String txt){
|
||||||
//style: new TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
|
//style: TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
|
||||||
return new Align(
|
return Align(
|
||||||
alignment: FractionalOffset.centerLeft,
|
alignment: FractionalOffset.centerLeft,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
SizedBox(height: 20.0),
|
SizedBox(height: 20.0),
|
||||||
MarkdownBody(data: txt)
|
MarkdownBody(data: txt)
|
||||||
//new Text(txt, style: new TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
|
// Text(txt, style: TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ class FloatingActionButtonCustom extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final _onPressed = onPressed;
|
final _onPressed = onPressed;
|
||||||
return new FloatingActionButton(
|
return FloatingActionButton(
|
||||||
// 子视图,一般为Icon,不推荐使用文字
|
// 子视图,一般为Icon,不推荐使用文字
|
||||||
child: const Icon(Icons.refresh),
|
child: const Icon(Icons.refresh),
|
||||||
// FAB的文字解释,FAB被长按时显示,也是无障碍功能
|
// FAB的文字解释,FAB被长按时显示,也是无障碍功能
|
||||||
@ -109,8 +109,8 @@ class FloatingActionButtonCustom2 extends StatelessWidget {
|
|||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
backgroundColor: Colors.amber,
|
backgroundColor: Colors.amber,
|
||||||
//如果不手动设置icon和text颜色,则默认使用foregroundColor颜色
|
//如果不手动设置icon和text颜色,则默认使用foregroundColor颜色
|
||||||
icon: new Icon(Icons.flag,color: Colors.red),
|
icon: Icon(Icons.flag,color: Colors.red),
|
||||||
label: new Text('FloatingActionButton.extended', maxLines: 1),
|
label: Text('FloatingActionButton.extended', maxLines: 1),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ class _DemoState extends State<Demo> {
|
|||||||
Widget allFloatingActionButtons(BuildContext context,_DemoState that){
|
Widget allFloatingActionButtons(BuildContext context,_DemoState that){
|
||||||
final ShapeBorder buttonShape = drawShape(that.buttonShapeType);
|
final ShapeBorder buttonShape = drawShape(that.buttonShapeType);
|
||||||
return Container(
|
return Container(
|
||||||
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||||
child: Column(
|
child: Column(
|
||||||
//mainAxisSize: MainAxisSize.max,
|
//mainAxisSize: MainAxisSize.max,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
@ -109,16 +109,16 @@ Widget allFloatingActionButtons(BuildContext context,_DemoState that){
|
|||||||
// context: context,
|
// context: context,
|
||||||
// builder: (BuildContext context) {
|
// builder: (BuildContext context) {
|
||||||
// return AlertDialog(
|
// return AlertDialog(
|
||||||
// title: new Text('提示'),
|
// title: Text('提示'),
|
||||||
// content: new Text(name),
|
// content: Text(name),
|
||||||
// actions: <Widget>[
|
// actions: <Widget>[
|
||||||
// new FlatButton(
|
// FlatButton(
|
||||||
// // alert 的取消按钮
|
// // alert 的取消按钮
|
||||||
// onPressed: () {
|
// onPressed: () {
|
||||||
// // 取消的事件
|
// // 取消的事件
|
||||||
// Navigator.of(context).pop(true);
|
// Navigator.of(context).pop(true);
|
||||||
// },
|
// },
|
||||||
// child: new Text('取消'))
|
// child: Text('取消'))
|
||||||
// ]);
|
// ]);
|
||||||
// }
|
// }
|
||||||
// );
|
// );
|
||||||
@ -128,14 +128,14 @@ Widget allFloatingActionButtons(BuildContext context,_DemoState that){
|
|||||||
* 带align的text
|
* 带align的text
|
||||||
* */
|
* */
|
||||||
Widget textAlignBar(String txt){
|
Widget textAlignBar(String txt){
|
||||||
//style: new TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
|
//style: TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
|
||||||
return new Align(
|
return Align(
|
||||||
alignment: FractionalOffset.centerLeft,
|
alignment: FractionalOffset.centerLeft,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
SizedBox(height: 20.0),
|
SizedBox(height: 20.0),
|
||||||
MarkdownBody(data: txt)
|
MarkdownBody(data: txt)
|
||||||
//new Text(txt, style: new TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
|
// Text(txt, style: TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -159,7 +159,7 @@ ShapeBorder drawShape(String type){
|
|||||||
break;
|
break;
|
||||||
case 'radius':
|
case 'radius':
|
||||||
return RoundedRectangleBorder(
|
return RoundedRectangleBorder(
|
||||||
side:new BorderSide( // 保留原来的边框样式
|
side: BorderSide( // 保留原来的边框样式
|
||||||
width: borderWidth,
|
width: borderWidth,
|
||||||
color: _color,
|
color: _color,
|
||||||
style: BorderStyle.solid,
|
style: BorderStyle.solid,
|
||||||
|
@ -75,7 +75,7 @@ class IconButtonCustom extends StatelessWidget {
|
|||||||
iconSize:(Random.secure().nextInt(20)+20).toDouble(), // 随机大小
|
iconSize:(Random.secure().nextInt(20)+20).toDouble(), // 随机大小
|
||||||
// 按钮内部,墨汁飞溅的颜色,点击按钮时的渐变背景色,当你不设置高亮背景时才会看的更清楚
|
// 按钮内部,墨汁飞溅的颜色,点击按钮时的渐变背景色,当你不设置高亮背景时才会看的更清楚
|
||||||
splashColor: _randomColor(),
|
splashColor: _randomColor(),
|
||||||
padding: new EdgeInsets.only(bottom: 5.0, top: 5.0, left: 30.0, right: 30.0),
|
padding: EdgeInsets.only(bottom: 5.0, top: 5.0, left: 30.0, right: 30.0),
|
||||||
// 描述按下按钮时将发生的操作的文本
|
// 描述按下按钮时将发生的操作的文本
|
||||||
tooltip:'这是${ type.codePoint }信息',
|
tooltip:'这是${ type.codePoint }信息',
|
||||||
// IconButton 的点击事件
|
// IconButton 的点击事件
|
||||||
|
@ -66,7 +66,7 @@ class _DemoState extends State<Demo> {
|
|||||||
Widget allIconButtons(BuildContext context,_DemoState that){
|
Widget allIconButtons(BuildContext context,_DemoState that){
|
||||||
final ShapeBorder buttonShape = drawShape(that.buttonShapeType);
|
final ShapeBorder buttonShape = drawShape(that.buttonShapeType);
|
||||||
return Container(
|
return Container(
|
||||||
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||||
child: Column(
|
child: Column(
|
||||||
//mainAxisSize: MainAxisSize.max,
|
//mainAxisSize: MainAxisSize.max,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
@ -106,14 +106,14 @@ Widget allIconButtons(BuildContext context,_DemoState that){
|
|||||||
* 带align的text
|
* 带align的text
|
||||||
* */
|
* */
|
||||||
Widget textAlignBar(String txt){
|
Widget textAlignBar(String txt){
|
||||||
//style: new TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
|
//style: TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
|
||||||
return new Align(
|
return Align(
|
||||||
alignment: FractionalOffset.centerLeft,
|
alignment: FractionalOffset.centerLeft,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
SizedBox(height: 20.0),
|
SizedBox(height: 20.0),
|
||||||
MarkdownBody(data: txt)
|
MarkdownBody(data: txt)
|
||||||
//new Text(txt, style: new TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
|
// Text(txt, style: TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -137,7 +137,7 @@ ShapeBorder drawShape(String type){
|
|||||||
break;
|
break;
|
||||||
case 'radius':
|
case 'radius':
|
||||||
return RoundedRectangleBorder(
|
return RoundedRectangleBorder(
|
||||||
side:new BorderSide( // 保留原来的边框样式
|
side: BorderSide( // 保留原来的边框样式
|
||||||
width: borderWidth,
|
width: borderWidth,
|
||||||
color: _color,
|
color: _color,
|
||||||
style: BorderStyle.solid,
|
style: BorderStyle.solid,
|
||||||
|
@ -79,7 +79,7 @@ class OutlineButtonCustom extends StatelessWidget {
|
|||||||
// 文本内容
|
// 文本内容
|
||||||
child: Text(txt, semanticsLabel: 'FLAT BUTTON 2'),
|
child: Text(txt, semanticsLabel: 'FLAT BUTTON 2'),
|
||||||
// 边框的颜色,颜色也可以走主题色 Theme.of(context).primaryColor
|
// 边框的颜色,颜色也可以走主题色 Theme.of(context).primaryColor
|
||||||
borderSide:new BorderSide(color: _randomColor(),width:Random.secure().nextInt(10).toDouble()),
|
borderSide: BorderSide(color: _randomColor(),width:Random.secure().nextInt(10).toDouble()),
|
||||||
// 按钮颜色
|
// 按钮颜色
|
||||||
color: _randomColor(),
|
color: _randomColor(),
|
||||||
// 按钮失效时边框颜色
|
// 按钮失效时边框颜色
|
||||||
@ -100,7 +100,7 @@ class OutlineButtonCustom extends StatelessWidget {
|
|||||||
splashColor: _randomColor(),
|
splashColor: _randomColor(),
|
||||||
// 抗锯齿能力,抗锯齿等级依次递增,none(默认),hardEdge,antiAliasWithSaveLayer,antiAlias
|
// 抗锯齿能力,抗锯齿等级依次递增,none(默认),hardEdge,antiAliasWithSaveLayer,antiAlias
|
||||||
clipBehavior: Clip.antiAlias,
|
clipBehavior: Clip.antiAlias,
|
||||||
padding: new EdgeInsets.only(bottom: 5.0, top: 5.0, left: 30.0, right: 30.0),
|
padding: EdgeInsets.only(bottom: 5.0, top: 5.0, left: 30.0, right: 30.0),
|
||||||
//高亮时候的阴影
|
//高亮时候的阴影
|
||||||
highlightElevation: 10.0,
|
highlightElevation: 10.0,
|
||||||
shape: shape, // 在Outline 里只能设置圆角,边框用borderSide
|
shape: shape, // 在Outline 里只能设置圆角,边框用borderSide
|
||||||
|
@ -75,7 +75,7 @@ class _DemoState extends State<Demo> {
|
|||||||
Widget allOutlineButtons(BuildContext context,_DemoState that){
|
Widget allOutlineButtons(BuildContext context,_DemoState that){
|
||||||
final ShapeBorder buttonShape = drawShape(that.buttonShapeType);
|
final ShapeBorder buttonShape = drawShape(that.buttonShapeType);
|
||||||
return Container(
|
return Container(
|
||||||
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||||
child: Column(
|
child: Column(
|
||||||
//mainAxisSize: MainAxisSize.max,
|
//mainAxisSize: MainAxisSize.max,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
@ -136,16 +136,16 @@ Widget allOutlineButtons(BuildContext context,_DemoState that){
|
|||||||
// context: context,
|
// context: context,
|
||||||
// builder: (BuildContext context) {
|
// builder: (BuildContext context) {
|
||||||
// return AlertDialog(
|
// return AlertDialog(
|
||||||
// title: new Text('提示'),
|
// title: Text('提示'),
|
||||||
// content: new Text(name),
|
// content: Text(name),
|
||||||
// actions: <Widget>[
|
// actions: <Widget>[
|
||||||
// new FlatButton(
|
// FlatButton(
|
||||||
// // alert 的取消按钮
|
// // alert 的取消按钮
|
||||||
// onPressed: () {
|
// onPressed: () {
|
||||||
// // 取消的事件
|
// // 取消的事件
|
||||||
// Navigator.of(context).pop(true);
|
// Navigator.of(context).pop(true);
|
||||||
// },
|
// },
|
||||||
// child: new Text('取消'))
|
// child: Text('取消'))
|
||||||
// ]);
|
// ]);
|
||||||
// }
|
// }
|
||||||
// );
|
// );
|
||||||
@ -155,14 +155,14 @@ Widget allOutlineButtons(BuildContext context,_DemoState that){
|
|||||||
* 带align的text
|
* 带align的text
|
||||||
* */
|
* */
|
||||||
Widget textAlignBar(String txt){
|
Widget textAlignBar(String txt){
|
||||||
//style: new TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
|
//style: TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
|
||||||
return new Align(
|
return Align(
|
||||||
alignment: FractionalOffset.centerLeft,
|
alignment: FractionalOffset.centerLeft,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
SizedBox(height: 20.0),
|
SizedBox(height: 20.0),
|
||||||
MarkdownBody(data: txt)
|
MarkdownBody(data: txt)
|
||||||
//new Text(txt, style: new TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
|
// Text(txt, style: TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -186,7 +186,7 @@ ShapeBorder drawShape(String type){
|
|||||||
break;
|
break;
|
||||||
case 'radius':
|
case 'radius':
|
||||||
return RoundedRectangleBorder(
|
return RoundedRectangleBorder(
|
||||||
side:new BorderSide( // 保留原来的边框样式
|
side: BorderSide( // 保留原来的边框样式
|
||||||
width: borderWidth,
|
width: borderWidth,
|
||||||
color: _color,
|
color: _color,
|
||||||
style: BorderStyle.solid,
|
style: BorderStyle.solid,
|
||||||
|
@ -71,8 +71,8 @@ class PopupMenuButtonDefault extends StatelessWidget {
|
|||||||
child: Text('点我试试'),
|
child: Text('点我试试'),
|
||||||
onSelected: (String value) {},
|
onSelected: (String value) {},
|
||||||
itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
|
itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
|
||||||
new PopupMenuItem(value: "选项一的内容", child: new Text("选项一")),
|
PopupMenuItem(value: "选项一的内容", child: Text("选项一")),
|
||||||
new PopupMenuItem(value: "选项二的内容", child: new Text("选项二"))
|
PopupMenuItem(value: "选项二的内容", child: Text("选项二"))
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,8 +82,8 @@ class PopupMenuButtonDefault extends StatelessWidget {
|
|||||||
icon: Icon(Icons.menu),
|
icon: Icon(Icons.menu),
|
||||||
onSelected: (String value) {},
|
onSelected: (String value) {},
|
||||||
itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
|
itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
|
||||||
new PopupMenuItem(value: "选项一的内容", child: new Text("选项一")),
|
PopupMenuItem(value: "选项一的内容", child: Text("选项一")),
|
||||||
new PopupMenuItem(value: "选项二的内容", child: new Text("选项二"))
|
PopupMenuItem(value: "选项二的内容", child: Text("选项二"))
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -116,10 +116,10 @@ class PopupMenuButtonCustom extends StatelessWidget {
|
|||||||
initialValue:selectStr,
|
initialValue:selectStr,
|
||||||
// 按下按钮时调用以创建要在菜单中显示的项目。
|
// 按下按钮时调用以创建要在菜单中显示的项目。
|
||||||
itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
|
itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
|
||||||
new PopupMenuItem(value: "选项一的内容", child: new Text("选项一")),
|
PopupMenuItem(value: "选项一的内容", child: Text("选项一")),
|
||||||
new PopupMenuItem(value: "选项二的内容", child: new Text("选项二")),
|
PopupMenuItem(value: "选项二的内容", child: Text("选项二")),
|
||||||
new PopupMenuItem(value: "选项三的内容", child: new Text("选项三")),
|
PopupMenuItem(value: "选项三的内容", child: Text("选项三")),
|
||||||
new PopupMenuItem(value: "选项四的内容", child: new Text("选项四"))
|
PopupMenuItem(value: "选项四的内容", child: Text("选项四"))
|
||||||
],
|
],
|
||||||
// 应用于弹出菜单按钮的偏移量(x,y)。
|
// 应用于弹出菜单按钮的偏移量(x,y)。
|
||||||
offset:Offset(0.0,50.0),
|
offset:Offset(0.0,50.0),
|
||||||
@ -134,7 +134,7 @@ class PopupMenuButtonCustom extends StatelessWidget {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 默认情况下匹配IconButton的8 dps填充。在某些情况下,特别是在此按钮作为列表项的尾随元素出现的情况下,能够将填充设置为零是有用的。
|
// 默认情况下匹配IconButton的8 dps填充。在某些情况下,特别是在此按钮作为列表项的尾随元素出现的情况下,能够将填充设置为零是有用的。
|
||||||
padding:new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0.0, right: 0.0),
|
padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0.0, right: 0.0),
|
||||||
//描述按下按钮时将发生的操作的文本。
|
//描述按下按钮时将发生的操作的文本。
|
||||||
tooltip:'这是信息'
|
tooltip:'这是信息'
|
||||||
);
|
);
|
||||||
|
@ -64,7 +64,7 @@ class _DemoState extends State<Demo> {
|
|||||||
|
|
||||||
Widget allPopupMenuButton(Demo widget,State parent){
|
Widget allPopupMenuButton(Demo widget,State parent){
|
||||||
return Container(
|
return Container(
|
||||||
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||||
child: Column(
|
child: Column(
|
||||||
//mainAxisSize: MainAxisSize.max,
|
//mainAxisSize: MainAxisSize.max,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
@ -105,10 +105,10 @@ class RaisedButtonCustom extends StatelessWidget {
|
|||||||
// 抗锯齿能力,抗锯齿等级依次递增,none(默认),hardEdge,antiAliasWithSaveLayer,antiAlias
|
// 抗锯齿能力,抗锯齿等级依次递增,none(默认),hardEdge,antiAliasWithSaveLayer,antiAlias
|
||||||
clipBehavior: Clip.antiAlias,
|
clipBehavior: Clip.antiAlias,
|
||||||
padding:
|
padding:
|
||||||
new EdgeInsets.only(bottom: 5.0, top: 5.0, left: 30.0, right: 30.0),
|
EdgeInsets.only(bottom: 5.0, top: 5.0, left: 30.0, right: 30.0),
|
||||||
shape: (shape is ShapeBorder)
|
shape: (shape is ShapeBorder)
|
||||||
? shape
|
? shape
|
||||||
: new Border.all(
|
: Border.all(
|
||||||
// 设置边框样式
|
// 设置边框样式
|
||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
width: 2.0,
|
width: 2.0,
|
||||||
|
@ -74,7 +74,7 @@ class _DemoState extends State<Demo> {
|
|||||||
Widget allRaisedButtons(BuildContext context,_DemoState that){
|
Widget allRaisedButtons(BuildContext context,_DemoState that){
|
||||||
final ShapeBorder buttonShape = drawShape(that.buttonShapeType);
|
final ShapeBorder buttonShape = drawShape(that.buttonShapeType);
|
||||||
return Container(
|
return Container(
|
||||||
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||||
child: Column(
|
child: Column(
|
||||||
//mainAxisSize: MainAxisSize.max,
|
//mainAxisSize: MainAxisSize.max,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
@ -135,16 +135,16 @@ Widget allRaisedButtons(BuildContext context,_DemoState that){
|
|||||||
// context: context,
|
// context: context,
|
||||||
// builder: (BuildContext context) {
|
// builder: (BuildContext context) {
|
||||||
// return AlertDialog(
|
// return AlertDialog(
|
||||||
// title: new Text('提示'),
|
// title: Text('提示'),
|
||||||
// content: new Text(name),
|
// content: Text(name),
|
||||||
// actions: <Widget>[
|
// actions: <Widget>[
|
||||||
// new FlatButton(
|
// FlatButton(
|
||||||
// // alert 的取消按钮
|
// // alert 的取消按钮
|
||||||
// onPressed: () {
|
// onPressed: () {
|
||||||
// // 取消的事件
|
// // 取消的事件
|
||||||
// Navigator.of(context).pop(true);
|
// Navigator.of(context).pop(true);
|
||||||
// },
|
// },
|
||||||
// child: new Text('取消'))
|
// child: Text('取消'))
|
||||||
// ]);
|
// ]);
|
||||||
// }
|
// }
|
||||||
// );
|
// );
|
||||||
@ -154,14 +154,14 @@ Widget allRaisedButtons(BuildContext context,_DemoState that){
|
|||||||
* 带align的text
|
* 带align的text
|
||||||
* */
|
* */
|
||||||
Widget textAlignBar(String txt){
|
Widget textAlignBar(String txt){
|
||||||
//style: new TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
|
//style: TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
|
||||||
return new Align(
|
return Align(
|
||||||
alignment: FractionalOffset.centerLeft,
|
alignment: FractionalOffset.centerLeft,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
SizedBox(height: 20.0),
|
SizedBox(height: 20.0),
|
||||||
MarkdownBody(data: txt)
|
MarkdownBody(data: txt)
|
||||||
//new Text(txt, style: new TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
|
// Text(txt, style: TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -185,7 +185,7 @@ ShapeBorder drawShape(String type){
|
|||||||
break;
|
break;
|
||||||
case 'radius':
|
case 'radius':
|
||||||
return RoundedRectangleBorder(
|
return RoundedRectangleBorder(
|
||||||
side:new BorderSide( // 保留原来的边框样式
|
side: BorderSide( // 保留原来的边框样式
|
||||||
width: borderWidth,
|
width: borderWidth,
|
||||||
color: _color,
|
color: _color,
|
||||||
style: BorderStyle.solid,
|
style: BorderStyle.solid,
|
||||||
|
@ -62,7 +62,7 @@ class RawMaterialButtonCustom extends StatelessWidget {
|
|||||||
splashColor: _randomColor(),
|
splashColor: _randomColor(),
|
||||||
// 抗锯齿能力,抗锯齿等级依次递增,none(默认),hardEdge,antiAliasWithSaveLayer,antiAlias
|
// 抗锯齿能力,抗锯齿等级依次递增,none(默认),hardEdge,antiAliasWithSaveLayer,antiAlias
|
||||||
clipBehavior: Clip.antiAlias,
|
clipBehavior: Clip.antiAlias,
|
||||||
padding: new EdgeInsets.only(bottom: 5.0, top: 5.0, left: 30.0, right: 30.0),
|
padding: EdgeInsets.only(bottom: 5.0, top: 5.0, left: 30.0, right: 30.0),
|
||||||
//高亮时候的阴影
|
//高亮时候的阴影
|
||||||
highlightElevation: 10.0,
|
highlightElevation: 10.0,
|
||||||
// 按钮材质的形状
|
// 按钮材质的形状
|
||||||
|
@ -64,7 +64,7 @@ class _DemoState extends State<Demo> {
|
|||||||
Widget allRawMaterialButtons(BuildContext context,_DemoState that){
|
Widget allRawMaterialButtons(BuildContext context,_DemoState that){
|
||||||
final ShapeBorder buttonShape = drawShape(that.buttonShapeType);
|
final ShapeBorder buttonShape = drawShape(that.buttonShapeType);
|
||||||
return Container(
|
return Container(
|
||||||
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||||
child: Column(
|
child: Column(
|
||||||
//mainAxisSize: MainAxisSize.max,
|
//mainAxisSize: MainAxisSize.max,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
@ -108,16 +108,16 @@ Widget allRawMaterialButtons(BuildContext context,_DemoState that){
|
|||||||
// context: context,
|
// context: context,
|
||||||
// builder: (BuildContext context) {
|
// builder: (BuildContext context) {
|
||||||
// return AlertDialog(
|
// return AlertDialog(
|
||||||
// title: new Text('提示'),
|
// title: Text('提示'),
|
||||||
// content: new Text(name),
|
// content: Text(name),
|
||||||
// actions: <Widget>[
|
// actions: <Widget>[
|
||||||
// new FlatButton(
|
// FlatButton(
|
||||||
// // alert 的取消按钮
|
// // alert 的取消按钮
|
||||||
// onPressed: () {
|
// onPressed: () {
|
||||||
// // 取消的事件
|
// // 取消的事件
|
||||||
// Navigator.of(context).pop(true);
|
// Navigator.of(context).pop(true);
|
||||||
// },
|
// },
|
||||||
// child: new Text('取消'))
|
// child: Text('取消'))
|
||||||
// ]);
|
// ]);
|
||||||
// }
|
// }
|
||||||
// );
|
// );
|
||||||
@ -127,14 +127,14 @@ Widget allRawMaterialButtons(BuildContext context,_DemoState that){
|
|||||||
* 带align的text
|
* 带align的text
|
||||||
* */
|
* */
|
||||||
Widget textAlignBar(String txt){
|
Widget textAlignBar(String txt){
|
||||||
//style: new TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
|
//style: TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
|
||||||
return new Align(
|
return Align(
|
||||||
alignment: FractionalOffset.centerLeft,
|
alignment: FractionalOffset.centerLeft,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
SizedBox(height: 20.0),
|
SizedBox(height: 20.0),
|
||||||
MarkdownBody(data: txt)
|
MarkdownBody(data: txt)
|
||||||
//new Text(txt, style: new TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
|
// Text(txt, style: TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -158,7 +158,7 @@ ShapeBorder drawShape(String type){
|
|||||||
break;
|
break;
|
||||||
case 'radius':
|
case 'radius':
|
||||||
return RoundedRectangleBorder(
|
return RoundedRectangleBorder(
|
||||||
side:new BorderSide( // 保留原来的边框样式
|
side: BorderSide( // 保留原来的边框样式
|
||||||
width: borderWidth,
|
width: borderWidth,
|
||||||
color: _color,
|
color: _color,
|
||||||
style: BorderStyle.solid,
|
style: BorderStyle.solid,
|
||||||
|
@ -59,7 +59,7 @@ class _DemoState extends State<Demo> {
|
|||||||
*/
|
*/
|
||||||
Widget allCheckboxs(BuildContext context,_DemoState that){
|
Widget allCheckboxs(BuildContext context,_DemoState that){
|
||||||
return Container(
|
return Container(
|
||||||
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||||
child: Column(
|
child: Column(
|
||||||
//mainAxisSize: MainAxisSize.max,
|
//mainAxisSize: MainAxisSize.max,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
@ -97,13 +97,13 @@ Widget allCheckboxs(BuildContext context,_DemoState that){
|
|||||||
* 带align的text
|
* 带align的text
|
||||||
* */
|
* */
|
||||||
Widget textAlignBar(String txt){
|
Widget textAlignBar(String txt){
|
||||||
return new Align(
|
return Align(
|
||||||
alignment: FractionalOffset.centerLeft,
|
alignment: FractionalOffset.centerLeft,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
SizedBox(height: 20.0),
|
SizedBox(height: 20.0),
|
||||||
MarkdownBody(data: txt)
|
MarkdownBody(data: txt)
|
||||||
//new Text(txt, style: new TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
|
// Text(txt, style: TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ class _CheckboxListTileStateDefault extends State {
|
|||||||
return Column(
|
return Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
new Center(
|
Center(
|
||||||
child: CheckboxListTile(
|
child: CheckboxListTile(
|
||||||
value: _value,
|
value: _value,
|
||||||
selected:true,// 默认文字是否高亮
|
selected:true,// 默认文字是否高亮
|
||||||
@ -48,10 +48,10 @@ class _CheckboxListTileStateDefault extends State {
|
|||||||
activeColor: Colors.red, // 选中此复选框时要使用的颜色
|
activeColor: Colors.red, // 选中此复选框时要使用的颜色
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
new Center(
|
Center(
|
||||||
child: new CheckboxListTile(
|
child: CheckboxListTile(
|
||||||
value: isChecks[0],
|
value: isChecks[0],
|
||||||
title: new Text('选项1'),
|
title: Text('选项1'),
|
||||||
activeColor: _value ? Colors.red : Colors.green,
|
activeColor: _value ? Colors.red : Colors.green,
|
||||||
controlAffinity: ListTileControlAffinity.platform,
|
controlAffinity: ListTileControlAffinity.platform,
|
||||||
onChanged: (bool){
|
onChanged: (bool){
|
||||||
@ -60,10 +60,10 @@ class _CheckboxListTileStateDefault extends State {
|
|||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
new Center(
|
Center(
|
||||||
child: new CheckboxListTile(
|
child: CheckboxListTile(
|
||||||
value: isChecks[1],
|
value: isChecks[1],
|
||||||
title: new Text('选项2'),
|
title: Text('选项2'),
|
||||||
activeColor: _value ? Colors.red : Colors.green,
|
activeColor: _value ? Colors.red : Colors.green,
|
||||||
controlAffinity: ListTileControlAffinity.platform,
|
controlAffinity: ListTileControlAffinity.platform,
|
||||||
onChanged: (bool){
|
onChanged: (bool){
|
||||||
@ -72,10 +72,10 @@ class _CheckboxListTileStateDefault extends State {
|
|||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
new Center(
|
Center(
|
||||||
child: new CheckboxListTile(
|
child: CheckboxListTile(
|
||||||
value: isChecks[2],
|
value: isChecks[2],
|
||||||
title: new Text('选项3'),
|
title: Text('选项3'),
|
||||||
activeColor: _value ? Colors.red : Colors.green,
|
activeColor: _value ? Colors.red : Colors.green,
|
||||||
controlAffinity: ListTileControlAffinity.platform,
|
controlAffinity: ListTileControlAffinity.platform,
|
||||||
onChanged: (bool){
|
onChanged: (bool){
|
||||||
@ -84,10 +84,10 @@ class _CheckboxListTileStateDefault extends State {
|
|||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
new Center(
|
Center(
|
||||||
child: new CheckboxListTile(
|
child: CheckboxListTile(
|
||||||
value: isChecks[3],
|
value: isChecks[3],
|
||||||
title: new Text('选项4'),
|
title: Text('选项4'),
|
||||||
activeColor: _value ? Colors.red : Colors.green,
|
activeColor: _value ? Colors.red : Colors.green,
|
||||||
controlAffinity: ListTileControlAffinity.platform,
|
controlAffinity: ListTileControlAffinity.platform,
|
||||||
onChanged: (bool){
|
onChanged: (bool){
|
||||||
|
@ -61,7 +61,7 @@ class _DemoState extends State<Demo> {
|
|||||||
*/
|
*/
|
||||||
Widget allCheckboxs(BuildContext context, _DemoState that) {
|
Widget allCheckboxs(BuildContext context, _DemoState that) {
|
||||||
return Container(
|
return Container(
|
||||||
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||||
child: Column(
|
child: Column(
|
||||||
//mainAxisSize: MainAxisSize.max,
|
//mainAxisSize: MainAxisSize.max,
|
||||||
children:[
|
children:[
|
||||||
@ -79,7 +79,7 @@ Widget allCheckboxs(BuildContext context, _DemoState that) {
|
|||||||
* 带align的text
|
* 带align的text
|
||||||
* */
|
* */
|
||||||
Widget textAlignBar(String txt) {
|
Widget textAlignBar(String txt) {
|
||||||
return new Align(
|
return Align(
|
||||||
alignment: FractionalOffset.centerLeft,
|
alignment: FractionalOffset.centerLeft,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
@ -4,7 +4,7 @@ import 'package:flutter/material.dart';
|
|||||||
class DefaultTextField extends StatelessWidget {
|
class DefaultTextField extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return new Container(
|
return Container(
|
||||||
padding: const EdgeInsets.all(30.0),
|
padding: const EdgeInsets.all(30.0),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start, //文本是起始端对齐
|
crossAxisAlignment: CrossAxisAlignment.start, //文本是起始端对齐
|
||||||
@ -29,7 +29,7 @@ class CustomTextField extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return new Container(
|
return Container(
|
||||||
padding: const EdgeInsets.all(30.0),
|
padding: const EdgeInsets.all(30.0),
|
||||||
child: TextField(
|
child: TextField(
|
||||||
keyboardType: TextInputType.number,
|
keyboardType: TextInputType.number,
|
||||||
|
@ -22,27 +22,27 @@ class _Demo extends State<RadioADemo> {
|
|||||||
}
|
}
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return (
|
return (
|
||||||
new Container(
|
Container(
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
child: new Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
new Radio(
|
Radio(
|
||||||
value: 1,
|
value: 1,
|
||||||
groupValue: groupValue,//当value和groupValue一致的时候则选中
|
groupValue: groupValue,//当value和groupValue一致的时候则选中
|
||||||
onChanged: (T){
|
onChanged: (T){
|
||||||
onChange(T);
|
onChange(T);
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
new Radio(
|
Radio(
|
||||||
value: 2,
|
value: 2,
|
||||||
groupValue: groupValue,
|
groupValue: groupValue,
|
||||||
onChanged: (T){
|
onChanged: (T){
|
||||||
onChange(T);
|
onChange(T);
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
new Radio(
|
Radio(
|
||||||
value: 3,
|
value: 3,
|
||||||
groupValue: groupValue,
|
groupValue: groupValue,
|
||||||
onChanged: (T){
|
onChanged: (T){
|
||||||
|
@ -25,7 +25,7 @@ const content2 = """
|
|||||||
# 基本用法
|
# 基本用法
|
||||||
|
|
||||||
```
|
```
|
||||||
new Radio(
|
Radio(
|
||||||
value: value,
|
value: value,
|
||||||
groupValue: groupValue, //当value和groupValue一致的时候则选中
|
groupValue: groupValue, //当value和groupValue一致的时候则选中
|
||||||
onChanged: (T){
|
onChanged: (T){
|
||||||
@ -45,7 +45,7 @@ class _DemoState extends State<Demo> {
|
|||||||
return WidgetDemo(
|
return WidgetDemo(
|
||||||
contentList: [
|
contentList: [
|
||||||
content1,
|
content1,
|
||||||
new RadioADemo(),
|
RadioADemo(),
|
||||||
content2
|
content2
|
||||||
],
|
],
|
||||||
title: 'Radio',
|
title: 'Radio',
|
||||||
|
@ -24,7 +24,7 @@ class _Demo extends State<DemoA> {
|
|||||||
}
|
}
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
||||||
return new Column(
|
return Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
RadioListTile<String>(
|
RadioListTile<String>(
|
||||||
title: const Text('A'),
|
title: const Text('A'),
|
||||||
|
@ -45,7 +45,7 @@ class _DemoState extends State<Demo> {
|
|||||||
return WidgetDemo(
|
return WidgetDemo(
|
||||||
contentList: [
|
contentList: [
|
||||||
content1,
|
content1,
|
||||||
new DemoA(),
|
DemoA(),
|
||||||
content2
|
content2
|
||||||
],
|
],
|
||||||
title: 'RadioListTile',
|
title: 'RadioListTile',
|
||||||
|
@ -16,7 +16,7 @@ class SliderDemo extends StatefulWidget {
|
|||||||
class _Demo extends State<SliderDemo> {
|
class _Demo extends State<SliderDemo> {
|
||||||
double value = 0.0;
|
double value = 0.0;
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return new Slider(
|
return Slider(
|
||||||
value: value,//实际进度的位置
|
value: value,//实际进度的位置
|
||||||
inactiveColor: Colors.black12,//进度中不活动部分的颜色
|
inactiveColor: Colors.black12,//进度中不活动部分的颜色
|
||||||
label: 'value: $value',
|
label: 'value: $value',
|
||||||
@ -43,8 +43,8 @@ class SliderThemeDemo extends StatefulWidget {
|
|||||||
class _SliderThemeDemo extends State<SliderThemeDemo> {
|
class _SliderThemeDemo extends State<SliderThemeDemo> {
|
||||||
double value = 0.0;
|
double value = 0.0;
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return new Container(
|
return Container(
|
||||||
child: new SliderTheme(
|
child: SliderTheme(
|
||||||
data: SliderTheme.of(context).copyWith(
|
data: SliderTheme.of(context).copyWith(
|
||||||
// activeTickMarkColor:Colors.yellowAccent,
|
// activeTickMarkColor:Colors.yellowAccent,
|
||||||
activeTrackColor: Colors.yellowAccent,//实际进度的颜色
|
activeTrackColor: Colors.yellowAccent,//实际进度的颜色
|
||||||
@ -52,21 +52,21 @@ class _SliderThemeDemo extends State<SliderThemeDemo> {
|
|||||||
thumbColor: Colors.black,//滑块中心的颜色
|
thumbColor: Colors.black,//滑块中心的颜色
|
||||||
inactiveTrackColor:Colors.red,//默 认进度条的颜色
|
inactiveTrackColor:Colors.red,//默 认进度条的颜色
|
||||||
valueIndicatorColor: Colors.blue,//提示进度的气派的背景色
|
valueIndicatorColor: Colors.blue,//提示进度的气派的背景色
|
||||||
valueIndicatorTextStyle: new TextStyle(//提示气泡里面文字的样式
|
valueIndicatorTextStyle: TextStyle(//提示气泡里面文字的样式
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
),
|
),
|
||||||
inactiveTickMarkColor:Colors.blue,//divisions对进度线分割后 断续线中间间隔的颜色
|
inactiveTickMarkColor:Colors.blue,//divisions对进度线分割后 断续线中间间隔的颜色
|
||||||
overlayColor: Colors.pink,//滑块边缘颜色
|
overlayColor: Colors.pink,//滑块边缘颜色
|
||||||
),
|
),
|
||||||
child: new Container(
|
child: Container(
|
||||||
width: 340.0,
|
width: 340.0,
|
||||||
margin: EdgeInsets.fromLTRB(0.0, 50.0, 0.0, 0.0),
|
margin: EdgeInsets.fromLTRB(0.0, 50.0, 0.0, 0.0),
|
||||||
child: new Row(
|
child: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
new Text('0.0'),
|
Text('0.0'),
|
||||||
new Expanded(
|
Expanded(
|
||||||
flex: 1,
|
flex: 1,
|
||||||
child: new Slider(
|
child: Slider(
|
||||||
value: value,
|
value: value,
|
||||||
label: '$value',
|
label: '$value',
|
||||||
divisions: 10,
|
divisions: 10,
|
||||||
@ -79,7 +79,7 @@ class _SliderThemeDemo extends State<SliderThemeDemo> {
|
|||||||
max: 100.0,
|
max: 100.0,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
new Text('100.0'),
|
Text('100.0'),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -49,19 +49,19 @@ const contentB = '''
|
|||||||
如果当前Slider样式 无法满足需求, 可以通过 ** SliderTheme ** 定制复杂样式
|
如果当前Slider样式 无法满足需求, 可以通过 ** SliderTheme ** 定制复杂样式
|
||||||
|
|
||||||
```
|
```
|
||||||
new SliderTheme(
|
SliderTheme(
|
||||||
data: SliderTheme.of(context).copyWith(
|
data: SliderTheme.of(context).copyWith(
|
||||||
activeTrackColor: Colors.yellowAccent,//实际进度的颜色
|
activeTrackColor: Colors.yellowAccent,//实际进度的颜色
|
||||||
inactiveTickMarkColor:Colors.black
|
inactiveTickMarkColor:Colors.black
|
||||||
thumbColor: Colors.black,//滑块中心的颜色
|
thumbColor: Colors.black,//滑块中心的颜色
|
||||||
inactiveTrackColor:Colors.red,//默 认进度条的颜色
|
inactiveTrackColor:Colors.red,//默 认进度条的颜色
|
||||||
valueIndicatorColor: Colors.blue,//提示进度的气派的背景色
|
valueIndicatorColor: Colors.blue,//提示进度的气派的背景色
|
||||||
valueIndicatorTextStyle: new TextStyle(//提示气泡里面文字的样式
|
valueIndicatorTextStyle: TextStyle(//提示气泡里面文字的样式
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
),
|
),
|
||||||
inactiveTickMarkColor:Colors.blue,//divisions对进度线分割后 断续线中间间隔的颜色
|
inactiveTickMarkColor:Colors.blue,//divisions对进度线分割后 断续线中间间隔的颜色
|
||||||
overlayColor: Colors.pink,//滑块边缘颜色
|
overlayColor: Colors.pink,//滑块边缘颜色
|
||||||
child: new Slider()
|
child: Slider()
|
||||||
)
|
)
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -17,8 +17,8 @@ class SliderThemeDemo extends StatefulWidget {
|
|||||||
class _SliderThemeDemo extends State<SliderThemeDemo> {
|
class _SliderThemeDemo extends State<SliderThemeDemo> {
|
||||||
double value = 0.0;
|
double value = 0.0;
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return new Container(
|
return Container(
|
||||||
child: new SliderTheme(
|
child: SliderTheme(
|
||||||
data: SliderTheme.of(context).copyWith(
|
data: SliderTheme.of(context).copyWith(
|
||||||
// activeTickMarkColor:Colors.yellowAccent,
|
// activeTickMarkColor:Colors.yellowAccent,
|
||||||
activeTrackColor: Colors.yellowAccent,//实际进度的颜色
|
activeTrackColor: Colors.yellowAccent,//实际进度的颜色
|
||||||
@ -26,21 +26,21 @@ class _SliderThemeDemo extends State<SliderThemeDemo> {
|
|||||||
thumbColor: Colors.black,//滑块中心的颜色
|
thumbColor: Colors.black,//滑块中心的颜色
|
||||||
inactiveTrackColor:Colors.red,//默 认进度条的颜色
|
inactiveTrackColor:Colors.red,//默 认进度条的颜色
|
||||||
valueIndicatorColor: Colors.blue,//提示进度的气派的背景色
|
valueIndicatorColor: Colors.blue,//提示进度的气派的背景色
|
||||||
valueIndicatorTextStyle: new TextStyle(//提示气泡里面文字的样式
|
valueIndicatorTextStyle: TextStyle(//提示气泡里面文字的样式
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
),
|
),
|
||||||
inactiveTickMarkColor:Colors.blue,//divisions对进度线分割后 断续线中间间隔的颜色
|
inactiveTickMarkColor:Colors.blue,//divisions对进度线分割后 断续线中间间隔的颜色
|
||||||
overlayColor: Colors.pink,//滑块边缘颜色
|
overlayColor: Colors.pink,//滑块边缘颜色
|
||||||
),
|
),
|
||||||
child: new Container(
|
child: Container(
|
||||||
width: 340.0,
|
width: 340.0,
|
||||||
margin: EdgeInsets.fromLTRB(0.0, 50.0, 0.0, 0.0),
|
margin: EdgeInsets.fromLTRB(0.0, 50.0, 0.0, 0.0),
|
||||||
child: new Row(
|
child: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
new Text('0.0'),
|
Text('0.0'),
|
||||||
new Expanded(
|
Expanded(
|
||||||
flex: 1,
|
flex: 1,
|
||||||
child: new Slider(
|
child: Slider(
|
||||||
value: value,
|
value: value,
|
||||||
label: '$value',
|
label: '$value',
|
||||||
divisions: 10,
|
divisions: 10,
|
||||||
@ -53,7 +53,7 @@ class _SliderThemeDemo extends State<SliderThemeDemo> {
|
|||||||
max: 100.0,
|
max: 100.0,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
new Text('100.0'),
|
Text('100.0'),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -24,7 +24,7 @@ const contentA = '''
|
|||||||
基本属性参考以下代码:
|
基本属性参考以下代码:
|
||||||
|
|
||||||
```
|
```
|
||||||
new SliderTheme(
|
SliderTheme(
|
||||||
data: SliderThemeData({
|
data: SliderThemeData({
|
||||||
@required Color activeTrackColor,
|
@required Color activeTrackColor,
|
||||||
@required Color inactiveTrackColor,
|
@required Color inactiveTrackColor,
|
||||||
@ -67,7 +67,7 @@ class _Demo extends State<Demo> {
|
|||||||
codeUrl: 'elements/Form/Slider/SliderTheme/demo.dart',
|
codeUrl: 'elements/Form/Slider/SliderTheme/demo.dart',
|
||||||
contentList: [
|
contentList: [
|
||||||
contentA,
|
contentA,
|
||||||
new SliderThemeDemo(),
|
SliderThemeDemo(),
|
||||||
],
|
],
|
||||||
docUrl: 'https://docs.flutter.io/flutter/material/SliderTheme-class.html',
|
docUrl: 'https://docs.flutter.io/flutter/material/SliderTheme-class.html',
|
||||||
);
|
);
|
||||||
|
@ -17,8 +17,8 @@ class SliderThemeDemo extends StatefulWidget {
|
|||||||
class _SliderThemeDemo extends State<SliderThemeDemo> {
|
class _SliderThemeDemo extends State<SliderThemeDemo> {
|
||||||
double value = 0.0;
|
double value = 0.0;
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return new Container(
|
return Container(
|
||||||
child: new SliderTheme(
|
child: SliderTheme(
|
||||||
data: SliderTheme.of(context).copyWith(
|
data: SliderTheme.of(context).copyWith(
|
||||||
// activeTickMarkColor:Colors.yellowAccent,
|
// activeTickMarkColor:Colors.yellowAccent,
|
||||||
activeTrackColor: Colors.yellowAccent,//实际进度的颜色
|
activeTrackColor: Colors.yellowAccent,//实际进度的颜色
|
||||||
@ -26,21 +26,21 @@ class _SliderThemeDemo extends State<SliderThemeDemo> {
|
|||||||
thumbColor: Colors.black,//滑块中心的颜色
|
thumbColor: Colors.black,//滑块中心的颜色
|
||||||
inactiveTrackColor:Colors.red,//默 认进度条的颜色
|
inactiveTrackColor:Colors.red,//默 认进度条的颜色
|
||||||
valueIndicatorColor: Colors.blue,//提示进度的气派的背景色
|
valueIndicatorColor: Colors.blue,//提示进度的气派的背景色
|
||||||
valueIndicatorTextStyle: new TextStyle(//提示气泡里面文字的样式
|
valueIndicatorTextStyle: TextStyle(//提示气泡里面文字的样式
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
),
|
),
|
||||||
inactiveTickMarkColor:Colors.blue,//divisions对进度线分割后 断续线中间间隔的颜色
|
inactiveTickMarkColor:Colors.blue,//divisions对进度线分割后 断续线中间间隔的颜色
|
||||||
overlayColor: Colors.pink,//滑块边缘颜色
|
overlayColor: Colors.pink,//滑块边缘颜色
|
||||||
),
|
),
|
||||||
child: new Container(
|
child: Container(
|
||||||
width: 340.0,
|
width: 340.0,
|
||||||
margin: EdgeInsets.fromLTRB(0.0, 50.0, 0.0, 0.0),
|
margin: EdgeInsets.fromLTRB(0.0, 50.0, 0.0, 0.0),
|
||||||
child: new Row(
|
child: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
new Text('0.0'),
|
Text('0.0'),
|
||||||
new Expanded(
|
Expanded(
|
||||||
flex: 1,
|
flex: 1,
|
||||||
child: new Slider(
|
child: Slider(
|
||||||
value: value,
|
value: value,
|
||||||
label: '$value',
|
label: '$value',
|
||||||
divisions: 10,
|
divisions: 10,
|
||||||
@ -53,7 +53,7 @@ class _SliderThemeDemo extends State<SliderThemeDemo> {
|
|||||||
max: 100.0,
|
max: 100.0,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
new Text('100.0'),
|
Text('100.0'),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -63,7 +63,7 @@ class _Demo extends State<Demo> {
|
|||||||
codeUrl: 'elements/Form/Slider/SliderThemeData/demo.dart',
|
codeUrl: 'elements/Form/Slider/SliderThemeData/demo.dart',
|
||||||
contentList: [
|
contentList: [
|
||||||
contentA,
|
contentA,
|
||||||
new SliderThemeDemo()
|
SliderThemeDemo()
|
||||||
],
|
],
|
||||||
docUrl: 'https://docs.flutter.io/flutter/material/SliderThemeData-class.html',
|
docUrl: 'https://docs.flutter.io/flutter/material/SliderThemeData-class.html',
|
||||||
);
|
);
|
||||||
|
@ -39,7 +39,7 @@ class _Demo extends State<Demo> {
|
|||||||
codeUrl: 'elements/Form/Switch/AnimatedSwitcher/demo.dart',
|
codeUrl: 'elements/Form/Switch/AnimatedSwitcher/demo.dart',
|
||||||
contentList: [
|
contentList: [
|
||||||
contentA,
|
contentA,
|
||||||
new AnimatedSwitcherDemo()
|
AnimatedSwitcherDemo()
|
||||||
],
|
],
|
||||||
docUrl: '',
|
docUrl: '',
|
||||||
);
|
);
|
||||||
|
@ -18,7 +18,7 @@ class SwitchDemo extends StatefulWidget {
|
|||||||
class _Demo extends State<SwitchDemo> {
|
class _Demo extends State<SwitchDemo> {
|
||||||
bool check = false;
|
bool check = false;
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return new Switch(
|
return Switch(
|
||||||
value: this.check,
|
value: this.check,
|
||||||
onChanged: (bool val) {
|
onChanged: (bool val) {
|
||||||
this.setState(() {
|
this.setState(() {
|
||||||
@ -36,7 +36,7 @@ class SwitchHighDemo extends StatefulWidget {
|
|||||||
class _SwitchHighDemo extends State<SwitchHighDemo> {
|
class _SwitchHighDemo extends State<SwitchHighDemo> {
|
||||||
bool check = false;
|
bool check = false;
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return new Switch.adaptive(
|
return Switch.adaptive(
|
||||||
value: this.check,
|
value: this.check,
|
||||||
activeColor: Colors.blue, // 激活时原点颜色
|
activeColor: Colors.blue, // 激活时原点颜色
|
||||||
onChanged: (bool val) {
|
onChanged: (bool val) {
|
||||||
@ -56,7 +56,7 @@ class SwitchTypesDemo extends StatefulWidget {
|
|||||||
class _SwitchTypesDemo extends State<SwitchTypesDemo> {
|
class _SwitchTypesDemo extends State<SwitchTypesDemo> {
|
||||||
bool check = false;
|
bool check = false;
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return new Switch(
|
return Switch(
|
||||||
value: this.check,
|
value: this.check,
|
||||||
activeTrackColor:Colors.green,
|
activeTrackColor:Colors.green,
|
||||||
inactiveThumbColor: Colors.black,
|
inactiveThumbColor: Colors.black,
|
||||||
|
@ -19,7 +19,7 @@ const contentA = '''
|
|||||||
### **基本用法**
|
### **基本用法**
|
||||||
|
|
||||||
```
|
```
|
||||||
new Switch(
|
Switch(
|
||||||
value: isChecked,
|
value: isChecked,
|
||||||
activeColor: Colors.blue, // 激活时原点颜色
|
activeColor: Colors.blue, // 激活时原点颜色
|
||||||
onChanged: (bool val) {
|
onChanged: (bool val) {
|
||||||
|
@ -18,7 +18,7 @@ class SwitchListTileDemo extends StatefulWidget {
|
|||||||
class _Demo extends State<SwitchListTileDemo> {
|
class _Demo extends State<SwitchListTileDemo> {
|
||||||
bool _lights = false;
|
bool _lights = false;
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return new SwitchListTile(
|
return SwitchListTile(
|
||||||
title: const Text('Lights'),
|
title: const Text('Lights'),
|
||||||
value: _lights,
|
value: _lights,
|
||||||
onChanged: (bool value) { setState(() { _lights = value; }); },
|
onChanged: (bool value) { setState(() { _lights = value; }); },
|
||||||
|
@ -18,13 +18,13 @@ class AlignAlignment extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return new Container(
|
return Container(
|
||||||
color: Color(0xffd81b60),
|
color: Color(0xffd81b60),
|
||||||
width: 90.0,
|
width: 90.0,
|
||||||
height: 50.0,
|
height: 50.0,
|
||||||
child: new Align(
|
child: Align(
|
||||||
alignment: status,
|
alignment: status,
|
||||||
child: new Text(
|
child: Text(
|
||||||
dec,
|
dec,
|
||||||
style: TextStyle(fontSize: 12.0, color: Color(0xffffffff)),
|
style: TextStyle(fontSize: 12.0, color: Color(0xffffffff)),
|
||||||
),
|
),
|
||||||
@ -45,10 +45,10 @@ class AlignFactor extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return new Container(
|
return Container(
|
||||||
margin: new EdgeInsets.only(top: 10.0, bottom: 10.0),
|
margin: EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||||||
color: Color(0xffd81b60),
|
color: Color(0xffd81b60),
|
||||||
child: new Align(
|
child: Align(
|
||||||
alignment: status,
|
alignment: status,
|
||||||
widthFactor: wFactor,
|
widthFactor: wFactor,
|
||||||
heightFactor: hFactor,
|
heightFactor: hFactor,
|
||||||
|
@ -40,10 +40,10 @@ class _DemoState extends State<Demo> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Column _alignCreate() {
|
Column _alignCreate() {
|
||||||
return new Column(
|
return Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
SizedBox(height: 10.0),
|
SizedBox(height: 10.0),
|
||||||
new Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
AlignAlignment(Alignment.center, 'center'),
|
AlignAlignment(Alignment.center, 'center'),
|
||||||
@ -51,7 +51,7 @@ class _DemoState extends State<Demo> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(height: 10.0),
|
SizedBox(height: 10.0),
|
||||||
new Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
AlignAlignment(Alignment.centerRight, 'centerRight'),
|
AlignAlignment(Alignment.centerRight, 'centerRight'),
|
||||||
@ -60,7 +60,7 @@ class _DemoState extends State<Demo> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(height: 10.0),
|
SizedBox(height: 10.0),
|
||||||
new Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
AlignAlignment(Alignment.topLeft, 'topLeft'),
|
AlignAlignment(Alignment.topLeft, 'topLeft'),
|
||||||
@ -71,11 +71,11 @@ class _DemoState extends State<Demo> {
|
|||||||
SizedBox(height: 10.0),
|
SizedBox(height: 10.0),
|
||||||
MarkdownBody(data: _flatText1),
|
MarkdownBody(data: _flatText1),
|
||||||
Container(
|
Container(
|
||||||
margin: new EdgeInsets.only(top: 20.0, bottom: 20.0),
|
margin: EdgeInsets.only(top: 20.0, bottom: 20.0),
|
||||||
color: Color(0xffe91e63),
|
color: Color(0xffe91e63),
|
||||||
child: new Align(
|
child: Align(
|
||||||
alignment: Alignment.topLeft,
|
alignment: Alignment.topLeft,
|
||||||
child: new Text(
|
child: Text(
|
||||||
"Align",
|
"Align",
|
||||||
style: TextStyle(color: Color(0xffffffff)),
|
style: TextStyle(color: Color(0xffffffff)),
|
||||||
),
|
),
|
||||||
|
@ -29,12 +29,12 @@ class ConstrainedBoxCreate extends StatelessWidget {
|
|||||||
maxWidth: 300.0,
|
maxWidth: 300.0,
|
||||||
maxHeight: 50.0,
|
maxHeight: 50.0,
|
||||||
),
|
),
|
||||||
child: new Container(
|
child: Container(
|
||||||
margin: const EdgeInsets.only(left: 20.0, right: 20.0),
|
margin: const EdgeInsets.only(left: 20.0, right: 20.0),
|
||||||
//child 宽高超过制定限制范围失效,效果宽/高=100/20区域
|
//child 宽高超过制定限制范围失效,效果宽/高=100/20区域
|
||||||
width: currWidth,
|
width: currWidth,
|
||||||
height: 250.0,
|
height: 250.0,
|
||||||
child: new Text(
|
child: Text(
|
||||||
describe,
|
describe,
|
||||||
style: TextStyle(color: Colors.white),
|
style: TextStyle(color: Colors.white),
|
||||||
),
|
),
|
||||||
|
@ -21,7 +21,7 @@ class DecoratedBoxCreate extends StatelessWidget {
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: const Color(0xff7c94b6),
|
color: const Color(0xff7c94b6),
|
||||||
//设置图片内容
|
//设置图片内容
|
||||||
image: new DecorationImage(
|
image: DecorationImage(
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
image: ExactAssetImage('assets/images/food01.jpeg')),
|
image: ExactAssetImage('assets/images/food01.jpeg')),
|
||||||
//外宽边框,可以不设置
|
//外宽边框,可以不设置
|
||||||
@ -46,7 +46,7 @@ class DecoratedBoxCreateTwo extends StatelessWidget {
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: const Color(0xff7c94b6),
|
color: const Color(0xff7c94b6),
|
||||||
//设置图片内容
|
//设置图片内容
|
||||||
image: new DecorationImage(
|
image: DecorationImage(
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
image: ExactAssetImage('assets/images/food01.jpeg')),
|
image: ExactAssetImage('assets/images/food01.jpeg')),
|
||||||
//根据传入的不同大小,呈现图片效弧度不同,
|
//根据传入的不同大小,呈现图片效弧度不同,
|
||||||
@ -67,7 +67,7 @@ class DecoratedBoxCreateShape extends StatelessWidget {
|
|||||||
position: DecorationPosition.background,
|
position: DecorationPosition.background,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: const Color(0xff7c94b6),
|
color: const Color(0xff7c94b6),
|
||||||
image: new DecorationImage(
|
image: DecorationImage(
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
image: ExactAssetImage('assets/images/food01.jpeg')),
|
image: ExactAssetImage('assets/images/food01.jpeg')),
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
|
@ -45,7 +45,7 @@ class _DemoState extends State<Demo> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Column _decoratedBoxCreate() {
|
Column _decoratedBoxCreate() {
|
||||||
return new Column(
|
return Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Container(
|
Container(
|
||||||
height: 100.0,
|
height: 100.0,
|
||||||
|
@ -15,11 +15,11 @@ class FittedBoxDefault extends StatelessWidget {
|
|||||||
final BoxFit curfit;
|
final BoxFit curfit;
|
||||||
final String dec;
|
final String dec;
|
||||||
|
|
||||||
FittedBoxDefault({Key key, this.curfit, this.dec});
|
FittedBoxDefault({Key key, this.curfit, this.dec});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return new Column(
|
return Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Container(
|
Container(
|
||||||
//外部有位置约束,内部大小设定失效,保持和外部约束一致
|
//外部有位置约束,内部大小设定失效,保持和外部约束一致
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Author: xiaojia.dxj
|
* Author: xiaojia.dxj
|
||||||
* Date: 2019-01-08
|
* Date: 2019-01-08
|
||||||
@ -9,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_go/components/widget_demo.dart';
|
import 'package:flutter_go/components/widget_demo.dart';
|
||||||
import './demo.dart' as fittedBox;
|
import './demo.dart';
|
||||||
|
|
||||||
const String Text0 = """
|
const String Text0 = """
|
||||||
### **FittedBox**
|
### **FittedBox**
|
||||||
@ -53,18 +52,16 @@ class _DemoState extends State<Demo> {
|
|||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
fittedBox.FittedBoxDefault(
|
FittedBoxDefault(
|
||||||
/**
|
//设置child写入布局期间分配空间
|
||||||
* 设置child写入布局期间分配空间
|
|
||||||
*/
|
|
||||||
curfit: BoxFit.contain,
|
curfit: BoxFit.contain,
|
||||||
dec: 'contain',
|
dec: 'contain',
|
||||||
),
|
),
|
||||||
fittedBox.FittedBoxDefault(
|
FittedBoxDefault(
|
||||||
curfit: BoxFit.fill,
|
curfit: BoxFit.fill,
|
||||||
dec: 'fill',
|
dec: 'fill',
|
||||||
),
|
),
|
||||||
fittedBox.FittedBoxDefault(
|
FittedBoxDefault(
|
||||||
curfit: BoxFit.cover,
|
curfit: BoxFit.cover,
|
||||||
dec: 'cover',
|
dec: 'cover',
|
||||||
),
|
),
|
||||||
@ -76,11 +73,11 @@ class _DemoState extends State<Demo> {
|
|||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
fittedBox.FittedBoxDefault(
|
FittedBoxDefault(
|
||||||
curfit: BoxFit.fitHeight,
|
curfit: BoxFit.fitHeight,
|
||||||
dec: 'fitHeight',
|
dec: 'fitHeight',
|
||||||
),
|
),
|
||||||
fittedBox.FittedBoxDefault(
|
FittedBoxDefault(
|
||||||
curfit: BoxFit.fitWidth,
|
curfit: BoxFit.fitWidth,
|
||||||
dec: 'fitWidth',
|
dec: 'fitWidth',
|
||||||
),
|
),
|
||||||
@ -92,11 +89,11 @@ class _DemoState extends State<Demo> {
|
|||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
fittedBox.FittedBoxDefault(
|
FittedBoxDefault(
|
||||||
curfit: BoxFit.none,
|
curfit: BoxFit.none,
|
||||||
dec: 'none',
|
dec: 'none',
|
||||||
),
|
),
|
||||||
fittedBox.FittedBoxDefault(
|
FittedBoxDefault(
|
||||||
curfit: BoxFit.scaleDown,
|
curfit: BoxFit.scaleDown,
|
||||||
dec: 'scaleDown',
|
dec: 'scaleDown',
|
||||||
),
|
),
|
||||||
|
@ -10,11 +10,11 @@ class OverflowBoxDefault extends StatelessWidget {
|
|||||||
|
|
||||||
OverflowBoxDefault(
|
OverflowBoxDefault(
|
||||||
{Key key,
|
{Key key,
|
||||||
this.curmaxHeight,
|
this.curmaxHeight,
|
||||||
this.curmaxWidth,
|
this.curmaxWidth,
|
||||||
this.curWidth,
|
this.curWidth,
|
||||||
this.curHeight,
|
this.curHeight,
|
||||||
this.curalignment})
|
this.curalignment})
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -25,18 +25,18 @@ class OverflowBoxDefault extends StatelessWidget {
|
|||||||
//设置最大宽,高
|
//设置最大宽,高
|
||||||
maxWidth: curmaxWidth,
|
maxWidth: curmaxWidth,
|
||||||
maxHeight: curmaxHeight,
|
maxHeight: curmaxHeight,
|
||||||
/**
|
|
||||||
* 调整child位置
|
//调整child位置
|
||||||
*/
|
|
||||||
alignment: curalignment,
|
alignment: curalignment,
|
||||||
child: Container(
|
child: Container(
|
||||||
/**
|
//widget宽高大于overflowBox设置的最大,以overflowbox设置的最大宽高为限制,
|
||||||
* widget宽高大于overflowBox设置的最大,以overflowbox设置的最大宽高为限制,
|
//小于overflowBox 设置的最大限度,子widget能够完全显示
|
||||||
* 小于overflowBox 设置的最大限度,子widget能够完全显示
|
|
||||||
* * */
|
|
||||||
height: curHeight,
|
height: curHeight,
|
||||||
width: curWidth,
|
width: curWidth,
|
||||||
child: Text("$curmaxWidth * $curmaxHeight",style: TextStyle(color: Colors.white),),
|
child: Text(
|
||||||
|
"$curmaxWidth * $curmaxHeight",
|
||||||
|
style: TextStyle(color: Colors.white),
|
||||||
|
),
|
||||||
color: Color(0xfff48fb1),
|
color: Color(0xfff48fb1),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -76,7 +76,10 @@ class _DemoState extends State<Demo> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 20),
|
SizedBox(height: 20),
|
||||||
SizedBox(height: 50,child: Text("宽高都大于最大限制"),),
|
SizedBox(
|
||||||
|
height: 50,
|
||||||
|
child: Text("宽高都大于最大限制"),
|
||||||
|
),
|
||||||
Container(
|
Container(
|
||||||
width: 100.0,
|
width: 100.0,
|
||||||
height: 100.0,
|
height: 100.0,
|
||||||
@ -90,7 +93,6 @@ class _DemoState extends State<Demo> {
|
|||||||
curalignment: Alignment.center,
|
curalignment: Alignment.center,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
class RenderBoxDemo extends StatefulWidget {
|
|
||||||
_RenderBoxDemoState createState() => _RenderBoxDemoState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _RenderBoxDemoState extends State<RenderBoxDemo> {
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Container(
|
|
||||||
// child: RenderFoo(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class RenderFoo extends RenderBox {
|
|
||||||
@override
|
|
||||||
bool get hasSize => super.hasSize;
|
|
||||||
|
|
||||||
@override
|
|
||||||
BoxConstraints get constraints => super.constraints;
|
|
||||||
}
|
|
@ -1,62 +0,0 @@
|
|||||||
/*
|
|
||||||
* @Author: xiaojia.dxj
|
|
||||||
* @Date: 2019-01-08 15:56:26
|
|
||||||
* @Last Modified by: xiaojia.dxj
|
|
||||||
* @Last Modified time: 2019-01-08 15:56:26
|
|
||||||
*/
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_go/components/widget_demo.dart';
|
|
||||||
|
|
||||||
const String _Text = '''
|
|
||||||
### **简介**
|
|
||||||
> BoxConstraints为抽象类,我们可以使用BoxConstraints,一个不可边的约束布局,renderBox布局
|
|
||||||
- 一个尺寸尊重一个BoxConstraints,当且仅当,以下关系式的成立:
|
|
||||||
minWidth <= Size.width <= maxWidth
|
|
||||||
minHeight <= Size.height <= maxHeight
|
|
||||||
约束本身必须满足这些关系:
|
|
||||||
|
|
||||||
0.0 <= minWidth <= maxWidth <= double.infinity
|
|
||||||
0.0 <= minHeight <= maxHeight <= double.infinity
|
|
||||||
double.infinity是每个约束的合法值。
|
|
||||||
''';
|
|
||||||
|
|
||||||
class Demo extends StatefulWidget {
|
|
||||||
static const String routeName = '/element/Frame/Box/RenderBox';
|
|
||||||
|
|
||||||
_DemoState createState() => _DemoState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _DemoState extends State<Demo> {
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return WidgetDemo(
|
|
||||||
title: 'Table',
|
|
||||||
codeUrl: 'elements/Frame/Box/RenderBox/demo.dart',
|
|
||||||
contentList: [
|
|
||||||
_Text,
|
|
||||||
_sizeBoxCreate(),
|
|
||||||
],
|
|
||||||
docUrl: 'https://docs.flutter.io/flutter/widgets/RenderBox-class.html',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Column _sizeBoxCreate() {
|
|
||||||
return new Column(
|
|
||||||
children: <Widget>[
|
|
||||||
/**
|
|
||||||
* Immutable layout constraints for RenderBox layout.
|
|
||||||
*/
|
|
||||||
SizedBox(
|
|
||||||
width: 900.0,
|
|
||||||
height: 50.0,
|
|
||||||
child: const Card(
|
|
||||||
child: Text(
|
|
||||||
'SizedBox',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
),
|
|
||||||
color: Color(0xFFEF5350)),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
@ -28,15 +28,15 @@ class _DemoState extends State<Demo> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Column _sizeBoxCreate() {
|
Column _sizeBoxCreate() {
|
||||||
return new Column(
|
return Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
new Text("SizedBox",
|
Text("SizedBox",
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 28.0,
|
fontSize: 28.0,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
)),
|
)),
|
||||||
new Row(
|
Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
sizeBox.SizeBoxDefault(),
|
sizeBox.SizeBoxDefault(),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
|
@ -7,10 +7,7 @@ class SizeOverflowBoxDefault extends StatelessWidget {
|
|||||||
final String text;
|
final String text;
|
||||||
|
|
||||||
SizeOverflowBoxDefault(
|
SizeOverflowBoxDefault(
|
||||||
{Key key,
|
{Key key, this.curSizeWidth, this.curSizeHeight, this.text})
|
||||||
this.curSizeWidth,
|
|
||||||
this.curSizeHeight,
|
|
||||||
this.text})
|
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -23,7 +20,7 @@ class SizeOverflowBoxDefault extends StatelessWidget {
|
|||||||
color: Color(0xfff06292),
|
color: Color(0xfff06292),
|
||||||
width: 50.0,
|
width: 50.0,
|
||||||
height: 50.0,
|
height: 50.0,
|
||||||
child: new Text(
|
child: Text(
|
||||||
text,
|
text,
|
||||||
style: TextStyle(color: Colors.white),
|
style: TextStyle(color: Colors.white),
|
||||||
),
|
),
|
||||||
@ -36,8 +33,7 @@ class SizeBoxDefault extends StatelessWidget {
|
|||||||
final double curWidth;
|
final double curWidth;
|
||||||
final double curHeight;
|
final double curHeight;
|
||||||
|
|
||||||
SizeBoxDefault({Key key, this.curHeight, this.curWidth})
|
SizeBoxDefault({Key key, this.curHeight, this.curWidth}) : super(key: key);
|
||||||
: super(key: key);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_go/components/widget_demo.dart';
|
import 'package:flutter_go/components/widget_demo.dart';
|
||||||
import './demo.dart' as sizeBox;
|
import './demo.dart';
|
||||||
|
|
||||||
// const String _Text = """### **SizeBox简介**
|
// const String _Text = """### **SizeBox简介**
|
||||||
// > 常用的一个控件,设置具体尺寸。
|
// > 常用的一个控件,设置具体尺寸。
|
||||||
@ -53,47 +53,47 @@ class _DemoState extends State<Demo> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Column _sizedOverflowBoxCreate() {
|
Column _sizedOverflowBoxCreate() {
|
||||||
return new Column(
|
return Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
sizeBox.SizeBoxDefault(
|
SizeBoxDefault(
|
||||||
curWidth: 200.0,
|
curWidth: 200.0,
|
||||||
curHeight: 50.0,
|
curHeight: 50.0,
|
||||||
),
|
),
|
||||||
SizedBox(height: 20.0),
|
SizedBox(height: 20.0),
|
||||||
Container(
|
Container(
|
||||||
margin: new EdgeInsets.only(top: 10.0),
|
margin: EdgeInsets.only(top: 10.0),
|
||||||
color: Color(0xffd81b60),
|
color: Color(0xffd81b60),
|
||||||
width: 200.0,
|
width: 200.0,
|
||||||
height: 50.0,
|
height: 50.0,
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
margin: new EdgeInsets.only(top: 10.0),
|
margin: EdgeInsets.only(top: 10.0),
|
||||||
color: Color(0xffd81b60),
|
color: Color(0xffd81b60),
|
||||||
alignment: Alignment.topCenter,
|
alignment: Alignment.topCenter,
|
||||||
width: 200.0,
|
width: 200.0,
|
||||||
height: 50.0,
|
height: 50.0,
|
||||||
child: sizeBox.SizeOverflowBoxDefault(
|
child: SizeOverflowBoxDefault(
|
||||||
text: "SizeBox",
|
text: "SizeBox",
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
margin: new EdgeInsets.only(top: 10.0),
|
margin: EdgeInsets.only(top: 10.0),
|
||||||
color: Color(0xffd81b60),
|
color: Color(0xffd81b60),
|
||||||
width: 200.0,
|
width: 200.0,
|
||||||
height: 50.0,
|
height: 50.0,
|
||||||
child: sizeBox.SizeOverflowBoxDefault(
|
child: SizeOverflowBoxDefault(
|
||||||
text: "box",
|
text: "box",
|
||||||
curSizeWidth: 100.0,
|
curSizeWidth: 100.0,
|
||||||
curSizeHeight: 20.0,
|
curSizeHeight: 20.0,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
margin: new EdgeInsets.only(top: 10.0),
|
margin: EdgeInsets.only(top: 10.0),
|
||||||
color: Color(0xffd81b60),
|
color: Color(0xffd81b60),
|
||||||
width: 200.0,
|
width: 200.0,
|
||||||
height: 50.0,
|
height: 50.0,
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: sizeBox.SizeOverflowBoxDefault(
|
child: SizeOverflowBoxDefault(
|
||||||
text: "box",
|
text: "box",
|
||||||
curSizeWidth: 100.0,
|
curSizeWidth: 100.0,
|
||||||
curSizeHeight: 20.0,
|
curSizeHeight: 20.0,
|
||||||
|
@ -1 +0,0 @@
|
|||||||
|
|
@ -1,49 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_go/components/widget_demo.dart';
|
|
||||||
|
|
||||||
const String _Text = """### **TextBox简介**
|
|
||||||
> 是一个包含一段文本的矩形
|
|
||||||
- 它与rect类似,不过包含一个固定的TextDirection。
|
|
||||||
- sizebox的width,heigh为null,child自身设置
|
|
||||||
### **属性**
|
|
||||||
> width:宽
|
|
||||||
> height:高
|
|
||||||
- ex:200*50 sizebox
|
|
||||||
""";
|
|
||||||
|
|
||||||
class Demo extends StatefulWidget {
|
|
||||||
static const String routeName = '/element/Frame/Box/TextBox';
|
|
||||||
|
|
||||||
_DemoState createState() => _DemoState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _DemoState extends State<Demo> {
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return WidgetDemo(
|
|
||||||
title: 'TextBox',
|
|
||||||
codeUrl: 'elements/Frame/Box/TextBox/demo.dart',
|
|
||||||
contentList: [
|
|
||||||
_Text,
|
|
||||||
_creatTexbox(),
|
|
||||||
],
|
|
||||||
docUrl: 'https://docs.flutter.io/flutter/dart-ui/TextBox-class.html',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Column _creatTexbox() {
|
|
||||||
return Column(
|
|
||||||
children: <Widget>[
|
|
||||||
// Text("TextBox ",textDirection: new TextBox.fo,),
|
|
||||||
Container(
|
|
||||||
// child: TextBox.fromLTRB(270.0, 180.0, 1360.0, 730.0,TextDirection.rtl),
|
|
||||||
|
|
||||||
)
|
|
||||||
|
|
||||||
// centerSlice: new Rect.fromLTRB(270.0, 180.0, 1360.0, 730.0),
|
|
||||||
|
|
||||||
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
@ -6,7 +6,7 @@ class UnconstrainedBoxDemo extends StatelessWidget {
|
|||||||
return UnconstrainedBox(
|
return UnconstrainedBox(
|
||||||
constrainedAxis: Axis.vertical,
|
constrainedAxis: Axis.vertical,
|
||||||
textDirection: TextDirection.rtl,
|
textDirection: TextDirection.rtl,
|
||||||
child: new Row(
|
child: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Container(
|
Container(
|
||||||
width: 100.0,
|
width: 100.0,
|
||||||
|
@ -5,7 +5,6 @@ import 'ConstrainedBox/index.dart' as ConstrainedBox;
|
|||||||
import 'DecoratedBox/index.dart' as DecoratedBox;
|
import 'DecoratedBox/index.dart' as DecoratedBox;
|
||||||
import 'SizeBox/index.dart' as SizeBox;
|
import 'SizeBox/index.dart' as SizeBox;
|
||||||
import 'SizedOverflowBox/index.dart' as SizedOverflowBox;
|
import 'SizedOverflowBox/index.dart' as SizedOverflowBox;
|
||||||
import 'TextBox/index.dart' as TextBox;
|
|
||||||
import 'UnconstrainedBox/index.dart' as UnconstrainedBox;
|
import 'UnconstrainedBox/index.dart' as UnconstrainedBox;
|
||||||
import 'OverflowBox/index.dart' as OverflowBox;
|
import 'OverflowBox/index.dart' as OverflowBox;
|
||||||
import 'FittedBox/index.dart' as FittedBox;
|
import 'FittedBox/index.dart' as FittedBox;
|
||||||
@ -33,11 +32,6 @@ List<WidgetPoint> widgetPoints = [
|
|||||||
routerName: SizedOverflowBox.Demo.routeName,
|
routerName: SizedOverflowBox.Demo.routeName,
|
||||||
buildRouter: (BuildContext context) => SizedOverflowBox.Demo(),
|
buildRouter: (BuildContext context) => SizedOverflowBox.Demo(),
|
||||||
),
|
),
|
||||||
WidgetPoint(
|
|
||||||
name: 'TextBox',
|
|
||||||
routerName: TextBox.Demo.routeName,
|
|
||||||
buildRouter: (BuildContext context) => TextBox.Demo(),
|
|
||||||
),
|
|
||||||
WidgetPoint(
|
WidgetPoint(
|
||||||
name: 'UnconstrainedBox',
|
name: 'UnconstrainedBox',
|
||||||
routerName: UnconstrainedBox.Demo.routeName,
|
routerName: UnconstrainedBox.Demo.routeName,
|
||||||
|
@ -14,57 +14,57 @@ class ExpandedDemo extends StatelessWidget {
|
|||||||
return Column(
|
return Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text('Expanded'),
|
Text('Expanded'),
|
||||||
new Row(children: <Widget>[
|
Row(children: <Widget>[
|
||||||
new RaisedButton(
|
RaisedButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
print('点击红色按钮事件');
|
print('点击红色按钮事件');
|
||||||
},
|
},
|
||||||
color: const Color(0xffcc0000),
|
color: const Color(0xffcc0000),
|
||||||
child: new Text('红色按钮',style: txtColor,),
|
child: Text('红色按钮',style: txtColor,),
|
||||||
),
|
),
|
||||||
new Expanded(
|
Expanded(
|
||||||
flex: 1,//flex用来设置当前可用空间的占优比
|
flex: 1,//flex用来设置当前可用空间的占优比
|
||||||
child: new RaisedButton(
|
child: RaisedButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
print('点击黄色按钮事件');
|
print('点击黄色按钮事件');
|
||||||
},
|
},
|
||||||
color: const Color(0xfff1c232),
|
color: const Color(0xfff1c232),
|
||||||
child: new Text('黄色按钮',style: txtColor,),
|
child: Text('黄色按钮',style: txtColor,),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
new RaisedButton(
|
RaisedButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
print('点击粉色按钮事件');
|
print('点击粉色按钮事件');
|
||||||
},
|
},
|
||||||
color: const Color(0xffea9999),
|
color: const Color(0xffea9999),
|
||||||
child: new Text('粉色按钮',style: txtColor,),
|
child: Text('粉色按钮',style: txtColor,),
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
Text('Flexible'),
|
Text('Flexible'),
|
||||||
new Row(children: <Widget>[
|
Row(children: <Widget>[
|
||||||
new RaisedButton(
|
RaisedButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
print('点击红色按钮事件');
|
print('点击红色按钮事件');
|
||||||
},
|
},
|
||||||
color: const Color(0xffcc0000),
|
color: const Color(0xffcc0000),
|
||||||
child: new Text('红色按钮',style: txtColor,),
|
child: Text('红色按钮',style: txtColor,),
|
||||||
),
|
),
|
||||||
new Flexible(
|
Flexible(
|
||||||
flex: 1,
|
flex: 1,
|
||||||
child: new RaisedButton(
|
child: RaisedButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
print('点击黄色按钮事件');
|
print('点击黄色按钮事件');
|
||||||
},
|
},
|
||||||
color: const Color(0xfff1c232),
|
color: const Color(0xfff1c232),
|
||||||
child: new Text('黄色按钮',style: txtColor,),
|
child: Text('黄色按钮',style: txtColor,),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
new RaisedButton(
|
RaisedButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
print('点击粉色按钮事件');
|
print('点击粉色按钮事件');
|
||||||
},
|
},
|
||||||
color: const Color(0xffea9999),
|
color: const Color(0xffea9999),
|
||||||
child: new Text('粉色按钮',style: txtColor,),
|
child: Text('粉色按钮',style: txtColor,),
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
],
|
],
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user