108 lines
4.2 KiB
Dart
108 lines
4.2 KiB
Dart
import 'package:flutter_bluetooth_serial/flutter_bluetooth_serial.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class BluetoothDeviceSettings extends StatefulWidget {
|
|
final BluetoothDevice device;
|
|
|
|
const BluetoothDeviceSettings({super.key, required this.device});
|
|
|
|
@override
|
|
State<BluetoothDeviceSettings> createState() => _BluetoothDeviceSettings();
|
|
}
|
|
|
|
class _BluetoothDeviceSettings extends State<BluetoothDeviceSettings> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
debugPrint(widget.device.address);
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: const Text("Bluetooth Devices"),
|
|
),
|
|
body: Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 10),
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Table(
|
|
defaultVerticalAlignment: TableCellVerticalAlignment.middle,
|
|
children: <TableRow>[
|
|
TableRow(
|
|
decoration: const BoxDecoration(
|
|
border: Border(
|
|
bottom:
|
|
BorderSide(width: 1.5, color: Colors.grey),
|
|
),
|
|
),
|
|
children: [
|
|
const TableCell(child: Text("Address")),
|
|
TableCell(
|
|
child: Container(
|
|
alignment: Alignment.centerLeft,
|
|
height: 50,
|
|
child: Text(
|
|
widget.device.address
|
|
)
|
|
)
|
|
),
|
|
]),
|
|
TableRow(
|
|
decoration: const BoxDecoration(
|
|
border: Border(
|
|
bottom:
|
|
BorderSide(width: 1.5, color: Colors.grey),
|
|
),
|
|
),
|
|
children: [
|
|
TableCell(
|
|
child: Container(
|
|
alignment: Alignment.centerLeft,
|
|
height: 50,
|
|
child: const Text(
|
|
"Name"
|
|
)
|
|
)
|
|
),
|
|
TableCell(
|
|
child: Container(
|
|
alignment: Alignment.centerLeft,
|
|
height: 50,
|
|
child: Text(
|
|
widget.device.name.toString()
|
|
)
|
|
)
|
|
),
|
|
]),
|
|
TableRow(
|
|
decoration: const BoxDecoration(
|
|
border: Border(
|
|
bottom:
|
|
BorderSide(width: 1.5, color: Colors.grey),
|
|
),
|
|
),
|
|
children: [
|
|
TableCell(
|
|
child: Container(
|
|
alignment: Alignment.centerLeft,
|
|
height: 50,
|
|
child: const Text(
|
|
"Connected"
|
|
)
|
|
)
|
|
),
|
|
TableCell(
|
|
child: Container(
|
|
alignment: Alignment.centerLeft,
|
|
height: 50,
|
|
child: Text(
|
|
widget.device.isConnected.toString()
|
|
)
|
|
)
|
|
),
|
|
]),
|
|
],
|
|
),
|
|
])));
|
|
}
|
|
}
|