From ef21901c399eb2556ac3ce78365ccdf1bc96cd07 Mon Sep 17 00:00:00 2001 From: toly <1981462002@qq.com> Date: Mon, 27 Apr 2020 23:11:58 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E4=BC=98=E5=8C=96=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E4=BB=A3=E7=A0=81=E7=9A=84=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=E5=BD=A2=E5=BC=8F,stateless=E9=87=8D=E6=9E=84=E5=AE=8C?= =?UTF-8?q?=E6=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../widgets/StatefulWidget/ExpansionTile.dart | 2 +- .../MonthPicker/node1_base.dart} | 0 .../WillPopScope/node1_base.dart} | 0 .../YearPicker/node1_base.dart} | 0 .../widgets/StatefulWidget/stateful_unit.dart | 3 + .../StatelessWidget/GestureDetector.dart | 130 ----------- .../GestureDetector/node1_base.dart | 48 ++++ .../GestureDetector/node2_tap.dart | 44 ++++ .../GestureDetector/node3_pan.dart | 52 +++++ .../widgets/StatelessWidget/GirdView.dart | 203 ---------------- .../StatelessWidget/GirdView/node1_base.dart | 56 +++++ .../GirdView/node2_direction.dart | 55 +++++ .../GirdView/node3_extend.dart | 54 +++++ .../GirdView/node4_builder.dart | 54 +++++ .../StatelessWidget/GridPaper/node1_base.dart | 29 +++ .../node2_divisions.dart} | 28 +-- .../node1_base.dart} | 12 + .../widgets/StatelessWidget/GridTileBar.dart | 21 -- .../GridTileBar/node1_base.dart | 36 +++ .../widgets/StatelessWidget/GridView.dart | 36 --- lib/views/widgets/StatelessWidget/Icon.dart | 45 ---- .../StatelessWidget/Icon/node1_base.dart | 38 +++ .../StatelessWidget/Icon/node2_diy.dart | 37 +++ .../widgets/StatelessWidget/IconButton.dart | 19 -- .../IconButton/node1_base.dart | 32 +++ .../node1_base.dart} | 12 +- .../StatelessWidget/InputChip/node1_base.dart | 41 ++++ .../node2_select.dart} | 39 +--- .../widgets/StatelessWidget/ListTile.dart | 74 ------ .../StatelessWidget/ListTile/node1_base.dart | 35 +++ .../ListTile/node2_select.dart | 38 +++ .../StatelessWidget/ListTile/node3_dense.dart | 38 +++ .../widgets/StatelessWidget/ListView.dart | 216 ------------------ .../StatelessWidget/ListView/node1_base.dart | 57 +++++ .../ListView/node2_direction.dart | 61 +++++ .../ListView/node3_builder.dart | 55 +++++ .../ListView/node4_separated.dart | 59 +++++ .../node1_base.dart} | 0 .../MaterialButton/node1_base.dart | 36 +++ .../MaterialButton/node2_onLongPress.dart | 30 +++ .../node3_shape.dart} | 42 +--- .../StatelessWidget/OutLineButton.dart | 18 -- .../OutlineButton/node1_base.dart | 34 +++ .../widgets/StatelessWidget/Placeholder.dart | 29 --- .../Placeholder/node1_base.dart | 25 ++ .../Placeholder/node2_fallback.dart | 26 +++ .../node1_base.dart} | 0 .../StatelessWidget/RadioListTile.dart | 169 -------------- .../RadioListTile/node1_base.dart | 71 ++++++ .../RadioListTile/node2_dense.dart | 68 ++++++ .../widgets/StatelessWidget/RaisedButton.dart | 17 -- .../RaisedButton/node1_base.dart | 34 +++ .../node1_base.dart} | 0 .../node1_base.dart} | 0 .../SingleChildScrollView/node1_base.dart | 59 +++++ .../node2_direction.dart} | 58 +---- .../node1_base.dart} | 0 .../node1_base.dart} | 0 lib/views/widgets/StatelessWidget/Spacer.dart | 107 --------- .../StatelessWidget/Spacer/node1_base.dart | 38 +++ .../StatelessWidget/Spacer/node2_flex.dart | 73 ++++++ .../StatelessWidget/SwitchListTile.dart | 87 ------- .../SwitchListTile/node1_base.dart | 45 ++++ .../SwitchListTile/node2_select.dart | 41 ++++ .../SwitchListTile/node3_dense.dart | 38 +++ .../{Tab.dart => Tab/node1_base.dart} | 0 .../{TabBar.dart => TabBar/node1_base.dart} | 52 +---- .../TabBar/node2_noShadow.dart | 55 +++++ lib/views/widgets/StatelessWidget/Text.dart | 127 ---------- .../StatelessWidget/Text/node1_base.dart | 37 +++ .../StatelessWidget/Text/node2_shadows.dart | 36 +++ .../Text/node3_decoration.dart | 35 +++ .../StatelessWidget/Text/node4_textAlign.dart | 34 +++ .../Text/node5_textDirection.dart | 37 +++ .../StatelessWidget/Text/node6_softWrap.dart | 34 +++ lib/views/widgets/StatelessWidget/Theme.dart | 103 --------- .../StatelessWidget/Theme/node1_base.dart | 63 +++++ .../StatelessWidget/Theme/node2_use.dart | 45 ++++ .../StatelessWidget/ToggleButtons.dart | 93 -------- .../ToggleButtons/node1_single.dart | 43 ++++ .../ToggleButtons/node2_color.dart | 48 ++++ .../ToggleButtons/node3_multi.dart | 42 ++++ .../UserAccountsDrawerHeader/node1_base.dart | 56 +++++ .../node2_pro.dart} | 52 +---- .../VerticalDivider/node1_base.dart | 34 +++ .../node2_height.dart} | 35 ++- .../widgets/StatelessWidget/Visibility.dart | 138 ----------- .../Visibility/node1_base.dart | 57 +++++ .../Visibility/node2_replacement.dart | 61 +++++ .../CupertinoSegmentedControlTest.dart | 0 .../StatelessWidget/stateless_unit.dart | 130 ++++++++--- lib/views/widgets/widgets_map.dart | 1 - 92 files changed, 2436 insertions(+), 1916 deletions(-) rename lib/views/widgets/{StatelessWidget/MonthPicker.dart => StatefulWidget/MonthPicker/node1_base.dart} (100%) rename lib/views/widgets/{StatelessWidget/WillPopScope.dart => StatefulWidget/WillPopScope/node1_base.dart} (100%) rename lib/views/widgets/{StatelessWidget/YearPicker.dart => StatefulWidget/YearPicker/node1_base.dart} (100%) delete mode 100644 lib/views/widgets/StatelessWidget/GestureDetector.dart create mode 100644 lib/views/widgets/StatelessWidget/GestureDetector/node1_base.dart create mode 100644 lib/views/widgets/StatelessWidget/GestureDetector/node2_tap.dart create mode 100644 lib/views/widgets/StatelessWidget/GestureDetector/node3_pan.dart delete mode 100644 lib/views/widgets/StatelessWidget/GirdView.dart create mode 100644 lib/views/widgets/StatelessWidget/GirdView/node1_base.dart create mode 100644 lib/views/widgets/StatelessWidget/GirdView/node2_direction.dart create mode 100644 lib/views/widgets/StatelessWidget/GirdView/node3_extend.dart create mode 100644 lib/views/widgets/StatelessWidget/GirdView/node4_builder.dart create mode 100644 lib/views/widgets/StatelessWidget/GridPaper/node1_base.dart rename lib/views/widgets/StatelessWidget/{GridPager.dart => GridPaper/node2_divisions.dart} (51%) rename lib/views/widgets/StatelessWidget/{GridTile.dart => GridTile/node1_base.dart} (74%) delete mode 100644 lib/views/widgets/StatelessWidget/GridTileBar.dart create mode 100644 lib/views/widgets/StatelessWidget/GridTileBar/node1_base.dart delete mode 100644 lib/views/widgets/StatelessWidget/GridView.dart delete mode 100644 lib/views/widgets/StatelessWidget/Icon.dart create mode 100644 lib/views/widgets/StatelessWidget/Icon/node1_base.dart create mode 100644 lib/views/widgets/StatelessWidget/Icon/node2_diy.dart delete mode 100755 lib/views/widgets/StatelessWidget/IconButton.dart create mode 100755 lib/views/widgets/StatelessWidget/IconButton/node1_base.dart rename lib/views/widgets/StatelessWidget/{ImageIcon.dart => ImageIcon/node1_base.dart} (57%) create mode 100644 lib/views/widgets/StatelessWidget/InputChip/node1_base.dart rename lib/views/widgets/StatelessWidget/{InputChip.dart => InputChip/node2_select.dart} (51%) delete mode 100644 lib/views/widgets/StatelessWidget/ListTile.dart create mode 100644 lib/views/widgets/StatelessWidget/ListTile/node1_base.dart create mode 100644 lib/views/widgets/StatelessWidget/ListTile/node2_select.dart create mode 100644 lib/views/widgets/StatelessWidget/ListTile/node3_dense.dart delete mode 100644 lib/views/widgets/StatelessWidget/ListView.dart create mode 100644 lib/views/widgets/StatelessWidget/ListView/node1_base.dart create mode 100644 lib/views/widgets/StatelessWidget/ListView/node2_direction.dart create mode 100644 lib/views/widgets/StatelessWidget/ListView/node3_builder.dart create mode 100644 lib/views/widgets/StatelessWidget/ListView/node4_separated.dart rename lib/views/widgets/StatelessWidget/{Listener.dart => Listener/node1_base.dart} (100%) create mode 100644 lib/views/widgets/StatelessWidget/MaterialButton/node1_base.dart create mode 100644 lib/views/widgets/StatelessWidget/MaterialButton/node2_onLongPress.dart rename lib/views/widgets/StatelessWidget/{MaterialButton.dart => MaterialButton/node3_shape.dart} (62%) delete mode 100755 lib/views/widgets/StatelessWidget/OutLineButton.dart create mode 100755 lib/views/widgets/StatelessWidget/OutlineButton/node1_base.dart delete mode 100644 lib/views/widgets/StatelessWidget/Placeholder.dart create mode 100644 lib/views/widgets/StatelessWidget/Placeholder/node1_base.dart create mode 100644 lib/views/widgets/StatelessWidget/Placeholder/node2_fallback.dart rename lib/views/widgets/StatelessWidget/{PositionedDirectional.dart => PositionedDirectional/node1_base.dart} (100%) delete mode 100644 lib/views/widgets/StatelessWidget/RadioListTile.dart create mode 100644 lib/views/widgets/StatelessWidget/RadioListTile/node1_base.dart create mode 100644 lib/views/widgets/StatelessWidget/RadioListTile/node2_dense.dart delete mode 100755 lib/views/widgets/StatelessWidget/RaisedButton.dart create mode 100755 lib/views/widgets/StatelessWidget/RaisedButton/node1_base.dart rename lib/views/widgets/StatelessWidget/{SimpleDialog.dart => SimpleDialog/node1_base.dart} (100%) rename lib/views/widgets/StatelessWidget/{SimpleDialogOption.dart => SimpleDialogOption/node1_base.dart} (100%) create mode 100644 lib/views/widgets/StatelessWidget/SingleChildScrollView/node1_base.dart rename lib/views/widgets/StatelessWidget/{SingleChildScrollView.dart => SingleChildScrollView/node2_direction.dart} (51%) rename lib/views/widgets/StatelessWidget/{SnackBar.dart => SnackBar/node1_base.dart} (100%) rename lib/views/widgets/StatelessWidget/{SnackBarAction.dart => SnackBarAction/node1_base.dart} (100%) delete mode 100644 lib/views/widgets/StatelessWidget/Spacer.dart create mode 100644 lib/views/widgets/StatelessWidget/Spacer/node1_base.dart create mode 100644 lib/views/widgets/StatelessWidget/Spacer/node2_flex.dart delete mode 100644 lib/views/widgets/StatelessWidget/SwitchListTile.dart create mode 100644 lib/views/widgets/StatelessWidget/SwitchListTile/node1_base.dart create mode 100644 lib/views/widgets/StatelessWidget/SwitchListTile/node2_select.dart create mode 100644 lib/views/widgets/StatelessWidget/SwitchListTile/node3_dense.dart rename lib/views/widgets/StatelessWidget/{Tab.dart => Tab/node1_base.dart} (100%) rename lib/views/widgets/StatelessWidget/{TabBar.dart => TabBar/node1_base.dart} (58%) create mode 100644 lib/views/widgets/StatelessWidget/TabBar/node2_noShadow.dart delete mode 100644 lib/views/widgets/StatelessWidget/Text.dart create mode 100644 lib/views/widgets/StatelessWidget/Text/node1_base.dart create mode 100644 lib/views/widgets/StatelessWidget/Text/node2_shadows.dart create mode 100644 lib/views/widgets/StatelessWidget/Text/node3_decoration.dart create mode 100644 lib/views/widgets/StatelessWidget/Text/node4_textAlign.dart create mode 100644 lib/views/widgets/StatelessWidget/Text/node5_textDirection.dart create mode 100644 lib/views/widgets/StatelessWidget/Text/node6_softWrap.dart delete mode 100644 lib/views/widgets/StatelessWidget/Theme.dart create mode 100644 lib/views/widgets/StatelessWidget/Theme/node1_base.dart create mode 100644 lib/views/widgets/StatelessWidget/Theme/node2_use.dart delete mode 100755 lib/views/widgets/StatelessWidget/ToggleButtons.dart create mode 100644 lib/views/widgets/StatelessWidget/ToggleButtons/node1_single.dart create mode 100644 lib/views/widgets/StatelessWidget/ToggleButtons/node2_color.dart create mode 100644 lib/views/widgets/StatelessWidget/ToggleButtons/node3_multi.dart create mode 100644 lib/views/widgets/StatelessWidget/UserAccountsDrawerHeader/node1_base.dart rename lib/views/widgets/StatelessWidget/{UserAccountsDrawerHeader.dart => UserAccountsDrawerHeader/node2_pro.dart} (55%) create mode 100644 lib/views/widgets/StatelessWidget/VerticalDivider/node1_base.dart rename lib/views/widgets/StatelessWidget/{VerticalDivider.dart => VerticalDivider/node2_height.dart} (55%) delete mode 100644 lib/views/widgets/StatelessWidget/Visibility.dart create mode 100644 lib/views/widgets/StatelessWidget/Visibility/node1_base.dart create mode 100644 lib/views/widgets/StatelessWidget/Visibility/node2_replacement.dart rename lib/views/widgets/StatelessWidget/{ => no}/CupertinoSegmentedControlTest.dart (100%) diff --git a/lib/views/widgets/StatefulWidget/ExpansionTile.dart b/lib/views/widgets/StatefulWidget/ExpansionTile.dart index 3750cf5..420515a 100644 --- a/lib/views/widgets/StatefulWidget/ExpansionTile.dart +++ b/lib/views/widgets/StatefulWidget/ExpansionTile.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:flutter_unit/views/widgets/StatelessWidget/RadioListTile.dart'; +import 'package:flutter_unit/views/widgets/StatelessWidget/stateless_unit.dart'; // { // "widgetId": 52, diff --git a/lib/views/widgets/StatelessWidget/MonthPicker.dart b/lib/views/widgets/StatefulWidget/MonthPicker/node1_base.dart similarity index 100% rename from lib/views/widgets/StatelessWidget/MonthPicker.dart rename to lib/views/widgets/StatefulWidget/MonthPicker/node1_base.dart diff --git a/lib/views/widgets/StatelessWidget/WillPopScope.dart b/lib/views/widgets/StatefulWidget/WillPopScope/node1_base.dart similarity index 100% rename from lib/views/widgets/StatelessWidget/WillPopScope.dart rename to lib/views/widgets/StatefulWidget/WillPopScope/node1_base.dart diff --git a/lib/views/widgets/StatelessWidget/YearPicker.dart b/lib/views/widgets/StatefulWidget/YearPicker/node1_base.dart similarity index 100% rename from lib/views/widgets/StatelessWidget/YearPicker.dart rename to lib/views/widgets/StatefulWidget/YearPicker/node1_base.dart diff --git a/lib/views/widgets/StatefulWidget/stateful_unit.dart b/lib/views/widgets/StatefulWidget/stateful_unit.dart index 8d25a99..32971e8 100644 --- a/lib/views/widgets/StatefulWidget/stateful_unit.dart +++ b/lib/views/widgets/StatefulWidget/stateful_unit.dart @@ -8,6 +8,9 @@ export 'CupertinoDatePicker/node1_base.dart'; export 'CupertinoPicker/node1_base.dart'; export 'CupertinoTimerPicker/node_base.dart'; +export 'MonthPicker/node1_base.dart'; +export 'YearPicker/node1_base.dart'; +export 'WillPopScope/node1_base.dart'; export 'AppBar.dart'; export 'BottomAppBar.dart'; diff --git a/lib/views/widgets/StatelessWidget/GestureDetector.dart b/lib/views/widgets/StatelessWidget/GestureDetector.dart deleted file mode 100644 index c85b0f6..0000000 --- a/lib/views/widgets/StatelessWidget/GestureDetector.dart +++ /dev/null @@ -1,130 +0,0 @@ -import 'package:flutter/material.dart'; - -/// create by 张风捷特烈 on 2020-03-25 -/// contact me by email 1981462002@qq.com -/// 说明: - -// { -// "widgetId": 146, -// "name": 'GestureDetector基本事件', -// "priority": 1, -// "subtitle": -// "【child】 : 子组件 【Widget】\n" -// "【onTap】 : 点击事件 【Function()】\n" -// "【onDoubleTap】 : 双击事件 【Function()】\n" -// "【onLongPress】 : 长按事件 【Function()】", -// } - -class CustomGestureDetector extends StatefulWidget { - @override - _CustomGestureDetectorState createState() => _CustomGestureDetectorState(); -} - -class _CustomGestureDetectorState extends State { - var _info = ''; - - @override - Widget build(BuildContext context) { - return GestureDetector( - onTap: () => setState(() => _info = 'onTap'), - onDoubleTap: () => setState(() => _info = 'onDoubleTap'), - onLongPress: () => setState(() => _info = 'onLongPress'), - child: Container( - alignment: Alignment.center, - width: 300, - height: 300 * 0.4, - color: Colors.grey.withAlpha(33), - child: Text( - _info, - style: TextStyle(fontSize: 18, color: Colors.blue), - ), - ), - ); - } -} - -// { -// "widgetId": 146, -// "name": 'GestureDetector详情信息', -// "priority": 2, -// "subtitle": -// "【onTapDown】 : 按下回调 【Function(TapDownDetails)】\n" -// "【onTapUp】 : 子组件 【Function(TapUpDetails)】\n" -// "【onTapCancel】 : 点击取消 【Function()】", -// } -class TapGestureDetector extends StatefulWidget { - @override - _TapGestureDetectorState createState() => _TapGestureDetectorState(); -} - -class _TapGestureDetectorState extends State { - var _info = ''; - - @override - Widget build(BuildContext context) { - return GestureDetector( - onTapDown: (detail) => setState(() => _info = - 'onTapDown:\n相对落点:${detail.localPosition}\n绝对落点:${detail.globalPosition}'), - onTapUp: (detail) => setState(() => _info = - 'onTapUp:\n相对落点:${detail.localPosition}\n绝对落点:${detail.globalPosition}'), - onTapCancel: () => setState(() => _info = 'onTapCancel'), - child: Container( - alignment: Alignment.center, - width: 300, - height: 300 * 0.618, - color: Colors.grey.withAlpha(33), - child: Text( - _info, - style: TextStyle(fontSize: 18, color: Colors.blue), - ), - ), - ); - } -} - -// { -// "widgetId": 146, -// "name": 'GestureDetector的Pan事件', -// "priority": 3, -// "subtitle": -// "【onPanDown】 : 按下回调 【Function(DragDownDetails)】\n" -// "【onPanEnd】 : 拖动结束 【Function(DragEndDetails)】\n" -// "【onPanStart】 : 开始拖动 【Function(DragStartDetails)】\n" -// "【onPanUpdate】 : 拖动更新 【Function(TapUpDetails)】\n" -// "【onPanCancel】 : 拖动取消 【Function()】", -// } -class PanGestureDetector extends StatefulWidget { - @override - _PanGestureDetectorState createState() => _PanGestureDetectorState(); -} - -class _PanGestureDetectorState extends State { - var _info = ''; - - @override - Widget build(BuildContext context) { - return GestureDetector( - onPanDown: (detail) => setState(() => _info = - 'onPanDown:\n相对落点:${detail.localPosition}\n绝对落点:${detail.globalPosition}'), - onPanEnd: (detail) => setState(() => _info = - 'onPanEnd:\n初速度:${detail.primaryVelocity}\n最终速度:${detail.velocity}'), - onPanUpdate: (detail) => setState(() => _info = - 'onPanUpdate:\n相对落点:${detail.localPosition}\n绝对落点:${detail.globalPosition}'), - onPanStart: (detail) => setState(() => _info = - 'onPanStart:\n相对落点:${detail.localPosition}\n绝对落点:${detail.globalPosition}'), - onPanCancel: () => setState(() => _info = 'onTapCancel'), - child: SingleChildScrollView( - child: Container( - alignment: Alignment.center, - width: 300, - height: 300 * 0.618, - color: Colors.grey.withAlpha(33), - child: Text( - _info, - style: TextStyle(fontSize: 18, color: Colors.blue), - ), - ), - ), - ); - } -} diff --git a/lib/views/widgets/StatelessWidget/GestureDetector/node1_base.dart b/lib/views/widgets/StatelessWidget/GestureDetector/node1_base.dart new file mode 100644 index 0000000..e9f2dfc --- /dev/null +++ b/lib/views/widgets/StatelessWidget/GestureDetector/node1_base.dart @@ -0,0 +1,48 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020/4/27 +/// contact me by email 1981462002@qq.com +/// 说明: + +/// create by 张风捷特烈 on 2020-03-25 +/// contact me by email 1981462002@qq.com +/// 说明: + +// { +// "widgetId": 146, +// "name": 'GestureDetector基本事件', +// "priority": 1, +// "subtitle": +// "【child】 : 子组件 【Widget】\n" +// "【onTap】 : 点击事件 【Function()】\n" +// "【onDoubleTap】 : 双击事件 【Function()】\n" +// "【onLongPress】 : 长按事件 【Function()】", +// } + +class CustomGestureDetector extends StatefulWidget { + @override + _CustomGestureDetectorState createState() => _CustomGestureDetectorState(); +} + +class _CustomGestureDetectorState extends State { + var _info = ''; + + @override + Widget build(BuildContext context) { + return GestureDetector( + onTap: () => setState(() => _info = 'onTap'), + onDoubleTap: () => setState(() => _info = 'onDoubleTap'), + onLongPress: () => setState(() => _info = 'onLongPress'), + child: Container( + alignment: Alignment.center, + width: 300, + height: 300 * 0.4, + color: Colors.grey.withAlpha(33), + child: Text( + _info, + style: TextStyle(fontSize: 18, color: Colors.blue), + ), + ), + ); + } +} \ No newline at end of file diff --git a/lib/views/widgets/StatelessWidget/GestureDetector/node2_tap.dart b/lib/views/widgets/StatelessWidget/GestureDetector/node2_tap.dart new file mode 100644 index 0000000..b2e6242 --- /dev/null +++ b/lib/views/widgets/StatelessWidget/GestureDetector/node2_tap.dart @@ -0,0 +1,44 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020/4/27 +/// contact me by email 1981462002@qq.com +/// 说明: + +// { +// "widgetId": 146, +// "name": 'GestureDetector详情信息', +// "priority": 2, +// "subtitle": +// "【onTapDown】 : 按下回调 【Function(TapDownDetails)】\n" +// "【onTapUp】 : 子组件 【Function(TapUpDetails)】\n" +// "【onTapCancel】 : 点击取消 【Function()】", +// } +class TapGestureDetector extends StatefulWidget { + @override + _TapGestureDetectorState createState() => _TapGestureDetectorState(); +} + +class _TapGestureDetectorState extends State { + var _info = ''; + + @override + Widget build(BuildContext context) { + return GestureDetector( + onTapDown: (detail) => setState(() => _info = + 'onTapDown:\n相对落点:${detail.localPosition}\n绝对落点:${detail.globalPosition}'), + onTapUp: (detail) => setState(() => _info = + 'onTapUp:\n相对落点:${detail.localPosition}\n绝对落点:${detail.globalPosition}'), + onTapCancel: () => setState(() => _info = 'onTapCancel'), + child: Container( + alignment: Alignment.center, + width: 300, + height: 300 * 0.618, + color: Colors.grey.withAlpha(33), + child: Text( + _info, + style: TextStyle(fontSize: 18, color: Colors.blue), + ), + ), + ); + } +} \ No newline at end of file diff --git a/lib/views/widgets/StatelessWidget/GestureDetector/node3_pan.dart b/lib/views/widgets/StatelessWidget/GestureDetector/node3_pan.dart new file mode 100644 index 0000000..ab62bfe --- /dev/null +++ b/lib/views/widgets/StatelessWidget/GestureDetector/node3_pan.dart @@ -0,0 +1,52 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020-03-25 +/// contact me by email 1981462002@qq.com +/// 说明: + +// { +// "widgetId": 146, +// "name": 'GestureDetector的Pan事件', +// "priority": 3, +// "subtitle": +// "【onPanDown】 : 按下回调 【Function(DragDownDetails)】\n" +// "【onPanEnd】 : 拖动结束 【Function(DragEndDetails)】\n" +// "【onPanStart】 : 开始拖动 【Function(DragStartDetails)】\n" +// "【onPanUpdate】 : 拖动更新 【Function(TapUpDetails)】\n" +// "【onPanCancel】 : 拖动取消 【Function()】", +// } +class PanGestureDetector extends StatefulWidget { + @override + _PanGestureDetectorState createState() => _PanGestureDetectorState(); +} + +class _PanGestureDetectorState extends State { + var _info = ''; + + @override + Widget build(BuildContext context) { + return GestureDetector( + onPanDown: (detail) => setState(() => _info = + 'onPanDown:\n相对落点:${detail.localPosition}\n绝对落点:${detail.globalPosition}'), + onPanEnd: (detail) => setState(() => _info = + 'onPanEnd:\n初速度:${detail.primaryVelocity}\n最终速度:${detail.velocity}'), + onPanUpdate: (detail) => setState(() => _info = + 'onPanUpdate:\n相对落点:${detail.localPosition}\n绝对落点:${detail.globalPosition}'), + onPanStart: (detail) => setState(() => _info = + 'onPanStart:\n相对落点:${detail.localPosition}\n绝对落点:${detail.globalPosition}'), + onPanCancel: () => setState(() => _info = 'onTapCancel'), + child: SingleChildScrollView( + child: Container( + alignment: Alignment.center, + width: 300, + height: 300 * 0.618, + color: Colors.grey.withAlpha(33), + child: Text( + _info, + style: TextStyle(fontSize: 18, color: Colors.blue), + ), + ), + ), + ); + } +} diff --git a/lib/views/widgets/StatelessWidget/GirdView.dart b/lib/views/widgets/StatelessWidget/GirdView.dart deleted file mode 100644 index 561f8da..0000000 --- a/lib/views/widgets/StatelessWidget/GirdView.dart +++ /dev/null @@ -1,203 +0,0 @@ -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -/// create by 张风捷特烈 on 2020-03-27 -/// contact me by email 1981462002@qq.com -/// 说明: -// { -// "widgetId": 163, -// "name": 'GridView.count构造', -// "priority": 1, -// "subtitle": -// "【children】 : 子组件列表 【List】\n" -// "【crossAxisCount】 : 主轴一行box数量 【int】\n" -// "【mainAxisSpacing】 : 主轴每行间距 【double】\n" -// "【crossAxisSpacing】 : 交叉轴每行间距 【double】\n" -// "【childAspectRatio】 : box主长/交叉轴长 【double】\n" -// "【crossAxisCount】 : 主轴一行数量 【int】", -// } -class CustomGridView extends StatelessWidget { - final data = List.generate(128, (i) => Color(0xFFFF00FF - 2*i)); - - @override - Widget build(BuildContext context) { - return Container( - height: 200, - child: GridView.count( - crossAxisCount: 4, - mainAxisSpacing: 2, - crossAxisSpacing: 2, - childAspectRatio: 1/0.618, - children: data - .map((color) => _buildItem(color)) - .toList(), - ), - ); - } - - Container _buildItem(Color color) => Container( - alignment: Alignment.center, - width: 100, - height: 30, - 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()}"; -} - -// { -// "widgetId": 163, -// "name": 'GridView滑动方向', -// "priority": 2, -// "subtitle": -// "【scrollDirection】 : 滑动方向 【Axis】\n" -// "【reverse】 : 是否反向滑动 【bool】\n" -// "【shrinkWrap】 : 无边界时是否包裹 【bool】", -// } -class HorizontalGridView extends StatelessWidget { - final data = List.generate(128, (i) => Color(0xFF00FFFF - 2*i)); - - @override - Widget build(BuildContext context) { - return Container( - height: 200, - child: GridView.count( - scrollDirection: Axis.horizontal, - reverse: true, - crossAxisCount: 4, - mainAxisSpacing: 2, - crossAxisSpacing: 2, - childAspectRatio: 0.618, - children: data - .map((color) => _buildItem(color)) - .toList(), - ), - ); - } - - Container _buildItem(Color color) => Container( - alignment: Alignment.center, - width: 100, - height: 30, - 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()}"; -} -// { -// "widgetId": 163, -// "name": 'GridView.extent构造', -// "priority": 3, -// "subtitle": -// "【maxCrossAxisExtent】 : box轴向长度 【double】\n" -// "【reverse】 : 是否反向滑动 【bool】\n" -// "【shrinkWrap】 : 无边界时是否包裹 【bool】", -// } -class ExtentGridView extends StatelessWidget { - final data = List.generate(128, (i) => Color(0xFF00FFFF - 2*i)); - - @override - Widget build(BuildContext context) { - return Container( - height: 200, - child: GridView.extent( - scrollDirection: Axis.horizontal, - maxCrossAxisExtent: 80.0, - mainAxisSpacing: 2, - crossAxisSpacing: 2, - childAspectRatio: 0.618, - children: data - .map((color) => _buildItem(color)) - .toList(), - ), - ); - } - - Container _buildItem(Color color) => Container( - alignment: Alignment.center, - width: 100, - height: 30, - 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()}"; -} - -// { -// "widgetId": 163, -// "name": 'GridView.builder构造', -// "priority": 4, -// "subtitle": -// "【itemCount】 : 条目数量 【int】\n" -// "【gridDelegate】 : 网格代理 【SliverGridDelegate】\n" -// "【itemBuilder】 : 条目构造器 【IndexedWidgetBuilder】", -// } -class BuilderGridView extends StatelessWidget { - final data = List.generate(128, (i) => Color(0xFF33FFF - 2*i)); - - @override - Widget build(BuildContext context) { - return Container( - height: 200, - child: GridView.builder( - itemCount: data.length, - scrollDirection: Axis.vertical, - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(//网格代理:定交叉轴数目 - crossAxisCount: 4,//条目个数 - mainAxisSpacing: 5,//主轴间距 - crossAxisSpacing: 5,//交叉轴间距 - childAspectRatio:1/0.618), - itemBuilder: (_, int position)=> _buildItem(data[position]) - ), - ); - } - - Container _buildItem(Color color) => Container( - alignment: Alignment.center, - width: 100, - height: 30, - 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/StatelessWidget/GirdView/node1_base.dart b/lib/views/widgets/StatelessWidget/GirdView/node1_base.dart new file mode 100644 index 0000000..f8dfa48 --- /dev/null +++ b/lib/views/widgets/StatelessWidget/GirdView/node1_base.dart @@ -0,0 +1,56 @@ + +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020-03-27 +/// contact me by email 1981462002@qq.com +/// 说明: +// { +// "widgetId": 163, +// "name": 'GridView.count构造', +// "priority": 1, +// "subtitle": +// "【children】 : 子组件列表 【List】\n" +// "【crossAxisCount】 : 主轴一行box数量 【int】\n" +// "【mainAxisSpacing】 : 主轴每行间距 【double】\n" +// "【crossAxisSpacing】 : 交叉轴每行间距 【double】\n" +// "【childAspectRatio】 : box主长/交叉轴长 【double】\n" +// "【crossAxisCount】 : 主轴一行数量 【int】", +// } +class CustomGridView extends StatelessWidget { + final data = List.generate(128, (i) => Color(0xFFFF00FF - 2*i)); + + @override + Widget build(BuildContext context) { + return Container( + height: 200, + child: GridView.count( + crossAxisCount: 4, + mainAxisSpacing: 2, + crossAxisSpacing: 2, + childAspectRatio: 1/0.618, + children: data + .map((color) => _buildItem(color)) + .toList(), + ), + ); + } + + Container _buildItem(Color color) => Container( + alignment: Alignment.center, + width: 100, + height: 30, + 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/StatelessWidget/GirdView/node2_direction.dart b/lib/views/widgets/StatelessWidget/GirdView/node2_direction.dart new file mode 100644 index 0000000..c72f57d --- /dev/null +++ b/lib/views/widgets/StatelessWidget/GirdView/node2_direction.dart @@ -0,0 +1,55 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020-03-27 +/// contact me by email 1981462002@qq.com +/// 说明: + +// { +// "widgetId": 163, +// "name": 'GridView滑动方向', +// "priority": 2, +// "subtitle": +// "【scrollDirection】 : 滑动方向 【Axis】\n" +// "【reverse】 : 是否反向滑动 【bool】\n" +// "【shrinkWrap】 : 无边界时是否包裹 【bool】", +// } +class HorizontalGridView extends StatelessWidget { + final data = List.generate(128, (i) => Color(0xFF00FFFF - 2*i)); + + @override + Widget build(BuildContext context) { + return Container( + height: 200, + child: GridView.count( + scrollDirection: Axis.horizontal, + reverse: true, + crossAxisCount: 4, + mainAxisSpacing: 2, + crossAxisSpacing: 2, + childAspectRatio: 0.618, + children: data + .map((color) => _buildItem(color)) + .toList(), + ), + ); + } + + Container _buildItem(Color color) => Container( + alignment: Alignment.center, + width: 100, + height: 30, + 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/StatelessWidget/GirdView/node3_extend.dart b/lib/views/widgets/StatelessWidget/GirdView/node3_extend.dart new file mode 100644 index 0000000..5fc92ea --- /dev/null +++ b/lib/views/widgets/StatelessWidget/GirdView/node3_extend.dart @@ -0,0 +1,54 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020-03-27 +/// contact me by email 1981462002@qq.com +/// 说明: + +// { +// "widgetId": 163, +// "name": 'GridView.extent构造', +// "priority": 3, +// "subtitle": +// "【maxCrossAxisExtent】 : box轴向长度 【double】\n" +// "【reverse】 : 是否反向滑动 【bool】\n" +// "【shrinkWrap】 : 无边界时是否包裹 【bool】", +// } +class ExtentGridView extends StatelessWidget { + final data = List.generate(128, (i) => Color(0xFF00FFFF - 2*i)); + + @override + Widget build(BuildContext context) { + return Container( + height: 200, + child: GridView.extent( + scrollDirection: Axis.horizontal, + maxCrossAxisExtent: 80.0, + mainAxisSpacing: 2, + crossAxisSpacing: 2, + childAspectRatio: 0.618, + children: data + .map((color) => _buildItem(color)) + .toList(), + ), + ); + } + + Container _buildItem(Color color) => Container( + alignment: Alignment.center, + width: 100, + height: 30, + 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/StatelessWidget/GirdView/node4_builder.dart b/lib/views/widgets/StatelessWidget/GirdView/node4_builder.dart new file mode 100644 index 0000000..695cae7 --- /dev/null +++ b/lib/views/widgets/StatelessWidget/GirdView/node4_builder.dart @@ -0,0 +1,54 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020-03-27 +/// contact me by email 1981462002@qq.com +/// 说明: + +// { +// "widgetId": 163, +// "name": 'GridView.builder构造', +// "priority": 4, +// "subtitle": +// "【itemCount】 : 条目数量 【int】\n" +// "【gridDelegate】 : 网格代理 【SliverGridDelegate】\n" +// "【itemBuilder】 : 条目构造器 【IndexedWidgetBuilder】", +// } +class BuilderGridView extends StatelessWidget { + final data = List.generate(128, (i) => Color(0xFF33FFF - 2*i)); + + @override + Widget build(BuildContext context) { + return Container( + height: 200, + child: GridView.builder( + itemCount: data.length, + scrollDirection: Axis.vertical, + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(//网格代理:定交叉轴数目 + crossAxisCount: 4,//条目个数 + mainAxisSpacing: 5,//主轴间距 + crossAxisSpacing: 5,//交叉轴间距 + childAspectRatio:1/0.618), + itemBuilder: (_, int position)=> _buildItem(data[position]) + ), + ); + } + + Container _buildItem(Color color) => Container( + alignment: Alignment.center, + width: 100, + height: 30, + 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/StatelessWidget/GridPaper/node1_base.dart b/lib/views/widgets/StatelessWidget/GridPaper/node1_base.dart new file mode 100644 index 0000000..045818d --- /dev/null +++ b/lib/views/widgets/StatelessWidget/GridPaper/node1_base.dart @@ -0,0 +1,29 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020/4/27 +/// contact me by email 1981462002@qq.com +/// 说明: + +// { +// "widgetId": 37, +// "priority": 1, +// "name": "GridPage基础属性", +// "subtitle": "【child】: 子组件 【Widget】\n" +// "【color】: 颜色 【Color】\n" +// "【interval】: 小块边长 【double】", +// } +class CustomGridPage extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Container( + width: 200, + height: 100, + child: GridPaper( + color: Colors.red, + interval: 50, + child: Image.asset( + "assets/images/wy_300x200.jpg", + fit: BoxFit.cover, + ))); + } +} \ No newline at end of file diff --git a/lib/views/widgets/StatelessWidget/GridPager.dart b/lib/views/widgets/StatelessWidget/GridPaper/node2_divisions.dart similarity index 51% rename from lib/views/widgets/StatelessWidget/GridPager.dart rename to lib/views/widgets/StatelessWidget/GridPaper/node2_divisions.dart index 33371aa..fba4cc6 100644 --- a/lib/views/widgets/StatelessWidget/GridPager.dart +++ b/lib/views/widgets/StatelessWidget/GridPaper/node2_divisions.dart @@ -1,21 +1,17 @@ import 'package:flutter/material.dart'; -class CustomGridPage extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Container( - width: 200, - height: 100, - child: GridPaper( - color: Colors.red, - interval: 50, - child: Image.asset( - "assets/images/wy_300x200.jpg", - fit: BoxFit.cover, - ))); - } -} - +/// create by 张风捷特烈 on 2020/4/27 +/// contact me by email 1981462002@qq.com +/// 说明: +// { +// "widgetId": 37, +// "priority": 2, +// "name": "GridPage再分割", +// "subtitle": "【child】: 子组件 【Widget】\n" +// "【color】: 颜色 【Color】\n" +// "【subdivisions】: 小块中子块个数 【int】\n" +// "【divisions】: 小块中子块的分割数 【int】", +// } class DivisionsGridPage extends StatelessWidget { @override Widget build(BuildContext context) { diff --git a/lib/views/widgets/StatelessWidget/GridTile.dart b/lib/views/widgets/StatelessWidget/GridTile/node1_base.dart similarity index 74% rename from lib/views/widgets/StatelessWidget/GridTile.dart rename to lib/views/widgets/StatelessWidget/GridTile/node1_base.dart index 78f620e..576bf25 100644 --- a/lib/views/widgets/StatelessWidget/GridTile.dart +++ b/lib/views/widgets/StatelessWidget/GridTile/node1_base.dart @@ -1,4 +1,16 @@ import 'package:flutter/material.dart'; +/// create by 张风捷特烈 on 2020/4/27 +/// contact me by email 1981462002@qq.com +/// 说明: + +// { +// "widgetId": 21, +// "priority": 1, +// "name": "GridTile的基本表现如下", +// "subtitle": "【header】: 头组件 【Widget】\n" +// "【child】: 子组件 【Widget】\n" +// "【footer】: 脚组件 【Widget】", +// } class CustomGridTile extends StatelessWidget { @override diff --git a/lib/views/widgets/StatelessWidget/GridTileBar.dart b/lib/views/widgets/StatelessWidget/GridTileBar.dart deleted file mode 100644 index a87740e..0000000 --- a/lib/views/widgets/StatelessWidget/GridTileBar.dart +++ /dev/null @@ -1,21 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_unit/components/permanent/panel.dart'; - - -class CustomGridTileBar extends StatelessWidget { - @override - Widget build(BuildContext context) { - return GridTileBar( - backgroundColor: Colors.blue.withAlpha(120), - trailing: Icon( - Icons.star, - color: Colors.red, - ), - leading: CircleAvatar( - backgroundImage: AssetImage("assets/images/wy_200x300.jpg"), - ), - title: Text("百里·巫缨"), - subtitle: Text("倾国必倾城"), - ); - } -} diff --git a/lib/views/widgets/StatelessWidget/GridTileBar/node1_base.dart b/lib/views/widgets/StatelessWidget/GridTileBar/node1_base.dart new file mode 100644 index 0000000..6e95d79 --- /dev/null +++ b/lib/views/widgets/StatelessWidget/GridTileBar/node1_base.dart @@ -0,0 +1,36 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020/4/27 +/// contact me by email 1981462002@qq.com +/// 说明: + +// { +// "widgetId": 20, +// "priority": 1, +// "name": "GridTileBar的基本表现如下", +// "subtitle": "【value】 : 条目对象 【T】\n" +// "【leading】: 左侧组件 【Widget】\n" +// "【trailing】: 尾组件 【Widget】\n" +// "【title】: 中间上组件 【Widget】\n" +// "【subtitle】: 中间下组件 【Widget】\n" +// "【backgroundColor】: 背景色 【Color】", +// } + + +class CustomGridTileBar extends StatelessWidget { + @override + Widget build(BuildContext context) { + return GridTileBar( + backgroundColor: Colors.blue.withAlpha(120), + trailing: Icon( + Icons.star, + color: Colors.red, + ), + leading: CircleAvatar( + backgroundImage: AssetImage("assets/images/wy_200x300.jpg"), + ), + title: Text("百里·巫缨"), + subtitle: Text("倾国必倾城"), + ); + } +} diff --git a/lib/views/widgets/StatelessWidget/GridView.dart b/lib/views/widgets/StatelessWidget/GridView.dart deleted file mode 100644 index 489328c..0000000 --- a/lib/views/widgets/StatelessWidget/GridView.dart +++ /dev/null @@ -1,36 +0,0 @@ -import 'package:flutter/material.dart'; - -import 'package:flutter_unit/app/utils/color_utils.dart'; - -class GridViewPage extends StatefulWidget { - - @override - _GridViewGridViewExtentState createState() => _GridViewGridViewExtentState(); -} -class _GridViewGridViewExtentState extends State { - List data; - - @override - void initState() { - data=List.generate(50, (i)=>i);//生成50个数字 - super.initState(); - } - - @override - Widget build(BuildContext context) { - var builder= GridView.builder( - itemCount: data.length, - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(//网格代理:定交叉轴数目 - crossAxisCount: 4,//条目个数 - mainAxisSpacing: 10,//主轴间距 - crossAxisSpacing: 10,//交叉轴间距 - childAspectRatio:1/0.618,//交叉轴方向item尺寸/主轴方向item尺寸 - ), - itemBuilder: (_, int position) => Container( alignment: Alignment.center, - color: ColorUtils.randomColor(limitA: 255),child: Text("$position") ), - padding: EdgeInsets.all(10), - scrollDirection: Axis.vertical,//滑动方向 - ); - return builder; - } -} \ No newline at end of file diff --git a/lib/views/widgets/StatelessWidget/Icon.dart b/lib/views/widgets/StatelessWidget/Icon.dart deleted file mode 100644 index 2d422eb..0000000 --- a/lib/views/widgets/StatelessWidget/Icon.dart +++ /dev/null @@ -1,45 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_unit/app/style/TolyIcon.dart'; - -class CustomIcon extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Wrap( - crossAxisAlignment: WrapCrossAlignment.center, - children: [ - Icon( - Icons.send, - color: Colors.orange, - size: 60, - ), - Icon( - Icons.android, - color: Colors.green, - size: 100, - ), - ], - ); - } -} - -class MyIcon extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Wrap( - spacing: 20, - crossAxisAlignment: WrapCrossAlignment.center, - children: [ - TolyIcon.icon_search, - TolyIcon.icon_star, - TolyIcon.icon_layout, - TolyIcon.icon_star_ok - ] - .map((e) => Icon( - e, - color: Colors.green, - size: 60, - )) - .toList(), - ); - } -} diff --git a/lib/views/widgets/StatelessWidget/Icon/node1_base.dart b/lib/views/widgets/StatelessWidget/Icon/node1_base.dart new file mode 100644 index 0000000..64aa692 --- /dev/null +++ b/lib/views/widgets/StatelessWidget/Icon/node1_base.dart @@ -0,0 +1,38 @@ + + +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020/4/27 +/// contact me by email 1981462002@qq.com +/// 说明: + +// { +// "widgetId": 6, +// "priority": 1, +// "name": "用于显示一个图标", +// "subtitle": "【入参】 :图标数据 【IconData】\n" +// "【size】 : 大小 【double】\n" +// "【color】: 颜色 【Color】", +// } + + +class CustomIcon extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Wrap( + crossAxisAlignment: WrapCrossAlignment.center, + children: [ + Icon( + Icons.send, + color: Colors.orange, + size: 60, + ), + Icon( + Icons.android, + color: Colors.green, + size: 100, + ), + ], + ); + } +} \ No newline at end of file diff --git a/lib/views/widgets/StatelessWidget/Icon/node2_diy.dart b/lib/views/widgets/StatelessWidget/Icon/node2_diy.dart new file mode 100644 index 0000000..1a3784d --- /dev/null +++ b/lib/views/widgets/StatelessWidget/Icon/node2_diy.dart @@ -0,0 +1,37 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_unit/app/style/TolyIcon.dart'; + +/// create by 张风捷特烈 on 2020/4/27 +/// contact me by email 1981462002@qq.com +/// 说明: + +// { +// "widgetId": 6, +// "priority": 2, +// "name": "使用自定义图标", +// "subtitle": "可在iconfont网站中下载图标字体进行使用", +// } + + +class MyIcon extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Wrap( + spacing: 20, + crossAxisAlignment: WrapCrossAlignment.center, + children: [ + TolyIcon.icon_search, + TolyIcon.icon_star, + TolyIcon.icon_layout, + TolyIcon.icon_star_ok + ] + .map((e) => Icon( + e, + color: Colors.green, + size: 60, + )) + .toList(), + ); + } +} + diff --git a/lib/views/widgets/StatelessWidget/IconButton.dart b/lib/views/widgets/StatelessWidget/IconButton.dart deleted file mode 100755 index f3007a8..0000000 --- a/lib/views/widgets/StatelessWidget/IconButton.dart +++ /dev/null @@ -1,19 +0,0 @@ -import 'package:flutter/material.dart'; - - -class CustomIconButton extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Padding( - padding: const EdgeInsets.all(8.0), - child: IconButton( - padding: EdgeInsets.only(), - onPressed: () {}, - icon: Icon(Icons.android, size: 40, color: Colors.green), - tooltip: "android", - highlightColor: Colors.orangeAccent, - splashColor: Colors.blue, - ), - ); - } -} diff --git a/lib/views/widgets/StatelessWidget/IconButton/node1_base.dart b/lib/views/widgets/StatelessWidget/IconButton/node1_base.dart new file mode 100755 index 0000000..e1d2386 --- /dev/null +++ b/lib/views/widgets/StatelessWidget/IconButton/node1_base.dart @@ -0,0 +1,32 @@ +import 'package:flutter/material.dart'; +/// create by 张风捷特烈 on 2020/4/27 +/// contact me by email 1981462002@qq.com +/// 说明: +// { +// "widgetId": 30, +// "priority": 1, +// "name": "IconButton属性", +// "subtitle": "【child】: 子组件 【Widget】\n" +// "【icon】: 内边距 【Widget】\n" +// "【tooltip】: 长按提示文字 【String】\n" +// "【highlightColor】: 长按高亮色 【Color】\n" +// "【splashColor】: 水波纹色 【Color】\n" +// "【onPressed】: 点击事件 【Function】", +// } + +class CustomIconButton extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.all(8.0), + child: IconButton( + padding: EdgeInsets.only(), + onPressed: () {}, + icon: Icon(Icons.android, size: 40, color: Colors.green), + tooltip: "android", + highlightColor: Colors.orangeAccent, + splashColor: Colors.blue, + ), + ); + } +} diff --git a/lib/views/widgets/StatelessWidget/ImageIcon.dart b/lib/views/widgets/StatelessWidget/ImageIcon/node1_base.dart similarity index 57% rename from lib/views/widgets/StatelessWidget/ImageIcon.dart rename to lib/views/widgets/StatelessWidget/ImageIcon/node1_base.dart index e08ba94..47eee46 100644 --- a/lib/views/widgets/StatelessWidget/ImageIcon.dart +++ b/lib/views/widgets/StatelessWidget/ImageIcon/node1_base.dart @@ -1,6 +1,16 @@ import 'package:flutter/material.dart'; -import 'package:flutter_unit/components/permanent/panel.dart'; +/// create by 张风捷特烈 on 2020/4/27 +/// contact me by email 1981462002@qq.com +/// 说明: +// { +// "widgetId": 7, +// "priority": 1, +// "name": "用于显示一个纯色图片", +// "subtitle": "【入参】 : 图片资源 【ImageProvider】\n" +// "【size】 : 大小 【double】\n" +// "【color】: 角标颜色 【Color】", +// } class CustomImageIcon extends StatelessWidget { @override diff --git a/lib/views/widgets/StatelessWidget/InputChip/node1_base.dart b/lib/views/widgets/StatelessWidget/InputChip/node1_base.dart new file mode 100644 index 0000000..7190ee8 --- /dev/null +++ b/lib/views/widgets/StatelessWidget/InputChip/node1_base.dart @@ -0,0 +1,41 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_unit/views/dialogs/dialog_about.dart'; + +/// create by 张风捷特烈 on 2020/4/27 +/// contact me by email 1981462002@qq.com +/// 说明: +// { +// "widgetId": 14, +// "priority": 1, +// "name": "可以接受点击、删除事件", +// "subtitle": "【onPressed】: 点击事件 【Function()】\n" +// "【onDeleted】: 删除事件 【Function()】", +// } + +class PressInputChip extends StatefulWidget { + @override + _PressInputChipState createState() => _PressInputChipState(); +} + +class _PressInputChipState extends State { + bool _delete = false; + + @override + Widget build(BuildContext context) { + return InputChip( + padding: EdgeInsets.all(5), + labelPadding: EdgeInsets.all(3), + label: Text( + !_delete ? + "This is a InputChip." : + "You are clicked delete icon."), + backgroundColor: Colors.grey.withAlpha(66), + avatar: Image.asset("assets/images/icon_head.png"), + selectedColor: Colors.orangeAccent.withAlpha(88), + selectedShadowColor: Colors.blue, + shadowColor: Colors.orangeAccent, + elevation: 3, + onPressed: () => DialogAbout.show(context), + onDeleted: () => setState(() => _delete = !_delete)); + } +} \ No newline at end of file diff --git a/lib/views/widgets/StatelessWidget/InputChip.dart b/lib/views/widgets/StatelessWidget/InputChip/node2_select.dart similarity index 51% rename from lib/views/widgets/StatelessWidget/InputChip.dart rename to lib/views/widgets/StatelessWidget/InputChip/node2_select.dart index b865f4d..1eb5959 100644 --- a/lib/views/widgets/StatelessWidget/InputChip.dart +++ b/lib/views/widgets/StatelessWidget/InputChip/node2_select.dart @@ -1,35 +1,18 @@ import 'package:flutter/material.dart'; -import 'package:flutter_unit/components/permanent/panel.dart'; import 'package:flutter_unit/views/dialogs/dialog_about.dart'; -class PressInputChip extends StatefulWidget { - @override - _PressInputChipState createState() => _PressInputChipState(); -} -class _PressInputChipState extends State { - bool _delete = false; - - @override - Widget build(BuildContext context) { - return InputChip( - padding: EdgeInsets.all(5), - labelPadding: EdgeInsets.all(3), - label: Text( - !_delete ? - "This is a InputChip." : - "You are clicked delete icon."), - backgroundColor: Colors.grey.withAlpha(66), - avatar: Image.asset("assets/images/icon_head.png"), - selectedColor: Colors.orangeAccent.withAlpha(88), - selectedShadowColor: Colors.blue, - shadowColor: Colors.orangeAccent, - elevation: 3, - onPressed: () => DialogAbout.show(context), - onDeleted: () => setState(() => _delete = !_delete)); - } -} +/// create by 张风捷特烈 on 2020/4/27 +/// contact me by email 1981462002@qq.com +/// 说明: +// { +// "widgetId": 14, +// "priority": 2, +// "name": "可以接受选中事件", +// "subtitle": "【selected】: 是否选中 【bool】\n" +// "【onSelected】: 选中事件 【Function(bool)】", +// } class SelectInputChip extends StatefulWidget { @override @@ -61,4 +44,4 @@ class _SelectInputChipState extends State { }, ); } -} +} \ No newline at end of file diff --git a/lib/views/widgets/StatelessWidget/ListTile.dart b/lib/views/widgets/StatelessWidget/ListTile.dart deleted file mode 100644 index 68eabcf..0000000 --- a/lib/views/widgets/StatelessWidget/ListTile.dart +++ /dev/null @@ -1,74 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_unit/views/dialogs/dialog_about.dart'; - - -class CustomListTile extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Container( - margin: EdgeInsets.all(10), - color: Colors.grey.withAlpha(22), - child: ListTile( - leading: Image.asset("assets/images/icon_head.png"), - title: Text("以梦为马"), - subtitle: Text("海子"), - contentPadding: EdgeInsets.all(5), - trailing: Icon(Icons.more_vert), - onLongPress: () => DialogAbout.show(context), - ), - ); - } -} - -class SelectListTile extends StatefulWidget { - @override - _SelectListTileState createState() => _SelectListTileState(); -} - -class _SelectListTileState extends State { - bool _selected = false; - - @override - Widget build(BuildContext context) { - return Container( - margin: EdgeInsets.all(10), - color: Colors.grey.withAlpha(22), - child: ListTile( - leading: Image.asset("assets/images/icon_head.png"), - selected: _selected, - title: Text("以梦为马"), - subtitle: Text("海子"), - contentPadding: EdgeInsets.all(5), - trailing: Icon(Icons.more_vert), - onTap: () => setState(() => _selected = !_selected), - ), - ); - } -} - -class DenseListTile extends StatefulWidget { - @override - _DenseListTileState createState() => _DenseListTileState(); -} - -class _DenseListTileState extends State { - bool _dense = false; - - @override - Widget build(BuildContext context) { - return Container( - margin: EdgeInsets.all(10), - color: Colors.grey.withAlpha(22), - child: ListTile( - leading: Image.asset("assets/images/icon_head.png"), - title: Text("以梦为马"), - subtitle: Text("海子"), - selected: false, - contentPadding: EdgeInsets.all(5), - trailing: Icon(Icons.more_vert), - dense: _dense, - onTap: () => setState(() => _dense = !_dense), - ), - ); - } -} diff --git a/lib/views/widgets/StatelessWidget/ListTile/node1_base.dart b/lib/views/widgets/StatelessWidget/ListTile/node1_base.dart new file mode 100644 index 0000000..3d31f34 --- /dev/null +++ b/lib/views/widgets/StatelessWidget/ListTile/node1_base.dart @@ -0,0 +1,35 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_unit/views/dialogs/dialog_about.dart'; + +/// create by 张风捷特烈 on 2020-03-25 +/// contact me by email 1981462002@qq.com +/// 说明: + +// { +// "widgetId": 16, +// "priority": 1, +// "name": "ListTile的基本表现如下", +// "subtitle": "【leading】: 左侧组件 【Widget】\n" +// "【title】: 中间上组件 【Widget】\n" +// "【subtitle】: 中间下组件 【Widget】\n" +// "【trailing】: 尾组件 【Widget】\n" +// "【contentPadding】: 内边距 【EdgeInsetsGeometry】\n" +// "【onLongPress】: 点击事件 【Function()】", +// } +class CustomListTile extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Container( + margin: EdgeInsets.all(10), + color: Colors.grey.withAlpha(22), + child: ListTile( + leading: Image.asset("assets/images/icon_head.png"), + title: Text("以梦为马"), + subtitle: Text("海子"), + contentPadding: EdgeInsets.all(5), + trailing: Icon(Icons.more_vert), + onLongPress: () => DialogAbout.show(context), + ), + ); + } +} \ No newline at end of file diff --git a/lib/views/widgets/StatelessWidget/ListTile/node2_select.dart b/lib/views/widgets/StatelessWidget/ListTile/node2_select.dart new file mode 100644 index 0000000..127a10a --- /dev/null +++ b/lib/views/widgets/StatelessWidget/ListTile/node2_select.dart @@ -0,0 +1,38 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020-03-25 +/// contact me by email 1981462002@qq.com +/// 说明: + +// { +// "widgetId": 16, +// "priority": 2, +// "name": "ListTile选中效果和长按事件", +// "subtitle": "【selected】: 是否选中 【bool】\n" +// "【onTap】: 点击事件 【Function()】", +// } +class SelectListTile extends StatefulWidget { + @override + _SelectListTileState createState() => _SelectListTileState(); +} + +class _SelectListTileState extends State { + bool _selected = false; + + @override + Widget build(BuildContext context) { + return Container( + margin: EdgeInsets.all(10), + color: Colors.grey.withAlpha(22), + child: ListTile( + leading: Image.asset("assets/images/icon_head.png"), + selected: _selected, + title: Text("以梦为马"), + subtitle: Text("海子"), + contentPadding: EdgeInsets.all(5), + trailing: Icon(Icons.more_vert), + onTap: () => setState(() => _selected = !_selected), + ), + ); + } +} \ No newline at end of file diff --git a/lib/views/widgets/StatelessWidget/ListTile/node3_dense.dart b/lib/views/widgets/StatelessWidget/ListTile/node3_dense.dart new file mode 100644 index 0000000..baf7e38 --- /dev/null +++ b/lib/views/widgets/StatelessWidget/ListTile/node3_dense.dart @@ -0,0 +1,38 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020-03-25 +/// contact me by email 1981462002@qq.com +/// 说明: + +// { +// "widgetId": 16, +// "priority": 3, +// "name": "ListTile的密排属性", +// "subtitle": "【dense】: 是否密排 【bool】", +// } +class DenseListTile extends StatefulWidget { + @override + _DenseListTileState createState() => _DenseListTileState(); +} + +class _DenseListTileState extends State { + bool _dense = false; + + @override + Widget build(BuildContext context) { + return Container( + margin: EdgeInsets.all(10), + color: Colors.grey.withAlpha(22), + child: ListTile( + leading: Image.asset("assets/images/icon_head.png"), + title: Text("以梦为马"), + subtitle: Text("海子"), + selected: false, + contentPadding: EdgeInsets.all(5), + trailing: Icon(Icons.more_vert), + dense: _dense, + onTap: () => setState(() => _dense = !_dense), + ), + ); + } +} diff --git a/lib/views/widgets/StatelessWidget/ListView.dart b/lib/views/widgets/StatelessWidget/ListView.dart deleted file mode 100644 index c2f4c38..0000000 --- a/lib/views/widgets/StatelessWidget/ListView.dart +++ /dev/null @@ -1,216 +0,0 @@ -import 'package:flutter/material.dart'; - -/// create by 张风捷特烈 on 2020-03-27 -/// contact me by email 1981462002@qq.com -/// 说明: -// { -// "widgetId": 162, -// "name": 'ListView基本使用', -// "priority": 1, -// "subtitle": -// "【children】 : 子组件列表 【List】\n" -// "【padding】 : 点击事件 【EdgeInsetsGeometry】", -// } -class CustomListView extends StatelessWidget { - final data = [ - Colors.purple[50], - Colors.purple[100], - Colors.purple[200], - Colors.purple[300], - Colors.purple[400], - Colors.purple[500], - Colors.purple[600], - Colors.purple[700], - Colors.purple[800], - Colors.purple[900], - ]; - - @override - Widget build(BuildContext context) { - return Container( - height: 200, - child: ListView( - padding: EdgeInsets.symmetric(horizontal: 5), - children: data - .map((color) => Container( - alignment: Alignment.center, - width: 100, - height: 50, - color: color, - child: Text( - colorString(color), - style: TextStyle(color: Colors.white, 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": 162, -// "name": 'ListView横向滑动', -// "priority": 2, -// "subtitle": -// "【scrollDirection】 : 滑动方向 【Axis】\n" -// "【reverse】 : 是否反向滑动 【bool】\n" -// "【shrinkWrap】 : 无边界时是否包裹 【bool】", -// } -class HorizontalListView extends StatelessWidget { - final data = [ - Colors.purple[50], - Colors.purple[100], - Colors.purple[200], - Colors.purple[300], - Colors.purple[400], - Colors.purple[500], - Colors.purple[600], - Colors.purple[700], - Colors.purple[800], - Colors.purple[900], - ]; - - @override - Widget build(BuildContext context) { - return Container( - height: 200, - child: ListView( - reverse: true, - shrinkWrap: true, - scrollDirection: Axis.horizontal, - children: data - .map((color) => Container( - alignment: Alignment.center, - width: 100, - height: 50, - color: color, - child: Text( - colorString(color), - style: TextStyle(color: Colors.white, 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": 162, -// "name": 'ListView.builder构造', -// "priority": 3, -// "subtitle": -// "【itemCount】 : 条目个数 【int】\n" -// "【itemBuilder】 : 条目构造器 【IndexedWidgetBuilder】", -// } -class BuilderListView extends StatelessWidget { - final data = [ - Colors.purple[50], - Colors.purple[100], - Colors.purple[200], - Colors.purple[300], - Colors.purple[400], - Colors.purple[500], - Colors.purple[600], - Colors.purple[700], - Colors.purple[800], - Colors.purple[900], - ]; - - @override - Widget build(BuildContext context) { - return Container( - height: 200, - child: ListView.builder( - itemCount: data.length, - itemBuilder: (context, index) => _buildItem(data[index]), - ), - ); - } - - String colorString(Color color) => - "#${color.value.toRadixString(16).padLeft(8, '0').toUpperCase()}"; - - Widget _buildItem(Color color) => Container( - alignment: Alignment.center, - width: 100, - height: 50, - color: color, - child: Text( - colorString(color), - style: TextStyle(color: Colors.white, shadows: [ - Shadow(color: Colors.black, offset: Offset(.5, .5), blurRadius: 2) - ]), - ), - ); -} -// { -// "widgetId": 162, -// "name": 'ListView.separated构造', -// "priority": 3, -// "subtitle": -// "【separatorBuilder】 : 条目构造器 【IndexedWidgetBuilder】", -// } -class SeparatedListView extends StatelessWidget { - final data = [ - Colors.purple[50], - Colors.purple[100], - Colors.purple[200], - Colors.purple[300], - Colors.purple[400], - Colors.purple[500], - Colors.purple[600], - Colors.purple[700], - Colors.purple[800], - Colors.purple[900], - ]; - - @override - Widget build(BuildContext context) { - return Container( - height: 200, - child: ListView.separated( - separatorBuilder: (context, index) => Divider( - thickness: 1, - height: 1, - color: Colors.orange, - ), - itemCount: data.length, - itemBuilder: (context, index) => _buildItem(data[index]), - ), - ); - } - - String colorString(Color color) => - "#${color.value.toRadixString(16).padLeft(8, '0').toUpperCase()}"; - - Widget _buildItem(Color color) => Container( - alignment: Alignment.center, - width: 100, - height: 50, - color: color, - child: Text( - colorString(color), - style: TextStyle(color: Colors.white, shadows: [ - Shadow(color: Colors.black, offset: Offset(.5, .5), blurRadius: 2) - ]), - ), - ); -} diff --git a/lib/views/widgets/StatelessWidget/ListView/node1_base.dart b/lib/views/widgets/StatelessWidget/ListView/node1_base.dart new file mode 100644 index 0000000..457db7a --- /dev/null +++ b/lib/views/widgets/StatelessWidget/ListView/node1_base.dart @@ -0,0 +1,57 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020-03-27 +/// contact me by email 1981462002@qq.com +/// 说明: +// { +// "widgetId": 162, +// "name": 'ListView基本使用', +// "priority": 1, +// "subtitle": +// "【children】 : 子组件列表 【List】\n" +// "【padding】 : 点击事件 【EdgeInsetsGeometry】", +// } +class CustomListView extends StatelessWidget { + final data = [ + Colors.purple[50], + Colors.purple[100], + Colors.purple[200], + Colors.purple[300], + Colors.purple[400], + Colors.purple[500], + Colors.purple[600], + Colors.purple[700], + Colors.purple[800], + Colors.purple[900], + ]; + + @override + Widget build(BuildContext context) { + return Container( + height: 200, + child: ListView( + padding: EdgeInsets.symmetric(horizontal: 5), + children: data + .map((color) => Container( + alignment: Alignment.center, + width: 100, + height: 50, + color: color, + child: Text( + colorString(color), + style: TextStyle(color: Colors.white, 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/StatelessWidget/ListView/node2_direction.dart b/lib/views/widgets/StatelessWidget/ListView/node2_direction.dart new file mode 100644 index 0000000..7a5803a --- /dev/null +++ b/lib/views/widgets/StatelessWidget/ListView/node2_direction.dart @@ -0,0 +1,61 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020/4/27 +/// contact me by email 1981462002@qq.com +/// 说明: + +// { +// "widgetId": 162, +// "name": 'ListView横向滑动', +// "priority": 2, +// "subtitle": +// "【scrollDirection】 : 滑动方向 【Axis】\n" +// "【reverse】 : 是否反向滑动 【bool】\n" +// "【shrinkWrap】 : 无边界时是否包裹 【bool】", +// } +class HorizontalListView extends StatelessWidget { + final data = [ + Colors.purple[50], + Colors.purple[100], + Colors.purple[200], + Colors.purple[300], + Colors.purple[400], + Colors.purple[500], + Colors.purple[600], + Colors.purple[700], + Colors.purple[800], + Colors.purple[900], + ]; + + @override + Widget build(BuildContext context) { + return Container( + height: 200, + child: ListView( + reverse: true, + shrinkWrap: true, + scrollDirection: Axis.horizontal, + children: data + .map((color) => Container( + alignment: Alignment.center, + width: 100, + height: 50, + color: color, + child: Text( + colorString(color), + style: TextStyle(color: Colors.white, 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/StatelessWidget/ListView/node3_builder.dart b/lib/views/widgets/StatelessWidget/ListView/node3_builder.dart new file mode 100644 index 0000000..f34be64 --- /dev/null +++ b/lib/views/widgets/StatelessWidget/ListView/node3_builder.dart @@ -0,0 +1,55 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020/4/27 +/// contact me by email 1981462002@qq.com +/// 说明: + +// { +// "widgetId": 162, +// "name": 'ListView.builder构造', +// "priority": 3, +// "subtitle": +// "【itemCount】 : 条目个数 【int】\n" +// "【itemBuilder】 : 条目构造器 【IndexedWidgetBuilder】", +// } +class BuilderListView extends StatelessWidget { + final data = [ + Colors.purple[50], + Colors.purple[100], + Colors.purple[200], + Colors.purple[300], + Colors.purple[400], + Colors.purple[500], + Colors.purple[600], + Colors.purple[700], + Colors.purple[800], + Colors.purple[900], + ]; + + @override + Widget build(BuildContext context) { + return Container( + height: 200, + child: ListView.builder( + itemCount: data.length, + itemBuilder: (context, index) => _buildItem(data[index]), + ), + ); + } + + String colorString(Color color) => + "#${color.value.toRadixString(16).padLeft(8, '0').toUpperCase()}"; + + Widget _buildItem(Color color) => Container( + alignment: Alignment.center, + width: 100, + height: 50, + color: color, + child: Text( + colorString(color), + style: TextStyle(color: Colors.white, shadows: [ + Shadow(color: Colors.black, offset: Offset(.5, .5), blurRadius: 2) + ]), + ), + ); +} \ No newline at end of file diff --git a/lib/views/widgets/StatelessWidget/ListView/node4_separated.dart b/lib/views/widgets/StatelessWidget/ListView/node4_separated.dart new file mode 100644 index 0000000..52cd7e5 --- /dev/null +++ b/lib/views/widgets/StatelessWidget/ListView/node4_separated.dart @@ -0,0 +1,59 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020/4/27 +/// contact me by email 1981462002@qq.com +/// 说明: + +// { +// "widgetId": 162, +// "name": 'ListView.separated构造', +// "priority": 3, +// "subtitle": +// "【separatorBuilder】 : 条目构造器 【IndexedWidgetBuilder】", +// } +class SeparatedListView extends StatelessWidget { + final data = [ + Colors.purple[50], + Colors.purple[100], + Colors.purple[200], + Colors.purple[300], + Colors.purple[400], + Colors.purple[500], + Colors.purple[600], + Colors.purple[700], + Colors.purple[800], + Colors.purple[900], + ]; + + @override + Widget build(BuildContext context) { + return Container( + height: 200, + child: ListView.separated( + separatorBuilder: (context, index) => Divider( + thickness: 1, + height: 1, + color: Colors.orange, + ), + itemCount: data.length, + itemBuilder: (context, index) => _buildItem(data[index]), + ), + ); + } + + String colorString(Color color) => + "#${color.value.toRadixString(16).padLeft(8, '0').toUpperCase()}"; + + Widget _buildItem(Color color) => Container( + alignment: Alignment.center, + width: 100, + height: 50, + color: color, + child: Text( + colorString(color), + style: TextStyle(color: Colors.white, shadows: [ + Shadow(color: Colors.black, offset: Offset(.5, .5), blurRadius: 2) + ]), + ), + ); +} diff --git a/lib/views/widgets/StatelessWidget/Listener.dart b/lib/views/widgets/StatelessWidget/Listener/node1_base.dart similarity index 100% rename from lib/views/widgets/StatelessWidget/Listener.dart rename to lib/views/widgets/StatelessWidget/Listener/node1_base.dart diff --git a/lib/views/widgets/StatelessWidget/MaterialButton/node1_base.dart b/lib/views/widgets/StatelessWidget/MaterialButton/node1_base.dart new file mode 100644 index 0000000..d73a363 --- /dev/null +++ b/lib/views/widgets/StatelessWidget/MaterialButton/node1_base.dart @@ -0,0 +1,36 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_unit/views/dialogs/dialog_about.dart'; + +/// create by 张风捷特烈 on 2020-03-25 +/// contact me by email 1981462002@qq.com +/// 说明: + +// { +// "widgetId": 23, +// "priority": 1, +// "name": "MaterialButton点击事件", +// "subtitle": "【color】: 颜色 【Color】\n" +// "【splashColor】: 水波纹颜色 【Color】\n" +// "【height】: 高 【double】\n" +// "【elevation】: 影深 【double】\n" +// "【child】: 子组件 【Widget】\n" +// "【textColor】: 子组件文字颜色 【Color】\n" +// "【highlightColor】: 长按高亮色 【Color】\n" +// "【padding】: 内边距 【EdgeInsetsGeometry】\n" +// "【onPressed】: 点击事件 【Function】", +// } + +class CustomMaterialButton extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialButton( + height: 40, + elevation: 5, + color: Colors.orangeAccent, + textColor: Colors.white, + splashColor: Colors.blue, + padding: EdgeInsets.all(8), + child: Text("MaterialButton"), + onPressed: () => DialogAbout.show(context)); + } +} \ No newline at end of file diff --git a/lib/views/widgets/StatelessWidget/MaterialButton/node2_onLongPress.dart b/lib/views/widgets/StatelessWidget/MaterialButton/node2_onLongPress.dart new file mode 100644 index 0000000..8ec33ad --- /dev/null +++ b/lib/views/widgets/StatelessWidget/MaterialButton/node2_onLongPress.dart @@ -0,0 +1,30 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_unit/views/dialogs/dialog_about.dart'; + +/// create by 张风捷特烈 on 2020-03-25 +/// contact me by email 1981462002@qq.com +/// 说明: + +// { +// "widgetId": 23, +// "priority": 2, +// "name": "MaterialButton长按事件", +// "subtitle": "【highlightColor】: 长按高亮色 【Color】\n" +// "【onLongPress】: 长按事件 【Function】", +// } + +class LongPressMaterialButton extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialButton( + height: 40, + elevation: 5, + color: Colors.blue, + highlightColor: Colors.green, + textColor: Colors.white, + padding: EdgeInsets.all(8), + child: Text("MaterialButton"), + onLongPress: () => DialogAbout.show(context), + onPressed: () => DialogAbout.show(context)); + } +} \ No newline at end of file diff --git a/lib/views/widgets/StatelessWidget/MaterialButton.dart b/lib/views/widgets/StatelessWidget/MaterialButton/node3_shape.dart similarity index 62% rename from lib/views/widgets/StatelessWidget/MaterialButton.dart rename to lib/views/widgets/StatelessWidget/MaterialButton/node3_shape.dart index 4091894..97a7335 100644 --- a/lib/views/widgets/StatelessWidget/MaterialButton.dart +++ b/lib/views/widgets/StatelessWidget/MaterialButton/node3_shape.dart @@ -1,38 +1,16 @@ import 'package:flutter/material.dart'; -import 'package:flutter_unit/app/utils/pather.dart'; -import 'package:flutter_unit/components/permanent/panel.dart'; import 'package:flutter_unit/views/dialogs/dialog_about.dart'; -class CustomMaterialButton extends StatelessWidget { - @override - Widget build(BuildContext context) { - return MaterialButton( - height: 40, - elevation: 5, - color: Colors.orangeAccent, - textColor: Colors.white, - splashColor: Colors.blue, - padding: EdgeInsets.all(8), - child: Text("MaterialButton"), - onPressed: () => DialogAbout.show(context)); - } -} +/// create by 张风捷特烈 on 2020-03-25 +/// contact me by email 1981462002@qq.com +/// 说明: -class LongPressMaterialButton extends StatelessWidget { - @override - Widget build(BuildContext context) { - return MaterialButton( - height: 40, - elevation: 5, - color: Colors.blue, - highlightColor: Colors.green, - textColor: Colors.white, - padding: EdgeInsets.all(8), - child: Text("MaterialButton"), - onLongPress: () => DialogAbout.show(context), - onPressed: () => DialogAbout.show(context)); - } -} +// { +// "widgetId": 23, +// "priority": 3, +// "name": "MaterialButton的自定义形状", +// "subtitle": "【shape】: 形状 【ShapeBorder】", +// } class ShapeMaterialButton extends StatelessWidget { @override @@ -82,4 +60,4 @@ class ShapeMaterialButton extends StatelessWidget { ], ); } -} +} \ No newline at end of file diff --git a/lib/views/widgets/StatelessWidget/OutLineButton.dart b/lib/views/widgets/StatelessWidget/OutLineButton.dart deleted file mode 100755 index 16d5d1f..0000000 --- a/lib/views/widgets/StatelessWidget/OutLineButton.dart +++ /dev/null @@ -1,18 +0,0 @@ -import 'package:flutter/material.dart'; - - -class CustomOutlineButton extends StatelessWidget { - @override - Widget build(BuildContext context) { - return OutlineButton(//边线按钮 - onPressed: () {}, - child: Text("OutlineButton"), - padding: EdgeInsets.all(8), - splashColor: Colors.green, - highlightColor: Colors.orangeAccent, - highlightedBorderColor: Colors.grey, - textColor: Color(0xff000000), - borderSide: BorderSide(color: Color(0xff0A66F8), width: 2), - ); - } -} diff --git a/lib/views/widgets/StatelessWidget/OutlineButton/node1_base.dart b/lib/views/widgets/StatelessWidget/OutlineButton/node1_base.dart new file mode 100755 index 0000000..3f9c9f9 --- /dev/null +++ b/lib/views/widgets/StatelessWidget/OutlineButton/node1_base.dart @@ -0,0 +1,34 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020-03-25 +/// contact me by email 1981462002@qq.com +/// 说明: +// { +// "widgetId": 27, +// "priority": 1, +// "name": "OutlineButton点击事件", +// "subtitle": "【textColor】: 子组件文字颜色 【Color】\n" +// "【splashColor】: 水波纹颜色 【Color】\n" +// "【highlightColor】: 长按高亮色 【Color】\n" +// "【highlightedBorderColor】: 高亮时框色 【Color】\n" +// "【child】: 子组件 【Widget】\n" +// "【padding】: 内边距 【EdgeInsetsGeometry】\n" +// "【borderSide】: 边线 【BorderSide】\n" +// "【onPressed】: 点击事件 【Function】", +// } + +class CustomOutlineButton extends StatelessWidget { + @override + Widget build(BuildContext context) { + return OutlineButton(//边线按钮 + onPressed: () {}, + child: Text("OutlineButton"), + padding: EdgeInsets.all(8), + splashColor: Colors.green, + highlightColor: Colors.orangeAccent, + highlightedBorderColor: Colors.grey, + textColor: Color(0xff000000), + borderSide: BorderSide(color: Color(0xff0A66F8), width: 2), + ); + } +} diff --git a/lib/views/widgets/StatelessWidget/Placeholder.dart b/lib/views/widgets/StatelessWidget/Placeholder.dart deleted file mode 100644 index d75a62f..0000000 --- a/lib/views/widgets/StatelessWidget/Placeholder.dart +++ /dev/null @@ -1,29 +0,0 @@ -import 'package:flutter/material.dart'; - - -class CustomPlaceholder extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Container( - width: 100, - height: 100*0.618, - child: Placeholder( - color: Colors.orangeAccent, - strokeWidth: 2, - ), - ); - } -} -class FallbackPlaceholder extends StatelessWidget { - @override - Widget build(BuildContext context) { - return UnconstrainedBox( - child: Placeholder( - color: Colors.blue, - strokeWidth: 2, - fallbackHeight: 100, - fallbackWidth: 150, - ), - ); - } -} diff --git a/lib/views/widgets/StatelessWidget/Placeholder/node1_base.dart b/lib/views/widgets/StatelessWidget/Placeholder/node1_base.dart new file mode 100644 index 0000000..aee4a58 --- /dev/null +++ b/lib/views/widgets/StatelessWidget/Placeholder/node1_base.dart @@ -0,0 +1,25 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020-03-25 +/// contact me by email 1981462002@qq.com +/// 说明: +// { +// "widgetId": 36, +// "priority": 1, +// "name": "Placeholder基础属性", +// "subtitle": "【color】: 颜色 【Color】\n" +// "【strokeWidth】: 线粗 【double】", +// } +class CustomPlaceholder extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Container( + width: 100, + height: 100*0.618, + child: Placeholder( + color: Colors.orangeAccent, + strokeWidth: 2, + ), + ); + } +} \ No newline at end of file diff --git a/lib/views/widgets/StatelessWidget/Placeholder/node2_fallback.dart b/lib/views/widgets/StatelessWidget/Placeholder/node2_fallback.dart new file mode 100644 index 0000000..bed98ef --- /dev/null +++ b/lib/views/widgets/StatelessWidget/Placeholder/node2_fallback.dart @@ -0,0 +1,26 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020-03-25 +/// contact me by email 1981462002@qq.com +/// 说明: +// { +// "widgetId": 36, +// "priority": 2, +// "name": "Placeholder的fallback属性", +// "subtitle": " 当所在区域无宽高约束时,占位组件的宽高。" +// "【fallbackHeight】: 高 【double】\n" +// "【fallbackWidth】: 宽 【double】", +// } +class FallbackPlaceholder extends StatelessWidget { + @override + Widget build(BuildContext context) { + return UnconstrainedBox( + child: Placeholder( + color: Colors.blue, + strokeWidth: 2, + fallbackHeight: 100, + fallbackWidth: 150, + ), + ); + } +} diff --git a/lib/views/widgets/StatelessWidget/PositionedDirectional.dart b/lib/views/widgets/StatelessWidget/PositionedDirectional/node1_base.dart similarity index 100% rename from lib/views/widgets/StatelessWidget/PositionedDirectional.dart rename to lib/views/widgets/StatelessWidget/PositionedDirectional/node1_base.dart diff --git a/lib/views/widgets/StatelessWidget/RadioListTile.dart b/lib/views/widgets/StatelessWidget/RadioListTile.dart deleted file mode 100644 index fbc80c3..0000000 --- a/lib/views/widgets/StatelessWidget/RadioListTile.dart +++ /dev/null @@ -1,169 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_unit/components/permanent/panel.dart'; - -enum ItemType { - java, - kotlin, - dart, -} - -class ItemBean { - final String title; - final String subTitle; - final String imgUrl; - - ItemBean(this.title, this.subTitle, this.imgUrl); -} - -class CustomRadioListTile extends StatefulWidget { - @override - _CustomRadioListTileState createState() => _CustomRadioListTileState(); -} - -class _CustomRadioListTileState extends State { - final Map languages = { - ItemType.java: - ItemBean("Java", "曾经世界上最流行的语言", "assets/images/java.jpeg"), - ItemType.kotlin: - ItemBean("Kotlin", "未来世界上最流行的语言", "assets/images/kotlin.jpg"), - ItemType.dart: - ItemBean("Dart", "世界上最优雅的语言", "assets/images/dart.jpg"), - }; - var _type = ItemType.java; - - @override - Widget build(BuildContext context) { - return Container( - color: Colors.grey.withAlpha(11), - child: Column( - mainAxisSize: MainAxisSize.min, - children: languages.keys - .map((type) => RadioListTile( - value: type, - groupValue: _type, - title: Text(languages[type].title), - subtitle: Text(languages[type].subTitle), - selected: _type == type, - secondary: CircleAvatar( - backgroundImage: AssetImage(languages[type].imgUrl), - ), - onChanged: (type) => setState(() => _type = type), - )) - .toList()), - ); - } -} - -class DenseRadioListTile extends StatefulWidget { - @override - _DenseRadioListTileState createState() => _DenseRadioListTileState(); -} - -class _DenseRadioListTileState extends State { - final Map languages = { - ItemType.java: - ItemBean("Java", "曾经世界上最流行的语言", "assets/images/java.jpeg"), - ItemType.kotlin: - ItemBean("Kotlin", "未来世界上最流行的语言", "assets/images/kotlin.jpg"), - ItemType.dart: - ItemBean("Dart", "世界上最优雅的语言", "assets/images/dart.jpg"), - }; - var _type = ItemType.java; - - @override - Widget build(BuildContext context) { - return Container( - color: Colors.grey.withAlpha(11), - child: Column( - mainAxisSize: MainAxisSize.min, - children: languages.keys - .map((type) => RadioListTile( - value: type, - groupValue: _type, - title: Text(languages[type].title), - activeColor: Colors.orangeAccent, - dense: true, - subtitle: Text(languages[type].subTitle), - selected: _type == type, - secondary: CircleAvatar( - backgroundImage: AssetImage(languages[type].imgUrl), - ), - onChanged: (type) => setState(() => _type = type), - )) - .toList()), - ); - } -} - - -//class RadioListTilePage extends StatefulWidget { -// @override -// _RadioListTilePageState createState() => _RadioListTilePageState(); -//} -// -//class _RadioListTilePageState extends State { -// -// final Map languages={ -// ItemType.java: ItemBean("Java", "曾经世界上最流行的语言", "assets/images/java.jpeg"), -// ItemType.kotlin: ItemBean("Kotlin", "未来世界上最流行的语言", "assets/images/kotlin.jpg"), -// ItemType.dart: ItemBean("Dart", "世界上最优雅的语言", "assets/images/dart.jpg"), -// }; -// var _type=ItemType.java; -// @override -// Widget build(BuildContext context) { -// -// return Container( -// color: Colors.grey.withAlpha(11), -// child: Column( -// mainAxisSize: MainAxisSize.min, -// children: languages.keys.map((type)=>RadioListTile( -// value: type, -// groupValue: _type, -// title: Text(languages[type].title), -// subtitle: Text(languages[type].subTitle), -// selected: _type==type, -// secondary: CircleAvatar( -// backgroundImage: AssetImage(languages[type].imgUrl),), -// onChanged: (type)=> setState(() => _type=type), -// )).toList() -// ), -// ); -// } -//} -// -//enum ItemType{ -// java, -// kotlin, -// dart, -//} -//class ItemBean{ -// final String title; -// final String subTitle; -// final String imgUrl; -// ItemBean(this.title, this.subTitle, this.imgUrl); -//} - -//class LanguageChooser extends StatelessWidget{ -// -// @override -// Widget build(BuildContext context) { -// -// var map ={ -// LocaleState.zh().locale:"java", -// LocaleState.en().locale:I18N.of(context).english, -// LocaleState.fr().locale:I18N.of(context).french, -// }; -// -// return StoreBuilder(builder: (context, store) =>ExpansionTile( -// title: Text(I18N.of(context).switchLocal), -// leading: Icon(Icons.language,color: store.state.themeState.primaryColor,), -// children: map.keys.map((local)=>RadioListTile( -// activeColor: store.state.themeState.primaryColor, -// value: local, -// title: Text(map[local]), -// groupValue: store.state.localeState.locale, -// onChanged: (locale)=> store.dispatch(ActionSwitchLocal(locale)) -// )).toList(), -// )); -// } -//} diff --git a/lib/views/widgets/StatelessWidget/RadioListTile/node1_base.dart b/lib/views/widgets/StatelessWidget/RadioListTile/node1_base.dart new file mode 100644 index 0000000..80978d0 --- /dev/null +++ b/lib/views/widgets/StatelessWidget/RadioListTile/node1_base.dart @@ -0,0 +1,71 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020-03-22 +/// contact me by email 1981462002@qq.com +/// 说明: + +// { +// "widgetId": 19, +// "priority": 1, +// "name": "RadioListTile需要一个泛型T", +// "subtitle": "【value】 : 条目对象 【T】\n" +// "【groupValue】 : 选中对象 【T】\n" +// "【selected】: 是否选中 【bool】\n" +// "【secondary】: 右侧组件 【Widget】\n" +// "【title】: 中间上组件 【Widget】\n" +// "【subtitle】: 中间下组件 【Widget】\n" +// "【onChanged】: 切换事件 【Function(T)】", +// } + +enum ItemType { + java, + kotlin, + dart, +} + +class ItemBean { + final String title; + final String subTitle; + final String imgUrl; + + ItemBean(this.title, this.subTitle, this.imgUrl); +} + +class CustomRadioListTile extends StatefulWidget { + @override + _CustomRadioListTileState createState() => _CustomRadioListTileState(); +} + +class _CustomRadioListTileState extends State { + final Map languages = { + ItemType.java: + ItemBean("Java", "曾经世界上最流行的语言", "assets/images/java.jpeg"), + ItemType.kotlin: + ItemBean("Kotlin", "未来世界上最流行的语言", "assets/images/kotlin.jpg"), + ItemType.dart: + ItemBean("Dart", "世界上最优雅的语言", "assets/images/dart.jpg"), + }; + var _type = ItemType.java; + + @override + Widget build(BuildContext context) { + return Container( + color: Colors.grey.withAlpha(11), + child: Column( + mainAxisSize: MainAxisSize.min, + children: languages.keys + .map((type) => RadioListTile( + value: type, + groupValue: _type, + title: Text(languages[type].title), + subtitle: Text(languages[type].subTitle), + selected: _type == type, + secondary: CircleAvatar( + backgroundImage: AssetImage(languages[type].imgUrl), + ), + onChanged: (type) => setState(() => _type = type), + )) + .toList()), + ); + } +} diff --git a/lib/views/widgets/StatelessWidget/RadioListTile/node2_dense.dart b/lib/views/widgets/StatelessWidget/RadioListTile/node2_dense.dart new file mode 100644 index 0000000..5611535 --- /dev/null +++ b/lib/views/widgets/StatelessWidget/RadioListTile/node2_dense.dart @@ -0,0 +1,68 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020-03-22 +/// contact me by email 1981462002@qq.com +/// 说明: + +// { +// "widgetId": 19, +// "priority": 2, +// "name": "RadioListTile选中色和密排", +// "subtitle": "【activeColor】 : 选中时颜色 【Color】\n" +// "【dense】: 是否密排 【bool】", +// } + +enum ItemType { + java, + kotlin, + dart, +} + +class ItemBean { + final String title; + final String subTitle; + final String imgUrl; + + ItemBean(this.title, this.subTitle, this.imgUrl); +} + +class DenseRadioListTile extends StatefulWidget { + @override + _DenseRadioListTileState createState() => _DenseRadioListTileState(); +} + +class _DenseRadioListTileState extends State { + final Map languages = { + ItemType.java: + ItemBean("Java", "曾经世界上最流行的语言", "assets/images/java.jpeg"), + ItemType.kotlin: + ItemBean("Kotlin", "未来世界上最流行的语言", "assets/images/kotlin.jpg"), + ItemType.dart: + ItemBean("Dart", "世界上最优雅的语言", "assets/images/dart.jpg"), + }; + var _type = ItemType.java; + + @override + Widget build(BuildContext context) { + return Container( + color: Colors.grey.withAlpha(11), + child: Column( + mainAxisSize: MainAxisSize.min, + children: languages.keys + .map((type) => RadioListTile( + value: type, + groupValue: _type, + title: Text(languages[type].title), + activeColor: Colors.orangeAccent, + dense: true, + subtitle: Text(languages[type].subTitle), + selected: _type == type, + secondary: CircleAvatar( + backgroundImage: AssetImage(languages[type].imgUrl), + ), + onChanged: (type) => setState(() => _type = type), + )) + .toList()), + ); + } +} \ No newline at end of file diff --git a/lib/views/widgets/StatelessWidget/RaisedButton.dart b/lib/views/widgets/StatelessWidget/RaisedButton.dart deleted file mode 100755 index 2b1bba0..0000000 --- a/lib/views/widgets/StatelessWidget/RaisedButton.dart +++ /dev/null @@ -1,17 +0,0 @@ -import 'package:flutter/material.dart'; - -class CustomRaisedButton extends StatelessWidget { - @override - Widget build(BuildContext context) { - return RaisedButton( - color: Colors.blue, - splashColor: Colors.green, - onPressed: () {}, - child: Text("RaisedButton"), - textColor: Color(0xffFfffff), - padding: EdgeInsets.all(8), - elevation: 5, - highlightColor: Color(0xffF88B0A), - ); - } -} diff --git a/lib/views/widgets/StatelessWidget/RaisedButton/node1_base.dart b/lib/views/widgets/StatelessWidget/RaisedButton/node1_base.dart new file mode 100755 index 0000000..ffa0444 --- /dev/null +++ b/lib/views/widgets/StatelessWidget/RaisedButton/node1_base.dart @@ -0,0 +1,34 @@ +import 'package:flutter/material.dart'; +/// create by 张风捷特烈 on 2020-03-22 +/// contact me by email 1981462002@qq.com +/// 说明: + +// { +// "widgetId": 26, +// "priority": 1, +// "name": "RaisedButton点击事件", +// "subtitle": "【color】: 颜色 【Color】\n" +// "【splashColor】: 水波纹颜色 【Color】\n" +// "【elevation】: 影深 【double】\n" +// "【child】: 子组件 【Widget】\n" +// "【textColor】: 子组件文字颜色 【Color】\n" +// "【highlightColor】: 长按高亮色 【Color】\n" +// "【padding】: 内边距 【EdgeInsetsGeometry】\n" +// "【onPressed】: 点击事件 【Function】", +// } + +class CustomRaisedButton extends StatelessWidget { + @override + Widget build(BuildContext context) { + return RaisedButton( + color: Colors.blue, + splashColor: Colors.green, + onPressed: () {}, + child: Text("RaisedButton"), + textColor: Color(0xffFfffff), + padding: EdgeInsets.all(8), + elevation: 5, + highlightColor: Color(0xffF88B0A), + ); + } +} diff --git a/lib/views/widgets/StatelessWidget/SimpleDialog.dart b/lib/views/widgets/StatelessWidget/SimpleDialog/node1_base.dart similarity index 100% rename from lib/views/widgets/StatelessWidget/SimpleDialog.dart rename to lib/views/widgets/StatelessWidget/SimpleDialog/node1_base.dart diff --git a/lib/views/widgets/StatelessWidget/SimpleDialogOption.dart b/lib/views/widgets/StatelessWidget/SimpleDialogOption/node1_base.dart similarity index 100% rename from lib/views/widgets/StatelessWidget/SimpleDialogOption.dart rename to lib/views/widgets/StatelessWidget/SimpleDialogOption/node1_base.dart diff --git a/lib/views/widgets/StatelessWidget/SingleChildScrollView/node1_base.dart b/lib/views/widgets/StatelessWidget/SingleChildScrollView/node1_base.dart new file mode 100644 index 0000000..501935f --- /dev/null +++ b/lib/views/widgets/StatelessWidget/SingleChildScrollView/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": 164, +// "name": 'SingleChildScrollView基本使用', +// "priority": 1, +// "subtitle": +// "【child】 : 子组件 【Widget】\n" +// "【padding】 : 点击事件 【EdgeInsetsGeometry】", +// } +class CustomSingleChildScrollView extends StatelessWidget { + final data = [ + Colors.blue[50], + Colors.blue[100], + Colors.blue[200], + Colors.blue[300], + Colors.blue[400], + Colors.blue[500], + Colors.blue[600], + Colors.blue[700], + Colors.blue[800], + Colors.blue[900], + ]; + + @override + Widget build(BuildContext context) { + return Container( + height: 200, + child: SingleChildScrollView( + padding: EdgeInsets.symmetric(horizontal: 10), + child: Column( + children: data + .map((color) => Container( + alignment: Alignment.center, + height: 50, + color: color, + child: Text( + colorString(color), + style: TextStyle(color: Colors.white, 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/StatelessWidget/SingleChildScrollView.dart b/lib/views/widgets/StatelessWidget/SingleChildScrollView/node2_direction.dart similarity index 51% rename from lib/views/widgets/StatelessWidget/SingleChildScrollView.dart rename to lib/views/widgets/StatelessWidget/SingleChildScrollView/node2_direction.dart index 8c00d6b..77d9a0d 100644 --- a/lib/views/widgets/StatelessWidget/SingleChildScrollView.dart +++ b/lib/views/widgets/StatelessWidget/SingleChildScrollView/node2_direction.dart @@ -1,63 +1,9 @@ import 'package:flutter/material.dart'; -/// create by 张风捷特烈 on 2020-03-28 +/// create by 张风捷特烈 on 2020/4/27 /// contact me by email 1981462002@qq.com /// 说明: -// { -// "widgetId": 164, -// "name": 'SingleChildScrollView基本使用', -// "priority": 1, -// "subtitle": -// "【child】 : 子组件 【Widget】\n" -// "【padding】 : 点击事件 【EdgeInsetsGeometry】", -// } -class CustomSingleChildScrollView extends StatelessWidget { - final data = [ - Colors.blue[50], - Colors.blue[100], - Colors.blue[200], - Colors.blue[300], - Colors.blue[400], - Colors.blue[500], - Colors.blue[600], - Colors.blue[700], - Colors.blue[800], - Colors.blue[900], - ]; - - @override - Widget build(BuildContext context) { - return Container( - height: 200, - child: SingleChildScrollView( - padding: EdgeInsets.symmetric(horizontal: 10), - child: Column( - children: data - .map((color) => Container( - alignment: Alignment.center, - height: 50, - color: color, - child: Text( - colorString(color), - style: TextStyle(color: Colors.white, 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": 164, // "name": 'SingleChildScrollView滑动方向', @@ -112,4 +58,4 @@ class DirectionSingleChildScrollView extends StatelessWidget { } String colorString(Color color) => "#${color.value.toRadixString(16).padLeft(8, '0').toUpperCase()}"; -} +} \ No newline at end of file diff --git a/lib/views/widgets/StatelessWidget/SnackBar.dart b/lib/views/widgets/StatelessWidget/SnackBar/node1_base.dart similarity index 100% rename from lib/views/widgets/StatelessWidget/SnackBar.dart rename to lib/views/widgets/StatelessWidget/SnackBar/node1_base.dart diff --git a/lib/views/widgets/StatelessWidget/SnackBarAction.dart b/lib/views/widgets/StatelessWidget/SnackBarAction/node1_base.dart similarity index 100% rename from lib/views/widgets/StatelessWidget/SnackBarAction.dart rename to lib/views/widgets/StatelessWidget/SnackBarAction/node1_base.dart diff --git a/lib/views/widgets/StatelessWidget/Spacer.dart b/lib/views/widgets/StatelessWidget/Spacer.dart deleted file mode 100644 index fdc827c..0000000 --- a/lib/views/widgets/StatelessWidget/Spacer.dart +++ /dev/null @@ -1,107 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_unit/app/utils/color_utils.dart'; - -/// create by 张风捷特烈 on 2020-03-22 -/// contact me by email 1981462002@qq.com -/// 说明: - -// { -// "widgetId": 107, -// "name": 'Spacer基本使用', -// "priority": 1, -// "subtitle": -// "一个Spacer会占据可延伸区域", -// } -class OneSpacer extends StatelessWidget { - - @override - Widget build(BuildContext context) { - return - Container( - color: Colors.grey.withAlpha(33), - child: Row(children: [ - Container( - alignment: Alignment.center, - width: 100, - height: 50, - color: Colors.red, - ), - Spacer(), - Container( - alignment: Alignment.center, - width: 60, - height: 50, - color: Colors.blue, - ), - ],), - ); - } -} - -// { -// "widgetId": 107, -// "name": '多个Spacer空间分配', -// "priority": 2, -// "subtitle": -// "【flex】 : 剩余空间分配占比 【int】", -// } -class ManySpacer extends StatefulWidget { - @override - _ManySpacerState createState() => _ManySpacerState(); -} - -class _ManySpacerState extends State { - int _flexA=1; - int _flexB=1; - - @override - Widget build(BuildContext context) { - return Column( - children: [ - _buildSliders(), - Container( - color: Colors.grey.withAlpha(33), - child: Row(children: [ - Spacer(flex: _flexA), - Container( - alignment: Alignment.center, - width: 100, - height: 50, - color: Colors.red, - ), - Spacer(flex: _flexB), - Container( - alignment: Alignment.center, - width: 60, - height: 50, - color: Colors.blue, - ), - ],), - ) - ], - ); - } - - Widget _buildSliders() { - return Column( - children: [ - Slider( - divisions: 20, - min: 1, - max: 10, - label: "左边flex: $_flexA", - value: _flexA.toDouble(), - onChanged: (v) => setState(() => _flexA = v.round()) - ), - Slider( - divisions: 20, - label: "右边flex: $_flexB", - min: 1, - max: 10, - value: _flexB.toDouble(), - onChanged: (v) => setState(() => _flexB = v.round()) - ), - ], - ); - } -} \ No newline at end of file diff --git a/lib/views/widgets/StatelessWidget/Spacer/node1_base.dart b/lib/views/widgets/StatelessWidget/Spacer/node1_base.dart new file mode 100644 index 0000000..1fa5e3b --- /dev/null +++ b/lib/views/widgets/StatelessWidget/Spacer/node1_base.dart @@ -0,0 +1,38 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020-03-22 +/// contact me by email 1981462002@qq.com +/// 说明: + +// { +// "widgetId": 107, +// "name": 'Spacer基本使用', +// "priority": 1, +// "subtitle": +// "一个Spacer会占据可延伸区域", +// } +class OneSpacer extends StatelessWidget { + + @override + Widget build(BuildContext context) { + return + Container( + color: Colors.grey.withAlpha(33), + child: Row(children: [ + Container( + alignment: Alignment.center, + width: 100, + height: 50, + color: Colors.red, + ), + Spacer(), + Container( + alignment: Alignment.center, + width: 60, + height: 50, + color: Colors.blue, + ), + ],), + ); + } +} \ No newline at end of file diff --git a/lib/views/widgets/StatelessWidget/Spacer/node2_flex.dart b/lib/views/widgets/StatelessWidget/Spacer/node2_flex.dart new file mode 100644 index 0000000..0f90049 --- /dev/null +++ b/lib/views/widgets/StatelessWidget/Spacer/node2_flex.dart @@ -0,0 +1,73 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020-03-22 +/// contact me by email 1981462002@qq.com +/// 说明: + +// { +// "widgetId": 107, +// "name": '多个Spacer空间分配', +// "priority": 2, +// "subtitle": +// "【flex】 : 剩余空间分配占比 【int】", +// } +class ManySpacer extends StatefulWidget { + @override + _ManySpacerState createState() => _ManySpacerState(); +} + +class _ManySpacerState extends State { + int _flexA=1; + int _flexB=1; + + @override + Widget build(BuildContext context) { + return Column( + children: [ + _buildSliders(), + Container( + color: Colors.grey.withAlpha(33), + child: Row(children: [ + Spacer(flex: _flexA), + Container( + alignment: Alignment.center, + width: 100, + height: 50, + color: Colors.red, + ), + Spacer(flex: _flexB), + Container( + alignment: Alignment.center, + width: 60, + height: 50, + color: Colors.blue, + ), + ],), + ) + ], + ); + } + + Widget _buildSliders() { + return Column( + children: [ + Slider( + divisions: 20, + min: 1, + max: 10, + label: "左边flex: $_flexA", + value: _flexA.toDouble(), + onChanged: (v) => setState(() => _flexA = v.round()) + ), + Slider( + divisions: 20, + label: "右边flex: $_flexB", + min: 1, + max: 10, + value: _flexB.toDouble(), + onChanged: (v) => setState(() => _flexB = v.round()) + ), + ], + ); + } +} \ No newline at end of file diff --git a/lib/views/widgets/StatelessWidget/SwitchListTile.dart b/lib/views/widgets/StatelessWidget/SwitchListTile.dart deleted file mode 100644 index 3baed1a..0000000 --- a/lib/views/widgets/StatelessWidget/SwitchListTile.dart +++ /dev/null @@ -1,87 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_unit/components/permanent/panel.dart'; - -class CustomSwitchListTile extends StatefulWidget { - @override - _CustomSwitchListTileState createState() => _CustomSwitchListTileState(); -} - -class _CustomSwitchListTileState extends State { - var _value=false; - - @override - Widget build(BuildContext context) { - return Container( - margin: EdgeInsets.all(10), - color: Colors.grey.withAlpha(22), - child: SwitchListTile( - value: _value, - inactiveThumbColor:Colors.cyanAccent , - inactiveTrackColor: Colors.blue.withAlpha(88), - activeColor: Colors.orangeAccent, - activeTrackColor: Colors.orange, - secondary: Image.asset("assets/images/icon_head.png"), - title: Text("张风捷特烈"), - subtitle: Text("@万花过尽知无物"), - onChanged: (v) => setState(() => _value = !_value), - ), - ); - } -} - -class SelectSwitchListTile extends StatefulWidget { - @override - _SelectSwitchListTileState createState() => _SelectSwitchListTileState(); -} - -class _SelectSwitchListTileState extends State { - var _value=false; - - @override - Widget build(BuildContext context) { - return Container( - margin: EdgeInsets.all(10), - color: Colors.grey.withAlpha(22), - child: SwitchListTile( - value: _value, - selected: _value, - activeColor: Colors.orangeAccent, - secondary: Image.asset("assets/images/icon_head.png"), - inactiveThumbImage: AssetImage("assets/images/pica.gif"), - activeThumbImage: AssetImage("assets/images/icon_head.png"), - title: Text("张风捷特烈"), - subtitle: Text("@万花过尽知无物"), - onChanged: (v) => setState(() => _value = !_value), - ), - ); - } -} - -class DenseSwitchListTile extends StatefulWidget { - @override - _DenseSwitchListTileState createState() => _DenseSwitchListTileState(); -} - -class _DenseSwitchListTileState extends State { - var _value=false; - - @override - Widget build(BuildContext context) { - return Container( - margin: EdgeInsets.all(10), - color: Colors.grey.withAlpha(22), - child: SwitchListTile( - value: _value, - dense: true, - selected: _value, - activeColor: Colors.orangeAccent, - secondary: Image.asset("assets/images/icon_head.png"), - title: Text("张风捷特烈"), - subtitle: Text("@万花过尽知无物"), - onChanged: (v) => setState(() => _value = !_value), - ), - ); - } -} - - diff --git a/lib/views/widgets/StatelessWidget/SwitchListTile/node1_base.dart b/lib/views/widgets/StatelessWidget/SwitchListTile/node1_base.dart new file mode 100644 index 0000000..d588c06 --- /dev/null +++ b/lib/views/widgets/StatelessWidget/SwitchListTile/node1_base.dart @@ -0,0 +1,45 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020-03-25 +/// contact me by email 1981462002@qq.com +/// 说明: +// { +// "widgetId": 18, +// "priority": 1, +// "name": "SwitchListTile的基本表现如下", +// "subtitle": "【secondary】: 左侧组件 【Widget】\n" +// "【title】: 中间上组件 【Widget】\n" +// "【subtitle】: 中间下组件 【Widget】\n" +// "【inactiveThumbColor】: 未选中时圆圈颜色 【Color】\n" +// "【inactiveTrackColor】: 未选中滑槽颜色 【Color】\n" +// "【activeColor】: 选中时圆圈颜色 【Color】\n" +// "【activeTrackColor】: 选中滑槽颜色 【Color】\n" +// "【onChanged】: 选中事件 【Function(bool)】", +// } +class CustomSwitchListTile extends StatefulWidget { + @override + _CustomSwitchListTileState createState() => _CustomSwitchListTileState(); +} + +class _CustomSwitchListTileState extends State { + var _value=false; + + @override + Widget build(BuildContext context) { + return Container( + margin: EdgeInsets.all(10), + color: Colors.grey.withAlpha(22), + child: SwitchListTile( + value: _value, + inactiveThumbColor:Colors.cyanAccent , + inactiveTrackColor: Colors.blue.withAlpha(88), + activeColor: Colors.orangeAccent, + activeTrackColor: Colors.orange, + secondary: Image.asset("assets/images/icon_head.png"), + title: Text("张风捷特烈"), + subtitle: Text("@万花过尽知无物"), + onChanged: (v) => setState(() => _value = !_value), + ), + ); + } +} diff --git a/lib/views/widgets/StatelessWidget/SwitchListTile/node2_select.dart b/lib/views/widgets/StatelessWidget/SwitchListTile/node2_select.dart new file mode 100644 index 0000000..3edd0c3 --- /dev/null +++ b/lib/views/widgets/StatelessWidget/SwitchListTile/node2_select.dart @@ -0,0 +1,41 @@ + +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020-03-25 +/// contact me by email 1981462002@qq.com +/// 说明: +// { +// "widgetId": 18, +// "priority": 2, +// "name": "SwitchListTile的选中效果", +// "subtitle": "【selected】: 是否选中 【bool】\n" +// "【inactiveThumbImage】: 未选中时圆圈图片 【ImageProvider】\n" +// "【activeThumbImage】: 选中时圆圈图片 【ImageProvider】", +// } +class SelectSwitchListTile extends StatefulWidget { + @override + _SelectSwitchListTileState createState() => _SelectSwitchListTileState(); +} + +class _SelectSwitchListTileState extends State { + var _value=false; + + @override + Widget build(BuildContext context) { + return Container( + margin: EdgeInsets.all(10), + color: Colors.grey.withAlpha(22), + child: SwitchListTile( + value: _value, + selected: _value, + activeColor: Colors.orangeAccent, + secondary: Image.asset("assets/images/icon_head.png"), + inactiveThumbImage: AssetImage("assets/images/pica.gif"), + activeThumbImage: AssetImage("assets/images/icon_head.png"), + title: Text("张风捷特烈"), + subtitle: Text("@万花过尽知无物"), + onChanged: (v) => setState(() => _value = !_value), + ), + ); + } +} \ No newline at end of file diff --git a/lib/views/widgets/StatelessWidget/SwitchListTile/node3_dense.dart b/lib/views/widgets/StatelessWidget/SwitchListTile/node3_dense.dart new file mode 100644 index 0000000..94010c3 --- /dev/null +++ b/lib/views/widgets/StatelessWidget/SwitchListTile/node3_dense.dart @@ -0,0 +1,38 @@ + +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020-03-25 +/// contact me by email 1981462002@qq.com +/// 说明: +// { +// "widgetId": 18, +// "priority": 3, +// "name": "SwitchListTile的密排属性", +// "subtitle": "【dense】: 是否密排 【bool】", +// } +class DenseSwitchListTile extends StatefulWidget { + @override + _DenseSwitchListTileState createState() => _DenseSwitchListTileState(); +} + +class _DenseSwitchListTileState extends State { + var _value=false; + + @override + Widget build(BuildContext context) { + return Container( + margin: EdgeInsets.all(10), + color: Colors.grey.withAlpha(22), + child: SwitchListTile( + value: _value, + dense: true, + selected: _value, + activeColor: Colors.orangeAccent, + secondary: Image.asset("assets/images/icon_head.png"), + title: Text("张风捷特烈"), + subtitle: Text("@万花过尽知无物"), + onChanged: (v) => setState(() => _value = !_value), + ), + ); + } +} \ No newline at end of file diff --git a/lib/views/widgets/StatelessWidget/Tab.dart b/lib/views/widgets/StatelessWidget/Tab/node1_base.dart similarity index 100% rename from lib/views/widgets/StatelessWidget/Tab.dart rename to lib/views/widgets/StatelessWidget/Tab/node1_base.dart diff --git a/lib/views/widgets/StatelessWidget/TabBar.dart b/lib/views/widgets/StatelessWidget/TabBar/node1_base.dart similarity index 58% rename from lib/views/widgets/StatelessWidget/TabBar.dart rename to lib/views/widgets/StatelessWidget/TabBar/node1_base.dart index 8fc3f77..f2b9cc0 100644 --- a/lib/views/widgets/StatelessWidget/TabBar.dart +++ b/lib/views/widgets/StatelessWidget/TabBar/node1_base.dart @@ -1,5 +1,4 @@ import 'package:flutter/material.dart'; -import 'package:flutter_unit/components/flutter/no_shadow_tab_bar.dart'; /// create by 张风捷特烈 on 2020-03-16 /// contact me by email 1981462002@qq.com @@ -60,53 +59,4 @@ class _CustomTabBarState extends State tabs: tabs.map((e) => Tab(text: e)).toList(), ); } -} - -// { -// "widgetId": 58, -// "name": '通过修改源码可实现无水波纹', -// "priority": 1, -// "subtitle": -// "详见:components/flutter/no_shadow_tab_bar.dart", -// } -class NoShadowTabBarDemo extends StatefulWidget { - @override - _NSTabBarState createState() => _NSTabBarState(); -} - -class _NSTabBarState extends State - with SingleTickerProviderStateMixin { - final tabs = ['风画庭', '雨韵舍', '雷鸣殿', '电疾堂', '霜寒阁', '雪月楼']; - TabController _tabController; - - @override - void initState() { - super.initState(); - _tabController = TabController(vsync: this, length: tabs.length); - } - - @override - void dispose() { - _tabController.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return NoShadowTabBar( - onTap: (tab) { - print(tab); - }, - labelStyle: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), - unselectedLabelStyle: TextStyle(fontSize: 16), - isScrollable: true, - controller: _tabController, - labelColor: Colors.blue, - indicatorWeight: 3, - indicatorPadding: EdgeInsets.symmetric(horizontal: 10), - unselectedLabelColor: Colors.grey, - indicatorColor: Colors.orangeAccent, - tabs: tabs.map((e) => Tab(text: e)).toList(), - ); - } -} +} \ No newline at end of file diff --git a/lib/views/widgets/StatelessWidget/TabBar/node2_noShadow.dart b/lib/views/widgets/StatelessWidget/TabBar/node2_noShadow.dart new file mode 100644 index 0000000..a638674 --- /dev/null +++ b/lib/views/widgets/StatelessWidget/TabBar/node2_noShadow.dart @@ -0,0 +1,55 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_unit/components/flutter/no_shadow_tab_bar.dart'; + +/// create by 张风捷特烈 on 2020/4/27 +/// contact me by email 1981462002@qq.com +/// 说明: + +// { +// "widgetId": 58, +// "name": '通过修改源码可实现无水波纹', +// "priority": 1, +// "subtitle": +// "详见:components/flutter/no_shadow_tab_bar.dart", +// } +class NoShadowTabBarDemo extends StatefulWidget { + @override + _NSTabBarState createState() => _NSTabBarState(); +} + +class _NSTabBarState extends State + with SingleTickerProviderStateMixin { + final tabs = ['风画庭', '雨韵舍', '雷鸣殿', '电疾堂', '霜寒阁', '雪月楼']; + TabController _tabController; + + @override + void initState() { + super.initState(); + _tabController = TabController(vsync: this, length: tabs.length); + } + + @override + void dispose() { + _tabController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return NoShadowTabBar( + onTap: (tab) { + print(tab); + }, + labelStyle: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), + unselectedLabelStyle: TextStyle(fontSize: 16), + isScrollable: true, + controller: _tabController, + labelColor: Colors.blue, + indicatorWeight: 3, + indicatorPadding: EdgeInsets.symmetric(horizontal: 10), + unselectedLabelColor: Colors.grey, + indicatorColor: Colors.orangeAccent, + tabs: tabs.map((e) => Tab(text: e)).toList(), + ); + } +} \ No newline at end of file diff --git a/lib/views/widgets/StatelessWidget/Text.dart b/lib/views/widgets/StatelessWidget/Text.dart deleted file mode 100644 index 9100624..0000000 --- a/lib/views/widgets/StatelessWidget/Text.dart +++ /dev/null @@ -1,127 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_unit/components/permanent/panel.dart'; - -class CustomText extends StatelessWidget { - @override - Widget build(BuildContext context) { - var style = TextStyle( - color: Colors.blue, - fontSize: 20, - fontWeight: FontWeight.bold, - fontStyle: FontStyle.italic, - letterSpacing: 10, - ); - return Container( - width: 200, - color: Colors.cyanAccent.withAlpha(33), - height: 200 * 0.618 * 0.618, - child: Text("toly-张风捷特烈-1994`", style: style), - ); - } -} - -class DecorationText extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Text( - "19940328", - style: TextStyle( - fontSize: 50, - fontWeight: FontWeight.bold, - decoration: TextDecoration.underline, - decorationThickness: 3, - decorationStyle: TextDecorationStyle.wavy, - decorationColor: Colors.blue, - fontStyle: FontStyle.italic, - fontFamily: "DancingScript", - letterSpacing: 10), - ); - } -} - -class ShadowText extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Text( - "张风捷特烈", - style: TextStyle( - fontSize: 50, - color: Colors.white, - backgroundColor: Colors.black, - shadows: [ - Shadow( - color: Colors.cyanAccent, - offset: Offset(1, 1), - blurRadius: 10), - Shadow( - color: Colors.blue, - offset: Offset(-0.1, 0.1), - blurRadius: 10), - ]), - ); - } -} - -class TextAlignText extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Wrap( - spacing: 10, - runSpacing: 10, - children: TextAlign.values - .map((e) => Container( - width: 120, - color: Colors.cyanAccent.withAlpha(33), - height: 120 * 0.618, - child: Text( - " 张风捷特烈 toly " * 3, - textAlign: e, - ), - )) - .toList(), - ); - } -} - -class TextDirectionText extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Wrap( - spacing: 40, - runSpacing: 10, - children: TextDirection.values - .map((e) => Container( - width: 120, - color: Colors.cyanAccent.withAlpha(33), - height: 120 * 0.618, - child: Text( - " 张风捷特烈 toly " * 10, - textDirection: e, - maxLines: 3, - overflow: TextOverflow.ellipsis, - ), - )) - .toList(), - ); - } -} - -class SoftWrapText extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Wrap( - spacing: 10, - runSpacing: 10, - children: TextOverflow.values - .map((e) => Container( - width: 150, - color: Colors.cyanAccent.withAlpha(33), - height: 150 * 0.618 * 0.618, - child: Text(" 张风捷特烈 toly " * 5, - overflow: e, - softWrap: false), - )) - .toList(), - ); - } -} diff --git a/lib/views/widgets/StatelessWidget/Text/node1_base.dart b/lib/views/widgets/StatelessWidget/Text/node1_base.dart new file mode 100644 index 0000000..e43363f --- /dev/null +++ b/lib/views/widgets/StatelessWidget/Text/node1_base.dart @@ -0,0 +1,37 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020-03-29 +/// contact me by email 1981462002@qq.com +/// 说明: + + +// { +// "widgetId": 2, +// "priority": 1, +// "name": "文字的基本样式", +// "subtitle": "【入参】 : 文字 【String】\n" +// "【style】: 文字样式 【TextStyle】\n" +// "【color】: 文字样式 【Color】\n" +// "【fontSize】: 文字大小 【double】\n" +// "【fontWeight】: 字重 【FontWeight】\n" +// "【fontStyle】: 字体样式 【fontStyle】\n" +// "【letterSpacing】: 字距 【double】", +// } +class CustomText extends StatelessWidget { + @override + Widget build(BuildContext context) { + var style = TextStyle( + color: Colors.blue, + fontSize: 20, + fontWeight: FontWeight.bold, + fontStyle: FontStyle.italic, + letterSpacing: 10, + ); + return Container( + width: 200, + color: Colors.cyanAccent.withAlpha(33), + height: 200 * 0.618 * 0.618, + child: Text("toly-张风捷特烈-1994`", style: style), + ); + } +} \ No newline at end of file diff --git a/lib/views/widgets/StatelessWidget/Text/node2_shadows.dart b/lib/views/widgets/StatelessWidget/Text/node2_shadows.dart new file mode 100644 index 0000000..8726b05 --- /dev/null +++ b/lib/views/widgets/StatelessWidget/Text/node2_shadows.dart @@ -0,0 +1,36 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020-03-29 +/// contact me by email 1981462002@qq.com +/// 说明: + + +// { +// "widgetId": 2, +// "priority": 2, +// "name": "文字阴影", +// "subtitle": "【shadows】 : 文字 【List】\n" +// "【backgroundColor】: 背景颜色 【Color】", +// } +class ShadowText extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Text( + "张风捷特烈", + style: TextStyle( + fontSize: 50, + color: Colors.white, + backgroundColor: Colors.black, + shadows: [ + Shadow( + color: Colors.cyanAccent, + offset: Offset(1, 1), + blurRadius: 10), + Shadow( + color: Colors.blue, + offset: Offset(-0.1, 0.1), + blurRadius: 10), + ]), + ); + } +} \ No newline at end of file diff --git a/lib/views/widgets/StatelessWidget/Text/node3_decoration.dart b/lib/views/widgets/StatelessWidget/Text/node3_decoration.dart new file mode 100644 index 0000000..3d21caa --- /dev/null +++ b/lib/views/widgets/StatelessWidget/Text/node3_decoration.dart @@ -0,0 +1,35 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020-03-29 +/// contact me by email 1981462002@qq.com +/// 说明: + + +// { +// "widgetId": 2, +// "priority": 3, +// "name": "文字装饰线", +// "subtitle": "【fontFamily】 : 文字字体 【String】\n" +// "【decoration】: 装饰线 【TextDecoration】\n" +// "【decorationColor】: 装饰线颜色 【Color】\n" +// "【decorationThickness】: 装饰线粗 【double】\n" +// "【decorationStyle】: 装饰线样式 【TextDecorationStyle】", +// } +class DecorationText extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Text( + "19940328", + style: TextStyle( + fontSize: 50, + fontWeight: FontWeight.bold, + decoration: TextDecoration.underline, + decorationThickness: 3, + decorationStyle: TextDecorationStyle.wavy, + decorationColor: Colors.blue, + fontStyle: FontStyle.italic, + fontFamily: "DancingScript", + letterSpacing: 10), + ); + } +} \ No newline at end of file diff --git a/lib/views/widgets/StatelessWidget/Text/node4_textAlign.dart b/lib/views/widgets/StatelessWidget/Text/node4_textAlign.dart new file mode 100644 index 0000000..e62c426 --- /dev/null +++ b/lib/views/widgets/StatelessWidget/Text/node4_textAlign.dart @@ -0,0 +1,34 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020-03-29 +/// contact me by email 1981462002@qq.com +/// 说明: + + +// { +// "widgetId": 2, +// "priority": 4, +// "name": "文字对齐方式", +// "subtitle": "【textAlign】: 对齐方式 【TextAlign】\n" +// "下面依次是:left、right、center、justify、start、end ", +// } +class TextAlignText extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Wrap( + spacing: 10, + runSpacing: 10, + children: TextAlign.values + .map((e) => Container( + width: 120, + color: Colors.cyanAccent.withAlpha(33), + height: 120 * 0.618, + child: Text( + " 张风捷特烈 toly " * 3, + textAlign: e, + ), + )) + .toList(), + ); + } +} \ No newline at end of file diff --git a/lib/views/widgets/StatelessWidget/Text/node5_textDirection.dart b/lib/views/widgets/StatelessWidget/Text/node5_textDirection.dart new file mode 100644 index 0000000..e7c74f2 --- /dev/null +++ b/lib/views/widgets/StatelessWidget/Text/node5_textDirection.dart @@ -0,0 +1,37 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020-03-29 +/// contact me by email 1981462002@qq.com +/// 说明: + + +// { +// "widgetId": 2, +// "priority": 5, +// "name": "文字方向与最大行数", +// "subtitle": "【maxLines】 : 最大行数 【int】\n" +// "【【textDirection】 : 文字方向 【TextDirection】\n" +// "下面依次是:rtl、ltr ", +// } +class TextDirectionText extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Wrap( + spacing: 40, + runSpacing: 10, + children: TextDirection.values + .map((e) => Container( + width: 120, + color: Colors.cyanAccent.withAlpha(33), + height: 120 * 0.618, + child: Text( + " 张风捷特烈 toly " * 10, + textDirection: e, + maxLines: 3, + overflow: TextOverflow.ellipsis, + ), + )) + .toList(), + ); + } +} \ No newline at end of file diff --git a/lib/views/widgets/StatelessWidget/Text/node6_softWrap.dart b/lib/views/widgets/StatelessWidget/Text/node6_softWrap.dart new file mode 100644 index 0000000..5e24d21 --- /dev/null +++ b/lib/views/widgets/StatelessWidget/Text/node6_softWrap.dart @@ -0,0 +1,34 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020-03-29 +/// contact me by email 1981462002@qq.com +/// 说明: + + +// { +// "widgetId": 2, +// "priority": 6, +// "name": "是否包裹与越界效果", +// "subtitle": "【softWrap】 : 是否换行 【bool】\n" +// "【overflow】 : 越界效果 【TextOverflow】\n" +// "下面softWrap=false; overflow依次是:clip、fade、ellipsis、visible ", +// } +class SoftWrapText extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Wrap( + spacing: 10, + runSpacing: 10, + children: TextOverflow.values + .map((e) => Container( + width: 150, + color: Colors.cyanAccent.withAlpha(33), + height: 150 * 0.618 * 0.618, + child: Text(" 张风捷特烈 toly " * 5, + overflow: e, + softWrap: false), + )) + .toList(), + ); + } +} diff --git a/lib/views/widgets/StatelessWidget/Theme.dart b/lib/views/widgets/StatelessWidget/Theme.dart deleted file mode 100644 index 66e1763..0000000 --- a/lib/views/widgets/StatelessWidget/Theme.dart +++ /dev/null @@ -1,103 +0,0 @@ -import 'package:flutter/material.dart'; - -/// create by 张风捷特烈 on 2020-03-29 -/// contact me by email 1981462002@qq.com -/// 说明: -// { -// "widgetId": 168, -// "name": '文字样式-ThemeData#TextTheme', -// "priority": 1, -// "subtitle": -// "子组件可以通过ThemeData.of获取主题的数据进行使用。", -// } -class TextThemeDemo extends StatelessWidget { - @override - Widget build(BuildContext context) { - var queryData = Theme.of(context).textTheme; - var styles = { - "headline: ": queryData.headline, - "title: ": queryData.title, - "subhead: ": queryData.subhead, - "subtitle: ": queryData.body1, - "body2: ": queryData.body2, - "button: ": queryData.button, - "overline: ": queryData.overline, - "subtitle: ": queryData.subtitle, - "button: ": queryData.caption, - "display1: ": queryData.display1, - "display2: ": queryData.display2, - "display3: ": queryData.display3, - "display4: ": queryData.display4, - }; - - return Container( - child: Column( - children: styles.keys.map((e) => buildItem(e, styles[e])).toList(), - ), - ); - } - - Widget buildItem(String e, TextStyle style) => Column( - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - e, - style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), - ), - Text( - "@toly", - style: style, - ) - ], - ), - ), - Divider( - height: 1, - ) - ], - ); -} - -// { -// "widgetId": 168, -// "name": 'Theme的用法', -// "priority": 2, -// "subtitle": -// "使用Theme,可以指定非常多的属性作为主题,这些属性将应用于所有的后代组件,如指定字体、滑块、卡片、文字、分割线、按钮等属性。", -// } -class CustomTheme extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Theme( - data: ThemeData( - cardTheme: CardTheme(color: Colors.red, elevation: 4), - dividerTheme: DividerThemeData( - color: Colors.blue, - thickness: 2 - ), - sliderTheme: SliderThemeData( - thumbColor: Colors.red, - activeTrackColor: Colors.green, - inactiveTrackColor: Colors.grey, - )), - child: Wrap( - crossAxisAlignment: WrapCrossAlignment.center, - children: [ - Card( - child: Container( - width: 50, - height: 50, - color: Colors.transparent, - ), - ), - Container( - width: 150, - child: Slider(value: 0.8, onChanged: (v) => {})), - Container( width: 150,child: Divider()) - ])); - } -} diff --git a/lib/views/widgets/StatelessWidget/Theme/node1_base.dart b/lib/views/widgets/StatelessWidget/Theme/node1_base.dart new file mode 100644 index 0000000..9162886 --- /dev/null +++ b/lib/views/widgets/StatelessWidget/Theme/node1_base.dart @@ -0,0 +1,63 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020-03-29 +/// contact me by email 1981462002@qq.com +/// 说明: +// { +// "widgetId": 168, +// "name": '文字样式-ThemeData#TextTheme', +// "priority": 1, +// "subtitle": +// "子组件可以通过ThemeData.of获取主题的数据进行使用。", +// } +class TextThemeDemo extends StatelessWidget { + @override + Widget build(BuildContext context) { + var queryData = Theme.of(context).textTheme; + var styles = { + "headline: ": queryData.headline, + "title: ": queryData.title, + "subhead: ": queryData.subhead, + "subtitle: ": queryData.body1, + "body2: ": queryData.body2, + "button: ": queryData.button, + "overline: ": queryData.overline, + "subtitle: ": queryData.subtitle, + "button: ": queryData.caption, + "display1: ": queryData.display1, + "display2: ": queryData.display2, + "display3: ": queryData.display3, + "display4: ": queryData.display4, + }; + + return Container( + child: Column( + children: styles.keys.map((e) => buildItem(e, styles[e])).toList(), + ), + ); + } + + Widget buildItem(String e, TextStyle style) => Column( + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + e, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), + ), + Text( + "@toly", + style: style, + ) + ], + ), + ), + Divider( + height: 1, + ) + ], + ); +} \ No newline at end of file diff --git a/lib/views/widgets/StatelessWidget/Theme/node2_use.dart b/lib/views/widgets/StatelessWidget/Theme/node2_use.dart new file mode 100644 index 0000000..a6b2ca1 --- /dev/null +++ b/lib/views/widgets/StatelessWidget/Theme/node2_use.dart @@ -0,0 +1,45 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020/4/27 +/// contact me by email 1981462002@qq.com +/// 说明: + +// { +// "widgetId": 168, +// "name": 'Theme的用法', +// "priority": 2, +// "subtitle": +// "使用Theme,可以指定非常多的属性作为主题,这些属性将应用于所有的后代组件,如指定字体、滑块、卡片、文字、分割线、按钮等属性。", +// } +class CustomTheme extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Theme( + data: ThemeData( + cardTheme: CardTheme(color: Colors.red, elevation: 4), + dividerTheme: DividerThemeData( + color: Colors.blue, + thickness: 2 + ), + sliderTheme: SliderThemeData( + thumbColor: Colors.red, + activeTrackColor: Colors.green, + inactiveTrackColor: Colors.grey, + )), + child: Wrap( + crossAxisAlignment: WrapCrossAlignment.center, + children: [ + Card( + child: Container( + width: 50, + height: 50, + color: Colors.transparent, + ), + ), + Container( + width: 150, + child: Slider(value: 0.8, onChanged: (v) => {})), + Container( width: 150,child: Divider()) + ])); + } +} \ No newline at end of file diff --git a/lib/views/widgets/StatelessWidget/ToggleButtons.dart b/lib/views/widgets/StatelessWidget/ToggleButtons.dart deleted file mode 100755 index 88c3e53..0000000 --- a/lib/views/widgets/StatelessWidget/ToggleButtons.dart +++ /dev/null @@ -1,93 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_unit/components/permanent/panel.dart'; - -class CustomToggleButtons extends StatefulWidget { - @override - _CustomToggleButtonsState createState() => _CustomToggleButtonsState(); -} - -class _CustomToggleButtonsState extends State { - var _isSelected = [true, false, false]; - - @override - Widget build(BuildContext context) { - return ToggleButtons( - children: [ - Icon(Icons.skip_previous), - Icon(Icons.pause), - Icon(Icons.skip_next), - ], - borderWidth: 1, - borderRadius: BorderRadius.circular(10), - isSelected: _isSelected, - onPressed: (value) => setState(() { - _isSelected = _isSelected.map((e) => false).toList(); - _isSelected[value] = true; - }), - ); - - } -} - -class ColorToggleButtons extends StatefulWidget { - @override - _ColorToggleButtonsState createState() => _ColorToggleButtonsState(); -} - -class _ColorToggleButtonsState extends State { - var _isSelected = [true, false, false]; - @override - Widget build(BuildContext context) { - return ToggleButtons( - children: [ - Icon(Icons.skip_previous), - Icon(Icons.pause), - Icon(Icons.skip_next), - ], - borderWidth: 1, - borderColor: Colors.orangeAccent, - selectedBorderColor: Colors.blue, - splashColor: Colors.purple.withAlpha(66), - borderRadius: BorderRadius.circular(10), - selectedColor: Colors.red, - fillColor: Colors.green.withAlpha(11), - isSelected: _isSelected, - onPressed: (value) => setState(() { - _isSelected = _isSelected.map((e) => false).toList(); - _isSelected[value] = true; - }), - ); - } -} - -class ProToggleButtons extends StatefulWidget { - @override - _ProToggleButtonsState createState() => _ProToggleButtonsState(); -} - -class _ProToggleButtonsState extends State { - var _isSelected = [false, false, false]; - @override - Widget build(BuildContext context) { - return ToggleButtons( - children: [ - Icon(Icons.skip_previous), - Icon(Icons.pause), - Icon(Icons.skip_next), - ], - borderWidth: 1, - borderColor: Colors.blue, - selectedBorderColor: Colors.orangeAccent, - splashColor: Colors.purple.withAlpha(66), - borderRadius: BorderRadius.circular(10), - selectedColor: Colors.red, - fillColor: Colors.green.withAlpha(11), - isSelected: _isSelected, - onPressed: (value) => setState(() { - _isSelected[value] = !_isSelected[value]; - }), - ); - } -} - - diff --git a/lib/views/widgets/StatelessWidget/ToggleButtons/node1_single.dart b/lib/views/widgets/StatelessWidget/ToggleButtons/node1_single.dart new file mode 100644 index 0000000..9c265ee --- /dev/null +++ b/lib/views/widgets/StatelessWidget/ToggleButtons/node1_single.dart @@ -0,0 +1,43 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020/4/27 +/// contact me by email 1981462002@qq.com +/// 说明: + +// { +// "widgetId": 33, +// "priority": 1, +// "name": "ToggleButtons单选切换", +// "subtitle": "【children】: 子组件集 【List】\n" +// "【borderWidth】: 边线宽 【double】\n" +// "【borderRadius】: 圆角 【BorderRadius】\n" +// "【isSelected】: 是否选中集 【List】\n" +// "【onPressed】: 点击事件 【Function(int)】", +// } +class CustomToggleButtons extends StatefulWidget { + @override + _CustomToggleButtonsState createState() => _CustomToggleButtonsState(); +} + +class _CustomToggleButtonsState extends State { + var _isSelected = [true, false, false]; + + @override + Widget build(BuildContext context) { + return ToggleButtons( + children: [ + Icon(Icons.skip_previous), + Icon(Icons.pause), + Icon(Icons.skip_next), + ], + borderWidth: 1, + borderRadius: BorderRadius.circular(10), + isSelected: _isSelected, + onPressed: (value) => setState(() { + _isSelected = _isSelected.map((e) => false).toList(); + _isSelected[value] = true; + }), + ); + + } +} \ No newline at end of file diff --git a/lib/views/widgets/StatelessWidget/ToggleButtons/node2_color.dart b/lib/views/widgets/StatelessWidget/ToggleButtons/node2_color.dart new file mode 100644 index 0000000..be46eeb --- /dev/null +++ b/lib/views/widgets/StatelessWidget/ToggleButtons/node2_color.dart @@ -0,0 +1,48 @@ + + +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020/4/27 +/// contact me by email 1981462002@qq.com +/// 说明: + +// { +// "widgetId": 33, +// "priority": 2, +// "name": "ToggleButtons颜色属性", +// "subtitle": "【borderColor】: 边线色 【Color】\n" +// "【selectedBorderColor】: 选中边线色 【Color】\n" +// "【selectedColor】: 选中时组件色 【Color】\n" +// "【fillColor】: 选中时填充色 【Color】\n" +// "【splashColor】: 水波纹色 【Color】", +// } +class ColorToggleButtons extends StatefulWidget { + @override + _ColorToggleButtonsState createState() => _ColorToggleButtonsState(); +} + +class _ColorToggleButtonsState extends State { + var _isSelected = [true, false, false]; + @override + Widget build(BuildContext context) { + return ToggleButtons( + children: [ + Icon(Icons.skip_previous), + Icon(Icons.pause), + Icon(Icons.skip_next), + ], + borderWidth: 1, + borderColor: Colors.orangeAccent, + selectedBorderColor: Colors.blue, + splashColor: Colors.purple.withAlpha(66), + borderRadius: BorderRadius.circular(10), + selectedColor: Colors.red, + fillColor: Colors.green.withAlpha(11), + isSelected: _isSelected, + onPressed: (value) => setState(() { + _isSelected = _isSelected.map((e) => false).toList(); + _isSelected[value] = true; + }), + ); + } +} diff --git a/lib/views/widgets/StatelessWidget/ToggleButtons/node3_multi.dart b/lib/views/widgets/StatelessWidget/ToggleButtons/node3_multi.dart new file mode 100644 index 0000000..cea4cb8 --- /dev/null +++ b/lib/views/widgets/StatelessWidget/ToggleButtons/node3_multi.dart @@ -0,0 +1,42 @@ + +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020/4/27 +/// contact me by email 1981462002@qq.com +/// 说明: + +// { +// "widgetId": 33, +// "priority": 3, +// "name": "ToggleButtons多选切换", +// "subtitle": " 可以控制状态转化的逻辑来形成不同的效果。", +// } +class ProToggleButtons extends StatefulWidget { + @override + _ProToggleButtonsState createState() => _ProToggleButtonsState(); +} + +class _ProToggleButtonsState extends State { + var _isSelected = [false, false, false]; + @override + Widget build(BuildContext context) { + return ToggleButtons( + children: [ + Icon(Icons.skip_previous), + Icon(Icons.pause), + Icon(Icons.skip_next), + ], + borderWidth: 1, + borderColor: Colors.blue, + selectedBorderColor: Colors.orangeAccent, + splashColor: Colors.purple.withAlpha(66), + borderRadius: BorderRadius.circular(10), + selectedColor: Colors.red, + fillColor: Colors.green.withAlpha(11), + isSelected: _isSelected, + onPressed: (value) => setState(() { + _isSelected[value] = !_isSelected[value]; + }), + ); + } +} \ No newline at end of file diff --git a/lib/views/widgets/StatelessWidget/UserAccountsDrawerHeader/node1_base.dart b/lib/views/widgets/StatelessWidget/UserAccountsDrawerHeader/node1_base.dart new file mode 100644 index 0000000..26d3913 --- /dev/null +++ b/lib/views/widgets/StatelessWidget/UserAccountsDrawerHeader/node1_base.dart @@ -0,0 +1,56 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020/4/27 +/// contact me by email 1981462002@qq.com +/// 说明: + +// { +// "widgetId": 22, +// "priority": 1, +// "name": "该组件的基本表现如下", +// "subtitle": "【currentAccountPicture】: 上组件 【Widget】\n" +// "【accountName】: 中组件 【Widget】\n" +// "【accountEmail】: 下组件 【Widget】\n" +// "【decoration】: 装饰 【Decoration】", +// } + +class CustomUAGHP extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Container( + width: MediaQuery.of(context).size.width / 3 * 2, + child: UserAccountsDrawerHeader( + accountName: Container( + padding: const EdgeInsets.all(8.0), + child: Text( + "张风捷特烈", + style: + TextStyle(color: Colors.orangeAccent, fontSize: 22, shadows: [ + Shadow( + color: Colors.black, offset: Offset(.5, .5), blurRadius: 2), + ]), + ), + ), + accountEmail: Padding( + padding: const EdgeInsets.all(8.0), + child: Text("1981462002@qq.com", + style: TextStyle(color: Colors.white, fontSize: 14, shadows: [ + Shadow( + color: Colors.orangeAccent, + offset: Offset(.5, .5), + blurRadius: 2), + ])), + ), + currentAccountPicture: Container( + padding: const EdgeInsets.all(15.0), + child: CircleAvatar( + backgroundImage: AssetImage("assets/images/icon_head.png"), + ), + ), + decoration: BoxDecoration( + image: DecorationImage(image: AssetImage("assets/images/caver.jpeg")), + ), + ), + ); + } +} diff --git a/lib/views/widgets/StatelessWidget/UserAccountsDrawerHeader.dart b/lib/views/widgets/StatelessWidget/UserAccountsDrawerHeader/node2_pro.dart similarity index 55% rename from lib/views/widgets/StatelessWidget/UserAccountsDrawerHeader.dart rename to lib/views/widgets/StatelessWidget/UserAccountsDrawerHeader/node2_pro.dart index 00bfba7..2016c58 100644 --- a/lib/views/widgets/StatelessWidget/UserAccountsDrawerHeader.dart +++ b/lib/views/widgets/StatelessWidget/UserAccountsDrawerHeader/node2_pro.dart @@ -1,46 +1,18 @@ import 'package:flutter/material.dart'; -class CustomUAGHP extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Container( - width: MediaQuery.of(context).size.width / 3 * 2, - child: UserAccountsDrawerHeader( - accountName: Container( - padding: const EdgeInsets.all(8.0), - child: Text( - "张风捷特烈", - style: - TextStyle(color: Colors.orangeAccent, fontSize: 22, shadows: [ - Shadow( - color: Colors.black, offset: Offset(.5, .5), blurRadius: 2), - ]), - ), - ), - accountEmail: Padding( - padding: const EdgeInsets.all(8.0), - child: Text("1981462002@qq.com", - style: TextStyle(color: Colors.white, fontSize: 14, shadows: [ - Shadow( - color: Colors.orangeAccent, - offset: Offset(.5, .5), - blurRadius: 2), - ])), - ), - currentAccountPicture: Container( - padding: const EdgeInsets.all(15.0), - child: CircleAvatar( - backgroundImage: AssetImage("assets/images/icon_head.png"), - ), - ), - decoration: BoxDecoration( - image: DecorationImage(image: AssetImage("assets/images/caver.jpeg")), - ), - ), - ); - } -} +/// create by 张风捷特烈 on 2020/4/27 +/// contact me by email 1981462002@qq.com +/// 说明: +// { +// "widgetId": 22, +// "priority": 2, +// "name": "右上角和底部", +// "subtitle": "【otherAccountsPictures】: 右上组件 【List】\n" +// "【onDetailsPressed】: 右下角点击事件 【Function()】\n" +// "【arrowColor】: 右下角按钮颜色 【Color】\n" +// "【margin】: 外边距 【EdgeInsetsGeometry】", +// } class ProUAGHP extends StatelessWidget { @override Widget build(BuildContext context) { diff --git a/lib/views/widgets/StatelessWidget/VerticalDivider/node1_base.dart b/lib/views/widgets/StatelessWidget/VerticalDivider/node1_base.dart new file mode 100644 index 0000000..28e0f16 --- /dev/null +++ b/lib/views/widgets/StatelessWidget/VerticalDivider/node1_base.dart @@ -0,0 +1,34 @@ +import 'package:flutter/material.dart'; +/// create by 张风捷特烈 on 2020/4/27 +/// contact me by email 1981462002@qq.com +/// 说明: + +// { +// "widgetId": 35, +// "priority": 1, +// "name": "VerticalDivider颜色和粗细", +// "subtitle": "【color】: 颜色 【Color】\n" +// "【thickness】: 线粗细 【double】", +// } +class CustomVerticalDivider extends StatelessWidget { + @override + Widget build(BuildContext context) { + var dataColor = [ + Colors.red, Colors.yellow, + Colors.blue, Colors.green]; + var dataThickness = [1.0, 2.0, 4.0, 6.0]; + var data = Map.fromIterables(dataColor, dataThickness); + return Container( + height: 150, + child: Row( + mainAxisSize: MainAxisSize.min, + children: dataColor + .map((e) => VerticalDivider( + color: e, + thickness: data[e], + )) + .toList(), + ), + ); + } +} \ No newline at end of file diff --git a/lib/views/widgets/StatelessWidget/VerticalDivider.dart b/lib/views/widgets/StatelessWidget/VerticalDivider/node2_height.dart similarity index 55% rename from lib/views/widgets/StatelessWidget/VerticalDivider.dart rename to lib/views/widgets/StatelessWidget/VerticalDivider/node2_height.dart index 3babd7f..87c6843 100644 --- a/lib/views/widgets/StatelessWidget/VerticalDivider.dart +++ b/lib/views/widgets/StatelessWidget/VerticalDivider/node2_height.dart @@ -1,28 +1,19 @@ + + import 'package:flutter/material.dart'; -class CustomVerticalDivider extends StatelessWidget { - @override - Widget build(BuildContext context) { - var dataColor = [ - Colors.red, Colors.yellow, - Colors.blue, Colors.green]; - var dataThickness = [1.0, 2.0, 4.0, 6.0]; - var data = Map.fromIterables(dataColor, dataThickness); - return Container( - height: 150, - child: Row( - mainAxisSize: MainAxisSize.min, - children: dataColor - .map((e) => VerticalDivider( - color: e, - thickness: data[e], - )) - .toList(), - ), - ); - } -} +/// create by 张风捷特烈 on 2020/4/27 +/// contact me by email 1981462002@qq.com +/// 说明: +// { +// "widgetId": 35, +// "priority": 2, +// "name": "VerticalDivider宽度和空缺", +// "subtitle": "【indent】: 前面空缺长度 【double】\n" +// "【endIndent】: 后面空缺长度 【double】\n" +// "【height】: 占位高 【double】", +// } class HeightVerticalDivider extends StatelessWidget { @override Widget build(BuildContext context) { diff --git a/lib/views/widgets/StatelessWidget/Visibility.dart b/lib/views/widgets/StatelessWidget/Visibility.dart deleted file mode 100644 index a477d08..0000000 --- a/lib/views/widgets/StatelessWidget/Visibility.dart +++ /dev/null @@ -1,138 +0,0 @@ -import 'package:flutter/material.dart'; - -class CustomVisibility extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Wrap( - spacing: 10, - children: [ - _buildVisibility(true), - _buildVisibility(false), - ], - ); - } - - _buildVisibility(bool visible) { - var box = Container( - height: 30, - width: 30, - color: Colors.blue, - ); - return Container( - width: 150, - height: 150 * 0.618, - color: Colors.cyanAccent.withAlpha(33), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - box, - Visibility( - visible: visible, - child: Container( - alignment: Alignment.center, - height: 80 * 0.618, - width: 80, - color: Colors.red, - child: Text( - "visible\ntrue", - style: TextStyle(fontSize: 20), - ), - )), - box, - ], - ), - ); - } -} - -class ReplacementVisibility extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Wrap( - spacing: 10, - children: [ - _buildVisibility(true), - _buildVisibility(false), - ], - ); - } - - _buildVisibility(bool visible) { - var box = Container( - height: 30, - width: 30, - color: Colors.blue, - ); - return Container( - width: 150, - height: 150 * 0.618, - color: Colors.cyanAccent.withAlpha(33), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - box, - Visibility( - visible: visible, - replacement: Container( - alignment: Alignment.center, - height: 80 * 0.618, - width: 80, - ), - child: Container( - alignment: Alignment.center, - height: 80 * 0.618, - width: 80, - color: Colors.red, - child: Text( - "visible\ntrue", - style: TextStyle(fontSize: 20), - ), - )), - box, - ], - ), - ); - } -} - -//class VisibilityPage extends StatefulWidget { -// @override -// _VisibilityPageState createState() => _VisibilityPageState(); -//} -// -//class _VisibilityPageState extends State { -// @override -// Widget build(BuildContext context) { -// var visibility = Visibility( -// visible: false, -// replacement: Container( -// alignment: Alignment.center, -// height: 100, -// width: 100, -// ), -// child: Container( -// alignment: Alignment.center, -// height: 100, -// width: 100, -// color: Colors.blue, -// child: Text( -// "Visibility", -// style: TextStyle(fontSize: 20), -// ), -// )); -// -// var radBox = Container( -// height: 50, -// width: 50, -// color: Colors.red, -// ); -// -// return Container( -// width: 200, -// height: 200, -// child: Row( -// children: [radBox, visibility, radBox], -// ), -// ); -// } -//} diff --git a/lib/views/widgets/StatelessWidget/Visibility/node1_base.dart b/lib/views/widgets/StatelessWidget/Visibility/node1_base.dart new file mode 100644 index 0000000..232981b --- /dev/null +++ b/lib/views/widgets/StatelessWidget/Visibility/node1_base.dart @@ -0,0 +1,57 @@ +import 'package:flutter/material.dart'; +/// create by 张风捷特烈 on 2020/4/27 +/// contact me by email 1981462002@qq.com +/// 说明: + +// { +// "widgetId": 10, +// "priority": 1, +// "name": "根据visible控制内部子组件的显隐情况", +// "subtitle": "【visible】 : 是否显示 【bool】\n" +// "【child】: 孩子 【Widget】\n" +// "默认孩子隐藏时会失去原来所在区域。", +// } +class CustomVisibility extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Wrap( + spacing: 10, + children: [ + _buildVisibility(true), + _buildVisibility(false), + ], + ); + } + + _buildVisibility(bool visible) { + var box = Container( + height: 30, + width: 30, + color: Colors.blue, + ); + return Container( + width: 150, + height: 150 * 0.618, + color: Colors.cyanAccent.withAlpha(33), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + box, + Visibility( + visible: visible, + child: Container( + alignment: Alignment.center, + height: 80 * 0.618, + width: 80, + color: Colors.red, + child: Text( + "visible\ntrue", + style: TextStyle(fontSize: 20), + ), + )), + box, + ], + ), + ); + } +} diff --git a/lib/views/widgets/StatelessWidget/Visibility/node2_replacement.dart b/lib/views/widgets/StatelessWidget/Visibility/node2_replacement.dart new file mode 100644 index 0000000..4c083cf --- /dev/null +++ b/lib/views/widgets/StatelessWidget/Visibility/node2_replacement.dart @@ -0,0 +1,61 @@ +import 'package:flutter/material.dart'; + +/// create by 张风捷特烈 on 2020/4/27 +/// contact me by email 1981462002@qq.com +/// 说明: + +// { +// "widgetId": 10, +// "priority": 2, +// "name": "replacement可在隐藏时进行占位", +// "subtitle": "【replacement】 : 隐藏时的占位组件 【Widget】", +// } +class ReplacementVisibility extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Wrap( + spacing: 10, + children: [ + _buildVisibility(true), + _buildVisibility(false), + ], + ); + } + + _buildVisibility(bool visible) { + var box = Container( + height: 30, + width: 30, + color: Colors.blue, + ); + return Container( + width: 150, + height: 150 * 0.618, + color: Colors.cyanAccent.withAlpha(33), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + box, + Visibility( + visible: visible, + replacement: Container( + alignment: Alignment.center, + height: 80 * 0.618, + width: 80, + ), + child: Container( + alignment: Alignment.center, + height: 80 * 0.618, + width: 80, + color: Colors.red, + child: Text( + "visible\ntrue", + style: TextStyle(fontSize: 20), + ), + )), + box, + ], + ), + ); + } +} diff --git a/lib/views/widgets/StatelessWidget/CupertinoSegmentedControlTest.dart b/lib/views/widgets/StatelessWidget/no/CupertinoSegmentedControlTest.dart similarity index 100% rename from lib/views/widgets/StatelessWidget/CupertinoSegmentedControlTest.dart rename to lib/views/widgets/StatelessWidget/no/CupertinoSegmentedControlTest.dart diff --git a/lib/views/widgets/StatelessWidget/stateless_unit.dart b/lib/views/widgets/StatelessWidget/stateless_unit.dart index 6fe7090..1b51d9a 100644 --- a/lib/views/widgets/StatelessWidget/stateless_unit.dart +++ b/lib/views/widgets/StatelessWidget/stateless_unit.dart @@ -35,35 +35,63 @@ export 'Divider/node2_height.dart'; export 'FloatingActionButton/node1_base.dart'; export 'FloatingActionButton/node2_mini.dart'; export 'FloatingActionButton/node3_shape.dart'; +export 'GestureDetector/node1_base.dart'; +export 'GestureDetector/node2_tap.dart'; +export 'GestureDetector/node3_pan.dart'; -export 'Text.dart'; export 'Banner/node1_base.dart'; -export 'Icon.dart'; -export 'ImageIcon.dart'; +export 'ImageIcon/node1_base.dart'; export 'FadeInImage/node1_base.dart'; export 'CircleAvatar/node1_base.dart'; -export 'Visibility.dart'; + + +export 'InputChip/node1_base.dart'; +export 'InputChip/node2_select.dart'; + + +export 'Visibility/node1_base.dart'; +export 'Visibility/node2_replacement.dart'; export 'ChoiceChip/node1_base.dart'; -export 'InputChip.dart'; + export 'FilterChip/node1_base.dart'; -export 'ListTile.dart'; -export 'SwitchListTile.dart'; -export 'RadioListTile.dart'; -export 'GridTileBar.dart'; -export 'GridTile.dart'; +export 'ListTile/node1_base.dart'; +export 'ListTile/node2_select.dart'; +export 'ListTile/node3_dense.dart'; -export 'MaterialButton.dart'; -export 'TabBar.dart'; +export 'ListView/node1_base.dart'; +export 'ListView/node2_direction.dart'; +export 'ListView/node3_builder.dart'; +export 'ListView/node4_separated.dart'; -export 'GridPager.dart'; +export 'MaterialButton/node1_base.dart'; +export 'MaterialButton/node2_onLongPress.dart'; +export 'MaterialButton/node3_shape.dart'; -export 'Placeholder.dart'; -export 'UserAccountsDrawerHeader.dart'; -export 'VerticalDivider.dart'; +export 'GridTileBar/node1_base.dart'; +export 'GridTile/node1_base.dart'; + +export 'Icon/node1_base.dart'; +export 'Icon/node2_diy.dart'; + +export 'Placeholder/node1_base.dart'; +export 'Placeholder/node2_fallback.dart'; + +export 'RadioListTile/node1_base.dart'; +export 'RadioListTile/node2_dense.dart' show DenseRadioListTile; + +export 'SingleChildScrollView/node1_base.dart'; +export 'SingleChildScrollView/node2_direction.dart'; + +export 'TabBar/node1_base.dart'; +export 'TabBar/node2_noShadow.dart'; + + +export 'UserAccountsDrawerHeader/node2_pro.dart'; +export 'VerticalDivider/node2_height.dart'; export 'BackButton/node1_base.dart'; export 'ButtonBar/node1_base.dart'; @@ -74,37 +102,67 @@ export 'FlatButton/node1_base.dart'; export 'FlutterLogo/node1_base.dart'; export 'FlutterLogo/node2_style.dart'; -export 'IconButton.dart'; -export 'OutLineButton.dart'; -export 'RaisedButton.dart'; -export 'ToggleButtons.dart'; +export 'IconButton/node1_base.dart'; +export 'OutlineButton/node1_base.dart'; +export 'RaisedButton/node1_base.dart'; export 'Drawer/node1_base.dart'; export 'DrawerHeader/node1_base.dart'; -export 'GestureDetector.dart'; -export 'GirdView.dart'; -export 'ListView.dart'; -export 'Listener.dart'; -export 'PositionedDirectional.dart'; -export 'SingleChildScrollView.dart'; -export 'Tab.dart'; -export 'Theme.dart'; -export 'WillPopScope.dart'; + +export 'UserAccountsDrawerHeader/node1_base.dart'; +export 'UserAccountsDrawerHeader/node2_pro.dart'; + + +export 'VerticalDivider/node1_base.dart'; +export 'VerticalDivider/node2_height.dart'; + + +export 'GirdView/node1_base.dart'; +export 'GirdView/node2_direction.dart'; +export 'GirdView/node3_extend.dart'; +export 'GirdView/node4_builder.dart'; + +export 'GridPaper/node1_base.dart'; +export 'GridPaper/node2_divisions.dart'; + +export 'Spacer/node1_base.dart'; +export 'Spacer/node2_flex.dart'; + +export 'SwitchListTile/node1_base.dart'; +export 'SwitchListTile/node2_select.dart'; +export 'SwitchListTile/node3_dense.dart'; + +export 'Listener/node1_base.dart'; +export 'PositionedDirectional/node1_base.dart'; + +export 'Tab/node1_base.dart'; +export 'Theme/node1_base.dart'; +export 'Theme/node2_use.dart'; + +export 'ToggleButtons/node1_single.dart'; +export 'ToggleButtons/node2_color.dart'; +export 'ToggleButtons/node3_multi.dart'; + export 'BottomSheet/node1_base.dart'; export 'CupertinoActionSheet/node1_base.dart'; export 'CupertinoActionSheetAction/node1_base.dart'; export 'CupertinoAlertDialog/node1_base.dart'; - +export 'Text/node1_base.dart'; +export 'Text/node2_shadows.dart'; +export 'Text/node3_decoration.dart'; +export 'Text/node4_textAlign.dart'; +export 'Text/node5_textDirection.dart'; +export 'Text/node6_softWrap.dart'; export 'DayPicker/node1_base.dart'; export 'Dialog/node1_base.dart'; -export 'MonthPicker.dart'; -export 'SimpleDialog.dart'; -export 'SimpleDialogOption.dart'; -export 'SnackBar.dart'; -export 'SnackBarAction.dart'; -export 'YearPicker.dart'; + +export 'SimpleDialog/node1_base.dart'; +export 'SimpleDialogOption/node1_base.dart'; +export 'SnackBar/node1_base.dart'; +export 'SnackBarAction/node1_base.dart'; + diff --git a/lib/views/widgets/widgets_map.dart b/lib/views/widgets/widgets_map.dart index 0be1f05..bfefb4a 100644 --- a/lib/views/widgets/widgets_map.dart +++ b/lib/views/widgets/widgets_map.dart @@ -19,7 +19,6 @@ import 'ProxyWidget/Flexible.dart'; import 'ProxyWidget/InheritedWidget/MediaQuery.dart'; import 'ProxyWidget/InheritedWidget/ScrollConfiguration.dart'; import 'ProxyWidget/Positioned.dart'; -import 'StatelessWidget/Spacer.dart'; import 'RenderObjectWidget/ErrorWidget.dart'; import 'RenderObjectWidget/MultiChildRenderObjectWidget/Column.dart'; import 'ProxyWidget/Expanded.dart';