diff --git a/example/ios/Flutter/Debug.xcconfig b/example/ios/Flutter/Debug.xcconfig index 592ceee..e8efba1 100644 --- a/example/ios/Flutter/Debug.xcconfig +++ b/example/ios/Flutter/Debug.xcconfig @@ -1 +1,2 @@ +#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" #include "Generated.xcconfig" diff --git a/example/ios/Flutter/Release.xcconfig b/example/ios/Flutter/Release.xcconfig index 592ceee..399e934 100644 --- a/example/ios/Flutter/Release.xcconfig +++ b/example/ios/Flutter/Release.xcconfig @@ -1 +1,2 @@ +#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" #include "Generated.xcconfig" diff --git a/example/ios/Podfile b/example/ios/Podfile new file mode 100644 index 0000000..1e8c3c9 --- /dev/null +++ b/example/ios/Podfile @@ -0,0 +1,41 @@ +# Uncomment this line to define a global platform for your project +# platform :ios, '9.0' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" + end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_ios_podfile_setup + +target 'Runner' do + use_frameworks! + use_modular_headers! + + flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_ios_build_settings(target) + end +end diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock new file mode 100644 index 0000000..8d2f1c1 --- /dev/null +++ b/example/ios/Podfile.lock @@ -0,0 +1,28 @@ +PODS: + - device_info (0.0.1): + - Flutter + - Flutter (1.0.0) + - package_info (0.0.1): + - Flutter + +DEPENDENCIES: + - device_info (from `.symlinks/plugins/device_info/ios`) + - Flutter (from `Flutter`) + - package_info (from `.symlinks/plugins/package_info/ios`) + +EXTERNAL SOURCES: + device_info: + :path: ".symlinks/plugins/device_info/ios" + Flutter: + :path: Flutter + package_info: + :path: ".symlinks/plugins/package_info/ios" + +SPEC CHECKSUMS: + device_info: d7d233b645a32c40dfdc212de5cf646ca482f175 + Flutter: 0e3d915762c693b495b44d77113d4970485de6ec + package_info: 873975fc26034f0b863a300ad47e7f1ac6c7ec62 + +PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c + +COCOAPODS: 1.10.1 diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index 1aec2aa..79169ac 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -13,6 +13,7 @@ 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; + E4C8E8078A994DF0014A625C /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 96B57934337F3BB1271BD557 /* Pods_Runner.framework */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -32,9 +33,12 @@ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 6DC5F1EE94ADE332D8909ACF /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 94747A973AD816526F533C5B /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; + 96B57934337F3BB1271BD557 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -42,6 +46,7 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 9F0D28F3EFE7B01AF0B193D9 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -49,12 +54,24 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + E4C8E8078A994DF0014A625C /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 6F833DADC4E47DCF7795F44F /* Pods */ = { + isa = PBXGroup; + children = ( + 9F0D28F3EFE7B01AF0B193D9 /* Pods-Runner.debug.xcconfig */, + 6DC5F1EE94ADE332D8909ACF /* Pods-Runner.release.xcconfig */, + 94747A973AD816526F533C5B /* Pods-Runner.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( @@ -72,6 +89,8 @@ 9740EEB11CF90186004384FC /* Flutter */, 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, + 6F833DADC4E47DCF7795F44F /* Pods */, + DC8C70EFC73720591BAAE673 /* Frameworks */, ); sourceTree = ""; }; @@ -98,6 +117,14 @@ path = Runner; sourceTree = ""; }; + DC8C70EFC73720591BAAE673 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 96B57934337F3BB1271BD557 /* Pods_Runner.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -105,12 +132,14 @@ isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( + A4783053CFC17DECCA8F66F9 /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + 321AFBCDE0C95A51A330E549 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -169,6 +198,23 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ + 321AFBCDE0C95A51A330E549 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -197,6 +243,28 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; + A4783053CFC17DECCA8F66F9 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ diff --git a/example/ios/Runner.xcworkspace/contents.xcworkspacedata b/example/ios/Runner.xcworkspace/contents.xcworkspacedata index 1d526a1..21a3cc1 100644 --- a/example/ios/Runner.xcworkspace/contents.xcworkspacedata +++ b/example/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -4,4 +4,7 @@ + + diff --git a/example/pubspec.lock b/example/pubspec.lock index afcf098..19f7d59 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -50,6 +50,20 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.0.0" + device_info: + dependency: transitive + description: + name: device_info + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.0" + device_info_platform_interface: + dependency: transitive + description: + name: device_info_platform_interface + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.1" dio: dependency: "direct main" description: @@ -116,6 +130,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.3.0-nullsafety.3" + package_info: + dependency: transitive + description: + name: package_info + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.4.3+4" path: dependency: transitive description: @@ -123,6 +144,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.8.0-nullsafety.1" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.3" power_logger: dependency: "direct main" description: @@ -200,4 +228,4 @@ packages: version: "2.1.0-nullsafety.3" sdks: dart: ">=2.10.0 <2.11.0" - flutter: ">=1.17.0" + flutter: ">=1.17.0 <2.0.0" diff --git a/lib/src/power_logger_view.dart b/lib/src/power_logger_view.dart index 9c7425a..87e57f7 100644 --- a/lib/src/power_logger_view.dart +++ b/lib/src/power_logger_view.dart @@ -1,5 +1,8 @@ import 'package:flutter/material.dart'; import 'package:power_logger/power_logger.dart'; +import 'package:power_logger/src/views/info_view.dart'; +import 'package:power_logger/src/views/logger_view.dart'; +import 'package:power_logger/src/views/settings_view.dart'; ///Logger view class PowerLoggerView extends StatefulWidget { @@ -10,6 +13,9 @@ class PowerLoggerView extends StatefulWidget { } class _PowerLoggerViewState extends State { + PageController _pageController = PageController(); + int _currentIndex = 0; + void Function(void Function()) _setState; @override Widget build(BuildContext context) { return Scaffold( @@ -25,13 +31,41 @@ class _PowerLoggerViewState extends State { ), ], ), - body: ListView.separated( - padding: EdgeInsets.all(5), - separatorBuilder: (_, __) => SizedBox(height: 5), - itemBuilder: (context, index) { - return LoggerDataParser.builder(LoggerData.data[index]); + body: PageView( + controller: _pageController, + onPageChanged: (index) { + _currentIndex = index; + if (_setState != null) _setState(() {}); + }, + children: [ + LoggerView(), + InfoView(), + SettingsView(), + ], + ), + bottomNavigationBar: StatefulBuilder( + builder: (context, kSetState) { + _setState = kSetState; + return BottomNavigationBar( + currentIndex: _currentIndex, + onTap: (index) { + _currentIndex = index; + kSetState(() {}); + _pageController.animateToPage( + index, + duration: Duration(milliseconds: 300), + curve: Curves.easeInOutCubic, + ); + }, + items: [ + BottomNavigationBarItem( + icon: Icon(Icons.assessment), label: '日志'), + BottomNavigationBarItem( + icon: Icon(Icons.perm_device_information), label: '信息'), + BottomNavigationBarItem(icon: Icon(Icons.settings), label: '设置'), + ], + ); }, - itemCount: LoggerData.data.length, ), ); } diff --git a/lib/src/views/info_view.dart b/lib/src/views/info_view.dart new file mode 100644 index 0000000..4fb33be --- /dev/null +++ b/lib/src/views/info_view.dart @@ -0,0 +1,196 @@ +import 'dart:io'; + +import 'package:device_info/device_info.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:package_info/package_info.dart'; + +class InfoView extends StatefulWidget { + InfoView({Key key}) : super(key: key); + + @override + _InfoViewState createState() => _InfoViewState(); +} + +class _InfoViewState extends State + with AutomaticKeepAliveClientMixin { + PackageInfo packageInfo; + AndroidDeviceInfo androidInfo; + IosDeviceInfo iosInfo; + + Future getAllInfo() async { + DeviceInfoPlugin deviceInfo = DeviceInfoPlugin(); + packageInfo = await PackageInfo.fromPlatform(); + if (Platform.isAndroid) androidInfo = await deviceInfo.androidInfo; + if (Platform.isIOS) iosInfo = await deviceInfo.iosInfo; + } + + bool get infoWell => + packageInfo != null && (androidInfo != null || iosInfo != null); + + _buildGridItem(String title, String subTitle) { + return CupertinoContextMenu( + actions: [ + CupertinoContextMenuAction( + child: Text('复制'), + onPressed: () { + Clipboard.setData(ClipboardData(text: subTitle)); + Navigator.pop(context); + }, + ), + ], + previewBuilder: (context, animation, child) { + return Material( + borderRadius: BorderRadius.circular(8), + child: Container( + width: MediaQuery.of(context).size.width - 100, + constraints: BoxConstraints(minHeight: 300), + padding: const EdgeInsets.all(8.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Text(title), + Text( + subTitle, + style: TextStyle(fontSize: 22), + ), + ], + ), + ), + ); + }, + child: Material( + color: Colors.white, + borderRadius: BorderRadius.circular(5), + elevation: 3, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(title), + Text( + subTitle, + style: TextStyle(fontSize: 22), + maxLines: 2, + overflow: TextOverflow.ellipsis, + ), + ], + ), + ), + ), + ); + } + + _buildTile(String title, String subTitle) { + return ListTile( + title: Text(title), + subtitle: Text(subTitle), + onLongPress: () { + Clipboard.setData(ClipboardData(text: subTitle)); + Scaffold.of(context).showSnackBar(SnackBar(content: Text('已复制'))); + }, + ); + } + + _buildAndroidList() { + return SliverList( + delegate: SliverChildListDelegate([ + _buildTile('androidId', androidInfo.androidId), + _buildTile('board', androidInfo.board), + _buildTile('bootloader', androidInfo.bootloader), + _buildTile('brand', androidInfo.brand), + _buildTile('device', androidInfo.device), + _buildTile('display', androidInfo.display), + _buildTile('fingerprint', androidInfo.fingerprint), + _buildTile('hardware', androidInfo.hardware), + _buildTile('host', androidInfo.host), + _buildTile('id', androidInfo.id), + _buildTile('manufacturer', androidInfo.manufacturer), + _buildTile('model', androidInfo.model), + _buildTile('product', androidInfo.product), + _buildTile('tags', androidInfo.tags), + _buildTile('type', androidInfo.type), + _buildTile('isPhysicalDevice', androidInfo.isPhysicalDevice.toString()), + _buildTile( + 'supported32BitAbis', androidInfo.supported32BitAbis.join(',')), + _buildTile( + 'supported64BitAbis', androidInfo.supported64BitAbis.join(',')), + _buildTile('supportedAbis', androidInfo.supportedAbis.join(',')), + _buildTile('baseOS', androidInfo.version.baseOS), + _buildTile('codename', androidInfo.version.codename), + _buildTile('incremental', androidInfo.version.incremental), + _buildTile('release', androidInfo.version.release), + _buildTile('securityPatch', androidInfo.version.securityPatch), + _buildTile('previewSdkInt', androidInfo.version.previewSdkInt.toString()), + _buildTile('sdkInt', androidInfo.version.sdkInt.toString()), + _buildTile('systemFeatures', androidInfo.systemFeatures.join(',')), + ])); + } + + _buildIOSList() { + return SliverList( + delegate: SliverChildListDelegate([ + _buildTile('identifierForVendor', iosInfo.identifierForVendor), + _buildTile('localizedModel', iosInfo.localizedModel), + _buildTile('model', iosInfo.model), + _buildTile('name', iosInfo.name), + _buildTile('systemName', iosInfo.systemName), + _buildTile('systemVersion', iosInfo.systemVersion), + _buildTile('isPhysicalDevice', iosInfo.isPhysicalDevice.toString()), + _buildTile('machine', iosInfo.utsname.machine), + _buildTile('nodename', iosInfo.utsname.nodename), + _buildTile('release', iosInfo.utsname.release), + _buildTile('sysname', iosInfo.utsname.sysname), + _buildTile('version', iosInfo.utsname.version), + ])); + } + + _buildView() { + if (Platform.isAndroid) return _buildAndroidList(); + if (Platform.isIOS) + return _buildIOSList(); + else + return SliverToBoxAdapter(child: Text('不支持的平台')); + } + + @override + void initState() { + super.initState(); + getAllInfo().then((value) => setState(() {})); + } + + @override + Widget build(BuildContext context) { + super.build(context); + return infoWell + ? CustomScrollView( + slivers: [ + SliverPadding( + padding: EdgeInsets.all(5), + sliver: SliverGrid.count( + crossAxisCount: 2, + childAspectRatio: 1.5, + mainAxisSpacing: 10, + crossAxisSpacing: 10, + children: [ + _buildGridItem('appName', packageInfo.appName), + _buildGridItem('buildNumber', packageInfo.buildNumber), + _buildGridItem('packageName', packageInfo.packageName), + _buildGridItem('version', packageInfo.version), + ], + ), + ), + _buildView(), + ], + ) + : ListView(); + } + + @override + bool get wantKeepAlive => true; +} diff --git a/lib/src/views/logger_view.dart b/lib/src/views/logger_view.dart new file mode 100644 index 0000000..9e443a8 --- /dev/null +++ b/lib/src/views/logger_view.dart @@ -0,0 +1,24 @@ +import 'package:flutter/material.dart'; +import 'package:power_logger/src/data/logger_data.dart'; +import 'package:power_logger/src/parser/data_parser.dart'; + +class LoggerView extends StatefulWidget { + LoggerView({Key key}) : super(key: key); + + @override + _LoggerViewState createState() => _LoggerViewState(); +} + +class _LoggerViewState extends State { + @override + Widget build(BuildContext context) { + return ListView.separated( + padding: EdgeInsets.all(5), + separatorBuilder: (_, __) => SizedBox(height: 5), + itemBuilder: (context, index) { + return LoggerDataParser.builder(LoggerData.data[index]); + }, + itemCount: LoggerData.data.length, + ); + } +} diff --git a/lib/src/views/settings_view.dart b/lib/src/views/settings_view.dart new file mode 100644 index 0000000..c04b3e6 --- /dev/null +++ b/lib/src/views/settings_view.dart @@ -0,0 +1,15 @@ +import 'package:flutter/material.dart'; + +class SettingsView extends StatefulWidget { + SettingsView({Key key}) : super(key: key); + + @override + _SettingsViewState createState() => _SettingsViewState(); +} + +class _SettingsViewState extends State { + @override + Widget build(BuildContext context) { + return ListView(); + } +} diff --git a/pubspec.lock b/pubspec.lock index 8d35956..98819d8 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -43,6 +43,20 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.15.0-nullsafety.3" + device_info: + dependency: "direct main" + description: + name: device_info + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.0" + device_info_platform_interface: + dependency: transitive + description: + name: device_info_platform_interface + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.1" dio: dependency: "direct main" description: @@ -102,6 +116,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.3.0-nullsafety.3" + package_info: + dependency: "direct main" + description: + name: package_info + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.4.3+4" path: dependency: transitive description: @@ -109,6 +130,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.8.0-nullsafety.1" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.3" pretty_json: dependency: "direct main" description: @@ -179,4 +207,4 @@ packages: version: "2.1.0-nullsafety.3" sdks: dart: ">=2.10.0-110 <2.11.0" - flutter: ">=1.17.0" + flutter: ">=1.17.0 <2.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index e40bdb0..47f9c03 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -13,38 +13,11 @@ dependencies: dio: ^3.0.10 pretty_json: ^1.1.0 flutter_highlight: ^0.6.0 + device_info: ^1.0.0 + package_info: ^0.4.3+4 dev_dependencies: flutter_test: sdk: flutter -flutter: - # To add assets to your package, add an assets section, like this: - # assets: - # - images/a_dot_burr.jpeg - # - images/a_dot_ham.jpeg - # - # For details regarding assets in packages, see - # https://flutter.dev/assets-and-images/#from-packages - # - # An image asset can refer to one or more resolution-specific "variants", see - # https://flutter.dev/assets-and-images/#resolution-aware. - # To add custom fonts to your package, add a fonts section here, - # in this "flutter" section. Each entry in this list should have a - # "family" key with the font family name, and a "fonts" key with a - # list giving the asset and other descriptors for the font. For - # example: - # fonts: - # - family: Schyler - # fonts: - # - asset: fonts/Schyler-Regular.ttf - # - asset: fonts/Schyler-Italic.ttf - # style: italic - # - family: Trajan Pro - # fonts: - # - asset: fonts/TrajanPro.ttf - # - asset: fonts/TrajanPro_Bold.ttf - # weight: 700 - # - # For details regarding fonts in packages, see - # https://flutter.dev/custom-fonts/#from-packages +flutter: \ No newline at end of file