فهرست منبع

Update billing plan model

Vishnu Mohandas 4 سال پیش
والد
کامیت
088c1777fd
3فایلهای تغییر یافته به همراه13 افزوده شده و 11 حذف شده
  1. 8 8
      lib/models/billing_plan.dart
  2. 1 1
      lib/ui/email_entry_page.dart
  3. 4 2
      lib/ui/subscription_page.dart

+ 8 - 8
lib/models/billing_plan.dart

@@ -4,7 +4,7 @@ class BillingPlan {
   final String id;
   final String androidID;
   final String iosID;
-  final int storageInMBs;
+  final int storage;
   final String price;
   final String period;
 
@@ -12,7 +12,7 @@ class BillingPlan {
     this.id,
     this.androidID,
     this.iosID,
-    this.storageInMBs,
+    this.storage,
     this.price,
     this.period,
   });
@@ -29,7 +29,7 @@ class BillingPlan {
       id: id ?? this.id,
       androidID: androidID ?? this.androidID,
       iosID: iosID ?? this.iosID,
-      storageInMBs: storageInMBs ?? this.storageInMBs,
+      storage: storageInMBs ?? this.storage,
       price: price ?? this.price,
       period: period ?? this.period,
     );
@@ -40,7 +40,7 @@ class BillingPlan {
       'id': id,
       'androidID': androidID,
       'iosID': iosID,
-      'storageInMBs': storageInMBs,
+      'storage': storage,
       'price': price,
       'period': period,
     };
@@ -53,7 +53,7 @@ class BillingPlan {
       id: map['id'],
       androidID: map['androidID'],
       iosID: map['iosID'],
-      storageInMBs: map['storageInMBs'],
+      storage: map['storage'],
       price: map['price'],
       period: map['period'],
     );
@@ -66,7 +66,7 @@ class BillingPlan {
 
   @override
   String toString() {
-    return 'BillingPlan(id: $id, androidID: $androidID, iosID: $iosID, storageInMBs: $storageInMBs, price: $price, period: $period)';
+    return 'BillingPlan(id: $id, androidID: $androidID, iosID: $iosID, storage: $storage, price: $price, period: $period)';
   }
 
   @override
@@ -77,7 +77,7 @@ class BillingPlan {
         o.id == id &&
         o.androidID == androidID &&
         o.iosID == iosID &&
-        o.storageInMBs == storageInMBs &&
+        o.storage == storage &&
         o.price == price &&
         o.period == period;
   }
@@ -87,7 +87,7 @@ class BillingPlan {
     return id.hashCode ^
         androidID.hashCode ^
         iosID.hashCode ^
-        storageInMBs.hashCode ^
+        storage.hashCode ^
         price.hashCode ^
         period.hashCode;
   }

+ 1 - 1
lib/ui/email_entry_page.dart

@@ -306,7 +306,7 @@ class BillingPlanWidget extends StatelessWidget {
         child: Column(
           children: [
             Text(
-              (plan.storageInMBs / 1024).round().toString() + " GB",
+              (plan.storage / (1024 * 1024 * 1024)).round().toString() + " GB",
               style: TextStyle(
                 fontWeight: FontWeight.bold,
                 fontSize: 16,

+ 4 - 2
lib/ui/subscription_page.dart

@@ -13,7 +13,6 @@ import 'package:photos/models/billing_plan.dart';
 import 'package:photos/models/subscription.dart';
 import 'package:photos/services/billing_service.dart';
 import 'package:photos/ui/loading_widget.dart';
-import 'package:photos/utils/date_time_util.dart';
 import 'package:photos/utils/dialog_util.dart';
 import 'package:photos/utils/toast_util.dart';
 import 'package:progress_dialog/progress_dialog.dart';
@@ -385,7 +384,10 @@ class SubscriptionPlanWidget extends StatelessWidget {
                     child: Column(
                       children: [
                         Text(
-                          (plan.storageInMBs / 1024).round().toString() + " GB",
+                          (plan.storage / (1024 * 1024 * 1024))
+                                  .round()
+                                  .toString() +
+                              " GB",
                           style: TextStyle(
                             fontWeight: FontWeight.bold,
                             fontSize: 16,