131 lines
3.6 KiB
Dart
131 lines
3.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
class CustomButton extends StatelessWidget {
|
|
final String text;
|
|
final Function onPressed;
|
|
final Color backgroundColor;
|
|
final double width;
|
|
final double height;
|
|
final Color textColor;
|
|
|
|
const CustomButton({
|
|
Key? key,
|
|
required this.text,
|
|
required this.onPressed,
|
|
this.backgroundColor = const Color(0xFFD90B2E),
|
|
this.width = double.infinity,
|
|
this.height = 50.0,
|
|
this.textColor = Colors.white,
|
|
}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return ElevatedButton(
|
|
onPressed: () {
|
|
onPressed();
|
|
},
|
|
style: ElevatedButton.styleFrom(
|
|
backgroundColor: backgroundColor,
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(30)),
|
|
minimumSize: Size(width, height),
|
|
),
|
|
child: FittedBox(
|
|
fit: BoxFit.contain,
|
|
child: Text(
|
|
text,
|
|
textAlign: TextAlign.center,
|
|
style: TextStyle(
|
|
fontFamily: "Helvetica",
|
|
fontWeight: FontWeight.w400,
|
|
fontSize: 16.sp,
|
|
color: Color(0xFFFCFCFC),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class CustomButton2 extends StatelessWidget {
|
|
final String text;
|
|
final Function onPressed;
|
|
// final Color backgroundColor;
|
|
final double width;
|
|
final double height;
|
|
final Color textColor;
|
|
|
|
const CustomButton2({
|
|
Key? key,
|
|
required this.text,
|
|
required this.onPressed,
|
|
// this.backgroundColor = const Color(0xFF434A53),
|
|
this.width = double.infinity,
|
|
this.height = 50.0,
|
|
this.textColor = Colors.white,
|
|
}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return InkWell(
|
|
onTap: onPressed(),
|
|
child: Container(
|
|
width: double.infinity,
|
|
height: 50.h,
|
|
decoration: ShapeDecoration(
|
|
gradient: LinearGradient(
|
|
begin: Alignment(-1.00, 0.02),
|
|
end: Alignment(1, -0.02),
|
|
colors: [
|
|
Colors.white.withOpacity(0.09000000357627869),
|
|
Colors.white.withOpacity(0.11999999731779099)
|
|
],
|
|
),
|
|
shape: RoundedRectangleBorder(
|
|
side: BorderSide(width: 1, color: Colors.white.withOpacity(0.3)),
|
|
borderRadius: BorderRadius.circular(30),
|
|
),
|
|
),
|
|
child: Center(
|
|
child: Text(
|
|
text,
|
|
textAlign: TextAlign.center,
|
|
style: TextStyle(
|
|
color: Color(0xFFFCFCFC),
|
|
fontSize: 16.sp,
|
|
fontFamily: 'Helvetica',
|
|
fontWeight: FontWeight.w400,
|
|
),
|
|
),
|
|
),
|
|
));
|
|
|
|
// ElevatedButton(
|
|
// onPressed: () {
|
|
// onPressed();
|
|
// },
|
|
// style: ElevatedButton.styleFrom(
|
|
// backgroundColor: Colors.white.withOpacity(0.09000000357627869),
|
|
// // Color(0XFFFFFFFF).withOpacity(0.54),
|
|
// shape: RoundedRectangleBorder(
|
|
// side: BorderSide(width: 1, color: Colors.white.withOpacity(0.3)),
|
|
// borderRadius: BorderRadius.circular(30)),
|
|
// minimumSize: Size(width, height),
|
|
// ),
|
|
// child: FittedBox(
|
|
// fit: BoxFit.contain,
|
|
// child: Text(
|
|
// text,
|
|
// textAlign: TextAlign.center,
|
|
// style: TextStyle(
|
|
// fontFamily: "Helvetica",
|
|
// fontWeight: FontWeight.w400,
|
|
// fontSize: 16.sp,
|
|
// color: Color(0xFFFCFCFC),
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// );
|
|
}
|
|
}
|