handle only lifetime product case

This commit is contained in:
Vadim 2025-08-08 13:52:42 +02:00
parent 9d04593479
commit e24bd8b2ec

View file

@ -63,28 +63,31 @@ class _LightmeterProOfferingState extends State<LightmeterProOffering> {
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Stack( if (!_isLifetimeOnly)
alignment: Alignment.center, Padding(
children: [ padding: const EdgeInsets.only(bottom: Dimens.paddingS),
AnimatedOpacity( child: Stack(
duration: Dimens.durationM, alignment: Alignment.center,
opacity: _isLoading ? Dimens.disabledOpacity : Dimens.enabledOpacity, children: [
child: _Products( AnimatedOpacity(
monthly: monthly, duration: Dimens.durationM,
yearly: yearly, opacity: _isLoading ? Dimens.disabledOpacity : Dimens.enabledOpacity,
lifetime: lifetime, child: _Products(
selected: selected, monthly: monthly,
onProductSelected: _selectProduct, yearly: yearly,
), lifetime: lifetime,
selected: selected,
onProductSelected: _selectProduct,
),
),
if (_isLoading)
const SizedBox(
height: 120,
child: Center(child: CircularProgressIndicator()),
),
],
), ),
if (_isLoading) ),
const SizedBox(
height: 120,
child: Center(child: CircularProgressIndicator()),
),
],
),
const SizedBox(height: Dimens.grid8),
FilledButtonLarge( FilledButtonLarge(
title: S.of(context).continuePurchase, title: S.of(context).continuePurchase,
onPressed: _isLoading || selected != null ? _buyPro : null, onPressed: _isLoading || selected != null ? _buyPro : null,
@ -94,6 +97,8 @@ class _LightmeterProOfferingState extends State<LightmeterProOffering> {
); );
} }
bool get _isLifetimeOnly => lifetime != null && yearly == null && monthly == null;
void _selectProduct(IAPProduct product) { void _selectProduct(IAPProduct product) {
if (!_isLoading) { if (!_isLoading) {
setState(() { setState(() {