Flutter曲线插值插件catmull_rom_spline_curve的使用
Flutter曲线插值插件catmull_rom_spline_curve的使用
标题
Flutter曲线插值插件catmull_rom_spline_curve的使用
内容
<h1 class="hash-header" id="catmull-rom-curve">Catmull-Rom 曲线 <a href="#catmull-rom-curve" class="hash-link">#</a></h1>
<h2 class="hash-header" id="platform-support">平台支持 <a href="#platform-support" class="hash-link">#</a></h2>
<table>
<thead>
<tr>
<th align="center">Android</th>
<th align="center">iOS</th>
<th align="center">MacOS</th>
<th align="center">Web</th>
<th align="center">Linux</th>
<th align="center">Windows</th>
</tr>
</thead>
<tbody>
<tr>
<td align="center">✅</td>
<td align="center">✅</td>
<td align="center">✅</td>
<td align="center">✅</td>
<td align="center">✅</td>
<td align="center">✅</td>
</tr>
</tbody>
</table>
<h2 class="hash-header" id="features">功能 <a href="#features" class="hash-link">#</a></h2>
<p>现在你可以轻松绘制拟合曲线,只需提供点偏移。</p>
<h2 class="hash-header" id="screenshot">截图 <a href="#screenshot" class="hash-link">#</a></h2>
<img src="https://i.ibb.co/MMkc2N3/Simulator-Screenshot-i-Phone-12-2023-10-09-at-20-44-27.png" width="250">
<h2 class="hash-header" id="getting-started">开始 <a href="#getting-started" class="hash-link">#</a></h2>
<p>使用 CatmullCurve.drawCurve() 函数,该函数将返回一个 CustomPaint,等待放置在你的<strong>受约束大小</strong>Widget 中。</p>
<h2 class="hash-header" id="constraints">约束条件 <a href="#constraints" class="hash-link">#</a></h2>
<p>必需:
- List of Offset "曲线上的点",
- Color "曲线颜色"
- double "曲线描边宽度"
- PaintingStyle "定义曲线样式"</p>
<p>可选:
- bool drawPoints "如果要绘制曲线上的点,请设置为 true"
- double? pointsStrokeWidth "指定点的描边宽度,默认设置为曲线描边宽度的两倍"
- Color pointcolor "指定点的颜色,默认为红色"</p>
<h2 class="hash-header" id="usage">使用 <a href="#usage" class="hash-link">#</a></h2>
<p>1 - 导入包 "import 'package:catmull_rom_spline_curve/catmull_rom_spline_curve.dart';"</p>
<p>2- 在你的受约束大小 Widget 中,调用函数 CatmullCurve.drawCurve() 并传递相应的参数</p>
<p>3- 完成!</p>
<pre><code class="language-dart"> SizedBox(
width: 2,
height: 2,
child: CatmullCurve.drawCurve(
[
Offset(0, 2),
Offset(2, e),
Offset(e, 0),
],
Colors.red,
2,
PaintingStyle.stroke,
pointcolor: Colors.blue,
drawPoints: true,
pointsStrokeWidth: 8,
),
),
</code></pre>
<h2 class="hash-header" id="additional-information">附加信息 <a href="#additional-information" class="hash-link">#</a></h2>
<ul>
<li><a href="https://pub.dev/documentation/catmull_rom_spline_curve/latest/catmull_rom_spline_curve/catmull_rom_spline_curve-library.html">API 文档</a></li>
<li><a href="https://www.linkedin.com/in/moaly2001/" rel="ugc">发布者 LinkedIn 链接</a></li>
<li><a href="mailto:moaly909@gmail.com">发布者邮箱</a></li>
</ul>
</section>
示例代码
更多关于Flutter曲线插值插件catmull_rom_spline_curve的使用的实战教程也可以访问 https://www.itying.com/category-92-b0.html
1 回复