Skip to content

Commit

Permalink
lib/presentation/widgets/tenflr_pay_card
Browse files Browse the repository at this point in the history
  • Loading branch information
fonkamloic committed Nov 30, 2020
1 parent 1ab2d6e commit 4131704
Showing 1 changed file with 25 additions and 13 deletions.
38 changes: 25 additions & 13 deletions lib/presentation/widgets/tenflr_pay_card.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import 'package:auto_route/auto_route.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flushbar/flushbar_helper.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_svg/svg.dart';
import 'package:provider/provider.dart';
import 'package:tenflrpay/domain/core/settings.dart';

import '../../application/trusted_funds_bloc/trusted_funds_bloc.dart';
import '../../domain/user/user.dart';
import '../../injection.dart';
import '../../routes/router.gr.dart';
import '../core/assets/colors.dart';
import '../core/assets/svg.dart';
Expand All @@ -22,6 +25,7 @@ class TenflrPayCard extends StatelessWidget {
@override
Widget build(BuildContext context) {
final User user = Provider.of<User>(context, listen: false);
final MySettings _settings = getIt<MySettings>();
context.bloc<TrustedFundsBloc>().add(const TrustedFundsEvent.watchFunds());
final Size size = MediaQuery.of(context).size;
return Container(
Expand Down Expand Up @@ -95,14 +99,17 @@ class TenflrPayCard extends StatelessWidget {
textAlign: TextAlign.center,
style: TenflrPayCardTextStyle.amount(size),
),
loadSuccess: (s) => FittedBox(
fit: BoxFit.fitWidth,
child: Text(
"$currency ${s.amount.getOrCrash().toStringAsFixed(1)}",
textAlign: TextAlign.center,
style: TenflrPayCardTextStyle.amount(size),
),
),
loadSuccess: (s) {
_settings.setTenflrBalance(s.amount);
return FittedBox(
fit: BoxFit.fitWidth,
child: Text(
"$currency ${s.amount.getOrCrash().toStringAsFixed(1)}",
textAlign: TextAlign.center,
style: TenflrPayCardTextStyle.amount(size),
),
);
},
loadFailure: (s) => Text(
"$currency 0.0}",
textAlign: TextAlign.center,
Expand All @@ -115,11 +122,16 @@ class TenflrPayCard extends StatelessWidget {
Stack(
alignment: Alignment.bottomCenter,
children: [
Align(
alignment: Alignment.bottomLeft,
child: Text(
"View all transaction history".i18n,
style: TenflrPayCardTextStyle.history(size),
InkWell(
onTap: () {
BotToast.showText(text: "Coming soon".i18n);
},
child: Align(
alignment: Alignment.bottomLeft,
child: Text(
"View all transaction history".i18n,
style: TenflrPayCardTextStyle.history(size),
),
),
),
Align(
Expand Down

0 comments on commit 4131704

Please sign in to comment.