/* * @Author : WuWei * @LastEditors : WuWei * @Date : 2022-11-02 10:26:39 * @LastEditTime : 2022-11-08 11:00:24 * @Description : Do not edit */ import 'package:flutter/material.dart'; import 'package:wisdom_cli/wisdom_cli.dart'; ///小圆点 class WDot extends StatelessWidget { const WDot({ Key? key, this.onTap, this.child, this.padding = EdgeInsets.zero, this.color = Colors.red, this.textStyle, this.constraints, this.iconTheme, this.behavior = HitTestBehavior.opaque, }) : super(key: key); ///右上角删除按钮 WDot.delete({ Key? key, this.onTap, this.behavior = HitTestBehavior.opaque, this.padding = EdgeInsets.zero, this.color = Colors.black45, this.textStyle, this.constraints, this.iconTheme, }) : this.child = Icon(Icons.close), super(key: key); final HitTestBehavior behavior; final void Function()? onTap; final EdgeInsetsGeometry padding; final Color color; final BoxConstraints? constraints; final IconThemeData? iconTheme; final TextStyle? textStyle; final Widget? child; @override Widget build(BuildContext context) { Widget current = DefaultTextStyle( style: TextStyle( fontSize: 10.pt, color: Colors.white, ).merge(textStyle), child: IconTheme( data: IconThemeData( size: 15.pt, color: Colors.white, ).merge(iconTheme), child: Container( padding: padding, constraints: constraints, decoration: BoxDecoration( color: color, borderRadius: BorderRadius.circular(1000), ), child: child, ), ), ); if (onTap != null) { current = GestureDetector( behavior: behavior, onTap: onTap, child: current, ); } return current; } }