Skip to content

Commit ad1d93e

Browse files
committed
Merge branch 'refs/heads/main' into pooja/style-guide
# Conflicts: # docs/resources/data-representation/global-properties.md
2 parents 2573e48 + d63ea6e commit ad1d93e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1940
-143
lines changed

docs/ff-concepts/adding-customization/custom-actions.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,13 @@ Flow.
118118

119119
<p></p>
120120

121+
121122
:::tip[LOOKING for other CUSTOM action properties?]
122123
To learn more about Custom Action settings, such as the
123124
[**Exclude From Compilation toggle**](custom-code.md#exclude-from-compilation),
124125
[**Include Build Context toggle**](custom-code.md#include-buildcontext),
125126
and other properties like [**Callback Actions**](custom-code.md#add-a-callback-action),
126-
[**Pub Dependencies**](custom-code.md#adding-a-pub-dependency), please check out this
127+
[**Pubspec Dependencies**](custom-code.md#adding-a-pubspec-dependency), please check out this
127128
[**comprehensive guide**](custom-code.md).
128129
:::
129130

docs/ff-concepts/adding-customization/custom-code.md

Lines changed: 53 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -217,20 +217,24 @@ Here's an example of an Action that returns a _nullable_ integer.
217217

218218
![return-value-actions.png](imgs/return-value-actions.png)
219219

220-
#### Adding a Pub Dependency
220+
## Adding a Pubspec Dependency
221221

222222
:::tip[Scope]
223-
You can only add a pub dependency to Custom Action & Custom Widgets.
223+
You can only add a pubspec dependency to [**Custom Action**](custom-actions.md) & [**Custom Widgets**](custom-widgets.md).
224224
:::
225225

226-
If you plan to use a dependency from [*pub.dev*](https://pub.dev/) into a custom widget or action,
227-
you must go through the following steps:
226+
### Pub.dev
227+
[Pub.dev](https://pub.dev) is the official package repository for Dart and Flutter. It hosts a wide range of packages, libraries, and tools that developers can use to extend the functionality of their Dart and Flutter applications.
228228

229-
1. [Choosing dependency](#1-choosing-dependency)
230-
2. [Copying dependency/package name](#2-copying-dependency-name)
231-
3. [Copying import statement](#3-copying-import-statement)
229+
:::info[Flutter Favourite Packages]
232230

233-
##### 1. Choosing dependency
231+
Flutter Favorite packages are a curated set of packages on pub.dev that have been recognized by the Flutter team and the community for their quality, popularity, and usefulness in Flutter development. These packages are marked with a "Flutter Favorite" badge, indicating that they meet a high standard of quality, reliability, and best practices.
232+
233+
You can explore the Flutter Favorite packages on **[pub.dev's Flutter Favorites page](https://pub.dev/packages?q=is%3Aflutter-favorite)**.
234+
235+
:::
236+
237+
### Choosing the correct package from pub.dev
234238

235239
You will find varieties of dependencies for a specific requirement, and choosing the best one can be
236240
challenging. This section helps you identify the right dependency by examining its score.
@@ -257,7 +261,9 @@ one.
257261

258262
![Dependency-score.png](imgs/Dependency-score.png)
259263

260-
##### 2. Copying dependency name
264+
When adding a pubspec dependency to your custom code in FlutterFlow, you’ll need two pieces of information: the [package name with its version number](#copy-package-name--version-) and the [import statement](#copying-import-statement).
265+
266+
#### Copy Package Name & Version
261267

262268
To use the dependency code in our code editor, copy its name with the version. To do so, click
263269
the **Copy to Clipboard** icon.
@@ -278,7 +284,7 @@ section at the bottom right side.
278284

279285
![img_1.png](imgs/img_1.png)
280286

281-
##### 3. Copying import statement
287+
#### Copying import statement
282288

283289
An import statement points to where the dependency's code is located. When making a custom widget or
284290
action, place this statement at the beginning of the code editor.
@@ -288,7 +294,44 @@ the import statement. To copy, click the **Copy to Clipboard** icon.
288294

289295
![img_2.png](imgs/img_2.png)
290296

297+
### Add Pubspec Dependency to Custom Code: Guide
298+
In this example, we are using the
299+
[**flutter_rating_bar**](https://pub.dev/packages/flutter_rating_bar) dependency to create a
300+
`ProductRatingBar` custom widget for our
301+
Product pages. See how we utilize the example code from pub.dev and add the customized widget in
302+
FlutterFlow:
291303

304+
<div style={{
305+
position: 'relative',
306+
paddingBottom: 'calc(56.67989417989418% + 41px)', // Keeps the aspect ratio and additional padding
307+
height: 0,
308+
width: '100%'
309+
}}>
310+
<iframe
311+
src="https://demo.arcade.software/EAqWwTSfjumXzJ3xB6FX?embed&show_copy_link=true"
312+
title=""
313+
style={{
314+
position: 'absolute',
315+
top: 0,
316+
left: 0,
317+
width: '100%',
318+
height: '100%',
319+
colorScheme: 'light'
320+
}}
321+
frameborder="0"
322+
loading="lazy"
323+
webkitAllowFullScreen
324+
mozAllowFullScreen
325+
allowFullScreen
326+
allow="clipboard-write">
327+
</iframe>
328+
</div>
329+
330+
<p></p>
331+
332+
:::note
333+
This example demonstrates how to add a [pub.dev](https://pub.dev) package to a Custom Widget snippet, but you can follow the same process for adding a package to Custom Actions. For a deep dive, explore the detailed documentation on **[Custom Widgets](custom-widgets.md)** and [Custom Actions](custom-actions.md).
334+
:::
292335

293336

294337

docs/ff-concepts/adding-customization/custom-widgets.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ this example, we will create a `ProductRatingBar` widget that uses a pub.dev dep
6161

6262
For custom widgets, it is mandatory to specify both width and height. These properties are required to size the custom widget appropriately. Without setting these dimensions, the custom widget will not render correctly within your application.
6363

64-
## Adding a pub.dev dependency
64+
## Add Dependency to Custom Widgets
6565

6666
In this example, we are using the
6767
[**flutter_rating_bar**](https://pub.dev/packages/flutter_rating_bar) dependency to create a
@@ -95,6 +95,10 @@ FlutterFlow:
9595
</iframe>
9696
</div>
9797

98+
:::tip[Choosing a Pubspec Dependency]
99+
For a comprehensive guide on navigating external packages using pub.dev, evaluating packages, and making the best choices for your app, [**follow the guide**](custom-code.md#adding-a-pubspec-dependency).
100+
:::
101+
98102
## Using a Custom Widget
99103
To add a custom widget to your page, you can drag and drop it from the Widget Palette's Components section or through the Widget Tree section. Here is a demo:
100104

@@ -167,7 +171,7 @@ FlutterFlow also allows you to view your custom widget once it is successfully c
167171
To learn more about Custom Widget settings, such as the
168172
[**Exclude From Compilation toggle**](custom-code.md#exclude-from-compilation),
169173
and other properties like [**Callback Actions**](custom-code.md#add-a-callback-action),
170-
[**Pub Dependencies**](custom-code.md#adding-a-pub-dependency), please check out this
174+
[**Pub Dependencies**](custom-code.md#adding-a-pubspec-dependency), please check out this
171175
[**comprehensive guide**](custom-code.md).
172176
:::
173177

0 commit comments

Comments
 (0)