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

寻找徐州网站开发台州建设银行官方网站

寻找徐州网站开发,台州建设银行官方网站,杭州宣传片制作公司,搜狐快站生成app目录 前言 需求 实现 前言 最近闲着无聊学习了flutter的一下知识#xff0c;发现flutter和安卓之间#xff0c;页面开发的方式还是有较大的差异的#xff0c;众所周知#xff0c;android的页面开发都是写在xml文件中的#xff0c;而flutter直接写在代码里#xff08;da…目录 前言 需求 实现 前言 最近闲着无聊学习了flutter的一下知识发现flutter和安卓之间页面开发的方式还是有较大的差异的众所周知android的页面开发都是写在xml文件中的而flutter直接写在代码里dart文件中从目前我的认识来看两者在UI上的“套娃”方式flutter更能套简直就是“套中套”啊哈哈。比如今天的手写一个最简单的自定义按钮吧效果如下图所示 需求 带文本的普通按钮可修改字体大小和字体颜色提供修改背景色按下后的背景色支持支持圆角和边框提供点击事件的回调 这几个需求还是毕竟常用的目前没考虑渐变色和图标具体需求具体改吧 实现 本次demo的代码本身属于练手相当于flutter的hello world(毕竟我才刚了解flutter没几天。 以下是具体的代码实现 import package:flutter/material.dart;class CustomTextButton extends StatefulWidget {//按钮的宽度final double? width;//按钮的长度final double? height;final String text;final double? textSize;final Color textColor;final Color backgroundColor;final Color pressedBackgroundColor;final VoidCallback onClick;final double borderRadius;final Color borderColor;const CustomTextButton({super.key,required this.onClick,required this.text,this.textSize 16,this.width double.infinity,required this.height,this.backgroundColor Colors.white,this.pressedBackgroundColor Colors.white,this.borderRadius 0.0,this.borderColor Colors.white,this.textColor Colors.black});overrideStateCustomTextButton createState() _CustomTextButtonState(); }class _CustomTextButtonState extends StateCustomTextButton {bool _isPressed false;overrideWidget build(BuildContext context) {return ConstrainedBox(constraints:BoxConstraints.expand(width: widget.width, height: widget.height),child: GestureDetector(onTap: () {widget.onClick();},onTapDown: (details) {setState(() {_isPressed true;});},onTapUp: (details) {setState(() {_isPressed false;});},child: Container(alignment: Alignment.center,decoration: BoxDecoration(color: _isPressed? widget.pressedBackgroundColor: widget.backgroundColor,borderRadius: BorderRadius.circular(widget.borderRadius),border: Border.fromBorderSide(BorderSide(width: 1, color: widget.borderColor))),child: Text(widget.text,maxLines: 1,overflow: TextOverflow.ellipsis,style: TextStyle(color: widget.textColor,fontSize: widget.textSize,fontStyle: FontStyle.normal,),),),),);} }extension HexColor on Color {/// String is in the format aabbcc or ffaabbcc with an optional leading #.static Color fromHex(String hexString) {final buffer StringBuffer();if (hexString.length 6 || hexString.length 7) buffer.write(ff);buffer.write(hexString.replaceFirst(#, ));return Color(int.parse(buffer.toString(), radix: 16));}}代码演示如何使用这个还是非常简单易懂的有什么需要改进的地方也请大佬指示改进。 Container(margin: const EdgeInsets.only(left: 20, right: 20),child: CustomTextButton(text: 注册,textSize: 18,textColor: Colors.white,backgroundColor: HexColor.fromHex(F9AC00),pressedBackgroundColor: HexColor.fromHex(E0CE32),height: 44,borderRadius: 30,onClick: () {Fluttertoast.showToast(msg: 您按了注册,toastLength: Toast.LENGTH_SHORT,gravity: ToastGravity.BOTTOM,timeInSecForIosWeb: 1,backgroundColor: Colors.black12,textColor: Colors.black,fontSize: 14.0);},),),
http://www.hkea.cn/news/14442188/

相关文章:

  • 电子工程师兼职平台seo收录查询工具
  • 青岛福瀛建设集团有限公司网站深圳有名的做公司网站
  • 陕西交通建设集团蓝商公司网站营业执照申请网站
  • 企业网站建设 英铭遵义在线招聘
  • 网站开发武胜招聘建网站有域名和主机
  • 网站开发文档源码商城网站优化方案
  • 如何制作网站的步骤wordpress中文分享插件
  • 口碑好的网站设计制作价格电子商务网站建设的盈利模式
  • php做的静态网站怎么加密wordpress 模拟数据
  • 建网站不花钱免费海口网站建设介绍
  • 做零食网站的首页模板上海企业信息查询公示系统
  • 泰安哪家做网站好网站开发教程
  • 农村电商网站建设如何注册公司名称
  • 机械建设网站制作如何建设一个文件分享网站
  • 网站建设ppt演示文稿毕业设计网站选题
  • 没有网站怎样做搜索引擎推广用ps做简单的网页设计
  • 东软网站建设新加坡网络公司排名
  • 做网站 需求河北网站建设流程
  • 重庆网站建设找重庆万为唯爱wordpress主题
  • 网站怎么做外链接地址网页设计与制作教程psd格式
  • 建设部网站监理注销查询电商设计需要学什么软件有哪些
  • 安丘做网站的公司农业公园网站建设
  • 南京关键词网站排名开发网站性能监控
  • wordpress建站教程简书东莞seo搜索
  • 做国外的众筹网站有哪些营销方案100例免费
  • 网站建设模型软件成都网页设计培训机构
  • 盐城网站建设制作方案网站的程序和数据库怎么做的
  • 在百度怎么做网站jfinal网站开发
  • 莱芜亓家网站网站广告文案
  • 凯里网站建设公司哪家好制作网站怎么做