Skip to content

Commit

Permalink
to full screen and add close button to premium introduction sheet
Browse files Browse the repository at this point in the history
  • Loading branch information
bannzai committed Feb 20, 2022
1 parent 32f168b commit 0687ea2
Showing 1 changed file with 72 additions and 70 deletions.
142 changes: 72 additions & 70 deletions lib/domain/premium_introduction/premium_introduction_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,87 +31,89 @@ class PremiumIntroductionSheet extends HookConsumerWidget {
return Indicator();
}

return DraggableScrollableSheet(
initialChildSize: 0.9,
maxChildSize: 0.9,
builder: (context, scrollController) {
return HUD(
shown: state.isLoading,
child: UniversalErrorPage(
error: null,
reload: () => store.reset(),
child: Container(
width: MediaQuery.of(context).size.width,
color: PilllColors.white,
child: Stack(
children: [
Container(
decoration: BoxDecoration(
color: Colors.transparent,
image: !state.isPremium && !isOverDiscountDeadline
? DecorationImage(
image:
AssetImage("images/premium_background.png"),
fit: BoxFit.cover,
)
: null,
),
padding: EdgeInsets.only(left: 40, right: 40, bottom: 40),
width: MediaQuery.of(context).size.width,
),
SingleChildScrollView(
controller: scrollController,
padding: EdgeInsets.only(bottom: 100),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
PremiumIntroductionHeader(),
if (state.isPremium) ...[
SizedBox(height: 32),
PremiumUserThanksRow(),
],
if (!state.isPremium) ...[
if (state.hasDiscountEntitlement)
PremiumIntroductionDiscountRow(
discountEntitlementDeadlineDate:
discountEntitlementDeadlineDate,
),
if (offerings != null) ...[
SizedBox(height: 32),
PurchaseButtons(
offerings: offerings,
store: store,
),
],
],
SizedBox(height: 24),
AlertButton(
onPressed: () async {
analytics.logEvent(
name: "pressed_premium_functions_on_sheet");
await launch(preimumLink);
},
text: "プレミアム機能を見る"),
SizedBox(height: 24),
PremiumIntroductionFotter(),
return HUD(
shown: state.isLoading,
child: UniversalErrorPage(
error: null,
reload: () => store.reset(),
child: Container(
padding: const EdgeInsets.only(top: 20),
width: MediaQuery.of(context).size.width,
color: PilllColors.white,
child: Stack(
children: [
Container(
decoration: BoxDecoration(
color: Colors.transparent,
image: !state.isPremium && !isOverDiscountDeadline
? DecorationImage(
image: AssetImage("images/premium_background.png"),
fit: BoxFit.cover,
)
: null,
),
padding: EdgeInsets.only(left: 40, right: 40, bottom: 40),
width: MediaQuery.of(context).size.width,
),
SingleChildScrollView(
padding: EdgeInsets.only(bottom: 100),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
PremiumIntroductionHeader(),
if (state.isPremium) ...[
SizedBox(height: 32),
PremiumUserThanksRow(),
],
if (!state.isPremium) ...[
if (state.hasDiscountEntitlement)
PremiumIntroductionDiscountRow(
discountEntitlementDeadlineDate:
discountEntitlementDeadlineDate,
),
if (offerings != null) ...[
SizedBox(height: 32),
PurchaseButtons(
offerings: offerings,
store: store,
),
],
),
),
],
],
SizedBox(height: 24),
AlertButton(
onPressed: () async {
analytics.logEvent(
name: "pressed_premium_functions_on_sheet");
await launch(preimumLink);
},
text: "プレミアム機能を見る"),
SizedBox(height: 24),
PremiumIntroductionFotter(),
],
),
),
Positioned(
left: 7,
top: 20,
child: IconButton(
icon: Icon(Icons.close, color: Colors.black),
onPressed: () => Navigator.of(context).pop(),
),
),
)),
);
},
],
),
)),
);
}
}

showPremiumIntroductionSheet(BuildContext context) {
analytics.setCurrentScreen(screenName: "PremiumIntroductionSheet");

showModalBottomSheet(
context: context,
builder: (_) => PremiumIntroductionSheet(),
isScrollControlled: true,
backgroundColor: Colors.transparent,
isScrollControlled: true,
);
}

0 comments on commit 0687ea2

Please sign in to comment.