Untitled
unknown
dart
2 years ago
2.8 kB
3
Indexable
import 'package:centro/app/services/authentication/auth_manager.dart'; import 'package:centro/app/utilities/constants/app_colors.dart'; import 'package:centro/app/utilities/constants/gradients.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:get/get.dart'; class CentroButton extends StatelessWidget { final double width; final double height; final String text; final Icon? icon; final bool isIconed; // if true it will show the icon dependant on the cancel result (x for isCancel=true, tick for isCancel=false) final Function() onPressed; final bool isCancel; // if true it will turn the button to reddish gradient color, else (false) it will keep it as greenish gradient color const CentroButton( {Key? key, required this.isIconed, required this.text, this.icon, this.isCancel = false, required this.onPressed, required this.width, this.height = 50}) : super(key: key); @override Widget build(BuildContext context) { return Container( width: width, height: Get.height * 0.06, decoration: BoxDecoration( borderRadius: const BorderRadius.all(Radius.circular(8)), gradient: LinearGradient( colors: isCancel ? Gradients.cancelGradient : Gradients.normalGradient, begin: isCancel ? FractionalOffset.centerRight : FractionalOffset.centerLeft, end: isCancel ? FractionalOffset.centerLeft : FractionalOffset.centerRight, // tileMode: TileMode.repeated, // stops: const [0.0, 1.0], ), boxShadow: const [ BoxShadow( color: Colors.grey, offset: Offset(0.0, 0.5), blurRadius: 1.5, ), ]), child: Material( color: Colors.transparent, child: InkWell( onTap: onPressed, child: Center( child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Padding( padding: EdgeInsets.only(left: Get.width * 0.02), child: isIconed ? SvgPicture.asset( isCancel ? 'assets/icons/cancel_button.svg' : 'assets/icons/checkmark-circle.svg', ) : null, ), Text( text, style: textTheme.bodyText2.copyWith( color: AppColors.white, ), ), ], ), ), ), ), ); } }
Editor is loading...