61 lines
1.4 KiB
Dart
61 lines
1.4 KiB
Dart
// Author: fengshengxiong
|
|
// Date: 2024/5/7
|
|
// Description: BaseTextButton
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:hello_wallpaper/res/themes/app_styles.dart';
|
|
|
|
class BaseTextButton extends StatelessWidget {
|
|
final double? width;
|
|
final double? height;
|
|
final ButtonStyle? buttonStyle;
|
|
final Color? bgColor;
|
|
final double? radius;
|
|
final String? label;
|
|
final TextStyle? textStyle;
|
|
final Widget? child;
|
|
final Function()? onTap;
|
|
|
|
const BaseTextButton({
|
|
super.key,
|
|
this.label,
|
|
this.width,
|
|
this.height,
|
|
this.buttonStyle,
|
|
this.bgColor,
|
|
this.radius,
|
|
this.textStyle,
|
|
this.child,
|
|
this.onTap,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return SizedBox(
|
|
width: width,
|
|
height: height,
|
|
child: TextButton(
|
|
onPressed: onTap,
|
|
style: buttonStyle ??
|
|
baseTextButtonStyle(
|
|
bgColor: bgColor,
|
|
radius: radius,
|
|
),
|
|
child: child ??
|
|
Text(
|
|
label ?? '',
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
style: textStyle ??
|
|
TextStyle(
|
|
color: const Color(0xFF333333),
|
|
fontSize: 16.sp,
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|