samples README

The project's README from github.com/flutter/samples. As one markdown file: README.md.

Flutter samples

Build Status

A collection of open source samples that illustrate best practices for Flutter.

Contributing

We appreciate fixes and necessary improvements to existing samples. But in most cases, we're not currently adding new samples to this repository while we rethink sample code in the new LLM world.

Please read the contributor's guide if you have contributions.

Googler's, you can freely add samples to the flutter/demos repository.

Index

Quickstarts

Native platform samples

Demo galleries

Demo apps

Flutter sample code

Samples are correct and concise code that developers can quickly understand and easily reuse with minimal side effects. Samples teach developers how to be successful using Flutter and Dart. They are maintained on an ongoing basis to reflect changing APIs and best practices.

Types of samples

There are two types of sample code in this repository:

A majority of samples in this repository are quickstarts.

Usage

Every sample in this repo is fully runnable. To run an example, use flutter run inside that example's directory. See the getting started guide to install the flutter tool.

[!IMPORTANT] If you want to run an add-to-app sample, there are additional requirements. We suggest reading the add-to-app documentation.

Interested in contributing?

See the contributor's guide!

Questions or issues?

If you have a general question about one of these samples or how to adapt its techniques for one of your own apps, try one of these resources:

If you run into a bug in one of the samples, please file an issue in the flutter/samples issue tracker.

samples (flutter/samples)

Searching Database…

19.3K ·GitHub
这是什么?一套开源的 Flutter 示例集合,用可运行的快速上手项目和应用演示来展示 Flutter 的最佳实践,涵盖组件、导航、着色器、测试,以及把 Flutter 嵌入原生应用。
这些是可以直接运行的完整应用,还是只能复制粘贴的代码片段?两者都有。大多数是快速上手示例,展示实现某个功能所需的最少代码;而 compassapp 和 veggieseasons 这类演示应用则是完整的应用,可以构建并运行。
我怎么把一个示例跑起来?先安装 Flutter 工具,然后在任意示例的目录里运行 'flutter run'——仓库里的每个示例都可以完整运行。
在能运行任何东西之前,我需要装好哪些东西?只需要 Flutter SDK 本身。add-to-app(嵌入现有应用)示例是例外——它们需要额外的 iOS 和 Android 原生工具,add-to-app 文档里有说明。
这个集合还会继续新增示例吗?基本不会——现有示例会继续修复和改进,但在团队重新思考大模型时代的示例代码之前,新示例暂时搁置;Google 员工会把新示例放到 flutter/demos 里。
这些示例是面向 Flutter 新手还是有经验的开发者?面向 Flutter 和 Dart 开发者——这些示例教你怎么用好这个框架,并持续维护,以跟上不断变化的 API 和最佳实践。
这些示例能跑在哪里——手机、桌面还是网页?主要是 iOS 和 Android 手机(两者都有 CI 构建),另外还有把 Flutter 嵌入网页应用的例子,以及一个采用 Material 和 FluentUI 风格的桌面图片搜索演示。
我能把 Flutter 嵌进我现有的 iOS 或 Android 应用吗?可以——add-to-app 示例涵盖了全屏嵌入、预构建模块和视图级集成;multipleflutters 还演示了如何借助 Engine Group API 以较低内存开销同时运行多个 Flutter 引擎。
Flutter 能嵌入到现有的网页里吗?可以——webembedding 示例展示了不借助 iframe 的元素级嵌入,从最基础的 hostElement 配置到完整的 Angular 组件封装都有。
着色器示例演示了什么?simpleshader 和 simplesdf 介绍了 Flutter 片元着色器,包括用 FragmentShader API 绘制有向距离场(Signed Distance Functions)。
有没有用到 Gemini API 的示例?有——dynamictheme 演示了如何根据 Gemini API 的输出调用设备端的 Flutter API。
Creator
flutter
Size
436.8 MB
Stars
19.3K
Updated
CommitOct 08
Age
8y
Commits · 90 Days