|
@@ -44,7 +44,7 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
|
|
|
FreePlan _freePlan;
|
|
|
List<BillingPlan> _plans = [];
|
|
|
bool _hasLoadedData = false;
|
|
|
- bool _isActiveStripeSubscriber;
|
|
|
+ bool _isStripeSubscriber = false;
|
|
|
bool _showYearlyPlan = false;
|
|
|
|
|
|
@override
|
|
@@ -59,9 +59,7 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
|
|
|
_currentSubscription = subscription;
|
|
|
_showYearlyPlan = _currentSubscription.isYearlyPlan();
|
|
|
_hasActiveSubscription = _currentSubscription.isValid();
|
|
|
- _isActiveStripeSubscriber =
|
|
|
- _currentSubscription.paymentProvider == kStripe &&
|
|
|
- _currentSubscription.isValid();
|
|
|
+ _isStripeSubscriber = _currentSubscription.paymentProvider == kStripe;
|
|
|
_usageFuture = _billingService.fetchUsage();
|
|
|
return _filterStripeForUI().then((value) {
|
|
|
_hasLoadedData = true;
|
|
@@ -158,8 +156,7 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
|
|
|
widgets.add(_stripeRenewOrCancelButton());
|
|
|
}
|
|
|
|
|
|
- if (_hasActiveSubscription &&
|
|
|
- _currentSubscription.productID != kFreeProductID) {
|
|
|
+ if (_currentSubscription.productID != kFreeProductID) {
|
|
|
widgets.addAll([
|
|
|
Align(
|
|
|
alignment: Alignment.center,
|
|
@@ -189,11 +186,11 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
|
|
|
children: [
|
|
|
RichText(
|
|
|
text: TextSpan(
|
|
|
- text: !_isActiveStripeSubscriber
|
|
|
+ text: !_isStripeSubscriber
|
|
|
? "visit ${_currentSubscription.paymentProvider} to manage your subscription"
|
|
|
: "payment details",
|
|
|
style: TextStyle(
|
|
|
- color: _isActiveStripeSubscriber
|
|
|
+ color: _isStripeSubscriber
|
|
|
? Colors.blue
|
|
|
: Colors.white,
|
|
|
fontFamily: 'Ubuntu',
|
|
@@ -322,7 +319,7 @@ class _StripeSubscriptionPageState extends State<StripeSubscriptionPage> {
|
|
|
}
|
|
|
}
|
|
|
String stripPurChaseAction = 'buy';
|
|
|
- if (_isActiveStripeSubscriber) {
|
|
|
+ if (_isStripeSubscriber && _hasActiveSubscription) {
|
|
|
// confirm if user wants to change plan or not
|
|
|
var result = await showChoiceDialog(
|
|
|
context,
|