Skip to content

Commit

Permalink
fix: fixed UI theme issues
Browse files Browse the repository at this point in the history
  • Loading branch information
wilburx9 committed Sep 18, 2022
1 parent 552b371 commit b063cde
Show file tree
Hide file tree
Showing 13 changed files with 48 additions and 44 deletions.
8 changes: 6 additions & 2 deletions lib/src/api/service/bank_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ class BankService with BaseApiService implements BankServiceContract {
if (response.statusCode == HttpStatus.ok && status!) {
return responseBody['data']['id'].toString();
}
} catch (e) {}
} catch (e, s) {
print("$e :: $s");
}
return null;
}

Expand Down Expand Up @@ -85,7 +87,9 @@ class BankService with BaseApiService implements BankServiceContract {
banks.add(new Bank(bank['name'], bank['id']));
}
return banks;
} catch (e) {}
} catch (e, s) {
print("$e :: $s");
}
return null;
}
}
Expand Down
5 changes: 3 additions & 2 deletions lib/src/widgets/birthday_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_paystack/src/widgets/base_widget.dart';
import 'package:flutter_paystack/src/widgets/buttons.dart';
import 'package:flutter_paystack/src/widgets/common/extensions.dart';
import 'package:flutter_paystack/src/widgets/custom_dialog.dart';
import 'package:intl/intl.dart';

Expand Down Expand Up @@ -42,9 +43,9 @@ class _BirthdayWidgetState extends BaseState<BirthdayWidget> {
new Text(
widget.message,
textAlign: TextAlign.center,
style: const TextStyle(
style: TextStyle(
fontWeight: FontWeight.w500,
color: Colors.black87,
color: context.textTheme().headline6?.color,
fontSize: 15.0,
),
),
Expand Down
13 changes: 4 additions & 9 deletions lib/src/widgets/buttons.dart
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,10 @@ class _BaseButton extends StatelessWidget {
? new Container(
width: 20.0,
height: 20.0,
child: new Theme(

data: Theme.of(context).copyWith(
colorScheme: Theme.of(context)
.colorScheme
.copyWith(secondary: Colors.white)),
child: new CircularProgressIndicator(
strokeWidth: 2.0,
)),
child: new CircularProgressIndicator(
strokeWidth: 2.0,
color: Colors.white,
),
)
: iconData == null
? child == null
Expand Down
4 changes: 1 addition & 3 deletions lib/src/widgets/checkout/bank_checkout.dart
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ class _BankCheckoutState extends BaseCheckoutMethodState<BankCheckout> {
_currentBank == null
? new Icon(
Icons.account_balance,
color: Colors.black,
size: 35.0,
)
: container,
Expand All @@ -133,8 +132,7 @@ class _BankCheckoutState extends BaseCheckoutMethodState<BankCheckout> {
: 'Enter your acccount number',
style: const TextStyle(
fontWeight: FontWeight.w500,
fontSize: 14.0,
color: Colors.black),
fontSize: 14.0),
),
new SizedBox(
height: 20.0,
Expand Down
19 changes: 11 additions & 8 deletions lib/src/widgets/checkout/checkout_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'package:flutter_paystack/src/widgets/base_widget.dart';
import 'package:flutter_paystack/src/widgets/checkout/bank_checkout.dart';
import 'package:flutter_paystack/src/widgets/checkout/card_checkout.dart';
import 'package:flutter_paystack/src/widgets/checkout/checkout_method.dart';
import 'package:flutter_paystack/src/widgets/common/extensions.dart';
import 'package:flutter_paystack/src/widgets/custom_dialog.dart';
import 'package:flutter_paystack/src/widgets/error_widget.dart';
import 'package:flutter_paystack/src/widgets/sucessful_widget.dart';
Expand Down Expand Up @@ -175,17 +176,19 @@ class _CheckoutWidgetState extends BaseState<CheckoutWidget>
key: Key("ChargeEmail"),
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: const TextStyle(color: Colors.grey, fontSize: 12.0),
style: TextStyle(
color: context.textTheme().bodySmall?.color, fontSize: 12.0),
),
if (!widget.hideAmount && !_charge.amount.isNegative)
Row(
key: Key("DisplayAmount"),
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
const Text(
Text(
'Pay',
style: const TextStyle(fontSize: 14.0, color: Colors.black54),
style: TextStyle(
fontSize: 14.0, color: context.textTheme().headline1?.color),
),
SizedBox(
width: 5.0,
Expand All @@ -194,8 +197,8 @@ class _CheckoutWidgetState extends BaseState<CheckoutWidget>
child: Text(Utils.formatAmount(_charge.amount),
style: TextStyle(
fontSize: 15.0,
color: Theme.of(context).textTheme.bodyText1!.color,
fontWeight: FontWeight.w500)))
color: context.textTheme().headline6?.color,
fontWeight: FontWeight.bold)))
],
)
],
Expand Down Expand Up @@ -239,13 +242,13 @@ class _CheckoutWidgetState extends BaseState<CheckoutWidget>
duration: const Duration(milliseconds: 300),
curve: Curves.fastOutSlowIn,
child: new Container(
color: Colors.grey.withOpacity(0.1),
color: context.colorScheme().background.withOpacity(0.5),
height: _tabHeight,
alignment: Alignment.center,
child: new TabBar(
controller: _tabController,
isScrollable: true,
unselectedLabelColor: Colors.black54,
unselectedLabelColor: context.colorScheme().onBackground,
labelColor: accentColor,
labelStyle:
new TextStyle(fontSize: 14.0, fontWeight: FontWeight.w500),
Expand Down Expand Up @@ -418,7 +421,7 @@ class _CheckoutWidgetState extends BaseState<CheckoutWidget>
if (_response!.card != null) {
_response!.card!.nullifyNumber();
}
Navigator.of(context).pop(_response);
Navigator.of(context).pop(_response);
},
);

Expand Down
7 changes: 7 additions & 0 deletions lib/src/widgets/common/extensions.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import 'package:flutter/material.dart';

extension Context on BuildContext {
TextTheme textTheme() => Theme.of(this).textTheme;

ColorScheme colorScheme() => Theme.of(this).colorScheme;
}
4 changes: 0 additions & 4 deletions lib/src/widgets/custom_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ class CustomAlertDialog extends StatelessWidget {
Widget widget;
if (fullscreen) {
widget = new Material(
color: Theme.of(context).brightness == Brightness.light
? Colors.white
: Colors.grey,
child: new Container(
child: onCancelPress == null
? new Padding(
Expand Down Expand Up @@ -96,7 +93,6 @@ class CustomAlertDialog extends StatelessWidget {
var body = new Material(
type: MaterialType.card,
borderRadius: new BorderRadius.circular(10.0),
color: Colors.white,
child: new Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
Expand Down
1 change: 0 additions & 1 deletion lib/src/widgets/error_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ class ErrorWidget extends StatelessWidget {
text!,
textAlign: TextAlign.center,
style: const TextStyle(
color: Colors.black54,
fontWeight: FontWeight.w500,
fontSize: 14.0,
),
Expand Down
1 change: 0 additions & 1 deletion lib/src/widgets/input/otp_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ class OtpField extends TextFormField {
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black87,
fontSize: 25.0,
),
autofocus: true,
Expand Down
1 change: 0 additions & 1 deletion lib/src/widgets/input/pin_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class _PinFieldState extends State<PinField> {
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black87,
fontSize: 25.0,
letterSpacing: 15.0,
),
Expand Down
5 changes: 3 additions & 2 deletions lib/src/widgets/otp_widget.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_paystack/src/widgets/base_widget.dart';
import 'package:flutter_paystack/src/widgets/common/extensions.dart';
import 'package:flutter_paystack/src/widgets/custom_dialog.dart';
import 'package:flutter_paystack/src/widgets/input/otp_field.dart';

Expand Down Expand Up @@ -39,9 +40,9 @@ class _OtpWidgetState extends BaseState<OtpWidget> {
new Text(
widget.message!,
textAlign: TextAlign.center,
style: const TextStyle(
style: TextStyle(
fontWeight: FontWeight.w500,
color: Colors.black87,
color: context.textTheme().headline6?.color,
fontSize: 15.0,
),
),
Expand Down
7 changes: 4 additions & 3 deletions lib/src/widgets/pin_widget.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_paystack/src/widgets/base_widget.dart';
import 'package:flutter_paystack/src/widgets/common/extensions.dart';
import 'package:flutter_paystack/src/widgets/custom_dialog.dart';
import 'package:flutter_paystack/src/widgets/input/pin_field.dart';

Expand Down Expand Up @@ -31,13 +32,13 @@ class _PinWidgetState extends BaseState<PinWidget> {
children: <Widget>[
buildStar(),
heightBox,
const Text(
Text(
'To confirm you\'re the owner of this card, please '
'enter your card pin.',
textAlign: TextAlign.center,
style: const TextStyle(
style: TextStyle(
fontWeight: FontWeight.w500,
color: Colors.black87,
color: context.textTheme().headline6?.color,
fontSize: 15.0,
),
),
Expand Down
17 changes: 9 additions & 8 deletions lib/src/widgets/sucessful_widget.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_paystack/src/common/utils.dart';
import 'package:flutter_paystack/src/widgets/animated_widget.dart';
import 'package:flutter_paystack/src/widgets/common/extensions.dart';

class SuccessfulWidget extends StatefulWidget {
final int amount;
Expand Down Expand Up @@ -67,7 +68,7 @@ class _SuccessfulWidgetState extends State<SuccessfulWidget>

@override
Widget build(BuildContext context) {
final accentColor = Theme.of(context).colorScheme.secondary;
final sceondaryColor = context.colorScheme().secondary;
return new Container(
child: new CustomAnimatedWidget(
controller: _mainController,
Expand All @@ -77,15 +78,15 @@ class _SuccessfulWidgetState extends State<SuccessfulWidget>
sizedBox,
new Image.asset(
'assets/images/successful.png',
color: accentColor,
color: sceondaryColor,
width: 50.0,
package: 'flutter_paystack',
),
sizedBox,
const Text(
Text(
'Payment Successful',
style: const TextStyle(
color: Colors.black87,
style: TextStyle(
color: context.textTheme().headline6?.color,
fontWeight: FontWeight.w500,
fontSize: 16.0,
),
Expand All @@ -96,8 +97,8 @@ class _SuccessfulWidgetState extends State<SuccessfulWidget>
widget.amount.isNegative
? new Container()
: new Text('You paid ${Utils.formatAmount(widget.amount)}',
style: const TextStyle(
color: Colors.black54,
style: TextStyle(
color: context.textTheme().headline6?.color,
fontWeight: FontWeight.normal,
fontSize: 14.0,
)),
Expand All @@ -107,7 +108,7 @@ class _SuccessfulWidgetState extends State<SuccessfulWidget>
child: new Text(
_countdownAnim.value.toString(),
style: TextStyle(
color: accentColor,
color: sceondaryColor,
fontWeight: FontWeight.bold,
fontSize: 25.0),
),
Expand Down

0 comments on commit b063cde

Please sign in to comment.