From ab88857b47a430af20756e0a8a5b0ab8ef87aa8b Mon Sep 17 00:00:00 2001 From: toly <1981462002@qq.com> Date: Tue, 17 Nov 2020 18:23:27 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E6=9B=B4=E6=96=B0=E7=89=88?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 10 ++--- lib/app/res/style/shape/techno_shape.dart | 31 ++++++++-------- .../permanent/overlay_tool_wrapper.dart | 37 ++++++++++--------- 3 files changed, 40 insertions(+), 38 deletions(-) diff --git a/README.md b/README.md index d5d4142..8c612d2 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ #### Flutter Unit 周边 -- 🔥 [《Flutter之旅》源码下载地址 ](https://gitee.com/toly1994328/FlutterUnit/attach_files/466731/download) +- 🔥 [实体书 - 《Flutter之旅》源码下载地址 ](https://gitee.com/toly1994328/FlutterUnit/attach_files/466731/download) - 🔥 [掘金小册 -《Flutter绘制指南》 3.28元 ](https://juejin.im/book/6844733827265331214) - 🔥 [Flutter环境配置](https://github.com/toly1994328/FlutterUnit/issues/22) - 🔥 [Flutter实用插件集录 ](https://github.com/toly1994328/FlutterUnit/issues/41) @@ -32,10 +32,10 @@ ``` a1@toly ~ % flutter --version -Flutter 1.22.0 • channel stable • https://github.com/flutter/flutter.git -Framework • revision d408d302e2 (5 days ago) • 2020-09-29 11:49:17 -0700 -Engine • revision 5babba6c4d -Tools • Dart 2.10.0 +Flutter 1.22.4 • channel stable • https://github.com/flutter/flutter.git +Framework • revision 1aafb3a8b9 (4 days ago) • 2020-11-13 09:59:28 -0800 +Engine • revision 2c956a31c0 +Tools • Dart 2.10.4 ``` --- diff --git a/lib/app/res/style/shape/techno_shape.dart b/lib/app/res/style/shape/techno_shape.dart index 3a85279..34adf0a 100644 --- a/lib/app/res/style/shape/techno_shape.dart +++ b/lib/app/res/style/shape/techno_shape.dart @@ -12,7 +12,6 @@ import 'package:flutter/material.dart'; class TechnoShapeBorder extends ShapeBorder { final Path outLinePath = Path(); final Paint _paint = Paint(); - final Path innerLinePath = Path(); final Path innerLinePathTop = Path(); final Color color; @@ -45,30 +44,30 @@ class TechnoShapeBorder extends ShapeBorder { @override Path getOuterPath(Rect rect, {TextDirection textDirection}) { + double width = rect.width; + outLinePath ..moveTo(cornerWidth, 0) - ..lineTo(rect.width - cornerWidth, 0) - ..lineTo(rect.width, cornerWidth) - ..lineTo(rect.width, rect.height - cornerWidth) - ..lineTo(rect.width - cornerWidth, rect.height) - ..lineTo(cornerWidth, rect.height) + ..relativeLineTo(width - cornerWidth*2, 0) + ..relativeLineTo(cornerWidth, cornerWidth) + ..relativeLineTo(0,rect.height - cornerWidth*2) + ..relativeLineTo( - cornerWidth, cornerWidth) + ..relativeLineTo(-((width-innerRate*2*width)/2-cornerWidth-2*spanWidth), 0) + ..relativeLineTo(-spanWidth*2, -spanWidth) + ..relativeLineTo(-rect.width * innerRate * 2, 0) + ..relativeLineTo(-spanWidth * 2, spanWidth) + ..relativeLineTo(-((width-innerRate*2*width)/2-cornerWidth-2*spanWidth), 0) ..lineTo(0, rect.height - cornerWidth) ..lineTo(0, cornerWidth) ..close(); - innerLinePath - ..moveTo(rect.width / 2, rect.height) - ..relativeLineTo(rect.width * innerRate, 0) - ..relativeLineTo(-spanWidth * 2, -spanWidth) - ..relativeLineTo(-rect.width * innerRate * 2, 0) - ..relativeLineTo(-spanWidth * 2, spanWidth) - ..close(); - return Path.combine(PathOperation.difference, outLinePath, innerLinePath); + + return outLinePath; } @override void paint(Canvas canvas, Rect rect, {TextDirection textDirection}) { canvas.drawPath( - Path.combine(PathOperation.difference, outLinePath, innerLinePath), + outLinePath, _paint..style = PaintingStyle.stroke); innerLinePathTop @@ -78,7 +77,7 @@ class TechnoShapeBorder extends ShapeBorder { ..relativeLineTo(-rect.width * innerRate * 2, 0) ..relativeLineTo(-spanWidth * 2, -spanWidth) ..close(); - canvas.drawPath(innerLinePathTop, _paint..style = PaintingStyle.fill); + canvas.drawPath(innerLinePathTop.shift(Offset(spanWidth*2,0)), _paint..style = PaintingStyle.fill); } @override diff --git a/lib/components/permanent/overlay_tool_wrapper.dart b/lib/components/permanent/overlay_tool_wrapper.dart index a75001e..f915fdf 100644 --- a/lib/components/permanent/overlay_tool_wrapper.dart +++ b/lib/components/permanent/overlay_tool_wrapper.dart @@ -126,23 +126,26 @@ class OverlayToolWrapperState extends State offset = Offset(x, y - boxHeight / 2); entry.markNeedsBuild(); }, - child: Container( - width: outWidth, - height: outWidth, - padding: EdgeInsets.all(4), - child: Image.asset('assets/images/icon_head.webp'), - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - boxShadow: [ - BoxShadow( - color: - Theme.of(context).primaryColor.withAlpha(128), - offset: Offset(.5, .5), - spreadRadius: .5, - blurRadius: .5) - ], - borderRadius: - BorderRadius.all(Radius.circular(outWidth / 2))), + child: Opacity( + opacity: 0.7, + child: Container( + width: outWidth, + height: outWidth, + padding: EdgeInsets.all(4), + child: Image.asset('assets/images/icon_head.webp'), + decoration: BoxDecoration( + color: Theme.of(context).primaryColor, + boxShadow: [ + BoxShadow( + color: + Theme.of(context).primaryColor.withAlpha(128), + offset: Offset(.5, .5), + spreadRadius: .5, + blurRadius: .5) + ], + borderRadius: + BorderRadius.all(Radius.circular(outWidth / 2))), + ), )), PictureFrame( alignment: Alignment.center,