From 7788185a36e0e2503b1ee2c3afb451338f0d8c67 Mon Sep 17 00:00:00 2001 From: YamiDoesDev Date: Wed, 4 Jan 2023 14:43:18 +0100 Subject: [PATCH] fixed error and added some functions for devices list --- lib/objects/cloud_service_api.dart | 8 +++--- lib/screens/registered_devices_screen.dart | 32 +++++++++++++++++++++- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/lib/objects/cloud_service_api.dart b/lib/objects/cloud_service_api.dart index d065440..952341e 100644 --- a/lib/objects/cloud_service_api.dart +++ b/lib/objects/cloud_service_api.dart @@ -18,10 +18,10 @@ Future> readJson() async { class CloudServiceAPI { static late final Map credentials; - static late String _basicAuth; - static late String _address; - static late String _username; - static late String _password; + static String _basicAuth = ""; + static String _address = ""; + static String _username = ""; + static String _password = ""; static late Map _headers; static bool _initState = false; diff --git a/lib/screens/registered_devices_screen.dart b/lib/screens/registered_devices_screen.dart index 6fa13ad..cbcd408 100644 --- a/lib/screens/registered_devices_screen.dart +++ b/lib/screens/registered_devices_screen.dart @@ -33,6 +33,7 @@ class _RegisteredDevicesScreen extends State { final CloudServiceAPI _cloudServiceAPI = CloudServiceAPI(); // static SharedPreferences? preferencesInstance; + String _searchText = ""; bool _isFetching = false; Future _fetchRegisteredDevices() async { @@ -89,6 +90,35 @@ class _RegisteredDevicesScreen extends State { physics: const ScrollPhysics(), child: Column( children: [ + SingleSection( + title: "Allgemeines", + children: [ + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0), + child: TextFormField( + obscureText: false, + decoration: InputDecoration( + border: const OutlineInputBorder(), + hintText: 'Enter the server password', + labelText: "Search", + suffixIcon: IconButton( + icon: const Icon(Icons.search), + onPressed: () { + setState(() { + // TODO Suchfunktion + }); + }, + ), + filled: true, + ), + keyboardType: TextInputType.text, + onChanged: (String newValue) { + _searchText = newValue; + }, + ), + ), + ] + ), SingleSection( title: "Registered Bluetooth Devices", children: [ @@ -100,7 +130,7 @@ class _RegisteredDevicesScreen extends State { DeviceInfoModel entry = _registeredInfoDevices![index]; //DeviceInfoModel entryInfo = await _cloudServiceAPI.getDeviceInfo(entry.id); return CustomListTile( - title: entry.id, + title: "${entry.id} \nentrypoint: ${entry.endpoint} \nstatus: ${entry.status} \nconnection: ${entry.connectionState} \nlast activity: ${entry.lastActivityTime}", icon: Icons.devices, ); },