Skip to content

DIGITAL WARDROBE #357

@somarowthupranavi-bot

Description

@somarowthupranavi-bot

// Digital Wardrobe — Flutter (single-file starter)
ElevatedButton(onPressed: _save, child: Text('Save Item'))
],
),
),
);
}

void showImageSourceSheet() {
showModalBottomSheet(
context: context,
builder: (
) => SafeArea(
child: Wrap(
children: [
ListTile(leading: Icon(Icons.camera_alt), title: Text('Camera'), onTap: () { Navigator.pop(context); _pickImage(ImageSource.camera); }),
ListTile(leading: Icon(Icons.photo), title: Text('Gallery'), onTap: () { Navigator.pop(context); _pickImage(ImageSource.gallery); }),
],
),
),
);
}
}

class ItemDetailScreen extends StatelessWidget {
final ClothingItem item;
const ItemDetailScreen({required this.item});

@OverRide
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text(item.name), actions: [
IconButton(
icon: Icon(Icons.delete),
onPressed: () async {
final confirmed = await showDialog(
context: context,
builder: (_) => AlertDialog(
title: Text('Delete'),
content: Text('Delete this item?'),
actions: [TextButton(onPressed: () => Navigator.pop(context, false), child: Text('No')), TextButton(onPressed: () => Navigator.pop(context, true), child: Text('Yes'))],
),
);
if (confirmed == true) {
await item.delete();
// delete image file
final f = File(item.imagePath);
if (await f.exists()) await f.delete();
Navigator.of(context).pop();
}
},
)
]),
body: Column(
children: [
Expanded(child: Image.file(File(item.imagePath), width: double.infinity, fit: BoxFit.cover)),
Padding(
padding: EdgeInsets.all(16),
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Text(item.name, style: TextStyle(fontSize: 22, fontWeight: FontWeight.bold)),
SizedBox(height: 8),
Text('Category: ${item.category}'),
SizedBox(height: 8),
Text('Added: ${item.addedAt.toLocal()}'),
]),
)
],
),
);
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions