Files
Vocasia-LMS-Mobile-apps--TA…/lib/widgets/login_regist/default_button_payment.dart

95 lines
3.1 KiB
Dart

import 'package:flutter/material.dart';
import 'package:initial_folder/providers/theme_provider.dart';
import 'package:provider/provider.dart';
import '../../theme.dart';
import '../../size_config.dart';
class DefaultButtonPayment extends StatelessWidget {
const DefaultButtonPayment({
Key? key,
this.text = '',
this.weight = semiBold,
this.press,
this.isCart,
this.width,
this.height,
this.isInvoice,
}) : super(key: key);
final String text;
final FontWeight weight;
final VoidCallback? press;
final bool? isCart;
final bool? isInvoice;
final double? width;
final double? height;
@override
Widget build(BuildContext context) {
final themeProvider = Provider.of<ThemeProvider>(context);
return isInvoice == null
? SizedBox(
width: getProportionateScreenWidth(width ?? 0),
height: getProportionateScreenWidth(height ?? 0),
child: TextButton(
style: TextButton.styleFrom(
foregroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(
getProportionateScreenWidth(5),
),
),
backgroundColor: themeProvider.themeData == ThemeClass.darkmode
?primaryColor : primaryColorligtmode,
),
onPressed: press,
child: Text(
text,
style: thirdTextStyle.copyWith(
fontSize: getProportionateScreenWidth(12),
fontWeight: weight,
color: baruTextutih,
letterSpacing: 0.3),
),
),
)
: SizedBox(
width: getProportionateScreenWidth(width ?? 0),
height: getProportionateScreenWidth(height ?? 0),
child: TextButton(
style: TextButton.styleFrom(
foregroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(
getProportionateScreenWidth(5),
),
),
backgroundColor: primaryColor,
),
onPressed: press,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Icon(
Icons.file_download_outlined,
color: baruTextutih,
size: getProportionateScreenWidth(24),
),
SizedBox(width: getProportionateScreenWidth(3)),
Text(
text,
style: thirdTextStyle.copyWith(
fontSize: getProportionateScreenWidth(12),
fontWeight: weight,
color: baruTextutih,
letterSpacing: 0.3),
),
],
),
),
);
}
}