Files
tm_app/lib/views/login/widgets/login_button.dart
T
2025-08-06 08:06:27 +03:30

61 lines
1.7 KiB
Dart

import 'package:flutter/material.dart';
import '../../../core/constants/colors.dart';
import '../../../core/constants/strings.dart';
import '../../../core/utils/size_config.dart';
class BaseButton extends StatelessWidget {
final bool isEnabled;
final VoidCallback? onPressed;
final String? text;
final Color? textColor;
final Color? backgroundColor;
final Color? borderColor;
final double? borderWidth;
final double? borderRadius;
final double? elevation;
const BaseButton({
required this.isEnabled,
required this.onPressed,
this.text,
this.textColor,
this.backgroundColor,
this.borderColor,
this.borderWidth,
this.borderRadius,
this.elevation,
super.key,
});
@override
Widget build(BuildContext context) {
return SizedBox(
width: double.infinity,
height: 55.0.h(),
child: ElevatedButton(
onPressed: isEnabled ? onPressed : null,
style: ElevatedButton.styleFrom(
backgroundColor: backgroundColor ??
(isEnabled ? AppColors.mainBlue : Colors.grey[300]),
foregroundColor: textColor ?? Colors.white,
elevation: elevation ?? 0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(borderRadius ?? 28.0.w()),
side: BorderSide(
color: borderColor ?? Colors.transparent,
width: borderWidth ?? 0,
),
),
),
child: Text(
text ?? AppStrings.loginButton,
style: TextStyle(
fontSize: 16.0.sp(),
fontWeight: FontWeight.bold,
color: textColor ?? Colors.white,
),
),
),
);
}
}