Camara e chat IA
This commit is contained in:
@@ -56,7 +56,7 @@ class _ItemScreenState extends State<ItemScreen> {
|
||||
_isLoading = false;
|
||||
});
|
||||
} catch (e) {
|
||||
print('Error loading items: $e');
|
||||
debugPrint('Error loading items: $e');
|
||||
setState(() => _isLoading = false);
|
||||
}
|
||||
}
|
||||
@@ -71,15 +71,15 @@ class _ItemScreenState extends State<ItemScreen> {
|
||||
|
||||
String _categoryName(String? id) {
|
||||
if (id == null) return 'Outros';
|
||||
return ITEM_CATEGORIES
|
||||
.firstWhere((c) => c.id == id, orElse: () => ITEM_CATEGORIES.last)
|
||||
return itemCategories
|
||||
.firstWhere((c) => c.id == id, orElse: () => itemCategories.last)
|
||||
.name;
|
||||
}
|
||||
|
||||
String _categoryIcon(String? id) {
|
||||
if (id == null) return '📦';
|
||||
return ITEM_CATEGORIES
|
||||
.firstWhere((c) => c.id == id, orElse: () => ITEM_CATEGORIES.last)
|
||||
return itemCategories
|
||||
.firstWhere((c) => c.id == id, orElse: () => itemCategories.last)
|
||||
.icon;
|
||||
}
|
||||
|
||||
@@ -231,7 +231,7 @@ class _ItemScreenState extends State<ItemScreen> {
|
||||
scrollDirection: Axis.horizontal,
|
||||
children: [
|
||||
_categoryChip(null, 'Todos', '🗂'),
|
||||
...ITEM_CATEGORIES.map(
|
||||
...itemCategories.map(
|
||||
(c) => _categoryChip(c.id, c.name, c.icon),
|
||||
),
|
||||
],
|
||||
@@ -324,7 +324,7 @@ class _ItemScreenState extends State<ItemScreen> {
|
||||
width: 72,
|
||||
height: 72,
|
||||
fit: BoxFit.cover,
|
||||
errorBuilder: (_, __, ___) =>
|
||||
errorBuilder: (context, error, stackTrace) =>
|
||||
_iconPlaceholder(categoryIcon),
|
||||
)
|
||||
: _iconPlaceholder(categoryIcon),
|
||||
@@ -362,7 +362,9 @@ class _ItemScreenState extends State<ItemScreen> {
|
||||
vertical: 2,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF0066CC).withOpacity(0.1),
|
||||
color: const Color(
|
||||
0xFF0066CC,
|
||||
).withValues(alpha: 0.1),
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: Text(
|
||||
@@ -430,7 +432,7 @@ class _ItemScreenState extends State<ItemScreen> {
|
||||
return Container(
|
||||
width: 72,
|
||||
height: 72,
|
||||
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: 32)),
|
||||
);
|
||||
@@ -451,10 +453,10 @@ class ItemDetailScreen extends StatelessWidget {
|
||||
final categoryId = item['categoria'] as String?;
|
||||
final categoryName = categoryId == null
|
||||
? 'Outros'
|
||||
: ITEM_CATEGORIES
|
||||
: itemCategories
|
||||
.firstWhere(
|
||||
(c) => c.id == categoryId,
|
||||
orElse: () => ITEM_CATEGORIES.last,
|
||||
orElse: () => itemCategories.last,
|
||||
)
|
||||
.name;
|
||||
final tags = List<String>.from(item['tags'] ?? []);
|
||||
@@ -482,7 +484,8 @@ class ItemDetailScreen extends StatelessWidget {
|
||||
width: double.infinity,
|
||||
height: 250,
|
||||
fit: BoxFit.cover,
|
||||
errorBuilder: (_, __, ___) => const SizedBox.shrink(),
|
||||
errorBuilder: (context, error, stackTrace) =>
|
||||
const SizedBox.shrink(),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
@@ -504,7 +507,7 @@ class ItemDetailScreen extends StatelessWidget {
|
||||
label: Text(t),
|
||||
backgroundColor: const Color(
|
||||
0xFF0066CC,
|
||||
).withOpacity(0.1),
|
||||
).withValues(alpha: 0.1),
|
||||
labelStyle: const TextStyle(color: Color(0xFF0066CC)),
|
||||
),
|
||||
)
|
||||
@@ -561,9 +564,9 @@ class _EditItemScreenState extends State<EditItemScreen> {
|
||||
_nameController = TextEditingController(text: widget.item['nome'] ?? '');
|
||||
final catId = widget.item['categoria'] as String?;
|
||||
if (catId != null) {
|
||||
_selectedCategory = ITEM_CATEGORIES.firstWhere(
|
||||
_selectedCategory = itemCategories.firstWhere(
|
||||
(c) => c.id == catId,
|
||||
orElse: () => ITEM_CATEGORIES.last,
|
||||
orElse: () => itemCategories.last,
|
||||
);
|
||||
}
|
||||
final tags = List<String>.from(widget.item['tags'] ?? []);
|
||||
@@ -653,7 +656,7 @@ class _EditItemScreenState extends State<EditItemScreen> {
|
||||
child: DropdownButton<ItemCategory>(
|
||||
value: _selectedCategory,
|
||||
isExpanded: true,
|
||||
items: ITEM_CATEGORIES
|
||||
items: itemCategories
|
||||
.map(
|
||||
(c) => DropdownMenuItem(
|
||||
value: c,
|
||||
@@ -674,7 +677,7 @@ class _EditItemScreenState extends State<EditItemScreen> {
|
||||
Wrap(
|
||||
spacing: 8,
|
||||
runSpacing: 8,
|
||||
children: CONTEXT_TAGS.map((tag) {
|
||||
children: contextTags.map((tag) {
|
||||
final selected = _selectedTags.contains(tag.id);
|
||||
return FilterChip(
|
||||
label: Text(tag.name),
|
||||
@@ -688,7 +691,7 @@ class _EditItemScreenState extends State<EditItemScreen> {
|
||||
}
|
||||
});
|
||||
},
|
||||
selectedColor: const Color(0xFF0066CC).withOpacity(0.2),
|
||||
selectedColor: const Color(0xFF0066CC).withValues(alpha: 0.2),
|
||||
checkmarkColor: const Color(0xFF0066CC),
|
||||
backgroundColor: Colors.white,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user