flutter / website

Flutter documentation web site
https://docs.flutter.dev
Other
2.82k stars 3.22k forks source link

Explain file structure for app on 'Exporting fonts from a package' page #6034

Open OpenTechConsult opened 3 years ago

OpenTechConsult commented 3 years ago

Page URL: https://docs.flutter.dev/cookbook/design/package-fonts Page source: https://github.com/flutter/website/tree/master/src/docs/cookbook/design/package-fonts.md

Description of issue:

I am trying to follow the recipe Export fonts from a package in the Cookbook, but I'm very confused about how to organize the whole project. The directories/files structures. Also, there is nowhere to find the complete source code of the project on GitHub for instance. I don't know if it's going to be two distinct projects or one project. Please help me out.

maheshj01 commented 3 years ago

Hi @OpenTechConsult, Thanks for filing the issue I do agree that couple of things are missing here.

Missing things

To answer your question.

The cookbook clearly mentions

This recipe uses the following steps: Add a font to a package. Add the package and font to the app. Use the font.

This basically means you will create a fonts package (name ="awesome_package"), The first step defines the structure of the package. This package will contain your fonts.

Once you have your package ready. You will place it in a packages directory in the root of your flutter project

folder Structure

 - flutterProject
    - packages/
           awesome_package/
    - lib/
          -main.dart
    - pubspec.yaml

And then you could simply add the fonts path in pubspec.yaml and use it as described in the cookbook.

Hope this helps.

Thank you.