Skip to content

Instantly share code, notes, and snippets.

@dmvvilela
Created March 2, 2024 01:50
Show Gist options
  • Save dmvvilela/5c208964bdcec47e8815f8922282c5ed to your computer and use it in GitHub Desktop.
Save dmvvilela/5c208964bdcec47e8815f8922282c5ed 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: SafeArea(
child: Column(
children: [
Expanded(
child: ListView(
padding: EdgeInsets.all(16.0),
children: [
Image.network(
'https://corsproxy.io/?https%3A%2F%2Foaidalleapiprodscus.blob.core.windows.net%2Fprivate%2Forg-CNt8X2dje9qoaeKXbaJi2Ael%2Fuser-QcMCune3AUUdDQs2bg8OaaQZ%2Fimg-4Buj0RVzDfSprQVmTlZ4mwuI.png%3Fst%3D2024-03-02T00%253A50%253A58Z%26se%3D2024-03-02T02%253A50%253A58Z%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-01T18%253A23%253A26Z%26ske%3D2024-03-02T18%253A23%253A26Z%26sks%3Db%26skv%3D2021-08-06%26sig%3DuIYynz1Zze3MtlgPeZFpqO73kowRUm58eqSmQI%2FacE0%253D',
height: 300,
fit: BoxFit.cover,
),
SizedBox(height: 24),
Text(
'Experimente ser um usuário D-Fit Plus!',
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
),
),
SizedBox(height: 16),
_buildFeatureTile('Inteligência Artificial'),
_buildFeatureTile('Visualize seus resultados'),
_buildFeatureTile('Recursos exclusivos e mais!'),
SizedBox(height: 24),
_buildSubscriptionOption(
title: 'Monthly',
description: 'Acesso completo por R\$ 24,90/mo',
isSelected: selectedSubscription == 'Monthly',
onTap: () {
setState(() {
selectedSubscription = 'Monthly';
});
},
),
_buildSubscriptionOption(
title: 'Annual',
description: 'Acesso completo por R\$ 24,90/mo',
isSelected: selectedSubscription == 'Annual',
onTap: () {
setState(() {
selectedSubscription = 'Annual';
});
},
),
],
),
),
Container(
padding: EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
child: ElevatedButton(
onPressed: () {},
child: Text('Continuar'),
style: ElevatedButton.styleFrom(
primary: Colors.blue,
minimumSize: Size(double.infinity, 50),
),
),
),
TextButton(
onPressed: () {},
child: Text('Restore purchases'),
),
SizedBox(height: 16),
],
),
),
);
}
Widget _buildFeatureTile(String text) {
return ListTile(
leading: Icon(Icons.check, color: Colors.blue),
title: Text(text),
horizontalTitleGap: 0,
);
}
Widget _buildSubscriptionOption({
required String title,
required String description,
required bool isSelected,
required VoidCallback onTap,
}) {
return ListTile(
title: Text(title),
subtitle: Text(description),
leading: Radio<String>(
value: title,
groupValue: selectedSubscription,
onChanged: (value) {
onTap();
},
),
onTap: onTap,
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment