Formatting and dart analyze fixes

This commit is contained in:
Nathan Anderson 2023-11-14 17:34:11 -07:00
parent f23805a3a8
commit 1668ab8947
3 changed files with 13 additions and 13 deletions

View File

@ -68,7 +68,7 @@ class _MyHomePageState extends State<MyHomePage> {
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
const Text(
'Enter your card details below:',
),
CardTextField(

View File

@ -37,7 +37,6 @@ class CardDetails {
int _lastCheckHash = 0;
CardProvider? provider;
/// Checks the validity of the `CardDetails` and returns the result.
ValidState get validState {
checkIsValid();
@ -269,7 +268,7 @@ enum CardProviderID {
class CardProvider {
CardProviderID id;
List<int>? innValidNums;
List<_Range>? innValidRanges;
List<Range>? innValidRanges;
int cardLength;
int cvcLength;
@ -290,11 +289,11 @@ class CardProvider {
/// Object for `CardProvider` to determine valid number ranges.
/// A loose wrapper on a tuple, that provides assertion of
/// valid inputs and the `isWithin()` helper function.
class _Range {
class Range {
int high;
int low;
_Range({required this.low, required this.high}) {
Range({required this.low, required this.high}) {
assert(low <= high);
}
@ -328,7 +327,7 @@ List<CardProvider> _providers = [
cardLength: 16,
cvcLength: 3,
innValidNums: [60, 65],
innValidRanges: [_Range(low: 644, high: 649)],
innValidRanges: [Range(low: 644, high: 649)],
),
CardProvider(
id: CardProviderID.jcb,
@ -340,7 +339,7 @@ List<CardProvider> _providers = [
id: CardProviderID.mastercard,
cardLength: 16,
cvcLength: 3,
innValidRanges: [_Range(low: 22, high: 27), _Range(low: 51, high: 55)],
innValidRanges: [Range(low: 22, high: 27), Range(low: 51, high: 55)],
),
CardProvider(
id: CardProviderID.visa,

View File

@ -33,6 +33,7 @@ class CardTextField extends StatefulWidget {
final BoxDecoration? boxDecoration; // TODO unapplied style
final BoxDecoration? errorBoxDecoration; // TODO unapplied style
final double width;
/// Callback that returns the completed CardDetails object
final void Function(CardDetails) onCardDetailsComplete;
final double? height;