sapaly_store/lib/common/custom_button.dart

47 lines
1.2 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,
margin: EdgeInsets.symmetric(
vertical: 5.adaptedPx(),
),
child: OutlinedButton(
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(),
),
),
),
);
}
}