Created
December 9, 2023 04:59
-
-
Save mirkancal/cd4a8cef21528cb2583e1e5a5bcf6f48 to your computer and use it in GitHub Desktop.
Generated code from pixels2flutter.dev
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
debugShowCheckedModeBanner: false, | |
theme: ThemeData( | |
useMaterial3: true, | |
colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue), | |
), | |
home: PaywallPage(), | |
); | |
} | |
} | |
class PaywallPage extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
backgroundColor: Colors.blue.shade800, | |
body: SafeArea( | |
child: Column( | |
children: [ | |
Align( | |
alignment: Alignment.topLeft, | |
child: IconButton( | |
icon: Icon(Icons.close, color: Colors.white), | |
onPressed: () { | |
// Close the paywall page | |
}, | |
), | |
), | |
Padding( | |
padding: const EdgeInsets.symmetric(vertical: 24.0), | |
child: Text( | |
'Unlock Unlimited Access', | |
style: TextStyle( | |
color: Colors.white, | |
fontSize: 32, | |
fontWeight: FontWeight.bold, | |
), | |
textAlign: TextAlign.center, | |
), | |
), | |
PremiumBenefits(), | |
SizedBox(height: 24), | |
RatingReviews(), | |
SizedBox(height: 24), | |
Offers(), | |
SizedBox(height: 24), | |
CTAButton(), | |
SizedBox(height: 24), | |
PrivacyTerms(), | |
], | |
), | |
), | |
); | |
} | |
} | |
class PremiumBenefits extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Column( | |
children: [ | |
BenefitItem( | |
icon: Icons.cloud, | |
text: 'Unlimited documents', | |
), | |
BenefitItem( | |
icon: Icons.no_encryption, | |
text: 'No Limits on export', | |
), | |
BenefitItem( | |
icon: Icons.block, | |
text: 'No Ads and Limits', | |
), | |
], | |
); | |
} | |
} | |
class BenefitItem extends StatelessWidget { | |
final IconData icon; | |
final String text; | |
const BenefitItem({required this.icon, required this.text}); | |
@override | |
Widget build(BuildContext context) { | |
return Padding( | |
padding: const EdgeInsets.symmetric(vertical: 8.0), | |
child: Row( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: [ | |
CircleAvatar( | |
backgroundColor: Colors.white.withOpacity(0.2), | |
child: Icon(icon, color: Colors.white), | |
), | |
SizedBox(width: 10), | |
Text( | |
text, | |
style: TextStyle(color: Colors.white, fontSize: 18), | |
), | |
], | |
), | |
); | |
} | |
} | |
class RatingReviews extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Container( | |
height: 100, | |
child: PageView( | |
children: [ | |
ReviewItem(text: "This app has so much flash cards that I like. And most important that you can create them by yourself I could do all my books in a minutes!"), | |
ReviewItem(text: "Great app, easy to use and very helpful for studying on the go."), | |
ReviewItem(text: "I love the variety of flashcards and the ability to customize my learning experience."), | |
], | |
), | |
); | |
} | |
} | |
class ReviewItem extends StatelessWidget { | |
final String text; | |
const ReviewItem({required this.text}); | |
@override | |
Widget build(BuildContext context) { | |
return Padding( | |
padding: const EdgeInsets.symmetric(horizontal: 24.0), | |
child: Text( | |
text, | |
style: TextStyle(color: Colors.white, fontSize: 16), | |
textAlign: TextAlign.center, | |
), | |
); | |
} | |
} | |
class Offers extends StatefulWidget { | |
@override | |
_OffersState createState() => _OffersState(); | |
} | |
class _OffersState extends State<Offers> { | |
int _selectedOffer = 0; | |
@override | |
Widget build(BuildContext context) { | |
return Column( | |
children: [ | |
OfferItem( | |
text: '\$4.99/week, auto renewable', | |
isSelected: _selectedOffer == 0, | |
onTap: () { | |
setState(() { | |
_selectedOffer = 0; | |
}); | |
}, | |
), | |
OfferItem( | |
text: '3-day FREE TRIAL\n\$65.99/year, auto renewable', | |
isSelected: _selectedOffer == 1, | |
onTap: () { | |
setState(() { | |
_selectedOffer = 1; | |
}); | |
}, | |
isTrial: true, | |
), | |
], | |
); | |
} | |
} | |
class OfferItem extends StatelessWidget { | |
final String text; | |
final bool isSelected; | |
final bool isTrial; | |
final VoidCallback onTap; | |
const OfferItem({ | |
required this.text, | |
this.isSelected = false, | |
this.isTrial = false, | |
required this.onTap, | |
}); | |
@override | |
Widget build(BuildContext context) { | |
return GestureDetector( | |
onTap: onTap, | |
child: Container( | |
margin: const EdgeInsets.symmetric(vertical: 8.0), | |
padding: const EdgeInsets.all(16.0), | |
decoration: BoxDecoration( | |
color: isSelected ? Colors.blue.shade900 : Colors.transparent, | |
border: isSelected ? Border.all(color: Colors.blue, width: 2) : null, | |
borderRadius: BorderRadius.circular(10), | |
gradient: isSelected ? LinearGradient(colors: [Colors.blue.shade700, Colors.blue.shade800]) : null, | |
), | |
child: Column( | |
children: [ | |
Text( | |
text, | |
style: TextStyle(color: Colors.white, fontSize: 18), | |
textAlign: TextAlign.center, | |
), | |
if (isTrial) ...[ | |
SizedBox(height: 4), | |
Text( | |
'Save 98%', | |
style: TextStyle(color: Colors.orange, fontSize: 16), | |
), | |
], | |
], | |
), | |
), | |
); | |
} | |
} | |
class CTAButton extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return ElevatedButton( | |
style: ElevatedButton.styleFrom( | |
primary: Colors.blue, | |
padding: EdgeInsets.symmetric(horizontal: 100, vertical: 20), | |
shape: RoundedRectangleBorder( | |
borderRadius: BorderRadius.circular(30), | |
), | |
), | |
onPressed: () { | |
// Start the free trial and plan | |
}, | |
child: Text( | |
'Start Free Trial and Plan', | |
style: TextStyle(fontSize: 18), | |
), | |
); | |
} | |
} | |
class PrivacyTerms extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Column( | |
children: [ | |
TextButton( | |
onPressed: () { | |
// Navigate to privacy policy | |
}, | |
child: Text( | |
'Privacy | Terms', | |
style: TextStyle(color: Colors.white70, fontSize: 16), | |
), | |
), | |
Text( | |
'Cancel Anytime', | |
style: TextStyle(color: Colors.white70, fontSize: 16), | |
), | |
], | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment