refactor:按照代码规范调整markdow解析

This commit is contained in:
ryan
2019-02-19 15:14:23 +08:00
parent 633f34fd92
commit 8895243a87
26 changed files with 438 additions and 879 deletions

View File

@ -27,6 +27,7 @@
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 */; };
@ -74,6 +75,7 @@
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>"; };
@ -146,6 +148,7 @@
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 */,
@ -271,6 +274,7 @@
0828E4A2220692B500A59437 /* iPhone Portrait-Retina HD 5.5.png in Resources */, 0828E4A2220692B500A59437 /* iPhone Portrait-Retina HD 5.5.png in Resources */,
0828E49A220692B500A59437 /* iPhone X_XS Portrait.png in Resources */, 0828E49A220692B500A59437 /* iPhone X_XS Portrait.png in Resources */,
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */,
0828E49E220692B500A59437 /* iPad Portrait@2x.png in Resources */, 0828E49E220692B500A59437 /* iPad Portrait@2x.png in Resources */,
0828E49D220692B500A59437 /* iPhone Portrait@2x.png in Resources */, 0828E49D220692B500A59437 /* iPhone Portrait@2x.png in Resources */,
0828E499220692B500A59437 /* iPhone Portrait-Retina HD 4.7.png in Resources */, 0828E499220692B500A59437 /* iPhone Portrait-Retina HD 4.7.png in Resources */,

View File

@ -6,7 +6,6 @@
/// target: AppBar 的示例 /// target: AppBar 的示例
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import './demo.dart' as AppBarDemo; import './demo.dart' as AppBarDemo;
import 'package:flutter_go/components/widget_demo.dart'; import 'package:flutter_go/components/widget_demo.dart';
@ -47,7 +46,7 @@ class _DemoState extends State<Demo> {
return WidgetDemo( return WidgetDemo(
title: 'AppBar', title: 'AppBar',
codeUrl: 'components/Bar/AppBar/demo.dart', codeUrl: 'components/Bar/AppBar/demo.dart',
contentList: [allDomes(context, this)], contentList: allDomes(context, this),
docUrl: 'https://docs.flutter.io/flutter/material/AppBar-class.html', docUrl: 'https://docs.flutter.io/flutter/material/AppBar-class.html',
); );
} }
@ -56,36 +55,17 @@ class _DemoState extends State<Demo> {
// 所有的 AppBar widget // 所有的 AppBar widget
// context: 运行上下文 // context: 运行上下文
// that: 指向有状态的 StatefulWidget // that: 指向有状态的 StatefulWidget
Widget allDomes(BuildContext context, _DemoState that) { List allDomes(BuildContext context, _DemoState that) {
return Container( return [
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), _Text0,
child: Column(
//mainAxisSize: MainAxisSize.max,
children: <Widget>[
MarkdownBody(data: _Text0),
SizedBox(height: 20.0), // 间距 SizedBox(height: 20.0), // 间距
MarkdownBody(data: _Text1), _Text1,
SizedBox(height: 20.0), // 间距 SizedBox(height: 20.0), // 间距
AppBarDemo.AppBarLessDefaultSimple(), AppBarDemo.AppBarLessDefaultSimple(),
SizedBox(height: 20.0), // 间距 SizedBox(height: 20.0), // 间距
MarkdownBody(data: _Text2), _Text2,
SizedBox(height: 20.0), // 间距 SizedBox(height: 20.0), // 间距
AppBarDemo.AppBarLessDefaultComplex(), AppBarDemo.AppBarLessDefaultComplex(),
SizedBox(height: 20.0), // 间距 SizedBox(height: 20.0), // 间距
]) ];
);
} }
// 带align的text
Widget textAlignBar(String txt) {
return Align(
alignment: FractionalOffset.centerLeft,
child: Column(
children: <Widget>[
SizedBox(height: 20.0),
MarkdownBody(data: txt)
])
);
}

View File

@ -9,7 +9,6 @@ import 'package:flutter_go/components/widget_demo.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import './demo.dart' as BottomAppBarDemo; import './demo.dart' as BottomAppBarDemo;
const String _Text0 = const String _Text0 =
@ -38,7 +37,7 @@ class _DemoState extends State<Demo> {
return WidgetDemo( return WidgetDemo(
title: 'BottomAppBar', title: 'BottomAppBar',
codeUrl: 'components/Bar/BottomAppBar/demo.dart', codeUrl: 'components/Bar/BottomAppBar/demo.dart',
contentList: [allDomes(context, this)], contentList: allDomes(context, this),
docUrl: 'https://docs.flutter.io/flutter/material/BottomAppBar-class.html', docUrl: 'https://docs.flutter.io/flutter/material/BottomAppBar-class.html',
); );
} }
@ -47,20 +46,15 @@ class _DemoState extends State<Demo> {
// 所有的 BottomAppBar widget // 所有的 BottomAppBar widget
// context: 运行上下文 // context: 运行上下文
// that: 指向有状态的 StatefulWidget // that: 指向有状态的 StatefulWidget
Widget allDomes(BuildContext context, _DemoState that) { List allDomes(BuildContext context, _DemoState that) {
return Container( return [
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), _Text0,
child: Column(
//mainAxisSize: MainAxisSize.max,
children: <Widget>[
MarkdownBody(data: _Text0),
SizedBox(height: 20.0), // 间距 SizedBox(height: 20.0), // 间距
MarkdownBody(data: _Text1), _Text1,
SizedBox(height: 20.0), // 间距 SizedBox(height: 20.0), // 间距
BottomAppBarDemo.AppBarLessDefaultSimple(), BottomAppBarDemo.AppBarLessDefaultSimple(),
SizedBox(height: 20.0), // 间距 SizedBox(height: 20.0), // 间距
]) ];
);
} }

View File

@ -9,7 +9,6 @@ import 'package:flutter_go/components/widget_demo.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import './demo.dart' as ButtonBarDemo; import './demo.dart' as ButtonBarDemo;
const String _Text0 = const String _Text0 =
@ -41,7 +40,7 @@ class _DemoState extends State<Demo> {
return WidgetDemo( return WidgetDemo(
title: 'ButtonBar', title: 'ButtonBar',
codeUrl: 'components/Bar/ButtonBar/demo.dart', codeUrl: 'components/Bar/ButtonBar/demo.dart',
contentList: [allDomes(context, this)], contentList: allDomes(context, this),
docUrl: 'https://docs.flutter.io/flutter/material/ButtonBar-class.html', docUrl: 'https://docs.flutter.io/flutter/material/ButtonBar-class.html',
); );
} }
@ -50,18 +49,13 @@ class _DemoState extends State<Demo> {
// 所有的 ButtonBar widget // 所有的 ButtonBar widget
// context: 运行上下文 // context: 运行上下文
// that: 指向有状态的 StatefulWidget // that: 指向有状态的 StatefulWidget
Widget allDomes(BuildContext context, _DemoState that) { List allDomes(BuildContext context, _DemoState that) {
return Container( return [
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), _Text0,
child: Column(
//mainAxisSize: MainAxisSize.max,
children: <Widget>[
MarkdownBody(data: _Text0),
SizedBox(height: 20.0), // 间距 SizedBox(height: 20.0), // 间距
MarkdownBody(data: _Text1), _Text1,
//SizedBox(height: 20.0), // 间距 //SizedBox(height: 20.0), // 间距
ButtonBarDemo.ButtonBarLessDefault() ButtonBarDemo.ButtonBarLessDefault()
]) ];
);
} }

View File

@ -9,7 +9,6 @@ import 'package:flutter_go/components/widget_demo.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import './demo.dart' as FlexibleSpaceBarDemo; import './demo.dart' as FlexibleSpaceBarDemo;
const String _Text0 = const String _Text0 =
@ -28,7 +27,7 @@ const String _Text1 =
class Demo extends StatefulWidget { class Demo extends StatefulWidget {
static const String routeName = '/components//Bar/FlexibleSpaceBar'; static const String routeName = '/components/Bar/FlexibleSpaceBar';
@override @override
_DemoState createState() => _DemoState(); _DemoState createState() => _DemoState();
@ -40,7 +39,7 @@ class _DemoState extends State<Demo> {
return WidgetDemo( return WidgetDemo(
title: 'FlexibleSpaceBar', title: 'FlexibleSpaceBar',
codeUrl: 'components/Bar/FlexibleSpaceBar/demo.dart', codeUrl: 'components/Bar/FlexibleSpaceBar/demo.dart',
contentList: [allDomes(context, this)], contentList: allDomes(context, this),
docUrl: 'https://docs.flutter.io/flutter/material/FlexibleSpaceBar-class.html', docUrl: 'https://docs.flutter.io/flutter/material/FlexibleSpaceBar-class.html',
); );
} }
@ -49,19 +48,14 @@ class _DemoState extends State<Demo> {
// 所有的 FlexibleSpaceBar widget // 所有的 FlexibleSpaceBar widget
// context: 运行上下文 // context: 运行上下文
// that: 指向有状态的 StatefulWidget // that: 指向有状态的 StatefulWidget
Widget allDomes(BuildContext context, _DemoState that) { List allDomes(BuildContext context, _DemoState that) {
return Container( return [
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), _Text0,
child: Column(
//mainAxisSize: MainAxisSize.max,
children: <Widget>[
MarkdownBody(data: _Text0),
SizedBox(height: 20.0), // 间距 SizedBox(height: 20.0), // 间距
MarkdownBody(data: _Text1), _Text1,
SizedBox(height: 20.0), // 间距 SizedBox(height: 20.0), // 间距
FlexibleSpaceBarDemo.FlexibleSpaceBarLessDefault(), FlexibleSpaceBarDemo.FlexibleSpaceBarLessDefault(),
SizedBox(height: 20.0), // 间距 SizedBox(height: 20.0), // 间距
]) ];
);
} }

View File

@ -9,7 +9,6 @@ import 'package:flutter_go/components/widget_demo.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import './demo.dart' as SliverAppBarDemo; import './demo.dart' as SliverAppBarDemo;
const String _Text0 = const String _Text0 =
@ -40,7 +39,7 @@ class _DemoState extends State<Demo> {
return WidgetDemo( return WidgetDemo(
title: 'SliverAppBar', title: 'SliverAppBar',
codeUrl: 'components/Bar/SliverAppBar/demo.dart', codeUrl: 'components/Bar/SliverAppBar/demo.dart',
contentList:[allDomes(context, this)], contentList: allDomes(context, this),
docUrl: 'https://docs.flutter.io/flutter/widgets/SliverAppBar-class.html', docUrl: 'https://docs.flutter.io/flutter/widgets/SliverAppBar-class.html',
); );
} }
@ -49,31 +48,13 @@ class _DemoState extends State<Demo> {
// 所有的 SliverAppBar widget // 所有的 SliverAppBar widget
// context: 运行上下文 // context: 运行上下文
// that: 指向有状态的 StatefulWidget // that: 指向有状态的 StatefulWidget
Widget allDomes(BuildContext context, _DemoState that) { List allDomes(BuildContext context, _DemoState that) {
return Container( return [
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), _Text0,
child: Column(
//mainAxisSize: MainAxisSize.max,
children: <Widget>[
MarkdownBody(data: _Text0),
SizedBox(height: 20.0), // 间距 SizedBox(height: 20.0), // 间距
MarkdownBody(data: _Text1), _Text1,
SizedBox(height: 20.0), // 间距 SizedBox(height: 20.0), // 间距
SliverAppBarDemo.SliverAppBarLessDefault() SliverAppBarDemo.SliverAppBarLessDefault()
]) ];
);
} }
// 带align的text
Widget textAlignBar(String txt) {
return Align(
alignment: FractionalOffset.centerLeft,
child: Column(
children: <Widget>[
SizedBox(height: 20.0),
MarkdownBody(data: txt)
])
);
}

View File

@ -4,10 +4,7 @@
/// Time: 上午12:06 /// Time: 上午12:06
/// email: zhu.yan@alibaba-inc.com /// email: zhu.yan@alibaba-inc.com
/// target: SnackBar 的示例 /// target: SnackBar 的示例
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:flutter_go/components/widget_demo.dart'; import 'package:flutter_go/components/widget_demo.dart';
import './demo.dart' as SnackBarDemo; import './demo.dart' as SnackBarDemo;
@ -40,7 +37,7 @@ class _DemoState extends State<Demo> {
return WidgetDemo( return WidgetDemo(
title: 'SnackBar', title: 'SnackBar',
codeUrl: 'components/Bar/SnackBar/demo.dart', codeUrl: 'components/Bar/SnackBar/demo.dart',
contentList: [allDomes(context, this)], contentList: allDomes(context, this),
docUrl: 'https://docs.flutter.io/flutter/material/SnackBar-class.html', docUrl: 'https://docs.flutter.io/flutter/material/SnackBar-class.html',
); );
} }
@ -49,32 +46,13 @@ class _DemoState extends State<Demo> {
// 所有的 SnackBar widget // 所有的 SnackBar widget
// context: 运行上下文 // context: 运行上下文
// that: 指向有状态的 StatefulWidget // that: 指向有状态的 StatefulWidget
Widget allDomes(BuildContext context, _DemoState that) { List allDomes(BuildContext context, _DemoState that) {
return Container( return [
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), _Text0,
child: Column(
//mainAxisSize: MainAxisSize.max,
children: <Widget>[
MarkdownBody(data: _Text0),
SizedBox(height: 20.0), // 间距 SizedBox(height: 20.0), // 间距
MarkdownBody(data: _Text1), _Text1,
SizedBox(height: 20.0), // 间距 SizedBox(height: 20.0), // 间距
SnackBarDemo.SnackBarLessDefault(), SnackBarDemo.SnackBarLessDefault(),
SizedBox(height: 20.0), // 间距 SizedBox(height: 20.0), // 间距
]) ];
);
} }
// 带align的text
Widget textAlignBar(String txt) {
return Align(
alignment: FractionalOffset.centerLeft,
child: Column(
children: <Widget>[
SizedBox(height: 20.0),
MarkdownBody(data: txt)
])
);
}

View File

@ -6,7 +6,6 @@
/// target: Card 的示例 /// target: Card 的示例
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:flutter_go/components/widget_demo.dart'; import 'package:flutter_go/components/widget_demo.dart';
import './demo.dart' as CardDemo; import './demo.dart' as CardDemo;
@ -37,7 +36,7 @@ class _DemoState extends State<Demo> {
return WidgetDemo( return WidgetDemo(
title: 'Card', title: 'Card',
codeUrl: 'components/Card/Card/demo.dart', codeUrl: 'components/Card/Card/demo.dart',
contentList: [allDomes(context, this)], contentList: allDomes(context, this),
docUrl: 'https://docs.flutter.io/flutter/material/Card-class.html', docUrl: 'https://docs.flutter.io/flutter/material/Card-class.html',
); );
} }
@ -47,18 +46,13 @@ class _DemoState extends State<Demo> {
/// 所有的 Card widget /// 所有的 Card widget
/// context: 运行上下文 /// context: 运行上下文
/// that: 指向有状态的 StatefulWidget /// that: 指向有状态的 StatefulWidget
Widget allDomes(BuildContext context, _DemoState that) { List allDomes(BuildContext context, _DemoState that) {
return Container( return [
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), _Text0,
child: Column(
//mainAxisSize: MainAxisSize.max,
children: <Widget>[
MarkdownBody(data: _Text0),
SizedBox(height: 20.0), // 间距 SizedBox(height: 20.0), // 间距
MarkdownBody(data: _Text1), _Text1,
SizedBox(height: 20.0), // 间距 SizedBox(height: 20.0), // 间距
CardDemo.CardLessDefault() CardDemo.CardLessDefault()
]) ];
);
} }

View File

@ -6,12 +6,10 @@
/// target: AnimatedList 的示例 /// target: AnimatedList 的示例
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:flutter_go/components/widget_demo.dart'; import 'package:flutter_go/components/widget_demo.dart';
import './demo.dart'; import './demo.dart';
//var _AnimatedListFullDefault = AnimatedListDemo.AnimatedListFullDefault; //var _AnimatedListFullDefault = AnimatedListDemo.AnimatedListFullDefault;
GlobalKey globalKey = GlobalKey(); GlobalKey globalKey = GlobalKey();
@ -44,7 +42,7 @@ class _DemoState extends State<Demo> {
return WidgetDemo( return WidgetDemo(
title: 'AnimatedList', title: 'AnimatedList',
codeUrl: 'components/List/AnimatedList/demo.dart', codeUrl: 'components/List/AnimatedList/demo.dart',
contentList: [allDemoBoxs(context, this)], contentList: allDemoBoxs(context, this),
docUrl: 'https://docs.flutter.io/flutter/widgets/AnimatedList-class.html', docUrl: 'https://docs.flutter.io/flutter/widgets/AnimatedList-class.html',
); );
} }
@ -54,15 +52,12 @@ class _DemoState extends State<Demo> {
/// 所有的 AnimatedList widget /// 所有的 AnimatedList widget
/// context: 运行上下文 /// context: 运行上下文
/// that: 指向有状态的 StatefulWidget /// that: 指向有状态的 StatefulWidget
Widget allDemoBoxs(BuildContext context, _DemoState that) { List allDemoBoxs(BuildContext context, _DemoState that) {
return Container( return [
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), _Text0,
child: Column( SizedBox(height: 20.0),
//mainAxisSize: MainAxisSize.max, // 间距
children: <Widget>[ _Text1,
MarkdownBody(data: _Text0),
SizedBox(height: 20.0), // 间距
MarkdownBody(data: _Text1),
ButtonBar( ButtonBar(
alignment: MainAxisAlignment.spaceAround, alignment: MainAxisAlignment.spaceAround,
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
@ -73,10 +68,9 @@ Widget allDemoBoxs(BuildContext context, _DemoState that) {
], ],
), ),
//AnimatedListDemo.AnimatedListFullDefault(key:globalKey,parent:context), //AnimatedListDemo.AnimatedListFullDefault(key:globalKey,parent:context),
AnimatedListFullDefault(key:globalKey,parent:that), AnimatedListFullDefault(key: globalKey, parent: that),
SizedBox(height: 20.0), // 间距 SizedBox(height: 20.0), // 间距
]) ];
);
} }

View File

@ -5,12 +5,10 @@
/// email: zhu.yan@alibaba-inc.com /// email: zhu.yan@alibaba-inc.com
/// target: ListBody 的示例 /// target: ListBody 的示例
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:flutter_go/components/widget_demo.dart'; import 'package:flutter_go/components/widget_demo.dart';
import './demo.dart' as ListBodyDemo; import './demo.dart' as ListBodyDemo;
const String _Text0 = const String _Text0 =
@ -42,7 +40,7 @@ class _DemoState extends State<Demo> {
return WidgetDemo( return WidgetDemo(
title: 'ListBody', title: 'ListBody',
codeUrl: 'components/List/ListBody/demo.dart', codeUrl: 'components/List/ListBody/demo.dart',
contentList: [allCheckboxs(context, this)], contentList: allDomeBox(context, this),
docUrl: 'https://docs.flutter.io/flutter/widgets/ListBody-class.html', docUrl: 'https://docs.flutter.io/flutter/widgets/ListBody-class.html',
); );
} }
@ -52,18 +50,13 @@ class _DemoState extends State<Demo> {
/// 所有的 ListBody widget /// 所有的 ListBody widget
/// context: 运行上下文 /// context: 运行上下文
/// that: 指向有状态的 StatefulWidget /// that: 指向有状态的 StatefulWidget
Widget allCheckboxs(BuildContext context, _DemoState that) { List allDomeBox(BuildContext context, _DemoState that) {
return Container( return [
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), _Text0,
child: Column(
//mainAxisSize: MainAxisSize.max,
children: <Widget>[
MarkdownBody(data: _Text0),
SizedBox(height: 20.0), // 间距 SizedBox(height: 20.0), // 间距
MarkdownBody(data: _Text1), _Text1,
SizedBox(height: 20.0), // 间距 SizedBox(height: 20.0), // 间距
ListBodyDemo.ListBodyLessDefault(), ListBodyDemo.ListBodyLessDefault(),
SizedBox(height: 20.0), // 间距 SizedBox(height: 20.0), // 间距
]) ];
);
} }

View File

@ -6,9 +6,9 @@
/// target: ListView 的示例 /// target: ListView 的示例
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:flutter_go/components/widget_demo.dart'; import 'package:flutter_go/components/widget_demo.dart';
import './demo.dart' as ListViewDemo; import './demo.dart' as ListViewDemo;
const String _Text0 = const String _Text0 =
@ -67,7 +67,7 @@ class _DemoState extends State<Demo> {
return WidgetDemo( return WidgetDemo(
title: 'ListView', title: 'ListView',
codeUrl: 'components/List/ListView/demo.dart', codeUrl: 'components/List/ListView/demo.dart',
contentList: [allCheckboxs(context, this)], contentList: allDomeBox(context, this),
docUrl: 'https://docs.flutter.io/flutter/widgets/ListView-class.html', docUrl: 'https://docs.flutter.io/flutter/widgets/ListView-class.html',
); );
} }
@ -76,41 +76,23 @@ class _DemoState extends State<Demo> {
/// 所有的 ListView widget /// 所有的 ListView widget
/// context: 运行上下文 /// context: 运行上下文
/// that: 指向有状态的 StatefulWidget /// that: 指向有状态的 StatefulWidget
Widget allCheckboxs(BuildContext context, _DemoState that) { List allDomeBox(BuildContext context, _DemoState that) {
return Container( return [
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), _Text0,
child: Column(
//mainAxisSize: MainAxisSize.max,
children: <Widget>[
MarkdownBody(data: _Text0),
SizedBox(height: 20.0), // 间距 SizedBox(height: 20.0), // 间距
MarkdownBody(data: _Text1), _Text1,
SizedBox(height: 20.0), // 间距 SizedBox(height: 20.0), // 间距
MarkdownBody(data: _Text2), _Text2,
ListViewDemo.ListViewLessDefault(0), ListViewDemo.ListViewLessDefault(0),
MarkdownBody(data: _Text3), _Text3,
ListViewDemo.ListViewLessDefault(1), ListViewDemo.ListViewLessDefault(1),
SizedBox(height: 20.0), // 间距 SizedBox(height: 20.0), // 间距
MarkdownBody(data: _Text4), _Text4,
ListViewDemo.ListViewLessDefault(2), ListViewDemo.ListViewLessDefault(2),
SizedBox(height: 20.0), // 间距 SizedBox(height: 20.0), // 间距
MarkdownBody(data: _Text5), _Text5,
ListViewDemo.ListViewLessDefault(3), ListViewDemo.ListViewLessDefault(3),
]) ];
);
}
/// 带align的text
Widget textAlignBar(String txt) {
return Align(
alignment: FractionalOffset.centerLeft,
child: Column(
children: <Widget>[
SizedBox(height: 20.0),
MarkdownBody(data: txt)
])
);
} }

View File

@ -6,9 +6,9 @@
/// target: BottomNavigationBar 的示例 /// target: BottomNavigationBar 的示例
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:flutter_go/components/widget_demo.dart'; import 'package:flutter_go/components/widget_demo.dart';
import './demo.dart' as BottomNavigationBarDemo; import './demo.dart' as BottomNavigationBarDemo;
const String _text0 = const String _text0 =
@ -41,7 +41,7 @@ class _DemoState extends State<Demo> {
return WidgetDemo( return WidgetDemo(
title: 'BottomNavigationBar', title: 'BottomNavigationBar',
codeUrl: 'components/Navigation/BottomNavigationBar/demo.dart', codeUrl: 'components/Navigation/BottomNavigationBar/demo.dart',
contentList: [allDemoBoxs(context, this)], contentList: allDemoBoxs(context, this),
docUrl: 'https://docs.flutter.io/flutter/material/BottomNavigationBar-class.html', docUrl: 'https://docs.flutter.io/flutter/material/BottomNavigationBar-class.html',
bottomNaviBar:BottomNavigationBarDemo.BottomNavigationBarFullDefault() bottomNaviBar:BottomNavigationBarDemo.BottomNavigationBarFullDefault()
); );
@ -52,14 +52,10 @@ class _DemoState extends State<Demo> {
// 所有的 BottomNavigationBar widget // 所有的 BottomNavigationBar widget
// context: 运行上下文 // context: 运行上下文
// that: 指向有状态的 StatefulWidget // that: 指向有状态的 StatefulWidget
Widget allDemoBoxs(BuildContext context, _DemoState that) { List allDemoBoxs(BuildContext context, _DemoState that) {
return Container( return [
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), _text0,
child: Column( _text1,
//mainAxisSize: MainAxisSize.max,
children: <Widget>[
MarkdownBody(data: _text0),
textAlignBar(_text1),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
@ -68,21 +64,7 @@ Widget allDemoBoxs(BuildContext context, _DemoState that) {
], ],
), ),
SizedBox(width: 20.0), // 间距 SizedBox(width: 20.0), // 间距
]) ];
);
}
// 带align的text
Widget textAlignBar(String txt) {
return Align(
alignment: FractionalOffset.centerLeft,
child: Column(
children: <Widget>[
SizedBox(height: 20.0),
MarkdownBody(data: txt)
])
);
} }

View File

@ -9,7 +9,6 @@ import 'package:flutter_go/components/widget_demo.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import './demo.dart' as BottomNavigationBarItemDemo; import './demo.dart' as BottomNavigationBarItemDemo;
const String _Text0 = const String _Text0 =
@ -18,13 +17,11 @@ const String _Text0 =
- material 的 BottomNavigationBar 或带有图标和标题的 iOS主题 CupertinoTabBar 中的交互式按钮; - material 的 BottomNavigationBar 或带有图标和标题的 iOS主题 CupertinoTabBar 中的交互式按钮;
"""; """;
const String _Text1 = const String _Text1 =
"""### **基本用法** """### **基本用法**
> 这个类很少单独使用。通常嵌入在上面的一个底部 bottom navigation widgets 中; > 这个类很少单独使用。通常嵌入在上面的一个底部 bottom navigation widgets 中;
"""; """;
class Demo extends StatefulWidget { class Demo extends StatefulWidget {
static const String routeName = '/components/Navigation/BottomNavigationBarItem'; static const String routeName = '/components/Navigation/BottomNavigationBarItem';
@ -38,7 +35,7 @@ class _DemoState extends State<Demo> {
return WidgetDemo( return WidgetDemo(
title: 'BottomNavigationBarItem', title: 'BottomNavigationBarItem',
codeUrl: 'components/Navigation/BottomNavigationBarItem/demo.dart', codeUrl: 'components/Navigation/BottomNavigationBarItem/demo.dart',
contentList: [allCheckboxs(context, this)], contentList: allDomeBox(context, this),
docUrl: 'https://docs.flutter.io/flutter/widgets/BottomNavigationBarItem-class.html', docUrl: 'https://docs.flutter.io/flutter/widgets/BottomNavigationBarItem-class.html',
); );
} }
@ -48,33 +45,16 @@ class _DemoState extends State<Demo> {
// 所有的 BottomNavigationBarItem widget // 所有的 BottomNavigationBarItem widget
// context: 运行上下文 // context: 运行上下文
// that: 指向有状态的 StatefulWidget // that: 指向有状态的 StatefulWidget
Widget allCheckboxs(BuildContext context, _DemoState that) { List allDomeBox(BuildContext context, _DemoState that) {
return Container( return [
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), _Text0,
child: Column(
//mainAxisSize: MainAxisSize.max,
children: <Widget>[
MarkdownBody(data: _Text0),
SizedBox(height: 20.0), // 间距 SizedBox(height: 20.0), // 间距
MarkdownBody(data: _Text1), _Text1,
SizedBox(height: 20.0), // 间距 SizedBox(height: 20.0), // 间距
BottomNavigationBarItemDemo.BottomNavigationBarItemLessDefault(), BottomNavigationBarItemDemo.BottomNavigationBarItemLessDefault(),
SizedBox(height: 20.0), // 间距 SizedBox(height: 20.0), // 间距
]) ];
);
} }
// 带align的text
Widget textAlignBar(String txt) {
return Align(
alignment: FractionalOffset.centerLeft,
child: Column(
children: <Widget>[
SizedBox(height: 20.0),
MarkdownBody(data: txt)
])
);
}

View File

@ -1,4 +1,4 @@
/// Created with 菜鸟手册. /// Created with FlutterGo.
/// User: 一晟 /// User: 一晟
/// Date: 2018/11/14 /// Date: 2018/11/14
/// Time: 下午4:31 /// Time: 下午4:31
@ -6,9 +6,6 @@
/// target: DropdownButton 的示例 /// target: DropdownButton 的示例
/// 对应文档地址:https://docs.flutter.io/flutter/material/DropdownButton-class.html /// 对应文档地址:https://docs.flutter.io/flutter/material/DropdownButton-class.html
import 'package:flutter_markdown/flutter_markdown.dart';
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';
@ -50,21 +47,17 @@ class _DemoState extends State<Demo> {
return WidgetDemo( return WidgetDemo(
title: 'DropdownButton', title: 'DropdownButton',
codeUrl: 'elements/Form/Button/DropdownButton/demo.dart', codeUrl: 'elements/Form/Button/DropdownButton/demo.dart',
contentList: [allDropdownButtons(context,this)], contentList: allDropdownButtons(context,this),
docUrl: 'https://docs.flutter.io/flutter/material/DropdownButton-class.html', docUrl: 'https://docs.flutter.io/flutter/material/DropdownButton-class.html',
); );
} }
} }
// 所有的 DropdownButton 按钮 // 所有的 DropdownButton 按钮
Widget allDropdownButtons(BuildContext context,_DemoState that){ List allDropdownButtons(BuildContext context,_DemoState that){
return Container( return [
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), _dropdownText0,
child: Column( _dropdownText1,
//mainAxisSize: MainAxisSize.max,
children: <Widget>[
MarkdownBody(data: _dropdownText0),
textAlignBar(_dropdownText1),
ButtonBar( ButtonBar(
alignment: MainAxisAlignment.spaceAround, alignment: MainAxisAlignment.spaceAround,
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
@ -72,25 +65,10 @@ Widget allDropdownButtons(BuildContext context,_DemoState that){
dropdownButton.DropdownButtonDefault(), dropdownButton.DropdownButtonDefault(),
], ],
), ),
textAlignBar(_dropdownText2), _dropdownText2,
SizedBox(height: 10.0), SizedBox(height: 10.0),
dropdownButton.DropdownButtonCustom(context.widget,that), dropdownButton.DropdownButtonCustom(context.widget, that),
SizedBox(height: 20.0) SizedBox(height: 20.0)
]) ];
);
}
// 带align的text
Widget textAlignBar(String txt){
//style: TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
return Align(
alignment: FractionalOffset.centerLeft,
child: Column(
children: <Widget>[
SizedBox(height: 20.0),
MarkdownBody(data: txt)
// Text(txt, style: TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
])
);
} }

View File

@ -1,4 +1,4 @@
/// Created with 菜鸟手册. /// Created with FlutterGo.
/// User: 一晟 /// User: 一晟
/// Date: 2018/11/14 /// Date: 2018/11/14
/// Time: 下午4:31 /// Time: 下午4:31
@ -6,9 +6,6 @@
/// target: FlatButton 的示例 /// target: FlatButton 的示例
/// 对应文档地址:https://docs.flutter.io/flutter/material/FlatButton-class.html /// 对应文档地址:https://docs.flutter.io/flutter/material/FlatButton-class.html
import 'package:flutter_markdown/flutter_markdown.dart';
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';
@ -51,21 +48,17 @@ class _DemoState extends State<Demo> {
return WidgetDemo( return WidgetDemo(
title: 'FlatButton', title: 'FlatButton',
codeUrl: 'elements/Form/Button/FlatButton/demo.dart', codeUrl: 'elements/Form/Button/FlatButton/demo.dart',
contentList: [allFlatButtons(context)], contentList: allFlatButtons(context),
docUrl: 'https://docs.flutter.io/flutter/material/FlatButton-class.html', docUrl: 'https://docs.flutter.io/flutter/material/FlatButton-class.html',
); );
} }
} }
// 所有的 FlatButton 按钮 // 所有的 FlatButton 按钮
Widget allFlatButtons(BuildContext context){ List allFlatButtons(BuildContext context){
return Container( return [
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), _flatText0,
child: Column( _flatText1,
//mainAxisSize: MainAxisSize.max,
children: <Widget>[
MarkdownBody(data: _flatText0),
textAlignBar(_flatText1),
ButtonBar( ButtonBar(
alignment: MainAxisAlignment.spaceAround, alignment: MainAxisAlignment.spaceAround,
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
@ -75,7 +68,7 @@ Widget allFlatButtons(BuildContext context){
flatButton.FlatButtonDefault(false), flatButton.FlatButtonDefault(false),
], ],
), ),
textAlignBar(_flatText2), _flatText2,
ButtonBar( ButtonBar(
alignment: MainAxisAlignment.spaceAround, alignment: MainAxisAlignment.spaceAround,
//mainAxisSize: MainAxisSize.min, //mainAxisSize: MainAxisSize.min,
@ -92,7 +85,7 @@ Widget allFlatButtons(BuildContext context){
flatButton.FlatButtonIconDefault(true, Icons.announcement), flatButton.FlatButtonIconDefault(true, Icons.announcement),
], ],
), ),
textAlignBar(_flatText3), _flatText3,
//flatButton.FlatButtonCustom(context,'主要按钮',Colors.blue), //flatButton.FlatButtonCustom(context,'主要按钮',Colors.blue),
flatButton.FlatButtonCustom('主要按钮',Colors.blue), flatButton.FlatButtonCustom('主要按钮',Colors.blue),
SizedBox(height: 10.0), SizedBox(height: 10.0),
@ -108,8 +101,7 @@ Widget allFlatButtons(BuildContext context){
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)
]) ];
);
} }
// alert 弹框 // alert 弹框
@ -134,17 +126,3 @@ void _showMessage(String name, BuildContext context) {
} }
); );
} }
// 带align的text
Widget textAlignBar(String txt){
//style: TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
return Align(
alignment: FractionalOffset.centerLeft,
child: Column(
children: <Widget>[
SizedBox(height: 20.0),
MarkdownBody(data: txt)
// Text(txt, style: TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
])
);
}

View File

@ -42,7 +42,7 @@ class FloatingActionButtonCustom extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final _onPressed = onPressed; final _onPressed = (onPressed is Function) ? onPressed : ()=>{};
return FloatingActionButton( return FloatingActionButton(
// 子视图一般为Icon不推荐使用文字 // 子视图一般为Icon不推荐使用文字
child: const Icon(Icons.refresh), child: const Icon(Icons.refresh),

View File

@ -1,4 +1,4 @@
/// Created with 菜鸟手册. /// Created with FlutterGo.
/// User: 一晟 /// User: 一晟
/// Date: 2018/11/14 /// Date: 2018/11/14
/// Time: 下午4:31 /// Time: 下午4:31
@ -7,10 +7,8 @@
/// 对应文档地址:https://docs.flutter.io/flutter/material/FloatingActionButton-class.html /// 对应文档地址:https://docs.flutter.io/flutter/material/FloatingActionButton-class.html
import 'dart:math'; import 'dart:math';
import 'package:flutter_markdown/flutter_markdown.dart';
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 floatingActionButton; import './demo.dart' as floatingActionButton;
@ -63,22 +61,18 @@ class _DemoState extends State<Demo> {
title: 'FloatingActionButton', title: 'FloatingActionButton',
// desc: _floatingActionTitle, // desc: _floatingActionTitle,
codeUrl: 'elements/Form/Button/FloatingActionButton/demo.dart', codeUrl: 'elements/Form/Button/FloatingActionButton/demo.dart',
contentList: [allFloatingActionButtons(context,this)], contentList: allFloatingActionButtons(context,this),
docUrl: 'https://docs.flutter.io/flutter/material/FloatingActionButton-class.html', docUrl: 'https://docs.flutter.io/flutter/material/FloatingActionButton-class.html',
); );
} }
} }
// 所有的 FloatingActionButton 按钮 // 所有的 FloatingActionButton 按钮
Widget allFloatingActionButtons(BuildContext context,_DemoState that){ List allFloatingActionButtons(BuildContext context,_DemoState that){
final ShapeBorder buttonShape = drawShape(that.buttonShapeType); final ShapeBorder buttonShape = drawShape(that.buttonShapeType);
return Container( return [
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), _floatingActionText0,
child: Column( _floatingActionText1,
//mainAxisSize: MainAxisSize.max,
children: <Widget>[
MarkdownBody(data: _floatingActionText0),
textAlignBar(_floatingActionText1),
ButtonBar( ButtonBar(
alignment: MainAxisAlignment.spaceAround, alignment: MainAxisAlignment.spaceAround,
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
@ -88,53 +82,17 @@ Widget allFloatingActionButtons(BuildContext context,_DemoState that){
floatingActionButton.FloatingActionButtonDefault(false), floatingActionButton.FloatingActionButtonDefault(false),
], ],
), ),
textAlignBar(_floatingActionText2), _floatingActionText2,
SizedBox(height: 10.0), SizedBox(height: 10.0),
floatingActionButton.FloatingActionButtonCustom('主要按钮',Colors.deepOrangeAccent,buttonShape), floatingActionButton.FloatingActionButtonCustom(
'主要按钮', Colors.deepOrangeAccent, buttonShape),
SizedBox(height: 20.0), SizedBox(height: 20.0),
textAlignBar(_floatingActionText3), _floatingActionText3,
SizedBox(height: 20.0), SizedBox(height: 20.0),
floatingActionButton.FloatingActionButtonCustom2('扩展按钮',Colors.deepOrangeAccent,buttonShape), floatingActionButton.FloatingActionButtonCustom2(
'扩展按钮', Colors.deepOrangeAccent, buttonShape),
SizedBox(height: 20.0) SizedBox(height: 20.0)
]) ];
);
}
// alert 弹框
// context:容器的父级
// void _showMessage(String name, BuildContext context) {
// showDialog(
// // alert 的父级
// context: context,
// builder: (BuildContext context) {
// return AlertDialog(
// title: Text('提示'),
// content: Text(name),
// actions: <Widget>[
// FlatButton(
// // alert 的取消按钮
// onPressed: () {
// // 取消的事件
// Navigator.of(context).pop(true);
// },
// child: Text('取消'))
// ]);
// }
// );
// }
// 带align的text
Widget textAlignBar(String txt){
//style: TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
return Align(
alignment: FractionalOffset.centerLeft,
child: Column(
children: <Widget>[
SizedBox(height: 20.0),
MarkdownBody(data: txt)
// Text(txt, style: TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
])
);
} }
// 绘制边框信息,比如是否有边框,是否是圆角 // 绘制边框信息,比如是否有边框,是否是圆角

View File

@ -1,5 +1,5 @@
/// Created with 菜鸟手册. /// Created with FlutterGo.
/// User: 一晟 /// User: 一晟
/// Date: 2018/11/14 /// Date: 2018/11/14
/// Time: 下午4:31 /// Time: 下午4:31
@ -7,16 +7,12 @@
/// target: IconButton 的示例 /// target: IconButton 的示例
/// 对应文档地址:https://docs.flutter.io/flutter/material/IconButton-class.html /// 对应文档地址:https://docs.flutter.io/flutter/material/IconButton-class.html
import 'package:flutter_markdown/flutter_markdown.dart';
import 'dart:math'; import 'dart:math';
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 iconButton; import './demo.dart' as iconButton;
const String _iconText0 = const String _iconText0 =
"""### **简介** """### **简介**
> Icon button “图标按钮” > Icon button “图标按钮”
@ -58,22 +54,18 @@ class _DemoState extends State<Demo> {
return WidgetDemo( return WidgetDemo(
title: 'IconButton', title: 'IconButton',
codeUrl: 'elements/Form/Button/IconButton/demo.dart', codeUrl: 'elements/Form/Button/IconButton/demo.dart',
contentList: [ allIconButtons(context,this)], contentList: allIconButtons(context,this),
docUrl: 'https://docs.flutter.io/flutter/material/IconButton-class.html', docUrl: 'https://docs.flutter.io/flutter/material/IconButton-class.html',
); );
} }
} }
// 所有的 IconButton 按钮 // 所有的 IconButton 按钮
Widget allIconButtons(BuildContext context,_DemoState that){ List allIconButtons(BuildContext context,_DemoState that){
final ShapeBorder buttonShape = drawShape(that.buttonShapeType); final ShapeBorder buttonShape = drawShape(that.buttonShapeType);
return Container( return [
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), _iconText0,
child: Column( _iconText1,
//mainAxisSize: MainAxisSize.max,
children: <Widget>[
MarkdownBody(data: _iconText0),
textAlignBar(_iconText1),
ButtonBar( ButtonBar(
alignment: MainAxisAlignment.spaceAround, alignment: MainAxisAlignment.spaceAround,
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
@ -83,42 +75,26 @@ Widget allIconButtons(BuildContext context,_DemoState that){
iconButton.IconButtonDefault(false), iconButton.IconButtonDefault(false),
], ],
), ),
textAlignBar(_iconText2), _iconText2,
SizedBox(height: 10.0), SizedBox(height: 10.0),
iconButton.IconButtonCustom('主要按钮',Colors.blue,buttonShape), iconButton.IconButtonCustom('主要按钮', Colors.blue, buttonShape),
SizedBox(height: 10.0), SizedBox(height: 10.0),
iconButton.IconButtonCustom('成功按钮',Colors.green,buttonShape), iconButton.IconButtonCustom('成功按钮', Colors.green, buttonShape),
SizedBox(height: 10.0), SizedBox(height: 10.0),
iconButton.IconButtonCustom('信息按钮',Colors.grey,buttonShape), iconButton.IconButtonCustom('信息按钮', Colors.grey, buttonShape),
SizedBox(height: 10.0), SizedBox(height: 10.0),
iconButton.IconButtonCustom('警告按钮',Colors.orange,buttonShape), iconButton.IconButtonCustom('警告按钮', Colors.orange, buttonShape),
SizedBox(height: 10.0), SizedBox(height: 10.0),
iconButton.IconButtonCustom('危险按钮',Colors.pink,buttonShape), iconButton.IconButtonCustom('危险按钮', Colors.pink, buttonShape),
SizedBox(height: 10.0), SizedBox(height: 10.0),
RaisedButton( RaisedButton(
// 文本内容 // 文本内容
child: const Text('点击切换,图标按钮', semanticsLabel: 'FLAT BUTTON 1'), child: const Text('点击切换,图标按钮', semanticsLabel: 'FLAT BUTTON 1'),
onPressed: ()=> that.setButtonShapeType()), onPressed: () => that.setButtonShapeType()),
SizedBox(height: 20.0) SizedBox(height: 20.0)
]) ];
);
} }
// 带align的text
Widget textAlignBar(String txt){
//style: TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
return Align(
alignment: FractionalOffset.centerLeft,
child: Column(
children: <Widget>[
SizedBox(height: 20.0),
MarkdownBody(data: txt)
// Text(txt, style: TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
])
);
}
// 绘制边框信息,比如是否有边框,是否是圆角 // 绘制边框信息,比如是否有边框,是否是圆角
ShapeBorder drawShape(String type){ ShapeBorder drawShape(String type){
final Color _color = _randomColor(); final Color _color = _randomColor();
@ -154,7 +130,6 @@ ShapeBorder drawShape(String type){
} }
} }
// 取随机颜色 // 取随机颜色
Color _randomColor() { Color _randomColor() {
var red = Random.secure().nextInt(255); var red = Random.secure().nextInt(255);

View File

@ -1,4 +1,4 @@
/// Created with 菜鸟手册. /// Created with FlutterGo.
/// User: 一晟 /// User: 一晟
/// Date: 2018/11/14 /// Date: 2018/11/14
/// Time: 下午4:31 /// Time: 下午4:31
@ -6,17 +6,11 @@
/// target: OutlineButton 的示例 /// target: OutlineButton 的示例
/// 对应文档地址:https://docs.flutter.io/flutter/material/OutlineButton-class.html /// 对应文档地址:https://docs.flutter.io/flutter/material/OutlineButton-class.html
import 'dart:math'; import 'dart:math';
import 'package:flutter_markdown/flutter_markdown.dart';
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 outlineButton; import './demo.dart' as outlineButton;
const String _outlineText0 = const String _outlineText0 =
"""### **简介** """### **简介**
> Outline button “边框按钮” > Outline button “边框按钮”
@ -67,22 +61,18 @@ class _DemoState extends State<Demo> {
return WidgetDemo( return WidgetDemo(
title: 'OutlineButton', title: 'OutlineButton',
codeUrl: 'elements/Form/Button/OutlineButton/demo.dart', codeUrl: 'elements/Form/Button/OutlineButton/demo.dart',
contentList: [allOutlineButtons(context,this)], contentList: allOutlineButtons(context,this),
docUrl: 'https://docs.flutter.io/flutter/material/OutlineButton-class.html', docUrl: 'https://docs.flutter.io/flutter/material/OutlineButton-class.html',
); );
} }
} }
// 所有的 OutlineButton 按钮 // 所有的 OutlineButton 按钮
Widget allOutlineButtons(BuildContext context,_DemoState that){ List allOutlineButtons(BuildContext context,_DemoState that){
final ShapeBorder buttonShape = drawShape(that.buttonShapeType); final ShapeBorder buttonShape = drawShape(that.buttonShapeType);
return Container( return [
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), _outlineText0,
child: Column( _outlineText1,
//mainAxisSize: MainAxisSize.max,
children: <Widget>[
MarkdownBody(data: _outlineText0),
textAlignBar(_outlineText1),
ButtonBar( ButtonBar(
alignment: MainAxisAlignment.spaceAround, alignment: MainAxisAlignment.spaceAround,
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
@ -92,7 +82,7 @@ Widget allOutlineButtons(BuildContext context,_DemoState that){
outlineButton.OutlineButtonDefault(false), outlineButton.OutlineButtonDefault(false),
], ],
), ),
textAlignBar(_outlineText2), _outlineText2,
ButtonBar( ButtonBar(
alignment: MainAxisAlignment.spaceAround, alignment: MainAxisAlignment.spaceAround,
//mainAxisSize: MainAxisSize.min, //mainAxisSize: MainAxisSize.min,
@ -109,63 +99,26 @@ Widget allOutlineButtons(BuildContext context,_DemoState that){
outlineButton.OutlineButtonIconDefault(true, Icons.announcement), outlineButton.OutlineButtonIconDefault(true, Icons.announcement),
], ],
), ),
textAlignBar(_outlineText3), _outlineText3,
SizedBox(height: 10.0), SizedBox(height: 10.0),
outlineButton.OutlineButtonCustom('主要按钮',Colors.blue,buttonShape), outlineButton.OutlineButtonCustom('主要按钮', Colors.blue, buttonShape),
SizedBox(height: 10.0), SizedBox(height: 10.0),
outlineButton.OutlineButtonCustom('成功按钮',Colors.green,buttonShape), outlineButton.OutlineButtonCustom('成功按钮', Colors.green, buttonShape),
SizedBox(height: 10.0), SizedBox(height: 10.0),
outlineButton.OutlineButtonCustom('信息按钮',Colors.grey,buttonShape), outlineButton.OutlineButtonCustom('信息按钮', Colors.grey, buttonShape),
SizedBox(height: 10.0), SizedBox(height: 10.0),
outlineButton.OutlineButtonCustom('警告按钮',Colors.orange,buttonShape), outlineButton.OutlineButtonCustom('警告按钮', Colors.orange, buttonShape),
SizedBox(height: 10.0), SizedBox(height: 10.0),
outlineButton.OutlineButtonCustom('危险按钮',Colors.pink,buttonShape), outlineButton.OutlineButtonCustom('危险按钮', Colors.pink, buttonShape),
SizedBox(height: 10.0), SizedBox(height: 10.0),
outlineButton.OutlineButtonCustom( '点击切换,随机改变按钮的圆角,边框样式', Colors.blue, buttonShape, outlineButton.OutlineButtonCustom(
'点击切换,随机改变按钮的圆角,边框样式', Colors.blue, buttonShape,
() => that.setButtonShapeType()), () => that.setButtonShapeType()),
SizedBox(height: 20.0) SizedBox(height: 20.0)
]) ];
);
} }
// alert 弹框 // 绘制边框信息,比如是否有边框,是否是圆角
// context:容器的父级
// void _showMessage(String name, BuildContext context) {
// showDialog(
// // alert 的父级
// context: context,
// builder: (BuildContext context) {
// return AlertDialog(
// title: Text('提示'),
// content: Text(name),
// actions: <Widget>[
// FlatButton(
// // alert 的取消按钮
// onPressed: () {
// // 取消的事件
// Navigator.of(context).pop(true);
// },
// child: Text('取消'))
// ]);
// }
// );
// }
// 带align的text
Widget textAlignBar(String txt){
//style: TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
return Align(
alignment: FractionalOffset.centerLeft,
child: Column(
children: <Widget>[
SizedBox(height: 20.0),
MarkdownBody(data: txt)
// Text(txt, style: TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
])
);
}
// 绘制边框信息,比如是否有边框,是否是圆角
ShapeBorder drawShape(String type){ ShapeBorder drawShape(String type){
final Color _color = _randomColor(); final Color _color = _randomColor();
final borderWidth = Random.secure().nextInt(5).toDouble(); final borderWidth = Random.secure().nextInt(5).toDouble();

View File

@ -6,8 +6,6 @@
/// target: PopupMenusButton 的示例 /// target: PopupMenusButton 的示例
/// 对应文档地址:https://docs.flutter.io/flutter/material/PopupMenuButton-class.html /// 对应文档地址:https://docs.flutter.io/flutter/material/PopupMenuButton-class.html
import 'package:flutter_markdown/flutter_markdown.dart';
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 popupMenuButton; import './demo.dart' as popupMenuButton;
@ -54,24 +52,20 @@ class _DemoState extends State<Demo> {
return WidgetDemo( return WidgetDemo(
title: 'PopupMenuButton', title: 'PopupMenuButton',
codeUrl: 'elements/Form/Button/RaisedButton/demo.dart', codeUrl: 'elements/Form/Button/RaisedButton/demo.dart',
contentList: [allPopupMenuButton(widget,this)], contentList: allPopupMenuButton(widget,this),
docUrl: 'https://docs.flutter.io/flutter/material/PopupMenuButton-class.html', docUrl: 'https://docs.flutter.io/flutter/material/PopupMenuButton-class.html',
); );
} }
} }
Widget allPopupMenuButton(Demo widget,State parent){ List allPopupMenuButton(Demo widget, State parent) {
return Container( return [
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), _titleText0,
child: Column(
//mainAxisSize: MainAxisSize.max,
children: <Widget>[
MarkdownBody(data: _titleText0),
SizedBox(height: 20.0), SizedBox(height: 20.0),
MarkdownBody(data: _titleText1), _titleText1,
Row( Row(
crossAxisAlignment:CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment:MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[ children: <Widget>[
popupMenuButton.PopupMenuButtonDefault('default1'), popupMenuButton.PopupMenuButtonDefault('default1'),
popupMenuButton.PopupMenuButtonDefault('default2'), popupMenuButton.PopupMenuButtonDefault('default2'),
@ -79,10 +73,9 @@ Widget allPopupMenuButton(Demo widget,State parent){
], ],
), ),
SizedBox(height: 20.0), SizedBox(height: 20.0),
MarkdownBody(data: _titleText2), _titleText2,
SizedBox(height: 20.0), SizedBox(height: 20.0),
popupMenuButton.PopupMenuButtonCustom(widget,parent), popupMenuButton.PopupMenuButtonCustom(widget, parent),
SizedBox(height: 40.0) SizedBox(height: 40.0)
] ];
));
} }

View File

@ -1,4 +1,4 @@
/// Created with 菜鸟手册. /// Created with FlutterGo.
/// User: 一晟 /// User: 一晟
/// Date: 2018/11/14 /// Date: 2018/11/14
/// Time: 下午4:31 /// Time: 下午4:31
@ -6,11 +6,7 @@
/// target: RaisedButton 的示例 /// target: RaisedButton 的示例
/// 对应文档地址:https://docs.flutter.io/flutter/material/RaisedButton-class.html /// 对应文档地址:https://docs.flutter.io/flutter/material/RaisedButton-class.html
import 'package:flutter_markdown/flutter_markdown.dart';
import 'dart:math'; import 'dart:math';
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 raisedButton; import './demo.dart' as raisedButton;
@ -65,22 +61,18 @@ class _DemoState extends State<Demo> {
return WidgetDemo( return WidgetDemo(
title: 'RaisedButton', title: 'RaisedButton',
codeUrl: 'elements/Form/Button/RaisedButton/demo.dart', codeUrl: 'elements/Form/Button/RaisedButton/demo.dart',
contentList: [allRaisedButtons(context,this)], contentList: allRaisedButtons(context, this),
docUrl: 'https://docs.flutter.io/flutter/material/RaisedButton-class.html', docUrl: 'https://docs.flutter.io/flutter/material/RaisedButton-class.html',
); );
} }
} }
// 所有的 RaisedButton 按钮 // 所有的 RaisedButton 按钮
Widget allRaisedButtons(BuildContext context,_DemoState that){ List allRaisedButtons(BuildContext context,_DemoState that){
final ShapeBorder buttonShape = drawShape(that.buttonShapeType); final ShapeBorder buttonShape = drawShape(that.buttonShapeType);
return Container( return [
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), _raisedText0,
child: Column( _raisedText1,
//mainAxisSize: MainAxisSize.max,
children: <Widget>[
MarkdownBody(data: _raisedText0),
textAlignBar(_raisedText1),
ButtonBar( ButtonBar(
alignment: MainAxisAlignment.spaceAround, alignment: MainAxisAlignment.spaceAround,
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
@ -90,7 +82,7 @@ Widget allRaisedButtons(BuildContext context,_DemoState that){
raisedButton.RaisedButtonDefault(false), raisedButton.RaisedButtonDefault(false),
], ],
), ),
textAlignBar(_raisedText2), _raisedText2,
ButtonBar( ButtonBar(
alignment: MainAxisAlignment.spaceAround, alignment: MainAxisAlignment.spaceAround,
//mainAxisSize: MainAxisSize.min, //mainAxisSize: MainAxisSize.min,
@ -107,60 +99,22 @@ Widget allRaisedButtons(BuildContext context,_DemoState that){
raisedButton.RaisedButtonIconDefault(true, Icons.announcement), raisedButton.RaisedButtonIconDefault(true, Icons.announcement),
], ],
), ),
textAlignBar(_raisedText3), _raisedText3,
SizedBox(height: 10.0), SizedBox(height: 10.0),
raisedButton.RaisedButtonCustom('主要按钮',Colors.blue,buttonShape), raisedButton.RaisedButtonCustom('主要按钮', Colors.blue, buttonShape),
SizedBox(height: 10.0), SizedBox(height: 10.0),
raisedButton.RaisedButtonCustom('成功按钮',Colors.green,buttonShape), raisedButton.RaisedButtonCustom('成功按钮', Colors.green, buttonShape),
SizedBox(height: 10.0), SizedBox(height: 10.0),
raisedButton.RaisedButtonCustom('信息按钮',Colors.grey,buttonShape), raisedButton.RaisedButtonCustom('信息按钮', Colors.grey, buttonShape),
SizedBox(height: 10.0), SizedBox(height: 10.0),
raisedButton.RaisedButtonCustom('警告按钮',Colors.orange,buttonShape), raisedButton.RaisedButtonCustom('警告按钮', Colors.orange, buttonShape),
SizedBox(height: 10.0), SizedBox(height: 10.0),
raisedButton.RaisedButtonCustom('危险按钮',Colors.pink,buttonShape), raisedButton.RaisedButtonCustom('危险按钮', Colors.pink, buttonShape),
SizedBox(height: 10.0), SizedBox(height: 10.0),
raisedButton.RaisedButtonCustom( '点击切换,按钮的圆角', Colors.blue, buttonShape, raisedButton.RaisedButtonCustom('点击切换,按钮的圆角', Colors.blue, buttonShape,
() => that.setButtonShapeType()), () => that.setButtonShapeType()),
SizedBox(height: 20.0) SizedBox(height: 20.0)
]) ];
);
}
// alert 弹框
// context:容器的父级
// void _showMessage(String name, BuildContext context) {
// showDialog(
// // alert 的父级
// context: context,
// builder: (BuildContext context) {
// return AlertDialog(
// title: Text('提示'),
// content: Text(name),
// actions: <Widget>[
// FlatButton(
// // alert 的取消按钮
// onPressed: () {
// // 取消的事件
// Navigator.of(context).pop(true);
// },
// child: Text('取消'))
// ]);
// }
// );
// }
// 带align的text
Widget textAlignBar(String txt){
//style: TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
return Align(
alignment: FractionalOffset.centerLeft,
child: Column(
children: <Widget>[
SizedBox(height: 20.0),
MarkdownBody(data: txt)
// Text(txt, style: TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
])
);
} }
// 绘制边框信息,比如是否有边框,是否是圆角 // 绘制边框信息,比如是否有边框,是否是圆角

View File

@ -1,18 +1,16 @@
/// Created with 菜鸟手册. /// Created with FlutterGo.
/// User: 一晟 /// User: 一晟
/// Date: 2018/11/14 /// Date: 2018/11/14
/// Time: 下午4:31 /// Time: 下午4:31
/// email: zhu.yan@alibaba-inc.com /// email: zhu.yan@alibaba-inc.com
/// target: RawMaterialButton 的示例 /// target: RawMaterialButton 的示例
/// 对应文档地址:https://docs.flutter.io/flutter/material/RawMaterialButton-class.html /// 对应文档地址:https://docs.flutter.io/flutter/material/RawMaterialButton-class.html
import 'package:flutter_markdown/flutter_markdown.dart';
import 'dart:math';
import 'dart:math';
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 rawMaterialButton; import './demo.dart' as rawMaterialButton;
const String _rawMaterialText0 = const String _rawMaterialText0 =
"""### **简介** """### **简介**
> RawMaterial button “RawMaterial 按钮” > RawMaterial button “RawMaterial 按钮”
@ -52,23 +50,19 @@ class _DemoState extends State<Demo> {
return WidgetDemo( return WidgetDemo(
title: 'RawMaterialButton', title: 'RawMaterialButton',
codeUrl: 'elements/Form/Button/RawMaterialButton/demo.dart', codeUrl: 'elements/Form/Button/RawMaterialButton/demo.dart',
contentList: [allRawMaterialButtons(context,this)], contentList: allRawMaterialButtons(context,this),
docUrl: 'https://docs.flutter.io/flutter/material/RawMaterialButton-class.html', docUrl: 'https://docs.flutter.io/flutter/material/RawMaterialButton-class.html',
); );
} }
} }
// 所有的 RawMaterialButton 按钮 // 所有的 RawMaterialButton 按钮
Widget allRawMaterialButtons(BuildContext context,_DemoState that){ List allRawMaterialButtons(BuildContext context,_DemoState that){
final ShapeBorder buttonShape = drawShape(that.buttonShapeType); final ShapeBorder buttonShape = drawShape(that.buttonShapeType);
return Container( return [
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), _rawMaterialText0,
child: Column( _rawMaterialText1,
//mainAxisSize: MainAxisSize.max,
children: <Widget>[
MarkdownBody(data: _rawMaterialText0),
textAlignBar(_rawMaterialText1),
ButtonBar( ButtonBar(
alignment: MainAxisAlignment.spaceAround, alignment: MainAxisAlignment.spaceAround,
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
@ -78,60 +72,25 @@ Widget allRawMaterialButtons(BuildContext context,_DemoState that){
rawMaterialButton.RawMaterialButtonDefault(false), rawMaterialButton.RawMaterialButtonDefault(false),
], ],
), ),
textAlignBar(_rawMaterialText2), _rawMaterialText2,
SizedBox(height: 10.0), SizedBox(height: 10.0),
rawMaterialButton.RawMaterialButtonCustom('主要按钮',Colors.blue,buttonShape), rawMaterialButton.RawMaterialButtonCustom('主要按钮', Colors.blue, buttonShape),
SizedBox(height: 10.0), SizedBox(height: 10.0),
rawMaterialButton.RawMaterialButtonCustom('成功按钮',Colors.green,buttonShape), rawMaterialButton.RawMaterialButtonCustom(
'成功按钮', Colors.green, buttonShape),
SizedBox(height: 10.0), SizedBox(height: 10.0),
rawMaterialButton.RawMaterialButtonCustom('信息按钮',Colors.grey,buttonShape), rawMaterialButton.RawMaterialButtonCustom('信息按钮', Colors.grey, buttonShape),
SizedBox(height: 10.0), SizedBox(height: 10.0),
rawMaterialButton.RawMaterialButtonCustom('警告按钮',Colors.orange,buttonShape), rawMaterialButton.RawMaterialButtonCustom(
'警告按钮', Colors.orange, buttonShape),
SizedBox(height: 10.0), SizedBox(height: 10.0),
rawMaterialButton.RawMaterialButtonCustom('危险按钮',Colors.pink,buttonShape), rawMaterialButton.RawMaterialButtonCustom('危险按钮', Colors.pink, buttonShape),
SizedBox(height: 10.0), SizedBox(height: 10.0),
rawMaterialButton.RawMaterialButtonCustom( '点击切换,观察字体变化', Colors.blue, buttonShape, rawMaterialButton.RawMaterialButtonCustom(
'点击切换,观察字体变化', Colors.blue, buttonShape,
() => that.setButtonShapeType()), () => that.setButtonShapeType()),
SizedBox(height: 20.0) SizedBox(height: 20.0)
]) ];
);
}
// alert 弹框
// context:容器的父级
// void _showMessage(String name, BuildContext context) {
// showDialog(
// // alert 的父级
// context: context,
// builder: (BuildContext context) {
// return AlertDialog(
// title: Text('提示'),
// content: Text(name),
// actions: <Widget>[
// FlatButton(
// // alert 的取消按钮
// onPressed: () {
// // 取消的事件
// Navigator.of(context).pop(true);
// },
// child: Text('取消'))
// ]);
// }
// );
// }
// 带align的text
Widget textAlignBar(String txt){
//style: TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
return Align(
alignment: FractionalOffset.centerLeft,
child: Column(
children: <Widget>[
SizedBox(height: 20.0),
MarkdownBody(data: txt)
// Text(txt, style: TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
])
);
} }
// 绘制边框信息,比如是否有边框,是否是圆角 // 绘制边框信息,比如是否有边框,是否是圆角

View File

@ -1,4 +1,4 @@
/// Created with 菜鸟手册. /// Created with FlutterGo.
/// User: 一晟 /// User: 一晟
/// Date: 2018/11/14 /// Date: 2018/11/14
/// Time: 下午4:31 /// Time: 下午4:31
@ -6,9 +6,6 @@
/// target: Checkbox 的示例 /// target: Checkbox 的示例
/// 对应文档地址:https://docs.flutter.io/flutter/material/Checkbox-class.html /// 对应文档地址:https://docs.flutter.io/flutter/material/Checkbox-class.html
import 'package:flutter_markdown/flutter_markdown.dart';
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 checkbox; import './demo.dart' as checkbox;
@ -47,60 +44,42 @@ class _DemoState extends State<Demo> {
return WidgetDemo( return WidgetDemo(
title: 'Checkbox', title: 'Checkbox',
codeUrl: 'elements/Form/CheckBox/Checkbox/demo.dart', codeUrl: 'elements/Form/CheckBox/Checkbox/demo.dart',
contentList: [allCheckboxs(context,this)], contentList: allCheckboxs(context,this),
docUrl: 'https://docs.flutter.io/flutter/material/Checkbox-class.html', docUrl: 'https://docs.flutter.io/flutter/material/Checkbox-class.html',
); );
} }
} }
// 所有的 Checkbox 按钮 // 所有的 Checkbox 按钮
Widget allCheckboxs(BuildContext context,_DemoState that){ List allCheckboxs(BuildContext context,_DemoState that){
return Container( return [
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), _checkboxText0,
child: Column( _checkboxText1,
//mainAxisSize: MainAxisSize.max,
children: <Widget>[
MarkdownBody(data: _checkboxText0),
textAlignBar(_checkboxText1),
Row( Row(
mainAxisAlignment : MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
children:[ children: [
checkbox.CheckboxDefault(that,0), checkbox.CheckboxDefault(that, 0),
checkbox.CheckboxDefault(that,1), checkbox.CheckboxDefault(that, 1),
checkbox.CheckboxDefault(that,2), checkbox.CheckboxDefault(that, 2),
checkbox.CheckboxDefault(that,3), checkbox.CheckboxDefault(that, 3),
checkbox.CheckboxDefault(that,4), checkbox.CheckboxDefault(that, 4),
], ],
), ),
textAlignBar(_checkboxText2), _checkboxText2,
Row( Row(
mainAxisAlignment : MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[
checkbox.CheckboxSelect(context.widget,that,0), checkbox.CheckboxSelect(context.widget, that, 0),
checkbox.CheckboxSelect(context.widget,that,1), checkbox.CheckboxSelect(context.widget, that, 1),
checkbox.CheckboxSelect(context.widget,that,2), checkbox.CheckboxSelect(context.widget, that, 2),
checkbox.CheckboxSelect(context.widget,that,3), checkbox.CheckboxSelect(context.widget, that, 3),
checkbox.CheckboxSelect(context.widget,that,4), checkbox.CheckboxSelect(context.widget, that, 4),
], ],
), ),
SizedBox(width: 20.0), // 间距 SizedBox(width: 20.0), // 间距
]) ];
);
}
// 带align的text
Widget textAlignBar(String txt){
return Align(
alignment: FractionalOffset.centerLeft,
child: Column(
children: <Widget>[
SizedBox(height: 20.0),
MarkdownBody(data: txt)
// Text(txt, style: TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
])
);
} }

View File

@ -5,8 +5,6 @@
/// email: zhu.yan@alibaba-inc.com /// email: zhu.yan@alibaba-inc.com
/// target: CheckboxListTile 的示例 /// target: CheckboxListTile 的示例
import 'package:flutter_markdown/flutter_markdown.dart';
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 CheckboxListTileDemo; import './demo.dart' as CheckboxListTileDemo;
@ -46,7 +44,7 @@ class _DemoState extends State<Demo> {
return WidgetDemo( return WidgetDemo(
title: 'CheckboxListTile', title: 'CheckboxListTile',
codeUrl: 'elements/Form/CheckBox/CheckboxListTile/demo.dart', codeUrl: 'elements/Form/CheckBox/CheckboxListTile/demo.dart',
contentList: [allCheckboxs(context, this)], contentList: allCheckboxs(context, this),
docUrl: 'https://docs.flutter.io/flutter/material/CheckboxListTile-class.html', docUrl: 'https://docs.flutter.io/flutter/material/CheckboxListTile-class.html',
); );
} }
@ -55,31 +53,15 @@ class _DemoState extends State<Demo> {
// 所有的 CheckboxListTile widget // 所有的 CheckboxListTile widget
// context: 运行上下文 // context: 运行上下文
// that: 指向有状态的 StatefulWidget // that: 指向有状态的 StatefulWidget
Widget allCheckboxs(BuildContext context, _DemoState that) { List allCheckboxs(BuildContext context, _DemoState that) {
return Container( return [
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), _CheckboxListTileText0,
child: Column( _CheckboxListTileText1,
//mainAxisSize: MainAxisSize.max, CheckboxListTileDemo.CheckboxListTileDefault(context.widget, that),
children:[ // CheckboxListTile 不能放在 Row 里...
MarkdownBody(data: _CheckboxListTileText0), _CheckboxListTileText2,
textAlignBar(_CheckboxListTileText1),
CheckboxListTileDemo.CheckboxListTileDefault(context.widget,that),// CheckboxListTile 不能放在 Row 里...
textAlignBar(_CheckboxListTileText2),
CheckboxListTileDemo.CheckboxListTileStateDefault(), CheckboxListTileDemo.CheckboxListTileStateDefault(),
SizedBox(height: 20.0), SizedBox(height: 20.0),
]) ];
);
}
// 带align的text
Widget textAlignBar(String txt) {
return Align(
alignment: FractionalOffset.centerLeft,
child: Column(
children: <Widget>[
SizedBox(height: 20.0),
MarkdownBody(data: txt)
])
);
} }

View File

@ -1,4 +1,4 @@
/// Created with 菜鸟手册. /// Created with FlutterGo.
/// User: 一晟 /// User: 一晟
/// Date: 2018/11/14 /// Date: 2018/11/14
/// Time: 下午4:31 /// Time: 下午4:31

View File

@ -1,4 +1,4 @@
/// Created with 菜鸟手册. /// Created with FlutterGo.
/// User: 一晟 /// User: 一晟
/// Date: 2018/11/14 /// Date: 2018/11/14
/// Time: 下午4:31 /// Time: 下午4:31