getWidth method
double
getWidth(
- dynamic context,
- dynamic currentState
)
Implementation
double getWidth(context, currentState) {
var width = 330.0;
switch (currentState) {
case InputState.NUMBER:
width =
textSize('XXXX XXXX XXXX XXXX', kCardDefaultTextStyle).width + 10;
break;
case InputState.NAME:
String name = Provider.of<CardNameProvider>(context).cardName;
if (name.isEmpty) {
name = 'NAME SURNAME';
}
width = textSize(name.toUpperCase(), kNametextStyle).width + 10;
break;
case InputState.CVV:
case InputState.VALIDATE:
width = textSize('MM/YY', kNametextStyle).width + 10;
break;
}
return width;
}