diff --git a/docs/widget/navigator/appbar/index.md b/docs/widget/navigator/appbar/index.md new file mode 100644 index 0000000..74e1a06 --- /dev/null +++ b/docs/widget/navigator/appbar/index.md @@ -0,0 +1 @@ +## **AppBar** \ No newline at end of file diff --git a/docs/widget/navigator/scaffold/index.md b/docs/widget/navigator/scaffold/index.md new file mode 100644 index 0000000..44a38db --- /dev/null +++ b/docs/widget/navigator/scaffold/index.md @@ -0,0 +1,34 @@ +## **Scallold** +> +页面的基础布局结构控件, + +### 构造方法 +``` dart +Scaffold({ +Key key, +PreferredSizeWidget appBar, +Widget body, +Widget floatingActionButton, +FloatingActionButtonLocation floatingActionButtonLocation, +FloatingActionButtonAnimator floatingActionButtonAnimator, +List persistentFooterButtons, +Widget drawer, +Widget endDrawer, +Widget bottomNavigationBar, +Widget bottomSheet, +Color backgroundColor, +bool resizeToAvoidBottomPadding, +bool resizeToAvoidBottomInset, +bool primary: true, +DragStartBehavior drawerDragStartBehavior: DragStartBehavior.down }) +``` + +### 属性介绍 +* appBar: 头部导航条 +* backgroundColor: 页面背景颜色 +* body : 整个scaffold主要显示模块内容 +* bottomNavigationBar:页面地方导航条 +* bottomSheet: 持久可见的底部sheet,即使用户在和其他页面部分有交互,底部sheet依然是可见的。 +可以使用showBottomSheet函数创建和显示模态底部sheet。如果用ShowBottomSheet这个函数 +创建了bottomSheet,那么在build一个含有bottomSheet的新的Scaffold的时候,当前的bottomSheet必须关闭。bottomSheet可以是任何形式的widget +* drawer :页面的抽屉,有从左向右或者从右向左的显示效果 \ No newline at end of file diff --git a/lib/widget/index.dart b/lib/widget/index.dart index 81aa4d1..e42c7cc 100644 --- a/lib/widget/index.dart +++ b/lib/widget/index.dart @@ -1,9 +1,10 @@ import 'scrollview/index.dart' as scrollview; import 'regular/index.dart' as regular; - +import 'navigator/index.dart' as navigator; List getAllWidgets() { List routerMap =[]; routerMap.addAll(scrollview.widgetMap); routerMap.addAll(regular.widgetMap); + routerMap.addAll(navigator.widgetMap); return routerMap; } \ No newline at end of file diff --git a/lib/widget/navigator/appbar/demo.dart b/lib/widget/navigator/appbar/demo.dart new file mode 100644 index 0000000..c759b8f --- /dev/null +++ b/lib/widget/navigator/appbar/demo.dart @@ -0,0 +1,43 @@ +import 'package:flutter/material.dart'; + +class Index extends StatefulWidget { + @override + _IndexState createState() => _IndexState(); +} + +class _IndexState extends State { + _airDress (){ + print( '_airDress'); + } + _restitchDress (){ + print( '_restitchDress'); + } + _repairDress (){ + print( '_repairDress'); + } + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('My Fancy Dress'), + actions: [ + IconButton( + icon: Icon(Icons.playlist_play), + tooltip: 'Air it', + onPressed: _airDress, + ), + IconButton( + icon: Icon(Icons.playlist_add), + tooltip: 'Restitch it', + onPressed: _restitchDress, + ), + IconButton( + icon: Icon(Icons.playlist_add_check), + tooltip: 'Repair it', + onPressed: _repairDress, + ), + ], + ) + ); + } +} \ No newline at end of file diff --git a/lib/widget/navigator/appbar/index.dart b/lib/widget/navigator/appbar/index.dart new file mode 100644 index 0000000..5fc573c --- /dev/null +++ b/lib/widget/navigator/appbar/index.dart @@ -0,0 +1,26 @@ +import 'package:flutter/material.dart'; +import 'package:efox_flutter/components/widgetComp.dart' as WidgetComp; +import 'demo.dart' as Demo; + +class Index extends StatefulWidget { + static String title = 'AppBar'; + static String originCodeUrl = 'https://docs.flutter.io/flutter/material/AppBar-class.html'; + static String mdUrl = 'docs/widget/navigator/appbar/index.md'; + + @override + _IndexState createState() => _IndexState(); +} + +class _IndexState extends State { + @override + Widget build(BuildContext context) { + return WidgetComp.Index( + title: Index.title, + originCodeUrl: Index.originCodeUrl, + mdUrl: Index.mdUrl, + demoChild: [ + Demo.Index() + ], + ); + } +} \ No newline at end of file diff --git a/lib/widget/navigator/index.dart b/lib/widget/navigator/index.dart new file mode 100644 index 0000000..595335d --- /dev/null +++ b/lib/widget/navigator/index.dart @@ -0,0 +1,26 @@ +import 'package:efox_flutter/store/objects/widget_info.dart'; +import 'appbar/index.dart' as appbar; +import 'scaffold/index.dart' as scaffold; +const nameSpaces = '/navigator_'; + +List widgets = [ + ItemInfo( + widget: scaffold.Index(), + code: 57439, // playlist_play + title: scaffold.Index.title, + ), + ItemInfo( + widget: appbar.Index(), + code: 58729, // near_me + title: appbar.Index.title, + ), +]; + +List widgetMap = [ + ItemListInfo( + nameSpaces: nameSpaces, + widgetList: widgets, + typeName: 'navigator', + code: 58717, + ) +]; \ No newline at end of file diff --git a/lib/widget/navigator/scaffold/demo.dart b/lib/widget/navigator/scaffold/demo.dart new file mode 100644 index 0000000..04b754e --- /dev/null +++ b/lib/widget/navigator/scaffold/demo.dart @@ -0,0 +1,33 @@ +import 'package:flutter/material.dart'; + +class Index extends StatefulWidget { + @override + _IndexState createState() => _IndexState(); +} + +class _IndexState extends State { + int _count = 0 ; + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('Sample Code'), + ), + body: Center( + child: Text('You have pressed the button $_count times.'), + ), + bottomNavigationBar: BottomAppBar( + child: Container(height: 50.0,), + ), + bottomSheet: Text( 'bottomSheet123123'), + floatingActionButton: FloatingActionButton( + onPressed: () => setState(() { + _count++; + }), + tooltip: 'Increment Counter', + child: Icon(Icons.add), + ), + floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, + ); + } +} \ No newline at end of file diff --git a/lib/widget/navigator/scaffold/index.dart b/lib/widget/navigator/scaffold/index.dart new file mode 100644 index 0000000..6fb2555 --- /dev/null +++ b/lib/widget/navigator/scaffold/index.dart @@ -0,0 +1,26 @@ +import 'package:flutter/material.dart'; +import 'package:efox_flutter/components/widgetComp.dart' as WidgetComp; +import 'demo.dart' as Demo; + +class Index extends StatefulWidget { + static String title = 'Scaffold'; + static String originCodeUrl = 'https://docs.flutter.io/flutter/material/Scaffold-class.html'; + static String mdUrl = 'docs/widget/navigator/scaffold/index.md'; + + @override + _IndexState createState() => _IndexState(); +} + +class _IndexState extends State { + @override + Widget build(BuildContext context) { + return WidgetComp.Index( + title: Index.title, + originCodeUrl: Index.originCodeUrl, + mdUrl: Index.mdUrl, + demoChild: [ + Demo.Index() + ], + ); + } +} \ No newline at end of file diff --git a/pubspec.yaml b/pubspec.yaml index 032d6e8..459bb11 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -70,6 +70,8 @@ flutter: - docs/widget/regular/table/ - docs/widget/regular/flow/ - docs/widget/regular/stack/ + - docs/widget/navigator/appbar/ + - docs/widget/navigator/scaffold/ # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.io/assets-and-images/#resolution-aware.