Skip to content

Commit 6f0d11c

Browse files
authored
Merge pull request #459 from FlutterFlow/fix/update-add-dependency
Update Add Dependency
2 parents d88d978 + 5259cdb commit 6f0d11c

File tree

4 files changed

+33
-27
lines changed

4 files changed

+33
-27
lines changed

docs/ff-concepts/adding-customization/common-examples.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Use this approach only when the component is a fixed element that does not chang
6767
:::
6868

6969
In a **[Custom Widget](custom-widgets.md)**, you can integrate a previously built **[FlutterFlow Component](../../resources/ui/components/intro-components.md)** directly, saving you from recreating child content in code. For example, if you’re building a Custom Widget to display custom dialog boxes or bottom sheets using a package from
70-
[pub.dev](custom-code.md#pubdev), you can simply return an existing Component created on the canvas, rather than coding a new one from scratch.
70+
[pub.dev](https://pub.dev/), you can simply return an existing Component created on the canvas, rather than coding a new one from scratch.
7171

7272
:::tip[Imports]
7373
When referencing a Component class in your code, FlutterFlow will automatically add the necessary import statement.

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

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -263,14 +263,7 @@ In the generated code, descriptions are added as comments before the function de
263263
:::
264264

265265
## Adding a Pubspec Dependency
266-
To utilize community-built Flutter solutions in your FlutterFlow projects, you can add a "pubspec dependency". The **pubspec file** is the configuration file in Flutter projects that lists external packages or libraries, along with other project configurations.
267266

268-
269-
:::tip[Scope]
270-
You can only add a pubspec dependency to [**Custom Actions**](custom-actions.md) & [**Custom Widgets**](custom-widgets.md).
271-
:::
272-
273-
#### Pub.dev
274267
[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.
275268

276269
:::info[Flutter Favorite Packages]
@@ -281,17 +274,33 @@ You can explore the Flutter Favorite packages on **[pub.dev's Flutter Favorites
281274

282275
:::
283276

284-
To add a pubspec dependency from [**pub.dev**](#pubdev), follow these steps:
285-
286-
1. Create a new Custom Widget or Custom Action resource file, and be sure to give it a meaningful name.
277+
To add a pubspec dependency from pub.dev, go to **Settings and Integrations > Project Dependencies**, then open the **Custom Dependencies** tab. Click **Add Pub Dependency**, enter the **package name** and **version**, and click **Add** to include it in your project.
287278

288-
2. [**Generate the boilerplate code**](#generate-boilerplate-code) and copy the basic widget or function structure into the code editor.
289-
290-
3. Select the [**package you want from pub.dev**](#choosing-the-correct-package-from-pubdev) and review its details.
291-
292-
4. Copy the package name and version, and add them to the Custom Code settings in FlutterFlow. Then, copy the import statement and add it to the list of imports in the Custom Code resource. You can also copy example code from the Example tab on the package’s pub.dev page and modify it as needed — see more in the **[Setup Code](#setup-code)** section.
293-
294-
5. Click "Save & **[Compile Code](#compile-code)**" to apply the changes.
279+
<div style={{
280+
position: 'relative',
281+
paddingBottom: 'calc(56.67989417989418% + 41px)', // Keeps the aspect ratio and additional padding
282+
height: 0,
283+
width: '100%'}}>
284+
<iframe
285+
src="https://demo.arcade.software/oRtb2mYzh1fdRcgeoQjZ?embed&show_copy_link=true"
286+
title=""
287+
style={{
288+
position: 'absolute',
289+
top: 0,
290+
left: 0,
291+
width: '100%',
292+
height: '100%',
293+
colorScheme: 'light'
294+
}}
295+
frameborder="0"
296+
loading="lazy"
297+
webkitAllowFullScreen
298+
mozAllowFullScreen
299+
allowFullScreen
300+
allow="clipboard-write">
301+
</iframe>
302+
</div>
303+
<p></p>
295304

296305
### Choosing the correct package from pub.dev
297306

@@ -376,14 +385,13 @@ dependencies:
376385

377386
Here’s exactly how you do it:
378387

379-
380388
<div style={{
381389
position: 'relative',
382390
paddingBottom: 'calc(56.67989417989418% + 41px)', // Keeps the aspect ratio and additional padding
383391
height: 0,
384392
width: '100%'}}>
385393
<iframe
386-
src="https://demo.arcade.software/CgLCKJzdiCuaxMF04pg6?embed&show_copy_link=true"
394+
src="https://demo.arcade.software/KUqOcYwnQQ77uAcTA1dw?embed&show_copy_link=true"
387395
title=""
388396
style={{
389397
position: 'absolute',
@@ -424,7 +432,7 @@ To configure your custom code with the package, copy and paste the following ite
424432

425433
To use the dependency in your Custom Action or Custom Widget resource file, go to the package's pub.dev page and click the **Copy to Clipboard** icon next to the package name and version. Then, paste it into the **Pubspec Dependency** section (bottom right) of the FlutterFlow code editor.
426434

427-
![package-dependency-version-copy.png](imgs/package-dependency-version-copy.png)
435+
![package-dependency-version-copy](imgs/package-dependency-version-copy.avif)
428436

429437

430438
See **[example](#add-pubspec-dependency-to-custom-code-example-guide)** for more information.
@@ -469,7 +477,7 @@ FlutterFlow:
469477
width: '100%'
470478
}}>
471479
<iframe
472-
src="https://demo.arcade.software/EAqWwTSfjumXzJ3xB6FX?embed&show_copy_link=true"
480+
src="https://demo.arcade.software/e8vTIcA4EPju5XntsGiD?embed&show_copy_link=true"
473481
title=""
474482
style={{
475483
position: 'absolute',
@@ -496,11 +504,9 @@ This example demonstrates how to add a [**pub.dev**](https://pub.dev) package to
496504

497505
## Manage Dependencies
498506

499-
You can also add packages directly on the **Dependencies** page (at **Settings and Integrations > Project Setup > Project Dependencies**) and they will be reflected in your custom actions or custom widgets, because packages are managed at the project level.
500-
501-
Additionally, when you create a new custom action or widget, all previously added custom dependencies will be listed on the **Pubspec** **Dependencies** list on the right side. This ensures that you can easily track all custom dependencies in the project, avoiding duplication or conflicts that could override each other or cause project errors.
507+
You can manage dependencies directly from **Settings and Integrations > Project Dependencies** > **Custom Dependencies** tab.
502508

503-
If any project errors related to packages arise, they will be displayed in both the custom code editor and the Dependencies page. You can also update the version numbers of custom packages directly from the Dependencies page. This streamlined process helps maintain consistency and reduces potential issues related to custom packages.
509+
If version conflicts occur, warnings will appear in both the **Custom Dependencies** tab and the **Custom Code** editor. You can also bump package versions directly from the list, making it easier to resolve issues and keep dependencies consistent.
504510

505511
<div style={{
506512
position: 'relative',

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ FlutterFlow:
8080
width: '100%'
8181
}}>
8282
<iframe
83-
src="https://demo.arcade.software/EAqWwTSfjumXzJ3xB6FX?embed&show_copy_link=true"
83+
src="https://demo.arcade.software/e8vTIcA4EPju5XntsGiD?embed&show_copy_link=true"
8484
title=""
8585
style={{
8686
position: 'absolute',
Binary file not shown.

0 commit comments

Comments
 (0)