57 lines
1.4 KiB
Dart
57 lines
1.4 KiB
Dart
import 'package:cdb_ui/pages/transaction.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:cdb_ui/api.dart' as API;
|
|
|
|
class AddNotePage extends StatelessWidget {
|
|
late final TextEditingController _noteController = TextEditingController();
|
|
final API.Flow flow;
|
|
final Function refresh;
|
|
|
|
AddNotePage(this.flow, this.refresh, {super.key});
|
|
|
|
_submit(BuildContext context) {
|
|
API.API().addNoteToFlow(flow.id, _noteController.text).then((x) {
|
|
refresh();
|
|
Navigator.of(context).pop();
|
|
});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: const Text("Add Note"),
|
|
),
|
|
body: Column(
|
|
children: [
|
|
TextFormField(
|
|
decoration: const InputDecoration(labelText: 'Note'),
|
|
controller: _noteController,
|
|
maxLines: 10),
|
|
const SizedBox(
|
|
height: 14,
|
|
),
|
|
ElevatedButton(
|
|
onPressed: _submit(context), child: const Text("Add Note"))
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class FlowNoteCard extends StatelessWidget {
|
|
final API.FlowNote note;
|
|
|
|
const FlowNoteCard(this.note, {super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Card(
|
|
child: ListTile(
|
|
title: Text(tsFormat(note.timestamp),
|
|
style: const TextStyle(fontSize: 12)),
|
|
subtitle: Text(note.content, overflow: TextOverflow.ellipsis),
|
|
),
|
|
);
|
|
}
|
|
}
|