Camara e chat IA
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:supabase_flutter/supabase_flutter.dart';
|
||||
import 'perfil_screen.dart';
|
||||
import 'add_item_screen.dart';
|
||||
import 'item_screen.dart';
|
||||
import 'week_screen.dart';
|
||||
import 'ai_chat_screen.dart';
|
||||
import '../constants/item_categories.dart';
|
||||
|
||||
class HomeScreen extends StatefulWidget {
|
||||
@@ -20,6 +21,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
const _HomeContent(),
|
||||
const _ItemsScreen(),
|
||||
const _WeekScreen(),
|
||||
const _AiScreen(),
|
||||
const _ProfileScreen(),
|
||||
];
|
||||
|
||||
@@ -36,7 +38,10 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
backgroundColor: Colors.white,
|
||||
type: BottomNavigationBarType.fixed,
|
||||
items: const [
|
||||
BottomNavigationBarItem(icon: Icon(Icons.home), label: 'InÃcio'),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.home),
|
||||
label: 'Início',
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.inventory_2_outlined),
|
||||
label: 'Itens',
|
||||
@@ -45,6 +50,10 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
icon: Icon(Icons.calendar_today_outlined),
|
||||
label: 'Semana',
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.auto_awesome_outlined),
|
||||
label: 'IA',
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.person_outline),
|
||||
label: 'Perfil',
|
||||
@@ -136,7 +145,7 @@ class _HomeContentState extends State<_HomeContent> {
|
||||
_isLoading = false;
|
||||
});
|
||||
} catch (e) {
|
||||
print('Error loading home: $e');
|
||||
debugPrint('Error loading home: $e');
|
||||
setState(() => _isLoading = false);
|
||||
}
|
||||
}
|
||||
@@ -315,9 +324,9 @@ class _HomeContentState extends State<_HomeContent> {
|
||||
final imageUrl = (images != null && images.isNotEmpty)
|
||||
? images.first['image_url']
|
||||
: null;
|
||||
final category = ITEM_CATEGORIES.firstWhere(
|
||||
final category = itemCategories.firstWhere(
|
||||
(c) => c.id == item['categoria'],
|
||||
orElse: () => ITEM_CATEGORIES.last,
|
||||
orElse: () => itemCategories.last,
|
||||
);
|
||||
return Container(
|
||||
width: 80,
|
||||
@@ -332,7 +341,8 @@ class _HomeContentState extends State<_HomeContent> {
|
||||
width: 60,
|
||||
height: 60,
|
||||
fit: BoxFit.cover,
|
||||
errorBuilder: (_, __, ___) => _placeholder(category.icon),
|
||||
errorBuilder: (context, error, stackTrace) =>
|
||||
_placeholder(category.icon),
|
||||
)
|
||||
: _placeholder(category.icon),
|
||||
),
|
||||
@@ -352,7 +362,7 @@ class _HomeContentState extends State<_HomeContent> {
|
||||
return Container(
|
||||
width: 60,
|
||||
height: 60,
|
||||
color: const Color(0xFF0066CC).withOpacity(0.1),
|
||||
color: const Color(0xFF0066CC).withValues(alpha: 0.1),
|
||||
alignment: Alignment.center,
|
||||
child: Text(icon, style: const TextStyle(fontSize: 26)),
|
||||
);
|
||||
@@ -391,9 +401,9 @@ class _HomeContentState extends State<_HomeContent> {
|
||||
final imageUrl = (images != null && images.isNotEmpty)
|
||||
? images.first['image_url']
|
||||
: null;
|
||||
final category = ITEM_CATEGORIES.firstWhere(
|
||||
final category = itemCategories.firstWhere(
|
||||
(c) => c.id == item['categoria'],
|
||||
orElse: () => ITEM_CATEGORIES.last,
|
||||
orElse: () => itemCategories.last,
|
||||
);
|
||||
return Container(
|
||||
width: 110,
|
||||
@@ -414,13 +424,13 @@ class _HomeContentState extends State<_HomeContent> {
|
||||
width: double.infinity,
|
||||
height: 70,
|
||||
fit: BoxFit.cover,
|
||||
errorBuilder: (_, __, ___) =>
|
||||
errorBuilder: (context, error, stackTrace) =>
|
||||
_placeholder(category.icon),
|
||||
)
|
||||
: Container(
|
||||
width: double.infinity,
|
||||
height: 70,
|
||||
color: const Color(0xFF0066CC).withOpacity(0.1),
|
||||
color: const Color(0xFF0066CC).withValues(alpha: 0.1),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
category.icon,
|
||||
@@ -468,6 +478,13 @@ class _WeekScreen extends StatelessWidget {
|
||||
Widget build(BuildContext context) => const WeekScreen();
|
||||
}
|
||||
|
||||
class _AiScreen extends StatelessWidget {
|
||||
const _AiScreen();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => const AiChatScreen();
|
||||
}
|
||||
|
||||
class _ProfileScreen extends StatelessWidget {
|
||||
const _ProfileScreen();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user