Flutter web app for my personal website. Deployed at https://alejandrofernandez.pages.dev/.
To know how to set up this project for development, check INSTALL.md.
Common development tasks have been unified into single interface of npm scripts for convenience. GitHub Actions also use these scripts to automate the deployment process, so be mindful of the changes you make to them. Here are some of the most common tasks:
npm run upgrade-deps
npm run serve
Alternatively, you can run the server in release mode with
npm run serve:release
, which will build the project as in a production environment. This also allows to emulate Cloudflare R2 storage by adding files to a local database. For example:npx wrangler r2 object put cv-documents/alejandro_fernandez_cv-en.pdf --local --file ~/Sync/Personal/CV/alejandro_fernandez_cv-en.pdf
npm run lint
On first execution, the
shellcheck
binary is automatically downloaded.
npm run test
To evaluate the performance of this website, crucial for a good user experience, we recommend the Lighthouse tool. If you want to audit the webpage locally, open the Chrome Developer Tools in a local server:
npm run serve:release
npm run build:wasm
npm run build:html
You can also use the build
script and change the rendering engine with the BUILD_RENDERER
environment variable. For example, to build the project with the html
renderer, run:
BUILD_RENDERER=html npm run build
By default, the project is built with the
wasm
renderer.
To deploy the project to Cloudflare Pages, run:
npm run deploy
By default, the project is deployed to the current git
branch. If you want to deploy to another branch, use the DEPLOY_BRANCH
environment variable. For example, to deploy to the main
branch (production), run:
DEPLOY_BRANCH=main npm run deploy
To see the full list of tasks, check the scripts
section in the package.json file.
This project uses the Material Design system to create a consistent and visually appealing user interface. Follow the instructions in the Material Theme Builder to build your own Material theme. For more information, check the Material Design website.
Fonts are a great way to give a personalized look and feel to a webpage. Google Fonts offers a wide variety of free fonts that can be easily integrated into webpages.
There are two ways to use Google Fonts in a webpage. The first is to download the font files and host them on your server. The second is to use the Google Fonts API to load the fonts from Google's servers dynamically (see the google_fonts flutter
package for more information about this). The first method is recommended for privacy and performance reasons (especially if the webpage is served over a CDN).
-
Select the Fonts. Explore the Google Fonts website and decide which fonts (and which styles) you want to use.
-
Download the fonts in woff2 format. Use the
Get embed code
option to get a download link of the desired styles of the fonts in.woff2
format, which is web-optimized for performance. To download only a subset of the characters (and have smaller file sizes), check the Google Fonts API. For example, to download the Silkscreen font in.woff2
format and only the glyphs required for the text "Loading portfolio...", send a request to https://fonts.googleapis.com/css2?family=Silkscreen&text=Loading%20portfolio.... The link used to download the fonts of this project is https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,100..900;1,100..900&family=Silkscreen:wght@400;700&subset=latin. -
Convert the fonts to woff format. As of August 2024, the current stable version of Flutter does not support
.woff2
fonts. Therefore, the recommended option is to use the old web-optimized format:.woff
. It should be noted that.woff
is only supported on mobile and web platforms (but not on desktop). To convert the files we need to follow these steps:- Install the woff2 tool developed by Google (
woff2_decompress path/to/font.woff2
). - Use
woff2_decompress path/to/font.woff2
to decompress the.woff2
files to.ttf
. - Use an online tool like FontSquirrel WebFont Generator to convert the
.ttf
files to.woff
(use theBasic
preset). - Download the converted files.
Note: FontSquirrel does not support variable fonts. To use variable fonts with Flutter web, you need to stick with
.ttf
files. - Install the woff2 tool developed by Google (
The Roboto font is the default font used in Flutter. As of August 2024, it is not possible to prevent Flutter from trying to load the Roboto font. Currently, the best solution is to download the Roboto font and host it on your server.
For more information, check the following GitHub issues:
Most custom icons have been downloaded from Streamline or from Font Awesome.