From 6ee59e8c2aaf69951f6f80003c23f9cd44976ce1 Mon Sep 17 00:00:00 2001 From: xengineering Date: Sun, 8 Mar 2026 17:53:53 +0100 Subject: Implement server selection This lets the user select the fully qualified domain name (FQDN) of the MQTT broker. The FQDN is not yet preserved after a manual disconnect. --- lib/ui.dart | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) (limited to 'lib/ui.dart') diff --git a/lib/ui.dart b/lib/ui.dart index 7a97f32..a191f5f 100644 --- a/lib/ui.dart +++ b/lib/ui.dart @@ -29,19 +29,26 @@ class ConnectionPage extends StatelessWidget { @override Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar(title: const Text("Connection")), - body: const Padding( - padding: EdgeInsets.all(16.0), - child: TextField( - decoration: InputDecoration( - labelText: "Server name", - hintText: "iot.example.org", - border: OutlineInputBorder(), + return Consumer( + builder: (_, AppState state, _) { + return Scaffold( + appBar: AppBar(title: const Text("Connection")), + body: Padding( + padding: const EdgeInsets.all(16.0), + child: TextField( + decoration: const InputDecoration( + labelText: "Server name", + hintText: "iot.example.org", + border: OutlineInputBorder(), + ), + onChanged: (String value) { + state.fqdn = value; + }, + ), ), - ), - ), - bottomNavigationBar: const ConnectionStatus(), + bottomNavigationBar: const ConnectionStatus(), + ); + } ); } } -- cgit v1.3