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 */; };
333E5DAE7FC10AC69FEC26C0 /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DDA792F029EDD7A11295D192 /* libPods-Runner.a */; };
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 */; };
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 */; };
@ -74,6 +75,7 @@
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>"; };
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>"; };
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>"; };
@ -146,6 +148,7 @@
children = (
3B80C3931E831B6300D905FE /* App.framework */,
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
2D5378251FAA1A9400D5DBA9 /* flutter_assets */,
9740EEBA1CF902C7004384FC /* Flutter.framework */,
9740EEB21CF90195004384FC /* Debug.xcconfig */,
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
@ -271,6 +274,7 @@
0828E4A2220692B500A59437 /* iPhone Portrait-Retina HD 5.5.png in Resources */,
0828E49A220692B500A59437 /* iPhone X_XS Portrait.png in Resources */,
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */,
0828E49E220692B500A59437 /* iPad Portrait@2x.png in Resources */,
0828E49D220692B500A59437 /* iPhone Portrait@2x.png in Resources */,
0828E499220692B500A59437 /* iPhone Portrait-Retina HD 4.7.png in Resources */,

View File

@ -6,7 +6,6 @@
/// target: AppBar 的示例
import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import './demo.dart' as AppBarDemo;
import 'package:flutter_go/components/widget_demo.dart';
@ -47,7 +46,7 @@ class _DemoState extends State<Demo> {
return WidgetDemo(
title: 'AppBar',
codeUrl: 'components/Bar/AppBar/demo.dart',
contentList: [allDomes(context, this)],
contentList: allDomes(context, this),
docUrl: 'https://docs.flutter.io/flutter/material/AppBar-class.html',
);
}
@ -56,36 +55,17 @@ class _DemoState extends State<Demo> {
// 所有的 AppBar widget
// context: 运行上下文
// that: 指向有状态的 StatefulWidget
Widget allDomes(BuildContext context, _DemoState that) {
return Container(
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column(
//mainAxisSize: MainAxisSize.max,
children: <Widget>[
MarkdownBody(data: _Text0),
SizedBox(height: 20.0), // 间距
MarkdownBody(data: _Text1),
SizedBox(height: 20.0), // 间距
AppBarDemo.AppBarLessDefaultSimple(),
SizedBox(height: 20.0), // 间距
MarkdownBody(data: _Text2),
SizedBox(height: 20.0), // 间距
AppBarDemo.AppBarLessDefaultComplex(),
SizedBox(height: 20.0), // 间距
])
);
List allDomes(BuildContext context, _DemoState that) {
return [
_Text0,
SizedBox(height: 20.0), // 间距
_Text1,
SizedBox(height: 20.0), // 间距
AppBarDemo.AppBarLessDefaultSimple(),
SizedBox(height: 20.0), // 间距
_Text2,
SizedBox(height: 20.0), // 间距
AppBarDemo.AppBarLessDefaultComplex(),
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_markdown/flutter_markdown.dart';
import './demo.dart' as BottomAppBarDemo;
const String _Text0 =
@ -38,7 +37,7 @@ class _DemoState extends State<Demo> {
return WidgetDemo(
title: 'BottomAppBar',
codeUrl: 'components/Bar/BottomAppBar/demo.dart',
contentList: [allDomes(context, this)],
contentList: allDomes(context, this),
docUrl: 'https://docs.flutter.io/flutter/material/BottomAppBar-class.html',
);
}
@ -47,20 +46,15 @@ class _DemoState extends State<Demo> {
// 所有的 BottomAppBar widget
// context: 运行上下文
// that: 指向有状态的 StatefulWidget
Widget allDomes(BuildContext context, _DemoState that) {
return Container(
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column(
//mainAxisSize: MainAxisSize.max,
children: <Widget>[
MarkdownBody(data: _Text0),
SizedBox(height: 20.0), // 间距
MarkdownBody(data: _Text1),
SizedBox(height: 20.0), // 间距
BottomAppBarDemo.AppBarLessDefaultSimple(),
SizedBox(height: 20.0), // 间距
])
);
List allDomes(BuildContext context, _DemoState that) {
return [
_Text0,
SizedBox(height: 20.0), // 间距
_Text1,
SizedBox(height: 20.0), // 间距
BottomAppBarDemo.AppBarLessDefaultSimple(),
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_markdown/flutter_markdown.dart';
import './demo.dart' as ButtonBarDemo;
const String _Text0 =
@ -41,7 +40,7 @@ class _DemoState extends State<Demo> {
return WidgetDemo(
title: 'ButtonBar',
codeUrl: 'components/Bar/ButtonBar/demo.dart',
contentList: [allDomes(context, this)],
contentList: allDomes(context, this),
docUrl: 'https://docs.flutter.io/flutter/material/ButtonBar-class.html',
);
}
@ -50,18 +49,13 @@ class _DemoState extends State<Demo> {
// 所有的 ButtonBar widget
// context: 运行上下文
// that: 指向有状态的 StatefulWidget
Widget allDomes(BuildContext context, _DemoState that) {
return Container(
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column(
//mainAxisSize: MainAxisSize.max,
children: <Widget>[
MarkdownBody(data: _Text0),
SizedBox(height: 20.0), // 间距
MarkdownBody(data: _Text1),
//SizedBox(height: 20.0), // 间距
ButtonBarDemo.ButtonBarLessDefault()
])
);
List allDomes(BuildContext context, _DemoState that) {
return [
_Text0,
SizedBox(height: 20.0), // 间距
_Text1,
//SizedBox(height: 20.0), // 间距
ButtonBarDemo.ButtonBarLessDefault()
];
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -9,7 +9,6 @@ import 'package:flutter_go/components/widget_demo.dart';
import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import './demo.dart' as BottomNavigationBarItemDemo;
const String _Text0 =
@ -18,13 +17,11 @@ const String _Text0 =
- material 的 BottomNavigationBar 或带有图标和标题的 iOS主题 CupertinoTabBar 中的交互式按钮;
""";
const String _Text1 =
"""### **基本用法**
> 这个类很少单独使用。通常嵌入在上面的一个底部 bottom navigation widgets 中;
""";
class Demo extends StatefulWidget {
static const String routeName = '/components/Navigation/BottomNavigationBarItem';
@ -38,7 +35,7 @@ class _DemoState extends State<Demo> {
return WidgetDemo(
title: 'BottomNavigationBarItem',
codeUrl: 'components/Navigation/BottomNavigationBarItem/demo.dart',
contentList: [allCheckboxs(context, this)],
contentList: allDomeBox(context, this),
docUrl: 'https://docs.flutter.io/flutter/widgets/BottomNavigationBarItem-class.html',
);
}
@ -48,33 +45,16 @@ class _DemoState extends State<Demo> {
// 所有的 BottomNavigationBarItem widget
// context: 运行上下文
// that: 指向有状态的 StatefulWidget
Widget allCheckboxs(BuildContext context, _DemoState that) {
return Container(
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column(
//mainAxisSize: MainAxisSize.max,
children: <Widget>[
MarkdownBody(data: _Text0),
SizedBox(height: 20.0), // 间距
MarkdownBody(data: _Text1),
SizedBox(height: 20.0), // 间距
BottomNavigationBarItemDemo.BottomNavigationBarItemLessDefault(),
SizedBox(height: 20.0), // 间距
])
);
List allDomeBox(BuildContext context, _DemoState that) {
return [
_Text0,
SizedBox(height: 20.0), // 间距
_Text1,
SizedBox(height: 20.0), // 间距
BottomNavigationBarItemDemo.BottomNavigationBarItemLessDefault(),
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: 一晟
/// Date: 2018/11/14
/// Time: 下午4:31
@ -6,9 +6,6 @@
/// target: DropdownButton 的示例
/// 对应文档地址:https://docs.flutter.io/flutter/material/DropdownButton-class.html
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:flutter/material.dart';
import 'package:flutter_go/components/widget_demo.dart';
@ -50,47 +47,28 @@ class _DemoState extends State<Demo> {
return WidgetDemo(
title: 'DropdownButton',
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',
);
}
}
// 所有的 DropdownButton 按钮
Widget allDropdownButtons(BuildContext context,_DemoState that){
return Container(
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column(
//mainAxisSize: MainAxisSize.max,
children: <Widget>[
MarkdownBody(data: _dropdownText0),
textAlignBar(_dropdownText1),
ButtonBar(
alignment: MainAxisAlignment.spaceAround,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
dropdownButton.DropdownButtonDefault(),
],
),
textAlignBar(_dropdownText2),
SizedBox(height: 10.0),
dropdownButton.DropdownButtonCustom(context.widget,that),
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)
])
);
List allDropdownButtons(BuildContext context,_DemoState that){
return [
_dropdownText0,
_dropdownText1,
ButtonBar(
alignment: MainAxisAlignment.spaceAround,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
dropdownButton.DropdownButtonDefault(),
],
),
_dropdownText2,
SizedBox(height: 10.0),
dropdownButton.DropdownButtonCustom(context.widget, that),
SizedBox(height: 20.0)
];
}

View File

@ -1,4 +1,4 @@
/// Created with 菜鸟手册.
/// Created with FlutterGo.
/// User: 一晟
/// Date: 2018/11/14
/// Time: 下午4:31
@ -6,9 +6,6 @@
/// target: FlatButton 的示例
/// 对应文档地址:https://docs.flutter.io/flutter/material/FlatButton-class.html
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:flutter/material.dart';
import 'package:flutter_go/components/widget_demo.dart';
@ -51,21 +48,17 @@ class _DemoState extends State<Demo> {
return WidgetDemo(
title: 'FlatButton',
codeUrl: 'elements/Form/Button/FlatButton/demo.dart',
contentList: [allFlatButtons(context)],
contentList: allFlatButtons(context),
docUrl: 'https://docs.flutter.io/flutter/material/FlatButton-class.html',
);
}
}
// 所有的 FlatButton 按钮
Widget allFlatButtons(BuildContext context){
return Container(
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column(
//mainAxisSize: MainAxisSize.max,
children: <Widget>[
MarkdownBody(data: _flatText0),
textAlignBar(_flatText1),
List allFlatButtons(BuildContext context){
return [
_flatText0,
_flatText1,
ButtonBar(
alignment: MainAxisAlignment.spaceAround,
mainAxisSize: MainAxisSize.max,
@ -75,7 +68,7 @@ Widget allFlatButtons(BuildContext context){
flatButton.FlatButtonDefault(false),
],
),
textAlignBar(_flatText2),
_flatText2,
ButtonBar(
alignment: MainAxisAlignment.spaceAround,
//mainAxisSize: MainAxisSize.min,
@ -92,7 +85,7 @@ Widget allFlatButtons(BuildContext context){
flatButton.FlatButtonIconDefault(true, Icons.announcement),
],
),
textAlignBar(_flatText3),
_flatText3,
//flatButton.FlatButtonCustom(context,'主要按钮',Colors.blue),
flatButton.FlatButtonCustom('主要按钮',Colors.blue),
SizedBox(height: 10.0),
@ -108,8 +101,7 @@ Widget allFlatButtons(BuildContext context){
Border.all(color: Colors.brown, width: 5.0, style: BorderStyle.solid),
() => _showMessage('点击了 FLAT BUTTON ', context)),
SizedBox(height: 20.0)
])
);
];
}
// 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
Widget build(BuildContext context) {
final _onPressed = onPressed;
final _onPressed = (onPressed is Function) ? onPressed : ()=>{};
return FloatingActionButton(
// 子视图一般为Icon不推荐使用文字
child: const Icon(Icons.refresh),

View File

@ -1,4 +1,4 @@
/// Created with 菜鸟手册.
/// Created with FlutterGo.
/// User: 一晟
/// Date: 2018/11/14
/// Time: 下午4:31
@ -7,10 +7,8 @@
/// 对应文档地址:https://docs.flutter.io/flutter/material/FloatingActionButton-class.html
import 'dart:math';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:flutter/material.dart';
import 'package:flutter_go/components/widget_demo.dart';
import './demo.dart' as floatingActionButton;
@ -63,78 +61,38 @@ class _DemoState extends State<Demo> {
title: 'FloatingActionButton',
// desc: _floatingActionTitle,
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',
);
}
}
// 所有的 FloatingActionButton 按钮
Widget allFloatingActionButtons(BuildContext context,_DemoState that){
List allFloatingActionButtons(BuildContext context,_DemoState that){
final ShapeBorder buttonShape = drawShape(that.buttonShapeType);
return Container(
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column(
//mainAxisSize: MainAxisSize.max,
children: <Widget>[
MarkdownBody(data: _floatingActionText0),
textAlignBar(_floatingActionText1),
ButtonBar(
alignment: MainAxisAlignment.spaceAround,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
floatingActionButton.FloatingActionButtonDefault(),
SizedBox(width: 20.0), // 间距
floatingActionButton.FloatingActionButtonDefault(false),
],
),
textAlignBar(_floatingActionText2),
SizedBox(height: 10.0),
floatingActionButton.FloatingActionButtonCustom('主要按钮',Colors.deepOrangeAccent,buttonShape),
SizedBox(height: 20.0),
textAlignBar(_floatingActionText3),
SizedBox(height: 20.0),
floatingActionButton.FloatingActionButtonCustom2('扩展按钮',Colors.deepOrangeAccent,buttonShape),
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)
])
);
return [
_floatingActionText0,
_floatingActionText1,
ButtonBar(
alignment: MainAxisAlignment.spaceAround,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
floatingActionButton.FloatingActionButtonDefault(),
SizedBox(width: 20.0), // 间距
floatingActionButton.FloatingActionButtonDefault(false),
],
),
_floatingActionText2,
SizedBox(height: 10.0),
floatingActionButton.FloatingActionButtonCustom(
'主要按钮', Colors.deepOrangeAccent, buttonShape),
SizedBox(height: 20.0),
_floatingActionText3,
SizedBox(height: 20.0),
floatingActionButton.FloatingActionButtonCustom2(
'扩展按钮', Colors.deepOrangeAccent, buttonShape),
SizedBox(height: 20.0)
];
}
// 绘制边框信息,比如是否有边框,是否是圆角

View File

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

View File

@ -1,4 +1,4 @@
/// Created with 菜鸟手册.
/// Created with FlutterGo.
/// User: 一晟
/// Date: 2018/11/14
/// Time: 下午4:31
@ -6,17 +6,11 @@
/// target: OutlineButton 的示例
/// 对应文档地址:https://docs.flutter.io/flutter/material/OutlineButton-class.html
import 'dart:math';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:flutter/material.dart';
import 'package:flutter_go/components/widget_demo.dart';
import './demo.dart' as outlineButton;
const String _outlineText0 =
"""### **简介**
> Outline button “边框按钮”
@ -67,105 +61,64 @@ class _DemoState extends State<Demo> {
return WidgetDemo(
title: 'OutlineButton',
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',
);
}
}
// 所有的 OutlineButton 按钮
Widget allOutlineButtons(BuildContext context,_DemoState that){
List allOutlineButtons(BuildContext context,_DemoState that){
final ShapeBorder buttonShape = drawShape(that.buttonShapeType);
return Container(
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column(
//mainAxisSize: MainAxisSize.max,
children: <Widget>[
MarkdownBody(data: _outlineText0),
textAlignBar(_outlineText1),
ButtonBar(
alignment: MainAxisAlignment.spaceAround,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
outlineButton.OutlineButtonDefault(),
SizedBox(width: 20.0), // 间距
outlineButton.OutlineButtonDefault(false),
],
),
textAlignBar(_outlineText2),
ButtonBar(
alignment: MainAxisAlignment.spaceAround,
//mainAxisSize: MainAxisSize.min,
children: <Widget>[
outlineButton.OutlineButtonIconDefault(),
outlineButton.OutlineButtonIconDefault(false),
],
),
ButtonBar(
alignment: MainAxisAlignment.spaceAround,
//mainAxisSize: MainAxisSize.min,
children: <Widget>[
outlineButton.OutlineButtonIconDefault(true, Icons.android),
outlineButton.OutlineButtonIconDefault(true, Icons.announcement),
],
),
textAlignBar(_outlineText3),
SizedBox(height: 10.0),
outlineButton.OutlineButtonCustom('主要按钮',Colors.blue,buttonShape),
SizedBox(height: 10.0),
outlineButton.OutlineButtonCustom('成功按钮',Colors.green,buttonShape),
SizedBox(height: 10.0),
outlineButton.OutlineButtonCustom('信息按钮',Colors.grey,buttonShape),
SizedBox(height: 10.0),
outlineButton.OutlineButtonCustom('警告按钮',Colors.orange,buttonShape),
SizedBox(height: 10.0),
outlineButton.OutlineButtonCustom('危险按钮',Colors.pink,buttonShape),
SizedBox(height: 10.0),
outlineButton.OutlineButtonCustom( '点击切换,随机改变按钮的圆角,边框样式', Colors.blue, buttonShape,
() => that.setButtonShapeType()),
SizedBox(height: 20.0)
])
);
return [
_outlineText0,
_outlineText1,
ButtonBar(
alignment: MainAxisAlignment.spaceAround,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
outlineButton.OutlineButtonDefault(),
SizedBox(width: 20.0), // 间距
outlineButton.OutlineButtonDefault(false),
],
),
_outlineText2,
ButtonBar(
alignment: MainAxisAlignment.spaceAround,
//mainAxisSize: MainAxisSize.min,
children: <Widget>[
outlineButton.OutlineButtonIconDefault(),
outlineButton.OutlineButtonIconDefault(false),
],
),
ButtonBar(
alignment: MainAxisAlignment.spaceAround,
//mainAxisSize: MainAxisSize.min,
children: <Widget>[
outlineButton.OutlineButtonIconDefault(true, Icons.android),
outlineButton.OutlineButtonIconDefault(true, Icons.announcement),
],
),
_outlineText3,
SizedBox(height: 10.0),
outlineButton.OutlineButtonCustom('主要按钮', Colors.blue, buttonShape),
SizedBox(height: 10.0),
outlineButton.OutlineButtonCustom('成功按钮', Colors.green, buttonShape),
SizedBox(height: 10.0),
outlineButton.OutlineButtonCustom('信息按钮', Colors.grey, buttonShape),
SizedBox(height: 10.0),
outlineButton.OutlineButtonCustom('警告按钮', Colors.orange, buttonShape),
SizedBox(height: 10.0),
outlineButton.OutlineButtonCustom('危险按钮', Colors.pink, buttonShape),
SizedBox(height: 10.0),
outlineButton.OutlineButtonCustom(
'点击切换,随机改变按钮的圆角,边框样式', Colors.blue, buttonShape,
() => that.setButtonShapeType()),
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){
final Color _color = _randomColor();
final borderWidth = Random.secure().nextInt(5).toDouble();

View File

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

View File

@ -1,4 +1,4 @@
/// Created with 菜鸟手册.
/// Created with FlutterGo.
/// User: 一晟
/// Date: 2018/11/14
/// Time: 下午4:31
@ -6,11 +6,7 @@
/// target: RaisedButton 的示例
/// 对应文档地址:https://docs.flutter.io/flutter/material/RaisedButton-class.html
import 'package:flutter_markdown/flutter_markdown.dart';
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:flutter_go/components/widget_demo.dart';
import './demo.dart' as raisedButton;
@ -65,102 +61,60 @@ class _DemoState extends State<Demo> {
return WidgetDemo(
title: 'RaisedButton',
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',
);
}
}
// 所有的 RaisedButton 按钮
Widget allRaisedButtons(BuildContext context,_DemoState that){
List allRaisedButtons(BuildContext context,_DemoState that){
final ShapeBorder buttonShape = drawShape(that.buttonShapeType);
return Container(
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column(
//mainAxisSize: MainAxisSize.max,
children: <Widget>[
MarkdownBody(data: _raisedText0),
textAlignBar(_raisedText1),
ButtonBar(
alignment: MainAxisAlignment.spaceAround,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
raisedButton.RaisedButtonDefault(),
SizedBox(width: 20.0), // 间距
raisedButton.RaisedButtonDefault(false),
],
),
textAlignBar(_raisedText2),
ButtonBar(
alignment: MainAxisAlignment.spaceAround,
//mainAxisSize: MainAxisSize.min,
children: <Widget>[
raisedButton.RaisedButtonIconDefault(),
raisedButton.RaisedButtonIconDefault(false),
],
),
ButtonBar(
alignment: MainAxisAlignment.spaceAround,
//mainAxisSize: MainAxisSize.min,
children: <Widget>[
raisedButton.RaisedButtonIconDefault(true, Icons.android),
raisedButton.RaisedButtonIconDefault(true, Icons.announcement),
],
),
textAlignBar(_raisedText3),
SizedBox(height: 10.0),
raisedButton.RaisedButtonCustom('主要按钮',Colors.blue,buttonShape),
SizedBox(height: 10.0),
raisedButton.RaisedButtonCustom('成功按钮',Colors.green,buttonShape),
SizedBox(height: 10.0),
raisedButton.RaisedButtonCustom('信息按钮',Colors.grey,buttonShape),
SizedBox(height: 10.0),
raisedButton.RaisedButtonCustom('警告按钮',Colors.orange,buttonShape),
SizedBox(height: 10.0),
raisedButton.RaisedButtonCustom('危险按钮',Colors.pink,buttonShape),
SizedBox(height: 10.0),
raisedButton.RaisedButtonCustom( '点击切换,按钮的圆角', Colors.blue, buttonShape,
() => that.setButtonShapeType()),
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)
])
);
return [
_raisedText0,
_raisedText1,
ButtonBar(
alignment: MainAxisAlignment.spaceAround,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
raisedButton.RaisedButtonDefault(),
SizedBox(width: 20.0), // 间距
raisedButton.RaisedButtonDefault(false),
],
),
_raisedText2,
ButtonBar(
alignment: MainAxisAlignment.spaceAround,
//mainAxisSize: MainAxisSize.min,
children: <Widget>[
raisedButton.RaisedButtonIconDefault(),
raisedButton.RaisedButtonIconDefault(false),
],
),
ButtonBar(
alignment: MainAxisAlignment.spaceAround,
//mainAxisSize: MainAxisSize.min,
children: <Widget>[
raisedButton.RaisedButtonIconDefault(true, Icons.android),
raisedButton.RaisedButtonIconDefault(true, Icons.announcement),
],
),
_raisedText3,
SizedBox(height: 10.0),
raisedButton.RaisedButtonCustom('主要按钮', Colors.blue, buttonShape),
SizedBox(height: 10.0),
raisedButton.RaisedButtonCustom('成功按钮', Colors.green, buttonShape),
SizedBox(height: 10.0),
raisedButton.RaisedButtonCustom('信息按钮', Colors.grey, buttonShape),
SizedBox(height: 10.0),
raisedButton.RaisedButtonCustom('警告按钮', Colors.orange, buttonShape),
SizedBox(height: 10.0),
raisedButton.RaisedButtonCustom('危险按钮', Colors.pink, buttonShape),
SizedBox(height: 10.0),
raisedButton.RaisedButtonCustom('点击切换,按钮的圆角', Colors.blue, buttonShape,
() => that.setButtonShapeType()),
SizedBox(height: 20.0)
];
}
// 绘制边框信息,比如是否有边框,是否是圆角

View File

@ -1,18 +1,16 @@
/// Created with 菜鸟手册.
/// Created with FlutterGo.
/// User: 一晟
/// Date: 2018/11/14
/// Time: 下午4:31
/// email: zhu.yan@alibaba-inc.com
/// target: RawMaterialButton 的示例
/// 对应文档地址: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_go/components/widget_demo.dart';
import './demo.dart' as rawMaterialButton;
const String _rawMaterialText0 =
"""### **简介**
> RawMaterial button “RawMaterial 按钮”
@ -52,86 +50,47 @@ class _DemoState extends State<Demo> {
return WidgetDemo(
title: 'RawMaterialButton',
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',
);
}
}
// 所有的 RawMaterialButton 按钮
Widget allRawMaterialButtons(BuildContext context,_DemoState that){
// 所有的 RawMaterialButton 按钮
List allRawMaterialButtons(BuildContext context,_DemoState that){
final ShapeBorder buttonShape = drawShape(that.buttonShapeType);
return Container(
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
child: Column(
//mainAxisSize: MainAxisSize.max,
children: <Widget>[
MarkdownBody(data: _rawMaterialText0),
textAlignBar(_rawMaterialText1),
ButtonBar(
alignment: MainAxisAlignment.spaceAround,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
rawMaterialButton.RawMaterialButtonDefault(),
SizedBox(width: 20.0), // 间距
rawMaterialButton.RawMaterialButtonDefault(false),
],
),
textAlignBar(_rawMaterialText2),
SizedBox(height: 10.0),
rawMaterialButton.RawMaterialButtonCustom('主要按钮',Colors.blue,buttonShape),
SizedBox(height: 10.0),
rawMaterialButton.RawMaterialButtonCustom('成功按钮',Colors.green,buttonShape),
SizedBox(height: 10.0),
rawMaterialButton.RawMaterialButtonCustom('信息按钮',Colors.grey,buttonShape),
SizedBox(height: 10.0),
rawMaterialButton.RawMaterialButtonCustom('警告按钮',Colors.orange,buttonShape),
SizedBox(height: 10.0),
rawMaterialButton.RawMaterialButtonCustom('危险按钮',Colors.pink,buttonShape),
SizedBox(height: 10.0),
rawMaterialButton.RawMaterialButtonCustom( '点击切换,观察字体变化', Colors.blue, buttonShape,
() => that.setButtonShapeType()),
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)
])
);
return [
_rawMaterialText0,
_rawMaterialText1,
ButtonBar(
alignment: MainAxisAlignment.spaceAround,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
rawMaterialButton.RawMaterialButtonDefault(),
SizedBox(width: 20.0), // 间距
rawMaterialButton.RawMaterialButtonDefault(false),
],
),
_rawMaterialText2,
SizedBox(height: 10.0),
rawMaterialButton.RawMaterialButtonCustom('主要按钮', Colors.blue, buttonShape),
SizedBox(height: 10.0),
rawMaterialButton.RawMaterialButtonCustom(
'成功按钮', Colors.green, buttonShape),
SizedBox(height: 10.0),
rawMaterialButton.RawMaterialButtonCustom('信息按钮', Colors.grey, buttonShape),
SizedBox(height: 10.0),
rawMaterialButton.RawMaterialButtonCustom(
'警告按钮', Colors.orange, buttonShape),
SizedBox(height: 10.0),
rawMaterialButton.RawMaterialButtonCustom('危险按钮', Colors.pink, buttonShape),
SizedBox(height: 10.0),
rawMaterialButton.RawMaterialButtonCustom(
'点击切换,观察字体变化', Colors.blue, buttonShape,
() => that.setButtonShapeType()),
SizedBox(height: 20.0)
];
}
// 绘制边框信息,比如是否有边框,是否是圆角

View File

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

View File

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

View File

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

View File

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