2023-03-08 15:40:07 +00:00
|
|
|
import 'package:adaptix/adaptix.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
|
|
import '../constants/global_variables.dart';
|
|
|
|
|
import '../themes/app_theme.dart';
|
|
|
|
|
|
|
|
|
|
class CustomButton extends StatelessWidget {
|
|
|
|
|
const CustomButton({
|
|
|
|
|
Key? key,
|
|
|
|
|
required this.name,
|
|
|
|
|
required this.onTap,
|
|
|
|
|
required this.backgroundColor,
|
|
|
|
|
required this.isMain,
|
|
|
|
|
}) : super(key: key);
|
|
|
|
|
final String name;
|
|
|
|
|
final Color backgroundColor;
|
|
|
|
|
final bool isMain;
|
|
|
|
|
final void Function() onTap;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return Container(
|
|
|
|
|
height: GlobalVariables.deviceHeight(context) / 15,
|
|
|
|
|
width: double.infinity,
|
2023-03-08 21:35:20 +00:00
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
border: Border.all(
|
|
|
|
|
color: Colors.transparent,
|
|
|
|
|
width: 0,
|
|
|
|
|
),
|
|
|
|
|
),
|
2023-03-08 15:40:07 +00:00
|
|
|
margin: EdgeInsets.symmetric(
|
|
|
|
|
vertical: 5.adaptedPx(),
|
|
|
|
|
),
|
2023-03-08 21:35:20 +00:00
|
|
|
child: TextButton(
|
2023-03-08 15:40:07 +00:00
|
|
|
onPressed: onTap,
|
|
|
|
|
style: TextButton.styleFrom(
|
|
|
|
|
backgroundColor: backgroundColor,
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadius.circular(10.adaptedPx()),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
child: Text(
|
|
|
|
|
name,
|
|
|
|
|
style: Theme.of(context).primaryTextTheme.bodyMedium?.copyWith(
|
|
|
|
|
color: isMain ? AppTheme.whiteColor : AppTheme.blackColor,
|
|
|
|
|
fontSize: 14.adaptedPx(),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|