Paywall Screen
Loading preview
Starting the Flutter app
A showcase of Flutter's paywall screen functionality
import 'package:flutter/material.dart';
class PaywallScreen extends StatelessWidget {
const PaywallScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: Column(
children: [
Container(
height: 240,
color: Colors.deepPurple.withValues(alpha: 0.2),
child: Center(
child: Icon(Icons.lock_open, size: 80, color: Colors.deepPurple[300]),
),
),
Padding(
padding: const EdgeInsets.all(24),
child: Column(
children: [
Text(
'Unlock Premium',
style: Theme.of(context).textTheme.headlineSmall,
),
const SizedBox(height: 8),
Text(
'Get unlimited access to all features',
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.bodyLarge,
),
const SizedBox(height: 24),
...['Unlimited projects', 'Priority support', 'Advanced analytics'].map((f) => Padding(
padding: const EdgeInsets.only(bottom: 12),
child: Row(
children: [
Icon(Icons.check_circle, color: Colors.green[700]),
const SizedBox(width: 12),
Text(f),
],
),
)),
const SizedBox(height: 24),
FilledButton(
onPressed: () => _showDemo(context, 'Subscribe (demo)'),
style: FilledButton.styleFrom(
minimumSize: const Size.fromHeight(48),
),
child: const Text('Subscribe for \$19/month'),
),
const SizedBox(height: 12),
TextButton(
onPressed: () => Navigator.of(context).pop(),
child: const Text('Maybe later'),
),
],
),
),
],
),
),
);
}
}
void _showDemo(BuildContext context, String message) {
ScaffoldMessenger.of(context)
..hideCurrentSnackBar()
..showSnackBar(SnackBar(content: Text(message)));
}
Add it to your project
Copies the Dart source into your app, so you own it. Flutter SDK only, no extra packages.
First time? Run dart pub global activate fluttertemplates_dev, or read the CLI guide.
How it works
A non-scrolling Column: a 240px hero block, benefit rows generated from an inline list, a subscribe button and Maybe later. The latter is the only live control, calling Navigator.of(context).pop(). Subscribing only shows a demo SnackBar, and $19/month is baked into the label. Because nothing scrolls, smaller phones can overflow at the bottom.
Adapting it
- Connect the
FilledButtontoin_app_purchaseor RevenueCat, and take price text from the store product. - Add a restore purchases
TextButton, which store reviewers expect. - Wrap the lower
Paddingin aSingleChildScrollView.