diff --git a/lib/screens/bluetooth_screen.dart b/lib/screens/bluetooth_screen.dart index e90d4c4..54a0dd9 100644 --- a/lib/screens/bluetooth_screen.dart +++ b/lib/screens/bluetooth_screen.dart @@ -41,6 +41,7 @@ class _BluetoothScreen extends State { bool isDisconnecting = false; bool isConnected = false; String textInput = "0123456789 abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + String textOuput = ""; ButtonStyle buttonStyle = ElevatedButton.styleFrom( foregroundColor: Colors.black, @@ -115,6 +116,9 @@ class _BluetoothScreen extends State { void _connectionOnListen(Uint8List data) { debugPrint("received: $data"); debugPrint("received decoded: ${const Utf8Decoder().convert(data)}"); + setState(() { + textOuput += const Utf8Decoder().convert(data); + }); // Allocate buffer for parsed data int backspacesCounter = 0; for (var byte in data) { @@ -250,6 +254,7 @@ class _BluetoothScreen extends State { ], ), const Divider(), + Text(textOuput), TextFormField( decoration: const InputDecoration( labelText: "BluetoothText" @@ -273,6 +278,16 @@ class _BluetoothScreen extends State { }, style: buttonStyle, child: const Text("Request Permissions"), + + ), + ElevatedButton( + onPressed: () async { + setState(() { + textOuput = ""; + }); + }, + style: buttonStyle, + child: const Text("Clear Output"), ), ElevatedButton( onPressed: () async {