72 lines
1.7 KiB
Dart
72 lines
1.7 KiB
Dart
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<Color>? 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 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??30.w),
|
|
gradient: LinearGradient(
|
|
begin: Alignment.centerLeft,
|
|
end: Alignment.centerRight,
|
|
colors: backgroundColorList??[
|
|
AppColors.mainColor,AppColors.mainColor,
|
|
],
|
|
)
|
|
),
|
|
child: Center(
|
|
child: Text(btnName!,style: TextStyle(
|
|
fontSize: fontSize??36.sp,
|
|
height: 1.3,
|
|
decoration: TextDecoration.none,
|
|
fontWeight: FontWeight.w500,
|
|
color: color??Colors.white
|
|
)),
|
|
),
|
|
),
|
|
onTap: (){
|
|
if(onClick!=null){
|
|
onClick!();
|
|
}
|
|
},
|
|
);
|
|
}
|
|
}
|