removed Cloud Service screen from menue

This commit is contained in:
Simeon5566 2023-01-05 17:43:25 +01:00
parent 259985f8cc
commit f588e61fe7
3 changed files with 1 additions and 99 deletions

View File

@ -1,90 +0,0 @@
import 'dart:convert';
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '../objects/cloud_service_api.dart';
import '../widgets/sidebar.dart';
Future<Map<String, dynamic>> readJson() async {
final String data = await rootBundle.loadString('config/credentials.json');
final Map<String, dynamic> dataMap = json.decode(data);
log("loaded json input $dataMap");
return dataMap;
}
class CloudService extends StatefulWidget {
const CloudService({Key? key}) : super(key: key);
@override
State<CloudService> createState() => _CloudService();
}
class _CloudService extends State<CloudService> {
late final Map<String, dynamic> credentials;
CloudServiceAPI cloudServiceAPI = CloudServiceAPI();
int _selectedIndex = 0;
void _onItemTapped(int index){
setState(() {
_selectedIndex = index;
if(_selectedIndex == 0){
cloudServiceAPI.updateDeviceList();
}
if(_selectedIndex == 1){
// implementation missing
}
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("Cloud Service"),
),
body: Column(
children: <Widget>[
Expanded(child: ListView.separated(
itemCount: cloudServiceAPI.getLoadedDevices().length,
itemBuilder: (BuildContext context, int index) {
return Container(
height: 100,
color: Colors.lightBlueAccent[100],
child: Center(child: Text("Id: ${cloudServiceAPI.getLoadedDevices()[index]['id']} \n"
"endpoint: ${cloudServiceAPI.getLoadedDevices()[index]['endpoint']} \n"
"status: ${cloudServiceAPI.getLoadedDevices()[index]['endpoint']} \n"
"connectionState: ${cloudServiceAPI.getLoadedDevices()[index]['connectionState']} \n"
"lastActivityTime: ${cloudServiceAPI.getLoadedDevices()[index]['lastActivityTime']}"),),
);
}, separatorBuilder: (BuildContext context, int index) => const Divider(
thickness: 0,
indent: 0,
height: 5,
color: Colors.white,
),)
)
],
),
bottomNavigationBar: BottomNavigationBar(
type: BottomNavigationBarType.fixed,
items: const<BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(Icons.refresh),
label: 'Reload',
),
BottomNavigationBarItem(
icon: Icon(Icons.search),
label: 'Search',
),
],
currentIndex: _selectedIndex,
selectedItemColor: Colors.lightBlueAccent,
onTap: _onItemTapped,
),
drawer: const Sidebar(),
);
}
}

View File

@ -1,7 +1,6 @@
import 'package:flutter/material.dart';
import '../screens/bluetooth_screen.dart';
import '../screens/cloud_service_ui.dart';
import '../screens/main_screen.dart';
import '../screens/registered_devices_screen.dart';
import '../screens/settings.dart';
@ -50,13 +49,6 @@ class Sidebar extends StatelessWidget {
Navigator.push(context, MaterialPageRoute(builder: (context) => const Settings()));
},
),
ListTile(
leading: const Icon(Icons.cloud),
title: const Text("Cloud Service"),
onTap: () {
Navigator.push(context, MaterialPageRoute(builder: (context) => const CloudService()));
},
),
],
),
);

View File

@ -14,7 +14,7 @@ import 'package:flutter_provisioning_for_iot/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(const MainPage());
await tester.pumpWidget(const MainScreen());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);