sapaly_store/lib/common/custom_button.dart

53 lines
1.4 KiB
Dart
Raw Normal View History

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,
),
),
margin: EdgeInsets.symmetric(
vertical: 5.adaptedPx(),
),
2023-03-08 21:35:20 +00:00
child: TextButton(
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,
2023-03-09 08:29:03 +00:00
fontSize: 15.adaptedPx(),
),
),
),
);
}
}