diff --git a/lib/gui/AdvancedPage.dart b/lib/gui/AdvancedPage.dart deleted file mode 100644 index 103dc03..0000000 --- a/lib/gui/AdvancedPage.dart +++ /dev/null @@ -1,45 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:system_info2/system_info2.dart'; - -class BuildSecondPage extends StatelessWidget { - const BuildSecondPage({super.key}); - - @override - Widget build(BuildContext context) { - return Scaffold( - body: SingleChildScrollView( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - buildRow('Architecture:', SysInfo.kernelArchitecture.toString()), - buildRow('Physical Memory Size:', - '${(SysInfo.getTotalPhysicalMemory() / 1000000).truncate()} MB'), - buildRow('Virtual Memory Size:', - '${(SysInfo.getTotalVirtualMemory() / 1000000).truncate()} MB'), - buildRow('CPU Vendor:', SysInfo.cores.first.vendor), - buildRow('Architecture Name:', SysInfo.cores.first.name), - ], - ), - ), - ); - } - - Widget buildRow(String leftText, String rightParam) { - return Padding( - padding: const EdgeInsets.fromLTRB(50.0, 20.0, 50.0, 20.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - leftText, - style: const TextStyle(color: Colors.white), - ), - Text( - rightParam, - style: const TextStyle(color: Colors.white), - ), - ], - ), - ); - } -} diff --git a/lib/gui/hwInfoPage.dart b/lib/gui/hwInfoPage.dart new file mode 100644 index 0000000..6cddd23 --- /dev/null +++ b/lib/gui/hwInfoPage.dart @@ -0,0 +1,64 @@ +import 'package:flutter/material.dart'; +import 'package:system_info2/system_info2.dart'; + +class BuildHWInfoPage extends StatefulWidget { + const BuildHWInfoPage({super.key}); + + @override + // ignore: library_private_types_in_public_api + _BuildHWInfoPage createState() => _BuildHWInfoPage(); +} + +class _BuildHWInfoPage extends State { + static String _physicalMemory = "loading..."; + static String _virtualMemory = "loading..."; + static String _cpuVendor = "loading..."; + static String _archName = "loading..."; + + @override + void initState() { + super.initState(); + _physicalMemory = + (SysInfo.getTotalPhysicalMemory() / 1000000).truncate().toString(); + _virtualMemory = + (SysInfo.getTotalVirtualMemory() / 1000000).truncate().toString(); + _cpuVendor = SysInfo.cores.first.vendor; + _archName = SysInfo.cores.first.name; + } + + @override + Widget build(BuildContext context) { + return Scaffold( + body: SingleChildScrollView( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + buildRow('Physical Memory Size:', '$_physicalMemory MB'), + buildRow('Virtual Memory Size:', '$_virtualMemory MB'), + buildRow('CPU Vendor:', _cpuVendor), + buildRow('Architecture Name:', _archName), + ], + ), + ), + ); + } + + Widget buildRow(String leftText, String rightParam) { + return Padding( + padding: const EdgeInsets.fromLTRB(50.0, 20.0, 50.0, 20.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + leftText, + style: const TextStyle(color: Colors.white), + ), + Text( + rightParam, + style: const TextStyle(color: Colors.white), + ), + ], + ), + ); + } +} diff --git a/lib/gui/sInfoPage.dart b/lib/gui/sInfoPage.dart new file mode 100644 index 0000000..584af50 --- /dev/null +++ b/lib/gui/sInfoPage.dart @@ -0,0 +1,105 @@ +import 'package:client_information/client_information.dart'; +import 'package:device_info_plus/device_info_plus.dart'; +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:system_info2/system_info2.dart'; + +class BuildSoftwareInfoPage extends StatefulWidget { + const BuildSoftwareInfoPage({super.key}); + + @override + // ignore: library_private_types_in_public_api + _BuildSoftwareInfoPage createState() => _BuildSoftwareInfoPage(); +} + +class _BuildSoftwareInfoPage extends State { + static String _deviceID = "loading..."; + static String _deviceModel = "loading..."; + static String _manufacturer = "loading..."; + static String _androidVersion = "loading..."; + static String _tags = "loading..."; + static String _boardName = "loading..."; + static String _display = "loading..."; + static String _buildType = "loading..."; + static String _kernelVersion = "loading..."; + static String _appVersion = "loading..."; + static String _appName = "loading..."; + + Future retrieveAppInfo() async { + ClientInformation clientInfo = await ClientInformation.fetch(); + setState(() { + _appVersion = clientInfo.softwareVersion; + _appName = clientInfo.softwareName; + }); + } + + Future retrieveDevicesInfo() async { + DeviceInfoPlugin deviceInfo = DeviceInfoPlugin(); + AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo; + setState(() { + _deviceID = androidInfo.id; + _deviceModel = androidInfo.model; + _manufacturer = androidInfo.manufacturer; + _androidVersion = androidInfo.version.release; + _tags = androidInfo.tags; + _boardName = androidInfo.board; + _display = androidInfo.display; + _buildType = androidInfo.type; + _kernelVersion = SysInfo.kernelVersion; + }); + + if (kDebugMode) { + print("load information from devices with ID: $_deviceID"); + } + } + + @override + void initState() { + super.initState(); + retrieveDevicesInfo(); + retrieveAppInfo(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + body: SingleChildScrollView( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + buildRow("Android Version ID:", _deviceID), + buildRow("Device Model:", _deviceModel), + buildRow("Device Manufacturer:", _manufacturer), + buildRow("Android Version", _androidVersion), + buildRow("Tags:", _tags), + buildRow("BoardName:", _boardName), + buildRow("Display:", _display), + buildRow("Build Type:", _buildType), + buildRow("Kernel Version:", _kernelVersion), + buildRow("App version:", _appVersion), + buildRow("App Name:", _appName), + ], + ), + ), + ); + } + + Widget buildRow(String leftText, String rightParam) { + return Padding( + padding: const EdgeInsets.fromLTRB(50.0, 20.0, 50.0, 20.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + leftText, + style: const TextStyle(color: Colors.white), + ), + Text( + rightParam, + style: const TextStyle(color: Colors.white), + ), + ], + ), + ); + } +} diff --git a/lib/main.dart b/lib/main.dart index 51dd90e..e96ef3b 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,7 +1,8 @@ import 'package:flutter/material.dart'; import 'gui/SideDrawer.dart'; -import 'gui/AdvancedPage.dart'; +import 'gui/hwInfoPage.dart'; import 'gui/HomePage.dart'; +import 'gui/sInfoPage.dart'; import 'package:salomon_bottom_bar/salomon_bottom_bar.dart'; void main() { @@ -40,7 +41,8 @@ class _MyHomePageState extends State { _currentPage = 0; _pages = [ const BuildHomePage(), - const BuildSecondPage(), + const BuildHWInfoPage(), + const BuildSoftwareInfoPage(), ]; } @@ -80,9 +82,14 @@ class _MyHomePageState extends State { selectedColor: Colors.orange, ), SalomonBottomBarItem( - icon: const Icon(Icons.admin_panel_settings), - title: const Text('Advanced'), - selectedColor: Colors.orange, + icon: const Icon(Icons.dataset_sharp), + title: const Text('Architecture'), + selectedColor: Colors.blue, + ), + SalomonBottomBarItem( + icon: const Icon(Icons.device_unknown), + title: const Text('Software'), + selectedColor: Colors.green, ), ], ), diff --git a/pubspec.lock b/pubspec.lock index 1433f0f..6a73367 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -121,6 +121,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.3" + client_information: + dependency: "direct main" + description: + name: client_information + sha256: "3af34866e7756824044ebb1b15c5df9d0228b1271efb1684599914853c75cc01" + url: "https://pub.dev" + source: hosted + version: "2.1.4" clock: dependency: transitive description: @@ -177,6 +185,22 @@ packages: url: "https://pub.dev" source: hosted version: "2.3.6" + device_info_plus: + dependency: "direct main" + description: + name: device_info_plus + sha256: "93429694c9253d2871b3af80cf11b3cbb5c65660d402ed7bf69854ce4a089f82" + url: "https://pub.dev" + source: hosted + version: "10.1.1" + device_info_plus_platform_interface: + dependency: transitive + description: + name: device_info_plus_platform_interface + sha256: "282d3cf731045a2feb66abfe61bbc40870ae50a3ed10a4d3d217556c35c8c2ba" + url: "https://pub.dev" + source: hosted + version: "7.0.1" fake_async: dependency: transitive description: @@ -549,6 +573,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.10.0" + sprintf: + dependency: transitive + description: + name: sprintf + sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23" + url: "https://pub.dev" + source: hosted + version: "7.0.0" stack_trace: dependency: transitive description: @@ -701,6 +733,14 @@ packages: url: "https://pub.dev" source: hosted version: "3.1.1" + uuid: + dependency: transitive + description: + name: uuid + sha256: "83d37c7ad7aaf9aa8e275490669535c8080377cfa7a7004c24dfac53afffaa90" + url: "https://pub.dev" + source: hosted + version: "4.4.2" vector_math: dependency: transitive description: @@ -757,6 +797,14 @@ packages: url: "https://pub.dev" source: hosted version: "5.2.0" + win32_registry: + dependency: transitive + description: + name: win32_registry + sha256: "41fd8a189940d8696b1b810efb9abcf60827b6cbfab90b0c43e8439e3a39d85a" + url: "https://pub.dev" + source: hosted + version: "1.1.2" yaml: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 01ef2e5..c29d47a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -47,6 +47,8 @@ dependencies: json_annotation: ^4.9.0 package_info: ^2.0.2 package_info_plus: ^4.2.0 + device_info_plus: ^10.1.1 + client_information: ^2.1.4 dev_dependencies: flutter_test: