Skip to content

Commit 9b05703

Browse files
committed
Provided style example
1 parent 41c434e commit 9b05703

File tree

2 files changed

+80
-36
lines changed

2 files changed

+80
-36
lines changed

example/lib/main.dart

Lines changed: 52 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import 'package:http/http.dart' as http;
1212
// Step 2. Click "Deploy to heroku"
1313
// Step 3. Login with your heroku credentials or create a free heroku account
1414
// Step 4. Provide your secret key and an email with which to start all test transactions
15-
// Step 5. Copy the url generated by heroku (format https://some-url.herokuapp.com) into the space below
16-
String backendUrl = 'https://wilbur-paystack.herokuapp.com';
15+
// Step 5. Replace {YOUR_BACKEND_URL} below with the url generated by heroku (format https://some-url.herokuapp.com)
16+
String backendUrl = '{YOUR_BACKEND_URL}';
1717
// Set this to a public key that matches the secret key you supplied while creating the heroku instance
1818
String paystackPublicKey = '{YOUR_PAYSTACK_PUBLIC_KEY}';
1919
const String appName = 'Paystack Example';
@@ -198,12 +198,28 @@ class _HomePageState extends State<HomePage> {
198198
_horizontalSizeBox,
199199
new Flexible(
200200
flex: 2,
201-
child: new Container(
202-
width: double.infinity,
203-
child: _getPlatformButton(
204-
'Checkout',
205-
() => _handleCheckout(),
206-
)),
201+
child: Theme(
202+
data: Theme.of(context).copyWith(
203+
accentColor: green,
204+
primaryColorLight: Colors.white,
205+
primaryColorDark: navyBlue,
206+
textTheme:
207+
Theme.of(context).textTheme.copyWith(
208+
body2: TextStyle(
209+
color: lightBlue,
210+
),
211+
),
212+
),
213+
child: Builder(
214+
builder: (context) => new Container(
215+
width: double.infinity,
216+
child: _getPlatformButton(
217+
'Checkout',
218+
() => _handleCheckout(context),
219+
),
220+
),
221+
),
222+
),
207223
),
208224
],
209225
)
@@ -220,7 +236,7 @@ class _HomePageState extends State<HomePage> {
220236
void _handleRadioValueChanged(int value) =>
221237
setState(() => _radioValue = value);
222238

223-
_handleCheckout() async {
239+
_handleCheckout(BuildContext context) async {
224240
if (_method == null) {
225241
_showMessage('Select checkout method first');
226242
return;
@@ -244,6 +260,7 @@ class _HomePageState extends State<HomePage> {
244260
method: _method,
245261
charge: charge,
246262
fullscreen: false,
263+
logo: MyLogo(),
247264
);
248265
print('Response = $response');
249266
setState(() => _inProgress = false);
@@ -454,3 +471,29 @@ CheckoutMethod _parseStringToMethod(String string) {
454471
}
455472
return method;
456473
}
474+
475+
class MyLogo extends StatelessWidget {
476+
@override
477+
Widget build(BuildContext context) {
478+
return Container(
479+
decoration: BoxDecoration(
480+
shape: BoxShape.circle,
481+
color: Colors.black,
482+
),
483+
alignment: Alignment.center,
484+
padding: EdgeInsets.all(10),
485+
child: Text(
486+
"CO",
487+
style: TextStyle(
488+
color: Colors.white,
489+
fontSize: 13,
490+
fontWeight: FontWeight.bold,
491+
),
492+
),
493+
);
494+
}
495+
}
496+
497+
const Color green = const Color(0xFF3db76d);
498+
const Color lightBlue = const Color(0xFF34a5db);
499+
const Color navyBlue = const Color(0xFF031b33);

lib/src/widgets/input/base_field.dart

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -25,32 +25,33 @@ class BaseTextField extends StatelessWidget {
2525
@override
2626
Widget build(BuildContext context) {
2727
return TextFormField(
28-
controller: controller,
29-
inputFormatters: inputFormatters,
30-
onSaved: onSaved,
31-
validator: validator,
32-
maxLines: 1,
33-
initialValue: initialValue,
34-
keyboardType: TextInputType.number,
35-
decoration: new InputDecoration(
36-
border: OutlineInputBorder(),
37-
labelText: labelText,
38-
labelStyle: const TextStyle(color: Colors.grey, fontSize: 14.0),
39-
suffixIcon: suffix == null
40-
? null
41-
: new Padding(
42-
padding: const EdgeInsetsDirectional.only(end: 12.0),
43-
child: suffix,
44-
),
45-
errorStyle: const TextStyle(fontSize: 12.0),
46-
errorMaxLines: 3,
47-
isDense: true,
48-
enabledBorder: OutlineInputBorder(
49-
borderSide: const BorderSide(color: Colors.grey, width: 0.5)),
50-
focusedBorder: OutlineInputBorder(
51-
borderSide: BorderSide(
52-
color: Theme.of(context).primaryColor, width: 1.0)),
53-
hintText: hintText,
54-
suffixStyle: TextStyle(color: Colors.green)));
28+
controller: controller,
29+
inputFormatters: inputFormatters,
30+
onSaved: onSaved,
31+
validator: validator,
32+
maxLines: 1,
33+
initialValue: initialValue,
34+
keyboardType: TextInputType.number,
35+
decoration: new InputDecoration(
36+
border: OutlineInputBorder(),
37+
labelText: labelText,
38+
labelStyle: const TextStyle(color: Colors.grey, fontSize: 14.0),
39+
suffixIcon: suffix == null
40+
? null
41+
: new Padding(
42+
padding: const EdgeInsetsDirectional.only(end: 12.0),
43+
child: suffix,
44+
),
45+
errorStyle: const TextStyle(fontSize: 12.0),
46+
errorMaxLines: 3,
47+
isDense: true,
48+
enabledBorder: OutlineInputBorder(
49+
borderSide: const BorderSide(color: Colors.grey, width: 0.5)),
50+
focusedBorder: OutlineInputBorder(
51+
borderSide:
52+
BorderSide(color: Theme.of(context).accentColor, width: 1.0)),
53+
hintText: hintText,
54+
),
55+
);
5556
}
5657
}

0 commit comments

Comments
 (0)