Skip to content

Commit 3548635

Browse files
committed
new flutter sample
1 parent 3d27dbc commit 3548635

File tree

9 files changed

+688
-2
lines changed

9 files changed

+688
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ You can follow me on twitter [@diegoveloper](https://www.twitter.com/diegovelope
5454
| <center> <img src="https://media.giphy.com/media/RJn8BMmOzfaW101iS2/giphy.gif" width="250"> </center> | <center> <img src="https://media.giphy.com/media/MeP49gjvFbUDShkzJM/giphy.gif" width="250">
5555
</center>
5656

57-
| App Clone / Album Flow | |
57+
| App Clone / Album Flow | App Clone / Credit Cards Concept |
5858
|--|--|
5959
| <center> <center> <img src="https://media.giphy.com/media/emGlZPMbFpkNDrFuO7/giphy.gif" width="250"/>
60-
</center> <center> <center>
60+
</center> <center> <img src="https://media.giphy.com/media/UrsStRAMXOT93wwyP2/giphy.gif" width="250"/> <center>
6161
</center>
6262

images/credit_cards/chip.png

81.4 KB
Loading

images/credit_cards/chip_logo.png

48.1 KB
Loading
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import 'dart:math';
2+
import 'package:flutter/material.dart';
3+
import 'package:flutter/widgets.dart';
4+
5+
class CreditCard {
6+
final Color color;
7+
final String number;
8+
final String ccv;
9+
final double amount;
10+
11+
CreditCard({
12+
this.color,
13+
this.number,
14+
this.ccv,
15+
this.amount,
16+
});
17+
}
18+
19+
final Random random = new Random();
20+
21+
double doubleInRange(Random source, int start, int end) =>
22+
source.nextDouble() * (end - start) + start;
23+
24+
int _intInRange(Random source, int start, int end) =>
25+
start + source.nextInt(end - start);
26+
27+
String _getFourNumbers() => _intInRange(random, 1000, 9999).toString();
28+
29+
final creditCards = List.generate(
30+
20,
31+
(index) => CreditCard(
32+
amount: doubleInRange(random, 500, 20000),
33+
ccv: _getFourNumbers(),
34+
color: Colors.primaries[index % Colors.primaries.length],
35+
number:
36+
"${_getFourNumbers()} ${_getFourNumbers()} ${_getFourNumbers()} ${_getFourNumbers()}",
37+
),
38+
);

0 commit comments

Comments
 (0)