Skip to content

Instantly share code, notes, and snippets.

@mirkancal
Created December 9, 2023 04:56
Show Gist options
  • Save mirkancal/5a8c011274adac2ea6beb96180e02c48 to your computer and use it in GitHub Desktop.
Save mirkancal/5a8c011274adac2ea6beb96180e02c48 to your computer and use it in GitHub Desktop.
Generated code from pixels2flutter.dev
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.fromSwatch().copyWith(
primary: Colors.blue,
secondary: Colors.blue,
background: Color(0xFF000046),
),
),
home: PaywallScreen(),
);
}
}
class PaywallScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Theme.of(context).colorScheme.background,
body: SafeArea(
child: Column(
children: [
Padding(
padding: const EdgeInsets.only(top: 16.0, right: 16.0),
child: Align(
alignment: Alignment.topRight,
child: IconButton(
icon: Icon(Icons.close, color: Colors.white),
onPressed: () {
Navigator.pop(context);
},
),
),
),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'Unlock Unlimited Access',
style: TextStyle(
color: Colors.white,
fontSize: 24,
fontWeight: FontWeight.bold,
),
textAlign: TextAlign.center,
),
SizedBox(height: 32),
Icon(Icons.lock_outline, color: Colors.white, size: 64),
SizedBox(height: 16),
Text(
'Unlimited documents',
style: TextStyle(color: Colors.white, fontSize: 18),
),
SizedBox(height: 8),
Text(
'No Limits on export',
style: TextStyle(color: Colors.white, fontSize: 18),
),
SizedBox(height: 8),
Text(
'No Ads and Limits',
style: TextStyle(color: Colors.white, fontSize: 18),
),
SizedBox(height: 32),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 32.0),
child: Text(
'"This app has so much flash cards that I like. And most important that you car create them by yourself I could do all my books in a minutes!"',
style: TextStyle(color: Colors.white, fontSize: 16),
textAlign: TextAlign.center,
),
),
SizedBox(height: 32),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
_buildPageIndicator(true),
_buildPageIndicator(false),
_buildPageIndicator(false),
],
),
SizedBox(height: 32),
_buildPriceOption(context, '4.99/week, auto renewable', true),
SizedBox(height: 8),
_buildPriceOption(context, '3-day FREE TRIAL\n\$65.99/year, auto renewable', false),
SizedBox(height: 32),
ElevatedButton(
onPressed: () {},
child: Text('Start Free Trial and Plan'),
style: ElevatedButton.styleFrom(
primary: Theme.of(context).colorScheme.primary,
padding: EdgeInsets.symmetric(horizontal: 48, vertical: 16),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30),
),
),
),
SizedBox(height: 16),
TextButton(
onPressed: () {},
child: Text(
'Cancel Anytime',
style: TextStyle(color: Colors.white),
),
),
],
),
),
Padding(
padding: const EdgeInsets.only(bottom: 16.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
TextButton(
onPressed: () {},
child: Text(
'Privacy',
style: TextStyle(color: Colors.white),
),
),
Text(
'|',
style: TextStyle(color: Colors.white),
),
TextButton(
onPressed: () {},
child: Text(
'Terms',
style: TextStyle(color: Colors.white),
),
),
],
),
),
],
),
),
);
}
Widget _buildPageIndicator(bool isActive) {
return Container(
margin: EdgeInsets.symmetric(horizontal: 4),
height: 8,
width: isActive ? 24 : 8,
decoration: BoxDecoration(
color: isActive ? Colors.blue : Colors.white.withOpacity(0.5),
borderRadius: BorderRadius.circular(4),
),
);
}
Widget _buildPriceOption(BuildContext context, String text, bool isMainOption) {
return Container(
padding: EdgeInsets.symmetric(vertical: 16, horizontal: 32),
decoration: BoxDecoration(
color: isMainOption ? Colors.white.withOpacity(0.1) : Colors.transparent,
borderRadius: BorderRadius.circular(30),
border: isMainOption ? null : Border.all(color: Colors.white.withOpacity(0.5)),
),
child: Column(
children: [
Text(
text.split('\n').first,
style: TextStyle(
color: Colors.white,
fontSize: 18,
fontWeight: FontWeight.bold,
),
),
if (text.split('\n').length > 1)
Text(
text.split('\n').last,
style: TextStyle(
color: Colors.white.withOpacity(0.7),
fontSize: 16,
),
),
if (isMainOption)
Padding(
padding: const EdgeInsets.only(top: 4.0),
child: Text(
'Save 98%',
style: TextStyle(
color: Colors.greenAccent,
fontSize: 16,
),
),
),
],
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment