Skip to content

Commit a28eb90

Browse files
committed
Properly formatted .dart files
1 parent bc520e6 commit a28eb90

File tree

5 files changed

+61
-43
lines changed

5 files changed

+61
-43
lines changed

example/lib/main.dart

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ class _HomePageState extends State<HomePage> {
5656

5757
@override
5858
void initState() {
59-
PaystackPlugin.initialize(publicKey: paystackPublicKey, secretKey: paystackSecretKey);
59+
PaystackPlugin.initialize(
60+
publicKey: paystackPublicKey, secretKey: paystackSecretKey);
6061
super.initState();
6162
}
6263

@@ -80,21 +81,22 @@ class _HomePageState extends State<HomePage> {
8081
child: const Text('Initalize transaction from:'),
8182
),
8283
new Expanded(
83-
child:
84-
new Column(mainAxisSize: MainAxisSize.min, children: <Widget>[
85-
new RadioListTile<int>(
86-
value: 0,
87-
groupValue: _radioValue,
88-
onChanged: _handleRadioValueChanged,
89-
title: const Text('Local'),
90-
),
91-
new RadioListTile<int>(
92-
value: 1,
93-
groupValue: _radioValue,
94-
onChanged: _handleRadioValueChanged,
95-
title: const Text('Server'),
96-
),
97-
]),
84+
child: new Column(
85+
mainAxisSize: MainAxisSize.min,
86+
children: <Widget>[
87+
new RadioListTile<int>(
88+
value: 0,
89+
groupValue: _radioValue,
90+
onChanged: _handleRadioValueChanged,
91+
title: const Text('Local'),
92+
),
93+
new RadioListTile<int>(
94+
value: 1,
95+
groupValue: _radioValue,
96+
onChanged: _handleRadioValueChanged,
97+
title: const Text('Server'),
98+
),
99+
]),
98100
)
99101
],
100102
),
@@ -155,7 +157,8 @@ class _HomePageState extends State<HomePage> {
155157
: new Column(
156158
mainAxisSize: MainAxisSize.min,
157159
children: <Widget>[
158-
_getPlatformButton('Charge Card', () => _startAfreshCharge()),
160+
_getPlatformButton(
161+
'Charge Card', () => _startAfreshCharge()),
159162
_verticalSizeBox,
160163
_border,
161164
new SizedBox(
@@ -184,7 +187,8 @@ class _HomePageState extends State<HomePage> {
184187
});
185188
},
186189
items: banks.map((String value) {
187-
return new DropdownMenuItem<CheckoutMethod>(
190+
return new DropdownMenuItem<
191+
CheckoutMethod>(
188192
value: _parseStringToMethod(value),
189193
child: new Text(value),
190194
);
@@ -213,7 +217,8 @@ class _HomePageState extends State<HomePage> {
213217
);
214218
}
215219

216-
void _handleRadioValueChanged(int value) => setState(() => _radioValue = value);
220+
void _handleRadioValueChanged(int value) =>
221+
setState(() => _radioValue = value);
217222

218223
_handleCheckout() async {
219224
if (_method == null) {
@@ -416,11 +421,12 @@ class _HomePageState extends State<HomePage> {
416421
}
417422

418423
_updateStatus(String reference, String message) {
419-
_showMessage(
420-
'Reference: $reference \n\ Response: $message', const Duration(seconds: 7));
424+
_showMessage('Reference: $reference \n\ Response: $message',
425+
const Duration(seconds: 7));
421426
}
422427

423-
_showMessage(String message, [Duration duration = const Duration(seconds: 4)]) {
428+
_showMessage(String message,
429+
[Duration duration = const Duration(seconds: 4)]) {
424430
_scaffoldKey.currentState.showSnackBar(new SnackBar(
425431
content: new Text(message),
426432
duration: duration,

lib/src/model/checkout_response.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,22 @@ class CheckoutResponse {
88
/// A user readable message. If the transaction was successful, this returns the
99
/// cause of the error.
1010
String message;
11+
1112
/// The card used for the payment. Will return null if the customer didn't use card
1213
/// payment
1314
PaymentCard card;
15+
1416
/// The bank account used for the payment. Will return null if the customer didn't use
1517
/// bank account as a means of payment
1618
BankAccount account;
19+
1720
/// Transaction reference. Might return null for failed transaction transactions
1821
String reference;
22+
1923
/// The status of the transaction. A successful response returns true and false
2024
/// otherwise
2125
bool status;
26+
2227
/// The means of payment. It may return [CheckoutMethod.bank] or [CheckoutMethod.card]
2328
CheckoutMethod method;
2429

lib/src/ui/widgets/base_widget.dart

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ abstract class BaseState<T extends StatefulWidget> extends State<T> {
3232
var returnValue = getPopReturnValue();
3333
if (alwaysPop ||
3434
(returnValue != null &&
35-
(returnValue is CheckoutResponse &&
36-
returnValue.status == true))) {
35+
(returnValue is CheckoutResponse && returnValue.status == true))) {
3736
Navigator.of(context).pop(returnValue);
3837
return false;
3938
}
@@ -56,8 +55,8 @@ abstract class BaseState<T extends StatefulWidget> extends State<T> {
5655
child: const Text('No'),
5756
isDefaultAction: true,
5857
onPressed: () {
59-
Navigator.pop(
60-
context, false); // Pops the confirmation dialog but not the page.
58+
Navigator.pop(context,
59+
false); // Pops the confirmation dialog but not the page.
6160
},
6261
),
6362
],
@@ -68,14 +67,14 @@ abstract class BaseState<T extends StatefulWidget> extends State<T> {
6867
new FlatButton(
6968
child: const Text('NO'),
7069
onPressed: () {
71-
Navigator.of(context)
72-
.pop(false); // Pops the confirmation dialog but not the page.
70+
Navigator.of(context).pop(
71+
false); // Pops the confirmation dialog but not the page.
7372
}),
7473
new FlatButton(
7574
child: const Text('YES'),
7675
onPressed: () {
77-
Navigator.of(context)
78-
.pop(true); // Returning true to _onWillPop will pop again.
76+
Navigator.of(context).pop(
77+
true); // Returning true to _onWillPop will pop again.
7978
})
8079
],
8180
);

lib/src/ui/widgets/checkout/card_checkout.dart

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ class CardCheckout extends StatefulWidget {
3535
});
3636

3737
@override
38-
_CardCheckoutState createState() => _CardCheckoutState(charge, accessCode, onResponse);
38+
_CardCheckoutState createState() =>
39+
_CardCheckoutState(charge, accessCode, onResponse);
3940
}
4041

4142
class _CardCheckoutState extends BaseCheckoutMethodState<CardCheckout> {
@@ -100,7 +101,8 @@ class _CardCheckoutState extends BaseCheckoutMethodState<CardCheckout> {
100101
_validateReference() {
101102
//check for null value, and length and starts with pk_
102103
if (_charge.reference == null || _charge.reference.isEmpty) {
103-
throw new PaystackException('Payment reference cannot be null or empty. If you '
104+
throw new PaystackException(
105+
'Payment reference cannot be null or empty. If you '
104106
'don\' want the plugin to initialize the transaction, then don\'t pass a '
105107
'private key in ${PaystackPlugin.initialize}');
106108
}
@@ -141,7 +143,8 @@ class _CardCheckoutState extends BaseCheckoutMethodState<CardCheckout> {
141143
}
142144

143145
try {
144-
http.Response response = await http.post(url, body: body, headers: headers);
146+
http.Response response =
147+
await http.post(url, body: body, headers: headers);
145148
if (!mounted) {
146149
return;
147150
}
@@ -210,11 +213,12 @@ class _CardCheckoutState extends BaseCheckoutMethodState<CardCheckout> {
210213
}
211214

212215
new MobileTransactionManager(
213-
charge: charge,
214-
context: context,
215-
beforeValidate: (transaction) => handleBeforeValidate(transaction),
216-
onSuccess: (transaction) => handleOnSuccess(transaction),
217-
onError: (error, transaction) => handleOnError(error, transaction)).chargeCard();
216+
charge: charge,
217+
context: context,
218+
beforeValidate: (transaction) => handleBeforeValidate(transaction),
219+
onSuccess: (transaction) => handleOnSuccess(transaction),
220+
onError: (error, transaction) => handleOnError(error, transaction))
221+
.chargeCard();
218222
}
219223

220224
void handleError(String message, String reference) {

lib/src/ui/widgets/checkout/checkout_widget.dart

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ class _CheckoutWidgetState extends BaseState<CheckoutWidget>
5050
_currentIndex = _getCurrentTab();
5151
_showTabs = widget.method == CheckoutMethod.selectable ? true : false;
5252
_tabController = new TabController(
53-
vsync: this, length: _methodWidgets.length, initialIndex: _currentIndex);
53+
vsync: this,
54+
length: _methodWidgets.length,
55+
initialIndex: _currentIndex);
5456
_tabController.addListener(_indexChange);
5557
_animationController = new AnimationController(
5658
duration: const Duration(milliseconds: 500),
@@ -78,7 +80,8 @@ class _CheckoutWidgetState extends BaseState<CheckoutWidget>
7880
content: new Container(
7981
child: new SingleChildScrollView(
8082
child: new Container(
81-
padding: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 10.0),
83+
padding:
84+
const EdgeInsets.symmetric(vertical: 10.0, horizontal: 10.0),
8285
child: _showProcessingError()
8386
? _buildErrorWidget()
8487
: _paymentSuccessful
@@ -109,7 +112,8 @@ class _CheckoutWidgetState extends BaseState<CheckoutWidget>
109112
children: <Widget>[
110113
const Text(
111114
'Pay',
112-
style: const TextStyle(fontSize: 14.0, color: Colors.black54),
115+
style:
116+
const TextStyle(fontSize: 14.0, color: Colors.black54),
113117
),
114118
new SizedBox(
115119
width: 5.0,
@@ -138,7 +142,8 @@ class _CheckoutWidgetState extends BaseState<CheckoutWidget>
138142
isScrollable: true,
139143
unselectedLabelColor: Colors.black54,
140144
labelColor: MyColors.green,
141-
labelStyle: new TextStyle(fontSize: 14.0, fontWeight: FontWeight.w500),
145+
labelStyle:
146+
new TextStyle(fontSize: 14.0, fontWeight: FontWeight.w500),
142147
indicator: new ShapeDecoration(
143148
shape: const RoundedRectangleBorder(
144149
borderRadius: tabBorderRadius,
@@ -327,7 +332,6 @@ class _CheckoutWidgetState extends BaseState<CheckoutWidget>
327332
onCountdownComplete: () => Navigator.of(context).pop(_response),
328333
);
329334

330-
331335
@override
332336
getPopReturnValue() {
333337
return _getResponse();

0 commit comments

Comments
 (0)