diff --git a/lib/tools/aku_divider.dart b/lib/tools/aku_divider.dart new file mode 100644 index 0000000..ed1260a --- /dev/null +++ b/lib/tools/aku_divider.dart @@ -0,0 +1,47 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +class AkuDivider extends StatelessWidget { + final double thickness; + final bool isHorizontal; + final double indent; + final double endIndent; + final Color color; + const AkuDivider( + {Key key, + this.isHorizontal, + this.indent, + this.endIndent, + this.thickness, + this.color}) + : super(key: key); + + AkuDivider.horizontal({Key key, this.indent, this.endIndent}) + : isHorizontal = true, + thickness = 1.w, + color = Color(0xFFE8E8E8), + super(key: key); + AkuDivider.vertical({Key key, this.indent, this.endIndent}) + : isHorizontal = false, + thickness = 1.w, + color = Color(0xFFE8E8E8), + super(key: key); + @override + Widget build(BuildContext context) { + return isHorizontal + ? Divider( + height: 0, + thickness: this.thickness ?? 1.w, + indent: this.indent ?? 0, + endIndent: this.endIndent ?? 0, + color: this.color ?? Color(0xFFE8E8E8), + ) + : VerticalDivider( + width: 0, + thickness: this.thickness ?? 1.w, + indent: this.indent ?? 0, + endIndent: this.endIndent ?? 0, + color: this.color ?? Color(0xFFE8E8E8), + ); + } +} diff --git a/lib/tools/extensions/list_extension_tool.dart b/lib/tools/extensions/list_extension_tool.dart new file mode 100644 index 0000000..fc3e9d7 --- /dev/null +++ b/lib/tools/extensions/list_extension_tool.dart @@ -0,0 +1,15 @@ +import 'package:flutter/material.dart'; +import 'package:velocity_x/velocity_x.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +extension WidgetListExt on List { + List sepWidget({Widget separate}) { + if (this.isEmpty) return []; + return List.generate(this.length * 2 - 1, (index) { + if (index.isEven) + return this[index ~/ 2]; + else + return separate ?? 10.w.heightBox; + }); + } +} \ No newline at end of file diff --git a/lib/tools/extensions/router_extension_tool.dart b/lib/tools/extensions/router_extension_tool.dart new file mode 100644 index 0000000..5275c59 --- /dev/null +++ b/lib/tools/extensions/router_extension_tool.dart @@ -0,0 +1,6 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; + +extension PageExt on Widget { + Function get to => () => Get.to(this); +} diff --git a/lib/tools/widget_tool.dart b/lib/tools/widget_tool.dart index aee07f1..d442e40 100644 --- a/lib/tools/widget_tool.dart +++ b/lib/tools/widget_tool.dart @@ -5,9 +5,9 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; ///自定义分割线 -class AkuDiveder { +class GridientDiveder { final bool isReverse; //颜色方向反转 - const AkuDiveder({Key key, this.isReverse = false}); + const GridientDiveder({Key key, this.isReverse = false}); Widget verticalDivider(double height) { return Container( width: 1.w, diff --git a/lib/ui/home/home_page.dart b/lib/ui/home/home_page.dart index 92275f5..1d9ccf7 100644 --- a/lib/ui/home/home_page.dart +++ b/lib/ui/home/home_page.dart @@ -532,20 +532,20 @@ class _HomePageState extends State { children: [ _card(AllModel(context).waitThings?.length, '未处理事项', Color(0xFFFF4E0D), 0), - AkuDiveder().verticalDivider(166.5.w), + GridientDiveder().verticalDivider(166.5.w), _card(AllModel(context).processingThings?.length, '处理中事项', Color(0xFFFFC40C), 1), ], ), Row(children: [ - AkuDiveder().horizontalDivider(343.w), - AkuDiveder(isReverse: true).horizontalDivider(343.w) + GridientDiveder().horizontalDivider(343.w), + GridientDiveder(isReverse: true).horizontalDivider(343.w) ]), Row( children: [ _card(AllModel(context).doneThings?.length, '已处理事项', Color(0xFF3F8FFE), 2), - AkuDiveder(isReverse: true).verticalDivider( + GridientDiveder(isReverse: true).verticalDivider( 166.5.w, ), _card(AllModel(context).allThings?.length, '全部事项', diff --git a/lib/ui/settings/user_info_page.dart b/lib/ui/settings/user_info_page.dart index 9479fd7..d928bd2 100644 --- a/lib/ui/settings/user_info_page.dart +++ b/lib/ui/settings/user_info_page.dart @@ -1,4 +1,5 @@ // Flutter imports: +import 'package:aku_community_manager/tools/aku_divider.dart'; import 'package:flutter/material.dart'; // Package imports: @@ -12,6 +13,7 @@ import 'package:aku_community_manager/ui/widgets/app_widgets/aku_avatar.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_tile.dart'; import 'package:aku_community_manager/ui/widgets/inner/pick_image.dart'; +import 'package:aku_community_manager/tools/extensions/list_extension_tool.dart'; class UserInfoPage extends StatefulWidget { UserInfoPage({Key key}) : super(key: key); @@ -49,7 +51,7 @@ class _UserInfoPageState extends State { title: Text('手机'), suffix: Text(TextUtil.hideNumber(userProvider.infoModel.tel)), ), - ], + ].sepWidget(separate: AkuDivider.horizontal()), ), ); } diff --git a/pubspec.lock b/pubspec.lock index e32c070..3b500c3 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1,6 +1,13 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + url: "https://pub.flutter-io.cn" + source: hosted + version: "14.0.0" aku_ui: dependency: "direct main" description: @@ -38,6 +45,20 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "0.14.0" + analyzer: + dependency: transitive + description: + name: analyzer + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.41.2" + animator: + dependency: transitive + description: + name: animator + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.2" args: dependency: transitive description: @@ -52,6 +73,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "2.5.0-nullsafety.1" + auto_size_text: + dependency: transitive + description: + name: auto_size_text + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.0" boolean_selector: dependency: transitive description: @@ -150,6 +178,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.0.0" + dart_style: + dependency: transitive + description: + name: dart_style + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.3.12" decimal: dependency: transitive description: @@ -211,6 +246,13 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_asset_generator: + dependency: "direct dev" + description: + name: flutter_asset_generator + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.6.1" flutter_easyrefresh: dependency: "direct main" description: @@ -352,6 +394,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "0.16.1" + io: + dependency: transitive + description: + name: io + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.3.4" jpush_flutter: dependency: "direct main" description: @@ -408,6 +457,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.2.0" + package_config: + dependency: transitive + description: + name: package_config + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.9.3" path: dependency: transitive description: @@ -520,6 +576,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "4.3.2+2" + pub_semver: + dependency: transitive + description: + name: pub_semver + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.4.4" qr_code_scanner: dependency: "direct main" description: @@ -553,6 +616,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.10.0-nullsafety.1" + states_rebuilder: + dependency: transitive + description: + name: states_rebuilder + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.2.0" stream_channel: dependency: transitive description: @@ -637,6 +707,20 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "2.1.0-nullsafety.3" + velocity_x: + dependency: "direct main" + description: + name: velocity_x + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.3.1" + watcher: + dependency: transitive + description: + name: watcher + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.9.7+15" win32: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 2113512..9152a80 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -46,7 +46,9 @@ dependencies: amap_map_fluttify: ^0.29.0 permission_handler: ^5.0.1+1 - + + velocity_x: ^1.3.1 + dio: power_logger: ^0.1.0 @@ -64,6 +66,7 @@ dev_dependencies: sdk: flutter import_sorter: grinder: + flutter_asset_generator: ^0.6.1 flutter: uses-material-design: true