-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.dart
150 lines (147 loc) · 6.37 KB
/
main.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
import 'package:flutter/material.dart';
import 'package:money_display/money_display.dart';
void main() {
runApp(const MoneyDisplayExample());
}
class MoneyDisplayExample extends StatelessWidget {
const MoneyDisplayExample({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title:
const Text('Money Display Example'), // Setting the app bar title.
),
body: CustomScrollView(
slivers: [
const SliverToBoxAdapter(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Widget for displaying money with a euro symbol.
MoneyDisplayWidget(
192837465.2523432, // Set the price to be displayed.
currencySymbol:
CurrencySymbol.euro, // Set the currency symbol to euro.
showTrailingZeros:
false, // Determine whether to show trailing zeros.
currencySymbolSize:
26, // Set the size of the currency symbol.
currencySymbolColor: Color.fromARGB(255, 0, 43,
32), // Set the color of the currency symbol.
currencySymbolFontWeight: FontWeight
.w800, // Set the font weight of the currency symbol.
integerPartColor: Color.fromARGB(
255, 206, 192, 0), // Set the color of the integer part.
integerPartSize: 46, // Set the size of the integer part.
decimalPartColor:
Colors.purple, // Set the color of the decimal part.
),
// Widget for displaying Chinese money with custom options.
ChineseMoneyDisplayWidget(
9999879999.92347,
maxNum: 10000000000, // Set a maximum number for display.
integerColor:
Colors.blue, // Set the color of the integer part.
integerFontsize:
25, // Set the font size of the integer part.
decimalFontsize:
21, // Set the font size of the decimal part.
currencySymbolColor:
Colors.pink, // Set the color of the currency symbol.
tenThousandSymbol: 'w', // Set the ten thousand symbol.
tenThousandSymbolColor: Color.fromARGB(255, 0, 156,
78), // Set the color of the ten thousand symbol.
),
// Widget for displaying money with a custom currency symbol.
MoneyDisplayWidget(
12345, // Set the price to be displayed.
currencySymbol: CurrencySymbol
.custom, // Set the currency symbol to custom.
customCurrencySymbol:
'💲', // If using a custom currency symbol, set it here.
showTrailingZeros:
false, // Determine whether to show trailing zeros.
),
],
),
),
SliverGrid.count(
crossAxisCount: 4,
children: const [
Center(child: ChineseMoneyDisplayWidget(0.9)),
Center(child: ChineseMoneyDisplayWidget(0.17)),
Center(child: ChineseMoneyDisplayWidget(0.1796)),
Center(child: ChineseMoneyDisplayWidget(6)),
Center(child: ChineseMoneyDisplayWidget(6.1)),
Center(
child: ChineseMoneyDisplayWidget(
9.16,
decimalFontsize: 29,
integerColor: Color.fromARGB(255, 0, 150, 187),
),
),
Center(child: ChineseMoneyDisplayWidget(9.1671)),
Center(child: ChineseMoneyDisplayWidget(10)),
Center(child: ChineseMoneyDisplayWidget(10.7)),
Center(
child: ChineseMoneyDisplayWidget(
10.71,
integerFontsize: 25,
),
),
Center(child: ChineseMoneyDisplayWidget(999)),
Center(child: ChineseMoneyDisplayWidget(999.7)),
Center(
child: ChineseMoneyDisplayWidget(
999.99,
decimalDigitColor: Color.fromARGB(255, 80, 0, 133),
),
),
Center(child: ChineseMoneyDisplayWidget(1000)),
Center(child: ChineseMoneyDisplayWidget(1995.0)),
Center(child: ChineseMoneyDisplayWidget(1995.07)),
Center(child: ChineseMoneyDisplayWidget(6666.66)),
Center(child: ChineseMoneyDisplayWidget(9999)),
Center(
child: ChineseMoneyDisplayWidget(
99999,
currencyFontWeight: FontWeight.w900,
currencySymbolColor: Color.fromARGB(255, 22, 0, 148),
currencySymbolFontsize: 56,
),
),
Center(child: ChineseMoneyDisplayWidget(999999)),
Center(child: ChineseMoneyDisplayWidget(996786)),
Center(
child: ChineseMoneyDisplayWidget(
9999999), // maxNum defaults to 10000.
),
Center(
child: ChineseMoneyDisplayWidget(
9999999,
maxNum:
10000001, // Set a custom maximum number for display.
),
),
Center(
child: ChineseMoneyDisplayWidget(
9999999.97,
maxNum: 10000001,
integerColor: Colors.blue,
integerFontsize: 25,
decimalFontsize: 21,
currencySymbolColor: Colors.pink,
tenThousandSymbol: 'w',
tenThousandSymbolColor: Color.fromARGB(255, 0, 156, 78),
),
),
],
),
],
),
),
);
}
}