Adequate Infosoft
Flutter web has been in the market for quite some time and it has made its place strongly among developers. The Flutter framework is said to be one of the most effective and efficient frameworks out there to build an attractive and responsive website with Flutter. The best part about this framework is that it gets updated once in a while which makes it more approachable and productive for the developers.
Flutter 2 is a new version of Flutter with more plugins and improvements, so if you still haven’t tried your hands then you must do it. In this article, we have discussed a responsive app and built a project in Flutter. Read this article to get the best Flutter web tutorial and build a basic website in Flutter.
In layman’s terms, a responsive UI web app in Flutter allows you to perform an activity on the application without any problem. The development team creates end-to-end responsive websites for the users. A responsive website means the size of the website can adjust to the screen size with fluidity and ease.
The single-code use makes Flutter a popular framework to develop custom software for various sectors. For people who pay attention to design and presentations, Flutter makes a good tool to make a website attractive and responsive UI.
In this project, we will use Flutter 2.0 for building and configuring an application to run on the web by default.
First, create a new project by using the below command:
flutter create explore
explore- It is the name of the Flutter website project that we will create.
Once created a project, open it by using IDE you want. To open this, use the below-given command:
code explore
If you are not using Flutter 2.0 then you need to enable web support.
flutter config --enable-web
Now you can run your project for a browser. In order to see whether your env is set up properly.
flutter devices
Let’s get to the creation. Use the create command for the Flutter app.
flutter create the_basics
The UI that we have included in this article is for the landing page given below. You will get the code for the set of series used on the landing page. Flutter is considered one of the best frameworks to build easy responsive UI web apps.
Now, the above landing page can be created with a basic UI layout web view. Nothing is special about the landing page. Open the_basic project in your favorite IDE (here we will use VS code). The first step into this is clearing out the main file and putting the scaffold body as the HomePage.
After this, create a new folder named page under the lib folder and inside the first folder create a new folder named home, and inside that folder create a new field named home_page.dart
The HomePage will be divided into the following three sections.
Now, it's time to build a UI and create a new folder of widgets in the lib folder. Under this folder create a new folder named as NavigationOption and inside it create a new file navigation_option.dart. This Flutter code example will help you build a basic responsive web application.
Find the logo and images here and download the one you like and create a new folder in the root named image. Put the logo.png in the folder. Navigate to the pubspec.yaml file and place it as an image.
assets:
- assets/logo.png
Now, the last thing we are required to change here to match it with our landing page is the Font of NavItems. The font that we downloaded above for the logo-named image is in the zip file, we need to move it to another folder named fonts. Open the pubspec.yaml file and place it as a font with the set weights for two fonts.
We need to set the font for the entire website and set the textTheme of the website in the main-dart file.
Lastly, we need to add the NavigationOption to the HomePage UI and that’s it.
When you run the code you can see that the navigation bar is written at the top. The content on the website must not go edge to edge. It should be aligned in the middle of the website properly so to make it readable. In order to do that we need to create another widget with a new folder named cenetered_page. Inside this folder create a new file named as centered_page.dart.
The maximum width of the page will not stretch more than 1200. You can pass the length to modify per view. Right now we are skipping this part.
Now, wrap the home_page with the file CenteredPage.
The header of the website must look like the one below the given image with spacing on the side.
Now it's time to build a course details widget which will be presented on the left side of the website. The font used here will be the one used before and the font weight will be at least 800. Create a new folder under widgets with the name page_details and inside this folder create a new file name page_details.dart.
Now, it's time to add this widget to the HomePage in an Expanded child, as the first widget item of a row. Update the home_page and build a method to look like this.
Now when you save the page it would look like the below image.
Call to Action
Finally, we will use a call to action button for Join Us. Create a call_to_action folder under widgets and create a new call_to_action.dart under the folder.
Your work is done and now when you run the code and see the changes the front page will look like the image shown earlier. The above Flutter layout is responsive and user-friendly, this will help you create a basic website.
Suggested Blogs:
>Python Error Solved: pg_config executable not found
>Set up Node.js & connect to a MongoDB Database Using Node.js
>Setting up a Cloud Composer environment: Step-by-step guide
>What is microservice architecture, and why is it better than monolithic architecture?
>What makes Python 'flow' with HTML nicely as compared to PHP?
>What to do when MQTT terminates an infinite loop while subscribing to a topic in Python?
>Creating custom required rule - Laravel validation
>How to configure transfers for different accounts in stripe with laravel?
>Laravel Query Solved: Laravel withOnly not restricting the query