ente/lib/ui/growth/code_success_screen.dart

168 lines
7 KiB
Dart
Raw Normal View History

2023-02-23 04:11:39 +00:00
import "package:flutter/material.dart";
import "package:flutter_animate/flutter_animate.dart";
import "package:photos/generated/l10n.dart";
2023-02-23 04:11:39 +00:00
import "package:photos/models/api/storage_bonus/storage_bonus.dart";
import "package:photos/models/user_details.dart";
import "package:photos/theme/ente_theme.dart";
import 'package:photos/ui/components/buttons/icon_button_widget.dart';
2023-02-23 04:11:39 +00:00
import "package:photos/ui/components/captioned_text_widget.dart";
import "package:photos/ui/components/menu_item_widget/menu_item_widget.dart";
import "package:photos/ui/components/title_bar_title_widget.dart";
import "package:photos/ui/components/title_bar_widget.dart";
import "package:photos/ui/growth/referral_code_widget.dart";
import "package:photos/ui/growth/storage_details_screen.dart";
import "package:photos/utils/navigation_util.dart";
import "package:photos/utils/share_util.dart";
class CodeSuccessScreen extends StatelessWidget {
final ReferralView referralView;
final UserDetails userDetails;
const CodeSuccessScreen(this.referralView, this.userDetails, {super.key});
@override
Widget build(BuildContext context) {
final colorScheme = getEnteColorScheme(context);
final textStyle = getEnteTextTheme(context);
return Scaffold(
body: CustomScrollView(
primary: false,
slivers: <Widget>[
TitleBarWidget(
flexibleSpaceTitle: TitleBarTitleWidget(
title: S.of(context).codeAppliedPageTitle,
2023-02-23 04:11:39 +00:00
),
actionIcons: [
IconButtonWidget(
icon: Icons.close_outlined,
iconButtonType: IconButtonType.secondary,
onTap: () {
Navigator.pop(context);
},
),
],
),
SliverList(
delegate: SliverChildBuilderDelegate(
(delegateBuildContext, index) {
return Padding(
padding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 6,
),
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 12.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Icon(
Icons.check,
color: colorScheme.primary500,
size: 96,
)
.animate()
.scaleXY(
begin: 0.5,
end: 1,
duration: 750.ms,
curve: Curves.easeInOutCubic,
delay: 250.ms,
)
.fadeIn(
duration: 500.ms,
curve: Curves.easeInOutCubic,
),
2023-02-23 04:11:39 +00:00
Text(
S.of(context).storageInGB(
referralView.planInfo.storageInGB,
),
2023-02-23 04:11:39 +00:00
style: textStyle.h2Bold,
),
2023-04-05 06:46:36 +00:00
Text(S.of(context).claimed, style: textStyle.bodyMuted),
2023-02-23 04:11:39 +00:00
const SizedBox(height: 32),
MenuItemWidget(
captionedTextWidget: CaptionedTextWidget(
title: S.of(context).details,
2023-02-23 04:11:39 +00:00
),
menuItemColor: colorScheme.fillFaint,
trailingWidget: Icon(
Icons.chevron_right_outlined,
color: colorScheme.strokeBase,
),
singleBorderRadius: 8,
alignCaptionedTextToLeft: true,
onTap: () async {
routeToPage(
context,
StorageDetailsScreen(referralView, userDetails),
);
},
),
const SizedBox(height: 32),
InkWell(
onTap: () {
shareText(
S.of(context).shareTextReferralCode(
referralView.code,
referralView.planInfo.storageInGB,
),
2023-02-23 04:11:39 +00:00
);
},
child: Container(
width: double.infinity,
decoration: BoxDecoration(
border: Border.all(
color: colorScheme.strokeFaint,
width: 1,
),
borderRadius: BorderRadius.circular(8),
),
child: Padding(
padding: const EdgeInsets.symmetric(
vertical: 12,
horizontal: 12,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
S.of(context).claimMore,
2023-02-23 04:11:39 +00:00
style: textStyle.body,
),
const SizedBox(height: 8),
Text(
S.of(context).freeStorageOnReferralSuccess(
referralView.planInfo.storageInGB,
),
2023-04-05 06:46:36 +00:00
style: textStyle.smallMuted,
2023-02-23 04:11:39 +00:00
textAlign: TextAlign.center,
),
const SizedBox(height: 16),
ReferralCodeWidget(referralView.code),
const SizedBox(height: 16),
Text(
S.of(context).theyAlsoGetXGb(
referralView.planInfo.storageInGB,
),
2023-04-05 06:46:36 +00:00
style: textStyle.smallMuted,
2023-02-23 04:11:39 +00:00
textAlign: TextAlign.center,
),
],
),
),
),
2023-08-19 11:39:56 +00:00
),
2023-02-23 04:11:39 +00:00
],
),
),
);
},
childCount: 1,
),
),
],
),
);
}
}