diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 1144f4b..479bf76 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -9,7 +9,7 @@ logo \ No newline at end of file diff --git a/lib/bluetooth_test.dart b/lib/bluetooth_test.dart deleted file mode 100644 index 81173c3..0000000 --- a/lib/bluetooth_test.dart +++ /dev/null @@ -1,49 +0,0 @@ -import 'package:flutter_blue/flutter_blue.dart'; -import 'package:flutter/material.dart'; - -import 'sidebar.dart'; - -class BluetoothTest extends StatefulWidget { - const BluetoothTest({super.key}); - - @override - State createState() => _BluetoothTest(); -} - -class _BluetoothTest extends State { - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: const Text("Bluetooth Test"), - ), - body: Center( - child: TextButton( - onPressed: () async { - - FlutterBlue flutterBlue = FlutterBlue.instance; - flutterBlue.startScan(timeout: const Duration(seconds: 4)); - - flutterBlue.scanResults.listen((results) async { - // do something with scan results - for (ScanResult r in results) { - String scan = '"scan: ${r.device.name} found! rssi: ${r - .rssi}"'; - debugPrint(scan); - if(r.device.name == "Crusher ANC") { - await r.device.connect(); - } - } - }); - // Stop scanning - flutterBlue.stopScan(); - - }, child: const Text("Scan Devices"), - ), - ), - drawer: const Sidebar(),// This trailing comma makes auto-formatting nicer for build methods. - ); - } -} - - diff --git a/lib/main.dart b/lib/main.dart index 9b894e8..1538145 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:flutter_provisioning_for_iot/main_page.dart'; +import 'package:flutter_provisioning_for_iot/screens/main_page.dart'; void main() { runApp(const MainPage()); diff --git a/lib/cloud_service_api.dart b/lib/objects/cloud_service_api.dart similarity index 95% rename from lib/cloud_service_api.dart rename to lib/objects/cloud_service_api.dart index 624f228..97273cb 100644 --- a/lib/cloud_service_api.dart +++ b/lib/objects/cloud_service_api.dart @@ -11,18 +11,16 @@ Future> readJson() async { return data_; } -class CloudServiceAPI{ +class CloudServiceAPI { late final Map credentials; late Future loadJson; late String basicAuth; late String address; late Map headers; - CloudServiceAPI() { - loadJson = loadConfig(); - } + CloudServiceAPI(); - Future loadConfig() async{ + Future loadConfig() async{ credentials = await readJson(); String username = credentials['username']; String password = credentials['password']; diff --git a/lib/objects/create_material_color.dart b/lib/objects/create_material_color.dart new file mode 100644 index 0000000..36f0e29 --- /dev/null +++ b/lib/objects/create_material_color.dart @@ -0,0 +1,28 @@ +import 'package:flutter/material.dart'; + +/// https://medium.com/@nickysong/creating-a-custom-color-swatch-in-flutter-554bcdcb27f3 +/// +/// usage: CustomColor.createMaterialColor(const Color(0xff263f8c)) + +class CustomColor { + static MaterialColor createMaterialColor(Color color) { + List strengths = [.05]; + Map swatch = {}; + final int r = color.red, g = color.green, b = color.blue; + + for (int i = 1; i < 10; i++) { + strengths.add(0.1 * i); + } + for (var strength in strengths) { + final double ds = 0.5 - strength; + swatch[(strength * 1000).round()] = Color.fromRGBO( + r + ((ds < 0 ? r : (255 - r)) * ds).round(), + g + ((ds < 0 ? g : (255 - g)) * ds).round(), + b + ((ds < 0 ? b : (255 - b)) * ds).round(), + 1, + ); + } + return MaterialColor(color.value, swatch); + } +} + diff --git a/lib/screens/bluetooth_device_settings.dart b/lib/screens/bluetooth_device_settings.dart new file mode 100644 index 0000000..fb738c2 --- /dev/null +++ b/lib/screens/bluetooth_device_settings.dart @@ -0,0 +1,107 @@ +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 createState() => _BluetoothDeviceSettings(); +} + +class _BluetoothDeviceSettings extends State { + @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( + 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() + ) + ) + ), + ]), + ], + ), + ]))); + } +} diff --git a/lib/screens/bluetooth_screen.dart b/lib/screens/bluetooth_screen.dart new file mode 100644 index 0000000..5971dcf --- /dev/null +++ b/lib/screens/bluetooth_screen.dart @@ -0,0 +1,134 @@ +import 'dart:async'; + +import 'package:flutter_bluetooth_serial/flutter_bluetooth_serial.dart'; +import 'package:fluttertoast/fluttertoast.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_provisioning_for_iot/widgets/bluetooth_discovery.dart'; +import 'package:flutter_provisioning_for_iot/objects/cloud_service_api.dart'; +import 'package:flutter_provisioning_for_iot/widgets/switch_widget.dart'; + +class BluetoothScreen extends StatefulWidget { + const BluetoothScreen({super.key}); + + @override + State createState() => _BluetoothScreen(); +} + +class _BluetoothScreen extends State { + + final textFieldValueHolder = TextEditingController(); + late CloudServiceAPI cloudServiceAPI = CloudServiceAPI(); + late List results = + List.empty(growable: true); + late ButtonStyle buttonStyle = ElevatedButton.styleFrom( + foregroundColor: Colors.black, + backgroundColor: const Color(0xFFFDE100), // Text Color (Foreground color) + ); + late String inputName = ""; + late bool initScan = true; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text("Bluetooth Devices"), + ), + body: RefreshIndicator( + onRefresh: () { + debugPrint("refreshed"); + return Future(() => null); + }, + child: SingleChildScrollView( + physics: const AlwaysScrollableScrollPhysics(), + //child: Padding( + //padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 10), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + padding: + const EdgeInsets.symmetric(horizontal: 10, vertical: 10), + decoration: const BoxDecoration( + border: Border( + bottom: BorderSide(width: 1.5, color: Colors.grey), + ), + ), + child: Column( + children: [ + TextField( + controller: textFieldValueHolder, + decoration: const InputDecoration( + border: OutlineInputBorder(), + hintText: 'Enter the name of your new device', + ), + ), + SizedBox( + width: double.infinity, + child: ElevatedButton( + onPressed: () { + var textFieldValue = + textFieldValueHolder.value.toString(); + checkNameAvailability(textFieldValue); + setState(() { + inputName = textFieldValue; + }); + }, + style: buttonStyle, + child: const Text("check name"), + ), + ), + ], + ), + ), + Container( + padding: + const EdgeInsets.symmetric(horizontal: 10, vertical: 10), + decoration: const BoxDecoration( + border: Border( + bottom: BorderSide(width: 1.5, color: Colors.grey), + ), + ), + child: Row(children: const [ + Text( + "Toggle Scan", + style: TextStyle(fontWeight: FontWeight.bold), + ), + Expanded(child: Text("")), + SwitchWidget(), + ]), + ), + BluetoothDiscovery(start: initScan, deviceID: inputName), + ], + ), + //), + ), + ), + ); + } + + Future checkNameAvailability(String input) async { + await cloudServiceAPI.loadConfig(); + List devices = await cloudServiceAPI.getDevices(); + for (Map selected in devices) { + if (selected["id"] == input) { + await showNameAvailabilityStatus(false); + return; + } + } + await showNameAvailabilityStatus(true); + } + + Future showNameAvailabilityStatus(bool status) async { + String statusText = status + ? "die eingegebene ID ist verfügbar" + : "die eingegebene ID ist nicht verfügbar"; + Fluttertoast.showToast( + msg: statusText, + toastLength: Toast.LENGTH_SHORT, + gravity: ToastGravity.BOTTOM, + timeInSecForIosWeb: 2, + backgroundColor: Colors.grey[200], + textColor: Colors.black, + fontSize: 16.0); + } +} diff --git a/lib/cloud_service_ui.dart b/lib/screens/cloud_service_ui.dart similarity index 90% rename from lib/cloud_service_ui.dart rename to lib/screens/cloud_service_ui.dart index 94d2d42..fde8dbe 100644 --- a/lib/cloud_service_ui.dart +++ b/lib/screens/cloud_service_ui.dart @@ -1,10 +1,10 @@ import 'dart:convert'; + import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:http/http.dart' as http; -import 'package:http/http.dart'; -import 'cloud_service_api.dart'; -import 'sidebar.dart'; + +import 'package:flutter_provisioning_for_iot/objects/cloud_service_api.dart'; +import 'package:flutter_provisioning_for_iot/widgets/sidebar.dart'; class CloudService extends StatefulWidget { @@ -22,10 +22,10 @@ Future> readJson() async { } class _CloudService extends State{ + late final Map credentials; final CloudServiceAPI cloudServiceAPI = CloudServiceAPI(); - @override Widget build(BuildContext context) { return Scaffold( diff --git a/lib/main_page.dart b/lib/screens/main_page.dart similarity index 91% rename from lib/main_page.dart rename to lib/screens/main_page.dart index ff534ec..ed5c06c 100644 --- a/lib/main_page.dart +++ b/lib/screens/main_page.dart @@ -1,5 +1,7 @@ import 'package:flutter/material.dart'; -import 'package:flutter_provisioning_for_iot/sidebar.dart'; +import 'package:flutter_provisioning_for_iot/widgets/sidebar.dart'; + +import '../objects/create_material_color.dart'; class MainPage extends StatelessWidget { const MainPage({super.key}); @@ -19,7 +21,7 @@ class MainPage extends StatelessWidget { // or simply save your changes to "hot reload" in a Flutter IDE). // Notice that the counter didn't reset back to zero; the application // is not restarted. - primarySwatch: Colors.blue, + primarySwatch: CustomColor.createMaterialColor(const Color(0xff263f8c)), ), home: const MyHomePage(title: 'Provisioning for IOT'), ); diff --git a/lib/settings.dart b/lib/screens/settings.dart similarity index 98% rename from lib/settings.dart rename to lib/screens/settings.dart index 0362db3..d203119 100644 --- a/lib/settings.dart +++ b/lib/screens/settings.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:shared_preferences/shared_preferences.dart'; -import 'sidebar.dart'; +import '../widgets/sidebar.dart'; class Settings extends StatefulWidget { const Settings({Key? key}) : super(key: key); diff --git a/lib/widgets/bluetooth_discovery.dart b/lib/widgets/bluetooth_discovery.dart new file mode 100644 index 0000000..870eb3e --- /dev/null +++ b/lib/widgets/bluetooth_discovery.dart @@ -0,0 +1,158 @@ +import 'dart:async'; + +import 'package:flutter/material.dart'; +import 'package:flutter_bluetooth_serial/flutter_bluetooth_serial.dart'; +import 'package:flutter_provisioning_for_iot/screens/bluetooth_device_settings.dart'; + +class BluetoothDiscovery extends StatefulWidget { + final bool start; + final String deviceID; + + const BluetoothDiscovery({ + super.key, + required this.start, + required this.deviceID + }); + + @override + State createState() => _BluetoothDiscovery(); +} + +class _BluetoothDiscovery extends State { + + StreamSubscription? _streamSubscription; + List results = List.empty(growable: true); + bool isDiscovering = false; + + @override + Widget build(BuildContext context) { + debugPrint("test: ${widget.deviceID}"); + debugPrint("bool: ${widget.start}"); + if(widget.start) { + _startDiscovery(); + } + return RefreshIndicator( + onRefresh: () { + debugPrint("refreshed"); + return Future(() => null); + }, + child: ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemCount: results.length, + itemExtent: 50.0, + itemBuilder: + (BuildContext context, int index) { + var device = results.elementAt(index).device; + var deviceAddress = device.address; + var deviceName = device.name; + return Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + const Icon(Icons.bluetooth_disabled_rounded), + TextButton( + onPressed: () { + debugPrint(deviceAddress); + }, + onLongPress: () { + debugPrint("no need to press for this long..."); + }, + child: Text("$deviceAddress" + "${(deviceName != "" ? "" : " | $deviceName")}")), + const Expanded(child: Text("")), + IconButton( + icon: const Icon(Icons.settings), + onPressed: () { + debugPrint("this is a warning!"); + debugPrint(device.address); + Navigator.push(context, MaterialPageRoute(builder: (context) => BluetoothDeviceSettings(device: device))); + }, + ), + ], + ); + }, + ) + ); + } + + @override + void initState() { + super.initState(); + + isDiscovering = widget.start; + if (isDiscovering) { + _startDiscovery(); + } + } + + void _restartDiscovery() { + setState(() { + results.clear(); + isDiscovering = true; + }); + + _startDiscovery(); + } + + void _startDiscovery() { + _streamSubscription = + FlutterBluetoothSerial.instance.startDiscovery().listen((r) { + setState(() { + final existingIndex = results.indexWhere( + (element) => element.device.address == r.device.address); + if (existingIndex >= 0) { + results[existingIndex] = r; + } else { + results.add(r); + } + }); + }); + + debugPrint("results: $results"); + + _streamSubscription!.onDone(() { + setState(() { + isDiscovering = false; + }); + }); + } + + @override + void dispose() { + // Avoid memory leak (`setState` after dispose) and cancel discovery + _streamSubscription?.cancel(); + + super.dispose(); + } + + void initScan() { + _streamSubscription = + FlutterBluetoothSerial.instance.startDiscovery().listen((r) { + debugPrint("r: ${r.device.name} ${r.device.address}"); + setState(() { + final existingIndex = results.indexWhere( + (element) => element.device.address == r.device.address); + if (existingIndex >= 0) { + results[existingIndex] = r; + } else { + results.add(r); + } + }); + if (r.device.address == "38:F3:2E:41:82:74") { + BluetoothConnection.toAddress(r.device.address).then((connection) { + debugPrint('Connected to the device'); + //connection = _connection; + //setState(() { + //isConnecting = false; + //isDisconnecting = false; + }); + } + }); + + _streamSubscription!.onDone(() { + setState(() { + isDiscovering = false; + }); + }); + } +} diff --git a/lib/sidebar.dart b/lib/widgets/sidebar.dart similarity index 69% rename from lib/sidebar.dart rename to lib/widgets/sidebar.dart index 07caec5..c7d97ad 100644 --- a/lib/sidebar.dart +++ b/lib/widgets/sidebar.dart @@ -1,20 +1,27 @@ import 'package:flutter/material.dart'; -import 'package:flutter_provisioning_for_iot/bluetooth_test.dart'; -import 'package:flutter_provisioning_for_iot/cloud_service_ui.dart'; -import 'main_page.dart'; -import 'settings.dart'; +import 'package:flutter_provisioning_for_iot/screens/bluetooth_screen.dart'; +import 'package:flutter_provisioning_for_iot/screens/cloud_service_ui.dart'; +import '../screens/main_page.dart'; +import '../screens/settings.dart'; class Sidebar extends StatelessWidget { const Sidebar({Key? key}) : super(key: key); + @override Widget build(BuildContext context) { return Drawer( child: ListView( children: [ const DrawerHeader( - decoration: BoxDecoration(color: Color(0xFF00844D)), - child: Text("Navigation"), + decoration: BoxDecoration( + color: Colors.white + ), + child: Center( + child: Image( + image: AssetImage('assets/logo/m&m_logo.png') + ), + ), ), ListTile( title: const Text("Main Page"), @@ -32,7 +39,7 @@ class Sidebar extends StatelessWidget { ListTile( title: const Text("Bluetooth Test"), onTap: () { - Navigator.push(context, MaterialPageRoute(builder: (context) => const BluetoothTest())); + Navigator.push(context, MaterialPageRoute(builder: (context) => const BluetoothScreen())); }, ), ListTile( diff --git a/lib/widgets/switch_widget.dart b/lib/widgets/switch_widget.dart new file mode 100644 index 0000000..544a846 --- /dev/null +++ b/lib/widgets/switch_widget.dart @@ -0,0 +1,44 @@ +import 'package:flutter/material.dart'; + +class SwitchWidget extends StatefulWidget { + + const SwitchWidget({super.key}); + + @override + State createState() => _SwitchWidget(); +} + +class _SwitchWidget extends State { + + bool switchControl = false; + var textHolder = 'Switch is OFF'; + + void toggleSwitch(bool value) { + if (switchControl == false) { + setState(() { + switchControl = true; + textHolder = 'Switch is ON'; + }); + debugPrint('Switch is ON'); + } else { + setState(() { + switchControl = false; + textHolder = 'Switch is OFF'; + }); + debugPrint('Switch is OFF'); + // Put your code here which you want to execute on Switch OFF event. + } + } + + @override + Widget build(BuildContext context) { + return Switch( + onChanged: toggleSwitch, + value: switchControl, + activeColor: Colors.white, + activeTrackColor: Colors.green, + inactiveThumbColor: Colors.white, + inactiveTrackColor: Colors.grey, + ); + } +} \ No newline at end of file diff --git a/pubspec.lock b/pubspec.lock index 9295504..2b8018f 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,61 +5,117 @@ packages: dependency: transitive description: name: async - url: "https://pub.dartlang.org" + sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0 + url: "https://pub.dev" source: hosted - version: "2.9.0" + version: "2.10.0" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" characters: dependency: transitive description: name: characters - url: "https://pub.dartlang.org" + sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c + url: "https://pub.dev" source: hosted version: "1.2.1" clock: dependency: transitive description: name: clock - url: "https://pub.dartlang.org" + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" source: hosted version: "1.1.1" collection: dependency: transitive description: name: collection - url: "https://pub.dartlang.org" + sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0 + url: "https://pub.dev" source: hosted - version: "1.16.0" + version: "1.17.0" + convert: + dependency: transitive + description: + name: convert + sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" + url: "https://pub.dev" + source: hosted + version: "3.1.1" cupertino_icons: dependency: "direct main" description: name: cupertino_icons - url: "https://pub.dartlang.org" + sha256: e35129dc44c9118cee2a5603506d823bab99c68393879edb440e0090d07586be + url: "https://pub.dev" source: hosted version: "1.0.5" fake_async: dependency: transitive description: name: fake_async - url: "https://pub.dartlang.org" + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" source: hosted version: "1.3.1" + ffi: + dependency: transitive + description: + name: ffi + sha256: a38574032c5f1dd06c4aee541789906c12ccaab8ba01446e800d9c5b79c4a978 + url: "https://pub.dev" + source: hosted + version: "2.0.1" + file: + dependency: transitive + description: + name: file + sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" + url: "https://pub.dev" + source: hosted + version: "6.1.4" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: "04be3e934c52e082558cc9ee21f42f5c1cd7a1262f4c63cd0357c08d5bba81ec" + url: "https://pub.dev" + source: hosted + version: "1.0.1" flutter: dependency: "direct main" description: flutter source: sdk version: "0.0.0" + flutter_blue: + dependency: "direct main" + description: + name: flutter_blue + sha256: f7f76b9b80455b0375693ec96c276fadb01e94d8441fa1740a64980cd1aeda5c + url: "https://pub.dev" + source: hosted + version: "0.8.0" + flutter_bluetooth_serial: + dependency: "direct main" + description: + name: flutter_bluetooth_serial + sha256: "85ae82c4099b2b1facdc54e75e1bcfa88dc7f719e55dc886bb0b648cb16636b1" + url: "https://pub.dev" + source: hosted + version: "0.4.0" flutter_lints: dependency: "direct dev" description: name: flutter_lints - url: "https://pub.dartlang.org" + sha256: aeb0b80a8b3709709c9cc496cdc027c5b3216796bc0af0ce1007eaf24464fd4c + url: "https://pub.dev" source: hosted version: "2.0.1" flutter_test: @@ -67,41 +123,211 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + fluttertoast: + dependency: "direct main" + description: + name: fluttertoast + sha256: "7a738eddad04c7b27a1ecfecd12e8ecd4b188cdd2d91c252a02a4aba65838c9d" + url: "https://pub.dev" + source: hosted + version: "8.1.1" + http: + dependency: "direct main" + description: + name: http + sha256: "6aa2946395183537c8b880962d935877325d6a09a2867c3970c05c0fed6ac482" + url: "https://pub.dev" + source: hosted + version: "0.13.5" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + url: "https://pub.dev" + source: hosted + version: "4.0.2" + js: + dependency: transitive + description: + name: js + sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7" + url: "https://pub.dev" + source: hosted + version: "0.6.5" lints: dependency: transitive description: name: lints - url: "https://pub.dartlang.org" + sha256: "5e4a9cd06d447758280a8ac2405101e0e2094d2a1dbdd3756aec3fe7775ba593" + url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "2.0.1" matcher: dependency: transitive description: name: matcher - url: "https://pub.dartlang.org" + sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72" + url: "https://pub.dev" source: hosted - version: "0.12.12" + version: "0.12.13" material_color_utilities: dependency: transitive description: name: material_color_utilities - url: "https://pub.dartlang.org" + sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724 + url: "https://pub.dev" source: hosted - version: "0.1.5" + version: "0.2.0" meta: dependency: transitive description: name: meta - url: "https://pub.dartlang.org" + sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42" + url: "https://pub.dev" source: hosted version: "1.8.0" path: dependency: transitive description: name: path - url: "https://pub.dartlang.org" + sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b + url: "https://pub.dev" source: hosted version: "1.8.2" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + sha256: ab0987bf95bc591da42dffb38c77398fc43309f0b9b894dcc5d6f40c4b26c379 + url: "https://pub.dev" + source: hosted + version: "2.1.7" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + sha256: f0abc8ebd7253741f05488b4813d936b4d07c6bae3e86148a09e342ee4b08e76 + url: "https://pub.dev" + source: hosted + version: "2.0.5" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + sha256: bcabbe399d4042b8ee687e17548d5d3f527255253b4a639f5f8d2094a9c2b45c + url: "https://pub.dev" + source: hosted + version: "2.1.3" + platform: + dependency: transitive + description: + name: platform + sha256: "4a451831508d7d6ca779f7ac6e212b4023dd5a7d08a27a63da33756410e32b76" + url: "https://pub.dev" + source: hosted + version: "3.1.0" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: dbf0f707c78beedc9200146ad3cb0ab4d5da13c246336987be6940f026500d3a + url: "https://pub.dev" + source: hosted + version: "2.1.3" + process: + dependency: transitive + description: + name: process + sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09" + url: "https://pub.dev" + source: hosted + version: "4.2.4" + protobuf: + dependency: transitive + description: + name: protobuf + sha256: "01dd9bd0fa02548bf2ceee13545d4a0ec6046459d847b6b061d8a27237108a08" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + rxdart: + dependency: transitive + description: + name: rxdart + sha256: "2ef8b4e91cb3b55d155e0e34eeae0ac7107974e451495c955ac04ddee8cc21fd" + url: "https://pub.dev" + source: hosted + version: "0.26.0" + shared_preferences: + dependency: "direct main" + description: + name: shared_preferences + sha256: "76917b7d4b9526b2ba416808a7eb9fb2863c1a09cf63ec85f1453da240fa818a" + url: "https://pub.dev" + source: hosted + version: "2.0.15" + shared_preferences_android: + dependency: transitive + description: + name: shared_preferences_android + sha256: "8e251f3c986002b65fed6396bce81f379fb63c27317d49743cf289fd0fd1ab97" + url: "https://pub.dev" + source: hosted + version: "2.0.14" + shared_preferences_ios: + dependency: transitive + description: + name: shared_preferences_ios + sha256: "585a14cefec7da8c9c2fb8cd283a3bb726b4155c0952afe6a0caaa7b2272de34" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + shared_preferences_linux: + dependency: transitive + description: + name: shared_preferences_linux + sha256: "28aefc1261746e7bad3d09799496054beb84e8c4ffcdfed7734e17b4ada459a5" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + shared_preferences_macos: + dependency: transitive + description: + name: shared_preferences_macos + sha256: fbb94bf296576f49be37a1496d5951796211a8db0aa22cc0d68c46440dad808c + url: "https://pub.dev" + source: hosted + version: "2.0.4" + shared_preferences_platform_interface: + dependency: transitive + description: + name: shared_preferences_platform_interface + sha256: da9431745ede5ece47bc26d5d73a9d3c6936ef6945c101a5aca46f62e52c1cf3 + url: "https://pub.dev" + source: hosted + version: "2.1.0" + shared_preferences_web: + dependency: transitive + description: + name: shared_preferences_web + sha256: a4b5bc37fe1b368bbc81f953197d55e12f49d0296e7e412dfe2d2d77d6929958 + url: "https://pub.dev" + source: hosted + version: "2.0.4" + shared_preferences_windows: + dependency: transitive + description: + name: shared_preferences_windows + sha256: "97f7ab9a7da96d9cf19581f5de520ceb529548498bd6b5e0ccd02d68a0d15eba" + url: "https://pub.dev" + source: hosted + version: "2.1.1" sky_engine: dependency: transitive description: flutter @@ -111,50 +337,82 @@ packages: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 + url: "https://pub.dev" source: hosted - version: "1.9.0" + version: "1.9.1" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.11.0" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dartlang.org" + sha256: "862015c5db1f3f3c4ea3b94dc2490363a84262994b88902315ed74be1155612f" + url: "https://pub.dev" source: hosted version: "1.1.1" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" source: hosted version: "1.2.1" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" + sha256: c9aba3b3dbfe8878845dfab5fa096eb8de7b62231baeeb1cea8e3ee81ca8c6d8 + url: "https://pub.dev" source: hosted - version: "0.4.12" + version: "0.4.15" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: "26f87ade979c47a150c9eaab93ccd2bebe70a27dc0b4b29517f2904f04eb11a5" + url: "https://pub.dev" + source: hosted + version: "1.3.1" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.dartlang.org" + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.4" + win32: + dependency: transitive + description: + name: win32 + sha256: d13ac5deea7327f027b3b97ee19ee210f68256ecf3f1a304bcfb992ee947637c + url: "https://pub.dev" + source: hosted + version: "3.1.1" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + sha256: "11541eedefbcaec9de35aa82650b695297ce668662bbd6e3911a7fabdbde589f" + url: "https://pub.dev" + source: hosted + version: "0.2.0+2" sdks: - dart: ">=2.18.2 <3.0.0" + dart: ">=2.18.2 <4.0.0" + flutter: ">=3.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 13579f9..8bae8e8 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -37,8 +37,10 @@ dependencies: # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.2 flutter_blue: ^0.8.0 + flutter_bluetooth_serial: ^0.4.0 shared_preferences: ^2.0.13 http: ^0.13.5 + fluttertoast: ^8.1.1 dev_dependencies: @@ -69,6 +71,7 @@ flutter: # - images/a_dot_ham.jpeg assets: - config/credentials.json + - assets/logo/m&m_logo.png # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/assets-and-images/#resolution-aware diff --git a/test/widget_test.dart b/test/widget_test.dart index 6f6a857..f386e92 100644 --- a/test/widget_test.dart +++ b/test/widget_test.dart @@ -6,7 +6,7 @@ // tree, read text, and verify that the values of widget properties are correct. import 'package:flutter/material.dart'; -import 'package:flutter_provisioning_for_iot/main_page.dart'; +import 'package:flutter_provisioning_for_iot/screens/main_page.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_provisioning_for_iot/main.dart';