diff --git a/lib/credit_card_background.dart b/lib/credit_card_background.dart index 70e4942..4fc9a43 100644 --- a/lib/credit_card_background.dart +++ b/lib/credit_card_background.dart @@ -15,6 +15,7 @@ class CardBackground extends StatelessWidget { this.width, this.height, this.glassmorphismConfig, + required this.padding, }) : assert( (backgroundImage == null && backgroundNetworkImage == null) || (backgroundImage == null && backgroundNetworkImage != null) || @@ -29,6 +30,7 @@ class CardBackground extends StatelessWidget { final Glassmorphism? glassmorphismConfig; final double? width; final double? height; + final double padding; @override Widget build(BuildContext context) { @@ -43,7 +45,7 @@ class CardBackground extends StatelessWidget { alignment: Alignment.center, children: [ Container( - margin: const EdgeInsets.all(AppConstants.creditCardPadding), + margin: EdgeInsets.all(padding), decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), gradient: glassmorphismConfig != null @@ -69,8 +71,7 @@ class CardBackground extends StatelessWidget { width: width ?? screenWidth, height: height ?? (orientation == Orientation.portrait - ? (((width ?? screenWidth) - - (AppConstants.creditCardPadding * 2)) * + ? (((width ?? screenWidth) - (padding * 2)) * AppConstants.creditCardAspectRatio) : screenHeight / 2), child: ClipRRect( diff --git a/lib/credit_card_widget.dart b/lib/credit_card_widget.dart index 2ea8688..7691f0d 100644 --- a/lib/credit_card_widget.dart +++ b/lib/credit_card_widget.dart @@ -1,6 +1,7 @@ import 'dart:math'; import 'package:flutter/material.dart'; +import 'package:flutter_credit_card/constants.dart'; import 'credit_card_animation.dart'; import 'credit_card_background.dart'; @@ -44,6 +45,7 @@ class CreditCardWidget extends StatefulWidget { this.isSwipeGestureEnabled = true, this.customCardTypeIcons = const [], required this.onCreditCardWidgetChange, + this.padding = AppConstants.creditCardPadding, this.chipColor}) : super(key: key); @@ -74,6 +76,7 @@ class CreditCardWidget extends StatefulWidget { final CardType? cardType; final List customCardTypeIcons; + final double padding; @override _CreditCardWidgetState createState() => _CreditCardWidgetState(); @@ -264,6 +267,7 @@ class _CreditCardWidgetState extends State glassmorphismConfig: widget.glassmorphismConfig, height: widget.height, width: widget.width, + padding: widget.padding, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -388,6 +392,7 @@ class _CreditCardWidgetState extends State glassmorphismConfig: widget.glassmorphismConfig, height: widget.height, width: widget.width, + padding: widget.padding, child: Column( mainAxisAlignment: MainAxisAlignment.spaceAround, crossAxisAlignment: CrossAxisAlignment.start,