{"id":13548363,"url":"https://github.com/monster555/flutter_web_loading_tips","last_synced_at":"2026-01-07T09:56:49.503Z","repository":{"id":197343285,"uuid":"698464823","full_name":"monster555/flutter_web_loading_tips","owner":"monster555","description":"Optimize the loading experience in Flutter Web with smooth progress bars and graceful transitions. Elevate user experience and professionalism in your Flutter Web applications.","archived":false,"fork":false,"pushed_at":"2024-10-23T20:07:53.000Z","size":55,"stargazers_count":36,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-03T17:39:18.654Z","etag":null,"topics":["animation","flutter","flutter-web","user-experience"],"latest_commit_sha":null,"homepage":"","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/monster555.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-30T02:19:56.000Z","updated_at":"2024-10-23T20:07:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"fc6de2dc-338a-4f9c-a2e9-4707dded8737","html_url":"https://github.com/monster555/flutter_web_loading_tips","commit_stats":null,"previous_names":["monster555/flutter_web_smooth_loading"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monster555%2Fflutter_web_loading_tips","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monster555%2Fflutter_web_loading_tips/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monster555%2Fflutter_web_loading_tips/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monster555%2Fflutter_web_loading_tips/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/monster555","download_url":"https://codeload.github.com/monster555/flutter_web_loading_tips/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246895740,"owners_count":20851322,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["animation","flutter","flutter-web","user-experience"],"created_at":"2024-08-01T12:01:09.374Z","updated_at":"2026-01-07T09:56:49.451Z","avatar_url":"https://github.com/monster555.png","language":"Dart","funding_links":["https://www.buymeacoffee.com/danicoy"],"categories":["Dart"],"sub_categories":[],"readme":"# Flutter Web Loading Tips\n\nhttps://github.com/monster555/flutter_web_loading_tips/assets/32662133/83df94b8-fa19-4a89-a646-1ad55765a373\n\n\u003ca href=\"https://www.buymeacoffee.com/danicoy\" target=\"_blank\"\u003e\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png\" alt=\"Buy Me A Coffee\" style=\"height: 60px !important;width: 217px !important;\" \u003e\u003c/a\u003e\n\n## Introduction\n\nUser experience is essential in the software development world, and the loading process is a crucial aspect often overlooked. A slow or clunky loading experience can frustrate users and cause them to abandon your app before it even has a chance to load your Flutter Web app.\n\n## Key Features\n\n- **Smooth Progress Bar**: Create an elegant progress bar that reflects the loading progress of your Flutter Web application.\n- **Graceful Fading**: Implement a graceful fading effect for the progress bar upon loading completion.\n- **Seamless Transition**: Ensure a seamless transition from the loading screen to displaying your Flutter content.\n\n## Getting Started\n\nTo get started with improving your Flutter Web loading experience, follow these steps:\n\n1. **Clone the Repository**: Begin by cloning this repository to your local development environment.\n\n  ```shell\n  git clone https://github.com/monster555/flutter_web_loading_tips.git\n  ```\n\n2. Enhance Your App: Apply the techniques learned from the guide to your Flutter Web project, and watch as your loading experience becomes smoother and more professional.\n\n## See How Smooth the Loading Experience is on FaceFolio\n\nThis is one of my portfolio projects. To see the smooth loading experience in action, visit the [FaceFolio homepage](https://facefolio.dctech.dev).\n\n## Step-by-Step\n\nImproving the loading experience in your Flutter Web application involves just a few steps. Follow each step closely to ensure proper implementation. The provided code snippets should be integrated into your project as described.\n\n### Step 1: Adding Progress Bar Elements in index.html\n\nIn your `index.html` file, add the following `\u003cdiv\u003e` elements to display the progress bar. These will visually represent the loading progress of the Flutter Engine.\n\n```html\n\u003c!-- Create a progress bar container with a nested progress bar --\u003e\n\u003cdiv class=\"progress-container\" id=\"progress\"\u003e\n  \u003cdiv class=\"progress-bar\" id=\"progressbar\"\u003e\u003c/div\u003e\n\u003c/div\u003e\n```\n\n### Step 2: Adding the Script in `flutter_bootstrap.js`\n\nTo ensure the proper initialization of your Flutter app using the new method available in Flutter 3.22 and later, you need to update the `web/flutter_bootstrap.js` file (not the `build/web/flutter_bootstrap.js`, which is auto-generated during the build process and will be overwritten).\n\nBelow is an example of how your `web/flutter_bootstrap.js` file should look with the necessary changes in place:\n\n```javascript\n    /**\n    * This function creates a delay of 500 milliseconds.\n    *\n    * @returns {Promise} A Promise that resolves after the delay.\n    */\n    function addDelay() {\n        return new Promise((resolve) =\u003e setTimeout(resolve, 500));\n    }\n\n    // Get the progress and progressBar elements from the DOM\n    const progress = document.getElementById(\"progress\");\n    const progressBar = document.getElementById(\"progressbar\");\n\n    // Initialize the width of the progress bar to 0%\n    progress.style.width = `0%`;\n\n    {{flutter_js}}\n\n    progress.style.width = `33%`;\n\n    {{flutter_build_config}}\n\n    // Load the Flutter engine\n    _flutter.loader.load({\n        onEntrypointLoaded: async function(engineInitializer) {\n            // Update the progress bar to 66% after the engine is loaded\n            progressBar.style.width = `66%`;\n\n            // Initialize the Flutter engine.\n            const appRunner = await engineInitializer.initializeEngine();\n    \n            // Set progress to 100% before adding a delay.\n            progressBar.style.width = `100%`;\n            \n            // Add a delay bofreo running the app to create a smooth crossfade effect.\n            await addDelay();\n            \n            // Hide the progress bar by reducing its opacity.\n            // This will create the fade out effect by animating the opacity.\n            progress.style.opacity = 0;\n    \n            // Run the Flutter app.\n            await appRunner.runApp();\n    \n            // Add a fade-in effect to the Flutter view element.\n            document.querySelector(\"flutter-view\").classList.add(\"fade-in\");\n        }\n    });\n```\n\n### Step 3: Creating `style.css`\n\nCreate a `style.css` file with the following content to style the progress bar and create the fade-in effect:\n\n```css\n/* Styles for the body element */\nbody {\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    height: 100vh;\n    margin: 0;\n    background-color: #fff;\n}\n\n/* Styles for the progress bar container */\n.progress-container {\n    width: 300px;\n    height: 8px;\n    background-color: #e0e0e0;\n    border-radius: 10px;\n    overflow: hidden;\n    transition: opacity 0.25s ease-out;\n}\n\n/* Styles for the progress bar */\n.progress-bar {\n    display: block;\n    height: 100%;\n    background-color: #6a6a6a;\n    width: 0;\n    transition: width 0.5s ease;\n}\n\n/* CSS for a fade-in animation */\n.fade-in {\n    opacity: 0;\n    animation: fadeIn 1s ease-in-out forwards;\n}\n\n/* Keyframes for the fadeIn animation */\n@keyframes fadeIn {\n    0% {\n        opacity: 0;\n    }\n    60% {\n        opacity: 0;\n    }\n    100% {\n        opacity: 1;\n    }\n}\n```\n\n### Step 4: Referencing `style.css`\n\nIn your `index.html`, reference the `style.css` file to apply the defined styles:\n\n```html\n\u003clink rel=\"stylesheet\" href=\"style.css\" /\u003e\n```\n\nBy following these steps, you can implement a smooth loading experience in your Flutter Web application.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmonster555%2Fflutter_web_loading_tips","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmonster555%2Fflutter_web_loading_tips","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmonster555%2Fflutter_web_loading_tips/lists"}