当前位置: 首页 > news >正文

常州网站设计湛江公司电话专业建网站设计公司

常州网站设计湛江公司电话,专业建网站设计公司,福州网站改版,中国十大门窗品牌有哪些功能#xff1a;CustomPaint 相当于在一个画布上面画画#xff0c;可以自己绘制不同的颜色形状等 在各种widget 或者是插件不能满足到需求的时候#xff0c;可以自己定义一些形状 使用实例和代码#xff1a; CustomPaint#xff1a; 能使你绘制的东西显示在你的ui 上面CustomPaint 相当于在一个画布上面画画可以自己绘制不同的颜色形状等 在各种widget 或者是插件不能满足到需求的时候可以自己定义一些形状 使用实例和代码 CustomPaint 能使你绘制的东西显示在你的ui 上面 painter》child》oregroundPainterforegroundPainter最外面的一层会覆盖painterchild 层里面的widget. return Container(//painter 绘制完成之后需要再CustomPaint 里面构建称为widgetchild: Center(child: CustomPaint(child: Icon(Icons.abc,size: 40,color: Colors.red,),painter: MybackGroudnPaiter(), //最内一层// child: ,//子组件在中间foregroundPainter: ForegroundPainter(), //最外面一层也是 CustomPainter),),);CustomPainter 绘制 class MybackGroudnPaiter extends CustomPainter {overridevoid paint(Canvas canvas, Size size) {//canvas 画布size 画布的尺寸//在这边绘制// canvas.drawColor(Colors.red, BlendMode.color);var centerp size / 2;//定义画笔是什么颜色,样式画笔的宽度var paint Paint()..color Colors.teal..style PaintingStyle.fill..strokeWidth 2.0;canvas.drawRect(Rect.fromLTWH(centerp.width - 100, centerp.height - 100, 200, 200),paint);}overridebool shouldRepaint(covariant CustomPainter oldDelegate) {return true;} }class ForegroundPainter extends CustomPainter {overridevoid paint(Canvas canvas, Size size) {var centerp size / 2;//定义画笔是什么颜色,样式画笔的宽度var paint Paint()..color Colors.pink..style PaintingStyle.fill..strokeWidth 2.0;canvas.drawRect(Rect.fromLTWH(centerp.width - 130, centerp.height - 130, 200, 200),paint);}overridebool shouldRepaint(covariant CustomPainter oldDelegate) {// TODO: implement shouldRepaintreturn true;} } 绘画的能力 我们绘制1000个彩色点点从上往下掉落看看性能没有任何的卡顿真给力 import dart:math; import package:flutter/material.dart;void main() runApp(const MyApp());class MyApp extends StatelessWidget {const MyApp({Key? key}) : super(key: key);overrideWidget build(BuildContext context) {return const MaterialApp(home: Scaffold(backgroundColor: Colors.white,body: MyHomePage(title: jack ma,),),);} }class MyHomePage extends StatefulWidget {const MyHomePage({Key? key, required this.title}) : super(key: key);final String title;overrideStateMyHomePage createState() _MyHomePageState(); }class _MyHomePageState extends StateMyHomePagewith SingleTickerProviderStateMixin {late AnimationController _controller;final ListSnowflake _snowflakes List.generate(1000, (index) Snowflake());overridevoid initState() {;_controller AnimationController(vsync: this, duration: const Duration(seconds: 5))..repeat();super.initState();}overrideWidget build(BuildContext context) {return Scaffold(body: Center(child: SizedBox(width: double.infinity,height: double.infinity,child: AnimatedBuilder(animation: _controller,builder: (BuildContext context, Widget? child) {//一直在这边build5s 动画运行时间for (var snow in _snowflakes) {snow.fall();}return CustomPaint(painter: MyPainter(_snowflakes),);},),),));} }class MyPainter extends CustomPainter {final ListSnowflake _snowflakes;MyPainter(this._snowflakes);overridevoid paint(Canvas canvas, Size size) {final whitePaint Paint()..color Colors.grey;for (int i 0; i 1000; i) {whitePaint.color Colors.primaries[i % Colors.primaries.length];canvas.drawCircle(Offset(_snowflakes[i].x, _snowflakes[i].y),_snowflakes[i].radius, whitePaint);}}overridebool shouldRepaint(covariant CustomPainter oldDelegate) true; }class Snowflake {double x Random().nextDouble() * 400;double y Random().nextDouble() * 800;double radius Random().nextDouble() * 2 2;double velocity Random().nextDouble() * 4 2;void fall() {y velocity;if (y 800) {y 0;x Random().nextDouble() * 400;radius Random().nextDouble() * 2 2;velocity Random().nextDouble() * 4 2;}} }
http://www.w-s-a.com/news/283282/

相关文章:

  • 无锡网站制作需要多少钱北京二次感染最新消息
  • 网站开发视频播放无画面杭州房产信息网官网
  • 网站开发 改进如何创建公众号平台
  • wordpress网站响应很慢只有asp网站代码可以重新编译吗
  • 哪个网站教做饭做的好wordpress热点文章
  • 可以做推广东西的网站重庆网站建设 重庆网站制作
  • 珠海网站建设培训学校wordpress去版权 合法
  • 建设食品商购网站学校网站设计实验报告
  • 建个网站多少钱沭阳奥体小区做网站的
  • 广州视频网站建站公司php网页设计作业代码
  • 成都公司网站设计如何制作网址最简单的方法
  • 温州 做网站福建住房城乡建设部网站
  • 网站自动化采集成都网站设计费用
  • 广东专业网站定制建设淘宝网站的人员组织结构
  • 网站改版seo无锡有多少家公司
  • h5美食制作网站模板下载wordpress大学百度云
  • 零陵做网站建立网站的公司平台
  • 某企业电子商务网站建设网站开发实验结论
  • 自己做的网站突然打不开杭州哪些做网站公司好
  • 株洲专业建设网站免费cms内容管理系统
  • 网上建立网站赚钱网站建设方案书纯文字
  • 专业网站设计哪家好it外包合同模板
  • 个人网站备案都需要什么中小企业服务网
  • 佛山网站建设哪个在公司网站投简历该怎么做
  • 八戒网站做推广老域名全部失效请拿笔记好
  • iss服务器网站建设甘肃建设厅网站执业注册中心
  • 域名访问网站 过程网站 免费 托管运营
  • 下单的网站建设教程wordpress php7.1
  • 爱网站查询怎么做网站的图片跳转
  • 阿里云建站百度收录吗北京的设计公司排名