1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-08 13:58:47 +00:00
Files
samples/experimental/pedometer
dependabot[bot] 4c753b2a4a Bump fl_chart from 0.68.0 to 0.69.0 in /experimental/pedometer/example (#2399)
Bumps [fl_chart](https://github.com/imaNNeo/fl_chart) from 0.68.0 to
0.69.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/imaNNeo/fl_chart/releases">fl_chart's
releases</a>.</em></p>
<blockquote>
<h2>0.69.0</h2>
<ul>
<li><strong>BUGFIX</strong> (by <a
href="https://github.com/imaNNeo"><code>@​imaNNeo</code></a>) Fix a
memory leak issue in the axis-based charts, there was a logic to
calculate and cache the minX, maxX, minY and maxY properties to reduce
the computation cost. But it caused some memory issues, as we don't have
a quick solution for this, we disabled the caching logic for now, later
we can move the calculation logic to the render objects to keep and
update them only when the data is changed, <a
href="https://redirect.github.com/imaNNeo/fl_chart/issues/1106">#1106</a>,
<a
href="https://redirect.github.com/imaNNeo/fl_chart/issues/1693">#1693</a></li>
<li><strong>BUGFIX</strong> (by <a
href="https://github.com/imaNNeo"><code>@​imaNNeo</code></a>) Fix
showing grid lines even when there is no line to show in the LineChart,
<a
href="https://redirect.github.com/imaNNeo/fl_chart/issues/1691">#1691</a></li>
<li><strong>IMPROVEMENT</strong> (by <a
href="https://github.com/sczesla"><code>@​sczesla</code></a>) Allow
users to control minIncluded and maxIncluded using SideTitles, <a
href="https://redirect.github.com/imaNNeo/fl_chart/issues/906">#906</a></li>
<li><strong>IMPROVEMENT</strong> (by <a
href="https://github.com/elizabethzhenliu"><code>@​elizabethzhenliu</code></a>)
Reverse the touch order in ScatterChart, so now the top spots are
touched first, <a
href="https://redirect.github.com/imaNNeo/fl_chart/issues/1675">#1675</a></li>
<li><strong>IMPROVEMENT</strong> (by <a
href="https://github.com/ksw2000"><code>@​ksw2000</code></a>) Remove
redundant math import, <a
href="https://redirect.github.com/imaNNeo/fl_chart/issues/1683">#1683</a></li>
<li><strong>IMPROVEMENT</strong> (by <a
href="https://github.com/Neer-Pathak"><code>@​Neer-Pathak</code></a>)
Fix linux example build issue, <a
href="https://redirect.github.com/imaNNeo/fl_chart/issues/1668">#1668</a></li>
<li><strong>IMPROVEMENT</strong> (by <a
href="https://github.com/TobiasRump"><code>@​TobiasRump</code></a>)
Update the bar chart documentation, <a
href="https://redirect.github.com/imaNNeo/fl_chart/issues/1662">#1662</a></li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/imaNNeo/fl_chart/blob/main/CHANGELOG.md">fl_chart's
changelog</a>.</em></p>
<blockquote>
<h2>0.69.0</h2>
<ul>
<li><strong>BUGFIX</strong> (by <a
href="https://github.com/imaNNeo"><code>@​imaNNeo</code></a>) Fix a
memory leak issue in the axis-based charts, there was a logic to
calculate and cache the minX, maxX, minY and maxY properties to reduce
the computation cost. But it caused some memory issues, as we don't have
a quick solution for this, we disabled the caching logic for now, later
we can move the calculation logic to the render objects to keep and
update them only when the data is changed, <a
href="https://redirect.github.com/imaNNeo/fl_chart/issues/1106">#1106</a>,
<a
href="https://redirect.github.com/imaNNeo/fl_chart/issues/1693">#1693</a></li>
<li><strong>BUGFIX</strong> (by <a
href="https://github.com/imaNNeo"><code>@​imaNNeo</code></a>) Fix
showing grid lines even when there is no line to show in the LineChart,
<a
href="https://redirect.github.com/imaNNeo/fl_chart/issues/1691">#1691</a></li>
<li><strong>IMPROVEMENT</strong> (by <a
href="https://github.com/sczesla"><code>@​sczesla</code></a>) Allow
users to control minIncluded and maxIncluded using SideTitles, <a
href="https://redirect.github.com/imaNNeo/fl_chart/issues/906">#906</a></li>
<li><strong>IMPROVEMENT</strong> (by <a
href="https://github.com/elizabethzhenliu"><code>@​elizabethzhenliu</code></a>)
Reverse the touch order in ScatterChart, so now the top spots are
touched first, <a
href="https://redirect.github.com/imaNNeo/fl_chart/issues/1675">#1675</a></li>
<li><strong>IMPROVEMENT</strong> (by <a
href="https://github.com/ksw2000"><code>@​ksw2000</code></a>) Remove
redundant math import, <a
href="https://redirect.github.com/imaNNeo/fl_chart/issues/1683">#1683</a></li>
<li><strong>IMPROVEMENT</strong> (by <a
href="https://github.com/Neer-Pathak"><code>@​Neer-Pathak</code></a>)
Fix linux example build issue, <a
href="https://redirect.github.com/imaNNeo/fl_chart/issues/1668">#1668</a></li>
<li><strong>IMPROVEMENT</strong> (by <a
href="https://github.com/TobiasRump"><code>@​TobiasRump</code></a>)
Update the bar chart documentation, <a
href="https://redirect.github.com/imaNNeo/fl_chart/issues/1662">#1662</a></li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="a6c274ced0"><code>a6c274c</code></a>
Bump version to 0.69.0</li>
<li><a
href="b0a50a4c13"><code>b0a50a4</code></a>
Update CHANGELOG.md</li>
<li><a
href="f5af4e5152"><code>f5af4e5</code></a>
Update bar_chart.md to fix <a
href="https://redirect.github.com/imaNNeo/fl_chart/issues/1608">#1608</a></li>
<li><a
href="a6b2d24e60"><code>a6b2d24</code></a>
fix: Linux Example App Build</li>
<li><a
href="99ae675184"><code>99ae675</code></a>
Update CHANGELOG.md</li>
<li><a
href="37371d8bdc"><code>37371d8</code></a>
fixed touch detection to select topmost spot. Spots are rendered in
order so ...</li>
<li><a
href="5a9606bd68"><code>5a9606b</code></a>
Remove redundant import of 'dart:math'</li>
<li><a
href="9fc2628e36"><code>9fc2628</code></a>
Code formatting</li>
<li><a
href="39985b0f15"><code>39985b0</code></a>
Adding change <a
href="https://redirect.github.com/imaNNeo/fl_chart/issues/906">#906</a>
change to CHANGELOG</li>
<li><a
href="ed1bdcb1b0"><code>ed1bdcb</code></a>
Adding unit test to check forwarding of minIncluded/maxIncluded via
sideTitles</li>
<li>Additional commits viewable in <a
href="https://github.com/imaNNeo/fl_chart/compare/0.68.0...0.69.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=fl_chart&package-manager=pub&previous-version=0.68.0&new-version=0.69.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-29 12:09:20 +10:00
..
2023-01-24 10:31:12 +10:00
2023-01-24 10:31:12 +10:00

FFIgen + JNIgen pedometer

This is a demo for some of our tooling around calling platform APIs directly from dart code. This repository represents a demo of a plugin that leverages FFIgen & JNIgen. There is also an example pedometer app that uses the bindings generated from these tools.

  • FFIgen is used to generate bindings for C, Objective-C and Swift APIs.
  • JNIgen is used to generate bindings for Java and Kotlin APIs.

These tools are both experimental and are currently a work in progress. If you find any issues or have feedback, please file it on the corresponding GitHub repositories.

Re-generating bindings

The bindings that allow the Dart code to call the platform code have already been generated in the \lib folder. You can regenerate them by following the steps below:

FFIgen

Configuration of FFIgen for the CoreMotion framework is in the ffigen.yaml file. FFIgen currently does not support autogenerating code to handle callbacks. So, there are a few extra steps needed to appropriately handle callbacks in Objective-C. You can read more about this limitation on dart.dev.

dart run ffigen --config ffigen.yaml

JNIgen

Configuration of JNIgen for the HealthConnect API is in the jnigen.yaml file.

  1. Build an Android APK file from the example app. Currently, JNIgen requires at least one APK build to obtain the classpaths of Android Gradle libraries.

    cd example && flutter build apk
    
  2. Return to the /pedometer directory and run jnigen:

    cd .. && dart run jnigen --config jnigen.yaml
    

Running the example app

The example app is located in the /example directory, and the following commands assume they are being run from that location.

Note that step counting is only available on physical devices.

iOS

  • Run flutter run and choose your physical device.
  • Allow the pedometer app access to step counting.

Android

  • Make sure that Google Fit is installed (to ensure that steps are being counted).
  • Run flutter run and choose your physical device.
  • Install Health Connect and grant access to Google Fit and the jni_demo app.

Project structure

  • src: Contains the native source code, and a CMakeLists.txt file for building that source code into a dynamic library.

  • lib: Contains the Dart code that defines the API of the plugin and calls into the native code using dart:ffi.

  • platform folders (ios etc.): Contain the build files for building and bundling the native code library with the platform application.

  • example: Contains the native source code for building that source code into a dynamic library.