diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index f748fea..53c4580 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -1,6 +1,13 @@
-
+
+
+
+
+
+
+
@@ -30,5 +37,8 @@
+
+
+
diff --git a/assets/UserForum.png b/assets/UserForum.png
new file mode 100644
index 0000000..d6f6635
Binary files /dev/null and b/assets/UserForum.png differ
diff --git a/assets/userPost.png b/assets/userPost.png
new file mode 100644
index 0000000..76b3e99
Binary files /dev/null and b/assets/userPost.png differ
diff --git a/assets/userPost2.png b/assets/userPost2.png
new file mode 100644
index 0000000..8f00dfe
Binary files /dev/null and b/assets/userPost2.png differ
diff --git a/lib/src/screens/EmConstrucao/EmConstrucaoScreen.dart b/lib/src/screens/EmConstrucao/EmConstrucaoScreen.dart
deleted file mode 100644
index cff6c06..0000000
--- a/lib/src/screens/EmConstrucao/EmConstrucaoScreen.dart
+++ /dev/null
@@ -1,75 +0,0 @@
-import 'package:flutter/material.dart';
-import 'dart:ui';
-
-import '../../app/theme/colors.dart';
-
-class EmConstrucaoScreen extends StatefulWidget {
- const EmConstrucaoScreen({super.key});
-
- @override
- State createState() => _EmConstrucaoScreenState();
-}
-
-class _EmConstrucaoScreenState extends State {
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- // bottomNavigationBar: const AppBottomNavigationBar(),
- backgroundColor: AppColors.white,
- body: Center(
- child: Stack(
- children: [
- Positioned.fill(
- child: BackdropFilter(
- filter: ImageFilter.blur(sigmaX: 8, sigmaY: 8),
- child: Container(
- color: Colors.transparent,
- ),
- ),
- ),
- Card(
- elevation: 4,
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(16),
- ),
- child: const Padding(
- padding: EdgeInsets.all(24),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- mainAxisSize: MainAxisSize.min,
- children: [
- Icon(
- Icons.construction,
- size: 100,
- color: AppColors.lightOrange,
- ),
- SizedBox(height: 16),
- Text(
- 'Em construção',
- style: TextStyle(
- fontFamily: 'Poppins',
- fontSize: 34,
- fontWeight: FontWeight.bold,
- color: AppColors.purple,
- ),
- ),
- SizedBox(height: 16),
- Text(
- 'Desculpe-nos pelo transtorno.\nEstamos trabalhando nesta Funcionalidade.',
- textAlign: TextAlign.center,
- style: TextStyle(
- fontFamily: 'Poppins',
- fontSize: 23,
- color: Color.fromRGBO(62, 0, 71, 0.984),
- ),
- ),
- ],
- ),
- ),
- ),
- ],
- ),
- ),
- );
- }
-}
diff --git a/lib/src/screens/Forum/CreatePost.dart b/lib/src/screens/Forum/CreatePost.dart
new file mode 100644
index 0000000..5f64a59
--- /dev/null
+++ b/lib/src/screens/Forum/CreatePost.dart
@@ -0,0 +1,123 @@
+import 'dart:io';
+import "package:flutter/cupertino.dart";
+import "package:flutter/material.dart";
+import '../../models/user.dart';
+import 'Post/ForumPost.dart';
+import 'package:juno/src/database/dao/user_dao.dart';
+import 'package:intl/intl.dart';
+
+class CreatePost extends StatefulWidget {
+ final int userId;
+
+ const CreatePost({Key? key, required this.userId}) : super(key: key);
+
+ @override
+ _CreatePostState createState() => _CreatePostState();
+}
+
+class _CreatePostState extends State {
+ final TextEditingController titleController = TextEditingController();
+ final TextEditingController contentController = TextEditingController();
+ String authorName = ""; // Nome do autor
+
+ @override
+ void initState() {
+ super.initState();
+ // Buscar o nome do usuário no banco de dados ao iniciar a tela
+ getUserInfo();
+ }
+
+ // Função para buscar o nome do usuário no banco de dados
+ void getUserInfo() async {
+ try {
+ User user = await UserDAO.getUserById(widget.userId);
+ setState(() {
+ authorName = "${user.nome}"; // Altere conforme a estrutura do seu objeto User
+ });
+ } catch (e) {
+ print("Erro ao buscar informações do usuário: $e");
+ }
+ }
+
+ // Função para criar uma nova postagem
+ void criarPostagem() {
+ if (titleController.text.isNotEmpty && contentController.text.isNotEmpty) {
+ // obter data e hora atual
+ DateTime agora = DateTime.now();
+ String dataHoraAtual = DateFormat('dd/MM/yyyy - HH:mm').format(agora);
+
+ ForumPost novaPostagem = ForumPost(
+ author: authorName, // Usar o nome do autor obtido do banco de dados
+ date: dataHoraAtual,
+ content: contentController.text,
+ );
+
+ // Adicione a nova postagem à lista de postagens (que deve ser acessível a partir da tela do fórum)
+ // forumPosts.add(novaPostagem);
+
+ // Navegue de volta para a tela do fórum
+ Navigator.pop(context, novaPostagem);
+ }
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return Scaffold(
+ appBar: AppBar(
+ title: Text('Criar Postagem'),
+ backgroundColor: Color(0xFF3A0751),
+ ),
+ body: SingleChildScrollView(
+ child: Container(
+ color: Color(0xFFFFFFFF),
+ padding: EdgeInsets.all(16),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.center,
+ children: [
+ CircleAvatar(
+ radius: 80,
+ backgroundImage: AssetImage('assets/UserForum.png'),
+ ),
+ SizedBox(height: 16),
+ Text(
+ "Autor: $authorName", // Exibir o nome do autor
+ style: TextStyle(
+ fontSize: 18,
+ fontWeight: FontWeight.bold,
+ color: Color(0xFF3A0751),
+ ),
+ ),
+ SizedBox(height: 16),
+ TextFormField(
+ controller: titleController,
+ decoration: InputDecoration(
+ labelText: 'Título',
+ labelStyle: TextStyle(
+ color: Color(0xFF3A0751),
+ ),
+ ),
+ ),
+ TextFormField(
+ controller: contentController,
+ decoration: InputDecoration(
+ labelText: 'Conteúdo',
+ labelStyle: TextStyle(
+ color: Color(0xFF3A0751),
+ ),
+ ),
+ ),
+ SizedBox(height: 16),
+ ElevatedButton(
+ onPressed: criarPostagem,
+ child: Text('Criar Postagem'),
+ style: ElevatedButton.styleFrom(
+ primary: Color(0xFF3A0751),
+ ),
+ ),
+ ],
+ ),
+ ),
+ ),
+ );
+ }
+}
diff --git a/lib/src/screens/Forum/Forum.dart b/lib/src/screens/Forum/Forum.dart
new file mode 100644
index 0000000..4685270
--- /dev/null
+++ b/lib/src/screens/Forum/Forum.dart
@@ -0,0 +1,120 @@
+import 'package:flutter/material.dart';
+import 'CreatePost.dart';
+import 'ProfileScreens/ProfileForum.dart';
+import 'PostCardForum.dart';
+import 'Post/ForumPost.dart';
+
+
+class ForumScreen extends StatefulWidget {
+ const ForumScreen({Key? key}) : super(key: key);
+
+ @override
+ _ForumScreenState createState() => _ForumScreenState();
+}
+
+class _ForumScreenState extends State {
+ String searchKeyword = '';
+ List forumPosts = []; // Corrija o tipo da lista para ForumPost
+
+ void removePost(ForumPost post) async {
+ await ForumPost.deletePost(post);
+ _loadPosts();
+ }
+
+ @override
+ void initState() {
+ super.initState();
+ _loadPosts();
+ }
+
+ void _loadPosts() async {
+ List posts = await ForumPost.getPosts(); // Corrija o tipo da lista para ForumPost
+ setState(() {
+ forumPosts = posts;
+ });
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return Scaffold(
+ appBar: AppBar(
+ title: Text('Fórum - Juno'),
+ backgroundColor: Colors.red,
+ centerTitle: true,
+ ),
+ body: Container(
+ color: Color(0xFFFFFFFF),
+ child: Column(
+ children: [
+ Padding(
+ padding: EdgeInsets.all(16),
+ child: Row(
+ children: [
+ Expanded(
+ child: TextField(
+ decoration: InputDecoration(
+ hintText: 'Pesquisar',
+ prefixIcon: Icon(Icons.search),
+ ),
+ onChanged: (value) {
+ setState(() {
+ searchKeyword = value;
+ });
+ },
+ ),
+ ),
+ InkWell(
+ onTap: () {
+ Navigator.push(
+ context,
+ MaterialPageRoute(
+ builder: (context) => ProfileForum(),
+ ),
+ );
+ },
+ child: CircleAvatar(
+ radius: 25,
+ backgroundImage: AssetImage('assets/UserForum.png'),
+ ),
+ ),
+ ],
+ ),
+ ),
+ Expanded(
+ child: ListView.builder(
+ itemCount: forumPosts.length,
+ itemBuilder: (context, index) {
+ return PostCardForum(
+ post: forumPosts[index],
+ onDelete: () {
+ removePost(forumPosts[index]);
+ },
+ );
+ },
+ ),
+ ),
+ ],
+ ),
+ ),
+ floatingActionButton: FloatingActionButton(
+ onPressed: () async {
+ // Navegue para a tela CreatePost e aguarde o resultado
+ final novaPostagem = await Navigator.push(
+ context,
+ MaterialPageRoute(
+ builder: (context) => CreatePost(userId: 1,),
+ ),
+ );
+
+ // Se houver uma nova postagem, adicione-a ao banco de dados e recarregue as postagens
+ if (novaPostagem != null) {
+ await ForumPost.insertPost(novaPostagem); // Corrija para ForumPost
+ _loadPosts();
+ }
+ },
+ child: Icon(Icons.add),
+ backgroundColor: Color(0xFF3A0751),
+ ),
+ );
+ }
+}
\ No newline at end of file
diff --git a/lib/src/screens/Forum/Post/ForumPost.dart b/lib/src/screens/Forum/Post/ForumPost.dart
new file mode 100644
index 0000000..dc3eab7
--- /dev/null
+++ b/lib/src/screens/Forum/Post/ForumPost.dart
@@ -0,0 +1,85 @@
+import 'package:flutter/material.dart';
+import 'package:sqflite/sqflite.dart';
+import 'package:path/path.dart';
+import 'package:path_provider/path_provider.dart';
+
+class ForumPost {
+ int? id;
+ final String author;
+ final String date;
+ final String content;
+
+ ForumPost({
+ this.id,
+ required this.author,
+ required this.date,
+ required this.content,
+ });
+
+ ForumPost.fromMap(Map map)
+ : id = map['id'],
+ author = map['author'],
+ date = map['date'],
+ content = map['content'];
+
+ Map toMap() {
+ return {
+ 'id': id,
+ 'author': author,
+ 'date': date,
+ 'content': content,
+ };
+ }
+
+ static const String dbName = 'forum.db';
+ static const String tableName = 'posts';
+
+ static Future insertPost(ForumPost post) async {
+ final Database db = await _initDatabase();
+ await db.insert(tableName, post.toMap());
+
+ // Adicione a instrução de impressão
+ print('Inserido no banco de dados: ${post.toMap()}');
+ }
+
+ static Future> getPosts() async {
+ final Database db = await _initDatabase();
+ final List