Преглед изворни кода

Show next renewal date on the susbcription screen

Vishnu Mohandas пре 4 година
родитељ
комит
380ce36e7d
2 измењених фајлова са 32 додато и 7 уклоњено
  1. 24 7
      lib/ui/subscription_page.dart
  2. 8 0
      lib/utils/date_time_util.dart

+ 24 - 7
lib/ui/subscription_page.dart

@@ -8,6 +8,7 @@ import 'package:flutter/widgets.dart';
 import 'package:in_app_purchase/in_app_purchase.dart';
 import 'package:logging/logging.dart';
 import 'package:photos/ui/expansion_card.dart';
+import 'package:photos/utils/date_time_util.dart';
 import 'package:progress_dialog/progress_dialog.dart';
 import 'package:url_launcher/url_launcher.dart';
 
@@ -281,14 +282,30 @@ class _SubscriptionPageState extends State<SubscriptionPage> {
             },
             child: Container(
               padding: EdgeInsets.all(80),
-              child: RichText(
-                text: TextSpan(
-                  text: "payment details",
-                  style: TextStyle(
-                    color: Colors.blue,
-                    fontFamily: 'Ubuntu',
+              child: Column(
+                children: [
+                  Text(
+                    "next renewal on " +
+                        getDateAndMonthAndYear(
+                            DateTime.fromMicrosecondsSinceEpoch(
+                                _currentSubscription.expiryTime)),
+                    style: TextStyle(
+                      color: Colors.white.withOpacity(0.6),
+                      fontSize: 14,
+                    ),
                   ),
-                ),
+                  Padding(padding: EdgeInsets.all(8)),
+                  RichText(
+                    text: TextSpan(
+                      text: "payment details",
+                      style: TextStyle(
+                        color: Colors.blue,
+                        fontFamily: 'Ubuntu',
+                        fontSize: 15,
+                      ),
+                    ),
+                  ),
+                ],
               ),
             ),
           ),

+ 8 - 0
lib/utils/date_time_util.dart

@@ -50,6 +50,14 @@ String getDayAndMonth(DateTime dateTime) {
       _months[dateTime.month];
 }
 
+String getDateAndMonthAndYear(DateTime dateTime) {
+  return dateTime.day.toString() +
+      " " +
+      _months[dateTime.month] +
+      ", " +
+      dateTime.year.toString();
+}
+
 String getDay(DateTime dateTime) {
   return _days[dateTime.weekday];
 }