Skip to content

Commit 926ba86

Browse files
authored
Merge pull request #4 from sncf-connect-tech/release-0.0.8
Release 0.0.8
2 parents 824518d + a54d7f9 commit 926ba86

File tree

5 files changed

+73
-44
lines changed

5 files changed

+73
-44
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
1+
## 0.0.8
2+
3+
* Fixed SVG in all supported locales
4+
* Renamed Add*to*GoogleWalletButton to Add*To*GoogleWalletButton (with a capital T): AddToGoogleWalletButton still exists but is deprecated
5+
* The `badgeButton` field is now the `buttonType` field, and is now of type `GoogleWalletButtonType` which has 2 possible values:
6+
* `GoogleWalletButtonType.primary` which is equivalent to `badgeButton = false`
7+
* `GoogleWalletButtonType.condensed` which is equivalent to `badgeButton = true`
8+
* The field `removeSvgPackage` has been renamed to `useInternalAssetPackage`
9+
* The field `langue` has been renamed to `locale`, and is now of type `Locale`
10+
111
## 0.0.7
212

313
* Fix spain locale
14+
415
## 0.0.6
516

617
* Fix asset path

example/lib/main.dart

Lines changed: 55 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,15 @@ class MyApp extends StatefulWidget {
1919
class _MyAppState extends State<MyApp> {
2020
final String _platformVersion = 'Unknown';
2121

22+
late Future<bool> _isWalletAvailable;
23+
2224
@override
2325
void initState() {
2426
super.initState();
25-
widget.flutterGoogleWalletPlugin.initWalletClient();
27+
_isWalletAvailable = Future(() async {
28+
await widget.flutterGoogleWalletPlugin.initWalletClient();
29+
return widget.flutterGoogleWalletPlugin.getWalletApiAvailabilityStatus();
30+
});
2631
}
2732

2833
@override
@@ -38,21 +43,22 @@ class _MyAppState extends State<MyApp> {
3843
children: [
3944
Text('Running on: $_platformVersion\n'),
4045
FutureBuilder<bool>(
41-
future: widget.flutterGoogleWalletPlugin
42-
.getWalletApiAvailabilityStatus(),
46+
future: _isWalletAvailable,
4347
builder: (BuildContext context, AsyncSnapshot<bool> available) {
44-
if (available.data ?? false) {
48+
if (available.data == true) {
4549
return Padding(
4650
padding: const EdgeInsets.all(10),
4751
child: Align(
48-
alignment: Alignment.topCenter,
49-
child: AddToGoogleWalletButton(
50-
locale: const Locale('en', 'US'),
51-
onPress: () {
52-
widget.flutterGoogleWalletPlugin.savePasses(
53-
jsonPass: '',
54-
addToGoogleWalletRequestCode: 2);
55-
})),
52+
alignment: Alignment.topCenter,
53+
child: AddToGoogleWalletButton(
54+
locale: const Locale('fr', 'FR'),
55+
onPress: () {
56+
widget.flutterGoogleWalletPlugin.savePasses(
57+
jsonPass: exampleJsonPass,
58+
addToGoogleWalletRequestCode: 2);
59+
},
60+
),
61+
),
5662
);
5763
} else {
5864
return const SizedBox.shrink();
@@ -66,3 +72,40 @@ class _MyAppState extends State<MyApp> {
6672
);
6773
}
6874
}
75+
76+
// This is a pass with fake data, and it will trigger an error when added to Google Wallet
77+
// For a pass with real data, you must follow the Google developer guide here: https://developers.google.com/wallet
78+
const exampleJsonPass = '''
79+
{
80+
"aud": "google",
81+
"origins": [
82+
"https://localhost:8080"
83+
],
84+
85+
"iat": 123456789,
86+
"typ": "savetowallet",
87+
"payload": {
88+
"loyaltyObjects": [
89+
{
90+
"barcode": {
91+
"alternateText": "12345",
92+
"type": "qrCode",
93+
"value": "28343E3"
94+
},
95+
"id": "123456789.LoyaltyObject",
96+
"loyaltyPoints": {
97+
"balance": {
98+
"string": "500"
99+
},
100+
"label": "Points"
101+
},
102+
"accountId": "1234567890",
103+
"classId": "123456789.LoyaltyClass",
104+
"accountName": "Jane Doe",
105+
"state": "active",
106+
"version": 1
107+
}
108+
]
109+
}
110+
}
111+
''';

example/pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ packages:
110110
path: ".."
111111
relative: true
112112
source: path
113-
version: "0.0.7"
113+
version: "0.0.8"
114114
flutter_lints:
115115
dependency: "direct dev"
116116
description:

example/pubspec.yaml

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -52,33 +52,8 @@ flutter:
5252
# the material Icons class.
5353
uses-material-design: true
5454

55-
# To add assets to your application, add an assets section, like this:
56-
# assets:
57-
# - images/a_dot_burr.jpeg
58-
# - images/a_dot_ham.jpeg
59-
60-
# An image asset can refer to one or more resolution-specific "variants", see
61-
# https://flutter.dev/assets-and-images/#resolution-aware
62-
63-
# For details regarding adding assets from package dependencies, see
64-
# https://flutter.dev/assets-and-images/#from-packages
65-
66-
# To add custom fonts to your application, add a fonts section here,
67-
# in this "flutter" section. Each entry in this list should have a
68-
# "family" key with the font family name, and a "fonts" key with a
69-
# list giving the asset and other descriptors for the font. For
70-
# example:
71-
# fonts:
72-
# - family: Schyler
73-
# fonts:
74-
# - asset: fonts/Schyler-Regular.ttf
75-
# - asset: fonts/Schyler-Italic.ttf
76-
# style: italic
77-
# - family: Trajan Pro
78-
# fonts:
79-
# - asset: fonts/TrajanPro.ttf
80-
# - asset: fonts/TrajanPro_Bold.ttf
81-
# weight: 700
82-
#
83-
# For details regarding fonts from package dependencies,
84-
# see https://flutter.dev/custom-fonts/#from-packages
55+
assets:
56+
- packages/flutter_google_wallet/assets/svg/button/frFR_add_to_google_wallet_wallet-button.svg
57+
- packages/flutter_google_wallet/assets/svg/button/enUS_add_to_google_wallet_wallet-button.svg
58+
- packages/flutter_google_wallet/assets/svg/button/esES_add_to_google_wallet_wallet-button.svg
59+
- packages/flutter_google_wallet/assets/svg/button/zhHK_add_to_google_wallet_wallet-button.svg

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: flutter_google_wallet
22
description: A Flutter Google Wallet Plugin
3-
version: 0.0.7
3+
version: 0.0.8
44
homepage: https://github.com/voyages-sncf-technologies/flutter_google_wallet
55

66
environment:

0 commit comments

Comments
 (0)