import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import '../app_settings/app_colors.dart'; /* * 提交按钮 公用组件 * */ class SubmitBtn extends StatelessWidget { String? btnName; Function()? onClick; EdgeInsetsGeometry? margin; EdgeInsetsGeometry? padding; double? width; double? fontSize; Color? color; List? backgroundColorList; double? borderRadius; SubmitBtn( {Key? key, required this.btnName, this.borderRadius, this.color, this.padding, this.onClick, this.margin, this.width, this.backgroundColorList, this.fontSize}) : super(key: key); @override Widget build(BuildContext context) { return SizedBox( width: ScreenUtil().screenWidth - 40.w, height: 44, child: ElevatedButton( style: ElevatedButton.styleFrom( backgroundColor: AppColors.mainColor, ), onPressed: () { if (onClick != null) { onClick!(); } }, child: Text( btnName!, style: TextStyle(color: Colors.white, fontSize: 30.sp), )), ); /* return GestureDetector( child: Container( width: width??690.w, padding: padding??EdgeInsets.only( top: 20.w, bottom: 20.w ), margin: margin??EdgeInsets.only(top: 30.w), decoration: BoxDecoration( borderRadius: BorderRadius.circular(borderRadius ?? 10.w), gradient: LinearGradient( begin: Alignment.centerLeft, end: Alignment.centerRight, colors: backgroundColorList ?? [ AppColors.mainColor, AppColors.mainColor, ], )), child: Center( child: Text(btnName!, style: TextStyle( fontSize: fontSize ?? 30.sp, height: 1.3, decoration: TextDecoration.none, fontWeight: FontWeight.w500, color: color ?? Colors.white)), ), ), onTap: () { if (onClick != null) { onClick!(); } }, ); */ } }