import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import '../../base/base_style.dart'; class PloneBottom extends StatefulWidget { final String text; final Color color1; final Color color2; final Color textColor; final Function() onTap; final bool blM; //是否间距 final bool border; //是否有边框 const PloneBottom({ Key? key, this.text = '返回首页', this.color1 = const Color(0xFF0593FF), this.color2 = const Color(0xFF027AFF), this.textColor = kForeGroundColor, this.blM = true, this.border = false, required this.onTap, }); @override State createState() => _PloneBottomState(); } class _PloneBottomState extends State { @override Widget build(BuildContext context) { return GestureDetector( onTap: widget.onTap, child: Material( color: Colors.transparent, child: Container( alignment: Alignment.center, padding: EdgeInsets.symmetric(vertical: 15.w), margin: widget.blM ? EdgeInsets.symmetric(horizontal: 32.w) : EdgeInsets.only(left: 0.w), decoration: BoxDecoration( border: Border.all( color: const Color(0xFF1890FF), width: !widget.border ? 1.w : 10.w), gradient: LinearGradient( begin: Alignment.centerLeft, end: Alignment.centerRight, colors: [widget.color1, widget.color2]), borderRadius: BorderRadius.circular(8.w)), child: Text( widget.text, style: TextStyle( fontSize: BaseStyle.fontSize28, color: widget.textColor), ), ), ), ); } }