add notes

This commit is contained in:
JMARyA 2024-09-21 01:37:11 +02:00
parent 35977e9a61
commit 4b9e616581
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
3 changed files with 25 additions and 3 deletions

View file

@ -168,6 +168,12 @@ class TransactionCard extends StatelessWidget {
const SizedBox(
height: 10,
),
if ((t.note ?? "").isNotEmpty) ...[
Text(t.note!),
const SizedBox(
height: 10,
)
],
Row(
children: [
const Icon(Icons.money, size: 18, color: Colors.green),

View file

@ -18,12 +18,14 @@ class _SupplyPageState extends State<SupplyPage> {
String _selectedOrigin = "";
String _selectedLocation = "";
late TextEditingController _priceController;
late TextEditingController _noteController;
@override
void initState() {
super.initState();
variant = widget.item.variants.keys.first;
_priceController = TextEditingController(text: "");
_noteController = TextEditingController(text: "");
}
void _supply() {
@ -32,7 +34,7 @@ class _SupplyPageState extends State<SupplyPage> {
API()
.supplyItem(widget.item.name, variant, "${_priceController.text}",
_selectedOrigin, _selectedLocation)
_selectedOrigin, _selectedLocation, _noteController.text)
.then((_) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Item added successfully!')),
@ -174,6 +176,13 @@ class _SupplyPageState extends State<SupplyPage> {
],
),
// Note
TextFormField(
decoration: const InputDecoration(labelText: 'Note'),
keyboardType: TextInputType.number,
controller: _noteController,
),
const SizedBox(height: 20),
// Submit Button