├── .gitignore ├── .metadata ├── CHANGELOG.md ├── LICENSE ├── README.md ├── example ├── .gitignore ├── .metadata ├── README.md ├── android │ ├── app │ │ ├── build.gradle │ │ └── src │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ ├── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── kotlin │ │ │ │ └── com │ │ │ │ │ └── example │ │ │ │ │ └── example │ │ │ │ │ └── MainActivity.kt │ │ │ └── res │ │ │ │ ├── drawable │ │ │ │ └── launch_background.xml │ │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ └── values │ │ │ │ └── styles.xml │ │ │ └── profile │ │ │ └── AndroidManifest.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ └── settings.gradle ├── ios │ ├── Flutter │ │ ├── AppFrameworkInfo.plist │ │ ├── Debug.xcconfig │ │ └── Release.xcconfig │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ └── contents.xcworkspacedata │ └── Runner │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ ├── Icon-App-20x20@1x.png │ │ │ ├── Icon-App-20x20@2x.png │ │ │ ├── Icon-App-20x20@3x.png │ │ │ ├── Icon-App-29x29@1x.png │ │ │ ├── Icon-App-29x29@2x.png │ │ │ ├── Icon-App-29x29@3x.png │ │ │ ├── Icon-App-40x40@1x.png │ │ │ ├── Icon-App-40x40@2x.png │ │ │ ├── Icon-App-40x40@3x.png │ │ │ ├── Icon-App-60x60@2x.png │ │ │ ├── Icon-App-60x60@3x.png │ │ │ ├── Icon-App-76x76@1x.png │ │ │ ├── Icon-App-76x76@2x.png │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ └── LaunchImage.imageset │ │ │ ├── Contents.json │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ └── README.md │ │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ │ ├── Info.plist │ │ └── Runner-Bridging-Header.h ├── lib │ └── main.dart ├── pubspec.lock ├── pubspec.yaml └── test │ └── widget_test.dart ├── lib ├── bean │ └── fps_info.dart ├── util │ └── collection_util.dart └── widget │ ├── custom_widget_inspector.dart │ ├── fps_chart.dart │ ├── fps_page.dart │ └── performance_observer_widget.dart ├── pubspec.lock ├── pubspec.yaml └── test └── fps_monitor_test.dart /.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 | .dart_tool/ 26 | .flutter-plugins 27 | .flutter-plugins-dependencies 28 | .packages 29 | .pub-cache/ 30 | .pub/ 31 | build/ 32 | ../ 33 | # Android related 34 | **/android/**/gradle-wrapper.jar 35 | **/android/.gradle 36 | **/android/captures/ 37 | **/android/gradlew 38 | **/android/gradlew.bat 39 | **/android/local.properties 40 | **/android/**/GeneratedPluginRegistrant.java 41 | 42 | # iOS/XCode related 43 | **/ios/**/*.mode1v3 44 | **/ios/**/*.mode2v3 45 | **/ios/**/*.moved-aside 46 | **/ios/**/*.pbxuser 47 | **/ios/**/*.perspectivev3 48 | **/ios/**/*sync/ 49 | **/ios/**/.sconsign.dblite 50 | **/ios/**/.tags* 51 | **/ios/**/.vagrant/ 52 | **/ios/**/DerivedData/ 53 | **/ios/**/Icon? 54 | **/ios/**/Pods/ 55 | **/ios/**/.symlinks/ 56 | **/ios/**/profile 57 | **/ios/**/xcuserdata 58 | **/ios/.generated/ 59 | **/ios/Flutter/App.framework 60 | **/ios/Flutter/Flutter.framework 61 | **/ios/Flutter/Flutter.podspec 62 | **/ios/Flutter/Generated.xcconfig 63 | **/ios/Flutter/app.flx 64 | **/ios/Flutter/app.zip 65 | **/ios/Flutter/flutter_assets/ 66 | **/ios/Flutter/flutter_export_environment.sh 67 | **/ios/ServiceDefinitions.json 68 | **/ios/Runner/GeneratedPluginRegistrant.* 69 | 70 | # Exceptions to above rules. 71 | !**/ios/**/default.mode1v3 72 | !**/ios/**/default.mode2v3 73 | !**/ios/**/default.pbxuser 74 | !**/ios/**/default.perspectivev3 75 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 76 | -------------------------------------------------------------------------------- /.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: f139b11009aeb8ed2a3a3aa8b0066e482709dde3 8 | channel: stable 9 | 10 | project_type: package 11 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [1.12.13-0] -正式稳定版本 2 | ## [1.12.13-1] -更新readme 3 | ## [1.12.13-2] -更新readme 4 | ## [2.0.0] -适配空安全 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2021, Nayuta-D 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | 3. Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 已适配 null-safe ,对应版本:2.0.0 2 | 3 | ## 导语: 4 | 5 | 对于任何一款应用而言,页面的流畅度一定是影响用户体验最重要的几个指标之一。作为开发者,优化页面流畅度也是自己技术实力的体现。但在决定进行优化之前,还有两个更重要的问题摆在我们面前:**1、如何发现卡顿的页面?**、**2、如何衡量我的优化效果?** 6 | 7 | 为了解决这两个问题,本期给大家带来一个很有意思的小工具:**fps_monitor** 8 | 9 | *** 10 | ## 一、What's this 这是个什么工具? 11 | 12 | 首先一句话告诉你:**这是一个能在 profile/debug 模式下,直观帮助我们评估页面流畅度的工具!!** 13 | 直白来说就是:这是一个可以在(刷新率60)设备上直接查看最近(默认 100)帧的表现情况的小工具,直接上图: 14 | 15 | 16 | 17 | 当我们点击右下角的 ⏯ 后,按钮变为⏸ 状态,工具开始为我们收集每一帧的总耗时(包含 CPU 和 GPU 耗时)。此时点击 ⏸ 按钮会为我们展示收集到的耗时信息 18 | 19 | ![image.png](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/a36915b137e14d1e9d4e9bbbe7f5bd6c~tplv-k3u1fbpfcp-watermark.image) 20 | 21 | 柱状图顶部为我们展示收集到的数据里:**最大耗时**、**平均耗时**、以及**总耗时**(单位:毫秒) 22 | 23 | 在下方,我将页面流畅度划为了四个级别:**流畅(蓝色)**、**良好(黄色)**、**轻微卡顿(粉色)**、**卡顿(红色)**,将 FPS 折算成一帧所消耗的时间,不同级别采用不一样的颜色,统计不同级别出现的次数。 24 | 25 | 上面的例子中,我们可以看到,工具一共收集了 99 帧,最大耗时的一帧花了119ms,平均耗时:32.9 ms,总耗时:3259.5 ms。其中认为有 40 帧流畅,25 帧良好,38 帧轻微卡顿,6 帧卡顿。 26 | 27 | 28 | 29 | *** 30 | 31 | ## 二、Why you need this 为什么你需要这个工具? 32 | 33 | ### 1、为什么我没选择 PerformanceOverLay 和 DoKit? 34 | 看到上面的功能可能有人有疑惑,你这功能咋和 PerformanceOverLay 这么类似? 35 | 36 | 首先,我在使用 PerformanceOverLay 的时候遇到了一点问题: 37 | 38 | 39 | ![image.png](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/151f8e7f24ae4f09a3583c7e173bbf6c~tplv-k3u1fbpfcp-watermark.image) 40 | 41 | 如图,PerformanceOverLay 上分别为我们展示了构建(UI)耗时和渲染(GPU)耗时。 42 | 43 | 我遇到的第一个问题是,因为我们在判断流畅度的时候,**往往是看一帧的总耗时**。这样拆分之后,一帧的耗时变成了上下的和,对我而言很不直观。 44 | 45 | 其次,这里面提供`最大耗时`或者`平均耗时`并不能很好的帮助我们量化页面的流畅程度。因为这个统计过程,会直接将一帧的耗时进行平均,这就带来一个问题。我们知道对于60刷新率的设备,两帧的间隔时间最小应该是 16.7ms,而 PerformanceOverLay 的收集过程没有对数据过滤,会出现一帧耗时小于 16.7ms,这就导致平均数据可能偏低。(下图平均一帧耗时为:10.6ms 60HZ设备) 46 | ![image.png](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/3289936d52424f7797f43634837148ce~tplv-k3u1fbpfcp-watermark.image) 47 | 48 | 其实这样来看,DoKit是一个不错的选择 49 | 50 | ![image.png](https://p1-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/57838121f69d4694b7ee074bbb7d1e19~tplv-k3u1fbpfcp-watermark.image) 51 | 52 | 但DoKit同样没有对最小帧耗时做过滤,也会出现平均耗时偏低的情况。同时,没有更多的数据辅助评估页面的流畅程度。 53 | 54 | 上面我遇到的情况,不一定是问题,只是我在使用过程中觉得不太直观,不太方便。 55 | 56 | 因此开发了这个工具,该工具具有以下特点 57 | 58 | 59 | ![image.png](https://p6-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/fde2765e3e944dbf98e90a2ffea75fad~tplv-k3u1fbpfcp-watermark.image) 60 | 61 | 同时支持设置最大采集帧数 62 | 63 | ### 2、我是如何理解页面流畅度 64 | 65 | 我在上一期[ListView流畅度翻倍!!Flutter卡顿分析和通用优化方案](https://juejin.cn/post/6940134891606507534)有解释过 66 | 67 | 对于大部分人而言,当每秒的画面达到60,也就是俗称**60FPS**的时候,整个过程就是流畅的。 68 | 69 | ![](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/b309e9f3ffe8425abb5ba11f5ef1f669~tplv-k3u1fbpfcp-zoom-1.image) 70 | 71 | 一秒 60 帧,也就意味着平均两帧之间的间隔为 16.7ms。那么耗时大于 16.7ms 就会觉得卡顿么? 72 | 73 | 答案当然是 NO。腾讯在 [Martrix](https://github.com/Tencent/matrix/wiki/Matrix-Android-TraceCanary) 中也提到 74 | 75 | >我们平时看到的大部分电影或视频 FPS 其实不高,一般只有 25FPS ~ 30FPS,而实际上我们也没有觉得卡顿。 在人眼结构上看,当一组动作在 1 秒内有 12 次变化(即 12FPS),我们会认为这组动作是连贯的 76 | 77 | 其实流畅度本身就是一个很主观的东西,就好比有人觉得打王者荣耀不开高帧率好像也还算流畅,有人觉得不开高帧率那不就是个GIF图么。 78 | 79 | 有没有客观一点的指标,我在网上查询了很久之后找到了一篇08年发表在ICIP上的论文[Modeling the impact of frame rate on perceptual quality of video 80 | ](https://www.researchgate.net/profile/Zhan-Ma-6/publication/224359119_Modeling_the_impact_of_frame_rate_on_perceptual_quality_of_video/links/00b7d514f3b347250e000000/Modeling-the-impact-of-frame-rate-on-perceptual-quality-of-video.pdf) 他们使用了6种内容进行测试,实验结果如下图所示 81 | 82 | ![image.png](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/3dbfc676b92e48ecbcddfb08d9da8a6e~tplv-k3u1fbpfcp-watermark.image) 83 | 84 | 通过该图我们可以看出,当帧率大于15帧的时候,人眼的主观感受差别不大,基本上都处于较高的水平。而帧率小于15帧以后,人眼的主观感受会急剧下降。换句话说,人眼会立刻感受到画面的不连贯性。 85 | 86 | 87 | 因此,在工具中我将低于16.7ms的数据统一成16.7ms,所以这个检测工具只在刷新率为60的设备有意义。并且将流畅度划分为了以下等级: 88 | 89 | * 流畅:FPS大于55,即一帧耗时低于 18ms 90 | * 良好:FPS在30-55之间,即一帧耗时在 18ms-33ms 之间 91 | * 轻微卡顿:FPS在15-30之间,即一帧耗时在 33ms-67ms 之间 92 | * 卡顿:FPS低于15,即一帧耗时大于 66.7ms 93 | 94 | 并统计出现的次数,你可以根据这几项数据,对比优化前后的数据,得出性能的提升情况;当然也可以制定一个理想的流畅度。例如:流畅的帧数占统计帧数的90%,或者卡顿的帧数不超过5次。 95 | 96 | *** 97 | 98 | ## 三、How to use it 如何使用? 99 | ### 1、项目依赖 100 | dependencies: 101 | fps_monitor: ^1.12.13-1 102 | ### 2、接入工程 103 | 有两处接入点 104 | 105 | * 指定overLayState ,因为需要弹出一个Fps的统计页面,所以当前指定overLayState。 106 | **(PS:大家一般使用Navigator.of(context)去跳转一个页面,通过GlobalKey可以实现无context的跳转)** 107 | 108 | ![image.png](https://p1-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/800dd3bb2e4c402db6d66758ad6154e2~tplv-k3u1fbpfcp-watermark.image) 109 | ```dart 110 | ///声明NavigatorState的GlobalKey 111 | GlobalKey globalKey = GlobalKey(); 112 | ///获取overLayState 113 | SchedulerBinding.instance.addPostFrameCallback((t) => 114 | overlayState =globalKey.currentState.overlay 115 | ); 116 | ///指定MaterialApp的navigatorKey 117 | navigatorKey: globalKey, 118 | 119 | ``` 120 | 121 | * 在build属性中包裹组件 122 | 123 | ![image.png](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/5770b6ef7ede429c95176e1eceb858b6~tplv-k3u1fbpfcp-watermark.image) 124 | 125 | ```dart 126 | builder: (ctx, child) => 127 | CustomWidgetInspector( 128 | child: child, 129 | ), 130 | ``` 131 | 132 | ### 3、如何使用 133 | 在完成了上述步骤之后,你只需要启动app,**该工具只会在profile/debug模式下集成**,在你的右下角会出现一个 ⏯ 按钮,点击开始记录,再次点击显示数据。 134 | 135 | ![Screenrecording_20210405_171133.gif](https://p1-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/4b13856e7c274513ac488f2959877786~tplv-k3u1fbpfcp-watermark.image) 136 | 137 | 如果想要结束采集,点击面板中的停止监听即可。 138 | 139 | 如果你想采集更多的帧,可以通过`kFpsInfoMaxSize`设置 140 | 141 | ![Screenrecording_20210405_171154.gif](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/373a7a22b17d4b308eacaaaa933a3358~tplv-k3u1fbpfcp-watermark.image) 142 | 143 | ### 4、Warning: 144 | 145 | 空安全之前 请使用 1.12.13-2 分支 146 | 空安全后 使用 2.0.0 分支 147 | 148 | *** 149 | 150 | ### 四、how do it 来点原理? 151 | 152 | 可能你会对这个工具的检测原理感兴趣,那咱们再来唠两句原理。 153 | 154 | #### 绘制数据的获取 155 | ```dart 156 | WidgetsBinding.instance.addTimingsCallback(monitor); 157 | ``` 158 | Flutter 会在每帧完成绘制后,会将耗时进行回调。耗时体现在三个变量上:1、构建时间;2、绘制时间;3、总时间。当你点击 ⏯ 按钮的时候,工具便开始采集耗时信息。 159 | 160 | 其实对于 Flutter 相关的渲染调度,推荐大家看看 `SchedulerBinding` ,里面写得再详细不过。 161 | 162 | #### 显示Fps界面 163 | 164 | 显示 Fps 的页面比较简单,直接通过 OverlayState 插入即可。如果你不太熟悉 Overlay 可以把它理解成浮窗。其中的表格绘制通过使用 DoKit 的自定义画笔实现,当然也可替换成各种开源的图表库。 165 | 166 | *** 167 | ## 最后 感谢各位吴彦祖和彭于晏的点赞,Start,和Follow 168 | 169 | 如果你觉得这个工具还不错,点个赞支持一下吧~ 170 | 171 | 最后附上我的: 172 | 173 | 掘金主页:[Nayuta]( https://juejin.cn/user/4309694831660711) 174 | 175 | 176 | 欢迎搜索公众号:**进击的Flutter或者runflutter** 里面整理收集了最详细的 Flutter 进阶与优化指南。关注我,获取我的最新文章~ 177 | 178 | 179 | ![1361617636891_.pic.jpg](https://p6-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/dd8c5b194fe244d7a8b56a68e254a4fb~tplv-k3u1fbpfcp-watermark.image) 180 | 181 | 182 | 如果使用过程有问题可以直接通过公众号私信我~ 183 | -------------------------------------------------------------------------------- /example/.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 | .dart_tool/ 26 | .flutter-plugins 27 | .flutter-plugins-dependencies 28 | .packages 29 | .pub-cache/ 30 | .pub/ 31 | /build/ 32 | 33 | # Web related 34 | lib/generated_plugin_registrant.dart 35 | 36 | # Exceptions to above rules. 37 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 38 | -------------------------------------------------------------------------------- /example/.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: f139b11009aeb8ed2a3a3aa8b0066e482709dde3 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # example 2 | 3 | A new Flutter project. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) 13 | 14 | For help getting started with Flutter, view our 15 | [online documentation](https://flutter.dev/docs), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion 28 30 | 31 | sourceSets { 32 | main.java.srcDirs += 'src/main/kotlin' 33 | } 34 | 35 | lintOptions { 36 | disable 'InvalidPackage' 37 | } 38 | 39 | defaultConfig { 40 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 41 | applicationId "com.example.example" 42 | minSdkVersion 16 43 | targetSdkVersion 28 44 | versionCode flutterVersionCode.toInteger() 45 | versionName flutterVersionName 46 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 47 | } 48 | 49 | buildTypes { 50 | release { 51 | // TODO: Add your own signing config for the release build. 52 | // Signing with the debug keys for now, so `flutter run --release` works. 53 | signingConfig signingConfigs.debug 54 | } 55 | } 56 | } 57 | 58 | flutter { 59 | source '../..' 60 | } 61 | 62 | dependencies { 63 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 64 | testImplementation 'junit:junit:4.12' 65 | androidTestImplementation 'androidx.test:runner:1.1.1' 66 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' 67 | } 68 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 8 | 12 | 19 | 20 | 21 | 22 | 23 | 24 | 26 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /example/android/app/src/main/kotlin/com/example/example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.example 2 | 3 | import androidx.annotation.NonNull; 4 | import io.flutter.embedding.android.FlutterActivity 5 | import io.flutter.embedding.engine.FlutterEngine 6 | import io.flutter.plugins.GeneratedPluginRegistrant 7 | 8 | class MainActivity: FlutterActivity() { 9 | override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) { 10 | GeneratedPluginRegistrant.registerWith(flutterEngine); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nayuta403/fps_monitor/5e1b6ec707d34e71fc68a367a382dbe3ed643996/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nayuta403/fps_monitor/5e1b6ec707d34e71fc68a367a382dbe3ed643996/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nayuta403/fps_monitor/5e1b6ec707d34e71fc68a367a382dbe3ed643996/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nayuta403/fps_monitor/5e1b6ec707d34e71fc68a367a382dbe3ed643996/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nayuta403/fps_monitor/5e1b6ec707d34e71fc68a367a382dbe3ed643996/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.3.50' 3 | repositories { 4 | google() 5 | jcenter() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:3.5.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | jcenter() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.enableR8=true 3 | android.useAndroidX=true 4 | android.enableJetifier=true 5 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip 7 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() 4 | 5 | def plugins = new Properties() 6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') 7 | if (pluginsFile.exists()) { 8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } 9 | } 10 | 11 | plugins.each { name, path -> 12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() 13 | include ":$name" 14 | project(":$name").projectDir = pluginDirectory 15 | } 16 | -------------------------------------------------------------------------------- /example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 13 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 14 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 15 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; 16 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 17 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 18 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 19 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXCopyFilesBuildPhase section */ 23 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 24 | isa = PBXCopyFilesBuildPhase; 25 | buildActionMask = 2147483647; 26 | dstPath = ""; 27 | dstSubfolderSpec = 10; 28 | files = ( 29 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, 30 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, 31 | ); 32 | name = "Embed Frameworks"; 33 | runOnlyForDeploymentPostprocessing = 0; 34 | }; 35 | /* End PBXCopyFilesBuildPhase section */ 36 | 37 | /* Begin PBXFileReference section */ 38 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 39 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 40 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 41 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; 42 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 43 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 44 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 45 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 46 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 47 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 48 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 49 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 50 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 51 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 52 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 53 | /* End PBXFileReference section */ 54 | 55 | /* Begin PBXFrameworksBuildPhase section */ 56 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 57 | isa = PBXFrameworksBuildPhase; 58 | buildActionMask = 2147483647; 59 | files = ( 60 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, 61 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, 62 | ); 63 | runOnlyForDeploymentPostprocessing = 0; 64 | }; 65 | /* End PBXFrameworksBuildPhase section */ 66 | 67 | /* Begin PBXGroup section */ 68 | 9740EEB11CF90186004384FC /* Flutter */ = { 69 | isa = PBXGroup; 70 | children = ( 71 | 3B80C3931E831B6300D905FE /* App.framework */, 72 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 73 | 9740EEBA1CF902C7004384FC /* Flutter.framework */, 74 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 75 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 76 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 77 | ); 78 | name = Flutter; 79 | sourceTree = ""; 80 | }; 81 | 97C146E51CF9000F007C117D = { 82 | isa = PBXGroup; 83 | children = ( 84 | 9740EEB11CF90186004384FC /* Flutter */, 85 | 97C146F01CF9000F007C117D /* Runner */, 86 | 97C146EF1CF9000F007C117D /* Products */, 87 | ); 88 | sourceTree = ""; 89 | }; 90 | 97C146EF1CF9000F007C117D /* Products */ = { 91 | isa = PBXGroup; 92 | children = ( 93 | 97C146EE1CF9000F007C117D /* Runner.app */, 94 | ); 95 | name = Products; 96 | sourceTree = ""; 97 | }; 98 | 97C146F01CF9000F007C117D /* Runner */ = { 99 | isa = PBXGroup; 100 | children = ( 101 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 102 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 103 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 104 | 97C147021CF9000F007C117D /* Info.plist */, 105 | 97C146F11CF9000F007C117D /* Supporting Files */, 106 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 107 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 108 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 109 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 110 | ); 111 | path = Runner; 112 | sourceTree = ""; 113 | }; 114 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 115 | isa = PBXGroup; 116 | children = ( 117 | ); 118 | name = "Supporting Files"; 119 | sourceTree = ""; 120 | }; 121 | /* End PBXGroup section */ 122 | 123 | /* Begin PBXNativeTarget section */ 124 | 97C146ED1CF9000F007C117D /* Runner */ = { 125 | isa = PBXNativeTarget; 126 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 127 | buildPhases = ( 128 | 9740EEB61CF901F6004384FC /* Run Script */, 129 | 97C146EA1CF9000F007C117D /* Sources */, 130 | 97C146EB1CF9000F007C117D /* Frameworks */, 131 | 97C146EC1CF9000F007C117D /* Resources */, 132 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 133 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 134 | ); 135 | buildRules = ( 136 | ); 137 | dependencies = ( 138 | ); 139 | name = Runner; 140 | productName = Runner; 141 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 142 | productType = "com.apple.product-type.application"; 143 | }; 144 | /* End PBXNativeTarget section */ 145 | 146 | /* Begin PBXProject section */ 147 | 97C146E61CF9000F007C117D /* Project object */ = { 148 | isa = PBXProject; 149 | attributes = { 150 | LastUpgradeCheck = 1020; 151 | ORGANIZATIONNAME = "The Chromium Authors"; 152 | TargetAttributes = { 153 | 97C146ED1CF9000F007C117D = { 154 | CreatedOnToolsVersion = 7.3.1; 155 | LastSwiftMigration = 1100; 156 | }; 157 | }; 158 | }; 159 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 160 | compatibilityVersion = "Xcode 3.2"; 161 | developmentRegion = en; 162 | hasScannedForEncodings = 0; 163 | knownRegions = ( 164 | en, 165 | Base, 166 | ); 167 | mainGroup = 97C146E51CF9000F007C117D; 168 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 169 | projectDirPath = ""; 170 | projectRoot = ""; 171 | targets = ( 172 | 97C146ED1CF9000F007C117D /* Runner */, 173 | ); 174 | }; 175 | /* End PBXProject section */ 176 | 177 | /* Begin PBXResourcesBuildPhase section */ 178 | 97C146EC1CF9000F007C117D /* Resources */ = { 179 | isa = PBXResourcesBuildPhase; 180 | buildActionMask = 2147483647; 181 | files = ( 182 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 183 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 184 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 185 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 186 | ); 187 | runOnlyForDeploymentPostprocessing = 0; 188 | }; 189 | /* End PBXResourcesBuildPhase section */ 190 | 191 | /* Begin PBXShellScriptBuildPhase section */ 192 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 193 | isa = PBXShellScriptBuildPhase; 194 | buildActionMask = 2147483647; 195 | files = ( 196 | ); 197 | inputPaths = ( 198 | ); 199 | name = "Thin Binary"; 200 | outputPaths = ( 201 | ); 202 | runOnlyForDeploymentPostprocessing = 0; 203 | shellPath = /bin/sh; 204 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; 205 | }; 206 | 9740EEB61CF901F6004384FC /* Run Script */ = { 207 | isa = PBXShellScriptBuildPhase; 208 | buildActionMask = 2147483647; 209 | files = ( 210 | ); 211 | inputPaths = ( 212 | ); 213 | name = "Run Script"; 214 | outputPaths = ( 215 | ); 216 | runOnlyForDeploymentPostprocessing = 0; 217 | shellPath = /bin/sh; 218 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 219 | }; 220 | /* End PBXShellScriptBuildPhase section */ 221 | 222 | /* Begin PBXSourcesBuildPhase section */ 223 | 97C146EA1CF9000F007C117D /* Sources */ = { 224 | isa = PBXSourcesBuildPhase; 225 | buildActionMask = 2147483647; 226 | files = ( 227 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 228 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 229 | ); 230 | runOnlyForDeploymentPostprocessing = 0; 231 | }; 232 | /* End PBXSourcesBuildPhase section */ 233 | 234 | /* Begin PBXVariantGroup section */ 235 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 236 | isa = PBXVariantGroup; 237 | children = ( 238 | 97C146FB1CF9000F007C117D /* Base */, 239 | ); 240 | name = Main.storyboard; 241 | sourceTree = ""; 242 | }; 243 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 244 | isa = PBXVariantGroup; 245 | children = ( 246 | 97C147001CF9000F007C117D /* Base */, 247 | ); 248 | name = LaunchScreen.storyboard; 249 | sourceTree = ""; 250 | }; 251 | /* End PBXVariantGroup section */ 252 | 253 | /* Begin XCBuildConfiguration section */ 254 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 255 | isa = XCBuildConfiguration; 256 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 257 | buildSettings = { 258 | ALWAYS_SEARCH_USER_PATHS = NO; 259 | CLANG_ANALYZER_NONNULL = YES; 260 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 261 | CLANG_CXX_LIBRARY = "libc++"; 262 | CLANG_ENABLE_MODULES = YES; 263 | CLANG_ENABLE_OBJC_ARC = YES; 264 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 265 | CLANG_WARN_BOOL_CONVERSION = YES; 266 | CLANG_WARN_COMMA = YES; 267 | CLANG_WARN_CONSTANT_CONVERSION = YES; 268 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 269 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 270 | CLANG_WARN_EMPTY_BODY = YES; 271 | CLANG_WARN_ENUM_CONVERSION = YES; 272 | CLANG_WARN_INFINITE_RECURSION = YES; 273 | CLANG_WARN_INT_CONVERSION = YES; 274 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 275 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 276 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 277 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 278 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 279 | CLANG_WARN_STRICT_PROTOTYPES = YES; 280 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 281 | CLANG_WARN_UNREACHABLE_CODE = YES; 282 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 283 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 284 | COPY_PHASE_STRIP = NO; 285 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 286 | ENABLE_NS_ASSERTIONS = NO; 287 | ENABLE_STRICT_OBJC_MSGSEND = YES; 288 | GCC_C_LANGUAGE_STANDARD = gnu99; 289 | GCC_NO_COMMON_BLOCKS = YES; 290 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 291 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 292 | GCC_WARN_UNDECLARED_SELECTOR = YES; 293 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 294 | GCC_WARN_UNUSED_FUNCTION = YES; 295 | GCC_WARN_UNUSED_VARIABLE = YES; 296 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 297 | MTL_ENABLE_DEBUG_INFO = NO; 298 | SDKROOT = iphoneos; 299 | SUPPORTED_PLATFORMS = iphoneos; 300 | TARGETED_DEVICE_FAMILY = "1,2"; 301 | VALIDATE_PRODUCT = YES; 302 | }; 303 | name = Profile; 304 | }; 305 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 306 | isa = XCBuildConfiguration; 307 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 308 | buildSettings = { 309 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 310 | CLANG_ENABLE_MODULES = YES; 311 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 312 | ENABLE_BITCODE = NO; 313 | FRAMEWORK_SEARCH_PATHS = ( 314 | "$(inherited)", 315 | "$(PROJECT_DIR)/Flutter", 316 | ); 317 | INFOPLIST_FILE = Runner/Info.plist; 318 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 319 | LIBRARY_SEARCH_PATHS = ( 320 | "$(inherited)", 321 | "$(PROJECT_DIR)/Flutter", 322 | ); 323 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example; 324 | PRODUCT_NAME = "$(TARGET_NAME)"; 325 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 326 | SWIFT_VERSION = 5.0; 327 | VERSIONING_SYSTEM = "apple-generic"; 328 | }; 329 | name = Profile; 330 | }; 331 | 97C147031CF9000F007C117D /* Debug */ = { 332 | isa = XCBuildConfiguration; 333 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 334 | buildSettings = { 335 | ALWAYS_SEARCH_USER_PATHS = NO; 336 | CLANG_ANALYZER_NONNULL = YES; 337 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 338 | CLANG_CXX_LIBRARY = "libc++"; 339 | CLANG_ENABLE_MODULES = YES; 340 | CLANG_ENABLE_OBJC_ARC = YES; 341 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 342 | CLANG_WARN_BOOL_CONVERSION = YES; 343 | CLANG_WARN_COMMA = YES; 344 | CLANG_WARN_CONSTANT_CONVERSION = YES; 345 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 346 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 347 | CLANG_WARN_EMPTY_BODY = YES; 348 | CLANG_WARN_ENUM_CONVERSION = YES; 349 | CLANG_WARN_INFINITE_RECURSION = YES; 350 | CLANG_WARN_INT_CONVERSION = YES; 351 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 352 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 353 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 354 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 355 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 356 | CLANG_WARN_STRICT_PROTOTYPES = YES; 357 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 358 | CLANG_WARN_UNREACHABLE_CODE = YES; 359 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 360 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 361 | COPY_PHASE_STRIP = NO; 362 | DEBUG_INFORMATION_FORMAT = dwarf; 363 | ENABLE_STRICT_OBJC_MSGSEND = YES; 364 | ENABLE_TESTABILITY = YES; 365 | GCC_C_LANGUAGE_STANDARD = gnu99; 366 | GCC_DYNAMIC_NO_PIC = NO; 367 | GCC_NO_COMMON_BLOCKS = YES; 368 | GCC_OPTIMIZATION_LEVEL = 0; 369 | GCC_PREPROCESSOR_DEFINITIONS = ( 370 | "DEBUG=1", 371 | "$(inherited)", 372 | ); 373 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 374 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 375 | GCC_WARN_UNDECLARED_SELECTOR = YES; 376 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 377 | GCC_WARN_UNUSED_FUNCTION = YES; 378 | GCC_WARN_UNUSED_VARIABLE = YES; 379 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 380 | MTL_ENABLE_DEBUG_INFO = YES; 381 | ONLY_ACTIVE_ARCH = YES; 382 | SDKROOT = iphoneos; 383 | TARGETED_DEVICE_FAMILY = "1,2"; 384 | }; 385 | name = Debug; 386 | }; 387 | 97C147041CF9000F007C117D /* Release */ = { 388 | isa = XCBuildConfiguration; 389 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 390 | buildSettings = { 391 | ALWAYS_SEARCH_USER_PATHS = NO; 392 | CLANG_ANALYZER_NONNULL = YES; 393 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 394 | CLANG_CXX_LIBRARY = "libc++"; 395 | CLANG_ENABLE_MODULES = YES; 396 | CLANG_ENABLE_OBJC_ARC = YES; 397 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 398 | CLANG_WARN_BOOL_CONVERSION = YES; 399 | CLANG_WARN_COMMA = YES; 400 | CLANG_WARN_CONSTANT_CONVERSION = YES; 401 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 402 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 403 | CLANG_WARN_EMPTY_BODY = YES; 404 | CLANG_WARN_ENUM_CONVERSION = YES; 405 | CLANG_WARN_INFINITE_RECURSION = YES; 406 | CLANG_WARN_INT_CONVERSION = YES; 407 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 408 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 409 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 410 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 411 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 412 | CLANG_WARN_STRICT_PROTOTYPES = YES; 413 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 414 | CLANG_WARN_UNREACHABLE_CODE = YES; 415 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 416 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 417 | COPY_PHASE_STRIP = NO; 418 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 419 | ENABLE_NS_ASSERTIONS = NO; 420 | ENABLE_STRICT_OBJC_MSGSEND = YES; 421 | GCC_C_LANGUAGE_STANDARD = gnu99; 422 | GCC_NO_COMMON_BLOCKS = YES; 423 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 424 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 425 | GCC_WARN_UNDECLARED_SELECTOR = YES; 426 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 427 | GCC_WARN_UNUSED_FUNCTION = YES; 428 | GCC_WARN_UNUSED_VARIABLE = YES; 429 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 430 | MTL_ENABLE_DEBUG_INFO = NO; 431 | SDKROOT = iphoneos; 432 | SUPPORTED_PLATFORMS = iphoneos; 433 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 434 | TARGETED_DEVICE_FAMILY = "1,2"; 435 | VALIDATE_PRODUCT = YES; 436 | }; 437 | name = Release; 438 | }; 439 | 97C147061CF9000F007C117D /* Debug */ = { 440 | isa = XCBuildConfiguration; 441 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 442 | buildSettings = { 443 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 444 | CLANG_ENABLE_MODULES = YES; 445 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 446 | ENABLE_BITCODE = NO; 447 | FRAMEWORK_SEARCH_PATHS = ( 448 | "$(inherited)", 449 | "$(PROJECT_DIR)/Flutter", 450 | ); 451 | INFOPLIST_FILE = Runner/Info.plist; 452 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 453 | LIBRARY_SEARCH_PATHS = ( 454 | "$(inherited)", 455 | "$(PROJECT_DIR)/Flutter", 456 | ); 457 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example; 458 | PRODUCT_NAME = "$(TARGET_NAME)"; 459 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 460 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 461 | SWIFT_VERSION = 5.0; 462 | VERSIONING_SYSTEM = "apple-generic"; 463 | }; 464 | name = Debug; 465 | }; 466 | 97C147071CF9000F007C117D /* Release */ = { 467 | isa = XCBuildConfiguration; 468 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 469 | buildSettings = { 470 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 471 | CLANG_ENABLE_MODULES = YES; 472 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 473 | ENABLE_BITCODE = NO; 474 | FRAMEWORK_SEARCH_PATHS = ( 475 | "$(inherited)", 476 | "$(PROJECT_DIR)/Flutter", 477 | ); 478 | INFOPLIST_FILE = Runner/Info.plist; 479 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 480 | LIBRARY_SEARCH_PATHS = ( 481 | "$(inherited)", 482 | "$(PROJECT_DIR)/Flutter", 483 | ); 484 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example; 485 | PRODUCT_NAME = "$(TARGET_NAME)"; 486 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 487 | SWIFT_VERSION = 5.0; 488 | VERSIONING_SYSTEM = "apple-generic"; 489 | }; 490 | name = Release; 491 | }; 492 | /* End XCBuildConfiguration section */ 493 | 494 | /* Begin XCConfigurationList section */ 495 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 496 | isa = XCConfigurationList; 497 | buildConfigurations = ( 498 | 97C147031CF9000F007C117D /* Debug */, 499 | 97C147041CF9000F007C117D /* Release */, 500 | 249021D3217E4FDB00AE95B9 /* Profile */, 501 | ); 502 | defaultConfigurationIsVisible = 0; 503 | defaultConfigurationName = Release; 504 | }; 505 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 506 | isa = XCConfigurationList; 507 | buildConfigurations = ( 508 | 97C147061CF9000F007C117D /* Debug */, 509 | 97C147071CF9000F007C117D /* Release */, 510 | 249021D4217E4FDB00AE95B9 /* Profile */, 511 | ); 512 | defaultConfigurationIsVisible = 0; 513 | defaultConfigurationName = Release; 514 | }; 515 | /* End XCConfigurationList section */ 516 | }; 517 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 518 | } 519 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nayuta403/fps_monitor/5e1b6ec707d34e71fc68a367a382dbe3ed643996/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nayuta403/fps_monitor/5e1b6ec707d34e71fc68a367a382dbe3ed643996/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nayuta403/fps_monitor/5e1b6ec707d34e71fc68a367a382dbe3ed643996/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nayuta403/fps_monitor/5e1b6ec707d34e71fc68a367a382dbe3ed643996/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nayuta403/fps_monitor/5e1b6ec707d34e71fc68a367a382dbe3ed643996/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nayuta403/fps_monitor/5e1b6ec707d34e71fc68a367a382dbe3ed643996/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nayuta403/fps_monitor/5e1b6ec707d34e71fc68a367a382dbe3ed643996/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nayuta403/fps_monitor/5e1b6ec707d34e71fc68a367a382dbe3ed643996/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nayuta403/fps_monitor/5e1b6ec707d34e71fc68a367a382dbe3ed643996/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nayuta403/fps_monitor/5e1b6ec707d34e71fc68a367a382dbe3ed643996/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nayuta403/fps_monitor/5e1b6ec707d34e71fc68a367a382dbe3ed643996/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nayuta403/fps_monitor/5e1b6ec707d34e71fc68a367a382dbe3ed643996/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nayuta403/fps_monitor/5e1b6ec707d34e71fc68a367a382dbe3ed643996/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nayuta403/fps_monitor/5e1b6ec707d34e71fc68a367a382dbe3ed643996/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nayuta403/fps_monitor/5e1b6ec707d34e71fc68a367a382dbe3ed643996/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nayuta403/fps_monitor/5e1b6ec707d34e71fc68a367a382dbe3ed643996/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nayuta403/fps_monitor/5e1b6ec707d34e71fc68a367a382dbe3ed643996/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nayuta403/fps_monitor/5e1b6ec707d34e71fc68a367a382dbe3ed643996/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | example 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/scheduler.dart'; 3 | import 'package:fps_monitor/widget/custom_widget_inspector.dart'; 4 | 5 | void main() => runApp(MyApp()); 6 | 7 | class MyApp extends StatelessWidget { 8 | // This widget is the root of your application. 9 | @override 10 | Widget build(BuildContext context) { 11 | GlobalKey globalKey = GlobalKey(); 12 | WidgetsBinding.instance.addPostFrameCallback((t) { 13 | overlayState = globalKey.currentState.overlay; 14 | }); 15 | return MaterialApp( 16 | navigatorKey: globalKey, 17 | title: 'Flutter Demo', 18 | builder: (ctx, child) => CustomWidgetInspector( 19 | child: child, 20 | ), 21 | theme: ThemeData( 22 | // This is the theme of your application. 23 | // 24 | // Try running your application with "flutter run". You'll see the 25 | // application has a blue toolbar. Then, without quitting the app, try 26 | // changing the primarySwatch below to Colors.green and then invoke 27 | // "hot reload" (press "r" in the console where you ran "flutter run", 28 | // or simply save your changes to "hot reload" in a Flutter IDE). 29 | // Notice that the counter didn't reset back to zero; the application 30 | // is not restarted. 31 | primarySwatch: Colors.blue, 32 | ), 33 | home: MyHomePage(title: 'Flutter Demo Home Page'), 34 | ); 35 | } 36 | } 37 | 38 | class MyHomePage extends StatefulWidget { 39 | MyHomePage({Key key, this.title}) : super(key: key); 40 | 41 | // This widget is the home page of your application. It is stateful, meaning 42 | // that it has a State object (defined below) that contains fields that affect 43 | // how it looks. 44 | 45 | // This class is the configuration for the state. It holds the values (in this 46 | // case the title) provided by the parent (in this case the App widget) and 47 | // used by the build method of the State. Fields in a Widget subclass are 48 | // always marked "final". 49 | 50 | final String title; 51 | 52 | @override 53 | _MyHomePageState createState() => _MyHomePageState(); 54 | } 55 | 56 | class _MyHomePageState extends State { 57 | int _counter = 0; 58 | 59 | void _incrementCounter() { 60 | setState(() { 61 | // This call to setState tells the Flutter framework that something has 62 | // changed in this State, which causes it to rerun the build method below 63 | // so that the display can reflect the updated values. If we changed 64 | // _counter without calling setState(), then the build method would not be 65 | // called again, and so nothing would appear to happen. 66 | _counter++; 67 | }); 68 | } 69 | 70 | @override 71 | Widget build(BuildContext context) { 72 | // This method is rerun every time setState is called, for instance as done 73 | // by the _incrementCounter method above. 74 | // 75 | // The Flutter framework has been optimized to make rerunning build methods 76 | // fast, so that you can just rebuild anything that needs updating rather 77 | // than having to individually change instances of widgets. 78 | return Scaffold( 79 | appBar: AppBar( 80 | // Here we take the value from the MyHomePage object that was created by 81 | // the App.build method, and use it to set our appbar title. 82 | title: Text(widget.title), 83 | ), 84 | body: Center( 85 | // Center is a layout widget. It takes a single child and positions it 86 | // in the middle of the parent. 87 | child: Column( 88 | // Column is also a layout widget. It takes a list of children and 89 | // arranges them vertically. By default, it sizes itself to fit its 90 | // children horizontally, and tries to be as tall as its parent. 91 | // 92 | // Invoke "debug painting" (press "p" in the console, choose the 93 | // "Toggle Debug Paint" action from the Flutter Inspector in Android 94 | // Studio, or the "Toggle Debug Paint" command in Visual Studio Code) 95 | // to see the wireframe for each widget. 96 | // 97 | // Column has various properties to control how it sizes itself and 98 | // how it positions its children. Here we use mainAxisAlignment to 99 | // center the children vertically; the main axis here is the vertical 100 | // axis because Columns are vertical (the cross axis would be 101 | // horizontal). 102 | mainAxisAlignment: MainAxisAlignment.center, 103 | children: [ 104 | Text( 105 | 'You have pushed the button this many times:', 106 | ), 107 | Text( 108 | '$_counter', 109 | style: Theme.of(context).textTheme.display1, 110 | ), 111 | FloatingActionButton( 112 | onPressed: _incrementCounter, 113 | tooltip: 'Increment', 114 | child: Icon(Icons.add), 115 | ) 116 | ], 117 | ), 118 | ), 119 | ); 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /example/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | url: "http://pub.ke.com" 9 | source: hosted 10 | version: "2.5.0" 11 | boolean_selector: 12 | dependency: transitive 13 | description: 14 | name: boolean_selector 15 | url: "http://pub.ke.com" 16 | source: hosted 17 | version: "2.1.0" 18 | characters: 19 | dependency: transitive 20 | description: 21 | name: characters 22 | url: "http://pub.ke.com" 23 | source: hosted 24 | version: "1.1.0" 25 | charcode: 26 | dependency: transitive 27 | description: 28 | name: charcode 29 | url: "http://pub.ke.com" 30 | source: hosted 31 | version: "1.2.0" 32 | clock: 33 | dependency: transitive 34 | description: 35 | name: clock 36 | url: "http://pub.ke.com" 37 | source: hosted 38 | version: "1.1.0" 39 | collection: 40 | dependency: transitive 41 | description: 42 | name: collection 43 | url: "http://pub.ke.com" 44 | source: hosted 45 | version: "1.15.0" 46 | cupertino_icons: 47 | dependency: "direct main" 48 | description: 49 | name: cupertino_icons 50 | url: "http://pub.ke.com" 51 | source: hosted 52 | version: "0.1.3" 53 | fake_async: 54 | dependency: transitive 55 | description: 56 | name: fake_async 57 | url: "http://pub.ke.com" 58 | source: hosted 59 | version: "1.2.0" 60 | flutter: 61 | dependency: "direct main" 62 | description: flutter 63 | source: sdk 64 | version: "0.0.0" 65 | flutter_test: 66 | dependency: "direct dev" 67 | description: flutter 68 | source: sdk 69 | version: "0.0.0" 70 | fps_monitor: 71 | dependency: "direct main" 72 | description: 73 | path: ".." 74 | relative: true 75 | source: path 76 | version: "2.0.0" 77 | matcher: 78 | dependency: transitive 79 | description: 80 | name: matcher 81 | url: "http://pub.ke.com" 82 | source: hosted 83 | version: "0.12.10" 84 | meta: 85 | dependency: transitive 86 | description: 87 | name: meta 88 | url: "http://pub.ke.com" 89 | source: hosted 90 | version: "1.3.0" 91 | path: 92 | dependency: transitive 93 | description: 94 | name: path 95 | url: "http://pub.ke.com" 96 | source: hosted 97 | version: "1.8.0" 98 | sky_engine: 99 | dependency: transitive 100 | description: flutter 101 | source: sdk 102 | version: "0.0.99" 103 | source_span: 104 | dependency: transitive 105 | description: 106 | name: source_span 107 | url: "http://pub.ke.com" 108 | source: hosted 109 | version: "1.8.0" 110 | stack_trace: 111 | dependency: transitive 112 | description: 113 | name: stack_trace 114 | url: "http://pub.ke.com" 115 | source: hosted 116 | version: "1.10.0" 117 | stream_channel: 118 | dependency: transitive 119 | description: 120 | name: stream_channel 121 | url: "http://pub.ke.com" 122 | source: hosted 123 | version: "2.1.0" 124 | string_scanner: 125 | dependency: transitive 126 | description: 127 | name: string_scanner 128 | url: "http://pub.ke.com" 129 | source: hosted 130 | version: "1.1.0" 131 | term_glyph: 132 | dependency: transitive 133 | description: 134 | name: term_glyph 135 | url: "http://pub.ke.com" 136 | source: hosted 137 | version: "1.2.0" 138 | test_api: 139 | dependency: transitive 140 | description: 141 | name: test_api 142 | url: "http://pub.ke.com" 143 | source: hosted 144 | version: "0.2.19" 145 | typed_data: 146 | dependency: transitive 147 | description: 148 | name: typed_data 149 | url: "http://pub.ke.com" 150 | source: hosted 151 | version: "1.3.0" 152 | vector_math: 153 | dependency: transitive 154 | description: 155 | name: vector_math 156 | url: "http://pub.ke.com" 157 | source: hosted 158 | version: "2.1.0" 159 | sdks: 160 | dart: ">=2.12.0 <3.0.0" 161 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: example 2 | description: A new Flutter project. 3 | 4 | # The following defines the version and build number for your application. 5 | # A version number is three numbers separated by dots, like 1.2.43 6 | # followed by an optional build number separated by a +. 7 | # Both the version and the builder number may be overridden in flutter 8 | # build by specifying --build-name and --build-number, respectively. 9 | # In Android, build-name is used as versionName while build-number used as versionCode. 10 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 11 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. 12 | # Read more about iOS versioning at 13 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 14 | version: 1.0.0+1 15 | 16 | environment: 17 | sdk: ">=2.1.0 <3.0.0" 18 | 19 | dependencies: 20 | flutter: 21 | sdk: flutter 22 | 23 | # The following adds the Cupertino Icons font to your application. 24 | # Use with the CupertinoIcons class for iOS style icons. 25 | cupertino_icons: ^0.1.2 26 | fps_monitor: 27 | path: ../ 28 | 29 | dev_dependencies: 30 | flutter_test: 31 | sdk: flutter 32 | 33 | 34 | # For information on the generic Dart part of this file, see the 35 | # following page: https://dart.dev/tools/pub/pubspec 36 | 37 | # The following section is specific to Flutter. 38 | flutter: 39 | 40 | # The following line ensures that the Material Icons font is 41 | # included with your application, so that you can use the icons in 42 | # the material Icons class. 43 | uses-material-design: true 44 | 45 | # To add assets to your application, add an assets section, like this: 46 | # assets: 47 | # - images/a_dot_burr.jpeg 48 | # - images/a_dot_ham.jpeg 49 | 50 | # An image asset can refer to one or more resolution-specific "variants", see 51 | # https://flutter.dev/assets-and-images/#resolution-aware. 52 | 53 | # For details regarding adding assets from package dependencies, see 54 | # https://flutter.dev/assets-and-images/#from-packages 55 | 56 | # To add custom fonts to your application, add a fonts section here, 57 | # in this "flutter" section. Each entry in this list should have a 58 | # "family" key with the font family name, and a "fonts" key with a 59 | # list giving the asset and other descriptors for the font. For 60 | # example: 61 | # fonts: 62 | # - family: Schyler 63 | # fonts: 64 | # - asset: fonts/Schyler-Regular.ttf 65 | # - asset: fonts/Schyler-Italic.ttf 66 | # style: italic 67 | # - family: Trajan Pro 68 | # fonts: 69 | # - asset: fonts/TrajanPro.ttf 70 | # - asset: fonts/TrajanPro_Bold.ttf 71 | # weight: 700 72 | # 73 | # For details regarding fonts from package dependencies, 74 | # see https://flutter.dev/custom-fonts/#from-packages 75 | -------------------------------------------------------------------------------- /example/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:example/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(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 | -------------------------------------------------------------------------------- /lib/bean/fps_info.dart: -------------------------------------------------------------------------------- 1 | class FpsInfo { 2 | double? totalSpan; 3 | String? pageName; 4 | double? buildDuration; 5 | double? rasterDuration; 6 | 7 | double? getValue() { 8 | return totalSpan; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /lib/util/collection_util.dart: -------------------------------------------------------------------------------- 1 | import 'dart:collection'; 2 | 3 | import 'package:fps_monitor/bean/fps_info.dart'; 4 | 5 | int kFpsInfoMaxSize = 100; 6 | 7 | /// Fps 信息存储 8 | class CommonStorage { 9 | static CommonStorage? _instance; 10 | 11 | static CommonStorage? get instance { 12 | if (_instance == null) { 13 | _instance = CommonStorage._(); 14 | } 15 | return _instance; 16 | } 17 | 18 | CommonStorage._(); 19 | 20 | int maxCount = kFpsInfoMaxSize; 21 | Queue items = new Queue(); 22 | double? max = 0; 23 | double totalNum = 0; 24 | 25 | List getAll() { 26 | return items.toList(); 27 | } 28 | 29 | void clear() { 30 | items.clear(); 31 | max = 0; 32 | totalNum = 0; 33 | } 34 | 35 | bool save(FpsInfo info) { 36 | if (items.length >= maxCount) { 37 | totalNum -= items.removeFirst().totalSpan!; 38 | } 39 | items.add(info); 40 | totalNum += info.totalSpan!; 41 | max = info.totalSpan! > max! ? info.totalSpan : max; 42 | return true; 43 | } 44 | 45 | num getAvg() { 46 | return totalNum / items.length; 47 | } 48 | 49 | bool contains(FpsInfo info) { 50 | return items.contains(info); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /lib/widget/custom_widget_inspector.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/foundation.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter/rendering.dart'; 4 | import 'package:flutter/widgets.dart'; 5 | 6 | import 'performance_observer_widget.dart'; 7 | 8 | const double _kInspectButtonMargin = 10.0; 9 | const double _kErrorReminderButtonMargin = 40.0; 10 | late OverlayState overlayState; 11 | 12 | class CustomWidgetInspector extends StatefulWidget { 13 | /// 展示性能监控数据 14 | static bool debugShowPerformanceMonitor = true; 15 | 16 | /// Creates a widget that enables inspection for the child. 17 | /// 18 | /// The [child] argument must not be null. 19 | const CustomWidgetInspector({Key? key, required this.child}) 20 | : assert(child != null), 21 | super(key: key); 22 | 23 | /// The widget that is being inspected. 24 | final Widget child; 25 | 26 | @override 27 | _CustomWidgetInspectorState createState() => _CustomWidgetInspectorState(); 28 | } 29 | 30 | class _CustomWidgetInspectorState extends State { 31 | /// Distance from the edge of the bounding box for an element to consider 32 | /// as selecting the edge of the bounding box. 33 | 34 | final GlobalKey rootGlobalKey = GlobalKey(); 35 | final InspectorSelection selection = 36 | WidgetInspectorService.instance.selection; 37 | 38 | @override 39 | Widget build(BuildContext context) { 40 | Widget child = widget.child; 41 | 42 | //release模式不打开FPS监控 43 | if (bool.fromEnvironment("dart.vm.product")) return child; 44 | 45 | Widget performanceObserver = Container(); 46 | 47 | if (CustomWidgetInspector.debugShowPerformanceMonitor) { 48 | performanceObserver = PerformanceObserverWidget(); 49 | } 50 | 51 | if (CustomWidgetInspector.debugShowPerformanceMonitor) { 52 | child = Stack( 53 | alignment: AlignmentDirectional.topStart, 54 | children: [ 55 | IgnorePointer( 56 | ignoring: false, 57 | key: rootGlobalKey, 58 | child: child, 59 | ), 60 | Positioned( 61 | right: _kInspectButtonMargin, 62 | bottom: _kErrorReminderButtonMargin, 63 | child: performanceObserver, 64 | ) 65 | ], 66 | ); 67 | } 68 | return child; 69 | } 70 | 71 | @override 72 | void dispose() { 73 | super.dispose(); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /lib/widget/fps_chart.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:fps_monitor/bean/fps_info.dart'; 4 | import 'package:fps_monitor/util/collection_util.dart'; 5 | 6 | class BarChartPainter extends CustomPainter { 7 | List datas; 8 | 9 | BarChartPainter({required this.datas}); 10 | 11 | @override 12 | bool shouldRepaint(BarChartPainter oldDelegate) => true; 13 | 14 | @override 15 | bool shouldRebuildSemantics(BarChartPainter oldDelegate) => false; 16 | 17 | void _drawAxis(Canvas canvas, Size size) { 18 | final double sw = size.width; 19 | final double sh = size.height; 20 | 21 | // 使用 Paint 定义路径的样式 22 | final Paint paint = Paint() 23 | ..color = Color(0xffdddddd) 24 | ..style = PaintingStyle.stroke 25 | ..strokeWidth = 0.5; 26 | 27 | // 使用 Path 定义绘制的路径,从画布的左上角到左下角在到右下角 28 | final Path path = Path() 29 | ..moveTo(0, 0) 30 | ..lineTo(0, sh) 31 | ..lineTo(sw, sh); 32 | 33 | // 使用 drawPath 方法绘制路径 34 | canvas.drawPath(path, paint); 35 | } 36 | 37 | void _drawLabels(Canvas canvas, Size size) { 38 | double labelFontSize = 10; 39 | final double sh = size.height; 40 | final List yAxisLabels = []; 41 | 42 | yAxisLabels.add(16); 43 | yAxisLabels.add(33); 44 | yAxisLabels.add(66); 45 | yAxisLabels.add(100); 46 | 47 | yAxisLabels.asMap().forEach( 48 | (index, label) { 49 | // 标识的高度为画布高度减去标识的值 50 | final double top = sh - label * 2.5; 51 | // final rect = Rect.fromLTWH(0, top, 4, 1); 52 | final Offset textOffset = Offset( 53 | 0 - (label.toInt().toString().length == 3 ? 24 : 20).toDouble(), 54 | top - labelFontSize / 2, 55 | ); 56 | 57 | // 绘制文字需要用 `TextPainter`,最后调用 paint 方法绘制文字 58 | TextPainter( 59 | text: TextSpan( 60 | text: label.toStringAsFixed(0), 61 | style: TextStyle(fontSize: labelFontSize, color: Color(0xff4a4b5b)), 62 | ), 63 | textAlign: TextAlign.right, 64 | textDirection: TextDirection.ltr, 65 | textWidthBasis: TextWidthBasis.longestLine, 66 | ) 67 | ..layout(minWidth: 0, maxWidth: 24) 68 | ..paint(canvas, textOffset); 69 | }, 70 | ); 71 | } 72 | 73 | void _drawBars(Canvas canvas, Size size) { 74 | final sh = size.height; 75 | final paint = Paint()..style = PaintingStyle.fill; 76 | final double marginLeft = 7.5; 77 | double _barWidth = (size.width / CommonStorage.instance!.maxCount); 78 | double _barGap = 0; 79 | int A = 0; 80 | int B = 0; 81 | int C = 0; 82 | int D = 0; 83 | 84 | for (int i = 0; i < datas.length; i++) { 85 | int value = datas[i].getValue()!.toInt(); 86 | 87 | if (value > 66) { 88 | D++; 89 | } else if (value > 33) { 90 | C++; 91 | } else if (value > 18) { 92 | B++; 93 | } else { 94 | A++; 95 | } 96 | paint.color = value <= 18 97 | ? Color(0xff55a8fd) 98 | : value <= 33 99 | ? Color(0xfffad337) 100 | : value <= 66 ? Color(0xFFF48FB1) : Color(0xFFD32F2F); 101 | // 矩形的上边缘为画布高度减去数据值 102 | final double top = sh - value * 2.5; 103 | // 矩形的左边缘为当前索引值乘以矩形宽度加上矩形之间的间距 104 | final double left = marginLeft + i * _barWidth + (i * _barGap) + _barGap; 105 | 106 | // 使用 Rect.fromLTWH 方法创建要绘制的矩形 107 | final rect = Rect.fromLTWH(left, top, _barWidth, value * 2.5.toDouble()); 108 | // 使用 drawRect 方法绘制矩形 109 | canvas.drawRect(rect, paint); 110 | } 111 | TextPainter( 112 | text: TextSpan( 113 | text: "流畅:$A 良好:$B 轻微卡顿:$C 卡顿:$D", 114 | style: TextStyle(fontSize: 10, color: Color(0xff4a4b5b)), 115 | ), 116 | textAlign: TextAlign.right, 117 | textDirection: TextDirection.ltr, 118 | textWidthBasis: TextWidthBasis.longestLine, 119 | ) 120 | ..layout( 121 | minWidth: 0, 122 | ) 123 | ..paint(canvas, Offset.zero); 124 | } 125 | 126 | @override 127 | void paint(Canvas canvas, Size size) { 128 | _drawAxis(canvas, size); 129 | _drawLabels(canvas, size); 130 | _drawBars(canvas, size); 131 | } 132 | } 133 | 134 | class FpsBarChart extends StatefulWidget { 135 | final List data; 136 | 137 | const FpsBarChart({ 138 | required this.data, 139 | }); 140 | 141 | @override 142 | _FpsBarChartState createState() => _FpsBarChartState(); 143 | } 144 | 145 | class _FpsBarChartState extends State 146 | with TickerProviderStateMixin { 147 | @override 148 | Widget build(BuildContext context) { 149 | double width = MediaQuery.of(context).orientation == Orientation.portrait 150 | ? MediaQuery.of(context).size.width - 56 151 | : MediaQuery.of(context).size.width - 30; 152 | double height = MediaQuery.of(context).orientation == Orientation.portrait 153 | ? MediaQuery.of(context).size.height - 500 154 | : MediaQuery.of(context).size.height - 200; 155 | return Column( 156 | mainAxisAlignment: MainAxisAlignment.center, 157 | children: [ 158 | Container( 159 | margin: EdgeInsets.only(top: 40, left: 24), 160 | child: CustomPaint( 161 | painter: BarChartPainter(datas: widget.data), 162 | child: Container( 163 | width: width, 164 | height: height, 165 | ), 166 | ), 167 | ) 168 | ], 169 | ); 170 | } 171 | } 172 | -------------------------------------------------------------------------------- /lib/widget/fps_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:fps_monitor/bean/fps_info.dart'; 3 | import 'package:fps_monitor/util/collection_util.dart'; 4 | 5 | import 'fps_chart.dart'; 6 | 7 | class FpsPage extends StatefulWidget { 8 | @override 9 | State createState() { 10 | return FpsPageState(); 11 | } 12 | } 13 | 14 | class FpsPageState extends State { 15 | @override 16 | Widget build(BuildContext context) { 17 | List list = CommonStorage.instance!.getAll(); 18 | return Container( 19 | width: MediaQuery.of(context).size.width, 20 | child: Column( 21 | mainAxisAlignment: MainAxisAlignment.start, 22 | children: [ 23 | Container( 24 | height: 44, 25 | padding: const EdgeInsets.only(left: 20, right: 20), 26 | child: Row( 27 | mainAxisAlignment: MainAxisAlignment.spaceAround, 28 | children: [ 29 | info('近${CommonStorage.instance!.items.length}帧'), 30 | info('最大耗时:${CommonStorage.instance!.max!.toStringAsFixed(1)}'), 31 | info( 32 | '平均耗时:${CommonStorage.instance!.getAvg().toStringAsFixed(1)}'), 33 | info( 34 | '总耗时:${CommonStorage.instance!.totalNum.toStringAsFixed(1)}') 35 | ], 36 | )), 37 | Divider( 38 | height: 0.5, 39 | color: Color(0xffdddddd), 40 | indent: 16, 41 | endIndent: 16, 42 | ), 43 | FpsBarChart(data: list) 44 | ], 45 | ), 46 | ); 47 | } 48 | 49 | Widget info(String text) { 50 | return Text("$text", 51 | style: const TextStyle( 52 | color: Colors.grey, 53 | fontWeight: FontWeight.normal, 54 | fontFamily: 'PingFang SC', 55 | fontSize: 9)); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /lib/widget/performance_observer_widget.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | import 'dart:ui'; 3 | 4 | import 'package:flutter/material.dart'; 5 | import 'package:fps_monitor/bean/fps_info.dart'; 6 | import 'package:fps_monitor/util/collection_util.dart'; 7 | import 'package:fps_monitor/widget/custom_widget_inspector.dart'; 8 | 9 | import 'fps_page.dart'; 10 | 11 | class PerformanceObserverWidget extends StatefulWidget { 12 | const PerformanceObserverWidget({Key? key}) : super(key: key); 13 | 14 | @override 15 | _PerformanceObserverWidgetState createState() => 16 | _PerformanceObserverWidgetState(); 17 | } 18 | 19 | class _PerformanceObserverWidgetState extends State { 20 | bool startRecording = false; 21 | bool fpsPageShowing = false; 22 | 23 | late ValueNotifier controller; 24 | late Function(List) monitor; 25 | OverlayEntry? fpsInfoPage; 26 | OverlayEntry? performancePage; 27 | 28 | @override 29 | void initState() { 30 | super.initState(); 31 | controller = ValueNotifier(""); 32 | monitor = (timings) { 33 | double duration = 0; 34 | timings.forEach((element) { 35 | FrameTiming frameTiming = element; 36 | duration = frameTiming.totalSpan.inMilliseconds.toDouble(); 37 | FpsInfo fpsInfo = new FpsInfo(); 38 | fpsInfo.totalSpan = max(16.7, duration); 39 | CommonStorage.instance!.save(fpsInfo); 40 | }); 41 | }; 42 | } 43 | 44 | @override 45 | void dispose() { 46 | stop(); 47 | super.dispose(); 48 | } 49 | 50 | void start() { 51 | WidgetsBinding.instance!.addTimingsCallback(monitor); 52 | } 53 | 54 | void stop() { 55 | WidgetsBinding.instance!.removeTimingsCallback(monitor); 56 | } 57 | 58 | @override 59 | Widget build(BuildContext context) { 60 | return Column( 61 | children: [ 62 | GestureDetector( 63 | child: RepaintBoundary( 64 | child: ValueListenableBuilder( 65 | valueListenable: controller, 66 | builder: (context, dynamic snapshot, _) { 67 | return Container( 68 | color: Colors.white, 69 | child: !startRecording 70 | ? Icon(Icons.play_arrow) 71 | : fpsPageShowing ? Row() : Icon(Icons.pause), 72 | ); 73 | }), 74 | ), 75 | onTap: () { 76 | fpsMonitor(); 77 | }, 78 | ) 79 | ], 80 | ); 81 | } 82 | 83 | void fpsMonitor() { 84 | if (!startRecording) { 85 | setState(() { 86 | start(); 87 | startRecording = true; 88 | controller.value = startRecording; 89 | }); 90 | } else { 91 | if (!fpsPageShowing) { 92 | stop(); 93 | if (fpsInfoPage == null) { 94 | fpsInfoPage = OverlayEntry(builder: (c) { 95 | return Scaffold( 96 | body: Column( 97 | children: [ 98 | Expanded( 99 | child: GestureDetector( 100 | onTap: () { 101 | fpsInfoPage!.remove(); 102 | fpsPageShowing = false; 103 | start(); 104 | }, 105 | child: Container( 106 | color: Color(0x33999999), 107 | ), 108 | )), 109 | Container( 110 | color: Colors.white, 111 | child: Column( 112 | children: [ 113 | FpsPage(), 114 | Divider(), 115 | Container( 116 | padding: const EdgeInsets.only( 117 | left: 20, top: 20, bottom: 20), 118 | child: GestureDetector( 119 | child: Text( 120 | '停止监听', 121 | style: TextStyle(color: Colors.blue), 122 | ), 123 | onTap: () { 124 | startRecording = false; 125 | fpsInfoPage!.remove(); 126 | fpsPageShowing = false; 127 | CommonStorage.instance!.clear(); 128 | controller.value = startRecording; 129 | // setState(() {}); 130 | }, 131 | ), 132 | alignment: Alignment.bottomLeft, 133 | ), 134 | ], 135 | )), 136 | ], 137 | ), 138 | backgroundColor: Color(0x33999999), 139 | ); 140 | }); 141 | } 142 | fpsPageShowing = true; 143 | overlayState.insert(fpsInfoPage!); 144 | } 145 | } 146 | } 147 | } 148 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | url: "http://pub.ke.com" 9 | source: hosted 10 | version: "2.5.0" 11 | boolean_selector: 12 | dependency: transitive 13 | description: 14 | name: boolean_selector 15 | url: "http://pub.ke.com" 16 | source: hosted 17 | version: "2.1.0" 18 | characters: 19 | dependency: transitive 20 | description: 21 | name: characters 22 | url: "http://pub.ke.com" 23 | source: hosted 24 | version: "1.1.0" 25 | charcode: 26 | dependency: transitive 27 | description: 28 | name: charcode 29 | url: "http://pub.ke.com" 30 | source: hosted 31 | version: "1.2.0" 32 | clock: 33 | dependency: transitive 34 | description: 35 | name: clock 36 | url: "http://pub.ke.com" 37 | source: hosted 38 | version: "1.1.0" 39 | collection: 40 | dependency: transitive 41 | description: 42 | name: collection 43 | url: "http://pub.ke.com" 44 | source: hosted 45 | version: "1.15.0" 46 | fake_async: 47 | dependency: transitive 48 | description: 49 | name: fake_async 50 | url: "http://pub.ke.com" 51 | source: hosted 52 | version: "1.2.0" 53 | flutter: 54 | dependency: "direct main" 55 | description: flutter 56 | source: sdk 57 | version: "0.0.0" 58 | flutter_test: 59 | dependency: "direct dev" 60 | description: flutter 61 | source: sdk 62 | version: "0.0.0" 63 | matcher: 64 | dependency: transitive 65 | description: 66 | name: matcher 67 | url: "http://pub.ke.com" 68 | source: hosted 69 | version: "0.12.10" 70 | meta: 71 | dependency: transitive 72 | description: 73 | name: meta 74 | url: "http://pub.ke.com" 75 | source: hosted 76 | version: "1.3.0" 77 | path: 78 | dependency: transitive 79 | description: 80 | name: path 81 | url: "http://pub.ke.com" 82 | source: hosted 83 | version: "1.8.0" 84 | sky_engine: 85 | dependency: transitive 86 | description: flutter 87 | source: sdk 88 | version: "0.0.99" 89 | source_span: 90 | dependency: transitive 91 | description: 92 | name: source_span 93 | url: "http://pub.ke.com" 94 | source: hosted 95 | version: "1.8.0" 96 | stack_trace: 97 | dependency: transitive 98 | description: 99 | name: stack_trace 100 | url: "http://pub.ke.com" 101 | source: hosted 102 | version: "1.10.0" 103 | stream_channel: 104 | dependency: transitive 105 | description: 106 | name: stream_channel 107 | url: "http://pub.ke.com" 108 | source: hosted 109 | version: "2.1.0" 110 | string_scanner: 111 | dependency: transitive 112 | description: 113 | name: string_scanner 114 | url: "http://pub.ke.com" 115 | source: hosted 116 | version: "1.1.0" 117 | term_glyph: 118 | dependency: transitive 119 | description: 120 | name: term_glyph 121 | url: "http://pub.ke.com" 122 | source: hosted 123 | version: "1.2.0" 124 | test_api: 125 | dependency: transitive 126 | description: 127 | name: test_api 128 | url: "http://pub.ke.com" 129 | source: hosted 130 | version: "0.2.19" 131 | typed_data: 132 | dependency: transitive 133 | description: 134 | name: typed_data 135 | url: "http://pub.ke.com" 136 | source: hosted 137 | version: "1.3.0" 138 | vector_math: 139 | dependency: transitive 140 | description: 141 | name: vector_math 142 | url: "http://pub.ke.com" 143 | source: hosted 144 | version: "2.1.0" 145 | sdks: 146 | dart: ">=2.12.0 <3.0.0" 147 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: fps_monitor 2 | description: A flutter package can help you get the Fps information for your app . 3 | version: 2.0.0 4 | homepage: https://github.com/Nayuta403/fps_monitor 5 | 6 | environment: 7 | sdk: '>=2.12.0 <3.0.0' 8 | 9 | dependencies: 10 | flutter: 11 | sdk: flutter 12 | 13 | dev_dependencies: 14 | flutter_test: 15 | sdk: flutter 16 | 17 | # For information on the generic Dart part of this file, see the 18 | # following page: https://dart.dev/tools/pub/pubspec 19 | 20 | # The following section is specific to Flutter. 21 | flutter: 22 | 23 | # To add assets to your package, add an assets section, like this: 24 | # assets: 25 | # - images/a_dot_burr.jpeg 26 | # - images/a_dot_ham.jpeg 27 | # 28 | # For details regarding assets in packages, see 29 | # https://flutter.dev/assets-and-images/#from-packages 30 | # 31 | # An image asset can refer to one or more resolution-specific "variants", see 32 | # https://flutter.dev/assets-and-images/#resolution-aware. 33 | 34 | # To add custom fonts to your package, add a fonts section here, 35 | # in this "flutter" section. Each entry in this list should have a 36 | # "family" key with the font family name, and a "fonts" key with a 37 | # list giving the asset and other descriptors for the font. For 38 | # example: 39 | # fonts: 40 | # - family: Schyler 41 | # fonts: 42 | # - asset: fonts/Schyler-Regular.ttf 43 | # - asset: fonts/Schyler-Italic.ttf 44 | # style: italic 45 | # - family: Trajan Pro 46 | # fonts: 47 | # - asset: fonts/TrajanPro.ttf 48 | # - asset: fonts/TrajanPro_Bold.ttf 49 | # weight: 700 50 | # 51 | # For details regarding fonts in packages, see 52 | # https://flutter.dev/custom-fonts/#from-packages 53 | -------------------------------------------------------------------------------- /test/fps_monitor_test.dart: -------------------------------------------------------------------------------- 1 | 2 | void main() { 3 | } 4 | --------------------------------------------------------------------------------