Skip to content

Instantly share code, notes, and snippets.

@dmvvilela
Created March 2, 2024 00:54
Show Gist options
  • Save dmvvilela/288219896f20cb958ce40a12ac85a98f to your computer and use it in GitHub Desktop.
Save dmvvilela/288219896f20cb958ce40a12ac85a98f 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,
primarySwatch: Colors.blue,
),
home: SubscriptionPage(),
);
}
}
class SubscriptionPage extends StatefulWidget {
@override
_SubscriptionPageState createState() => _SubscriptionPageState();
}
class _SubscriptionPageState extends State<SubscriptionPage> {
String _selectedSubscription = 'monthly';
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: SingleChildScrollView(
child: Column(
children: [
Image.network(
'https://corsproxy.io/?https%3A%2F%2Foaidalleapiprodscus.blob.core.windows.net%2Fprivate%2Forg-CNt8X2dje9qoaeKXbaJi2Ael%2Fuser-QcMCune3AUUdDQs2bg8OaaQZ%2Fimg-vHLmMXDypjrbeueuYgaGXJTr.png%3Fst%3D2024-03-01T23%253A54%253A18Z%26se%3D2024-03-02T01%253A54%253A18Z%26sp%3Dr%26sv%3D2021-08-06%26sr%3Db%26rscd%3Dinline%26rsct%3Dimage%2Fpng%26skoid%3D6aaadede-4fb3-4698-a8f6-684d7786b067%26sktid%3Da48cca56-e6da-484e-a814-9c849652bcb3%26skt%3D2024-03-01T15%253A11%253A33Z%26ske%3D2024-03-02T15%253A11%253A33Z%26sks%3Db%26skv%3D2021-08-06%26sig%3D4jqAGAHfGQKFgozFveiLcIWUP9dKCKJmKOp%252BpadwNzQ%253D',
width: double.infinity,
fit: BoxFit.cover,
),
Padding(
padding: const EdgeInsets.all(24.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Experimente ser um usuário D-Fit Plus!',
style: TextStyle(
fontSize: 24.0,
fontWeight: FontWeight.bold,
),
),
SizedBox(height: 24.0),
_buildCheckItem('Inteligência Artificial'),
_buildCheckItem('Visualize seus resultados'),
_buildCheckItem('Recursos exclusivos e mais!'),
SizedBox(height: 24.0),
_buildSubscriptionOption(
title: 'Monthly',
description: 'Acesso completo por \$4.99/mo',
value: 'monthly',
),
_buildSubscriptionOption(
title: 'Annual',
description: 'Acesso completo por \$39.99/yr',
value: 'annual',
discount: '33% OFF',
),
SizedBox(height: 24.0),
ElevatedButton(
onPressed: () {},
child: Text('Continuar'),
style: ElevatedButton.styleFrom(
minimumSize: Size(double.infinity, 50),
),
),
TextButton(
onPressed: () {},
child: Text('Restore'),
),
],
),
),
],
),
),
);
}
Widget _buildCheckItem(String text) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0),
child: Row(
children: [
Icon(Icons.check, color: Colors.blue),
SizedBox(width: 8.0),
Text(text),
],
),
);
}
Widget _buildSubscriptionOption({
required String title,
required String description,
required String value,
String? discount,
}) {
return ListTile(
leading: Radio<String>(
value: value,
groupValue: _selectedSubscription,
onChanged: (String? newValue) {
setState(() {
_selectedSubscription = newValue!;
});
},
),
title: Text(title),
subtitle: Text(description),
trailing: discount != null
? Container(
padding: EdgeInsets.symmetric(horizontal: 8.0, vertical: 4.0),
decoration: BoxDecoration(
color: Colors.grey[200],
borderRadius: BorderRadius.circular(20.0),
),
child: Text(
discount,
style: TextStyle(color: Colors.red, fontWeight: FontWeight.bold),
),
)
: null,
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment