├── .github └── FUNDING.yml ├── .gitignore ├── .metadata ├── LICENSE ├── README.md ├── analysis_options.yaml ├── assets └── images │ ├── app_icon.png │ └── github_mark.png ├── lib ├── includes.dart ├── inspectors │ ├── inspectors.dart │ ├── network │ │ ├── network.dart │ │ └── network_record.dart │ └── shared_preferences │ │ └── shared_preferences.dart ├── main.dart ├── models │ ├── device.dart │ ├── models.dart │ └── version.dart ├── networking │ ├── api_client │ │ ├── api_client.dart │ │ ├── api_client_interceptor.dart │ │ └── apis │ │ │ └── versions.dart │ └── networking.dart ├── pages │ ├── home │ │ └── home.dart │ ├── pages.dart │ └── settings │ │ └── settings.dart ├── themes │ ├── dark_theme.dart │ ├── light_theme.dart │ └── themes.dart ├── utilities │ ├── env.dart │ ├── pretty_json.dart │ ├── remove_nulls.dart │ └── utilities.dart └── widgets │ ├── menu │ ├── menu.dart │ ├── menu_item.dart │ └── menu_section.dart │ ├── sidebar │ └── sidebar.dart │ └── widgets.dart ├── linux ├── .gitignore ├── CMakeLists.txt ├── flutter │ ├── CMakeLists.txt │ ├── generated_plugin_registrant.cc │ ├── generated_plugin_registrant.h │ └── generated_plugins.cmake ├── main.cc ├── my_application.cc └── my_application.h ├── macos ├── .gitignore ├── Flutter │ ├── Flutter-Debug.xcconfig │ ├── Flutter-Release.xcconfig │ └── GeneratedPluginRegistrant.swift ├── Podfile ├── Podfile.lock ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── Runner │ ├── AppDelegate.swift │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── app_icon_1024.png │ │ │ ├── app_icon_128.png │ │ │ ├── app_icon_16.png │ │ │ ├── app_icon_256.png │ │ │ ├── app_icon_32.png │ │ │ ├── app_icon_512.png │ │ │ └── app_icon_64.png │ ├── Base.lproj │ │ └── MainMenu.xib │ ├── Configs │ │ ├── AppInfo.xcconfig │ │ ├── Debug.xcconfig │ │ ├── Release.xcconfig │ │ └── Warnings.xcconfig │ ├── DebugProfile.entitlements │ ├── Info.plist │ ├── MainFlutterWindow.swift │ ├── Release.entitlements │ └── en.lproj │ │ └── InfoPlist.strings └── packaging │ └── dmg │ └── appdmg.json ├── makeanyicon_options.yaml ├── pubspec.lock ├── pubspec.yaml ├── test └── widget_test.dart └── windows ├── .gitignore ├── CMakeLists.txt ├── flutter ├── CMakeLists.txt ├── generated_plugin_registrant.cc ├── generated_plugin_registrant.h └── generated_plugins.cmake └── runner ├── CMakeLists.txt ├── Runner.rc ├── flutter_window.cpp ├── flutter_window.h ├── main.cpp ├── resource.h ├── resources └── app_icon.ico ├── runner.exe.manifest ├── utils.cpp ├── utils.h ├── win32_window.cpp └── win32_window.h /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: ['https://www.anyinspect.dev/sponsor'] 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | **/ios/Flutter/.last_build_id 26 | .dart_tool/ 27 | .flutter-plugins 28 | .flutter-plugins-dependencies 29 | .packages 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Web related 35 | lib/generated_plugin_registrant.dart 36 | 37 | # Symbolication related 38 | app.*.symbols 39 | 40 | # Obfuscation related 41 | app.*.map.json 42 | 43 | # Android Studio will place build artifacts here 44 | /android/app/debug 45 | /android/app/profile 46 | /android/app/release 47 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 3595343e20a61ff16d14e8ecc25f364276bb1b8b 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 LiJianying 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # anyinspect_app 2 | 3 | [![GitHub (pre-)release](https://img.shields.io/github/release/anyinspect/anyinspect_app/all.svg?style=flat-square)](https://github.com/anyinspect/anyinspect_app/releases) 4 | 5 | A tool for debugging your Flutter apps. 6 | 7 | [![Discord](https://img.shields.io/badge/discord-%237289DA.svg?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/RzFrAhmXFY) 8 | 9 | --- 10 | 11 | ![](https://anyinspect.dev/images/screenshots/anyinspect_app.png) 12 | 13 | ## Platform Support 14 | 15 | | Linux | macOS | Windows | 16 | | :---: | :---: | :-----: | 17 | | ➖ | ✔️ | ✔️ | 18 | 19 | ## Installation 20 | 21 | Downloads are available on the [Releases](https://github.com/anyinspect/anyinspect_app/releases/latest) page. Also check out the [website](https://anyinspect.dev/release-notes) for other installation methods. 22 | 23 | > Please refer to our [Quick Start](https://anyinspect.dev/docs) guide to set up. 24 | 25 | ## Development 26 | 27 | We welcome you to join the development of `AnyInspect`. 28 | 29 | ### Before You Start 30 | 31 | 1. Create working directory 32 | 33 | ``` 34 | $ mkdir ~/anyinspect 35 | $ cd ~/anyinspect 36 | ``` 37 | 38 | 2. Clone dependency repos via git: 39 | 40 | ``` 41 | $ git clone https://github.com/anyinspect/anyinspect.git 42 | ``` 43 | 44 | 3. Clone this repo via git: 45 | 46 | ``` 47 | $ git clone https://github.com/anyinspect/anyinspect_app.git 48 | ``` 49 | 50 | 4. Change to `anyinspect_app` directory 51 | 52 | ``` 53 | $ cd ~/anyinspect/anyinspect_app 54 | ``` 55 | 56 | 5. Install dependencies 57 | 58 | ``` 59 | $ flutter pub get 60 | ``` 61 | 62 | ### Run app 63 | 64 | ``` 65 | $ flutter run -d linux / macos / windows 66 | ``` 67 | 68 | ## Related Links 69 | 70 | - https://github.com/anyinspect/anyinspect 71 | - https://github.com/anyinspect/anyinspect_app 72 | - https://github.com/anyinspect/anyinspect_integrate_example 73 | - https://github.com/anyinspect/plugins 74 | 75 | ## License 76 | 77 | ```text 78 | MIT License 79 | 80 | Copyright (c) 2021 LiJianying 81 | 82 | Permission is hereby granted, free of charge, to any person obtaining a copy 83 | of this software and associated documentation files (the "Software"), to deal 84 | in the Software without restriction, including without limitation the rights 85 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 86 | copies of the Software, and to permit persons to whom the Software is 87 | furnished to do so, subject to the following conditions: 88 | 89 | The above copyright notice and this permission notice shall be included in all 90 | copies or substantial portions of the Software. 91 | 92 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 93 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 94 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 95 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 96 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 97 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 98 | SOFTWARE. 99 | ``` 100 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # This file configures the analyzer, which statically analyzes Dart code to 2 | # check for errors, warnings, and lints. 3 | # 4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled 5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be 6 | # invoked from the command line by running `flutter analyze`. 7 | 8 | # The following line activates a set of recommended lints for Flutter apps, 9 | # packages, and plugins designed to encourage good coding practices. 10 | include: package:flutter_lints/flutter.yaml 11 | 12 | linter: 13 | # The lint rules applied to this project can be customized in the 14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml` 15 | # included above or to enable additional rules. A list of all available lints 16 | # and their documentation is published at 17 | # https://dart-lang.github.io/linter/lints/index.html. 18 | # 19 | # Instead of disabling a lint rule for the entire project in the 20 | # section below, it can also be suppressed for a single line of code 21 | # or a specific dart file by using the `// ignore: name_of_lint` and 22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 23 | # producing the lint. 24 | rules: 25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule 26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule 27 | 28 | # Additional information about this file can be found at 29 | # https://dart.dev/guides/language/analysis-options 30 | -------------------------------------------------------------------------------- /assets/images/app_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijy91-archives-repos/anyinspect_app/0f4db9b5e33329987729c15750e9757ec381ae6a/assets/images/app_icon.png -------------------------------------------------------------------------------- /assets/images/github_mark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijy91-archives-repos/anyinspect_app/0f4db9b5e33329987729c15750e9757ec381ae6a/assets/images/github_mark.png -------------------------------------------------------------------------------- /lib/includes.dart: -------------------------------------------------------------------------------- 1 | export 'inspectors/inspectors.dart'; 2 | export 'models/models.dart'; 3 | export 'networking/networking.dart'; 4 | export 'pages/pages.dart'; 5 | export 'themes/themes.dart'; 6 | export 'utilities/utilities.dart'; 7 | export 'widgets/widgets.dart'; 8 | 9 | import 'package:anyinspect_server/anyinspect_server.dart'; 10 | 11 | import 'models/models.dart'; 12 | import 'utilities/env.dart'; 13 | 14 | extension AnyInspectServerExt on AnyInspectServer { 15 | List get allDevices { 16 | return allClients 17 | .map((e) => Device( 18 | id: e.deviceId, 19 | name: e.deviceName, 20 | isPhysical: e.deviceIsPhysical ?? false, 21 | system: e.deviceSystem!, 22 | systemVersion: e.deviceSystemVersion!)) 23 | .toList(); 24 | } 25 | } 26 | 27 | Future init() async { 28 | await initEnv(); 29 | } 30 | -------------------------------------------------------------------------------- /lib/inspectors/inspectors.dart: -------------------------------------------------------------------------------- 1 | export 'network/network.dart'; 2 | export 'shared_preferences/shared_preferences.dart'; 3 | -------------------------------------------------------------------------------- /lib/inspectors/network/network.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | 3 | import 'package:anyinspect_client/anyinspect_client.dart'; 4 | import 'package:anyinspect_ui/anyinspect_ui.dart'; 5 | import 'package:flutter/material.dart' hide DataTable; 6 | import 'package:intl/intl.dart'; 7 | 8 | import 'network_record.dart'; 9 | 10 | class NetworkInspector extends StatefulWidget { 11 | final AnyInspectPlugin plugin; 12 | 13 | const NetworkInspector( 14 | this.plugin, { 15 | Key? key, 16 | }) : super(key: key); 17 | 18 | @override 19 | State createState() => _NetworkInspectorState(); 20 | } 21 | 22 | class _NetworkInspectorState extends State 23 | with AnyInspectPluginEventListener { 24 | final List _records = []; 25 | 26 | NetworkRecord? _selectedRecord; 27 | 28 | @override 29 | void initState() { 30 | widget.plugin.addEventListener(this); 31 | super.initState(); 32 | } 33 | 34 | @override 35 | void dispose() { 36 | widget.plugin.removeEventListener(this); 37 | super.dispose(); 38 | } 39 | 40 | @override 41 | void onEvent(AnyInspectPluginEvent event) { 42 | if (event.name == 'request') { 43 | _onRequest(NetworkRecordRequest.fromJson(event.arguments)); 44 | } else if (event.name == 'response') { 45 | _onResponse(NetworkRecordResponse.fromJson(event.arguments)); 46 | } 47 | } 48 | 49 | void _onRequest(NetworkRecordRequest request) { 50 | NetworkRecord record = NetworkRecord( 51 | id: request.requestId, 52 | request: request, 53 | ); 54 | _records.add(record); 55 | setState(() {}); 56 | } 57 | 58 | void _onResponse(NetworkRecordResponse response) { 59 | int recordIndex = _records.indexWhere((e) => e.id == response.requestId); 60 | if (recordIndex != -1) { 61 | _records[recordIndex].response = response; 62 | setState(() {}); 63 | } 64 | } 65 | 66 | List _buildDataColumns() { 67 | return const [ 68 | DataColumn( 69 | label: Text('Uri'), 70 | ), 71 | DataColumn( 72 | label: Text('Status'), 73 | ), 74 | DataColumn( 75 | label: Text('Duration'), 76 | ), 77 | DataColumn( 78 | label: Text('Timestamp'), 79 | ), 80 | ]; 81 | } 82 | 83 | List _buildDataRows() { 84 | List rows = []; 85 | for (var record in _records) { 86 | NetworkRecordRequest request = record.request!; 87 | NetworkRecordResponse? response = record.response; 88 | 89 | TextStyle defaultTextStyle = TextStyle( 90 | color: Theme.of(context).textTheme.bodyText2!.color!, 91 | ); 92 | 93 | if (response != null && response.statusCode >= 400) { 94 | defaultTextStyle = defaultTextStyle.copyWith(color: Colors.red); 95 | } 96 | 97 | List cells = [ 98 | DataCell( 99 | Builder( 100 | builder: (_) { 101 | Color bgColor = Colors.black; 102 | switch (request.method.toLowerCase()) { 103 | case 'post': 104 | bgColor = const Color(0xff49cc90); 105 | break; 106 | case "get": 107 | bgColor = const Color(0xff61affe); 108 | break; 109 | case "put": 110 | bgColor = const Color(0xfffca130); 111 | break; 112 | case "delete": 113 | bgColor = const Color(0xfff93e3e); 114 | break; 115 | case "head": 116 | bgColor = const Color(0xff9012fe); 117 | break; 118 | case "patch": 119 | bgColor = const Color(0xff50e3c2); 120 | break; 121 | case "disabled": 122 | bgColor = const Color(0xffebebeb); 123 | break; 124 | case "options": 125 | bgColor = const Color(0xff0d5aa7); 126 | break; 127 | } 128 | return Row( 129 | children: [ 130 | Container( 131 | decoration: BoxDecoration( 132 | color: bgColor, 133 | borderRadius: BorderRadius.circular(2), 134 | ), 135 | margin: const EdgeInsets.only(right: 10), 136 | padding: const EdgeInsets.only( 137 | left: 4, 138 | right: 4, 139 | top: 2, 140 | bottom: 2, 141 | ), 142 | child: Text( 143 | request.method, 144 | style: const TextStyle( 145 | color: Colors.white, 146 | fontSize: 12, 147 | ), 148 | ), 149 | ), 150 | Expanded( 151 | child: Text( 152 | request.uri, 153 | maxLines: 1, 154 | overflow: TextOverflow.ellipsis, 155 | style: defaultTextStyle, 156 | ), 157 | ), 158 | ], 159 | ); 160 | }, 161 | ), 162 | ), 163 | DataCell( 164 | Builder( 165 | builder: (_) { 166 | if (response != null) { 167 | return Text( 168 | '${response.statusCode}', 169 | style: defaultTextStyle, 170 | ); 171 | } 172 | return Container(); 173 | }, 174 | ), 175 | ), 176 | DataCell( 177 | Builder( 178 | builder: (_) { 179 | if (response != null) { 180 | Duration duration = Duration( 181 | milliseconds: response.timeStamp - request.timeStamp, 182 | ); 183 | return Text( 184 | '${duration.inMilliseconds} ms', 185 | style: defaultTextStyle, 186 | ); 187 | } 188 | return Container(); 189 | }, 190 | ), 191 | ), 192 | DataCell( 193 | Text( 194 | DateFormat('HH:mm:ss').format( 195 | DateTime.fromMillisecondsSinceEpoch(request.timeStamp), 196 | ), 197 | style: defaultTextStyle, 198 | ), 199 | ), 200 | ]; 201 | 202 | DataRow dataRow = DataRow( 203 | selected: _selectedRecord?.id == record.id, 204 | onSelectChanged: (bool? selected) { 205 | if (selected != null && selected) { 206 | _selectedRecord = record; 207 | } 208 | setState(() {}); 209 | }, 210 | cells: cells, 211 | ); 212 | rows.add(dataRow); 213 | } 214 | return rows; 215 | } 216 | 217 | Widget _buildSelectedRecordViewer(BuildContext context) { 218 | NetworkRecordRequest request = _selectedRecord!.request!; 219 | NetworkRecordResponse? response = _selectedRecord!.response; 220 | 221 | return DataViewer( 222 | children: [ 223 | DataViewerSection( 224 | title: const Text('General'), 225 | children: [ 226 | DataViewerItem( 227 | title: const Text('Request URL'), 228 | detailText: SelectableText(request.uri), 229 | ), 230 | DataViewerItem( 231 | title: const Text('Request Method'), 232 | detailText: SelectableText(request.method), 233 | ), 234 | if (response != null) 235 | DataViewerItem( 236 | title: const Text('Status Code'), 237 | detailText: SelectableText('${response.statusCode}'), 238 | ), 239 | ], 240 | ), 241 | DataViewerSection( 242 | title: const Text('Request Headers'), 243 | children: [ 244 | for (var key in (request.headers.keys)) 245 | DataViewerItem( 246 | title: SelectableText(key), 247 | detailText: SelectableText('${request.headers[key]}'), 248 | ), 249 | ], 250 | ), 251 | DataViewerSection( 252 | title: const Text('Request Body'), 253 | children: [ 254 | if (request.body != null) 255 | Padding( 256 | padding: const EdgeInsets.all(14), 257 | child: SelectableText( 258 | request.body, 259 | ), 260 | ), 261 | ], 262 | ), 263 | if (response != null) 264 | DataViewerSection( 265 | title: const Text('Response Headers'), 266 | children: [ 267 | for (var key in (response.headers.keys)) 268 | DataViewerItem( 269 | title: SelectableText(key), 270 | detailText: SelectableText('${response.headers[key]}'), 271 | ), 272 | ], 273 | ), 274 | if (response != null) 275 | DataViewerSection( 276 | title: const Text('Response Body'), 277 | children: [ 278 | if (response.body != null) 279 | Padding( 280 | padding: const EdgeInsets.all(14), 281 | child: SelectableText( 282 | response.body, 283 | ), 284 | ), 285 | ], 286 | ), 287 | ], 288 | ); 289 | } 290 | 291 | @override 292 | Widget build(BuildContext context) { 293 | return Inspector( 294 | child: DataTable( 295 | initialColumnWeights: const [3, 1, 1, 1], 296 | columns: _buildDataColumns(), 297 | rows: _buildDataRows(), 298 | ), 299 | detailView: 300 | _selectedRecord == null ? null : _buildSelectedRecordViewer(context), 301 | ); 302 | } 303 | } 304 | -------------------------------------------------------------------------------- /lib/inspectors/network/network_record.dart: -------------------------------------------------------------------------------- 1 | class NetworkRecord { 2 | final String id; 3 | NetworkRecordRequest? request; 4 | NetworkRecordResponse? response; 5 | 6 | NetworkRecord({ 7 | required this.id, 8 | this.request, 9 | this.response, 10 | }); 11 | } 12 | 13 | class NetworkRecordRequest { 14 | String requestId; 15 | int timeStamp; 16 | Map headers; 17 | String method; 18 | String uri; 19 | dynamic body; 20 | 21 | NetworkRecordRequest({ 22 | required this.requestId, 23 | required this.timeStamp, 24 | required this.headers, 25 | required this.method, 26 | required this.uri, 27 | required this.body, 28 | }); 29 | 30 | factory NetworkRecordRequest.fromJson(Map json) { 31 | return NetworkRecordRequest( 32 | requestId: json['requestId'], 33 | timeStamp: json['timeStamp'], 34 | headers: json['headers'], 35 | method: json['method'], 36 | uri: json['uri'], 37 | body: json['body'], 38 | ); 39 | } 40 | 41 | Map toJson() { 42 | return { 43 | 'requestId': requestId, 44 | 'timeStamp': timeStamp, 45 | 'headers': headers, 46 | 'method': method, 47 | 'uri': uri, 48 | 'body': body, 49 | }..removeWhere((key, value) => value == null); 50 | } 51 | } 52 | 53 | class NetworkRecordResponse { 54 | String requestId; 55 | int timeStamp; 56 | int statusCode; 57 | 58 | Map headers; 59 | dynamic body; 60 | 61 | NetworkRecordResponse({ 62 | required this.requestId, 63 | required this.timeStamp, 64 | required this.statusCode, 65 | required this.headers, 66 | required this.body, 67 | }); 68 | factory NetworkRecordResponse.fromJson(Map json) { 69 | return NetworkRecordResponse( 70 | requestId: json['requestId'], 71 | timeStamp: json['timeStamp'], 72 | statusCode: json['statusCode'], 73 | headers: json['headers'], 74 | body: json['body'], 75 | ); 76 | } 77 | 78 | Map toJson() { 79 | return { 80 | 'requestId': requestId, 81 | 'timeStamp': timeStamp, 82 | 'statusCode': statusCode, 83 | 'headers': headers, 84 | 'body': body, 85 | }..removeWhere((key, value) => value == null); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /lib/inspectors/shared_preferences/shared_preferences.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math' as math; 2 | 3 | import 'package:anyinspect_client/anyinspect_client.dart'; 4 | import 'package:anyinspect_ui/anyinspect_ui.dart'; 5 | import 'package:flutter/material.dart' hide DataTable; 6 | import 'package:flutter_sfsymbols/flutter_sfsymbols.dart'; 7 | 8 | class SharedPreferencesInspector extends StatefulWidget { 9 | final AnyInspectPlugin plugin; 10 | 11 | const SharedPreferencesInspector( 12 | this.plugin, { 13 | Key? key, 14 | }) : super(key: key); 15 | 16 | @override 17 | State createState() => 18 | _SharedPreferencesInspectorState(); 19 | } 20 | 21 | class _SharedPreferencesInspectorState extends State 22 | with SingleTickerProviderStateMixin, AnyInspectPluginEventListener { 23 | late AnimationController _animationController; 24 | 25 | List> _records = []; 26 | 27 | @override 28 | void initState() { 29 | _animationController = AnimationController( 30 | duration: const Duration(milliseconds: 1200), 31 | vsync: this, 32 | ); 33 | widget.plugin.addEventListener(this); 34 | super.initState(); 35 | 36 | _getAll(); 37 | } 38 | 39 | @override 40 | void dispose() { 41 | widget.plugin.removeEventListener(this); 42 | super.dispose(); 43 | } 44 | 45 | @override 46 | void onEvent(AnyInspectPluginEvent event) { 47 | if (event.name == 'getAllSuccess') { 48 | List> list = 49 | List>.from(event.arguments['list']); 50 | 51 | setState(() { 52 | _records.clear(); 53 | _records.addAll(list); 54 | }); 55 | 56 | Future.delayed(const Duration(seconds: 1)).then((_) { 57 | _animationController.stop(); 58 | }); 59 | } 60 | } 61 | 62 | void _getAll() { 63 | _animationController.repeat(); 64 | widget.plugin.callMethod('getAll'); 65 | } 66 | 67 | List _buildDataColumns() { 68 | return const [ 69 | DataColumn( 70 | label: Text('Key'), 71 | ), 72 | DataColumn( 73 | label: Text('Value'), 74 | ), 75 | ]; 76 | } 77 | 78 | List _buildDataRows() { 79 | List rows = []; 80 | for (var record in _records) { 81 | DataRow dataRow = DataRow( 82 | onSelectChanged: (bool? selected) {}, 83 | cells: [ 84 | DataCell( 85 | SelectableText(record['key']), 86 | ), 87 | DataCell( 88 | SelectableText('${record['value']}'), 89 | ), 90 | ], 91 | ); 92 | rows.add(dataRow); 93 | } 94 | return rows; 95 | } 96 | 97 | @override 98 | Widget build(BuildContext context) { 99 | return Stack( 100 | children: [ 101 | Inspector( 102 | child: DataTable( 103 | initialColumnWeights: const [2, 3], 104 | columns: _buildDataColumns(), 105 | rows: _buildDataRows(), 106 | ), 107 | ), 108 | Positioned( 109 | right: 60, 110 | bottom: 60, 111 | child: FloatingActionButton.small( 112 | backgroundColor: Theme.of(context).primaryColor, 113 | child: AnimatedBuilder( 114 | animation: _animationController, 115 | child: const Icon( 116 | SFSymbols.arrow_2_circlepath, 117 | size: 20, 118 | ), 119 | builder: (_, Widget? child) { 120 | return Transform.rotate( 121 | angle: _animationController.value * 2.0 * math.pi, 122 | child: child, 123 | ); 124 | }, 125 | ), 126 | onPressed: () { 127 | _getAll(); 128 | }, 129 | ), 130 | ), 131 | ], 132 | ); 133 | } 134 | } 135 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:anyinspect_server/anyinspect_server.dart'; 2 | import 'package:bot_toast/bot_toast.dart'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:network_info_plus/network_info_plus.dart'; 5 | import 'package:window_manager/window_manager.dart'; 6 | 7 | import './includes.dart'; 8 | 9 | void main() async { 10 | WidgetsFlutterBinding.ensureInitialized(); 11 | await windowManager.ensureInitialized(); 12 | await init(); 13 | 14 | windowManager.waitUntilReadyToShow().then((_) async { 15 | await Future.delayed(const Duration(milliseconds: 200)); 16 | await windowManager.setTitle('AnyInspect'); 17 | await windowManager.show(); 18 | }); 19 | 20 | String? localIpAddress = await NetworkInfo().getWifiIP(); 21 | await AnyInspectServer.instance.start( 22 | address: localIpAddress!, 23 | port: 7700, 24 | ); 25 | 26 | // Env.instance.appBuildNumber = 1; 27 | // Env.instance.appVersion = '0.1.1'; 28 | // ApiClient.instance.setDebug(); 29 | 30 | runApp(const MyApp()); 31 | } 32 | 33 | class MyApp extends StatefulWidget { 34 | const MyApp({Key? key}) : super(key: key); 35 | 36 | @override 37 | _MyAppState createState() => _MyAppState(); 38 | } 39 | 40 | class _MyAppState extends State { 41 | @override 42 | Widget build(BuildContext context) { 43 | final botToastBuilder = BotToastInit(); 44 | return MaterialApp( 45 | theme: lightThemeData, 46 | darkTheme: darkThemeData, 47 | builder: (context, child) { 48 | child = botToastBuilder(context, child); 49 | return child; 50 | }, 51 | navigatorObservers: [BotToastNavigatorObserver()], 52 | home: const HomePage(), 53 | ); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /lib/models/device.dart: -------------------------------------------------------------------------------- 1 | class Device { 2 | final String? id; 3 | final String? name; 4 | final bool isPhysical; 5 | final String system; 6 | final String systemVersion; 7 | 8 | Device({ 9 | this.id, 10 | this.name, 11 | required this.isPhysical, 12 | required this.system, 13 | required this.systemVersion, 14 | }); 15 | } 16 | -------------------------------------------------------------------------------- /lib/models/models.dart: -------------------------------------------------------------------------------- 1 | export 'device.dart'; 2 | export 'version.dart'; 3 | -------------------------------------------------------------------------------- /lib/models/version.dart: -------------------------------------------------------------------------------- 1 | class VersionPlatform { 2 | String platform; 3 | String url; 4 | 5 | VersionPlatform({ 6 | required this.platform, 7 | required this.url, 8 | }); 9 | 10 | factory VersionPlatform.fromJson(Map json) { 11 | return VersionPlatform( 12 | platform: json['platform'], 13 | url: json['url'], 14 | ); 15 | } 16 | 17 | Map toJson() { 18 | return { 19 | 'platform': platform, 20 | 'url': url, 21 | }; 22 | } 23 | } 24 | 25 | class Version { 26 | String version; 27 | int buildNumber; 28 | List platforms; 29 | 30 | Version({ 31 | required this.version, 32 | required this.buildNumber, 33 | required this.platforms, 34 | }); 35 | 36 | factory Version.fromJson(Map json) { 37 | List platforms = []; 38 | 39 | if (json['platforms'] != null) { 40 | platforms = (json['platforms'] as List) 41 | .map((item) => VersionPlatform.fromJson(item)) 42 | .toList(); 43 | } 44 | return Version( 45 | version: json['version'], 46 | buildNumber: json['buildNumber'], 47 | platforms: platforms, 48 | ); 49 | } 50 | 51 | Map toJson() { 52 | return { 53 | 'version': version, 54 | 'buildNumber': buildNumber, 55 | 'platforms': platforms.map((e) => e.toJson()).toList(), 56 | }; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /lib/networking/api_client/api_client.dart: -------------------------------------------------------------------------------- 1 | import 'package:anyinspect_app/includes.dart'; 2 | import 'package:dio/dio.dart'; 3 | 4 | import 'apis/versions.dart'; 5 | import 'api_client_interceptor.dart'; 6 | 7 | class ApiClient { 8 | static String guestKey = ''; 9 | 10 | ApiClient._() { 11 | BaseOptions options = BaseOptions( 12 | baseUrl: Env.instance.apiUrl, 13 | connectTimeout: 60000, 14 | receiveTimeout: 60000, 15 | headers: { 16 | 'Accept': 'application/json', 17 | 'Content-Type': 'application/json' 18 | }, 19 | responseType: ResponseType.json, 20 | ); 21 | _http = Dio(options); 22 | _http.interceptors.add(ApiClientInterceptor()); 23 | 24 | _versionsApi = VersionsApi(_http); 25 | } 26 | 27 | /// The shared instance of [ApiClient]. 28 | static final ApiClient instance = ApiClient._(); 29 | 30 | late Dio _http; 31 | 32 | late VersionsApi _versionsApi; 33 | 34 | void setDebug() { 35 | _http.options.baseUrl = 'http://127.0.0.1:8080'; 36 | } 37 | 38 | VersionsApi get versions => version(null); 39 | 40 | VersionsApi version(String? id) { 41 | _versionsApi.setVersionId(id); 42 | return _versionsApi; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /lib/networking/api_client/api_client_interceptor.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:anyinspect_app/includes.dart'; 4 | import 'package:device_info_plus/device_info_plus.dart'; 5 | import 'package:dio/dio.dart'; 6 | import 'package:flutter/foundation.dart'; 7 | 8 | class ApiClientInterceptor extends Interceptor { 9 | bool _isGettedDeviceInfo = false; 10 | 11 | String? _deviceUniqueId; 12 | String? _deviceBrand; 13 | String? _deviceModel; 14 | String? _deviceLanguage; 15 | String? _deviceSystem; 16 | String? _deviceSystemVersion; 17 | 18 | @override 19 | void onRequest( 20 | RequestOptions options, 21 | RequestInterceptorHandler handler, 22 | ) async { 23 | if (!_isGettedDeviceInfo) { 24 | DeviceInfoPlugin _deviceInfo = DeviceInfoPlugin(); 25 | 26 | if (!kIsWeb && Platform.isAndroid) { 27 | AndroidDeviceInfo info = (await _deviceInfo.androidInfo); 28 | _deviceUniqueId = info.androidId; 29 | _deviceBrand = info.brand; 30 | _deviceModel = info.model; 31 | } else if (!kIsWeb && Platform.isIOS) { 32 | IosDeviceInfo info = (await _deviceInfo.iosInfo); 33 | _deviceUniqueId = info.identifierForVendor; 34 | _deviceBrand = 'Apple'; 35 | _deviceModel = info.utsname.machine; 36 | } else if (!kIsWeb && Platform.isLinux) { 37 | } else if (!kIsWeb && Platform.isMacOS) { 38 | MacOsDeviceInfo info = (await _deviceInfo.macOsInfo); 39 | _deviceBrand = 'Apple'; 40 | _deviceModel = info.model; 41 | } else if (!kIsWeb && Platform.isWindows) { 42 | // WindowsDeviceInfo info = (await _deviceInfo.windowsInfo); 43 | } 44 | 45 | _deviceLanguage = Platform.localeName; 46 | _deviceSystem = Platform.operatingSystem; 47 | _deviceSystemVersion = Platform.operatingSystemVersion; 48 | _isGettedDeviceInfo = true; 49 | } 50 | 51 | options.headers["X-USER-DEVICE-UNIQUE-ID"] = (_deviceUniqueId ?? '').isEmpty 52 | ? Env.instance.deviceUniqueId 53 | : _deviceUniqueId; 54 | options.headers["X-USER-DEVICE-BRAND"] = _deviceBrand; 55 | options.headers["X-USER-DEVICE-MODEL"] = _deviceModel; 56 | options.headers["X-USER-DEVICE-LANGUAGE"] = _deviceLanguage; 57 | options.headers["X-USER-DEVICE-SYSTEM"] = _deviceSystem; 58 | options.headers["X-USER-DEVICE-SYSTEM-VERSION"] = _deviceSystemVersion; 59 | 60 | options.headers["X-USER-APP-BUILD-NUMBER"] = Env.instance.appBuildNumber; 61 | options.headers["X-USER-APP-VERSION"] = Env.instance.appVersion; 62 | 63 | handler.next(options); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /lib/networking/api_client/apis/versions.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'package:dio/dio.dart'; 3 | 4 | import '../../../models/version.dart'; 5 | 6 | class VersionsApi { 7 | final Dio _http; 8 | 9 | dynamic _versionId; 10 | 11 | VersionsApi(this._http); 12 | 13 | void setVersionId(id) { 14 | _versionId = id; 15 | } 16 | 17 | Future> list() async { 18 | final response = await _http.get('/versions'); 19 | 20 | List list = (response.data as List) 21 | .map( 22 | (e) => Version.fromJson(e), 23 | ) 24 | .toList(); 25 | return list; 26 | } 27 | 28 | Future get() async { 29 | final response = await _http.get('/versions/$_versionId'); 30 | 31 | var d = Version.fromJson(response.data); 32 | return d; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /lib/networking/networking.dart: -------------------------------------------------------------------------------- 1 | export 'api_client/api_client.dart'; -------------------------------------------------------------------------------- /lib/pages/home/home.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:anyinspect_client/anyinspect_client.dart'; 4 | import 'package:anyinspect_server/anyinspect_server.dart'; 5 | import 'package:bot_toast/bot_toast.dart'; 6 | import 'package:flutter/cupertino.dart'; 7 | import 'package:flutter/gestures.dart'; 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_sfsymbols/flutter_sfsymbols.dart'; 10 | import 'package:multi_split_view/multi_split_view.dart'; 11 | import 'package:preference_list/preference_list.dart'; 12 | import 'package:url_launcher/url_launcher.dart'; 13 | 14 | import '../../includes.dart'; 15 | 16 | extension AnyInspectPluginExt on AnyInspectPlugin { 17 | IconData get icon { 18 | switch (id) { 19 | case 'network': 20 | return SFSymbols.globe; 21 | default: 22 | } 23 | return SFSymbols.cube_fill; 24 | } 25 | } 26 | 27 | class HomePage extends StatefulWidget { 28 | const HomePage({Key? key}) : super(key: key); 29 | 30 | @override 31 | _HomePageState createState() => _HomePageState(); 32 | } 33 | 34 | class _HomePageState extends State with AnyInspectServerListener { 35 | Version? _latestVersion; 36 | 37 | List _devices = []; 38 | List _clients = []; 39 | 40 | String? _selectedClientId; 41 | String? _selectedClientPluginId; 42 | 43 | AnyInspectClient get selectedClient { 44 | return _clients.firstWhere( 45 | (e) => e.id == _selectedClientId, 46 | ); 47 | } 48 | 49 | AnyInspectPlugin get selectedClientPlugin { 50 | return selectedClient.plugins.firstWhere( 51 | (e) => e.id == _selectedClientPluginId, 52 | ); 53 | } 54 | 55 | @override 56 | void initState() { 57 | AnyInspectServer.instance.addListener(this); 58 | super.initState(); 59 | 60 | _loadData(); 61 | } 62 | 63 | @override 64 | void dispose() { 65 | AnyInspectServer.instance.removeListener(this); 66 | super.dispose(); 67 | } 68 | 69 | void _loadData() async { 70 | try { 71 | _latestVersion = await ApiClient.instance.version('latest').get(); 72 | setState(() {}); 73 | } catch (error) {} 74 | } 75 | 76 | Widget _buildPageSidebar(BuildContext context) { 77 | return Sidebar( 78 | children: [ 79 | if (Platform.isMacOS) const SizedBox(height: 22), 80 | if (_selectedClientId != null) 81 | _SidebarHeader( 82 | devices: _devices, 83 | clients: _clients, 84 | selectedClient: selectedClient, 85 | onSelectedClientChanged: (newSelectedClient) { 86 | setState(() { 87 | _selectedClientId = newSelectedClient.id; 88 | }); 89 | }, 90 | ), 91 | const Divider(height: 0), 92 | const SizedBox(height: 4), 93 | Expanded( 94 | child: Menu( 95 | children: [ 96 | MenuSection( 97 | title: const Text('PLUGINS'), 98 | children: [ 99 | for (AnyInspectPlugin plugin in (selectedClient.plugins)) 100 | MenuItem( 101 | icon: Container( 102 | margin: const EdgeInsets.only(top: 2, bottom: 2), 103 | decoration: BoxDecoration( 104 | // color: const Color(0xffbfbfbf), 105 | color: Theme.of(context).primaryColor, 106 | borderRadius: BorderRadius.circular(4), 107 | ), 108 | width: 25, 109 | height: 25, 110 | child: Icon( 111 | plugin.icon, 112 | size: 16, 113 | color: Colors.white, 114 | ), 115 | ), 116 | title: Container( 117 | padding: const EdgeInsets.only(bottom: 2), 118 | child: Text(plugin.name), 119 | ), 120 | selected: _selectedClientPluginId == plugin.id, 121 | onTap: () async { 122 | _selectedClientPluginId = plugin.id; 123 | setState(() {}); 124 | }, 125 | ), 126 | ], 127 | ), 128 | ], 129 | ), 130 | ), 131 | if (_latestVersion != null && 132 | _latestVersion!.buildNumber > Env.instance.appBuildNumber) 133 | Container( 134 | width: double.infinity, 135 | margin: const EdgeInsets.only( 136 | left: 14, 137 | right: 14, 138 | top: 14, 139 | bottom: 14, 140 | ), 141 | padding: const EdgeInsets.only( 142 | left: 12, 143 | right: 12, 144 | top: 12, 145 | bottom: 14, 146 | ), 147 | decoration: BoxDecoration( 148 | color: Theme.of(context).primaryColor, 149 | borderRadius: BorderRadius.circular(4), 150 | ), 151 | child: Column( 152 | crossAxisAlignment: CrossAxisAlignment.start, 153 | children: [ 154 | const Text( 155 | 'Update available', 156 | style: TextStyle( 157 | color: Colors.white, 158 | fontSize: 14, 159 | fontWeight: FontWeight.w500, 160 | ), 161 | ), 162 | const SizedBox(height: 10), 163 | Text.rich( 164 | TextSpan( 165 | text: 166 | 'AnyInspect version ${_latestVersion!.version} is now available. Click to ', 167 | children: [ 168 | TextSpan( 169 | text: 'download', 170 | style: const TextStyle( 171 | color: Colors.white, 172 | fontWeight: FontWeight.bold, 173 | ), 174 | recognizer: TapGestureRecognizer() 175 | ..onTap = () async { 176 | await launch( 177 | '${Env.instance.webUrl}/release-notes'); 178 | }, 179 | ), 180 | const TextSpan(text: '.'), 181 | ], 182 | ), 183 | style: const TextStyle( 184 | color: Colors.white, 185 | ), 186 | ), 187 | ], 188 | ), 189 | ), 190 | const Divider(height: 0), 191 | const _SidebarFooter(), 192 | ], 193 | ); 194 | } 195 | 196 | Widget _buildPageContent(BuildContext context) { 197 | int index = selectedClient.plugins.indexWhere( 198 | (e) => e.id == _selectedClientPluginId, 199 | ); 200 | if (index == -1) { 201 | return const Center( 202 | child: Text('NO PLUGIN SELECTED'), 203 | ); 204 | } 205 | return IndexedStack( 206 | key: Key(_selectedClientId!), 207 | index: index, 208 | children: [ 209 | for (var plugin in selectedClient.plugins) 210 | Builder(builder: (_) { 211 | switch (plugin.id) { 212 | case 'network': 213 | return NetworkInspector(plugin); 214 | case 'shared_preferences': 215 | return SharedPreferencesInspector(plugin); 216 | } 217 | return Container(); 218 | }), 219 | ], 220 | ); 221 | } 222 | 223 | @override 224 | Widget build(BuildContext context) { 225 | return Scaffold( 226 | body: Builder(builder: (_) { 227 | Size size = MediaQuery.of(context).size; 228 | if (_clients.isEmpty || _selectedClientId == null) { 229 | return Center( 230 | child: Column( 231 | mainAxisSize: MainAxisSize.min, 232 | children: [ 233 | const Text( 234 | 'NO APPLICATIONS FOUND', 235 | style: TextStyle(fontSize: 16), 236 | ), 237 | MouseRegion( 238 | cursor: SystemMouseCursors.click, 239 | child: CupertinoButton( 240 | child: const Text('Adding to your app'), 241 | onPressed: () async { 242 | await launch('${Env.instance.webUrl}/docs'); 243 | }, 244 | ), 245 | ), 246 | ], 247 | ), 248 | ); 249 | } 250 | return Container( 251 | decoration: BoxDecoration( 252 | border: Platform.isWindows 253 | ? Border(top: BorderSide(color: Theme.of(context).dividerColor)) 254 | : null, 255 | ), 256 | child: MultiSplitViewTheme( 257 | child: MultiSplitView( 258 | children: [ 259 | _buildPageSidebar(context), 260 | Builder(builder: (_) { 261 | if (_selectedClientId == null) { 262 | return Container(); 263 | } 264 | return _buildPageContent(context); 265 | }), 266 | ], 267 | controller: MultiSplitViewController( 268 | initialWeights: [280 / size.width], 269 | ), 270 | ), 271 | data: MultiSplitViewThemeData( 272 | dividerThickness: 1, 273 | dividerPainter: DividerPainters.background( 274 | color: Theme.of(context).dividerColor, 275 | ), 276 | ), 277 | ), 278 | ); 279 | }), 280 | ); 281 | } 282 | 283 | @override 284 | void onClientConnect(AnyInspectClient client) { 285 | _devices = AnyInspectServer.instance.allDevices; 286 | _clients = AnyInspectServer.instance.allClients; 287 | _selectedClientId = _clients.first.id; 288 | setState(() {}); 289 | } 290 | 291 | @override 292 | void onClientDisconnect(AnyInspectClient client) { 293 | _devices = AnyInspectServer.instance.allDevices; 294 | _clients = AnyInspectServer.instance.allClients; 295 | if (_clients.indexWhere((e) => e.id == _selectedClientId) == -1) { 296 | if (_clients.isNotEmpty) { 297 | _selectedClientId = _clients.first.id; 298 | } else { 299 | _selectedClientId = null; 300 | _selectedClientPluginId = null; 301 | } 302 | } 303 | setState(() {}); 304 | } 305 | } 306 | 307 | class _SidebarHeader extends StatelessWidget { 308 | final List devices; 309 | final List clients; 310 | final AnyInspectClient selectedClient; 311 | final ValueChanged onSelectedClientChanged; 312 | 313 | const _SidebarHeader({ 314 | Key? key, 315 | required this.devices, 316 | required this.clients, 317 | required this.selectedClient, 318 | required this.onSelectedClientChanged, 319 | }) : super(key: key); 320 | 321 | CancelFunc _show(BuildContext targetContext) { 322 | return BotToast.showAttachedWidget( 323 | targetContext: targetContext, 324 | onlyOne: true, 325 | attachedBuilder: (cancel) => Padding( 326 | padding: const EdgeInsets.only(top: 10), 327 | child: Container( 328 | width: 240, 329 | decoration: BoxDecoration( 330 | color: Theme.of(targetContext).canvasColor, 331 | border: Border.all( 332 | color: Theme.of(targetContext).dividerColor, 333 | width: 1, 334 | ), 335 | borderRadius: BorderRadius.circular(4), 336 | boxShadow: [ 337 | BoxShadow( 338 | color: Colors.black.withOpacity(0.1), 339 | offset: const Offset(0.0, 6), 340 | blurRadius: 6, 341 | ), 342 | ], 343 | ), 344 | padding: const EdgeInsets.only( 345 | top: 6, 346 | bottom: 6, 347 | ), 348 | child: Column( 349 | mainAxisSize: MainAxisSize.min, 350 | children: [ 351 | for (Device device in devices) 352 | MenuSection( 353 | title: Text(device.name ?? device.id ?? ''), 354 | children: [ 355 | for (AnyInspectClient client 356 | in clients.where((e) => e.deviceId == device.id)) 357 | MenuItem( 358 | title: Text( 359 | client.appName ?? client.appIdentifier ?? '', 360 | ), 361 | selected: client.id == selectedClient.id, 362 | onTap: () async { 363 | onSelectedClientChanged(client); 364 | cancel(); 365 | }, 366 | ), 367 | ], 368 | ), 369 | ], 370 | ), 371 | ), 372 | ), 373 | ); 374 | } 375 | 376 | @override 377 | Widget build(BuildContext context) { 378 | String appIdentifier = selectedClient.appIdentifier!; 379 | String appName = selectedClient.appName!; 380 | String appVersion = selectedClient.appVersion!; 381 | String appBuildNumber = selectedClient.appBuildNumber!; 382 | return Column( 383 | children: [ 384 | Builder( 385 | builder: (ctx) { 386 | return CupertinoButton( 387 | padding: EdgeInsets.zero, 388 | child: Container( 389 | width: double.infinity, 390 | decoration: BoxDecoration( 391 | color: Theme.of(context).scaffoldBackgroundColor, 392 | borderRadius: BorderRadius.circular(4), 393 | ), 394 | margin: const EdgeInsets.only( 395 | left: 14, 396 | right: 14, 397 | top: 14, 398 | ), 399 | padding: const EdgeInsets.all(10), 400 | child: Row( 401 | children: [ 402 | // Container( 403 | // decoration: BoxDecoration( 404 | // color: Theme.of(context).primaryColor, 405 | // borderRadius: BorderRadius.circular(4), 406 | // ), 407 | // width: 28, 408 | // height: 28, 409 | // margin: const EdgeInsets.only(right: 8), 410 | // ), 411 | Expanded( 412 | child: Column( 413 | crossAxisAlignment: CrossAxisAlignment.start, 414 | mainAxisAlignment: MainAxisAlignment.center, 415 | children: [ 416 | Text( 417 | '$appName (v$appVersion+$appBuildNumber)', 418 | style: TextStyle( 419 | color: 420 | Theme.of(context).textTheme.bodyText2!.color, 421 | fontSize: 12, 422 | ), 423 | maxLines: 1, 424 | overflow: TextOverflow.ellipsis, 425 | ), 426 | Text( 427 | appIdentifier, 428 | style: TextStyle( 429 | color: Theme.of(context) 430 | .textTheme 431 | .bodyText2! 432 | .color! 433 | .withOpacity(0.5), 434 | fontSize: 10, 435 | ), 436 | maxLines: 1, 437 | overflow: TextOverflow.ellipsis, 438 | ), 439 | ], 440 | ), 441 | ), 442 | Icon( 443 | SFSymbols.chevron_up_chevron_down, 444 | size: 15, 445 | color: Theme.of(context) 446 | .textTheme 447 | .bodyText2! 448 | .color! 449 | .withOpacity(0.5), 450 | ), 451 | ], 452 | ), 453 | ), 454 | onPressed: () => _show(ctx), 455 | ); 456 | }, 457 | ), 458 | if (selectedClient.disconnected) 459 | Container( 460 | margin: const EdgeInsets.only( 461 | left: 14, 462 | right: 14, 463 | top: 6, 464 | ), 465 | child: Row( 466 | children: const [ 467 | SizedBox(width: 2), 468 | Icon( 469 | SFSymbols.info_circle, 470 | size: 14, 471 | color: Colors.red, 472 | ), 473 | SizedBox(width: 4), 474 | Text( 475 | 'APPLICATION DISCONNECTED', 476 | style: TextStyle( 477 | color: Colors.red, 478 | fontSize: 12, 479 | ), 480 | ), 481 | ], 482 | ), 483 | ), 484 | const SizedBox(height: 14), 485 | ], 486 | ); 487 | } 488 | } 489 | 490 | class _SidebarFooter extends StatelessWidget { 491 | const _SidebarFooter({ 492 | Key? key, 493 | }) : super(key: key); 494 | 495 | @override 496 | Widget build(BuildContext context) { 497 | return Column( 498 | children: [ 499 | Container( 500 | margin: const EdgeInsets.all(14), 501 | child: Row( 502 | children: [ 503 | Text( 504 | '${Env.instance.appVersion}+${Env.instance.appBuildNumber}', 505 | style: TextStyle( 506 | color: Theme.of(context) 507 | .textTheme 508 | .bodyText2! 509 | .color! 510 | .withOpacity(0.5), 511 | ), 512 | ), 513 | Expanded(child: Container()), 514 | SizedBox( 515 | width: 16, 516 | height: 16, 517 | child: CupertinoButton( 518 | padding: EdgeInsets.zero, 519 | child: Image.asset( 520 | 'assets/images/github_mark.png', 521 | width: 16, 522 | height: 16, 523 | ), 524 | onPressed: () async { 525 | await launch('https://github.com/anyinspect/anyinspect'); 526 | }, 527 | ), 528 | ), 529 | ], 530 | ), 531 | ), 532 | ], 533 | ); 534 | } 535 | } 536 | -------------------------------------------------------------------------------- /lib/pages/pages.dart: -------------------------------------------------------------------------------- 1 | export './home/home.dart'; 2 | export './settings/settings.dart'; -------------------------------------------------------------------------------- /lib/pages/settings/settings.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:preference_list/preference_list.dart'; 3 | 4 | import '../../../includes.dart'; 5 | 6 | class SettingsPage extends StatefulWidget { 7 | const SettingsPage({Key? key}) : super(key: key); 8 | 9 | @override 10 | State createState() => _SettingsPageState(); 11 | } 12 | 13 | class _SettingsPageState extends State { 14 | Widget _buildBody(BuildContext context) { 15 | return PreferenceList( 16 | children: [ 17 | PreferenceListSection( 18 | title: Text('Appearance'), 19 | children: [ 20 | PreferenceListItem( 21 | title: Text('Theme Mode'), 22 | detailText: Text('Light'), 23 | onTap: () {}, 24 | ), 25 | ], 26 | ), 27 | PreferenceListSection( 28 | title: Text('Shortcuts'), 29 | children: [ 30 | PreferenceListItem( 31 | title: Text('Keyboard Shortcuts'), 32 | onTap: () {}, 33 | ), 34 | ], 35 | ), 36 | ], 37 | ); 38 | } 39 | 40 | Widget _build(BuildContext context) { 41 | return Scaffold( 42 | appBar: AppBar( 43 | title: const Text('Settings'), 44 | ), 45 | body: _buildBody(context), 46 | ); 47 | } 48 | 49 | @override 50 | Widget build(BuildContext context) { 51 | return _build(context); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /lib/themes/dark_theme.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | const _kBlueColor = Color(0xff416ff4); 5 | const _kGreenColor = Color(0xff52c41a); 6 | const _kRedColor = Color(0xfff5222d); 7 | const _kGoldColor = Color(0xfffaad14); 8 | 9 | // -------- Colors ----------- 10 | const _kPrimaryColor = _kBlueColor; 11 | const _kInfoColor = _kBlueColor; 12 | const _kSuccessColor = _kGreenColor; 13 | const _kErrorColor = _kRedColor; 14 | const _kWarningColor = _kGoldColor; 15 | 16 | const _kScaffoldBackgroundColor = const Color(0xff1d1d1d); 17 | const _kCanvasColor = Color(0xff282828); 18 | 19 | var darkThemeData = ThemeData( 20 | brightness: Brightness.dark, 21 | // VisualDensity? visualDensity, 22 | // MaterialColor? primarySwatch, 23 | primaryColor: _kPrimaryColor, 24 | // Brightness? primaryColorBrightness, 25 | // Color? primaryColorLight, 26 | // Color? primaryColorDark, 27 | // Color? accentColor, 28 | // Brightness? accentColorBrightness, 29 | canvasColor: _kCanvasColor, 30 | // Color? shadowColor, 31 | scaffoldBackgroundColor: _kScaffoldBackgroundColor, 32 | // Color? bottomAppBarColor, 33 | // Color? cardColor, 34 | // Color? dividerColor, 35 | // Color? focusColor, 36 | // Color? hoverColor, 37 | // Color? highlightColor, 38 | // Color? splashColor, 39 | // InteractiveInkFeatureFactory? splashFactory, 40 | // Color? selectedRowColor, 41 | // Color? unselectedWidgetColor, 42 | // Color? disabledColor, 43 | // Color? buttonColor, 44 | // ButtonThemeData? buttonTheme, 45 | // ToggleButtonsThemeData? toggleButtonsTheme, 46 | // Color? secondaryHeaderColor, 47 | // Color? backgroundColor, 48 | dialogBackgroundColor: _kCanvasColor, 49 | // Color? indicatorColor, 50 | // Color? hintColor, 51 | // Color? errorColor, 52 | // Color? toggleableActiveColor, 53 | // String? fontFamily, 54 | textTheme: TextTheme( 55 | bodyText2: TextStyle( 56 | fontSize: 14, 57 | ), 58 | caption: TextStyle( 59 | fontSize: 12, 60 | ), 61 | ), 62 | // primaryTextTheme 63 | // TextTheme? accentTextTheme, 64 | // InputDecorationTheme? inputDecorationTheme, 65 | // IconThemeData? iconTheme, 66 | // IconThemeData? primaryIconTheme, 67 | // IconThemeData? accentIconTheme, 68 | // SliderThemeData? sliderTheme, 69 | // TabBarTheme? tabBarTheme, 70 | // TooltipThemeData? tooltipTheme, 71 | // CardTheme? cardTheme, 72 | // ChipThemeData? chipTheme, 73 | // TargetPlatform? platform, 74 | // MaterialTapTargetSize? materialTapTargetSize, 75 | // bool? applyElevationOverlayColor, 76 | // PageTransitionsTheme? pageTransitionsTheme, 77 | appBarTheme: AppBarTheme( 78 | brightness: Brightness.dark, 79 | color: _kCanvasColor, 80 | elevation: 0, 81 | // this.shadowColor, 82 | iconTheme: IconThemeData( 83 | color: Colors.white, 84 | opacity: 1, 85 | size: 24, 86 | ), 87 | actionsIconTheme: IconThemeData( 88 | color: Colors.white, 89 | opacity: 1, 90 | size: 24, 91 | ), 92 | textTheme: TextTheme( 93 | headline6: TextStyle( 94 | color: Colors.white, 95 | fontSize: 15, 96 | ), 97 | ), 98 | titleTextStyle: TextStyle( 99 | color: Colors.white, 100 | fontSize: 15, 101 | ), 102 | // this.centerTitle, 103 | // this.titleSpacing, 104 | ), 105 | // BottomAppBarTheme? bottomAppBarTheme, 106 | // ColorScheme? colorScheme, 107 | // DialogTheme? dialogTheme, 108 | // FloatingActionButtonThemeData? floatingActionButtonTheme, 109 | // NavigationRailThemeData? navigationRailTheme, 110 | // Typography? typography, 111 | cupertinoOverrideTheme: CupertinoThemeData( 112 | primaryColor: _kPrimaryColor, 113 | barBackgroundColor: _kCanvasColor, 114 | ), 115 | // SnackBarThemeData? snackBarTheme, 116 | // BottomSheetThemeData? bottomSheetTheme, 117 | // PopupMenuThemeData? popupMenuTheme, 118 | // MaterialBannerThemeData? bannerTheme, 119 | // DividerThemeData? dividerTheme, 120 | // ButtonBarThemeData? buttonBarTheme, 121 | // BottomNavigationBarThemeData? bottomNavigationBarTheme, 122 | // TimePickerThemeData? timePickerTheme, 123 | // TextButtonThemeData? textButtonTheme, 124 | // ElevatedButtonThemeData? elevatedButtonTheme, 125 | // OutlinedButtonThemeData? outlinedButtonTheme, 126 | // TextSelectionThemeData? textSelectionTheme, 127 | // DataTableThemeData? dataTableTheme, 128 | // bool? fixTextFieldOutlineLabel, 129 | ); 130 | -------------------------------------------------------------------------------- /lib/themes/light_theme.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | const _kBlueColor = Color(0xff416ff4); 5 | const _kGreenColor = Color(0xff52c41a); 6 | const _kRedColor = Color(0xfff5222d); 7 | const _kGoldColor = Color(0xfffaad14); 8 | 9 | // -------- Colors ----------- 10 | const _kPrimaryColor = _kBlueColor; 11 | const _kInfoColor = _kBlueColor; 12 | const _kSuccessColor = _kGreenColor; 13 | const _kErrorColor = _kRedColor; 14 | const _kWarningColor = _kGoldColor; 15 | 16 | const kTextColor = Color(0xff070708); 17 | const kTextColorSecondary = Color(0xff4b4d52); 18 | const kTextColorWarning = _kGoldColor; 19 | const kTextColorDanger = _kRedColor; 20 | const kTextColorInverse = Colors.white; 21 | 22 | const _kScaffoldBackgroundColor = Color(0xfff6f8fa); 23 | const _kCanvasColor = Colors.white; 24 | 25 | var lightThemeData = ThemeData( 26 | // Brightness? brightness, 27 | // VisualDensity? visualDensity, 28 | // MaterialColor? primarySwatch, 29 | primaryColor: _kPrimaryColor, 30 | // Brightness? primaryColorBrightness, 31 | // Color? primaryColorLight, 32 | // Color? primaryColorDark, 33 | // Color? accentColor, 34 | // Brightness? accentColorBrightness, 35 | canvasColor: _kCanvasColor, 36 | // Color? shadowColor, 37 | scaffoldBackgroundColor: _kScaffoldBackgroundColor, 38 | // Color? bottomAppBarColor, 39 | // Color? cardColor, 40 | dividerColor: Colors.grey.withOpacity(0.2), 41 | // Color? focusColor, 42 | // Color? hoverColor, 43 | // Color? highlightColor, 44 | // Color? splashColor, 45 | // InteractiveInkFeatureFactory? splashFactory, 46 | // Color? selectedRowColor, 47 | // Color? unselectedWidgetColor, 48 | // Color? disabledColor, 49 | // Color? buttonColor, 50 | // ButtonThemeData? buttonTheme, 51 | // ToggleButtonsThemeData? toggleButtonsTheme, 52 | // Color? secondaryHeaderColor, 53 | // Color? backgroundColor, 54 | dialogBackgroundColor: _kCanvasColor, 55 | // Color? indicatorColor, 56 | // Color? hintColor, 57 | // Color? errorColor, 58 | // Color? toggleableActiveColor, 59 | // String? fontFamily, 60 | textTheme: const TextTheme( 61 | bodyText2: TextStyle( 62 | color: kTextColor, 63 | fontSize: 14, 64 | ), 65 | caption: TextStyle( 66 | color: kTextColorSecondary, 67 | fontSize: 12, 68 | ), 69 | ), 70 | // primaryTextTheme 71 | // TextTheme? accentTextTheme, 72 | // InputDecorationTheme? inputDecorationTheme, 73 | // IconThemeData? iconTheme, 74 | // IconThemeData? primaryIconTheme, 75 | // IconThemeData? accentIconTheme, 76 | // SliderThemeData? sliderTheme, 77 | // TabBarTheme? tabBarTheme, 78 | // TooltipThemeData? tooltipTheme, 79 | // CardTheme? cardTheme, 80 | // ChipThemeData? chipTheme, 81 | // TargetPlatform? platform, 82 | // MaterialTapTargetSize? materialTapTargetSize, 83 | // bool? applyElevationOverlayColor, 84 | // PageTransitionsTheme? pageTransitionsTheme, 85 | appBarTheme: const AppBarTheme( 86 | brightness: Brightness.light, 87 | color: _kCanvasColor, 88 | elevation: 0, 89 | // this.shadowColor, 90 | iconTheme: IconThemeData( 91 | color: Colors.black, 92 | opacity: 1, 93 | size: 24, 94 | ), 95 | actionsIconTheme: IconThemeData( 96 | color: Colors.black, 97 | opacity: 1, 98 | size: 24, 99 | ), 100 | textTheme: TextTheme( 101 | headline6: TextStyle( 102 | color: Colors.black, 103 | fontSize: 15, 104 | ), 105 | ), 106 | titleTextStyle: TextStyle( 107 | color: Colors.black, 108 | fontSize: 15, 109 | ), 110 | // this.centerTitle, 111 | // this.titleSpacing, 112 | ), 113 | // BottomAppBarTheme? bottomAppBarTheme, 114 | // ColorScheme? colorScheme, 115 | // DialogTheme? dialogTheme, 116 | // FloatingActionButtonThemeData? floatingActionButtonTheme, 117 | // NavigationRailThemeData? navigationRailTheme, 118 | // Typography? typography, 119 | cupertinoOverrideTheme: CupertinoThemeData( 120 | primaryColor: _kPrimaryColor, 121 | barBackgroundColor: _kCanvasColor, 122 | ), 123 | // SnackBarThemeData? snackBarTheme, 124 | // BottomSheetThemeData? bottomSheetTheme, 125 | // PopupMenuThemeData? popupMenuTheme, 126 | // MaterialBannerThemeData? bannerTheme, 127 | // DividerThemeData? dividerTheme, 128 | // ButtonBarThemeData? buttonBarTheme, 129 | // BottomNavigationBarThemeData? bottomNavigationBarTheme, 130 | // TimePickerThemeData? timePickerTheme, 131 | // TextButtonThemeData? textButtonTheme, 132 | // ElevatedButtonThemeData? elevatedButtonTheme, 133 | // OutlinedButtonThemeData? outlinedButtonTheme, 134 | // TextSelectionThemeData? textSelectionTheme, 135 | // DataTableThemeData? dataTableTheme, 136 | // bool? fixTextFieldOutlineLabel, 137 | ); 138 | -------------------------------------------------------------------------------- /lib/themes/themes.dart: -------------------------------------------------------------------------------- 1 | export 'dark_theme.dart'; 2 | export 'light_theme.dart'; -------------------------------------------------------------------------------- /lib/utilities/env.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:uuid/uuid.dart'; 4 | import 'package:package_info_plus/package_info_plus.dart'; 5 | import 'package:path_provider/path_provider.dart'; 6 | 7 | const kAppBuildNumber = '1'; 8 | 9 | Future initEnv() async { 10 | PackageInfo packageInfo = await PackageInfo.fromPlatform(); 11 | 12 | Env.instance.appBuildNumber = int.parse(packageInfo.buildNumber.isEmpty 13 | ? kAppBuildNumber 14 | : packageInfo.buildNumber); 15 | Env.instance.appVersion = packageInfo.version; 16 | 17 | final docDir = await getApplicationDocumentsDirectory(); 18 | final homeDir = docDir.parent; 19 | 20 | Env.instance.dataDirectory = Directory('${homeDir.path}/.anyinspect'); 21 | if (!Env.instance.dataDirectory.existsSync()) { 22 | Env.instance.dataDirectory.createSync(recursive: true); 23 | } 24 | File guestKeyFile = 25 | File('${Env.instance.dataDirectory.path}/device_unique_id'); 26 | if (guestKeyFile.existsSync()) { 27 | Env.instance.deviceUniqueId = await guestKeyFile.readAsString(); 28 | } else { 29 | Env.instance.deviceUniqueId = const Uuid().v4(); 30 | guestKeyFile.writeAsStringSync(Env.instance.deviceUniqueId); 31 | } 32 | } 33 | 34 | class Env { 35 | Env._(); 36 | 37 | /// The shared instance of [Env]. 38 | static final Env instance = Env._(); 39 | 40 | late Directory dataDirectory; 41 | 42 | String deviceUniqueId = const Uuid().v4(); 43 | 44 | int appBuildNumber = 0; 45 | String appVersion = '0.0.0'; 46 | 47 | String webUrl = 'https://www.anyinspect.dev'; 48 | String apiUrl = 'https://anyinspect-api.leanflutter.com'; 49 | } 50 | -------------------------------------------------------------------------------- /lib/utilities/pretty_json.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | String prettyJsonString(dynamic json) { 4 | JsonEncoder encoder = const JsonEncoder.withIndent(' '); 5 | String jsonString = encoder.convert(json); 6 | return jsonString; 7 | } 8 | -------------------------------------------------------------------------------- /lib/utilities/remove_nulls.dart: -------------------------------------------------------------------------------- 1 | import 'dart:core'; 2 | 3 | Map removeNullsFromMap(Map json) => json 4 | ..removeWhere((String key, dynamic value) => value == null) 5 | ..map((key, value) => MapEntry(key, removeNulls(value))); 6 | 7 | List removeNullsFromList(List list) => list 8 | ..removeWhere((value) => value == null) 9 | ..map(removeNulls).toList(); 10 | 11 | dynamic removeNulls(dynamic e) => (e is List) 12 | ? removeNullsFromList(e) 13 | : (e is Map ? removeNullsFromMap(e as Map) : e); 14 | 15 | extension ListExtension on List { 16 | List removeNulls() => removeNullsFromList(this); 17 | } 18 | 19 | extension MapExtension on Map { 20 | Map removeNulls() => removeNullsFromMap(this as Map); 21 | } 22 | -------------------------------------------------------------------------------- /lib/utilities/utilities.dart: -------------------------------------------------------------------------------- 1 | export './env.dart'; 2 | export './pretty_json.dart'; 3 | export './remove_nulls.dart'; 4 | -------------------------------------------------------------------------------- /lib/widgets/menu/menu.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | export './menu_item.dart'; 4 | export './menu_section.dart'; 5 | 6 | class Menu extends StatelessWidget { 7 | final EdgeInsets padding; 8 | final List children; 9 | 10 | const Menu({ 11 | Key? key, 12 | this.padding = EdgeInsets.zero, 13 | this.children = const [], 14 | }) : super(key: key); 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | return ListView( 19 | padding: padding, 20 | children: children, 21 | ); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/widgets/menu/menu_item.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class MenuItem extends StatefulWidget { 5 | final Widget? icon; 6 | final Widget? title; 7 | final Widget? summary; 8 | final Widget? detailText; 9 | final Widget? accessoryView; 10 | final bool selected; 11 | final bool disabled; 12 | final VoidCallback? onTap; 13 | 14 | const MenuItem({ 15 | Key? key, 16 | this.icon, 17 | this.title, 18 | this.summary, 19 | this.detailText, 20 | this.accessoryView, 21 | this.selected = false, 22 | this.disabled = false, 23 | this.onTap, 24 | }) : super(key: key); 25 | 26 | @override 27 | _MenuItemState createState() => _MenuItemState(); 28 | } 29 | 30 | class _MenuItemState extends State { 31 | bool _isHovered = false; 32 | 33 | _onTap() { 34 | if (widget.onTap != null) { 35 | widget.onTap!(); 36 | } 37 | } 38 | 39 | Widget buildDetailText(BuildContext context) { 40 | if (widget.detailText != null) { 41 | return DefaultTextStyle( 42 | style: const TextStyle( 43 | color: Color(0xff999999), 44 | fontSize: 13, 45 | ), 46 | child: widget.detailText!, 47 | ); 48 | } 49 | 50 | return Container(); 51 | } 52 | 53 | Widget buildAccessoryView(BuildContext context) { 54 | if (widget.accessoryView != null) { 55 | return widget.accessoryView!; 56 | } 57 | return Container(); 58 | } 59 | 60 | @override 61 | Widget build(BuildContext context) { 62 | return Container( 63 | margin: const EdgeInsets.only( 64 | left: 10, 65 | right: 10, 66 | ), 67 | padding: const EdgeInsets.only( 68 | left: 6, 69 | right: 6, 70 | top: 4, 71 | bottom: 4, 72 | ), 73 | decoration: BoxDecoration( 74 | color: widget.selected ? Theme.of(context).primaryColor : null, 75 | borderRadius: BorderRadius.circular(4), 76 | ), 77 | child: Builder( 78 | builder: (_) { 79 | return MouseRegion( 80 | onEnter: (event) { 81 | _isHovered = true; 82 | setState(() {}); 83 | }, 84 | onExit: (event) { 85 | _isHovered = false; 86 | setState(() {}); 87 | }, 88 | child: GestureDetector( 89 | behavior: HitTestBehavior.opaque, 90 | onTap: widget.disabled ? null : _onTap, 91 | child: Container( 92 | width: double.infinity, 93 | child: Row( 94 | children: [ 95 | if (widget.icon != null) 96 | Container( 97 | child: widget.icon, 98 | margin: EdgeInsets.only(right: 8), 99 | ), 100 | if (widget.title != null || widget.summary != null) 101 | Expanded( 102 | child: Column( 103 | crossAxisAlignment: CrossAxisAlignment.start, 104 | mainAxisAlignment: MainAxisAlignment.center, 105 | children: [ 106 | if (widget.title != null) 107 | DefaultTextStyle( 108 | style: TextStyle( 109 | fontSize: 13, 110 | color: widget.selected 111 | ? Colors.white 112 | : Theme.of(context) 113 | .textTheme 114 | .bodyText2 115 | ?.color, 116 | ), 117 | child: widget.title!, 118 | ), 119 | if (widget.summary != null) 120 | DefaultTextStyle( 121 | style: TextStyle( 122 | color: widget.selected 123 | ? Colors.white.withOpacity(0.8) 124 | : const Color(0xff999999), 125 | fontSize: 11, 126 | ), 127 | child: widget.summary!, 128 | ), 129 | ], 130 | ), 131 | ), 132 | buildDetailText(context), 133 | if (_isHovered) buildAccessoryView(context), 134 | ], 135 | ), 136 | ), 137 | ), 138 | ); 139 | }, 140 | ), 141 | ); 142 | } 143 | } 144 | -------------------------------------------------------------------------------- /lib/widgets/menu/menu_section.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math' as math; 2 | 3 | import 'package:flutter/cupertino.dart'; 4 | import 'package:flutter/material.dart'; 5 | 6 | class MenuSection extends StatefulWidget { 7 | final Widget title; 8 | final Widget? trailing; 9 | final bool collapsible; 10 | final List children; 11 | 12 | const MenuSection({ 13 | Key? key, 14 | required this.title, 15 | this.trailing, 16 | this.collapsible = true, 17 | this.children = const [], 18 | }) : super(key: key); 19 | 20 | @override 21 | _MenuSectionState createState() => _MenuSectionState(); 22 | } 23 | 24 | class _MenuSectionState extends State { 25 | bool _isHovered = false; 26 | bool _isCollapsed = true; 27 | 28 | @override 29 | Widget build(BuildContext context) { 30 | return Column( 31 | crossAxisAlignment: CrossAxisAlignment.start, 32 | children: [ 33 | MouseRegion( 34 | onEnter: (event) { 35 | _isHovered = true; 36 | setState(() {}); 37 | }, 38 | onExit: (event) { 39 | _isHovered = false; 40 | setState(() {}); 41 | }, 42 | child: Container( 43 | width: double.infinity, 44 | constraints: const BoxConstraints(minHeight: 32), 45 | child: Row( 46 | children: [ 47 | Container( 48 | child: DefaultTextStyle( 49 | style: const TextStyle( 50 | color: Color(0xff9b9b9b), 51 | fontSize: 11, 52 | fontWeight: FontWeight.w500, 53 | ), 54 | child: widget.title, 55 | ), 56 | margin: const EdgeInsets.only(left: 16), 57 | ), 58 | Expanded(child: Container()), 59 | if (_isHovered) 60 | Row( 61 | children: [ 62 | if (widget.trailing != null) 63 | Container( 64 | child: widget.trailing, 65 | ), 66 | Container( 67 | width: 14, 68 | height: 14, 69 | margin: const EdgeInsets.only(left: 8, right: 12), 70 | child: CupertinoButton( 71 | padding: EdgeInsets.zero, 72 | pressedOpacity: 1, 73 | child: AnimatedContainer( 74 | duration: const Duration(milliseconds: 200), 75 | curve: Curves.fastOutSlowIn, 76 | transformAlignment: Alignment.center, 77 | transform: Matrix4.rotationZ( 78 | _isCollapsed ? math.pi / 2 : 0, 79 | ), 80 | child: const Icon( 81 | CupertinoIcons.chevron_right, 82 | size: 15, 83 | color: Colors.grey, 84 | ), 85 | ), 86 | onPressed: () { 87 | setState(() { 88 | _isCollapsed = !_isCollapsed; 89 | }); 90 | }, 91 | ), 92 | ), 93 | ], 94 | ), 95 | ], 96 | ), 97 | ), 98 | ), 99 | AnimatedCrossFade( 100 | duration: const Duration(milliseconds: 200), 101 | firstChild: Column( 102 | crossAxisAlignment: CrossAxisAlignment.start, 103 | children: widget.children, 104 | ), 105 | secondChild: Container(), 106 | crossFadeState: _isCollapsed 107 | ? CrossFadeState.showFirst 108 | : CrossFadeState.showSecond, 109 | ), 110 | ], 111 | ); 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /lib/widgets/sidebar/sidebar.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class Sidebar extends StatelessWidget { 4 | final List children; 5 | 6 | const Sidebar({ 7 | Key? key, 8 | this.children = const [], 9 | }) : super(key: key); 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | return Container( 14 | decoration: BoxDecoration( 15 | color: Theme.of(context).canvasColor, 16 | ), 17 | child: Column( 18 | children: children, 19 | ), 20 | ); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /lib/widgets/widgets.dart: -------------------------------------------------------------------------------- 1 | export './menu/menu.dart'; 2 | export './sidebar/sidebar.dart'; -------------------------------------------------------------------------------- /linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /linux/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.10) 2 | project(runner LANGUAGES CXX) 3 | 4 | set(BINARY_NAME "anyinspect_app") 5 | set(APPLICATION_ID "com.example.anyinspect_app") 6 | 7 | cmake_policy(SET CMP0063 NEW) 8 | 9 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") 10 | 11 | # Root filesystem for cross-building. 12 | if(FLUTTER_TARGET_PLATFORM_SYSROOT) 13 | set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) 14 | set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) 15 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 16 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) 17 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 18 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 19 | endif() 20 | 21 | # Configure build options. 22 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 23 | set(CMAKE_BUILD_TYPE "Debug" CACHE 24 | STRING "Flutter build mode" FORCE) 25 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 26 | "Debug" "Profile" "Release") 27 | endif() 28 | 29 | # Compilation settings that should be applied to most targets. 30 | function(APPLY_STANDARD_SETTINGS TARGET) 31 | target_compile_features(${TARGET} PUBLIC cxx_std_14) 32 | target_compile_options(${TARGET} PRIVATE -Wall -Werror) 33 | target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") 34 | target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") 35 | endfunction() 36 | 37 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 38 | 39 | # Flutter library and tool build rules. 40 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 41 | 42 | # System-level dependencies. 43 | find_package(PkgConfig REQUIRED) 44 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 45 | 46 | add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") 47 | 48 | # Application build 49 | add_executable(${BINARY_NAME} 50 | "main.cc" 51 | "my_application.cc" 52 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 53 | ) 54 | apply_standard_settings(${BINARY_NAME}) 55 | target_link_libraries(${BINARY_NAME} PRIVATE flutter) 56 | target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) 57 | add_dependencies(${BINARY_NAME} flutter_assemble) 58 | # Only the install-generated bundle's copy of the executable will launch 59 | # correctly, since the resources must in the right relative locations. To avoid 60 | # people trying to run the unbundled copy, put it in a subdirectory instead of 61 | # the default top-level location. 62 | set_target_properties(${BINARY_NAME} 63 | PROPERTIES 64 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" 65 | ) 66 | 67 | # Generated plugin build rules, which manage building the plugins and adding 68 | # them to the application. 69 | include(flutter/generated_plugins.cmake) 70 | 71 | 72 | # === Installation === 73 | # By default, "installing" just makes a relocatable bundle in the build 74 | # directory. 75 | set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") 76 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 77 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 78 | endif() 79 | 80 | # Start with a clean build bundle directory every time. 81 | install(CODE " 82 | file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") 83 | " COMPONENT Runtime) 84 | 85 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 86 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") 87 | 88 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 89 | COMPONENT Runtime) 90 | 91 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 92 | COMPONENT Runtime) 93 | 94 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 95 | COMPONENT Runtime) 96 | 97 | if(PLUGIN_BUNDLED_LIBRARIES) 98 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" 99 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 100 | COMPONENT Runtime) 101 | endif() 102 | 103 | # Fully re-copy the assets directory on each build to avoid having stale files 104 | # from a previous install. 105 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 106 | install(CODE " 107 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 108 | " COMPONENT Runtime) 109 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 110 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 111 | 112 | # Install the AOT library on non-Debug builds only. 113 | if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") 114 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 115 | COMPONENT Runtime) 116 | endif() 117 | -------------------------------------------------------------------------------- /linux/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.10) 2 | 3 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 4 | 5 | # Configuration provided via flutter tool. 6 | include(${EPHEMERAL_DIR}/generated_config.cmake) 7 | 8 | # TODO: Move the rest of this into files in ephemeral. See 9 | # https://github.com/flutter/flutter/issues/57146. 10 | 11 | # Serves the same purpose as list(TRANSFORM ... PREPEND ...), 12 | # which isn't available in 3.10. 13 | function(list_prepend LIST_NAME PREFIX) 14 | set(NEW_LIST "") 15 | foreach(element ${${LIST_NAME}}) 16 | list(APPEND NEW_LIST "${PREFIX}${element}") 17 | endforeach(element) 18 | set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) 19 | endfunction() 20 | 21 | # === Flutter Library === 22 | # System-level dependencies. 23 | find_package(PkgConfig REQUIRED) 24 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 25 | pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) 26 | pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) 27 | 28 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") 29 | 30 | # Published to parent scope for install step. 31 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 32 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 33 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 34 | set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) 35 | 36 | list(APPEND FLUTTER_LIBRARY_HEADERS 37 | "fl_basic_message_channel.h" 38 | "fl_binary_codec.h" 39 | "fl_binary_messenger.h" 40 | "fl_dart_project.h" 41 | "fl_engine.h" 42 | "fl_json_message_codec.h" 43 | "fl_json_method_codec.h" 44 | "fl_message_codec.h" 45 | "fl_method_call.h" 46 | "fl_method_channel.h" 47 | "fl_method_codec.h" 48 | "fl_method_response.h" 49 | "fl_plugin_registrar.h" 50 | "fl_plugin_registry.h" 51 | "fl_standard_message_codec.h" 52 | "fl_standard_method_codec.h" 53 | "fl_string_codec.h" 54 | "fl_value.h" 55 | "fl_view.h" 56 | "flutter_linux.h" 57 | ) 58 | list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") 59 | add_library(flutter INTERFACE) 60 | target_include_directories(flutter INTERFACE 61 | "${EPHEMERAL_DIR}" 62 | ) 63 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") 64 | target_link_libraries(flutter INTERFACE 65 | PkgConfig::GTK 66 | PkgConfig::GLIB 67 | PkgConfig::GIO 68 | ) 69 | add_dependencies(flutter flutter_assemble) 70 | 71 | # === Flutter tool backend === 72 | # _phony_ is a non-existent file to force this command to run every time, 73 | # since currently there's no way to get a full input/output list from the 74 | # flutter tool. 75 | add_custom_command( 76 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 77 | ${CMAKE_CURRENT_BINARY_DIR}/_phony_ 78 | COMMAND ${CMAKE_COMMAND} -E env 79 | ${FLUTTER_TOOL_ENVIRONMENT} 80 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" 81 | ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} 82 | VERBATIM 83 | ) 84 | add_custom_target(flutter_assemble DEPENDS 85 | "${FLUTTER_LIBRARY}" 86 | ${FLUTTER_LIBRARY_HEADERS} 87 | ) 88 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | 11 | void fl_register_plugins(FlPluginRegistry* registry) { 12 | g_autoptr(FlPluginRegistrar) window_manager_registrar = 13 | fl_plugin_registry_get_registrar_for_plugin(registry, "WindowManagerPlugin"); 14 | window_manager_plugin_register_with_registrar(window_manager_registrar); 15 | } 16 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void fl_register_plugins(FlPluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | window_manager 7 | ) 8 | 9 | set(PLUGIN_BUNDLED_LIBRARIES) 10 | 11 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 12 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) 13 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 14 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 15 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 16 | endforeach(plugin) 17 | -------------------------------------------------------------------------------- /linux/main.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | int main(int argc, char** argv) { 4 | g_autoptr(MyApplication) app = my_application_new(); 5 | return g_application_run(G_APPLICATION(app), argc, argv); 6 | } 7 | -------------------------------------------------------------------------------- /linux/my_application.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | #include 4 | #ifdef GDK_WINDOWING_X11 5 | #include 6 | #endif 7 | 8 | #include "flutter/generated_plugin_registrant.h" 9 | 10 | struct _MyApplication { 11 | GtkApplication parent_instance; 12 | char** dart_entrypoint_arguments; 13 | }; 14 | 15 | G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) 16 | 17 | // Implements GApplication::activate. 18 | static void my_application_activate(GApplication* application) { 19 | MyApplication* self = MY_APPLICATION(application); 20 | GtkWindow* window = 21 | GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); 22 | 23 | // Use a header bar when running in GNOME as this is the common style used 24 | // by applications and is the setup most users will be using (e.g. Ubuntu 25 | // desktop). 26 | // If running on X and not using GNOME then just use a traditional title bar 27 | // in case the window manager does more exotic layout, e.g. tiling. 28 | // If running on Wayland assume the header bar will work (may need changing 29 | // if future cases occur). 30 | gboolean use_header_bar = TRUE; 31 | #ifdef GDK_WINDOWING_X11 32 | GdkScreen* screen = gtk_window_get_screen(window); 33 | if (GDK_IS_X11_SCREEN(screen)) { 34 | const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); 35 | if (g_strcmp0(wm_name, "GNOME Shell") != 0) { 36 | use_header_bar = FALSE; 37 | } 38 | } 39 | #endif 40 | if (use_header_bar) { 41 | GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); 42 | gtk_widget_show(GTK_WIDGET(header_bar)); 43 | gtk_header_bar_set_title(header_bar, "anyinspect_app"); 44 | gtk_header_bar_set_show_close_button(header_bar, TRUE); 45 | gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); 46 | } else { 47 | gtk_window_set_title(window, "anyinspect_app"); 48 | } 49 | 50 | gtk_window_set_default_size(window, 1280, 720); 51 | gtk_widget_show(GTK_WIDGET(window)); 52 | 53 | g_autoptr(FlDartProject) project = fl_dart_project_new(); 54 | fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); 55 | 56 | FlView* view = fl_view_new(project); 57 | gtk_widget_show(GTK_WIDGET(view)); 58 | gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); 59 | 60 | fl_register_plugins(FL_PLUGIN_REGISTRY(view)); 61 | 62 | gtk_widget_grab_focus(GTK_WIDGET(view)); 63 | } 64 | 65 | // Implements GApplication::local_command_line. 66 | static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) { 67 | MyApplication* self = MY_APPLICATION(application); 68 | // Strip out the first argument as it is the binary name. 69 | self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); 70 | 71 | g_autoptr(GError) error = nullptr; 72 | if (!g_application_register(application, nullptr, &error)) { 73 | g_warning("Failed to register: %s", error->message); 74 | *exit_status = 1; 75 | return TRUE; 76 | } 77 | 78 | g_application_activate(application); 79 | *exit_status = 0; 80 | 81 | return TRUE; 82 | } 83 | 84 | // Implements GObject::dispose. 85 | static void my_application_dispose(GObject* object) { 86 | MyApplication* self = MY_APPLICATION(object); 87 | g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); 88 | G_OBJECT_CLASS(my_application_parent_class)->dispose(object); 89 | } 90 | 91 | static void my_application_class_init(MyApplicationClass* klass) { 92 | G_APPLICATION_CLASS(klass)->activate = my_application_activate; 93 | G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; 94 | G_OBJECT_CLASS(klass)->dispose = my_application_dispose; 95 | } 96 | 97 | static void my_application_init(MyApplication* self) {} 98 | 99 | MyApplication* my_application_new() { 100 | return MY_APPLICATION(g_object_new(my_application_get_type(), 101 | "application-id", APPLICATION_ID, 102 | "flags", G_APPLICATION_NON_UNIQUE, 103 | nullptr)); 104 | } 105 | -------------------------------------------------------------------------------- /linux/my_application.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_MY_APPLICATION_H_ 2 | #define FLUTTER_MY_APPLICATION_H_ 3 | 4 | #include 5 | 6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, 7 | GtkApplication) 8 | 9 | /** 10 | * my_application_new: 11 | * 12 | * Creates a new Flutter-based application. 13 | * 14 | * Returns: a new #MyApplication. 15 | */ 16 | MyApplication* my_application_new(); 17 | 18 | #endif // FLUTTER_MY_APPLICATION_H_ 19 | -------------------------------------------------------------------------------- /macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | import device_info_plus_macos 9 | import network_info_plus_macos 10 | import package_info_plus_macos 11 | import path_provider_macos 12 | import url_launcher_macos 13 | import window_manager 14 | 15 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 16 | DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) 17 | NetworkInfoPlusPlugin.register(with: registry.registrar(forPlugin: "NetworkInfoPlusPlugin")) 18 | FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin")) 19 | PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) 20 | UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) 21 | WindowManagerPlugin.register(with: registry.registrar(forPlugin: "WindowManagerPlugin")) 22 | } 23 | -------------------------------------------------------------------------------- /macos/Podfile: -------------------------------------------------------------------------------- 1 | platform :osx, '10.11' 2 | 3 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 4 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 5 | 6 | project 'Runner', { 7 | 'Debug' => :debug, 8 | 'Profile' => :release, 9 | 'Release' => :release, 10 | } 11 | 12 | def flutter_root 13 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) 14 | unless File.exist?(generated_xcode_build_settings_path) 15 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" 16 | end 17 | 18 | File.foreach(generated_xcode_build_settings_path) do |line| 19 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 20 | return matches[1].strip if matches 21 | end 22 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" 23 | end 24 | 25 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 26 | 27 | flutter_macos_podfile_setup 28 | 29 | target 'Runner' do 30 | use_frameworks! 31 | use_modular_headers! 32 | 33 | flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) 34 | end 35 | 36 | post_install do |installer| 37 | installer.pods_project.targets.each do |target| 38 | flutter_additional_macos_build_settings(target) 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /macos/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - device_info_plus_macos (0.0.1): 3 | - FlutterMacOS 4 | - FlutterMacOS (1.0.0) 5 | - network_info_plus_macos (0.0.1): 6 | - FlutterMacOS 7 | - package_info_plus_macos (0.0.1): 8 | - FlutterMacOS 9 | - path_provider_macos (0.0.1): 10 | - FlutterMacOS 11 | - url_launcher_macos (0.0.1): 12 | - FlutterMacOS 13 | - window_manager (0.0.1): 14 | - FlutterMacOS 15 | 16 | DEPENDENCIES: 17 | - device_info_plus_macos (from `Flutter/ephemeral/.symlinks/plugins/device_info_plus_macos/macos`) 18 | - FlutterMacOS (from `Flutter/ephemeral`) 19 | - network_info_plus_macos (from `Flutter/ephemeral/.symlinks/plugins/network_info_plus_macos/macos`) 20 | - package_info_plus_macos (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus_macos/macos`) 21 | - path_provider_macos (from `Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos`) 22 | - url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`) 23 | - window_manager (from `Flutter/ephemeral/.symlinks/plugins/window_manager/macos`) 24 | 25 | EXTERNAL SOURCES: 26 | device_info_plus_macos: 27 | :path: Flutter/ephemeral/.symlinks/plugins/device_info_plus_macos/macos 28 | FlutterMacOS: 29 | :path: Flutter/ephemeral 30 | network_info_plus_macos: 31 | :path: Flutter/ephemeral/.symlinks/plugins/network_info_plus_macos/macos 32 | package_info_plus_macos: 33 | :path: Flutter/ephemeral/.symlinks/plugins/package_info_plus_macos/macos 34 | path_provider_macos: 35 | :path: Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos 36 | url_launcher_macos: 37 | :path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos 38 | window_manager: 39 | :path: Flutter/ephemeral/.symlinks/plugins/window_manager/macos 40 | 41 | SPEC CHECKSUMS: 42 | device_info_plus_macos: 1ad388a1ef433505c4038e7dd9605aadd1e2e9c7 43 | FlutterMacOS: 57701585bf7de1b3fc2bb61f6378d73bbdea8424 44 | network_info_plus_macos: d2b9e6c01c291449b91a584217aa53b113847dbd 45 | package_info_plus_macos: f010621b07802a241d96d01876d6705f15e77c1c 46 | path_provider_macos: 160cab0d5461f0c0e02995469a98f24bdb9a3f1f 47 | url_launcher_macos: 45af3d61de06997666568a7149c1be98b41c95d4 48 | window_manager: f5fa14814635f059571527ddd5e676f688af552c 49 | 50 | PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c 51 | 52 | COCOAPODS: 1.11.2 53 | -------------------------------------------------------------------------------- /macos/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 51; 7 | objects = { 8 | 9 | /* Begin PBXAggregateTarget section */ 10 | 33CC111A2044C6BA0003C045 /* Flutter Assemble */ = { 11 | isa = PBXAggregateTarget; 12 | buildConfigurationList = 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */; 13 | buildPhases = ( 14 | 33CC111E2044C6BF0003C045 /* ShellScript */, 15 | ); 16 | dependencies = ( 17 | ); 18 | name = "Flutter Assemble"; 19 | productName = FLX; 20 | }; 21 | /* End PBXAggregateTarget section */ 22 | 23 | /* Begin PBXBuildFile section */ 24 | 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; }; 25 | 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC10F02044A3C60003C045 /* AppDelegate.swift */; }; 26 | 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; 27 | 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; 28 | 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; 29 | 9ABE3D5DF0CE6406E607A100 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DB70110B6C985B89B388FC30 /* Pods_Runner.framework */; }; 30 | F520CCB12729AFDC001AB500 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = F520CCAF2729AFDC001AB500 /* InfoPlist.strings */; }; 31 | /* End PBXBuildFile section */ 32 | 33 | /* Begin PBXContainerItemProxy section */ 34 | 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */ = { 35 | isa = PBXContainerItemProxy; 36 | containerPortal = 33CC10E52044A3C60003C045 /* Project object */; 37 | proxyType = 1; 38 | remoteGlobalIDString = 33CC111A2044C6BA0003C045; 39 | remoteInfo = FLX; 40 | }; 41 | /* End PBXContainerItemProxy section */ 42 | 43 | /* Begin PBXCopyFilesBuildPhase section */ 44 | 33CC110E2044A8840003C045 /* Bundle Framework */ = { 45 | isa = PBXCopyFilesBuildPhase; 46 | buildActionMask = 2147483647; 47 | dstPath = ""; 48 | dstSubfolderSpec = 10; 49 | files = ( 50 | ); 51 | name = "Bundle Framework"; 52 | runOnlyForDeploymentPostprocessing = 0; 53 | }; 54 | /* End PBXCopyFilesBuildPhase section */ 55 | 56 | /* Begin PBXFileReference section */ 57 | 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; 58 | 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; 59 | 33CC10ED2044A3C60003C045 /* anyinspect_app.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = anyinspect_app.app; sourceTree = BUILT_PRODUCTS_DIR; }; 60 | 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 61 | 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = ""; }; 62 | 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; 63 | 33CC10F72044A3C60003C045 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = Runner/Info.plist; sourceTree = ""; }; 64 | 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainFlutterWindow.swift; sourceTree = ""; }; 65 | 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = ""; }; 66 | 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = ""; }; 67 | 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = ""; }; 68 | 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; 69 | 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; 70 | 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; 71 | 5047CCF38F764F63809F77D3 /* 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 = ""; }; 72 | 51AFB4AC912A148E6169A7D7 /* 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 = ""; }; 73 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; 74 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; 75 | B57892E2891FC0D2DFFEF202 /* 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 = ""; }; 76 | DB70110B6C985B89B388FC30 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 77 | F520CCB02729AFDC001AB500 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = InfoPlist.strings; sourceTree = ""; }; 78 | /* End PBXFileReference section */ 79 | 80 | /* Begin PBXFrameworksBuildPhase section */ 81 | 33CC10EA2044A3C60003C045 /* Frameworks */ = { 82 | isa = PBXFrameworksBuildPhase; 83 | buildActionMask = 2147483647; 84 | files = ( 85 | 9ABE3D5DF0CE6406E607A100 /* Pods_Runner.framework in Frameworks */, 86 | ); 87 | runOnlyForDeploymentPostprocessing = 0; 88 | }; 89 | /* End PBXFrameworksBuildPhase section */ 90 | 91 | /* Begin PBXGroup section */ 92 | 33BA886A226E78AF003329D5 /* Configs */ = { 93 | isa = PBXGroup; 94 | children = ( 95 | 33E5194F232828860026EE4D /* AppInfo.xcconfig */, 96 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 97 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 98 | 333000ED22D3DE5D00554162 /* Warnings.xcconfig */, 99 | ); 100 | path = Configs; 101 | sourceTree = ""; 102 | }; 103 | 33CC10E42044A3C60003C045 = { 104 | isa = PBXGroup; 105 | children = ( 106 | 33FAB671232836740065AC1E /* Runner */, 107 | 33CEB47122A05771004F2AC0 /* Flutter */, 108 | 33CC10EE2044A3C60003C045 /* Products */, 109 | D73912EC22F37F3D000D13A0 /* Frameworks */, 110 | CA53E6941FA61B3BCAE2E2EA /* Pods */, 111 | ); 112 | sourceTree = ""; 113 | }; 114 | 33CC10EE2044A3C60003C045 /* Products */ = { 115 | isa = PBXGroup; 116 | children = ( 117 | 33CC10ED2044A3C60003C045 /* anyinspect_app.app */, 118 | ); 119 | name = Products; 120 | sourceTree = ""; 121 | }; 122 | 33CC11242044D66E0003C045 /* Resources */ = { 123 | isa = PBXGroup; 124 | children = ( 125 | 33CC10F22044A3C60003C045 /* Assets.xcassets */, 126 | 33CC10F42044A3C60003C045 /* MainMenu.xib */, 127 | 33CC10F72044A3C60003C045 /* Info.plist */, 128 | ); 129 | name = Resources; 130 | path = ..; 131 | sourceTree = ""; 132 | }; 133 | 33CEB47122A05771004F2AC0 /* Flutter */ = { 134 | isa = PBXGroup; 135 | children = ( 136 | 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */, 137 | 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */, 138 | 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */, 139 | 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */, 140 | ); 141 | path = Flutter; 142 | sourceTree = ""; 143 | }; 144 | 33FAB671232836740065AC1E /* Runner */ = { 145 | isa = PBXGroup; 146 | children = ( 147 | F520CCAE2729AFDC001AB500 /* en.lproj */, 148 | 33CC10F02044A3C60003C045 /* AppDelegate.swift */, 149 | 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */, 150 | 33E51913231747F40026EE4D /* DebugProfile.entitlements */, 151 | 33E51914231749380026EE4D /* Release.entitlements */, 152 | 33CC11242044D66E0003C045 /* Resources */, 153 | 33BA886A226E78AF003329D5 /* Configs */, 154 | ); 155 | path = Runner; 156 | sourceTree = ""; 157 | }; 158 | CA53E6941FA61B3BCAE2E2EA /* Pods */ = { 159 | isa = PBXGroup; 160 | children = ( 161 | 51AFB4AC912A148E6169A7D7 /* Pods-Runner.debug.xcconfig */, 162 | B57892E2891FC0D2DFFEF202 /* Pods-Runner.release.xcconfig */, 163 | 5047CCF38F764F63809F77D3 /* Pods-Runner.profile.xcconfig */, 164 | ); 165 | path = Pods; 166 | sourceTree = ""; 167 | }; 168 | D73912EC22F37F3D000D13A0 /* Frameworks */ = { 169 | isa = PBXGroup; 170 | children = ( 171 | DB70110B6C985B89B388FC30 /* Pods_Runner.framework */, 172 | ); 173 | name = Frameworks; 174 | sourceTree = ""; 175 | }; 176 | F520CCAE2729AFDC001AB500 /* en.lproj */ = { 177 | isa = PBXGroup; 178 | children = ( 179 | F520CCAF2729AFDC001AB500 /* InfoPlist.strings */, 180 | ); 181 | path = en.lproj; 182 | sourceTree = ""; 183 | }; 184 | /* End PBXGroup section */ 185 | 186 | /* Begin PBXNativeTarget section */ 187 | 33CC10EC2044A3C60003C045 /* Runner */ = { 188 | isa = PBXNativeTarget; 189 | buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; 190 | buildPhases = ( 191 | E4919D2ECF5CE69FFAEC2CF9 /* [CP] Check Pods Manifest.lock */, 192 | 33CC10E92044A3C60003C045 /* Sources */, 193 | 33CC10EA2044A3C60003C045 /* Frameworks */, 194 | 33CC10EB2044A3C60003C045 /* Resources */, 195 | 33CC110E2044A8840003C045 /* Bundle Framework */, 196 | 3399D490228B24CF009A79C7 /* ShellScript */, 197 | 0054FAFB57ACAE86D944D741 /* [CP] Embed Pods Frameworks */, 198 | ); 199 | buildRules = ( 200 | ); 201 | dependencies = ( 202 | 33CC11202044C79F0003C045 /* PBXTargetDependency */, 203 | ); 204 | name = Runner; 205 | productName = Runner; 206 | productReference = 33CC10ED2044A3C60003C045 /* anyinspect_app.app */; 207 | productType = "com.apple.product-type.application"; 208 | }; 209 | /* End PBXNativeTarget section */ 210 | 211 | /* Begin PBXProject section */ 212 | 33CC10E52044A3C60003C045 /* Project object */ = { 213 | isa = PBXProject; 214 | attributes = { 215 | LastSwiftUpdateCheck = 0920; 216 | LastUpgradeCheck = 0930; 217 | ORGANIZATIONNAME = ""; 218 | TargetAttributes = { 219 | 33CC10EC2044A3C60003C045 = { 220 | CreatedOnToolsVersion = 9.2; 221 | LastSwiftMigration = 1100; 222 | ProvisioningStyle = Automatic; 223 | SystemCapabilities = { 224 | com.apple.Sandbox = { 225 | enabled = 1; 226 | }; 227 | }; 228 | }; 229 | 33CC111A2044C6BA0003C045 = { 230 | CreatedOnToolsVersion = 9.2; 231 | ProvisioningStyle = Manual; 232 | }; 233 | }; 234 | }; 235 | buildConfigurationList = 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */; 236 | compatibilityVersion = "Xcode 9.3"; 237 | developmentRegion = en; 238 | hasScannedForEncodings = 0; 239 | knownRegions = ( 240 | en, 241 | Base, 242 | ); 243 | mainGroup = 33CC10E42044A3C60003C045; 244 | productRefGroup = 33CC10EE2044A3C60003C045 /* Products */; 245 | projectDirPath = ""; 246 | projectRoot = ""; 247 | targets = ( 248 | 33CC10EC2044A3C60003C045 /* Runner */, 249 | 33CC111A2044C6BA0003C045 /* Flutter Assemble */, 250 | ); 251 | }; 252 | /* End PBXProject section */ 253 | 254 | /* Begin PBXResourcesBuildPhase section */ 255 | 33CC10EB2044A3C60003C045 /* Resources */ = { 256 | isa = PBXResourcesBuildPhase; 257 | buildActionMask = 2147483647; 258 | files = ( 259 | 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */, 260 | F520CCB12729AFDC001AB500 /* InfoPlist.strings in Resources */, 261 | 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */, 262 | ); 263 | runOnlyForDeploymentPostprocessing = 0; 264 | }; 265 | /* End PBXResourcesBuildPhase section */ 266 | 267 | /* Begin PBXShellScriptBuildPhase section */ 268 | 0054FAFB57ACAE86D944D741 /* [CP] Embed Pods Frameworks */ = { 269 | isa = PBXShellScriptBuildPhase; 270 | buildActionMask = 2147483647; 271 | files = ( 272 | ); 273 | inputFileListPaths = ( 274 | "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", 275 | ); 276 | name = "[CP] Embed Pods Frameworks"; 277 | outputFileListPaths = ( 278 | "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", 279 | ); 280 | runOnlyForDeploymentPostprocessing = 0; 281 | shellPath = /bin/sh; 282 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; 283 | showEnvVarsInLog = 0; 284 | }; 285 | 3399D490228B24CF009A79C7 /* ShellScript */ = { 286 | isa = PBXShellScriptBuildPhase; 287 | buildActionMask = 2147483647; 288 | files = ( 289 | ); 290 | inputFileListPaths = ( 291 | ); 292 | inputPaths = ( 293 | ); 294 | outputFileListPaths = ( 295 | ); 296 | outputPaths = ( 297 | ); 298 | runOnlyForDeploymentPostprocessing = 0; 299 | shellPath = /bin/sh; 300 | shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n"; 301 | }; 302 | 33CC111E2044C6BF0003C045 /* ShellScript */ = { 303 | isa = PBXShellScriptBuildPhase; 304 | buildActionMask = 2147483647; 305 | files = ( 306 | ); 307 | inputFileListPaths = ( 308 | Flutter/ephemeral/FlutterInputs.xcfilelist, 309 | ); 310 | inputPaths = ( 311 | Flutter/ephemeral/tripwire, 312 | ); 313 | outputFileListPaths = ( 314 | Flutter/ephemeral/FlutterOutputs.xcfilelist, 315 | ); 316 | outputPaths = ( 317 | ); 318 | runOnlyForDeploymentPostprocessing = 0; 319 | shellPath = /bin/sh; 320 | shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; 321 | }; 322 | E4919D2ECF5CE69FFAEC2CF9 /* [CP] Check Pods Manifest.lock */ = { 323 | isa = PBXShellScriptBuildPhase; 324 | buildActionMask = 2147483647; 325 | files = ( 326 | ); 327 | inputFileListPaths = ( 328 | ); 329 | inputPaths = ( 330 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 331 | "${PODS_ROOT}/Manifest.lock", 332 | ); 333 | name = "[CP] Check Pods Manifest.lock"; 334 | outputFileListPaths = ( 335 | ); 336 | outputPaths = ( 337 | "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", 338 | ); 339 | runOnlyForDeploymentPostprocessing = 0; 340 | shellPath = /bin/sh; 341 | 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"; 342 | showEnvVarsInLog = 0; 343 | }; 344 | /* End PBXShellScriptBuildPhase section */ 345 | 346 | /* Begin PBXSourcesBuildPhase section */ 347 | 33CC10E92044A3C60003C045 /* Sources */ = { 348 | isa = PBXSourcesBuildPhase; 349 | buildActionMask = 2147483647; 350 | files = ( 351 | 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */, 352 | 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */, 353 | 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */, 354 | ); 355 | runOnlyForDeploymentPostprocessing = 0; 356 | }; 357 | /* End PBXSourcesBuildPhase section */ 358 | 359 | /* Begin PBXTargetDependency section */ 360 | 33CC11202044C79F0003C045 /* PBXTargetDependency */ = { 361 | isa = PBXTargetDependency; 362 | target = 33CC111A2044C6BA0003C045 /* Flutter Assemble */; 363 | targetProxy = 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */; 364 | }; 365 | /* End PBXTargetDependency section */ 366 | 367 | /* Begin PBXVariantGroup section */ 368 | 33CC10F42044A3C60003C045 /* MainMenu.xib */ = { 369 | isa = PBXVariantGroup; 370 | children = ( 371 | 33CC10F52044A3C60003C045 /* Base */, 372 | ); 373 | name = MainMenu.xib; 374 | path = Runner; 375 | sourceTree = ""; 376 | }; 377 | F520CCAF2729AFDC001AB500 /* InfoPlist.strings */ = { 378 | isa = PBXVariantGroup; 379 | children = ( 380 | F520CCB02729AFDC001AB500 /* en */, 381 | ); 382 | name = InfoPlist.strings; 383 | sourceTree = ""; 384 | }; 385 | /* End PBXVariantGroup section */ 386 | 387 | /* Begin XCBuildConfiguration section */ 388 | 338D0CE9231458BD00FA5F75 /* Profile */ = { 389 | isa = XCBuildConfiguration; 390 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 391 | buildSettings = { 392 | ALWAYS_SEARCH_USER_PATHS = NO; 393 | CLANG_ANALYZER_NONNULL = YES; 394 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 395 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 396 | CLANG_CXX_LIBRARY = "libc++"; 397 | CLANG_ENABLE_MODULES = YES; 398 | CLANG_ENABLE_OBJC_ARC = YES; 399 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 400 | CLANG_WARN_BOOL_CONVERSION = YES; 401 | CLANG_WARN_CONSTANT_CONVERSION = YES; 402 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 403 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 404 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 405 | CLANG_WARN_EMPTY_BODY = YES; 406 | CLANG_WARN_ENUM_CONVERSION = YES; 407 | CLANG_WARN_INFINITE_RECURSION = YES; 408 | CLANG_WARN_INT_CONVERSION = YES; 409 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 410 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 411 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 412 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 413 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 414 | CODE_SIGN_IDENTITY = "-"; 415 | COPY_PHASE_STRIP = NO; 416 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 417 | ENABLE_NS_ASSERTIONS = NO; 418 | ENABLE_STRICT_OBJC_MSGSEND = YES; 419 | GCC_C_LANGUAGE_STANDARD = gnu11; 420 | GCC_NO_COMMON_BLOCKS = YES; 421 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 422 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 423 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 424 | GCC_WARN_UNUSED_FUNCTION = YES; 425 | GCC_WARN_UNUSED_VARIABLE = YES; 426 | MACOSX_DEPLOYMENT_TARGET = 10.11; 427 | MTL_ENABLE_DEBUG_INFO = NO; 428 | SDKROOT = macosx; 429 | SWIFT_COMPILATION_MODE = wholemodule; 430 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 431 | }; 432 | name = Profile; 433 | }; 434 | 338D0CEA231458BD00FA5F75 /* Profile */ = { 435 | isa = XCBuildConfiguration; 436 | baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; 437 | buildSettings = { 438 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 439 | CLANG_ENABLE_MODULES = YES; 440 | CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; 441 | CODE_SIGN_IDENTITY = "-"; 442 | CODE_SIGN_STYLE = Automatic; 443 | COMBINE_HIDPI_IMAGES = YES; 444 | DEVELOPMENT_TEAM = G83H824X6L; 445 | INFOPLIST_FILE = Runner/Info.plist; 446 | LD_RUNPATH_SEARCH_PATHS = ( 447 | "$(inherited)", 448 | "@executable_path/../Frameworks", 449 | ); 450 | PROVISIONING_PROFILE_SPECIFIER = ""; 451 | SWIFT_VERSION = 5.0; 452 | }; 453 | name = Profile; 454 | }; 455 | 338D0CEB231458BD00FA5F75 /* Profile */ = { 456 | isa = XCBuildConfiguration; 457 | buildSettings = { 458 | CODE_SIGN_STYLE = Manual; 459 | PRODUCT_NAME = "$(TARGET_NAME)"; 460 | }; 461 | name = Profile; 462 | }; 463 | 33CC10F92044A3C60003C045 /* Debug */ = { 464 | isa = XCBuildConfiguration; 465 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 466 | buildSettings = { 467 | ALWAYS_SEARCH_USER_PATHS = NO; 468 | CLANG_ANALYZER_NONNULL = YES; 469 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 470 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 471 | CLANG_CXX_LIBRARY = "libc++"; 472 | CLANG_ENABLE_MODULES = YES; 473 | CLANG_ENABLE_OBJC_ARC = YES; 474 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 475 | CLANG_WARN_BOOL_CONVERSION = YES; 476 | CLANG_WARN_CONSTANT_CONVERSION = YES; 477 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 478 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 479 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 480 | CLANG_WARN_EMPTY_BODY = YES; 481 | CLANG_WARN_ENUM_CONVERSION = YES; 482 | CLANG_WARN_INFINITE_RECURSION = YES; 483 | CLANG_WARN_INT_CONVERSION = YES; 484 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 485 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 486 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 487 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 488 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 489 | CODE_SIGN_IDENTITY = "-"; 490 | COPY_PHASE_STRIP = NO; 491 | DEBUG_INFORMATION_FORMAT = dwarf; 492 | ENABLE_STRICT_OBJC_MSGSEND = YES; 493 | ENABLE_TESTABILITY = YES; 494 | GCC_C_LANGUAGE_STANDARD = gnu11; 495 | GCC_DYNAMIC_NO_PIC = NO; 496 | GCC_NO_COMMON_BLOCKS = YES; 497 | GCC_OPTIMIZATION_LEVEL = 0; 498 | GCC_PREPROCESSOR_DEFINITIONS = ( 499 | "DEBUG=1", 500 | "$(inherited)", 501 | ); 502 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 503 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 504 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 505 | GCC_WARN_UNUSED_FUNCTION = YES; 506 | GCC_WARN_UNUSED_VARIABLE = YES; 507 | MACOSX_DEPLOYMENT_TARGET = 10.11; 508 | MTL_ENABLE_DEBUG_INFO = YES; 509 | ONLY_ACTIVE_ARCH = YES; 510 | SDKROOT = macosx; 511 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 512 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 513 | }; 514 | name = Debug; 515 | }; 516 | 33CC10FA2044A3C60003C045 /* Release */ = { 517 | isa = XCBuildConfiguration; 518 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 519 | buildSettings = { 520 | ALWAYS_SEARCH_USER_PATHS = NO; 521 | CLANG_ANALYZER_NONNULL = YES; 522 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 523 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 524 | CLANG_CXX_LIBRARY = "libc++"; 525 | CLANG_ENABLE_MODULES = YES; 526 | CLANG_ENABLE_OBJC_ARC = YES; 527 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 528 | CLANG_WARN_BOOL_CONVERSION = YES; 529 | CLANG_WARN_CONSTANT_CONVERSION = YES; 530 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 531 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 532 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 533 | CLANG_WARN_EMPTY_BODY = YES; 534 | CLANG_WARN_ENUM_CONVERSION = YES; 535 | CLANG_WARN_INFINITE_RECURSION = YES; 536 | CLANG_WARN_INT_CONVERSION = YES; 537 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 538 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 539 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 540 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 541 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 542 | CODE_SIGN_IDENTITY = "-"; 543 | COPY_PHASE_STRIP = NO; 544 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 545 | ENABLE_NS_ASSERTIONS = NO; 546 | ENABLE_STRICT_OBJC_MSGSEND = YES; 547 | GCC_C_LANGUAGE_STANDARD = gnu11; 548 | GCC_NO_COMMON_BLOCKS = YES; 549 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 550 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 551 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 552 | GCC_WARN_UNUSED_FUNCTION = YES; 553 | GCC_WARN_UNUSED_VARIABLE = YES; 554 | MACOSX_DEPLOYMENT_TARGET = 10.11; 555 | MTL_ENABLE_DEBUG_INFO = NO; 556 | SDKROOT = macosx; 557 | SWIFT_COMPILATION_MODE = wholemodule; 558 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 559 | }; 560 | name = Release; 561 | }; 562 | 33CC10FC2044A3C60003C045 /* Debug */ = { 563 | isa = XCBuildConfiguration; 564 | baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; 565 | buildSettings = { 566 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 567 | CLANG_ENABLE_MODULES = YES; 568 | CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; 569 | CODE_SIGN_IDENTITY = "-"; 570 | CODE_SIGN_STYLE = Automatic; 571 | COMBINE_HIDPI_IMAGES = YES; 572 | DEVELOPMENT_TEAM = G83H824X6L; 573 | INFOPLIST_FILE = Runner/Info.plist; 574 | LD_RUNPATH_SEARCH_PATHS = ( 575 | "$(inherited)", 576 | "@executable_path/../Frameworks", 577 | ); 578 | PROVISIONING_PROFILE_SPECIFIER = ""; 579 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 580 | SWIFT_VERSION = 5.0; 581 | }; 582 | name = Debug; 583 | }; 584 | 33CC10FD2044A3C60003C045 /* Release */ = { 585 | isa = XCBuildConfiguration; 586 | baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; 587 | buildSettings = { 588 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 589 | CLANG_ENABLE_MODULES = YES; 590 | CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements; 591 | CODE_SIGN_IDENTITY = "-"; 592 | CODE_SIGN_STYLE = Automatic; 593 | COMBINE_HIDPI_IMAGES = YES; 594 | DEVELOPMENT_TEAM = G83H824X6L; 595 | INFOPLIST_FILE = Runner/Info.plist; 596 | LD_RUNPATH_SEARCH_PATHS = ( 597 | "$(inherited)", 598 | "@executable_path/../Frameworks", 599 | ); 600 | PROVISIONING_PROFILE_SPECIFIER = ""; 601 | SWIFT_VERSION = 5.0; 602 | }; 603 | name = Release; 604 | }; 605 | 33CC111C2044C6BA0003C045 /* Debug */ = { 606 | isa = XCBuildConfiguration; 607 | buildSettings = { 608 | CODE_SIGN_STYLE = Manual; 609 | PRODUCT_NAME = "$(TARGET_NAME)"; 610 | }; 611 | name = Debug; 612 | }; 613 | 33CC111D2044C6BA0003C045 /* Release */ = { 614 | isa = XCBuildConfiguration; 615 | buildSettings = { 616 | CODE_SIGN_STYLE = Automatic; 617 | PRODUCT_NAME = "$(TARGET_NAME)"; 618 | }; 619 | name = Release; 620 | }; 621 | /* End XCBuildConfiguration section */ 622 | 623 | /* Begin XCConfigurationList section */ 624 | 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */ = { 625 | isa = XCConfigurationList; 626 | buildConfigurations = ( 627 | 33CC10F92044A3C60003C045 /* Debug */, 628 | 33CC10FA2044A3C60003C045 /* Release */, 629 | 338D0CE9231458BD00FA5F75 /* Profile */, 630 | ); 631 | defaultConfigurationIsVisible = 0; 632 | defaultConfigurationName = Release; 633 | }; 634 | 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */ = { 635 | isa = XCConfigurationList; 636 | buildConfigurations = ( 637 | 33CC10FC2044A3C60003C045 /* Debug */, 638 | 33CC10FD2044A3C60003C045 /* Release */, 639 | 338D0CEA231458BD00FA5F75 /* Profile */, 640 | ); 641 | defaultConfigurationIsVisible = 0; 642 | defaultConfigurationName = Release; 643 | }; 644 | 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */ = { 645 | isa = XCConfigurationList; 646 | buildConfigurations = ( 647 | 33CC111C2044C6BA0003C045 /* Debug */, 648 | 33CC111D2044C6BA0003C045 /* Release */, 649 | 338D0CEB231458BD00FA5F75 /* Profile */, 650 | ); 651 | defaultConfigurationIsVisible = 0; 652 | defaultConfigurationName = Release; 653 | }; 654 | /* End XCConfigurationList section */ 655 | }; 656 | rootObject = 33CC10E52044A3C60003C045 /* Project object */; 657 | } 658 | -------------------------------------------------------------------------------- /macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @NSApplicationMain 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "app_icon_16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "app_icon_32.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "app_icon_32.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "app_icon_64.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "app_icon_128.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "app_icon_256.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "app_icon_256.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "app_icon_512.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "app_icon_512.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "app_icon_1024.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijy91-archives-repos/anyinspect_app/0f4db9b5e33329987729c15750e9757ec381ae6a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijy91-archives-repos/anyinspect_app/0f4db9b5e33329987729c15750e9757ec381ae6a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijy91-archives-repos/anyinspect_app/0f4db9b5e33329987729c15750e9757ec381ae6a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijy91-archives-repos/anyinspect_app/0f4db9b5e33329987729c15750e9757ec381ae6a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijy91-archives-repos/anyinspect_app/0f4db9b5e33329987729c15750e9757ec381ae6a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijy91-archives-repos/anyinspect_app/0f4db9b5e33329987729c15750e9757ec381ae6a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijy91-archives-repos/anyinspect_app/0f4db9b5e33329987729c15750e9757ec381ae6a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /macos/Runner/Base.lproj/MainMenu.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | -------------------------------------------------------------------------------- /macos/Runner/Configs/AppInfo.xcconfig: -------------------------------------------------------------------------------- 1 | // Application-level settings for the Runner target. 2 | // 3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the 4 | // future. If not, the values below would default to using the project name when this becomes a 5 | // 'flutter create' template. 6 | 7 | // The application's name. By default this is also the title of the Flutter window. 8 | PRODUCT_NAME = anyinspect_app 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = dev.anyinspect.app 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2021 AnyInspect. All rights reserved. 15 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.network.client 10 | 11 | com.apple.security.network.server 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /macos/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSApplicationCategoryType 24 | public.app-category.developer-tools 25 | LSHasLocalizedDisplayName 26 | 27 | LSMinimumSystemVersion 28 | $(MACOSX_DEPLOYMENT_TARGET) 29 | NSHumanReadableCopyright 30 | $(PRODUCT_COPYRIGHT) 31 | NSMainNibFile 32 | MainMenu 33 | NSPrincipalClass 34 | NSApplication 35 | 36 | 37 | -------------------------------------------------------------------------------- /macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | import window_manager 4 | 5 | class MainFlutterWindow: NSWindow { 6 | override func awakeFromNib() { 7 | let flutterViewController = FlutterViewController.init() 8 | let windowFrame = self.frame 9 | self.contentViewController = flutterViewController 10 | self.setFrame(windowFrame, display: true) 11 | 12 | self.toolbar = NSToolbar(identifier: "DummyToolbar") 13 | self.titleVisibility = .hidden 14 | self.titlebarAppearsTransparent = true 15 | self.styleMask.insert(.fullSizeContentView) 16 | 17 | RegisterGeneratedPlugins(registry: flutterViewController) 18 | 19 | super.awakeFromNib() 20 | } 21 | 22 | override public func order(_ place: NSWindow.OrderingMode, relativeTo otherWin: Int) { 23 | super.order(place, relativeTo: otherWin) 24 | hiddenWindowAtLaunch() 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.network.client 8 | 9 | com.apple.security.network.server 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /macos/Runner/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* 2 | InfoPlist.strings 3 | Runner 4 | 5 | Created by Lijy91 on 2021/10/28. 6 | Copyright © 2021 LiJianying. All rights reserved. 7 | */ 8 | "CFBundleDisplayName" = "AnyInspect"; 9 | -------------------------------------------------------------------------------- /macos/packaging/dmg/appdmg.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "AnyInspect", 3 | "contents": [ 4 | { 5 | "x": 448, 6 | "y": 344, 7 | "type": "link", 8 | "path": "/Applications" 9 | }, 10 | { 11 | "x": 192, 12 | "y": 344, 13 | "type": "file", 14 | "path": "anyinspect_app.app" 15 | } 16 | ] 17 | } -------------------------------------------------------------------------------- /makeanyicon_options.yaml: -------------------------------------------------------------------------------- 1 | output: '' 2 | image_sets: 3 | - name: macos 4 | path: macos/Runner/Assets.xcassets/AppIcon.appiconset/ 5 | images: 6 | - size: 16x16 7 | filename: app_icon_16.png 8 | - size: 32x32 9 | filename: app_icon_32.png 10 | - size: 64x64 11 | filename: app_icon_64.png 12 | - size: 128x128 13 | filename: app_icon_128.png 14 | - size: 256x256 15 | filename: app_icon_256.png 16 | - size: 512x512 17 | filename: app_icon_512.png 18 | - size: 1024x1024 19 | filename: app_icon_1024.png 20 | - name: windows 21 | path: windows/runner/resources/ 22 | images: 23 | - size: 256x256 24 | filename: app_icon.ico -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | anyinspect_client: 5 | dependency: "direct main" 6 | description: 7 | name: anyinspect_client 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "0.1.0" 11 | anyinspect_server: 12 | dependency: "direct main" 13 | description: 14 | name: anyinspect_server 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "0.1.1" 18 | anyinspect_ui: 19 | dependency: "direct overridden" 20 | description: 21 | path: "../anyinspect/packages/anyinspect_ui" 22 | relative: true 23 | source: path 24 | version: "0.1.0" 25 | args: 26 | dependency: transitive 27 | description: 28 | name: args 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "2.3.0" 32 | async: 33 | dependency: transitive 34 | description: 35 | name: async 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "2.8.1" 39 | boolean_selector: 40 | dependency: transitive 41 | description: 42 | name: boolean_selector 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "2.1.0" 46 | bot_toast: 47 | dependency: "direct main" 48 | description: 49 | name: bot_toast 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "4.0.1" 53 | characters: 54 | dependency: transitive 55 | description: 56 | name: characters 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "1.1.0" 60 | charcode: 61 | dependency: transitive 62 | description: 63 | name: charcode 64 | url: "https://pub.dartlang.org" 65 | source: hosted 66 | version: "1.3.1" 67 | clock: 68 | dependency: transitive 69 | description: 70 | name: clock 71 | url: "https://pub.dartlang.org" 72 | source: hosted 73 | version: "1.1.0" 74 | collection: 75 | dependency: transitive 76 | description: 77 | name: collection 78 | url: "https://pub.dartlang.org" 79 | source: hosted 80 | version: "1.15.0" 81 | crypto: 82 | dependency: transitive 83 | description: 84 | name: crypto 85 | url: "https://pub.dartlang.org" 86 | source: hosted 87 | version: "3.0.1" 88 | cupertino_icons: 89 | dependency: "direct main" 90 | description: 91 | name: cupertino_icons 92 | url: "https://pub.dartlang.org" 93 | source: hosted 94 | version: "1.0.4" 95 | dbus: 96 | dependency: transitive 97 | description: 98 | name: dbus 99 | url: "https://pub.dartlang.org" 100 | source: hosted 101 | version: "0.5.6" 102 | device_info_plus: 103 | dependency: "direct main" 104 | description: 105 | name: device_info_plus 106 | url: "https://pub.dartlang.org" 107 | source: hosted 108 | version: "3.1.1" 109 | device_info_plus_linux: 110 | dependency: transitive 111 | description: 112 | name: device_info_plus_linux 113 | url: "https://pub.dartlang.org" 114 | source: hosted 115 | version: "2.1.0" 116 | device_info_plus_macos: 117 | dependency: transitive 118 | description: 119 | name: device_info_plus_macos 120 | url: "https://pub.dartlang.org" 121 | source: hosted 122 | version: "2.2.0" 123 | device_info_plus_platform_interface: 124 | dependency: transitive 125 | description: 126 | name: device_info_plus_platform_interface 127 | url: "https://pub.dartlang.org" 128 | source: hosted 129 | version: "2.2.1" 130 | device_info_plus_web: 131 | dependency: transitive 132 | description: 133 | name: device_info_plus_web 134 | url: "https://pub.dartlang.org" 135 | source: hosted 136 | version: "2.1.0" 137 | device_info_plus_windows: 138 | dependency: transitive 139 | description: 140 | name: device_info_plus_windows 141 | url: "https://pub.dartlang.org" 142 | source: hosted 143 | version: "2.1.0" 144 | dio: 145 | dependency: "direct main" 146 | description: 147 | name: dio 148 | url: "https://pub.dartlang.org" 149 | source: hosted 150 | version: "4.0.1" 151 | fake_async: 152 | dependency: transitive 153 | description: 154 | name: fake_async 155 | url: "https://pub.dartlang.org" 156 | source: hosted 157 | version: "1.2.0" 158 | ffi: 159 | dependency: transitive 160 | description: 161 | name: ffi 162 | url: "https://pub.dartlang.org" 163 | source: hosted 164 | version: "1.1.2" 165 | file: 166 | dependency: transitive 167 | description: 168 | name: file 169 | url: "https://pub.dartlang.org" 170 | source: hosted 171 | version: "6.1.2" 172 | flutter: 173 | dependency: "direct main" 174 | description: flutter 175 | source: sdk 176 | version: "0.0.0" 177 | flutter_lints: 178 | dependency: "direct dev" 179 | description: 180 | name: flutter_lints 181 | url: "https://pub.dartlang.org" 182 | source: hosted 183 | version: "1.0.4" 184 | flutter_sfsymbols: 185 | dependency: "direct main" 186 | description: 187 | name: flutter_sfsymbols 188 | url: "https://pub.dartlang.org" 189 | source: hosted 190 | version: "2.0.0" 191 | flutter_test: 192 | dependency: "direct dev" 193 | description: flutter 194 | source: sdk 195 | version: "0.0.0" 196 | flutter_web_plugins: 197 | dependency: transitive 198 | description: flutter 199 | source: sdk 200 | version: "0.0.0" 201 | http: 202 | dependency: transitive 203 | description: 204 | name: http 205 | url: "https://pub.dartlang.org" 206 | source: hosted 207 | version: "0.13.4" 208 | http_parser: 209 | dependency: transitive 210 | description: 211 | name: http_parser 212 | url: "https://pub.dartlang.org" 213 | source: hosted 214 | version: "4.0.0" 215 | intl: 216 | dependency: "direct main" 217 | description: 218 | name: intl 219 | url: "https://pub.dartlang.org" 220 | source: hosted 221 | version: "0.17.0" 222 | js: 223 | dependency: transitive 224 | description: 225 | name: js 226 | url: "https://pub.dartlang.org" 227 | source: hosted 228 | version: "0.6.3" 229 | lints: 230 | dependency: transitive 231 | description: 232 | name: lints 233 | url: "https://pub.dartlang.org" 234 | source: hosted 235 | version: "1.0.1" 236 | matcher: 237 | dependency: transitive 238 | description: 239 | name: matcher 240 | url: "https://pub.dartlang.org" 241 | source: hosted 242 | version: "0.12.10" 243 | meta: 244 | dependency: transitive 245 | description: 246 | name: meta 247 | url: "https://pub.dartlang.org" 248 | source: hosted 249 | version: "1.7.0" 250 | multi_split_view: 251 | dependency: "direct main" 252 | description: 253 | name: multi_split_view 254 | url: "https://pub.dartlang.org" 255 | source: hosted 256 | version: "1.9.1" 257 | network_info_plus: 258 | dependency: "direct main" 259 | description: 260 | name: network_info_plus 261 | url: "https://pub.dartlang.org" 262 | source: hosted 263 | version: "2.1.0" 264 | network_info_plus_linux: 265 | dependency: transitive 266 | description: 267 | name: network_info_plus_linux 268 | url: "https://pub.dartlang.org" 269 | source: hosted 270 | version: "1.1.0" 271 | network_info_plus_macos: 272 | dependency: transitive 273 | description: 274 | name: network_info_plus_macos 275 | url: "https://pub.dartlang.org" 276 | source: hosted 277 | version: "1.3.0" 278 | network_info_plus_platform_interface: 279 | dependency: transitive 280 | description: 281 | name: network_info_plus_platform_interface 282 | url: "https://pub.dartlang.org" 283 | source: hosted 284 | version: "1.1.0" 285 | network_info_plus_web: 286 | dependency: transitive 287 | description: 288 | name: network_info_plus_web 289 | url: "https://pub.dartlang.org" 290 | source: hosted 291 | version: "1.0.1" 292 | network_info_plus_windows: 293 | dependency: transitive 294 | description: 295 | name: network_info_plus_windows 296 | url: "https://pub.dartlang.org" 297 | source: hosted 298 | version: "1.0.2" 299 | nm: 300 | dependency: transitive 301 | description: 302 | name: nm 303 | url: "https://pub.dartlang.org" 304 | source: hosted 305 | version: "0.3.0" 306 | package_info_plus: 307 | dependency: "direct main" 308 | description: 309 | name: package_info_plus 310 | url: "https://pub.dartlang.org" 311 | source: hosted 312 | version: "1.3.0" 313 | package_info_plus_linux: 314 | dependency: transitive 315 | description: 316 | name: package_info_plus_linux 317 | url: "https://pub.dartlang.org" 318 | source: hosted 319 | version: "1.0.3" 320 | package_info_plus_macos: 321 | dependency: transitive 322 | description: 323 | name: package_info_plus_macos 324 | url: "https://pub.dartlang.org" 325 | source: hosted 326 | version: "1.3.0" 327 | package_info_plus_platform_interface: 328 | dependency: transitive 329 | description: 330 | name: package_info_plus_platform_interface 331 | url: "https://pub.dartlang.org" 332 | source: hosted 333 | version: "1.0.2" 334 | package_info_plus_web: 335 | dependency: transitive 336 | description: 337 | name: package_info_plus_web 338 | url: "https://pub.dartlang.org" 339 | source: hosted 340 | version: "1.0.4" 341 | package_info_plus_windows: 342 | dependency: transitive 343 | description: 344 | name: package_info_plus_windows 345 | url: "https://pub.dartlang.org" 346 | source: hosted 347 | version: "1.0.4" 348 | path: 349 | dependency: transitive 350 | description: 351 | name: path 352 | url: "https://pub.dartlang.org" 353 | source: hosted 354 | version: "1.8.0" 355 | path_provider: 356 | dependency: "direct main" 357 | description: 358 | name: path_provider 359 | url: "https://pub.dartlang.org" 360 | source: hosted 361 | version: "2.0.6" 362 | path_provider_linux: 363 | dependency: transitive 364 | description: 365 | name: path_provider_linux 366 | url: "https://pub.dartlang.org" 367 | source: hosted 368 | version: "2.1.1" 369 | path_provider_macos: 370 | dependency: transitive 371 | description: 372 | name: path_provider_macos 373 | url: "https://pub.dartlang.org" 374 | source: hosted 375 | version: "2.0.2" 376 | path_provider_platform_interface: 377 | dependency: transitive 378 | description: 379 | name: path_provider_platform_interface 380 | url: "https://pub.dartlang.org" 381 | source: hosted 382 | version: "2.0.1" 383 | path_provider_windows: 384 | dependency: transitive 385 | description: 386 | name: path_provider_windows 387 | url: "https://pub.dartlang.org" 388 | source: hosted 389 | version: "2.0.4" 390 | pedantic: 391 | dependency: transitive 392 | description: 393 | name: pedantic 394 | url: "https://pub.dartlang.org" 395 | source: hosted 396 | version: "1.11.1" 397 | petitparser: 398 | dependency: transitive 399 | description: 400 | name: petitparser 401 | url: "https://pub.dartlang.org" 402 | source: hosted 403 | version: "4.4.0" 404 | platform: 405 | dependency: transitive 406 | description: 407 | name: platform 408 | url: "https://pub.dartlang.org" 409 | source: hosted 410 | version: "3.0.2" 411 | plugin_platform_interface: 412 | dependency: transitive 413 | description: 414 | name: plugin_platform_interface 415 | url: "https://pub.dartlang.org" 416 | source: hosted 417 | version: "2.0.2" 418 | preference_list: 419 | dependency: "direct main" 420 | description: 421 | path: "." 422 | ref: main 423 | resolved-ref: "404953212dc5870acdab1f0017d8cfc2fab77eb0" 424 | url: "https://github.com/leanflutter/preference_list" 425 | source: git 426 | version: "0.0.1" 427 | process: 428 | dependency: transitive 429 | description: 430 | name: process 431 | url: "https://pub.dartlang.org" 432 | source: hosted 433 | version: "4.2.4" 434 | shelf: 435 | dependency: transitive 436 | description: 437 | name: shelf 438 | url: "https://pub.dartlang.org" 439 | source: hosted 440 | version: "1.2.0" 441 | shelf_web_socket: 442 | dependency: transitive 443 | description: 444 | name: shelf_web_socket 445 | url: "https://pub.dartlang.org" 446 | source: hosted 447 | version: "1.0.1" 448 | sky_engine: 449 | dependency: transitive 450 | description: flutter 451 | source: sdk 452 | version: "0.0.99" 453 | source_span: 454 | dependency: transitive 455 | description: 456 | name: source_span 457 | url: "https://pub.dartlang.org" 458 | source: hosted 459 | version: "1.8.1" 460 | stack_trace: 461 | dependency: transitive 462 | description: 463 | name: stack_trace 464 | url: "https://pub.dartlang.org" 465 | source: hosted 466 | version: "1.10.0" 467 | stream_channel: 468 | dependency: transitive 469 | description: 470 | name: stream_channel 471 | url: "https://pub.dartlang.org" 472 | source: hosted 473 | version: "2.1.0" 474 | string_scanner: 475 | dependency: transitive 476 | description: 477 | name: string_scanner 478 | url: "https://pub.dartlang.org" 479 | source: hosted 480 | version: "1.1.0" 481 | term_glyph: 482 | dependency: transitive 483 | description: 484 | name: term_glyph 485 | url: "https://pub.dartlang.org" 486 | source: hosted 487 | version: "1.2.0" 488 | test_api: 489 | dependency: transitive 490 | description: 491 | name: test_api 492 | url: "https://pub.dartlang.org" 493 | source: hosted 494 | version: "0.4.2" 495 | typed_data: 496 | dependency: transitive 497 | description: 498 | name: typed_data 499 | url: "https://pub.dartlang.org" 500 | source: hosted 501 | version: "1.3.0" 502 | url_launcher: 503 | dependency: "direct main" 504 | description: 505 | name: url_launcher 506 | url: "https://pub.dartlang.org" 507 | source: hosted 508 | version: "6.0.12" 509 | url_launcher_linux: 510 | dependency: transitive 511 | description: 512 | name: url_launcher_linux 513 | url: "https://pub.dartlang.org" 514 | source: hosted 515 | version: "2.0.2" 516 | url_launcher_macos: 517 | dependency: transitive 518 | description: 519 | name: url_launcher_macos 520 | url: "https://pub.dartlang.org" 521 | source: hosted 522 | version: "2.0.2" 523 | url_launcher_platform_interface: 524 | dependency: transitive 525 | description: 526 | name: url_launcher_platform_interface 527 | url: "https://pub.dartlang.org" 528 | source: hosted 529 | version: "2.0.4" 530 | url_launcher_web: 531 | dependency: transitive 532 | description: 533 | name: url_launcher_web 534 | url: "https://pub.dartlang.org" 535 | source: hosted 536 | version: "2.0.4" 537 | url_launcher_windows: 538 | dependency: transitive 539 | description: 540 | name: url_launcher_windows 541 | url: "https://pub.dartlang.org" 542 | source: hosted 543 | version: "2.0.2" 544 | uuid: 545 | dependency: transitive 546 | description: 547 | name: uuid 548 | url: "https://pub.dartlang.org" 549 | source: hosted 550 | version: "3.0.5" 551 | vector_math: 552 | dependency: transitive 553 | description: 554 | name: vector_math 555 | url: "https://pub.dartlang.org" 556 | source: hosted 557 | version: "2.1.0" 558 | web_socket_channel: 559 | dependency: transitive 560 | description: 561 | name: web_socket_channel 562 | url: "https://pub.dartlang.org" 563 | source: hosted 564 | version: "2.1.0" 565 | win32: 566 | dependency: transitive 567 | description: 568 | name: win32 569 | url: "https://pub.dartlang.org" 570 | source: hosted 571 | version: "2.2.10" 572 | window_manager: 573 | dependency: "direct main" 574 | description: 575 | name: window_manager 576 | url: "https://pub.dartlang.org" 577 | source: hosted 578 | version: "0.0.5" 579 | xdg_directories: 580 | dependency: transitive 581 | description: 582 | name: xdg_directories 583 | url: "https://pub.dartlang.org" 584 | source: hosted 585 | version: "0.2.0" 586 | xml: 587 | dependency: transitive 588 | description: 589 | name: xml 590 | url: "https://pub.dartlang.org" 591 | source: hosted 592 | version: "5.3.1" 593 | yaml: 594 | dependency: "direct main" 595 | description: 596 | name: yaml 597 | url: "https://pub.dartlang.org" 598 | source: hosted 599 | version: "3.1.0" 600 | sdks: 601 | dart: ">=2.14.0 <3.0.0" 602 | flutter: ">=2.5.0" 603 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: anyinspect_app 2 | description: A tool for debugging your Flutter apps. 3 | 4 | # The following line prevents the package from being accidentally published to 5 | # pub.dev using `flutter pub publish`. This is preferred for private packages. 6 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev 7 | 8 | # The following defines the version and build number for your application. 9 | # A version number is three numbers separated by dots, like 1.2.43 10 | # followed by an optional build number separated by a +. 11 | # Both the version and the builder number may be overridden in flutter 12 | # build by specifying --build-name and --build-number, respectively. 13 | # In Android, build-name is used as versionName while build-number used as versionCode. 14 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 15 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. 16 | # Read more about iOS versioning at 17 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 18 | version: 0.1.0+1 19 | 20 | environment: 21 | sdk: ">=2.12.0 <3.0.0" 22 | 23 | # Dependencies specify other packages that your package needs in order to work. 24 | # To automatically upgrade your package dependencies to the latest versions 25 | # consider running `flutter pub upgrade --major-versions`. Alternatively, 26 | # dependencies can be manually updated by changing the version numbers below to 27 | # the latest version available on pub.dev. To see which dependencies have newer 28 | # versions available, run `flutter pub outdated`. 29 | dependencies: 30 | flutter: 31 | sdk: flutter 32 | 33 | anyinspect_client: ^0.1.0 34 | anyinspect_server: ^0.1.1 35 | bot_toast: ^4.0.1 36 | device_info_plus: ^3.1.1 37 | dio: ^4.0.1 38 | flutter_sfsymbols: ^2.0.0 39 | intl: ^0.17.0 40 | multi_split_view: ^1.9.0 41 | network_info_plus: ^2.0.2 42 | package_info_plus: ^1.3.0 43 | path_provider: ^2.0.6 44 | preference_list: 45 | git: 46 | ref: main 47 | url: https://github.com/leanflutter/preference_list 48 | url_launcher: ^6.0.12 49 | window_manager: ^0.0.5 50 | yaml: ^3.1.0 51 | 52 | # The following adds the Cupertino Icons font to your application. 53 | # Use with the CupertinoIcons class for iOS style icons. 54 | cupertino_icons: ^1.0.2 55 | 56 | dev_dependencies: 57 | flutter_test: 58 | sdk: flutter 59 | 60 | # The "flutter_lints" package below contains a set of recommended lints to 61 | # encourage good coding practices. The lint set provided by the package is 62 | # activated in the `analysis_options.yaml` file located at the root of your 63 | # package. See that file for information about deactivating specific lint 64 | # rules and activating additional ones. 65 | flutter_lints: ^1.0.0 66 | 67 | dependency_overrides: 68 | # anyinspect_client: 69 | # path: ../anyinspect/packages/anyinspect_client 70 | # anyinspect_server: 71 | # path: ../anyinspect/packages/anyinspect_server 72 | anyinspect_ui: 73 | path: ../anyinspect/packages/anyinspect_ui 74 | 75 | # For information on the generic Dart part of this file, see the 76 | # following page: https://dart.dev/tools/pub/pubspec 77 | 78 | # The following section is specific to Flutter. 79 | flutter: 80 | 81 | # The following line ensures that the Material Icons font is 82 | # included with your application, so that you can use the icons in 83 | # the material Icons class. 84 | uses-material-design: true 85 | 86 | assets: 87 | - assets/images/ 88 | 89 | fonts: 90 | - family: sficonsets 91 | fonts: 92 | - asset: packages/flutter_sfsymbols/fonts/sficonsets.ttf 93 | -------------------------------------------------------------------------------- /test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility that Flutter provides. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | import 'package:anyinspect_app/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | // await tester.pumpWidget(const MyApp()); 17 | 18 | // Verify that our counter starts at 0. 19 | expect(find.text('0'), findsOneWidget); 20 | expect(find.text('1'), findsNothing); 21 | 22 | // Tap the '+' icon and trigger a frame. 23 | await tester.tap(find.byIcon(Icons.add)); 24 | await tester.pump(); 25 | 26 | // Verify that our counter has incremented. 27 | expect(find.text('0'), findsNothing); 28 | expect(find.text('1'), findsOneWidget); 29 | }); 30 | } 31 | -------------------------------------------------------------------------------- /windows/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral/ 2 | 3 | # Visual Studio user-specific files. 4 | *.suo 5 | *.user 6 | *.userosscache 7 | *.sln.docstates 8 | 9 | # Visual Studio build-related files. 10 | x64/ 11 | x86/ 12 | 13 | # Visual Studio cache files 14 | # files ending in .cache can be ignored 15 | *.[Cc]ache 16 | # but keep track of directories ending in .cache 17 | !*.[Cc]ache/ 18 | -------------------------------------------------------------------------------- /windows/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.15) 2 | project(anyinspect_app LANGUAGES CXX) 3 | 4 | set(BINARY_NAME "anyinspect_app") 5 | 6 | cmake_policy(SET CMP0063 NEW) 7 | 8 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") 9 | 10 | # Configure build options. 11 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) 12 | if(IS_MULTICONFIG) 13 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" 14 | CACHE STRING "" FORCE) 15 | else() 16 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 17 | set(CMAKE_BUILD_TYPE "Debug" CACHE 18 | STRING "Flutter build mode" FORCE) 19 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 20 | "Debug" "Profile" "Release") 21 | endif() 22 | endif() 23 | 24 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") 25 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") 26 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") 27 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") 28 | 29 | # Use Unicode for all projects. 30 | add_definitions(-DUNICODE -D_UNICODE) 31 | 32 | # Compilation settings that should be applied to most targets. 33 | function(APPLY_STANDARD_SETTINGS TARGET) 34 | target_compile_features(${TARGET} PUBLIC cxx_std_17) 35 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") 36 | target_compile_options(${TARGET} PRIVATE /EHsc) 37 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") 38 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") 39 | endfunction() 40 | 41 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 42 | 43 | # Flutter library and tool build rules. 44 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 45 | 46 | # Application build 47 | add_subdirectory("runner") 48 | 49 | # Generated plugin build rules, which manage building the plugins and adding 50 | # them to the application. 51 | include(flutter/generated_plugins.cmake) 52 | 53 | 54 | # === Installation === 55 | # Support files are copied into place next to the executable, so that it can 56 | # run in place. This is done instead of making a separate bundle (as on Linux) 57 | # so that building and running from within Visual Studio will work. 58 | set(BUILD_BUNDLE_DIR "$") 59 | # Make the "install" step default, as it's required to run. 60 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) 61 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 62 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 63 | endif() 64 | 65 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 66 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") 67 | 68 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 69 | COMPONENT Runtime) 70 | 71 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 72 | COMPONENT Runtime) 73 | 74 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 75 | COMPONENT Runtime) 76 | 77 | if(PLUGIN_BUNDLED_LIBRARIES) 78 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" 79 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 80 | COMPONENT Runtime) 81 | endif() 82 | 83 | # Fully re-copy the assets directory on each build to avoid having stale files 84 | # from a previous install. 85 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 86 | install(CODE " 87 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 88 | " COMPONENT Runtime) 89 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 90 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 91 | 92 | # Install the AOT library on non-Debug builds only. 93 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 94 | CONFIGURATIONS Profile;Release 95 | COMPONENT Runtime) 96 | -------------------------------------------------------------------------------- /windows/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.15) 2 | 3 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 4 | 5 | # Configuration provided via flutter tool. 6 | include(${EPHEMERAL_DIR}/generated_config.cmake) 7 | 8 | # TODO: Move the rest of this into files in ephemeral. See 9 | # https://github.com/flutter/flutter/issues/57146. 10 | set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") 11 | 12 | # === Flutter Library === 13 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") 14 | 15 | # Published to parent scope for install step. 16 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 17 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 18 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 19 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) 20 | 21 | list(APPEND FLUTTER_LIBRARY_HEADERS 22 | "flutter_export.h" 23 | "flutter_windows.h" 24 | "flutter_messenger.h" 25 | "flutter_plugin_registrar.h" 26 | "flutter_texture_registrar.h" 27 | ) 28 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") 29 | add_library(flutter INTERFACE) 30 | target_include_directories(flutter INTERFACE 31 | "${EPHEMERAL_DIR}" 32 | ) 33 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") 34 | add_dependencies(flutter flutter_assemble) 35 | 36 | # === Wrapper === 37 | list(APPEND CPP_WRAPPER_SOURCES_CORE 38 | "core_implementations.cc" 39 | "standard_codec.cc" 40 | ) 41 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") 42 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN 43 | "plugin_registrar.cc" 44 | ) 45 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") 46 | list(APPEND CPP_WRAPPER_SOURCES_APP 47 | "flutter_engine.cc" 48 | "flutter_view_controller.cc" 49 | ) 50 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") 51 | 52 | # Wrapper sources needed for a plugin. 53 | add_library(flutter_wrapper_plugin STATIC 54 | ${CPP_WRAPPER_SOURCES_CORE} 55 | ${CPP_WRAPPER_SOURCES_PLUGIN} 56 | ) 57 | apply_standard_settings(flutter_wrapper_plugin) 58 | set_target_properties(flutter_wrapper_plugin PROPERTIES 59 | POSITION_INDEPENDENT_CODE ON) 60 | set_target_properties(flutter_wrapper_plugin PROPERTIES 61 | CXX_VISIBILITY_PRESET hidden) 62 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) 63 | target_include_directories(flutter_wrapper_plugin PUBLIC 64 | "${WRAPPER_ROOT}/include" 65 | ) 66 | add_dependencies(flutter_wrapper_plugin flutter_assemble) 67 | 68 | # Wrapper sources needed for the runner. 69 | add_library(flutter_wrapper_app STATIC 70 | ${CPP_WRAPPER_SOURCES_CORE} 71 | ${CPP_WRAPPER_SOURCES_APP} 72 | ) 73 | apply_standard_settings(flutter_wrapper_app) 74 | target_link_libraries(flutter_wrapper_app PUBLIC flutter) 75 | target_include_directories(flutter_wrapper_app PUBLIC 76 | "${WRAPPER_ROOT}/include" 77 | ) 78 | add_dependencies(flutter_wrapper_app flutter_assemble) 79 | 80 | # === Flutter tool backend === 81 | # _phony_ is a non-existent file to force this command to run every time, 82 | # since currently there's no way to get a full input/output list from the 83 | # flutter tool. 84 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") 85 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) 86 | add_custom_command( 87 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 88 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} 89 | ${CPP_WRAPPER_SOURCES_APP} 90 | ${PHONY_OUTPUT} 91 | COMMAND ${CMAKE_COMMAND} -E env 92 | ${FLUTTER_TOOL_ENVIRONMENT} 93 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" 94 | windows-x64 $ 95 | VERBATIM 96 | ) 97 | add_custom_target(flutter_assemble DEPENDS 98 | "${FLUTTER_LIBRARY}" 99 | ${FLUTTER_LIBRARY_HEADERS} 100 | ${CPP_WRAPPER_SOURCES_CORE} 101 | ${CPP_WRAPPER_SOURCES_PLUGIN} 102 | ${CPP_WRAPPER_SOURCES_APP} 103 | ) 104 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | #include 11 | 12 | void RegisterPlugins(flutter::PluginRegistry* registry) { 13 | NetworkInfoPlusWindowsPluginRegisterWithRegistrar( 14 | registry->GetRegistrarForPlugin("NetworkInfoPlusWindowsPlugin")); 15 | WindowManagerPluginRegisterWithRegistrar( 16 | registry->GetRegistrarForPlugin("WindowManagerPlugin")); 17 | } 18 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void RegisterPlugins(flutter::PluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | network_info_plus_windows 7 | window_manager 8 | ) 9 | 10 | set(PLUGIN_BUNDLED_LIBRARIES) 11 | 12 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 13 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 14 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 15 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 17 | endforeach(plugin) 18 | -------------------------------------------------------------------------------- /windows/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.15) 2 | project(runner LANGUAGES CXX) 3 | 4 | add_executable(${BINARY_NAME} WIN32 5 | "flutter_window.cpp" 6 | "main.cpp" 7 | "utils.cpp" 8 | "win32_window.cpp" 9 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 10 | "Runner.rc" 11 | "runner.exe.manifest" 12 | ) 13 | apply_standard_settings(${BINARY_NAME}) 14 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") 15 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) 16 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 17 | add_dependencies(${BINARY_NAME} flutter_assemble) 18 | -------------------------------------------------------------------------------- /windows/runner/Runner.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #pragma code_page(65001) 4 | #include "resource.h" 5 | 6 | #define APSTUDIO_READONLY_SYMBOLS 7 | ///////////////////////////////////////////////////////////////////////////// 8 | // 9 | // Generated from the TEXTINCLUDE 2 resource. 10 | // 11 | #include "winres.h" 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | #undef APSTUDIO_READONLY_SYMBOLS 15 | 16 | ///////////////////////////////////////////////////////////////////////////// 17 | // English (United States) resources 18 | 19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | 22 | #ifdef APSTUDIO_INVOKED 23 | ///////////////////////////////////////////////////////////////////////////// 24 | // 25 | // TEXTINCLUDE 26 | // 27 | 28 | 1 TEXTINCLUDE 29 | BEGIN 30 | "resource.h\0" 31 | END 32 | 33 | 2 TEXTINCLUDE 34 | BEGIN 35 | "#include ""winres.h""\r\n" 36 | "\0" 37 | END 38 | 39 | 3 TEXTINCLUDE 40 | BEGIN 41 | "\r\n" 42 | "\0" 43 | END 44 | 45 | #endif // APSTUDIO_INVOKED 46 | 47 | 48 | ///////////////////////////////////////////////////////////////////////////// 49 | // 50 | // Icon 51 | // 52 | 53 | // Icon with lowest ID value placed first to ensure application icon 54 | // remains consistent on all systems. 55 | IDI_APP_ICON ICON "resources\\app_icon.ico" 56 | 57 | 58 | ///////////////////////////////////////////////////////////////////////////// 59 | // 60 | // Version 61 | // 62 | 63 | #ifdef FLUTTER_BUILD_NUMBER 64 | #define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER 65 | #else 66 | #define VERSION_AS_NUMBER 1,0,0 67 | #endif 68 | 69 | #ifdef FLUTTER_BUILD_NAME 70 | #define VERSION_AS_STRING #FLUTTER_BUILD_NAME 71 | #else 72 | #define VERSION_AS_STRING "1.0.0" 73 | #endif 74 | 75 | VS_VERSION_INFO VERSIONINFO 76 | FILEVERSION VERSION_AS_NUMBER 77 | PRODUCTVERSION VERSION_AS_NUMBER 78 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 79 | #ifdef _DEBUG 80 | FILEFLAGS VS_FF_DEBUG 81 | #else 82 | FILEFLAGS 0x0L 83 | #endif 84 | FILEOS VOS__WINDOWS32 85 | FILETYPE VFT_APP 86 | FILESUBTYPE 0x0L 87 | BEGIN 88 | BLOCK "StringFileInfo" 89 | BEGIN 90 | BLOCK "040904e4" 91 | BEGIN 92 | VALUE "CompanyName", "dev.anyinspect.app" "\0" 93 | VALUE "FileDescription", "AnyInspect" "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "anyinspect_app" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2021 AnyInspect. All rights reserved." "\0" 97 | VALUE "OriginalFilename", "anyinspect_app.exe" "\0" 98 | VALUE "ProductName", "anyinspect_app" "\0" 99 | VALUE "ProductVersion", VERSION_AS_STRING "\0" 100 | END 101 | END 102 | BLOCK "VarFileInfo" 103 | BEGIN 104 | VALUE "Translation", 0x409, 1252 105 | END 106 | END 107 | 108 | #endif // English (United States) resources 109 | ///////////////////////////////////////////////////////////////////////////// 110 | 111 | 112 | 113 | #ifndef APSTUDIO_INVOKED 114 | ///////////////////////////////////////////////////////////////////////////// 115 | // 116 | // Generated from the TEXTINCLUDE 3 resource. 117 | // 118 | 119 | 120 | ///////////////////////////////////////////////////////////////////////////// 121 | #endif // not APSTUDIO_INVOKED 122 | -------------------------------------------------------------------------------- /windows/runner/flutter_window.cpp: -------------------------------------------------------------------------------- 1 | #include "flutter_window.h" 2 | 3 | #include 4 | 5 | #include "flutter/generated_plugin_registrant.h" 6 | 7 | FlutterWindow::FlutterWindow(const flutter::DartProject& project) 8 | : project_(project) {} 9 | 10 | FlutterWindow::~FlutterWindow() {} 11 | 12 | bool FlutterWindow::OnCreate() { 13 | if (!Win32Window::OnCreate()) { 14 | return false; 15 | } 16 | 17 | RECT frame = GetClientArea(); 18 | 19 | // The size here must match the window dimensions to avoid unnecessary surface 20 | // creation / destruction in the startup path. 21 | flutter_controller_ = std::make_unique( 22 | frame.right - frame.left, frame.bottom - frame.top, project_); 23 | // Ensure that basic setup of the controller was successful. 24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) { 25 | return false; 26 | } 27 | RegisterPlugins(flutter_controller_->engine()); 28 | SetChildContent(flutter_controller_->view()->GetNativeWindow()); 29 | return true; 30 | } 31 | 32 | void FlutterWindow::OnDestroy() { 33 | if (flutter_controller_) { 34 | flutter_controller_ = nullptr; 35 | } 36 | 37 | Win32Window::OnDestroy(); 38 | } 39 | 40 | LRESULT 41 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 42 | WPARAM const wparam, 43 | LPARAM const lparam) noexcept { 44 | // Give Flutter, including plugins, an opportunity to handle window messages. 45 | if (flutter_controller_) { 46 | std::optional result = 47 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 48 | lparam); 49 | if (result) { 50 | return *result; 51 | } 52 | } 53 | 54 | switch (message) { 55 | case WM_FONTCHANGE: 56 | flutter_controller_->engine()->ReloadSystemFonts(); 57 | break; 58 | } 59 | 60 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 61 | } 62 | -------------------------------------------------------------------------------- /windows/runner/flutter_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_FLUTTER_WINDOW_H_ 2 | #define RUNNER_FLUTTER_WINDOW_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "win32_window.h" 10 | 11 | // A window that does nothing but host a Flutter view. 12 | class FlutterWindow : public Win32Window { 13 | public: 14 | // Creates a new FlutterWindow hosting a Flutter view running |project|. 15 | explicit FlutterWindow(const flutter::DartProject& project); 16 | virtual ~FlutterWindow(); 17 | 18 | protected: 19 | // Win32Window: 20 | bool OnCreate() override; 21 | void OnDestroy() override; 22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, 23 | LPARAM const lparam) noexcept override; 24 | 25 | private: 26 | // The project to run. 27 | flutter::DartProject project_; 28 | 29 | // The Flutter instance hosted by this window. 30 | std::unique_ptr flutter_controller_; 31 | }; 32 | 33 | #endif // RUNNER_FLUTTER_WINDOW_H_ 34 | -------------------------------------------------------------------------------- /windows/runner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "flutter_window.h" 6 | #include "utils.h" 7 | 8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, 9 | _In_ wchar_t *command_line, _In_ int show_command) { 10 | // Attach to console when present (e.g., 'flutter run') or create a 11 | // new console when running with a debugger. 12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { 13 | CreateAndAttachConsole(); 14 | } 15 | 16 | // Initialize COM, so that it is available for use in the library and/or 17 | // plugins. 18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); 19 | 20 | flutter::DartProject project(L"data"); 21 | 22 | std::vector command_line_arguments = 23 | GetCommandLineArguments(); 24 | 25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); 26 | 27 | FlutterWindow window(project); 28 | Win32Window::Point origin(10, 10); 29 | Win32Window::Size size(1280, 720); 30 | if (!window.CreateAndShow(L"anyinspect_app", origin, size)) { 31 | return EXIT_FAILURE; 32 | } 33 | window.SetQuitOnClose(true); 34 | 35 | ::MSG msg; 36 | while (::GetMessage(&msg, nullptr, 0, 0)) { 37 | ::TranslateMessage(&msg); 38 | ::DispatchMessage(&msg); 39 | } 40 | 41 | ::CoUninitialize(); 42 | return EXIT_SUCCESS; 43 | } 44 | -------------------------------------------------------------------------------- /windows/runner/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Runner.rc 4 | // 5 | #define IDI_APP_ICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijy91-archives-repos/anyinspect_app/0f4db9b5e33329987729c15750e9757ec381ae6a/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /windows/runner/runner.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PerMonitorV2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /windows/runner/utils.cpp: -------------------------------------------------------------------------------- 1 | #include "utils.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | void CreateAndAttachConsole() { 11 | if (::AllocConsole()) { 12 | FILE *unused; 13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) { 14 | _dup2(_fileno(stdout), 1); 15 | } 16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) { 17 | _dup2(_fileno(stdout), 2); 18 | } 19 | std::ios::sync_with_stdio(); 20 | FlutterDesktopResyncOutputStreams(); 21 | } 22 | } 23 | 24 | std::vector GetCommandLineArguments() { 25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. 26 | int argc; 27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); 28 | if (argv == nullptr) { 29 | return std::vector(); 30 | } 31 | 32 | std::vector command_line_arguments; 33 | 34 | // Skip the first argument as it's the binary name. 35 | for (int i = 1; i < argc; i++) { 36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i])); 37 | } 38 | 39 | ::LocalFree(argv); 40 | 41 | return command_line_arguments; 42 | } 43 | 44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) { 45 | if (utf16_string == nullptr) { 46 | return std::string(); 47 | } 48 | int target_length = ::WideCharToMultiByte( 49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 50 | -1, nullptr, 0, nullptr, nullptr); 51 | if (target_length == 0) { 52 | return std::string(); 53 | } 54 | std::string utf8_string; 55 | utf8_string.resize(target_length); 56 | int converted_length = ::WideCharToMultiByte( 57 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 58 | -1, utf8_string.data(), 59 | target_length, nullptr, nullptr); 60 | if (converted_length == 0) { 61 | return std::string(); 62 | } 63 | return utf8_string; 64 | } 65 | -------------------------------------------------------------------------------- /windows/runner/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_UTILS_H_ 2 | #define RUNNER_UTILS_H_ 3 | 4 | #include 5 | #include 6 | 7 | // Creates a console for the process, and redirects stdout and stderr to 8 | // it for both the runner and the Flutter library. 9 | void CreateAndAttachConsole(); 10 | 11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string 12 | // encoded in UTF-8. Returns an empty std::string on failure. 13 | std::string Utf8FromUtf16(const wchar_t* utf16_string); 14 | 15 | // Gets the command line arguments passed in as a std::vector, 16 | // encoded in UTF-8. Returns an empty std::vector on failure. 17 | std::vector GetCommandLineArguments(); 18 | 19 | #endif // RUNNER_UTILS_H_ 20 | -------------------------------------------------------------------------------- /windows/runner/win32_window.cpp: -------------------------------------------------------------------------------- 1 | #include "win32_window.h" 2 | 3 | #include 4 | 5 | #include "resource.h" 6 | 7 | namespace { 8 | 9 | constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW"; 10 | 11 | // The number of Win32Window objects that currently exist. 12 | static int g_active_window_count = 0; 13 | 14 | using EnableNonClientDpiScaling = BOOL __stdcall(HWND hwnd); 15 | 16 | // Scale helper to convert logical scaler values to physical using passed in 17 | // scale factor 18 | int Scale(int source, double scale_factor) { 19 | return static_cast(source * scale_factor); 20 | } 21 | 22 | // Dynamically loads the |EnableNonClientDpiScaling| from the User32 module. 23 | // This API is only needed for PerMonitor V1 awareness mode. 24 | void EnableFullDpiSupportIfAvailable(HWND hwnd) { 25 | HMODULE user32_module = LoadLibraryA("User32.dll"); 26 | if (!user32_module) { 27 | return; 28 | } 29 | auto enable_non_client_dpi_scaling = 30 | reinterpret_cast( 31 | GetProcAddress(user32_module, "EnableNonClientDpiScaling")); 32 | if (enable_non_client_dpi_scaling != nullptr) { 33 | enable_non_client_dpi_scaling(hwnd); 34 | FreeLibrary(user32_module); 35 | } 36 | } 37 | 38 | } // namespace 39 | 40 | // Manages the Win32Window's window class registration. 41 | class WindowClassRegistrar { 42 | public: 43 | ~WindowClassRegistrar() = default; 44 | 45 | // Returns the singleton registar instance. 46 | static WindowClassRegistrar* GetInstance() { 47 | if (!instance_) { 48 | instance_ = new WindowClassRegistrar(); 49 | } 50 | return instance_; 51 | } 52 | 53 | // Returns the name of the window class, registering the class if it hasn't 54 | // previously been registered. 55 | const wchar_t* GetWindowClass(); 56 | 57 | // Unregisters the window class. Should only be called if there are no 58 | // instances of the window. 59 | void UnregisterWindowClass(); 60 | 61 | private: 62 | WindowClassRegistrar() = default; 63 | 64 | static WindowClassRegistrar* instance_; 65 | 66 | bool class_registered_ = false; 67 | }; 68 | 69 | WindowClassRegistrar* WindowClassRegistrar::instance_ = nullptr; 70 | 71 | const wchar_t* WindowClassRegistrar::GetWindowClass() { 72 | if (!class_registered_) { 73 | WNDCLASS window_class{}; 74 | window_class.hCursor = LoadCursor(nullptr, IDC_ARROW); 75 | window_class.lpszClassName = kWindowClassName; 76 | window_class.style = CS_HREDRAW | CS_VREDRAW; 77 | window_class.cbClsExtra = 0; 78 | window_class.cbWndExtra = 0; 79 | window_class.hInstance = GetModuleHandle(nullptr); 80 | window_class.hIcon = 81 | LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON)); 82 | window_class.hbrBackground = 0; 83 | window_class.lpszMenuName = nullptr; 84 | window_class.lpfnWndProc = Win32Window::WndProc; 85 | RegisterClass(&window_class); 86 | class_registered_ = true; 87 | } 88 | return kWindowClassName; 89 | } 90 | 91 | void WindowClassRegistrar::UnregisterWindowClass() { 92 | UnregisterClass(kWindowClassName, nullptr); 93 | class_registered_ = false; 94 | } 95 | 96 | Win32Window::Win32Window() { 97 | ++g_active_window_count; 98 | } 99 | 100 | Win32Window::~Win32Window() { 101 | --g_active_window_count; 102 | Destroy(); 103 | } 104 | 105 | bool Win32Window::CreateAndShow(const std::wstring& title, 106 | const Point& origin, 107 | const Size& size) { 108 | Destroy(); 109 | 110 | const wchar_t* window_class = 111 | WindowClassRegistrar::GetInstance()->GetWindowClass(); 112 | 113 | const POINT target_point = {static_cast(origin.x), 114 | static_cast(origin.y)}; 115 | HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST); 116 | UINT dpi = FlutterDesktopGetDpiForMonitor(monitor); 117 | double scale_factor = dpi / 96.0; 118 | 119 | HWND window = CreateWindow( 120 | window_class, title.c_str(), WS_OVERLAPPEDWINDOW | WS_VISIBLE, 121 | Scale(origin.x, scale_factor), Scale(origin.y, scale_factor), 122 | Scale(size.width, scale_factor), Scale(size.height, scale_factor), 123 | nullptr, nullptr, GetModuleHandle(nullptr), this); 124 | 125 | if (!window) { 126 | return false; 127 | } 128 | 129 | return OnCreate(); 130 | } 131 | 132 | // static 133 | LRESULT CALLBACK Win32Window::WndProc(HWND const window, 134 | UINT const message, 135 | WPARAM const wparam, 136 | LPARAM const lparam) noexcept { 137 | if (message == WM_NCCREATE) { 138 | auto window_struct = reinterpret_cast(lparam); 139 | SetWindowLongPtr(window, GWLP_USERDATA, 140 | reinterpret_cast(window_struct->lpCreateParams)); 141 | 142 | auto that = static_cast(window_struct->lpCreateParams); 143 | EnableFullDpiSupportIfAvailable(window); 144 | that->window_handle_ = window; 145 | } else if (Win32Window* that = GetThisFromHandle(window)) { 146 | return that->MessageHandler(window, message, wparam, lparam); 147 | } 148 | 149 | return DefWindowProc(window, message, wparam, lparam); 150 | } 151 | 152 | LRESULT 153 | Win32Window::MessageHandler(HWND hwnd, 154 | UINT const message, 155 | WPARAM const wparam, 156 | LPARAM const lparam) noexcept { 157 | switch (message) { 158 | case WM_DESTROY: 159 | window_handle_ = nullptr; 160 | Destroy(); 161 | if (quit_on_close_) { 162 | PostQuitMessage(0); 163 | } 164 | return 0; 165 | 166 | case WM_DPICHANGED: { 167 | auto newRectSize = reinterpret_cast(lparam); 168 | LONG newWidth = newRectSize->right - newRectSize->left; 169 | LONG newHeight = newRectSize->bottom - newRectSize->top; 170 | 171 | SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth, 172 | newHeight, SWP_NOZORDER | SWP_NOACTIVATE); 173 | 174 | return 0; 175 | } 176 | case WM_SIZE: { 177 | RECT rect = GetClientArea(); 178 | if (child_content_ != nullptr) { 179 | // Size and position the child window. 180 | MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left, 181 | rect.bottom - rect.top, TRUE); 182 | } 183 | return 0; 184 | } 185 | 186 | case WM_ACTIVATE: 187 | if (child_content_ != nullptr) { 188 | SetFocus(child_content_); 189 | } 190 | return 0; 191 | } 192 | 193 | return DefWindowProc(window_handle_, message, wparam, lparam); 194 | } 195 | 196 | void Win32Window::Destroy() { 197 | OnDestroy(); 198 | 199 | if (window_handle_) { 200 | DestroyWindow(window_handle_); 201 | window_handle_ = nullptr; 202 | } 203 | if (g_active_window_count == 0) { 204 | WindowClassRegistrar::GetInstance()->UnregisterWindowClass(); 205 | } 206 | } 207 | 208 | Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept { 209 | return reinterpret_cast( 210 | GetWindowLongPtr(window, GWLP_USERDATA)); 211 | } 212 | 213 | void Win32Window::SetChildContent(HWND content) { 214 | child_content_ = content; 215 | SetParent(content, window_handle_); 216 | RECT frame = GetClientArea(); 217 | 218 | MoveWindow(content, frame.left, frame.top, frame.right - frame.left, 219 | frame.bottom - frame.top, true); 220 | 221 | SetFocus(child_content_); 222 | } 223 | 224 | RECT Win32Window::GetClientArea() { 225 | RECT frame; 226 | GetClientRect(window_handle_, &frame); 227 | return frame; 228 | } 229 | 230 | HWND Win32Window::GetHandle() { 231 | return window_handle_; 232 | } 233 | 234 | void Win32Window::SetQuitOnClose(bool quit_on_close) { 235 | quit_on_close_ = quit_on_close; 236 | } 237 | 238 | bool Win32Window::OnCreate() { 239 | // No-op; provided for subclasses. 240 | return true; 241 | } 242 | 243 | void Win32Window::OnDestroy() { 244 | // No-op; provided for subclasses. 245 | } 246 | -------------------------------------------------------------------------------- /windows/runner/win32_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_WIN32_WINDOW_H_ 2 | #define RUNNER_WIN32_WINDOW_H_ 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | // A class abstraction for a high DPI-aware Win32 Window. Intended to be 11 | // inherited from by classes that wish to specialize with custom 12 | // rendering and input handling 13 | class Win32Window { 14 | public: 15 | struct Point { 16 | unsigned int x; 17 | unsigned int y; 18 | Point(unsigned int x, unsigned int y) : x(x), y(y) {} 19 | }; 20 | 21 | struct Size { 22 | unsigned int width; 23 | unsigned int height; 24 | Size(unsigned int width, unsigned int height) 25 | : width(width), height(height) {} 26 | }; 27 | 28 | Win32Window(); 29 | virtual ~Win32Window(); 30 | 31 | // Creates and shows a win32 window with |title| and position and size using 32 | // |origin| and |size|. New windows are created on the default monitor. Window 33 | // sizes are specified to the OS in physical pixels, hence to ensure a 34 | // consistent size to will treat the width height passed in to this function 35 | // as logical pixels and scale to appropriate for the default monitor. Returns 36 | // true if the window was created successfully. 37 | bool CreateAndShow(const std::wstring& title, 38 | const Point& origin, 39 | const Size& size); 40 | 41 | // Release OS resources associated with window. 42 | void Destroy(); 43 | 44 | // Inserts |content| into the window tree. 45 | void SetChildContent(HWND content); 46 | 47 | // Returns the backing Window handle to enable clients to set icon and other 48 | // window properties. Returns nullptr if the window has been destroyed. 49 | HWND GetHandle(); 50 | 51 | // If true, closing this window will quit the application. 52 | void SetQuitOnClose(bool quit_on_close); 53 | 54 | // Return a RECT representing the bounds of the current client area. 55 | RECT GetClientArea(); 56 | 57 | protected: 58 | // Processes and route salient window messages for mouse handling, 59 | // size change and DPI. Delegates handling of these to member overloads that 60 | // inheriting classes can handle. 61 | virtual LRESULT MessageHandler(HWND window, 62 | UINT const message, 63 | WPARAM const wparam, 64 | LPARAM const lparam) noexcept; 65 | 66 | // Called when CreateAndShow is called, allowing subclass window-related 67 | // setup. Subclasses should return false if setup fails. 68 | virtual bool OnCreate(); 69 | 70 | // Called when Destroy is called. 71 | virtual void OnDestroy(); 72 | 73 | private: 74 | friend class WindowClassRegistrar; 75 | 76 | // OS callback called by message pump. Handles the WM_NCCREATE message which 77 | // is passed when the non-client area is being created and enables automatic 78 | // non-client DPI scaling so that the non-client area automatically 79 | // responsponds to changes in DPI. All other messages are handled by 80 | // MessageHandler. 81 | static LRESULT CALLBACK WndProc(HWND const window, 82 | UINT const message, 83 | WPARAM const wparam, 84 | LPARAM const lparam) noexcept; 85 | 86 | // Retrieves a class instance pointer for |window| 87 | static Win32Window* GetThisFromHandle(HWND const window) noexcept; 88 | 89 | bool quit_on_close_ = false; 90 | 91 | // window handle for top level window. 92 | HWND window_handle_ = nullptr; 93 | 94 | // window handle for hosted content. 95 | HWND child_content_ = nullptr; 96 | }; 97 | 98 | #endif // RUNNER_WIN32_WINDOW_H_ 99 | --------------------------------------------------------------------------------