Skip to content

Commit

Permalink
bfix: fix total balance on rebate card (#216)
Browse files Browse the repository at this point in the history
  • Loading branch information
aman-singh7 authored Feb 6, 2023
1 parent 891e363 commit 33a20a3
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 56 deletions.
37 changes: 19 additions & 18 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -113,24 +113,24 @@ PODS:
- GoogleUtilities/Environment (~> 7.7)
- nanopb (< 2.30910.0, >= 2.30908.0)
- PromisesObjC (< 3.0, >= 1.2)
- GoogleUtilities/AppDelegateSwizzler (7.10.0):
- GoogleUtilities/AppDelegateSwizzler (7.11.0):
- GoogleUtilities/Environment
- GoogleUtilities/Logger
- GoogleUtilities/Network
- GoogleUtilities/Environment (7.10.0):
- GoogleUtilities/Environment (7.11.0):
- PromisesObjC (< 3.0, >= 1.2)
- GoogleUtilities/Logger (7.10.0):
- GoogleUtilities/Logger (7.11.0):
- GoogleUtilities/Environment
- GoogleUtilities/MethodSwizzler (7.10.0):
- GoogleUtilities/MethodSwizzler (7.11.0):
- GoogleUtilities/Logger
- GoogleUtilities/Network (7.10.0):
- GoogleUtilities/Network (7.11.0):
- GoogleUtilities/Logger
- "GoogleUtilities/NSData+zlib"
- GoogleUtilities/Reachability
- "GoogleUtilities/NSData+zlib (7.10.0)"
- GoogleUtilities/Reachability (7.10.0):
- "GoogleUtilities/NSData+zlib (7.11.0)"
- GoogleUtilities/Reachability (7.11.0):
- GoogleUtilities/Logger
- GoogleUtilities/UserDefaults (7.10.0):
- GoogleUtilities/UserDefaults (7.11.0):
- GoogleUtilities/Logger
- nanopb (2.30909.0):
- nanopb/decode (= 2.30909.0)
Expand All @@ -144,15 +144,16 @@ PODS:
- Flutter
- PromisesObjC (2.1.1)
- ReachabilitySwift (5.0.0)
- Sentry/HybridSDK (7.31.3)
- Sentry/HybridSDK (7.31.5)
- sentry_flutter (0.0.1):
- Flutter
- FlutterMacOS
- Sentry/HybridSDK (= 7.31.3)
- Sentry/HybridSDK (= 7.31.5)
- share_plus (0.0.1):
- Flutter
- shared_preferences_ios (0.0.1):
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
- Toast (4.0.0)
- url_launcher_ios (0.0.1):
- Flutter
Expand All @@ -171,7 +172,7 @@ DEPENDENCIES:
- path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`)
- sentry_flutter (from `.symlinks/plugins/sentry_flutter/ios`)
- share_plus (from `.symlinks/plugins/share_plus/ios`)
- shared_preferences_ios (from `.symlinks/plugins/shared_preferences_ios/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/ios`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)

SPEC REPOS:
Expand Down Expand Up @@ -221,8 +222,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/sentry_flutter/ios"
share_plus:
:path: ".symlinks/plugins/share_plus/ios"
shared_preferences_ios:
:path: ".symlinks/plugins/shared_preferences_ios/ios"
shared_preferences_foundation:
:path: ".symlinks/plugins/shared_preferences_foundation/ios"
url_launcher_ios:
:path: ".symlinks/plugins/url_launcher_ios/ios"

Expand All @@ -246,17 +247,17 @@ SPEC CHECKSUMS:
fluttertoast: eb263d302cc92e04176c053d2385237e9f43fad0
GoogleAppMeasurement: c7d6fff39bf2d829587d74088d582e32d75133c3
GoogleDataTransport: 1c8145da7117bd68bbbed00cf304edb6a24de00f
GoogleUtilities: bad72cb363809015b1f7f19beb1f1cd23c589f95
GoogleUtilities: c2bdc4cf2ce786c4d2e6b3bcfd599a25ca78f06f
nanopb: b552cce312b6c8484180ef47159bc0f65a1f0431
OrderedSet: aaeb196f7fef5a9edf55d89760da9176ad40b93c
package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e
path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02
PromisesObjC: ab77feca74fa2823e7af4249b8326368e61014cb
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
Sentry: 08884c523575ec0f6690d94ed3ccb0246a1600bf
sentry_flutter: 91ebe7757a166b34ff432a0d550d22cd010d44d2
Sentry: 4c9babff9034785067c896fd580b1f7de44da020
sentry_flutter: d3dad547d3db4918a8051a5ef738cc195c427b4b
share_plus: 056a1e8ac890df3e33cb503afffaf1e9b4fbae68
shared_preferences_ios: 548a61f8053b9b8a49ac19c1ffbc8b92c50d68ad
shared_preferences_foundation: 297b3ebca31b34ec92be11acd7fb0ba932c822ca
Toast: 91b396c56ee72a5790816f40d3a94dd357abc196
url_launcher_ios: 839c58cdb4279282219f5e248c3321761ff3c4de

Expand Down
38 changes: 19 additions & 19 deletions lib/ui/rebates/components/monthly_rebate_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class MonthlyRebateCard extends StatelessWidget {
final int? balanceConsumed;
final num? rebate;
final int? additionalMeal;
final String? month;
final int? year;
final num balanceConsumed;
final num rebate;
final num additionalMeal;
final num totalBalance;
final String month;
final int year;

MonthlyRebateCard({
this.balanceConsumed,
this.rebate,
this.additionalMeal,
this.month,
this.year,
});
this.balanceConsumed = 0,
this.rebate = 0,
this.additionalMeal = 0,
required this.month,
required this.year,
}) : totalBalance = balanceConsumed + additionalMeal - rebate;

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -56,7 +57,7 @@ class MonthlyRebateCard extends StatelessWidget {
style: AppTheme.bodyText2,
),
Text(
'- Rs. ${balanceConsumed ?? 0}',
'- Rs. $balanceConsumed',
style: AppTheme.bodyText2.copyWith(
color: AppTheme.red,
),
Expand All @@ -72,7 +73,7 @@ class MonthlyRebateCard extends StatelessWidget {
style: AppTheme.bodyText2,
),
Text(
'- Rs. ${rebate ?? 0}',
'- Rs. $rebate',
style: AppTheme.bodyText2.copyWith(
color: AppTheme.green,
),
Expand All @@ -88,7 +89,7 @@ class MonthlyRebateCard extends StatelessWidget {
style: AppTheme.bodyText2,
),
Text(
'- Rs. ${additionalMeal ?? 0}',
'- Rs. $additionalMeal',
style: AppTheme.bodyText2,
),
],
Expand All @@ -103,11 +104,10 @@ class MonthlyRebateCard extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Text(
'Rs. ' +
(balanceConsumed ??
0 + (additionalMeal ?? 0) - (rebate ?? 0))
.toString(),
style: AppTheme.headline4,
'Rs. ${totalBalance.abs()}',
style: AppTheme.headline4.copyWith(
color: totalBalance <= 0 ? AppTheme.green : AppTheme.red,
),
)
],
),
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/rebates/my_rebates_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class MyRebatesView extends StatelessWidget {
children: <Widget>[
MonthlyRebateCard(
balanceConsumed: 0,
rebate: model.monthlyRebate,
rebate: model.monthlyRebate ?? 0,
additionalMeal: 0,
month: DateFormat.MMMM().format(DateTime.now()),
year: DateTime.now().year,
Expand Down
29 changes: 11 additions & 18 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ packages:
name: lottie
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
version: "2.2.0"
matcher:
dependency: transitive
description:
Expand Down Expand Up @@ -414,7 +414,7 @@ packages:
name: mime
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
version: "1.0.4"
nested:
dependency: transitive
description:
Expand Down Expand Up @@ -498,7 +498,7 @@ packages:
name: path_provider_macos
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.6"
version: "2.0.7"
path_provider_platform_interface:
dependency: transitive
description:
Expand Down Expand Up @@ -582,21 +582,21 @@ packages:
name: sembast
url: "https://pub.dartlang.org"
source: hosted
version: "3.3.1+1"
version: "3.4.0+6"
sentry:
dependency: transitive
description:
name: sentry
url: "https://pub.dartlang.org"
source: hosted
version: "6.18.1"
version: "6.18.2"
sentry_flutter:
dependency: "direct main"
description:
name: sentry_flutter
url: "https://pub.dartlang.org"
source: hosted
version: "6.18.1"
version: "6.18.2"
share_plus:
dependency: "direct main"
description:
Expand All @@ -617,18 +617,18 @@ packages:
name: shared_preferences
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.15"
version: "2.0.16"
shared_preferences_android:
dependency: transitive
description:
name: shared_preferences_android
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.14"
shared_preferences_ios:
shared_preferences_foundation:
dependency: transitive
description:
name: shared_preferences_ios
name: shared_preferences_foundation
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
Expand All @@ -639,13 +639,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.2"
shared_preferences_macos:
dependency: transitive
description:
name: shared_preferences_macos
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.4"
shared_preferences_platform_interface:
dependency: transitive
description:
Expand Down Expand Up @@ -706,7 +699,7 @@ packages:
name: synchronized
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0+3"
version: "3.0.1"
term_glyph:
dependency: transitive
description:
Expand Down Expand Up @@ -825,7 +818,7 @@ packages:
name: xdg_directories
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.0+2"
version: "0.2.0+3"
xml:
dependency: transitive
description:
Expand Down

0 comments on commit 33a20a3

Please sign in to comment.