Skip to content

Instantly share code, notes, and snippets.

@suamirochadev
Created April 10, 2024 15:17
Show Gist options
  • Save suamirochadev/32105a17bf949770234ab4f24cd2b6bc to your computer and use it in GitHub Desktop.
Save suamirochadev/32105a17bf949770234ab4f24cd2b6bc to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
import 'app/service/project_service.dart';
class PortfolioApp extends StatelessWidget {
const PortfolioApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Suami Rocha Dev 🩶',
theme: ThemeData(
primarySwatch: Colors.grey,
),
debugShowCheckedModeBanner: false,
home: const PortfolioPage(),
);
}
}
final Uri _twitter = Uri.parse('https://twitter.com/suamirochadev');
Future<void> _launchUrlTwitter() async {
if (!await launchUrl(_twitter)) {
throw Exception('Could not launch $_twitter');
}
}
final Uri _linkedin = Uri.parse('https://www.linkedin.com/in/suamirochadev/');
Future<void> _launchUrlLinkedin() async {
if (!await launchUrl(_linkedin)) {
throw Exception('Could not launch $_linkedin');
}
}
final Uri _links = Uri.parse('https://bento.me/suamirochadev');
Future<void> _launchUrlLinks() async {
if (!await launchUrl(_links)) {
throw Exception('Could not launch $_links');
}
}
class PortfolioPage extends StatelessWidget {
const PortfolioPage({super.key});
final List<String> items = const [
'Item 1',
'Item 2',
'Item 3',
'Item 4',
'Item 5',
];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.black.withOpacity(0.4),
title: const Text(
'Não fique de fora das minhas últimas novidades!',
style: TextStyle(
fontSize: 10.0,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
centerTitle: true,
actions: <Widget>[
TextButton(
onPressed: () {
_launchUrlLinks();
},
child: const Text(
'Links',
style: TextStyle(
color: Colors.white,
),
),
),
IconButton(
icon: const Icon(Icons.notifications),
onPressed: () {
_launchUrlTwitter();
},
color: Colors.white,
),
IconButton(
icon: const Icon(Icons.work),
onPressed: () {
_launchUrlLinkedin();
},
color: Colors.white,
),
],
),
body: SingleChildScrollView(
child: FutureBuilder<List<Project>>(
future: fetchProjects(),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return const CircularProgressIndicator();
} else if (snapshot.hasError) {
return Text('Error: ${snapshot.error}');
} else {
return Center(
child: Container(
padding: const EdgeInsets.all(20.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const CircleAvatar(
radius: 100.0,
backgroundImage: AssetImage('images/me.png'),
),
const SizedBox(height: 20.0),
const Text(
'Suami Rocha',
style: TextStyle(
fontSize: 30.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 10.0),
const Text(
'Desenvolvedora Mobile',
style: TextStyle(
fontSize: 20.0,
color: Colors.grey,
),
),
const SizedBox(height: 20.0),
const Text(
'Sobre Mim',
style: TextStyle(
fontSize: 25.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 10.0),
const Text(
'Desenvolvedora Flutter determinada, apaixonada por tecnologia e açaí, mãe amorosa e gamer nas horas vagas. 🚀👩‍💻🍇🎮',
textAlign: TextAlign.center,
),
const SizedBox(height: 20.0),
const Text(
'Projetos',
style: TextStyle(
fontSize: 25.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 10.0),
GridView.count(
shrinkWrap: true,
crossAxisCount: 2,
crossAxisSpacing: 10.0,
mainAxisSpacing: 10.0,
children: snapshot.data!.map((project) {
return GestureDetector(
onTap: () async {
Uri uri = Uri.parse(project.url);
if (await launchUrl(uri)) {
await launchUrl(uri);
} else {
throw 'Não foi possível iniciar ${project.url}';
}
},
child: Card(
color: Colors.black.withOpacity(0.02),
elevation: 2.0,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
project.imageUrl,
fit: BoxFit.cover,
scale: 1.0,
),
Text(
project.title,
style: const TextStyle(
fontSize: 18.0,
fontWeight: FontWeight.bold,
),
),
Text(
project.description,
textAlign: TextAlign.center,
),
],
),
),
);
}).toList(),
),
ListView.builder(
itemCount: items.length,
itemBuilder: (BuildContext context, int index) {
return Card(
elevation: 2.0,
margin: const EdgeInsets.symmetric(
horizontal: 10.0, vertical: 5.0),
child: ListTile(
title: Text(
items[index],
style: const TextStyle(
fontSize: 18.0,
fontWeight: FontWeight.bold,
),
),
trailing: const Icon(Icons.arrow_forward),
onTap: () {
// Implementar ação ao tocar em um item, se necessário
},
),
);
},
)
],
),
),
);
}
},
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment