Skip to content

rahulmokaria/gdsc-flutter-class-1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 

Repository files navigation

GDSC-flutter-class-1

Table of Content

Getting Started

If you're new to Flutter, the first thing you should do is visit the official Flutter website and follow the instructions to install Flutter on your machine. You'll also need an IDE, such as Android Studio or Visual Studio Code, to develop Flutter applications.

Video Link

After installing flutter if you want to use VS Code then also install flutter extension in VS Code.

Once you have Flutter installed and your IDE set up, you're ready to start learning!

Class Resources

Class ppt: Flutter_Introduction.pptx

Creating a Flutter project

There are many ways in which we can create a project, out of which some are listed below:

Using Terminal

  • Firstly, we will move into the directory in which we want to create a project, for eg. Documents.
cd Documents
  • Now we will create the flutter project.
flutter create hello_world
  • Now move into the project's directory.
cd hello_world
  • Now open the project in VS Code using Ctrl+K+O.

Using VS Code

  • After installing flutter extension in VS Code, Open command pallete using the shortcut Ctrl+Shift+P. The following dialog box appears. image
  • Select Flutter: New Project. A new dialog Box appears. image
  • Select Application. After which we have to select the folder in which we have to select the folder in which we want our project. image
  • Now give the name of our Project hello_world. image
  • Let it load and your project is created.

Running the project and playing with it

  • To run the project, in Vscode , press F5 or in terminal move into the project directory. And run the following.
flutter run
  • Select the device in which we want to run our project, here we will choose chrome i.e. we will write 2. image

  • After a while it will run the project in Chrome. image

  • When we have created the project the following file structure appears.

image

  • In this, the corresponding directories correspond to that environment, i.e. android for our android app, ios for ios app, web for our web app,etc.
  • We only need to add/edit code in the lib directory.
  • main.dart is the current code that is running.
  • main function loads our app, which calls an inbuild function runApp() where we pass the class we want to load which in our case is MyApp.
  • MyApp returns a MaterialApp widget.
  • This MyApp class loads the MyHomePage.

Exploring the code

  • To remove the debug tag in the app, we need to add the following code which is an attribute to the Material App at Line 14
debugShowCheckedModeBanner: false,
  • To change the theme of our app, change the color blue to green at Line 26.
primarySwatch: Colors.green, 

Run again(which can be done using r in terminal) and the theme changes. image

  • At Line 82 it uses a widget Column, changing it to Row will show both, the text and the count in a row.
        child: Row(
  • Try to explore more by changing style, adding attributes, etc.

Adding Dependencies

  • Dependencies can be added to our flutter project in pubspect.yaml file in the root directory which can be added after Line 31 .
  • To add a directory select the dependency from pub.dev and run the follwoing code in terminal to load the dependecy.
flutter pub get

Additional Resources

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published