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

@ -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)
])
);
}