diff --git a/lib/views/widgets/StatefulWidget/AppBar/node1_base.dart b/lib/views/widgets/StatefulWidget/AppBar/node1_base.dart index 54f912e..5f2ba33 100755 --- a/lib/views/widgets/StatefulWidget/AppBar/node1_base.dart +++ b/lib/views/widgets/StatefulWidget/AppBar/node1_base.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; -import '../PopupMenuButton.dart'; +import '../PopupMenuButton/node1_base.dart'; /// create by 张风捷特烈 on 2020-03-23 /// contact me by email 1981462002@qq.com diff --git a/lib/views/widgets/StatefulWidget/AppBar/node2_tab.dart b/lib/views/widgets/StatefulWidget/AppBar/node2_tab.dart index e25564a..d8aff46 100755 --- a/lib/views/widgets/StatefulWidget/AppBar/node2_tab.dart +++ b/lib/views/widgets/StatefulWidget/AppBar/node2_tab.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import '../PopupMenuButton.dart'; +import '../PopupMenuButton/node1_base.dart'; /// create by 张风捷特烈 on 2020-03-23 /// contact me by email 1981462002@qq.com /// 详情: diff --git a/lib/views/widgets/StatefulWidget/Ink.dart b/lib/views/widgets/StatefulWidget/Ink/node1_base.dart similarity index 57% rename from lib/views/widgets/StatefulWidget/Ink.dart rename to lib/views/widgets/StatefulWidget/Ink/node1_base.dart index 1a256c4..20adc80 100644 --- a/lib/views/widgets/StatefulWidget/Ink.dart +++ b/lib/views/widgets/StatefulWidget/Ink/node1_base.dart @@ -45,38 +45,3 @@ class CustomInk extends StatelessWidget { } } -// { -// "widgetId": 152, -// "name": 'Ink.image图片水波纹', -// "priority": 2, -// "subtitle": -// " 其中属性与Image组件一致,详见Image组件" -// } - -class InkImage extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Material( - color: Colors.grey[800], - child: Center( - child: Ink.image( - image: AssetImage('assets/images/sabar.jpg'), - fit: BoxFit.cover, - width: 300.0, - height: 200.0, - child: InkWell( - onTap: () {}, - child: Align( - alignment: Alignment.topLeft, - child: Padding( - padding: const EdgeInsets.all(10.0), - child: Text('Chaos', - style: TextStyle( - fontWeight: FontWeight.w900, color: Colors.black)), - ), - )), - ), - ), - ); - } -} diff --git a/lib/views/widgets/StatefulWidget/Ink/node2_image.dart b/lib/views/widgets/StatefulWidget/Ink/node2_image.dart new file mode 100644 index 0000000..2f9acea --- /dev/null +++ b/lib/views/widgets/StatefulWidget/Ink/node2_image.dart @@ -0,0 +1,40 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020-03-26 +/// contact me by email 1981462002@qq.com +/// 说明: +// { +// "widgetId": 152, +// "name": 'Ink.image图片水波纹', +// "priority": 2, +// "subtitle": +// " 其中属性与Image组件一致,详见Image组件" +// } + +class InkImage extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Material( + color: Colors.grey[800], + child: Center( + child: Ink.image( + image: AssetImage('assets/images/sabar.jpg'), + fit: BoxFit.cover, + width: 300.0, + height: 200.0, + child: InkWell( + onTap: () {}, + child: Align( + alignment: Alignment.topLeft, + child: Padding( + padding: const EdgeInsets.all(10.0), + child: Text('Chaos', + style: TextStyle( + fontWeight: FontWeight.w900, color: Colors.black)), + ), + )), + ), + ), + ); + } +} diff --git a/lib/views/widgets/StatefulWidget/InkResponse.dart b/lib/views/widgets/StatefulWidget/InkResponse/node1_base.dart similarity index 53% rename from lib/views/widgets/StatefulWidget/InkResponse.dart rename to lib/views/widgets/StatefulWidget/InkResponse/node1_base.dart index f87bb9d..3294192 100644 --- a/lib/views/widgets/StatefulWidget/InkResponse.dart +++ b/lib/views/widgets/StatefulWidget/InkResponse/node1_base.dart @@ -39,43 +39,4 @@ class _CustomInkResponseState extends State { ), ); } -} - -// { -// "widgetId": 149, -// "name": 'InkResponse其他属性', -// "priority": 2, -// "subtitle": -// "【child】 : 子组件 【Widget】\n" -// "【onHighlightChanged】 : 高亮变化回调 【Function(bool)】\n" -// "【highlightColor】 : 高亮色 【Color】\n" -// "【splashColor】 : 水波纹色 【Color】\n" -// "【radius】 : 水波半径 【double】", -// } - -class ColorInkResponse extends StatefulWidget { - @override - _ColorInkResponseState createState() => _ColorInkResponseState(); -} - -class _ColorInkResponseState extends State { - var _info = 'Push'; - - @override - Widget build(BuildContext context) { - return InkResponse( - onTap: () => {}, - splashColor: Colors.blueAccent, - highlightColor: Colors.orange, - onHighlightChanged: (v) => - setState(() => _info = 'onHighlightChanged:$v'), - radius: 50, - child: Container( - alignment: Alignment.center, - width: 200, - height: 100, - child: Text(_info), - ), - ); - } -} +} \ No newline at end of file diff --git a/lib/views/widgets/StatefulWidget/InkResponse/node2_color.dart b/lib/views/widgets/StatefulWidget/InkResponse/node2_color.dart new file mode 100644 index 0000000..236e4fa --- /dev/null +++ b/lib/views/widgets/StatefulWidget/InkResponse/node2_color.dart @@ -0,0 +1,44 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020-03-25 +/// contact me by email 1981462002@qq.com +/// 说明: + +// { +// "widgetId": 149, +// "name": 'InkResponse其他属性', +// "priority": 2, +// "subtitle": +// "【child】 : 子组件 【Widget】\n" +// "【onHighlightChanged】 : 高亮变化回调 【Function(bool)】\n" +// "【highlightColor】 : 高亮色 【Color】\n" +// "【splashColor】 : 水波纹色 【Color】\n" +// "【radius】 : 水波半径 【double】", +// } + +class ColorInkResponse extends StatefulWidget { + @override + _ColorInkResponseState createState() => _ColorInkResponseState(); +} + +class _ColorInkResponseState extends State { + var _info = 'Push'; + + @override + Widget build(BuildContext context) { + return InkResponse( + onTap: () => {}, + splashColor: Colors.blueAccent, + highlightColor: Colors.orange, + onHighlightChanged: (v) => + setState(() => _info = 'onHighlightChanged:$v'), + radius: 50, + child: Container( + alignment: Alignment.center, + width: 200, + height: 100, + child: Text(_info), + ), + ); + } +} diff --git a/lib/views/widgets/StatefulWidget/InkWell.dart b/lib/views/widgets/StatefulWidget/InkWell/node1_base.dart similarity index 53% rename from lib/views/widgets/StatefulWidget/InkWell.dart rename to lib/views/widgets/StatefulWidget/InkWell/node1_base.dart index f4f9136..de2b03d 100644 --- a/lib/views/widgets/StatefulWidget/InkWell.dart +++ b/lib/views/widgets/StatefulWidget/InkWell/node1_base.dart @@ -39,43 +39,4 @@ class _CustomInkWellState extends State { ), ); } -} - -// { -// "widgetId": 150, -// "name": 'InkWell其他属性', -// "priority": 2, -// "subtitle": -// "【child】 : 子组件 【Widget】\n" -// "【onHighlightChanged】 : 高亮变化回调 【Function(bool)】\n" -// "【highlightColor】 : 高亮色 【Color】\n" -// "【splashColor】 : 水波纹色 【Color】\n" -// "【radius】 : 水波半径 【double】", -// } - -class ColorInkWell extends StatefulWidget { - @override - _ColorInkWellState createState() => _ColorInkWellState(); -} - -class _ColorInkWellState extends State { - var _info = 'Push'; - - @override - Widget build(BuildContext context) { - return InkWell( - onTap: () => {}, - splashColor: Colors.blueAccent, - highlightColor: Colors.orange, - onHighlightChanged: (v) => - setState(() => _info = 'onHighlightChanged:$v'), - radius: 50, - child: Container( - alignment: Alignment.center, - width: 180, - height: 50, - child: Text(_info), - ), - ); - } -} +} \ No newline at end of file diff --git a/lib/views/widgets/StatefulWidget/InkWell/node2_color.dart b/lib/views/widgets/StatefulWidget/InkWell/node2_color.dart new file mode 100644 index 0000000..442a992 --- /dev/null +++ b/lib/views/widgets/StatefulWidget/InkWell/node2_color.dart @@ -0,0 +1,44 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020-03-25 +/// contact me by email 1981462002@qq.com +/// 说明: + +// { +// "widgetId": 150, +// "name": 'InkWell其他属性', +// "priority": 2, +// "subtitle": +// "【child】 : 子组件 【Widget】\n" +// "【onHighlightChanged】 : 高亮变化回调 【Function(bool)】\n" +// "【highlightColor】 : 高亮色 【Color】\n" +// "【splashColor】 : 水波纹色 【Color】\n" +// "【radius】 : 水波半径 【double】", +// } + +class ColorInkWell extends StatefulWidget { + @override + _ColorInkWellState createState() => _ColorInkWellState(); +} + +class _ColorInkWellState extends State { + var _info = 'Push'; + + @override + Widget build(BuildContext context) { + return InkWell( + onTap: () => {}, + splashColor: Colors.blueAccent, + highlightColor: Colors.orange, + onHighlightChanged: (v) => + setState(() => _info = 'onHighlightChanged:$v'), + radius: 50, + child: Container( + alignment: Alignment.center, + width: 180, + height: 50, + child: Text(_info), + ), + ); + } +} diff --git a/lib/views/widgets/StatefulWidget/LicensePage.dart b/lib/views/widgets/StatefulWidget/LicensePage/node1_base.dart similarity index 100% rename from lib/views/widgets/StatefulWidget/LicensePage.dart rename to lib/views/widgets/StatefulWidget/LicensePage/node1_base.dart diff --git a/lib/views/widgets/StatefulWidget/LinearProgressIndicator.dart b/lib/views/widgets/StatefulWidget/LinearProgressIndicator/node1_base.dart similarity index 100% rename from lib/views/widgets/StatefulWidget/LinearProgressIndicator.dart rename to lib/views/widgets/StatefulWidget/LinearProgressIndicator/node1_base.dart diff --git a/lib/views/widgets/StatefulWidget/ListWheelScrollView.dart b/lib/views/widgets/StatefulWidget/ListWheelScrollView/node1_base.dart similarity index 100% rename from lib/views/widgets/StatefulWidget/ListWheelScrollView.dart rename to lib/views/widgets/StatefulWidget/ListWheelScrollView/node1_base.dart diff --git a/lib/views/widgets/StatefulWidget/LongPressDraggable.dart b/lib/views/widgets/StatefulWidget/LongPressDraggable/node1_base.dart similarity index 100% rename from lib/views/widgets/StatefulWidget/LongPressDraggable.dart rename to lib/views/widgets/StatefulWidget/LongPressDraggable/node1_base.dart diff --git a/lib/views/widgets/StatefulWidget/Material/node1_base.dart b/lib/views/widgets/StatefulWidget/Material/node1_base.dart new file mode 100644 index 0000000..1461e84 --- /dev/null +++ b/lib/views/widgets/StatefulWidget/Material/node1_base.dart @@ -0,0 +1,41 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020-03-26 +/// contact me by email 1981462002@qq.com +/// 说明: +// { +// "widgetId": 160, +// "name": 'Material基本使用', +// "priority": 1, +// "subtitle": +// "【child】 : 子组件 【Widget】\n" +// "【type】 : 类型 【MaterialType】\n" +// "【elevation】 : 影深 【double】\n" +// "【shadowColor】 : 阴影颜色 【Color】\n" +// "【color】 : 颜色 【Color】", +// } +class CustomMaterial extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Wrap( + spacing: 10, + runSpacing: 10, + children: MaterialType.values.map((e) => _buildMaterial(e)).toList()); + } + + Material _buildMaterial(MaterialType type) => Material( + shadowColor: Colors.blue, + type: type, + color: Colors.orange, + elevation: 3, + child: Container( + alignment: Alignment.center, + width: 100, + height: 60, + child: Text( + type.toString().split('.')[1], + style: TextStyle(color: Colors.black), + ), + ), + ); +} diff --git a/lib/views/widgets/StatefulWidget/Material.dart b/lib/views/widgets/StatefulWidget/Material/node2_shape.dart similarity index 64% rename from lib/views/widgets/StatefulWidget/Material.dart rename to lib/views/widgets/StatefulWidget/Material/node2_shape.dart index 6c38775..67a3d47 100644 --- a/lib/views/widgets/StatefulWidget/Material.dart +++ b/lib/views/widgets/StatefulWidget/Material/node2_shape.dart @@ -3,43 +3,6 @@ import 'package:flutter/material.dart'; /// create by 张风捷特烈 on 2020-03-26 /// contact me by email 1981462002@qq.com /// 说明: -// { -// "widgetId": 160, -// "name": 'Material基本使用', -// "priority": 1, -// "subtitle": -// "【child】 : 子组件 【Widget】\n" -// "【type】 : 类型 【MaterialType】\n" -// "【elevation】 : 影深 【double】\n" -// "【shadowColor】 : 阴影颜色 【Color】\n" -// "【color】 : 颜色 【Color】", -// } -class CustomMaterial extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Wrap( - spacing: 10, - runSpacing: 10, - children: MaterialType.values.map((e) => _buildMaterial(e)).toList()); - } - - Material _buildMaterial(MaterialType type) => Material( - shadowColor: Colors.blue, - type: type, - color: Colors.orange, - elevation: 3, - child: Container( - alignment: Alignment.center, - width: 100, - height: 60, - child: Text( - type.toString().split('.')[1], - style: TextStyle(color: Colors.black), - ), - ), - ); -} - // { // "widgetId": 160, // "name": 'Material的shape属性', diff --git a/lib/views/widgets/StatefulWidget/MaterialApp.dart b/lib/views/widgets/StatefulWidget/MaterialApp/node1_base.dart similarity index 98% rename from lib/views/widgets/StatefulWidget/MaterialApp.dart rename to lib/views/widgets/StatefulWidget/MaterialApp/node1_base.dart index 9afefa0..0f66d50 100644 --- a/lib/views/widgets/StatefulWidget/MaterialApp.dart +++ b/lib/views/widgets/StatefulWidget/MaterialApp/node1_base.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_unit/app/router.dart'; -import 'package:flutter_unit/views/widgets/StatefulWidget/Scaffold.dart'; +import 'package:flutter_unit/views/widgets/StatefulWidget/Scaffold/node1_base.dart'; /// create by 张风捷特烈 on 2020-03-17 /// contact me by email 1981462002@qq.com diff --git a/lib/views/widgets/StatefulWidget/Overlay.dart b/lib/views/widgets/StatefulWidget/Overlay/node1_base.dart similarity index 100% rename from lib/views/widgets/StatefulWidget/Overlay.dart rename to lib/views/widgets/StatefulWidget/Overlay/node1_base.dart diff --git a/lib/views/widgets/StatefulWidget/PageView.dart b/lib/views/widgets/StatefulWidget/PageView.dart deleted file mode 100644 index 71ec1d0..0000000 --- a/lib/views/widgets/StatefulWidget/PageView.dart +++ /dev/null @@ -1,195 +0,0 @@ -import 'package:flutter/material.dart'; - -/// create by 张风捷特烈 on 2020-03-28 -/// contact me by email 1981462002@qq.com -/// 说明: - -// { -// "widgetId": 165, -// "name": 'PageView基本使用', -// "priority": 1, -// "subtitle": -// "【children】 : 子组件列表 【List】\n" -// "【onPageChanged】 : 点击事件 【ValueChanged】", -// } -class CustomPageView extends StatelessWidget { - final data = [ - Colors.green[50], - Colors.green[100], - Colors.green[200], - Colors.green[300], - Colors.green[400], - Colors.green[500], - Colors.green[600], - Colors.green[700], - Colors.green[800], - Colors.green[900], - ]; - - @override - Widget build(BuildContext context) { - return Container( - height: 150, - child: PageView( - onPageChanged: (position){ - print(position); - }, - children: data - .map((color) => Container( - alignment: Alignment.center, - width: 90, - color: color, - child: Text( - colorString(color), - style: TextStyle(color: Colors.white, - fontSize:24,shadows: [ - Shadow( - color: Colors.black, - offset: Offset(.5, .5), - blurRadius: 2) - ]), - ), - )) - .toList(), - ), - ); - } - String colorString(Color color) => - "#${color.value.toRadixString(16).padLeft(8, '0').toUpperCase()}"; -} -// { -// "widgetId": 165, -// "name": 'PageView滑动方向', -// "priority": 2, -// "subtitle": -// "【scrollDirection】 : 滑动方向 【Axis】\n" -// "【reverse】 : 是否反向 【bool】", -// } -class DirectionPageView extends StatelessWidget { - final data = [ - Colors.orange[50], - Colors.orange[100], - Colors.orange[200], - Colors.orange[300], - Colors.orange[400], - Colors.orange[500], - Colors.orange[600], - Colors.orange[700], - Colors.orange[800], - Colors.orange[900], - ]; - - @override - Widget build(BuildContext context) { - return Container( - height: 150, - child: PageView( - scrollDirection: Axis.vertical, - reverse: true, - onPageChanged: (position) { - print(position); - }, - children: data - .map((color) => - Container( - alignment: Alignment.center, - width: 90, - color: color, - child: Text( - colorString(color), - style: TextStyle(color: Colors.white, - fontSize: 24, shadows: [ - Shadow( - color: Colors.black, - offset: Offset(.5, .5), - blurRadius: 2) - ]), - ), - )) - .toList(), - ), - ); - } - - String colorString(Color color) => - "#${color.value.toRadixString(16).padLeft(8, '0').toUpperCase()}"; -} - -// { -// "widgetId": 165, -// "name": 'PageView控制器简单实用', -// "priority": 3, -// "subtitle": -// "【controller】 : 页面控制器 【PageController】", -// } -class CtrlPageView extends StatefulWidget { - @override - _CtrlPageViewState createState() => _CtrlPageViewState(); -} - -class _CtrlPageViewState extends State { - final data = [ - Colors.orange[50], - Colors.orange[100], - Colors.orange[200], - Colors.orange[300], - Colors.orange[400], - Colors.orange[500], - Colors.orange[600], - Colors.orange[700], - Colors.orange[800], - Colors.orange[900], - ]; - - PageController _controller; - - @override - void dispose() { - _controller.dispose(); - super.dispose(); - } - - @override - void initState() { - super.initState(); - _controller=PageController( - viewportFraction: 0.8, - initialPage: (data.length/2).round() - ); - - } - - @override - Widget build(BuildContext context) { - return Container( - height: 150, - child: PageView( - controller: _controller, - onPageChanged: (position) { - print(position); - }, - children: data - .map((color) => - Container( - alignment: Alignment.center, - width: 90, - color: color, - child: Text( - colorString(color), - style: TextStyle(color: Colors.white, - fontSize: 24, shadows: [ - Shadow( - color: Colors.black, - offset: Offset(.5, .5), - blurRadius: 2) - ]), - ), - )) - .toList(), - ), - ); - } - - String colorString(Color color) => - "#${color.value.toRadixString(16).padLeft(8, '0').toUpperCase()}"; -} \ No newline at end of file diff --git a/lib/views/widgets/StatefulWidget/PageView/node1_base.dart b/lib/views/widgets/StatefulWidget/PageView/node1_base.dart new file mode 100644 index 0000000..5927b1d --- /dev/null +++ b/lib/views/widgets/StatefulWidget/PageView/node1_base.dart @@ -0,0 +1,59 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020-03-28 +/// contact me by email 1981462002@qq.com +/// 说明: + +// { +// "widgetId": 165, +// "name": 'PageView基本使用', +// "priority": 1, +// "subtitle": +// "【children】 : 子组件列表 【List】\n" +// "【onPageChanged】 : 点击事件 【ValueChanged】", +// } +class CustomPageView extends StatelessWidget { + final data = [ + Colors.green[50], + Colors.green[100], + Colors.green[200], + Colors.green[300], + Colors.green[400], + Colors.green[500], + Colors.green[600], + Colors.green[700], + Colors.green[800], + Colors.green[900], + ]; + + @override + Widget build(BuildContext context) { + return Container( + height: 150, + child: PageView( + onPageChanged: (position){ + print(position); + }, + children: data + .map((color) => Container( + alignment: Alignment.center, + width: 90, + color: color, + child: Text( + colorString(color), + style: TextStyle(color: Colors.white, + fontSize:24,shadows: [ + Shadow( + color: Colors.black, + offset: Offset(.5, .5), + blurRadius: 2) + ]), + ), + )) + .toList(), + ), + ); + } + String colorString(Color color) => + "#${color.value.toRadixString(16).padLeft(8, '0').toUpperCase()}"; +} diff --git a/lib/views/widgets/StatefulWidget/PageView/node2_direction.dart b/lib/views/widgets/StatefulWidget/PageView/node2_direction.dart new file mode 100644 index 0000000..63ccf68 --- /dev/null +++ b/lib/views/widgets/StatefulWidget/PageView/node2_direction.dart @@ -0,0 +1,63 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020-03-28 +/// contact me by email 1981462002@qq.com +/// 说明: + +// { +// "widgetId": 165, +// "name": 'PageView滑动方向', +// "priority": 2, +// "subtitle": +// "【scrollDirection】 : 滑动方向 【Axis】\n" +// "【reverse】 : 是否反向 【bool】", +// } +class DirectionPageView extends StatelessWidget { + final data = [ + Colors.orange[50], + Colors.orange[100], + Colors.orange[200], + Colors.orange[300], + Colors.orange[400], + Colors.orange[500], + Colors.orange[600], + Colors.orange[700], + Colors.orange[800], + Colors.orange[900], + ]; + + @override + Widget build(BuildContext context) { + return Container( + height: 150, + child: PageView( + scrollDirection: Axis.vertical, + reverse: true, + onPageChanged: (position) { + print(position); + }, + children: data + .map((color) => + Container( + alignment: Alignment.center, + width: 90, + color: color, + child: Text( + colorString(color), + style: TextStyle(color: Colors.white, + fontSize: 24, shadows: [ + Shadow( + color: Colors.black, + offset: Offset(.5, .5), + blurRadius: 2) + ]), + ), + )) + .toList(), + ), + ); + } + + String colorString(Color color) => + "#${color.value.toRadixString(16).padLeft(8, '0').toUpperCase()}"; +} diff --git a/lib/views/widgets/StatefulWidget/PageView/node3_controller.dart b/lib/views/widgets/StatefulWidget/PageView/node3_controller.dart new file mode 100644 index 0000000..e98c0ba --- /dev/null +++ b/lib/views/widgets/StatefulWidget/PageView/node3_controller.dart @@ -0,0 +1,84 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020-03-28 +/// contact me by email 1981462002@qq.com +/// 说明: + +// { +// "widgetId": 165, +// "name": 'PageView控制器简单实用', +// "priority": 3, +// "subtitle": +// "【controller】 : 页面控制器 【PageController】", +// } +class CtrlPageView extends StatefulWidget { + @override + _CtrlPageViewState createState() => _CtrlPageViewState(); +} + +class _CtrlPageViewState extends State { + final data = [ + Colors.orange[50], + Colors.orange[100], + Colors.orange[200], + Colors.orange[300], + Colors.orange[400], + Colors.orange[500], + Colors.orange[600], + Colors.orange[700], + Colors.orange[800], + Colors.orange[900], + ]; + + PageController _controller; + + @override + void dispose() { + _controller.dispose(); + super.dispose(); + } + + @override + void initState() { + super.initState(); + _controller=PageController( + viewportFraction: 0.8, + initialPage: (data.length/2).round() + ); + + } + + @override + Widget build(BuildContext context) { + return Container( + height: 150, + child: PageView( + controller: _controller, + onPageChanged: (position) { + print(position); + }, + children: data + .map((color) => + Container( + alignment: Alignment.center, + width: 90, + color: color, + child: Text( + colorString(color), + style: TextStyle(color: Colors.white, + fontSize: 24, shadows: [ + Shadow( + color: Colors.black, + offset: Offset(.5, .5), + blurRadius: 2) + ]), + ), + )) + .toList(), + ), + ); + } + + String colorString(Color color) => + "#${color.value.toRadixString(16).padLeft(8, '0').toUpperCase()}"; +} \ No newline at end of file diff --git a/lib/views/widgets/StatefulWidget/PopupMenuButton.dart b/lib/views/widgets/StatefulWidget/PopupMenuButton/node1_base.dart similarity index 100% rename from lib/views/widgets/StatefulWidget/PopupMenuButton.dart rename to lib/views/widgets/StatefulWidget/PopupMenuButton/node1_base.dart diff --git a/lib/views/widgets/StatefulWidget/PopupMenuDivider.dart b/lib/views/widgets/StatefulWidget/PopupMenuDivider/node1_base.dart similarity index 100% rename from lib/views/widgets/StatefulWidget/PopupMenuDivider.dart rename to lib/views/widgets/StatefulWidget/PopupMenuDivider/node1_base.dart diff --git a/lib/views/widgets/StatefulWidget/PositionedTransition.dart b/lib/views/widgets/StatefulWidget/PositionedTransition/node1_base.dart similarity index 94% rename from lib/views/widgets/StatefulWidget/PositionedTransition.dart rename to lib/views/widgets/StatefulWidget/PositionedTransition/node1_base.dart index e397469..82eb148 100644 --- a/lib/views/widgets/StatefulWidget/PositionedTransition.dart +++ b/lib/views/widgets/StatefulWidget/PositionedTransition/node1_base.dart @@ -1,5 +1,7 @@ import 'package:flutter/material.dart'; - +/// create by 张风捷特烈 on 2020-03-29 +/// contact me by email 1981462002@qq.com +/// 说明: // { // "widgetId": 92, // "name": 'PositionedTransition基本使用', diff --git a/lib/views/widgets/StatefulWidget/Radio.dart b/lib/views/widgets/StatefulWidget/Radio/node1_base.dart similarity index 90% rename from lib/views/widgets/StatefulWidget/Radio.dart rename to lib/views/widgets/StatefulWidget/Radio/node1_base.dart index 562a72d..f365991 100644 --- a/lib/views/widgets/StatefulWidget/Radio.dart +++ b/lib/views/widgets/StatefulWidget/Radio/node1_base.dart @@ -1,4 +1,8 @@ import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020-03-29 +/// contact me by email 1981462002@qq.com +/// 说明: // { // "widgetId": 45, // "name": 'Radio基本使用', diff --git a/lib/views/widgets/StatefulWidget/RangerSlider.dart b/lib/views/widgets/StatefulWidget/RangeSlider/node1_base.dart similarity index 94% rename from lib/views/widgets/StatefulWidget/RangerSlider.dart rename to lib/views/widgets/StatefulWidget/RangeSlider/node1_base.dart index ee6c761..97bff14 100644 --- a/lib/views/widgets/StatefulWidget/RangerSlider.dart +++ b/lib/views/widgets/StatefulWidget/RangeSlider/node1_base.dart @@ -1,4 +1,7 @@ import 'package:flutter/material.dart'; +/// create by 张风捷特烈 on 2020-03-29 +/// contact me by email 1981462002@qq.com +/// 说明: // { // "widgetId": 44, // "name": 'Slider基本使用', diff --git a/lib/views/widgets/StatefulWidget/RawChip/node1_press.dart b/lib/views/widgets/StatefulWidget/RawChip/node1_press.dart new file mode 100644 index 0000000..48cc0df --- /dev/null +++ b/lib/views/widgets/StatefulWidget/RawChip/node1_press.dart @@ -0,0 +1,39 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_unit/views/dialogs/dialog_about.dart'; + +/// create by 张风捷特烈 on 2020-03-26 +/// contact me by email 1981462002@qq.com +/// 说明: + +// { +// "widgetId": 153, +// "name": 'RawChip点击效果', +// "priority": 1, +// "subtitle": +// "【label】: 中间组件 【Widget】\n" +// "【padding】 : 内边距 【EdgeInsetsGeometry】\n" +// "【labelPadding】 : label边距 【EdgeInsetsGeometry】\n" +// "【shadowColor】: 阴影色 【Color】\n" +// "【avatar】: 左侧组件 【Widget】\n" +// "【elevation】: 影深 【double】\n" +// "【pressElevation】: 点击时影深 【double】\n" +// "【onPressed】 : 点击事件 【Function()】", +// } +class PressRawChip extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Container( + child: RawChip( + padding: EdgeInsets.all(5), + labelPadding: EdgeInsets.all(3), + label: Text('张风捷特烈'), + avatar: Image.asset("assets/images/icon_head.png"), + elevation: 3, + pressElevation: 5, + shadowColor: Colors.orangeAccent, + onPressed: () => DialogAbout.show(context), + ), + ); + } +} diff --git a/lib/views/widgets/StatefulWidget/RawChip.dart b/lib/views/widgets/StatefulWidget/RawChip/node2_select.dart similarity index 58% rename from lib/views/widgets/StatefulWidget/RawChip.dart rename to lib/views/widgets/StatefulWidget/RawChip/node2_select.dart index db324d1..d143929 100644 --- a/lib/views/widgets/StatefulWidget/RawChip.dart +++ b/lib/views/widgets/StatefulWidget/RawChip/node2_select.dart @@ -6,38 +6,6 @@ import 'package:flutter_unit/views/dialogs/dialog_about.dart'; /// contact me by email 1981462002@qq.com /// 说明: -// { -// "widgetId": 153, -// "name": 'RawChip点击效果', -// "priority": 1, -// "subtitle": -// "【label】: 中间组件 【Widget】\n" -// "【padding】 : 内边距 【EdgeInsetsGeometry】\n" -// "【labelPadding】 : label边距 【EdgeInsetsGeometry】\n" -// "【shadowColor】: 阴影色 【Color】\n" -// "【avatar】: 左侧组件 【Widget】\n" -// "【elevation】: 影深 【double】\n" -// "【pressElevation】: 点击时影深 【double】\n" -// "【onPressed】 : 点击事件 【Function()】", -// } -class PressRawChip extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Container( - child: RawChip( - padding: EdgeInsets.all(5), - labelPadding: EdgeInsets.all(3), - label: Text('张风捷特烈'), - avatar: Image.asset("assets/images/icon_head.png"), - elevation: 3, - pressElevation: 5, - shadowColor: Colors.orangeAccent, - onPressed: () => DialogAbout.show(context), - ), - ); - } -} - // { // "widgetId": 153, // "name": 'RawChip选中和删除效果', diff --git a/lib/views/widgets/StatefulWidget/RawMaterialButton/node1_base.dart b/lib/views/widgets/StatefulWidget/RawMaterialButton/node1_base.dart new file mode 100644 index 0000000..91dca57 --- /dev/null +++ b/lib/views/widgets/StatefulWidget/RawMaterialButton/node1_base.dart @@ -0,0 +1,59 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_unit/views/dialogs/dialog_about.dart'; + +/// create by 张风捷特烈 on 2020-03-29 +/// contact me by email 1981462002@qq.com +/// 说明: +// { +// "widgetId": 175, +// "name": 'RawMaterialButton基本使用', +// "priority": 1, +// "subtitle": +// "【child】 : 子组件 【Widget】\n" +// "【elevation】 : 影深 【double】\n" +// "【fillColor】 : 填充色 【Color】\n" +// "【splashColor】 : 水波纹色 【Color】\n" +// "【textStyle】 : 文字样式 【TextStyle】\n" +// "【onLongPress】 : 长按事件 【Function()】\n" +// "【onPressed】 : 点击事件 【Function()】", +// } +class CustomRawMaterialButton extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Container( + child: Wrap( + spacing: 20, + children: [ + RawMaterialButton( + elevation: 2, + fillColor: Colors.green, + splashColor: Colors.orange, + textStyle: TextStyle(color: Colors.white), + onLongPress: ()=>print('onLongPress'), + child: Icon(Icons.remove), + onPressed: ()=>print('onPressed'), + ), + RawMaterialButton( + elevation: 2, + fillColor: Colors.blue, + splashColor: Colors.orange, + textStyle: TextStyle(color: Colors.white), + onLongPress: ()=>print('onLongPress'), + child: Text('Push'), + onPressed: ()=>print('onPressed'), + ), + RawMaterialButton( + elevation: 2, + fillColor: Colors.red, + splashColor: Colors.orange, + textStyle: TextStyle(color: Colors.white), + onLongPress: ()=>print('onLongPress'), + child: Icon(Icons.add), + onPressed: ()=>print('onPressed'), + ), + + ], + ), + ); + } +} \ No newline at end of file diff --git a/lib/views/widgets/StatefulWidget/RawMaterialButton.dart b/lib/views/widgets/StatefulWidget/RawMaterialButton/node2_shape.dart similarity index 52% rename from lib/views/widgets/StatefulWidget/RawMaterialButton.dart rename to lib/views/widgets/StatefulWidget/RawMaterialButton/node2_shape.dart index dac5c3e..8fb19a7 100644 --- a/lib/views/widgets/StatefulWidget/RawMaterialButton.dart +++ b/lib/views/widgets/StatefulWidget/RawMaterialButton/node2_shape.dart @@ -3,64 +3,11 @@ import 'package:flutter_unit/views/dialogs/dialog_about.dart'; /// create by 张风捷特烈 on 2020-03-29 /// contact me by email 1981462002@qq.com -/// 说明: -// { -// "widgetId": 175, -// "name": 'RawMaterialButton基本使用', -// "priority": 1, -// "subtitle": -// "【child】 : 子组件 【Widget】\n" -// "【elevation】 : 影深 【double】\n" -// "【fillColor】 : 填充色 【Color】\n" -// "【splashColor】 : 水波纹色 【Color】\n" -// "【textStyle】 : 文字样式 【TextStyle】\n" -// "【onLongPress】 : 长按事件 【Function()】\n" -// "【onPressed】 : 点击事件 【Function()】", -// } -class CustomRawMaterialButton extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Container( - child: Wrap( - spacing: 20, - children: [ - RawMaterialButton( - elevation: 2, - fillColor: Colors.green, - splashColor: Colors.orange, - textStyle: TextStyle(color: Colors.white), - onLongPress: ()=>print('onLongPress'), - child: Icon(Icons.remove), - onPressed: ()=>print('onPressed'), - ), - RawMaterialButton( - elevation: 2, - fillColor: Colors.blue, - splashColor: Colors.orange, - textStyle: TextStyle(color: Colors.white), - onLongPress: ()=>print('onLongPress'), - child: Text('Push'), - onPressed: ()=>print('onPressed'), - ), - RawMaterialButton( - elevation: 2, - fillColor: Colors.red, - splashColor: Colors.orange, - textStyle: TextStyle(color: Colors.white), - onLongPress: ()=>print('onLongPress'), - child: Icon(Icons.add), - onPressed: ()=>print('onPressed'), - ), - - ], - ), - ); - } -} +/// 说明: // { // "widgetId": 175, -// "name": 'RawMaterialButton基本使用', +// "name": 'RawMaterialButton高亮和形状', // "priority": 2, // "subtitle": // "【highlightElevation】 : 高亮影深 【double】\n" diff --git a/lib/views/widgets/StatefulWidget/RefreshIndicator.dart b/lib/views/widgets/StatefulWidget/RefreshIndicator/node1_base.dart similarity index 100% rename from lib/views/widgets/StatefulWidget/RefreshIndicator.dart rename to lib/views/widgets/StatefulWidget/RefreshIndicator/node1_base.dart diff --git a/lib/views/widgets/StatefulWidget/RelativePositionedTransition.dart b/lib/views/widgets/StatefulWidget/RelativePositionedTransition/node1_base.dart similarity index 100% rename from lib/views/widgets/StatefulWidget/RelativePositionedTransition.dart rename to lib/views/widgets/StatefulWidget/RelativePositionedTransition/node1_base.dart diff --git a/lib/views/widgets/StatefulWidget/ReorderableListView.dart b/lib/views/widgets/StatefulWidget/ReorderableListView/node1_base.dart similarity index 55% rename from lib/views/widgets/StatefulWidget/ReorderableListView.dart rename to lib/views/widgets/StatefulWidget/ReorderableListView/node1_base.dart index 078c137..09c2bfa 100644 --- a/lib/views/widgets/StatefulWidget/ReorderableListView.dart +++ b/lib/views/widgets/StatefulWidget/ReorderableListView/node1_base.dart @@ -76,76 +76,6 @@ class _CustomReorderableListViewState extends State { ); } - String colorString(Color color) => - "#${color.value.toRadixString(16).padLeft(8, '0').toUpperCase()}"; -} -// { -// "widgetId": 177, -// "name": 'ReorderableListView滑动方向', -// "priority": 2, -// "subtitle": -// "【scrollDirection】 : 滑动方向 【Axis】\n" -// "【reverse】 : 是否反向 【bool】", -// } -class DirectionReorderableListView extends StatefulWidget { - @override - _DirectionReorderableListViewState createState() => _DirectionReorderableListViewState(); -} - -class _DirectionReorderableListViewState extends State { - var data = [ - Colors.yellow[50], - Colors.yellow[100], - Colors.yellow[200], - Colors.yellow[300], - Colors.yellow[400], - Colors.yellow[500], - Colors.yellow[600], - Colors.yellow[700], - Colors.yellow[800], - Colors.yellow[900], - ]; - - @override - Widget build(BuildContext context) { - return Container( - height: 200, - child: ReorderableListView( - scrollDirection: Axis.horizontal, - reverse: false, - onReorder: _handleReorder, - children: data.map((color) => _buildItem(color)).toList(), - ), - ); - } - - void _handleReorder(int oldIndex, int newIndex) { - if (oldIndex < newIndex) { - newIndex -= 1; - } - - setState(() { - final element = data.removeAt(oldIndex); - data.insert(newIndex, element); - }); - - } - - Widget _buildItem(Color color) { - return Container( - key: ValueKey(color) , - alignment: Alignment.center, - width: 80, - color: color, - child: Text( - colorString(color), - style: TextStyle(color: Colors.white, shadows: [ - Shadow(color: Colors.black, offset: Offset(.5, .5), blurRadius: 2) - ]), - ), - ); - } - String colorString(Color color) => "#${color.value.toRadixString(16).padLeft(8, '0').toUpperCase()}"; } \ No newline at end of file diff --git a/lib/views/widgets/StatefulWidget/ReorderableListView/node2_direction.dart b/lib/views/widgets/StatefulWidget/ReorderableListView/node2_direction.dart new file mode 100644 index 0000000..a073612 --- /dev/null +++ b/lib/views/widgets/StatefulWidget/ReorderableListView/node2_direction.dart @@ -0,0 +1,76 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020-03-30 +/// contact me by email 1981462002@qq.com +/// 说明: + +// { +// "widgetId": 177, +// "name": 'ReorderableListView滑动方向', +// "priority": 2, +// "subtitle": +// "【scrollDirection】 : 滑动方向 【Axis】\n" +// "【reverse】 : 是否反向 【bool】", +// } +class DirectionReorderableListView extends StatefulWidget { + @override + _DirectionReorderableListViewState createState() => _DirectionReorderableListViewState(); +} + +class _DirectionReorderableListViewState extends State { + var data = [ + Colors.yellow[50], + Colors.yellow[100], + Colors.yellow[200], + Colors.yellow[300], + Colors.yellow[400], + Colors.yellow[500], + Colors.yellow[600], + Colors.yellow[700], + Colors.yellow[800], + Colors.yellow[900], + ]; + + @override + Widget build(BuildContext context) { + return Container( + height: 200, + child: ReorderableListView( + scrollDirection: Axis.horizontal, + reverse: false, + onReorder: _handleReorder, + children: data.map((color) => _buildItem(color)).toList(), + ), + ); + } + + void _handleReorder(int oldIndex, int newIndex) { + if (oldIndex < newIndex) { + newIndex -= 1; + } + + setState(() { + final element = data.removeAt(oldIndex); + data.insert(newIndex, element); + }); + + } + + Widget _buildItem(Color color) { + return Container( + key: ValueKey(color) , + alignment: Alignment.center, + width: 80, + color: color, + child: Text( + colorString(color), + style: TextStyle(color: Colors.white, shadows: [ + Shadow(color: Colors.black, offset: Offset(.5, .5), blurRadius: 2) + ]), + ), + ); + } + + String colorString(Color color) => + "#${color.value.toRadixString(16).padLeft(8, '0').toUpperCase()}"; +} \ No newline at end of file diff --git a/lib/views/widgets/StatefulWidget/RotationTransition.dart b/lib/views/widgets/StatefulWidget/RotationTransition/node1_base.dart similarity index 100% rename from lib/views/widgets/StatefulWidget/RotationTransition.dart rename to lib/views/widgets/StatefulWidget/RotationTransition/node1_base.dart diff --git a/lib/views/widgets/StatefulWidget/Scaffold.dart b/lib/views/widgets/StatefulWidget/Scaffold/node1_base.dart similarity index 99% rename from lib/views/widgets/StatefulWidget/Scaffold.dart rename to lib/views/widgets/StatefulWidget/Scaffold/node1_base.dart index 4485858..bde5495 100755 --- a/lib/views/widgets/StatefulWidget/Scaffold.dart +++ b/lib/views/widgets/StatefulWidget/Scaffold/node1_base.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:flutter_unit/views/widgets/StatefulWidget/PopupMenuButton.dart'; +import 'package:flutter_unit/views/widgets/StatefulWidget/PopupMenuButton/node1_base.dart'; // { // "widgetId": 64, diff --git a/lib/views/widgets/StatefulWidget/ScaleTransition.dart b/lib/views/widgets/StatefulWidget/ScaleTransition/node1_base.dart similarity index 100% rename from lib/views/widgets/StatefulWidget/ScaleTransition.dart rename to lib/views/widgets/StatefulWidget/ScaleTransition/node1_base.dart diff --git a/lib/views/widgets/StatefulWidget/Scrollbar.dart b/lib/views/widgets/StatefulWidget/Scrollbar/node1_base.dart similarity index 100% rename from lib/views/widgets/StatefulWidget/Scrollbar.dart rename to lib/views/widgets/StatefulWidget/Scrollbar/node1_base.dart diff --git a/lib/views/widgets/StatefulWidget/SelectableText/node1_base.dart b/lib/views/widgets/StatefulWidget/SelectableText/node1_base.dart new file mode 100644 index 0000000..fd26b31 --- /dev/null +++ b/lib/views/widgets/StatefulWidget/SelectableText/node1_base.dart @@ -0,0 +1,39 @@ +import 'package:flutter/material.dart'; +/// create by 张风捷特烈 on 2020-03-31 +/// contact me by email 1981462002@qq.com +/// 说明: +// { +// "widgetId": 53, +// "name": 'SelectableText基本使用', +// "priority": 1, +// "subtitle": +// "【入参】 : 显示文字 【String】\n" +// "【style】 : 文字样式 【TextStyle】\n" +// "【cursorRadius】 : 光标半径 【Radius】\n" +// "【cursorColor】 : 光标颜色 【Color】\n" +// "【cursorWidth】 : 光标宽度 【double】\n" +// "【showCursor】 : 是否显示光标 【bool】\n" +// "【autofocus】 : 自动聚焦 【bool】" +// } +class CustomSelectableText extends StatelessWidget { + final text = " 始臣之解牛之时,所见无非牛者。三年之后,未尝见全牛也。方今之时," + "臣以神遇而不以目视,官知止而神欲行。依乎天理,批大郤,导大窾,因其固然," + "技经肯綮之未尝,而况大軱乎!良庖岁更刀,割也;族庖月更刀,折也。" + "今臣之刀十九年矣,所解数千牛矣,而刀刃若新发于硎。彼节者有间,而刀刃者无厚;" + "以无厚入有间,恢恢乎其于游刃必有余地矣,是以十九年而刀刃若新发于硎。" + "虽然,每至于族,吾见其难为,怵然为戒,视为止,行为迟。动刀甚微,謋然已解,如土委地。" + "提刀而立,为之四顾,为之踌躇满志,善刀而藏之."; + + @override + Widget build(BuildContext context) { + return SelectableText( + text, + style: TextStyle(fontSize: 18, color: Colors.orange), + cursorColor: Colors.green, + cursorRadius: Radius.circular(3), + cursorWidth: 5, + showCursor: true, + autofocus: false, + ); + } +} diff --git a/lib/views/widgets/StatefulWidget/SelectableText.dart b/lib/views/widgets/StatefulWidget/SelectableText/node2_align.dart similarity index 54% rename from lib/views/widgets/StatefulWidget/SelectableText.dart rename to lib/views/widgets/StatefulWidget/SelectableText/node2_align.dart index 41aa2a0..41667e8 100644 --- a/lib/views/widgets/StatefulWidget/SelectableText.dart +++ b/lib/views/widgets/StatefulWidget/SelectableText/node2_align.dart @@ -1,41 +1,8 @@ import 'package:flutter/material.dart'; -// { -// "widgetId": 53, -// "name": 'SelectableText基本使用', -// "priority": 1, -// "subtitle": -// "【入参】 : 显示文字 【String】\n" -// "【style】 : 文字样式 【TextStyle】\n" -// "【cursorRadius】 : 光标半径 【Radius】\n" -// "【cursorColor】 : 光标颜色 【Color】\n" -// "【cursorWidth】 : 光标宽度 【double】\n" -// "【showCursor】 : 是否显示光标 【bool】\n" -// "【autofocus】 : 自动聚焦 【bool】" -// } -class CustomSelectableText extends StatelessWidget { - final text = " 始臣之解牛之时,所见无非牛者。三年之后,未尝见全牛也。方今之时," - "臣以神遇而不以目视,官知止而神欲行。依乎天理,批大郤,导大窾,因其固然," - "技经肯綮之未尝,而况大軱乎!良庖岁更刀,割也;族庖月更刀,折也。" - "今臣之刀十九年矣,所解数千牛矣,而刀刃若新发于硎。彼节者有间,而刀刃者无厚;" - "以无厚入有间,恢恢乎其于游刃必有余地矣,是以十九年而刀刃若新发于硎。" - "虽然,每至于族,吾见其难为,怵然为戒,视为止,行为迟。动刀甚微,謋然已解,如土委地。" - "提刀而立,为之四顾,为之踌躇满志,善刀而藏之."; - - @override - Widget build(BuildContext context) { - return SelectableText( - text, - style: TextStyle(fontSize: 18, color: Colors.orange), - cursorColor: Colors.green, - cursorRadius: Radius.circular(3), - cursorWidth: 5, - showCursor: true, - autofocus: false, - ); - } -} - +/// create by 张风捷特烈 on 2020-03-31 +/// contact me by email 1981462002@qq.com +/// 说明: // { // "widgetId": 53, // "name": 'SelectableText对齐属性', diff --git a/lib/views/widgets/StatefulWidget/SizeTransition.dart b/lib/views/widgets/StatefulWidget/SizeTransition/node1_base.dart similarity index 95% rename from lib/views/widgets/StatefulWidget/SizeTransition.dart rename to lib/views/widgets/StatefulWidget/SizeTransition/node1_base.dart index 535d0d5..ead3be6 100644 --- a/lib/views/widgets/StatefulWidget/SizeTransition.dart +++ b/lib/views/widgets/StatefulWidget/SizeTransition/node1_base.dart @@ -1,6 +1,8 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; - +/// create by 张风捷特烈 on 2020-03-31 +/// contact me by email 1981462002@qq.com +/// 说明: // { // "widgetId": 92, // "name": 'FadeTransition基本使用', diff --git a/lib/views/widgets/StatefulWidget/SlideTransition.dart b/lib/views/widgets/StatefulWidget/SlideTransition/node1_base.dart similarity index 100% rename from lib/views/widgets/StatefulWidget/SlideTransition.dart rename to lib/views/widgets/StatefulWidget/SlideTransition/node1_base.dart diff --git a/lib/views/widgets/StatefulWidget/Slider/node1_base.dart b/lib/views/widgets/StatefulWidget/Slider/node1_base.dart new file mode 100644 index 0000000..720d781 --- /dev/null +++ b/lib/views/widgets/StatefulWidget/Slider/node1_base.dart @@ -0,0 +1,44 @@ +import 'package:flutter/material.dart'; +/// create by 张风捷特烈 on 2020-03-31 +/// contact me by email 1981462002@qq.com +/// 说明: +// { +// "widgetId": 42, +// "name": 'Slider基本使用', +// "priority": 1, +// "subtitle": +// "【value】 : 数值 【double】\n" +// "【min】 : 最小值 【double】\n" +// "【max】 : 最大值 【double】\n" +// "【activeColor】 : 激活颜色 【Color】\n" +// "【inactiveColor】 : 非激活颜色 【Color】\n" +// "【onChanged】 : 改变时回调 【Function(double)】", +// } +class CustomSlider extends StatefulWidget { + @override + _CustomSliderState createState() => _CustomSliderState(); +} + +class _CustomSliderState extends State { + double _value = 0.0; + + @override + Widget build(BuildContext context) { + return Column( + children: [ + Text('当前值:${_value.toStringAsFixed(1)}'), + Slider( + value: _value, + min: 0.0, + max: 360.0, + activeColor: Colors.orangeAccent, + inactiveColor: Colors.green.withAlpha(99), + onChanged: (value) { + setState(() { + _value = value; + }); + }), + ], + ); + } +} diff --git a/lib/views/widgets/StatefulWidget/Slider.dart b/lib/views/widgets/StatefulWidget/Slider/node2_lable.dart similarity index 51% rename from lib/views/widgets/StatefulWidget/Slider.dart rename to lib/views/widgets/StatefulWidget/Slider/node2_lable.dart index f4fe001..86f8901 100644 --- a/lib/views/widgets/StatefulWidget/Slider.dart +++ b/lib/views/widgets/StatefulWidget/Slider/node2_lable.dart @@ -1,46 +1,8 @@ import 'package:flutter/material.dart'; -// { -// "widgetId": 42, -// "name": 'Slider基本使用', -// "priority": 1, -// "subtitle": -// "【value】 : 数值 【double】\n" -// "【min】 : 最小值 【double】\n" -// "【max】 : 最大值 【double】\n" -// "【activeColor】 : 激活颜色 【Color】\n" -// "【inactiveColor】 : 非激活颜色 【Color】\n" -// "【onChanged】 : 改变时回调 【Function(double)】", -// } -class CustomSlider extends StatefulWidget { - @override - _CustomSliderState createState() => _CustomSliderState(); -} - -class _CustomSliderState extends State { - double _value = 0.0; - - @override - Widget build(BuildContext context) { - return Column( - children: [ - Text('当前值:${_value.toStringAsFixed(1)}'), - Slider( - value: _value, - min: 0.0, - max: 360.0, - activeColor: Colors.orangeAccent, - inactiveColor: Colors.green.withAlpha(99), - onChanged: (value) { - setState(() { - _value = value; - }); - }), - ], - ); - } -} - +/// create by 张风捷特烈 on 2020-03-31 +/// contact me by email 1981462002@qq.com +/// 说明: // { // "widgetId": 42, // "name": 'Slider的分段与标签', diff --git a/lib/views/widgets/StatefulWidget/Stepper.dart b/lib/views/widgets/StatefulWidget/Stepper/node1_base.dart similarity index 53% rename from lib/views/widgets/StatefulWidget/Stepper.dart rename to lib/views/widgets/StatefulWidget/Stepper/node1_base.dart index 2b06d00..d77d9a9 100644 --- a/lib/views/widgets/StatefulWidget/Stepper.dart +++ b/lib/views/widgets/StatefulWidget/Stepper/node1_base.dart @@ -109,105 +109,3 @@ class _StepperDemoState extends State { return StepState.indexed; } } - -// { -// "widgetId": 200, -// "name": 'Stepper的方向', -// "priority": 2, -// "subtitle": -// "【type】 : 方向 【StepperType】", -// } -class VerticalStepper extends StatefulWidget { - @override - _VerticalStepperState createState() => _VerticalStepperState(); -} - -class _VerticalStepperState extends State { - int _position = 0; - - final stepsData = { - "填写表单":'请按表单填写个人信息。', - "邮箱校验":'已将邮件发送至您的邮箱,请按照相关指示对您的账号进行邮箱校验。', - "注册完成":'恭喜您,注册完成!', - }; - - final steps = [ - Step( - title: Text("填写表单"), - content: Container(height: 60, child: Text("请按表单填写个人信息")), - ), - Step(title: Text("邮箱校验"), content: Text("请对您的账号进行邮箱校验")), - Step(title: Text("注册完成"), content: Text("恭喜您,注册完成")), - ]; - - @override - Widget build(BuildContext context) { - return Container( - child: Stepper( - type:StepperType.vertical, - currentStep: _position, - onStepTapped: (index) { - setState(() { - _position = index; - }); - }, - onStepContinue: () { - setState(() { - if (_position < 2) { - _position++; - } - }); - }, - onStepCancel: () { - if (_position > 0) { - setState(() { - _position--; - }); - } - }, - controlsBuilder: (_, - {VoidCallback onStepContinue, VoidCallback onStepCancel}) { - return Row( - children: [ - RaisedButton( - color: Colors.blue, - shape: CircleBorder( - side: BorderSide(width: 2.0, color: Color(0xFFFFDFDFDF)), - ), - onPressed: onStepContinue, - child: Icon( - Icons.check, - color: Colors.white, - ), - ), - RaisedButton( - color: Colors.red, - shape: CircleBorder( - side: BorderSide(width: 2.0, color: Color(0xFFFFDFDFDF)), - ), - onPressed: onStepCancel, - child: Icon( - Icons.keyboard_backspace, - color: Colors.white, - ), - ), - ], - ); - }, - steps: stepsData.keys.map((e){ - bool isActive = stepsData.keys.toList().indexOf(e) ==_position; - return Step( - title: Text(e,style: TextStyle(color: isActive?Colors.blue:Colors.black),), - isActive: isActive, - state: _getState(stepsData.keys.toList().indexOf(e)), - content: Container(height: 60, child: Text(stepsData[e])), - ); - }).toList()), - ); - } - _getState(index){ - if(_position==index) return StepState.editing; - if(_position>index) return StepState.complete; - return StepState.indexed; - } -} diff --git a/lib/views/widgets/StatefulWidget/Stepper/node2_type.dart b/lib/views/widgets/StatefulWidget/Stepper/node2_type.dart new file mode 100644 index 0000000..1269040 --- /dev/null +++ b/lib/views/widgets/StatefulWidget/Stepper/node2_type.dart @@ -0,0 +1,111 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020-04-01 +/// contact me by email 1981462002@qq.com +/// 说明: + +// { +// "widgetId": 200, +// "name": 'Stepper的方向', +// "priority": 2, +// "subtitle": +// "【type】 : 方向 【StepperType】", +// } +class VerticalStepper extends StatefulWidget { + @override + _VerticalStepperState createState() => _VerticalStepperState(); +} + +class _VerticalStepperState extends State { + int _position = 0; + + final stepsData = { + "填写表单": '请按表单填写个人信息。', + "邮箱校验": '已将邮件发送至您的邮箱,请按照相关指示对您的账号进行邮箱校验。', + "注册完成": '恭喜您,注册完成!', + }; + + final steps = [ + Step( + title: Text("填写表单"), + content: Container(height: 60, child: Text("请按表单填写个人信息")), + ), + Step(title: Text("邮箱校验"), content: Text("请对您的账号进行邮箱校验")), + Step(title: Text("注册完成"), content: Text("恭喜您,注册完成")), + ]; + + @override + Widget build(BuildContext context) { + return Container( + child: Stepper( + type: StepperType.vertical, + currentStep: _position, + onStepTapped: (index) { + setState(() { + _position = index; + }); + }, + onStepContinue: () { + setState(() { + if (_position < 2) { + _position++; + } + }); + }, + onStepCancel: () { + if (_position > 0) { + setState(() { + _position--; + }); + } + }, + controlsBuilder: (_, + {VoidCallback onStepContinue, VoidCallback onStepCancel}) { + return Row( + children: [ + RaisedButton( + color: Colors.blue, + shape: CircleBorder( + side: BorderSide(width: 2.0, color: Color(0xFFFFDFDFDF)), + ), + onPressed: onStepContinue, + child: Icon( + Icons.check, + color: Colors.white, + ), + ), + RaisedButton( + color: Colors.red, + shape: CircleBorder( + side: BorderSide(width: 2.0, color: Color(0xFFFFDFDFDF)), + ), + onPressed: onStepCancel, + child: Icon( + Icons.keyboard_backspace, + color: Colors.white, + ), + ), + ], + ); + }, + steps: stepsData.keys.map((e) { + bool isActive = stepsData.keys.toList().indexOf(e) == _position; + return Step( + title: Text( + e, + style: TextStyle(color: isActive ? Colors.blue : Colors.black), + ), + isActive: isActive, + state: _getState(stepsData.keys.toList().indexOf(e)), + content: Container(height: 60, child: Text(stepsData[e])), + ); + }).toList()), + ); + } + + _getState(index) { + if (_position == index) return StepState.editing; + if (_position > index) return StepState.complete; + return StepState.indexed; + } +} diff --git a/lib/views/widgets/StatefulWidget/StreamBuilder.dart b/lib/views/widgets/StatefulWidget/StreamBuilder/node1_base.dart similarity index 100% rename from lib/views/widgets/StatefulWidget/StreamBuilder.dart rename to lib/views/widgets/StatefulWidget/StreamBuilder/node1_base.dart diff --git a/lib/views/widgets/StatefulWidget/Switch.dart b/lib/views/widgets/StatefulWidget/Switch/node1_base.dart similarity index 57% rename from lib/views/widgets/StatefulWidget/Switch.dart rename to lib/views/widgets/StatefulWidget/Switch/node1_base.dart index ccfbba2..c5df7cb 100644 --- a/lib/views/widgets/StatefulWidget/Switch.dart +++ b/lib/views/widgets/StatefulWidget/Switch/node1_base.dart @@ -45,42 +45,3 @@ class _CustomSwitchState extends State { } } -// { -// "widgetId": 40, -// "name": 'Switch图片', -// "priority": 2, -// "subtitle": -// "【inactiveThumbImage】 : 未选中小圈图片 【ImageProvider】\n" -// "【activeThumbImage】 : 选中时滑槽颜色 【ImageProvider】" -// } -class ImageSwitch extends StatefulWidget { - @override - _ImageSwitchState createState() => _ImageSwitchState(); -} - -class _ImageSwitchState extends State { - final imgs = [ - "assets/images/head_icon/icon_5.jpg", - "assets/images/head_icon/icon_6.jpg", - "assets/images/head_icon/icon_7.jpg", - "assets/images/head_icon/icon_8.jpg"]; - bool _checked = false; - - @override - Widget build(BuildContext context) { - return Wrap( - spacing: 10, - children: imgs - .map((e) => - Switch( - value: _checked, - inactiveThumbImage: AssetImage(e), - activeThumbImage: AssetImage('assets/images/pica.gif'), - onChanged: (v) { - setState(() => _checked = v); - })) - .toList(), - ); - } -} - diff --git a/lib/views/widgets/StatefulWidget/Switch/node2_image.dart b/lib/views/widgets/StatefulWidget/Switch/node2_image.dart new file mode 100644 index 0000000..4edd18f --- /dev/null +++ b/lib/views/widgets/StatefulWidget/Switch/node2_image.dart @@ -0,0 +1,45 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020-03-14 +/// contact me by email 1981462002@qq.com +/// 说明: + +// { +// "widgetId": 40, +// "name": 'Switch图片', +// "priority": 2, +// "subtitle": +// "【inactiveThumbImage】 : 未选中小圈图片 【ImageProvider】\n" +// "【activeThumbImage】 : 选中时滑槽颜色 【ImageProvider】" +// } +class ImageSwitch extends StatefulWidget { + @override + _ImageSwitchState createState() => _ImageSwitchState(); +} + +class _ImageSwitchState extends State { + final imgs = [ + "assets/images/head_icon/icon_5.jpg", + "assets/images/head_icon/icon_6.jpg", + "assets/images/head_icon/icon_7.jpg", + "assets/images/head_icon/icon_8.jpg"]; + bool _checked = false; + + @override + Widget build(BuildContext context) { + return Wrap( + spacing: 10, + children: imgs + .map((e) => + Switch( + value: _checked, + inactiveThumbImage: AssetImage(e), + activeThumbImage: AssetImage('assets/images/pica.gif'), + onChanged: (v) { + setState(() => _checked = v); + })) + .toList(), + ); + } +} + diff --git a/lib/views/widgets/StatefulWidget/TabBarView.dart b/lib/views/widgets/StatefulWidget/TabBarView/node1_base.dart similarity index 95% rename from lib/views/widgets/StatefulWidget/TabBarView.dart rename to lib/views/widgets/StatefulWidget/TabBarView/node1_base.dart index 7e73db8..6feb48a 100644 --- a/lib/views/widgets/StatefulWidget/TabBarView.dart +++ b/lib/views/widgets/StatefulWidget/TabBarView/node1_base.dart @@ -1,5 +1,7 @@ import 'package:flutter/material.dart'; - +/// create by 张风捷特烈 on 2020-03-29 +/// contact me by email 1981462002@qq.com +/// 说明: // { // "widgetId": 59, // "name": 'TabBarView需要与TabBar联用', diff --git a/lib/views/widgets/StatefulWidget/TableRowInkWell.dart b/lib/views/widgets/StatefulWidget/TableRowInkWell/node1_base.dart similarity index 100% rename from lib/views/widgets/StatefulWidget/TableRowInkWell.dart rename to lib/views/widgets/StatefulWidget/TableRowInkWell/node1_base.dart diff --git a/lib/views/widgets/StatefulWidget/TextField.dart b/lib/views/widgets/StatefulWidget/TextField.dart deleted file mode 100644 index c3747a0..0000000 --- a/lib/views/widgets/StatefulWidget/TextField.dart +++ /dev/null @@ -1,191 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; - -// { -// "widgetId": 54, -// "name": 'TextField基本用法', -// "priority": 1, -// "subtitle": -// "【controller】 : 控制器 【TextEditingController】\n" -// "【style】 : 文字样式 【TextStyle】\n" -// "【decoration】 : 装饰线 【InputDecoration】\n" -// "【onEditingComplete】 : 输入完成事件 【Function()】\n" -// "【onSubmitted】 : 提交事件 【Function(String)】\n" -// "【onChanged】 : 输入事件 【Function(String)】", -// } -class CustomTextField extends StatefulWidget { - @override - _CustomTextFieldState createState() => _CustomTextFieldState(); -} - -class _CustomTextFieldState extends State { - final FocusNode _focusNode = FocusNode(); - TextEditingController _controller; - - void initState() { - super.initState(); - _controller = TextEditingController(); - } - - @override - void dispose() { - _controller.dispose(); - _focusNode.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return Container( - width: 300, - child: TextField( - controller: _controller, - style: TextStyle(color: Colors.blue), - decoration: InputDecoration( - border: OutlineInputBorder(), - labelText: 'username', - ), - onEditingComplete: () { - print('onEditingComplete'); - }, - onChanged: (v) { - print('onChanged:' + v); - }, - onSubmitted: (v) { - FocusScope.of(context).requestFocus(_focusNode); - print('onSubmitted:' + v); - _controller.clear(); - }, - )); - } -} - -// { -// "widgetId": 54, -// "name": 'TextField基本语法', -// "priority": 2, -// "subtitle": -// "【minLines】 : 最小行数 【int】\n" -// "【maxLines】 : 最大行数 【int】\n" -// "【cursorRadius】 : 光标半径 【Radius】\n" -// "【cursorColor】 : 光标颜色 【Color】\n" -// "【cursorWidth】 : 光标宽度 【double】\n" -// "【showCursor】 : 是否显示光标 【bool】\n" -// "【autofocus】 : 自动聚焦 【bool】", -// } -class CursorTextField extends StatefulWidget { - @override - _CursorTextFieldState createState() => _CursorTextFieldState(); -} - -class _CursorTextFieldState extends State { - final FocusNode _focusNode = FocusNode(); - - @override - void dispose() { - _focusNode.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return Column( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - _buildSubmitBtn(), - _buildTextField(context), - ], - ); - } - - Container _buildTextField(BuildContext context) { - return Container( - width: 300, - child: TextField( - style: TextStyle(color: Colors.blue), - minLines: 3, - maxLines: 5, - cursorColor: Colors.green, - cursorRadius: Radius.circular(3), - cursorWidth: 5, - showCursor: true, - decoration: InputDecoration( - contentPadding: EdgeInsets.all(10), - hintText: "请输入...", - border: OutlineInputBorder(), - ), - onChanged: (v) {}, - ), - ); - } - - _buildSubmitBtn() => FlatButton( - color: Colors.blue, - child: Text( - "提交", - style: TextStyle(color: Colors.white, fontSize: 16), - ), - onPressed: () => FocusScope.of(context).requestFocus(_focusNode)); -} - -// { -// "widgetId": 54, -// "name": 'decoration的复杂装饰', -// "priority": 3, -// "subtitle": -// "InputDecoration有非常多的装饰点,对应点缀见代码:\n" -// "border: 边线相关\n" -// "helper: 左下角相关提示\n" -// "counter: 右下角相关提示\n" -// "prefix: 输入框内部最左侧\n" -// "suffix: 输入框内部最右侧\n" -// "label: 无焦点时文字\n" -// "label: 无焦点时文字\n" -// "hint: 提示文字相关\n" -// "border: 边线相关", -// } -class ComplexTextField extends StatelessWidget { - @override - Widget build(BuildContext context) { - return TextField( - decoration: InputDecoration( - border: OutlineInputBorder(), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide(color: Colors.blue), - borderRadius: BorderRadius.only( - topLeft: Radius.circular(10), bottomLeft: Radius.circular(10))), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Colors.deepPurpleAccent), - borderRadius: BorderRadius.only( - topLeft: Radius.circular(10), bottomLeft: Radius.circular(10))), - labelText: 'username', - labelStyle: TextStyle(color: Colors.purple), - helperText: "help me", - helperStyle: TextStyle(color: Colors.blue), - - suffixText: "suffix", - suffixIcon: Icon(Icons.done), - suffixStyle: TextStyle(color: Colors.green), - - counterText: "counter", - counterStyle: TextStyle(color: Colors.orange), - - prefixText: "ID ", - prefixStyle: TextStyle(color: Colors.blue), - prefixIcon: Icon(Icons.language), - - fillColor: Color(0x110099ee), - filled: true, - - // errorText: "error", - // errorMaxLines: 1, - // errorStyle: TextStyle(color: Colors.red), - // errorBorder: UnderlineInputBorder(), - - hintText: "请输入用户名", - hintMaxLines: 1, - hintStyle: TextStyle(color: Colors.black38), - icon: Icon(Icons.assignment_ind), - )); - } -} diff --git a/lib/views/widgets/StatefulWidget/TextField/node1_base.dart b/lib/views/widgets/StatefulWidget/TextField/node1_base.dart new file mode 100644 index 0000000..3d765f5 --- /dev/null +++ b/lib/views/widgets/StatefulWidget/TextField/node1_base.dart @@ -0,0 +1,62 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; + +// { +// "widgetId": 54, +// "name": 'TextField基本用法', +// "priority": 1, +// "subtitle": +// "【controller】 : 控制器 【TextEditingController】\n" +// "【style】 : 文字样式 【TextStyle】\n" +// "【decoration】 : 装饰线 【InputDecoration】\n" +// "【onEditingComplete】 : 输入完成事件 【Function()】\n" +// "【onSubmitted】 : 提交事件 【Function(String)】\n" +// "【onChanged】 : 输入事件 【Function(String)】", +// } +class CustomTextField extends StatefulWidget { + @override + _CustomTextFieldState createState() => _CustomTextFieldState(); +} + +class _CustomTextFieldState extends State { + final FocusNode _focusNode = FocusNode(); + TextEditingController _controller; + + void initState() { + super.initState(); + _controller = TextEditingController(); + } + + @override + void dispose() { + _controller.dispose(); + _focusNode.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Container( + width: 300, + child: TextField( + controller: _controller, + style: TextStyle(color: Colors.blue), + decoration: InputDecoration( + border: OutlineInputBorder(), + labelText: 'username', + ), + onEditingComplete: () { + print('onEditingComplete'); + }, + onChanged: (v) { + print('onChanged:' + v); + }, + onSubmitted: (v) { + FocusScope.of(context).requestFocus(_focusNode); + print('onSubmitted:' + v); + _controller.clear(); + }, + )); + } +} + diff --git a/lib/views/widgets/StatefulWidget/TextField/node2_cursor.dart b/lib/views/widgets/StatefulWidget/TextField/node2_cursor.dart new file mode 100644 index 0000000..4725093 --- /dev/null +++ b/lib/views/widgets/StatefulWidget/TextField/node2_cursor.dart @@ -0,0 +1,73 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; + +/// create by 张风捷特烈 on 2020-03-29 +/// contact me by email 1981462002@qq.com +/// 说明: +// { +// "widgetId": 54, +// "name": 'TextField行数和cursor', +// "priority": 2, +// "subtitle": +// "【minLines】 : 最小行数 【int】\n" +// "【maxLines】 : 最大行数 【int】\n" +// "【cursorRadius】 : 光标半径 【Radius】\n" +// "【cursorColor】 : 光标颜色 【Color】\n" +// "【cursorWidth】 : 光标宽度 【double】\n" +// "【showCursor】 : 是否显示光标 【bool】\n" +// "【autofocus】 : 自动聚焦 【bool】", +// } +class CursorTextField extends StatefulWidget { + @override + _CursorTextFieldState createState() => _CursorTextFieldState(); +} + +class _CursorTextFieldState extends State { + final FocusNode _focusNode = FocusNode(); + + @override + void dispose() { + _focusNode.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + _buildSubmitBtn(), + _buildTextField(context), + ], + ); + } + + Container _buildTextField(BuildContext context) { + return Container( + width: 300, + child: TextField( + style: TextStyle(color: Colors.blue), + minLines: 3, + maxLines: 5, + cursorColor: Colors.green, + cursorRadius: Radius.circular(3), + cursorWidth: 5, + showCursor: true, + decoration: InputDecoration( + contentPadding: EdgeInsets.all(10), + hintText: "请输入...", + border: OutlineInputBorder(), + ), + onChanged: (v) {}, + ), + ); + } + + _buildSubmitBtn() => FlatButton( + color: Colors.blue, + child: Text( + "提交", + style: TextStyle(color: Colors.white, fontSize: 16), + ), + onPressed: () => FocusScope.of(context).requestFocus(_focusNode)); +} diff --git a/lib/views/widgets/StatefulWidget/TextField/node3_decoration.dart b/lib/views/widgets/StatefulWidget/TextField/node3_decoration.dart new file mode 100644 index 0000000..efe48ad --- /dev/null +++ b/lib/views/widgets/StatefulWidget/TextField/node3_decoration.dart @@ -0,0 +1,66 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020-03-29 +/// contact me by email 1981462002@qq.com +/// 说明: +// { +// "widgetId": 54, +// "name": 'decoration的复杂装饰', +// "priority": 3, +// "subtitle": +// "InputDecoration有非常多的装饰点,对应点缀见代码:\n" +// "border: 边线相关\n" +// "helper: 左下角相关提示\n" +// "counter: 右下角相关提示\n" +// "prefix: 输入框内部最左侧\n" +// "suffix: 输入框内部最右侧\n" +// "label: 无焦点时文字\n" +// "label: 无焦点时文字\n" +// "hint: 提示文字相关\n" +// "border: 边线相关", +// } +class ComplexTextField extends StatelessWidget { + @override + Widget build(BuildContext context) { + return TextField( + decoration: InputDecoration( + border: OutlineInputBorder(), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: Colors.blue), + borderRadius: BorderRadius.only( + topLeft: Radius.circular(10), bottomLeft: Radius.circular(10))), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Colors.deepPurpleAccent), + borderRadius: BorderRadius.only( + topLeft: Radius.circular(10), bottomLeft: Radius.circular(10))), + labelText: 'username', + labelStyle: TextStyle(color: Colors.purple), + helperText: "help me", + helperStyle: TextStyle(color: Colors.blue), + + suffixText: "suffix", + suffixIcon: Icon(Icons.done), + suffixStyle: TextStyle(color: Colors.green), + + counterText: "counter", + counterStyle: TextStyle(color: Colors.orange), + + prefixText: "ID ", + prefixStyle: TextStyle(color: Colors.blue), + prefixIcon: Icon(Icons.language), + + fillColor: Color(0x110099ee), + filled: true, + + // errorText: "error", + // errorMaxLines: 1, + // errorStyle: TextStyle(color: Colors.red), + // errorBorder: UnderlineInputBorder(), + + hintText: "请输入用户名", + hintMaxLines: 1, + hintStyle: TextStyle(color: Colors.black38), + icon: Icon(Icons.assignment_ind), + )); + } +} diff --git a/lib/views/widgets/StatefulWidget/TextFormField.dart b/lib/views/widgets/StatefulWidget/TextFormField/node1_base.dart similarity index 100% rename from lib/views/widgets/StatefulWidget/TextFormField.dart rename to lib/views/widgets/StatefulWidget/TextFormField/node1_base.dart diff --git a/lib/views/widgets/StatefulWidget/Tooltip.dart b/lib/views/widgets/StatefulWidget/Tooltip/node1_base.dart similarity index 53% rename from lib/views/widgets/StatefulWidget/Tooltip.dart rename to lib/views/widgets/StatefulWidget/Tooltip/node1_base.dart index cd9f771..b0482a7 100644 --- a/lib/views/widgets/StatefulWidget/Tooltip.dart +++ b/lib/views/widgets/StatefulWidget/Tooltip/node1_base.dart @@ -1,5 +1,7 @@ import 'package:flutter/material.dart'; - +/// create by 张风捷特烈 on 2020-04-01 +/// contact me by email 1981462002@qq.com +/// 说明: // { // "widgetId": 50, // "name": 'Tooltip基本使用', @@ -27,32 +29,3 @@ class CustomTooltip extends StatelessWidget { ); } } - -// { -// "widgetId": 50, -// "name": 'Tooltip的装饰', -// "priority": 2, -// "subtitle": -// "【decoration】 : 装饰对象 【Decoration】\n" -// "【textStyle】 : 文字样式 【double】" -// } -class DecorationTooltip extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Tooltip( - preferBelow: false, - padding: EdgeInsets.all(5), - margin: EdgeInsets.all(2), - message: "宝塔镇河妖", - textStyle: TextStyle( - color: Colors.red, - shadows: [Shadow(color: Colors.white, - offset: Offset(1, 1))]), - decoration: BoxDecoration(boxShadow: [ - BoxShadow( - color: Colors.orangeAccent, - offset: Offset(1, 1), blurRadius: 8) - ]), - child: Icon(Icons.info_outline)); - } -} diff --git a/lib/views/widgets/StatefulWidget/Tooltip/node2_decoration.dart b/lib/views/widgets/StatefulWidget/Tooltip/node2_decoration.dart new file mode 100644 index 0000000..fbc4832 --- /dev/null +++ b/lib/views/widgets/StatefulWidget/Tooltip/node2_decoration.dart @@ -0,0 +1,33 @@ +import 'package:flutter/material.dart'; +/// create by 张风捷特烈 on 2020-04-01 +/// contact me by email 1981462002@qq.com +/// 说明: + +// { +// "widgetId": 50, +// "name": 'Tooltip的装饰', +// "priority": 2, +// "subtitle": +// "【decoration】 : 装饰对象 【Decoration】\n" +// "【textStyle】 : 文字样式 【double】" +// } +class DecorationTooltip extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Tooltip( + preferBelow: false, + padding: EdgeInsets.all(5), + margin: EdgeInsets.all(2), + message: "宝塔镇河妖", + textStyle: TextStyle( + color: Colors.red, + shadows: [Shadow(color: Colors.white, + offset: Offset(1, 1))]), + decoration: BoxDecoration(boxShadow: [ + BoxShadow( + color: Colors.orangeAccent, + offset: Offset(1, 1), blurRadius: 8) + ]), + child: Icon(Icons.info_outline)); + } +} diff --git a/lib/views/widgets/StatefulWidget/Scrollable.dart b/lib/views/widgets/StatefulWidget/zz_no/Scrollable.dart similarity index 100% rename from lib/views/widgets/StatefulWidget/Scrollable.dart rename to lib/views/widgets/StatefulWidget/zz_no/Scrollable.dart diff --git a/lib/views/widgets/StatelessWidget/no/CupertinoSegmentedControlTest.dart b/lib/views/widgets/StatelessWidget/zz_no/CupertinoSegmentedControlTest.dart similarity index 100% rename from lib/views/widgets/StatelessWidget/no/CupertinoSegmentedControlTest.dart rename to lib/views/widgets/StatelessWidget/zz_no/CupertinoSegmentedControlTest.dart diff --git a/lib/views/widgets/render_object_unit.dart b/lib/views/widgets/render_object_unit.dart index a0aaf4a..4083240 100644 --- a/lib/views/widgets/render_object_unit.dart +++ b/lib/views/widgets/render_object_unit.dart @@ -23,10 +23,10 @@ export 'SingleChildRenderObjectWidget/SizedBox.dart'; export 'SingleChildRenderObjectWidget/SizedOverflowBox.dart'; export 'SingleChildRenderObjectWidget/Transform.dart'; export 'SingleChildRenderObjectWidget/UnConstrainedBox.dart'; -export 'StatefulWidget/PositionedTransition.dart'; -export 'StatefulWidget/RotationTransition.dart'; -export 'StatefulWidget/ScaleTransition.dart'; -export 'StatefulWidget/SizeTransition.dart'; +export 'StatefulWidget/PositionedTransition/node1_base.dart'; +export 'StatefulWidget/RotationTransition/node1_base.dart'; +export 'StatefulWidget/ScaleTransition/node1_base.dart'; +export 'StatefulWidget/SizeTransition/node1_base.dart'; export 'SingleChildRenderObjectWidget/ClipOval.dart'; export 'SingleChildRenderObjectWidget/ClipPath.dart'; export 'SingleChildRenderObjectWidget/ClipRRect.dart'; diff --git a/lib/views/widgets/stateful_unit.dart b/lib/views/widgets/stateful_unit.dart index 1bb46c2..b20ae0f 100644 --- a/lib/views/widgets/stateful_unit.dart +++ b/lib/views/widgets/stateful_unit.dart @@ -7,7 +7,7 @@ export 'StatefulWidget/CupertinoContextMenuAction/node1_base.dart'; export 'StatefulWidget/CupertinoDatePicker/node1_base.dart'; export 'StatefulWidget/CupertinoPicker/node1_base.dart'; export 'StatefulWidget/CupertinoTimerPicker/node1_base.dart'; - +export 'StatefulWidget/SlideTransition/node1_base.dart'; export 'StatefulWidget/MonthPicker/node1_base.dart'; export 'StatefulWidget/YearPicker/node1_base.dart'; export 'StatefulWidget/WillPopScope/node1_base.dart'; @@ -21,8 +21,9 @@ export 'StatefulWidget/Checkbox/node1_base.dart'; export 'StatefulWidget/Checkbox/node2_tristate.dart'; export 'StatefulWidget/ExpandIcon/node1_base.dart'; export 'StatefulWidget/ExpansionTile/node1_base.dart'; -export 'StatefulWidget/Radio.dart'; -export 'StatefulWidget/Tooltip.dart'; +export 'StatefulWidget/Radio/node1_base.dart'; +export 'StatefulWidget/Tooltip/node1_base.dart'; +export 'StatefulWidget/Tooltip/node2_decoration.dart'; export 'StatefulWidget/CircularProgressIndicator/node1_base.dart'; export 'StatefulWidget/CupertinoActivityIndicator/node1_base.dart'; export 'StatefulWidget/CupertinoSlider/node1_base.dart'; @@ -35,12 +36,15 @@ export 'StatefulWidget/Image/node4_colorBlendMode.dart'; export 'StatefulWidget/Image/node5_repeat.dart'; export 'StatefulWidget/Image/node6_centerSlice.dart'; -export 'StatefulWidget/RangerSlider.dart'; -export 'StatefulWidget/Slider.dart'; -export 'StatefulWidget/Switch.dart'; -export 'StatefulWidget/TextField.dart'; -export 'StatefulWidget/RefreshIndicator.dart'; -export 'StatefulWidget/SelectableText.dart'; +export 'StatefulWidget/RangeSlider/node1_base.dart'; +export 'StatefulWidget/Slider/node1_base.dart'; +export 'StatefulWidget/Slider/node2_lable.dart'; +export 'StatefulWidget/Switch/node1_base.dart'; +export 'StatefulWidget/Switch/node2_image.dart'; +export 'StatefulWidget/TextField/node3_decoration.dart'; +export 'StatefulWidget/RefreshIndicator/node1_base.dart'; +export 'StatefulWidget/SelectableText/node1_base.dart'; +export 'StatefulWidget/SelectableText/node2_align.dart'; export 'StatefulWidget/CupertinoNavigationBar/node1_base.dart'; export 'StatefulWidget/CupertinoTabBar/node1_base.dart'; @@ -55,7 +59,7 @@ export 'StatefulWidget/AnimatedSwitcher/node1_base.dart'; export 'StatefulWidget/AlignTransition/node1_base.dart'; export 'StatefulWidget/DecoratedBoxTransition/node1_base.dart'; export 'StatefulWidget/DefaultTextStyleTransition/node1_base.dart'; -export 'StatefulWidget/RelativePositionedTransition.dart'; +export 'StatefulWidget/RelativePositionedTransition/node1_base.dart'; export 'StatefulWidget/CupertinoScrollbar/node1_base.dart'; export 'StatefulWidget/Dismissible/node1_base.dart'; @@ -79,29 +83,47 @@ export 'StatefulWidget/AnimatedPositionedDirectional/node1_base.dart'; export 'StatefulWidget/ExpansionPanelList/node1_base.dart'; -export 'StatefulWidget/Ink.dart'; -export 'StatefulWidget/InkResponse.dart'; -export 'StatefulWidget/InkWell.dart'; -export 'StatefulWidget/LicensePage.dart'; -export 'StatefulWidget/ListWheelScrollView.dart'; -export 'StatefulWidget/LongPressDraggable.dart'; -export 'StatefulWidget/Material.dart'; -export 'StatefulWidget/Overlay.dart'; -export 'StatefulWidget/PageView.dart'; -export 'StatefulWidget/PopupMenuButton.dart'; -export 'StatefulWidget/PopupMenuDivider.dart'; -export 'StatefulWidget/RawChip.dart'; -export 'StatefulWidget/RawMaterialButton.dart'; -export 'StatefulWidget/ReorderableListView.dart'; -export 'StatefulWidget/Scrollbar.dart'; -export 'StatefulWidget/Stepper.dart'; -export 'StatefulWidget/StreamBuilder.dart'; -export 'StatefulWidget/TableRowInkWell.dart'; -export 'StatefulWidget/TextFormField.dart'; -export 'StatefulWidget/LinearProgressIndicator.dart'; +export 'StatefulWidget/Ink/node1_base.dart'; +export 'StatefulWidget/Ink/node2_image.dart'; + +export 'StatefulWidget/InkResponse/node1_base.dart'; +export 'StatefulWidget/InkResponse/node2_color.dart'; + +export 'StatefulWidget/InkWell/node1_base.dart'; +export 'StatefulWidget/InkWell/node2_color.dart'; + +export 'StatefulWidget/LicensePage/node1_base.dart'; +export 'StatefulWidget/ListWheelScrollView/node1_base.dart'; +export 'StatefulWidget/LongPressDraggable/node1_base.dart'; +export 'StatefulWidget/Material/node1_base.dart'; +export 'StatefulWidget/Material/node2_shape.dart'; +export 'StatefulWidget/Overlay/node1_base.dart'; +export 'StatefulWidget/PageView/node1_base.dart'; +export 'StatefulWidget/PageView/node2_direction.dart'; +export 'StatefulWidget/PageView/node3_controller.dart'; +export 'StatefulWidget/PopupMenuButton/node1_base.dart'; +export 'StatefulWidget/PopupMenuDivider/node1_base.dart'; +export 'StatefulWidget/RawChip/node1_press.dart'; +export 'StatefulWidget/RawChip/node2_select.dart'; + +export 'StatefulWidget/RawMaterialButton/node1_base.dart'; +export 'StatefulWidget/RawMaterialButton/node2_shape.dart'; +export 'StatefulWidget/ReorderableListView/node1_base.dart'; +export 'StatefulWidget/ReorderableListView/node2_direction.dart'; +export 'StatefulWidget/Scrollbar/node1_base.dart'; +export 'StatefulWidget/Stepper/node1_base.dart'; +export 'StatefulWidget/Stepper/node2_type.dart'; +export 'StatefulWidget/StreamBuilder/node1_base.dart'; +export 'StatefulWidget/TableRowInkWell/node1_base.dart'; +export 'StatefulWidget/TextField/node1_base.dart'; +export 'StatefulWidget/TextField/node2_cursor.dart'; +export 'StatefulWidget/TextField/node3_decoration.dart'; + +export 'StatefulWidget/TextFormField/node1_base.dart'; +export 'StatefulWidget/LinearProgressIndicator/node1_base.dart'; export 'StatefulWidget/CupertinoApp/node1_base.dart'; export 'StatefulWidget/CupertinoPageScaffold/node1_base.dart'; export 'StatefulWidget/CupertinoTabScaffold/node1_base.dart'; -export 'StatefulWidget/MaterialApp.dart'; -export 'StatefulWidget/Scaffold.dart'; -export 'StatefulWidget/TabBarView.dart'; +export 'StatefulWidget/MaterialApp/node1_base.dart'; +export 'StatefulWidget/Scaffold/node1_base.dart'; +export 'StatefulWidget/TabBarView/node1_base.dart'; diff --git a/lib/views/widgets/widgets_map.dart b/lib/views/widgets/widgets_map.dart index eb04d85..77cc58e 100644 --- a/lib/views/widgets/widgets_map.dart +++ b/lib/views/widgets/widgets_map.dart @@ -1,7 +1,4 @@ import 'package:flutter/material.dart'; -import 'package:flutter_unit/views/widgets/StatefulWidget/SlideTransition.dart'; - - import 'stateful_unit.dart'; import 'stateless_unit.dart';