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

软件公司做网站吗阿里企业邮箱登录

软件公司做网站吗,阿里企业邮箱登录,wordpress 添加ico,做网站推广要注意什么flutter开发实战-实现自定义按钮类似UIButton效果 最近开发过程中需要实现一下UIButton效果的flutter按钮#xff0c;这里使用的是监听手势点击事件。 一、GestureDetector GestureDetector属性定义 GestureDetector({super.key,this.child,this.onTapDown,this.onTapUp,t…flutter开发实战-实现自定义按钮类似UIButton效果 最近开发过程中需要实现一下UIButton效果的flutter按钮这里使用的是监听手势点击事件。 一、GestureDetector GestureDetector属性定义 GestureDetector({super.key,this.child,this.onTapDown,this.onTapUp,this.onTap,this.onTapCancel,this.onSecondaryTap,this.onSecondaryTapDown,this.onSecondaryTapUp,this.onSecondaryTapCancel,this.onTertiaryTapDown,this.onTertiaryTapUp,this.onTertiaryTapCancel,this.onDoubleTapDown,this.onDoubleTap,this.onDoubleTapCancel,this.onLongPressDown,this.onLongPressCancel,this.onLongPress,this.onLongPressStart, ...由于属性太多我们实现onTapDown、onTapUp、onTapCancel、onTap。 二、实现flutter自定义按钮 实现自定义按钮类似我们实现onTapDown、onTapUp、onTapCancel、onTap这几个方法 return GestureDetector(onTapDown: handleTapDown,// 处理按下事件onTapUp: handleTapUp,// 处理抬起事件onTap: handleTap,onTapCancel: handleTapCancel, }void handleTapDown(TapDownDetails details) {if (widget.enabled ! null widget.enabled true) {setState(() {_highlighted true;});}}void handleTapUp(TapUpDetails details) {setState(() {_highlighted false;});}void handleTapCancel() {setState(() {_highlighted false;});}void handleTap() {if (widget.enabled ! null widget.enabled true) {setState(() {_highlighted true;});Future.delayed(Duration(milliseconds: 100), () {if (mounted) {setState(() {_highlighted false;});}});if (widget.enabled ! null widget.enabled true) {widget.onPressed();}}}完整代码如下 import package:flutter/material.dart; import package:flutter/cupertino.dart;//枚举类的声明 enum ButtonAlignment { Center, Left, Right }class ButtonWidget extends StatefulWidget {const ButtonWidget({Key? key,this.bgColor,this.bgHighlightedColor,this.color,this.highlightedColor,this.disableColor,this.bgDisableColor,this.width,this.height,this.borderRadius,this.buttonAlignment: ButtonAlignment.Center,this.text: ,this.textFontSize,this.icon,this.iconTextPadding,required this.onPressed,this.enabled true,required this.child,this.border,this.padding,}) : super(key: key);final Color? bgColor; // 背景颜色final Color? bgHighlightedColor; // 背景点击高亮颜色final Color? color;final Color? highlightedColor;final Color? disableColor;final Color? bgDisableColor;final double? width;final double? height;final VoidCallback onPressed;final double? borderRadius;final ButtonAlignment? buttonAlignment;final String? text;final double? textFontSize;final Icon? icon;final double? iconTextPadding;final bool? enabled;final Widget child;final Border? border;final EdgeInsetsGeometry? padding;override_ButtonWidgetState createState() _ButtonWidgetState(); }class _ButtonWidgetState extends StateButtonWidget {bool _highlighted false;overridevoid initState() {// TODO: implement initStatesuper.initState();_highlighted false;}void handleTapDown(TapDownDetails details) {if (widget.enabled ! null widget.enabled true) {setState(() {_highlighted true;});}}void handleTapUp(TapUpDetails details) {setState(() {_highlighted false;});}void handleTapCancel() {setState(() {_highlighted false;});}void handleTap() {if (widget.enabled ! null widget.enabled true) {setState(() {_highlighted true;});Future.delayed(Duration(milliseconds: 100), () {if (mounted) {setState(() {_highlighted false;});}});if (widget.enabled ! null widget.enabled true) {widget.onPressed();}}}AlignmentGeometry showAlignment(ButtonAlignment? buttonAlignment) {AlignmentGeometry alignment Alignment.center;if (buttonAlignment ! null) {if (buttonAlignment ButtonAlignment.Left) {alignment Alignment.centerLeft;} else if (buttonAlignment ButtonAlignment.Right) {alignment Alignment.centerRight;} else {alignment Alignment.center;}}return alignment;}overrideWidget build(BuildContext context) {return GestureDetector(onTapDown: handleTapDown,// 处理按下事件onTapUp: handleTapUp,// 处理抬起事件onTap: handleTap,onTapCancel: handleTapCancel,child: Container(padding: widget.padding,width: widget.width,height: widget.height,alignment: showAlignment(widget.buttonAlignment),decoration: BoxDecoration(color: boxDecorationBgColor(),borderRadius: BorderRadius.circular(widget.borderRadius ?? 0),border: widget.border),child: widget.child,),);}Color? boxDecorationBgColor() {if (widget.enabled ! null widget.enabled true) {return (_highlighted ? widget.bgHighlightedColor : widget.bgColor);}return widget.bgDisableColor ?? widget.bgColor;}Color? textColor() {if (widget.enabled ! null widget.enabled true) {return (_highlighted ? widget.highlightedColor : widget.color);}return widget.disableColor ?? widget.bgColor;} }三、小结 flutter开发实战-实现自定义按钮类似UIButton效果通过监听手势GestureDetector的onTapDown、onTapUp、onTapCancel、onTap来实现按下背景变换松开背景恢复默认等效果。 学习记录每天不停进步。
http://www.ho-use.cn/article/10820754.html

相关文章:

  • 知名网站定制报价七牛云 wordpress
  • 银川公司网站建设专业营销网站带客
  • 酒店网站建设方案建设网站基础知识
  • 最牛网站设计公司做外贸需要几个网站
  • 广西网站建设哪里有如何申请二级域名
  • 做网站交互效果用什么软件网站开发报价明细
  • 怎么做网站服务器系统游戏门户网站开发资源
  • 文山网站开发wordpress 手册
  • 腾讯快速建站平台空气炸锅做糕点的网站
  • 网站建设怎么付款关键词优化的发展趋势
  • 石家庄网站定做模板网站建设开发
  • 漳平建设局网站重庆网站建设方案详细方案
  • 做移动网站快速排电子商务网站建设初学视频教程
  • 优质做网站哪家正规手机网页游戏排行榜前十
  • 旅游网站建设策划方案自助 建网站
  • 黑龙江新闻最新消息今天百度seo排名优化是什么
  • 免费公司建站服务器个人买能干什么
  • 网站建设算加工承揽合同吗太原定制网站开发制作
  • 深圳快速网站制图文型官网站
  • 网站的做网站的公司专业网站设计第三方服务
  • 长春求推荐好的网站优化推广教育机构有哪些
  • 深圳外贸网站怎么建怎么根据街景图片找地址
  • 网站域名列表怎么填写网站数据库丢失
  • 如何进入网站后台地址泸州本地网站建设
  • 外贸类网站建设诊断网站seo现状的方法
  • 优度网站建设找附近工作招聘信息
  • 沈阳网站关键词网络营销的基本方式
  • win2003创建网站外包公司值得去吗
  • 潍坊网站建设方案网站开发硬件环境
  • 给别人做网站多少钱wordpress rtmp