Skip to content

Commit

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

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

class WhiteButton extends _BaseButton {
final bool flat;
Expand Down Expand Up @@ -46,7 +47,7 @@ class AccentButton extends StatelessWidget {
return _BaseButton(
onPressed: onPressed,
showProgress: showProgress,
color: Theme.of(context).colorScheme.secondary,
color: context.colorScheme().secondary,
borderSide: BorderSide.none,
textStyle: const TextStyle(
fontSize: 14.0, color: Colors.white, fontWeight: FontWeight.bold),
Expand Down
3 changes: 2 additions & 1 deletion lib/src/widgets/checkout/bank_checkout.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import 'package:flutter_paystack/src/transaction/bank_transaction_manager.dart';
import 'package:flutter_paystack/src/widgets/buttons.dart';
import 'package:flutter_paystack/src/widgets/checkout/base_checkout.dart';
import 'package:flutter_paystack/src/widgets/checkout/checkout_widget.dart';
import 'package:flutter_paystack/src/widgets/common/extensions.dart';
import 'package:flutter_paystack/src/widgets/input/account_field.dart';

class BankCheckout extends StatefulWidget {
Expand Down Expand Up @@ -147,7 +148,7 @@ class _BankCheckoutState extends BaseCheckoutMethodState<BankCheckout> {
const BorderSide(color: Colors.grey, width: 0.5)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).colorScheme.secondary, width: 1.0)),
color: context.colorScheme().secondary, width: 1.0)),
hintText: 'Tap here to choose',
),
isEmpty: _currentBank == null,
Expand Down
2 changes: 1 addition & 1 deletion lib/src/widgets/checkout/checkout_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ class _CheckoutWidgetState extends BaseState<CheckoutWidget>
}

Widget _buildTitle() {
final accentColor = Theme.of(context).colorScheme.secondary;
final accentColor = context.colorScheme().secondary;
var emailAndAmount = Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
Expand Down
5 changes: 3 additions & 2 deletions lib/src/widgets/custom_dialog.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'dart:math' as math;

import 'package:flutter/material.dart';
import 'package:flutter_paystack/src/widgets/common/extensions.dart';

/// This is a modification of [AlertDialog]. A lot of modifications was made. The goal is
/// to retain the dialog feel and look while adding the close IconButton
Expand Down Expand Up @@ -32,7 +33,7 @@ class CustomAlertDialog extends StatelessWidget {
children.add(new Padding(
padding: titlePadding!,
child: new DefaultTextStyle(
style: Theme.of(context).textTheme.headline6!,
style: context.textTheme().headline6!,
child: new Semantics(child: title, namesRoute: true),
),
));
Expand All @@ -42,7 +43,7 @@ class CustomAlertDialog extends StatelessWidget {
child: new Padding(
padding: contentPadding,
child: new DefaultTextStyle(
style: Theme.of(context).textTheme.subtitle1!,
style: context.textTheme().subtitle1!,
child: content,
),
),
Expand Down
3 changes: 2 additions & 1 deletion lib/src/widgets/input/base_field.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_paystack/src/widgets/common/extensions.dart';

class BaseTextField extends StatelessWidget {
final Widget? suffix;
Expand Down Expand Up @@ -50,7 +51,7 @@ class BaseTextField extends StatelessWidget {
borderSide: const BorderSide(color: Colors.grey, width: 0.5)),
focusedBorder: OutlineInputBorder(
borderSide:
BorderSide(color: Theme.of(context).colorScheme.secondary, width: 1.0)),
BorderSide(color: context.colorScheme().secondary, width: 1.0)),
hintText: hintText,
),
);
Expand Down
3 changes: 2 additions & 1 deletion lib/src/widgets/input/pin_field.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_paystack/src/widgets/common/extensions.dart';

class PinField extends StatefulWidget {
final ValueChanged<String>? onSaved;
Expand Down Expand Up @@ -44,7 +45,7 @@ class _PinFieldState extends State<PinField> {
borderSide: const BorderSide(color: Colors.grey, width: 0.5)),
focusedBorder: OutlineInputBorder(
borderSide:
BorderSide(color: Theme.of(context).colorScheme.secondary, width: 1.0)),
BorderSide(color: context.colorScheme().secondary, width: 1.0)),
),
onChanged: (String value) {
if (value.length == widget.pinLength) {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/widgets/otp_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class _OtpWidgetState extends BaseState<OtpWidget> {
padding: EdgeInsets.symmetric(horizontal: 10),
child: new OtpField(
onSaved: (String? value) => _otp = value,
borderColor: Theme.of(context).colorScheme.secondary,
borderColor: context.colorScheme().secondary,
),
),
heightBox,
Expand Down
2 changes: 1 addition & 1 deletion lib/src/widgets/pin_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class _PinWidgetState extends BaseState<PinWidget> {
children: List.generate(
_startCount,
(i) => star(i == (_startCount - 1)
? Theme.of(context).colorScheme.secondary
? context.colorScheme().secondary
: Theme.of(context).primaryColorLight)),
),
);
Expand Down

0 comments on commit 351ef80

Please sign in to comment.