Files
GSFV2/gsf/lib/views/components/btn.dart
2024-04-10 12:51:20 +05:30

141 lines
4.0 KiB
Dart

import 'package:flutter/material.dart';
import '../theme.dart';
// class FullWdtBtn extends StatelessWidget {
// const FullWdtBtn({
// Key? key,
// required this.btnText,
// required this.onTap,
// this.styleElement,
// }) : super(key: key);
// final String btnText;
// // final IconData icon;
// final VoidCallback onTap;
// final TextStyle? styleElement;
// @override
// Widget build(BuildContext context) {
// final screenSize = MediaQuery.of(context).size;
// return InkWell(
// onTap: onTap,
// child: Container(
// width: screenSize.width * 1,
// height: 50,
// decoration: BoxDecoration(
// color: ColorConstants.kPrimaryColor,
// borderRadius: BorderRadius.circular(30),
// ),
// child: Center(
// child: Text(
// btnText,
// style: styleElement ??
// const TextStyle(
// fontSize: 16,
// color: Color(0xff000000),
// fontWeight: FontWeight.w500,
// fontFamily: 'Poppins',
// ),
// ),
// ),
// ),
// );
// }
// }
class FullWdtBtn extends StatelessWidget {
final String btnText;
// final IconData icon;
final VoidCallback onTap;
final TextStyle? styleElement;
final bool isBgTransparent;
final bool disabled;
const FullWdtBtn({
Key? key,
required this.btnText,
required this.onTap,
this.styleElement,
this.isBgTransparent = false,
this.disabled = false,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return ElevatedButton(
style: ElevatedButton.styleFrom(
elevation: isBgTransparent ? 0 : null,
shape: const StadiumBorder(),
backgroundColor: isBgTransparent
? const Color.fromARGB(43, 0, 0, 0)
: disabled?const Color.fromARGB(255, 70, 90, 25):ColorConstants.kPrimaryColor,
foregroundColor:
isBgTransparent ? ColorConstants.kWhite : ColorConstants.kBlack,
fixedSize: const Size(double.infinity, 50),
textStyle: TextStyle(
fontSize: 15,
color: isBgTransparent ? Colors.white : Colors.black,
fontWeight: FontWeight.w500,
fontFamily: 'Poppins',
),
),
// style: ButtonStyle(
// shape: MaterialStateProperty.all<RoundedRectangleBorder>(
// RoundedRectangleBorder(
// borderRadius: BorderRadius.circular(30.0),
// ),
// ),
// backgroundColor: MaterialStateProperty.all<Color>(
// isBgTransparent ? Colors.transparent : ColorConstants.kPrimaryColor,
// ),
// foregroundColor:
// MaterialStateProperty.all<Color>(ColorConstants.kBlack),
// fixedSize: MaterialStateProperty.all<Size>(
// const Size.fromHeight(50),
// ),
// ),
onPressed: onTap,
child: Center(
child: Text(btnText),
),
);
}
}
class FullWdtBtnLoader extends StatelessWidget {
const FullWdtBtnLoader({
Key? key,
required this.onTap,
this.styleElement,
}) : super(key: key);
// final IconData icon;
final VoidCallback onTap;
final TextStyle? styleElement;
@override
Widget build(BuildContext context) {
return ElevatedButton(
style: ButtonStyle(
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30.0),
),
),
backgroundColor: MaterialStateProperty.all<Color>(
ColorConstants.kPrimaryColor,
),
foregroundColor:
MaterialStateProperty.all<Color>(ColorConstants.kBlack),
fixedSize: MaterialStateProperty.all<Size>(
const Size.fromHeight(50),
),
),
onPressed: onTap,
child: const Center(
child: CircularProgressIndicator(
color: Colors.black,
),
),
);
}
}