From 6cb5a471a1bb18de802006c1017839c00d1871ad Mon Sep 17 00:00:00 2001 From: xengineering Date: Fri, 6 Mar 2026 21:45:43 +0100 Subject: Add class ConnectionPage This is a second page to offer a form to set the Sia server name. --- lib/ui.dart | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'lib/ui.dart') diff --git a/lib/ui.dart b/lib/ui.dart index 02093eb..e7c0234 100644 --- a/lib/ui.dart +++ b/lib/ui.dart @@ -10,7 +10,40 @@ class Sia extends StatelessWidget { Widget build(BuildContext context) { return ChangeNotifierProvider( create: (BuildContext context) => AppState(), - child: const MaterialApp(home: DevicesPage()), + child: MaterialApp( + home: Consumer( + builder: (_, AppState provider, _) { + if (provider.onConnectionPage) { + return const ConnectionPage(); + } + return const DevicesPage(); + } + ), + ), + ); + } +} + +class ConnectionPage extends StatelessWidget { + const ConnectionPage({super.key}); + + @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(), + ), + ), + ), + bottomNavigationBar: const SafeArea( + child: ConnectionStatus(), + ), ); } } -- cgit v1.3