DEV Community

Cover image for My first day with Flutter!!
Shakya Peiris
Shakya Peiris

Posted on

My first day with Flutter!!

Hello everyone hope you are reacting well. Recently I joined a Sri Lankan JavaScript meetup named Colombo JavaScript and two members of the organizing committee of that meetup, Chathu Vishwajith and Pubudu Kodikara hosted a pair-programming live stream on Flutter and it was streamed via YouTube, Fb and Twitch(SLDevTalks) and that live stream inspired me to learn Flutter!

Before touching Flutter I thought to learn Dart because I have never used dart before and since it's somewhat looks like JavaScript, I was able to learn even OOP within an hour. To learn dart I watched the following video on YouTube. But I don't recommend if you don't have a pretty good understanding about programming and I'll the put my recommendation for beginner programmers also.

Dart Tutorial for ones with prior programming experience : https://www.youtube.com/watch?v=Ej_Pcr4uC2Q&t=1621s

Dart for beginners : https://www.youtube.com/watch?v=5xlVP04905w

My first dart app :


class MyPig{
  String name;
  int age;

  MyPig(this.name,this.age);

  void tellMeAboutYou(){
    speak("Oink Oink I'm $name and I'm $age years old");
  }

  void eat(String food){
    List favouriteFoods = ["apple","orange","pizza","burger"];
    List worstFoods = ["rice and curry","pickles","cauliflower"];

    if (favouriteFoods.contains(food)){
      speak("Mmm Yumy I like $food");
    }
    else if (worstFoods.contains(food)){
      speak("Ewww I don't like $food");
    }
    else if (food.length % 2 == 0){
      speak("Mmm This is tasty what's the name of this food?");
    }
    else{
      speak("Eww I don't wanna know what this food is!");
    }
  }

  void friends(List friendList){
    speak("Oink Oink I have lot of friends");
    for (var friend in friendList){
      speak(friend);
    }
  }

  void speak(String word){
    print(word);
  }
}

void main () {
  MyPig emilly = MyPig("Emilly",4);
  emilly.tellMeAboutYou();
  emilly.eat("apple");
  emilly.friends(["Peter","Shakya","Other Friends"]);
}
Enter fullscreen mode Exit fullscreen mode

Then today, I got up at around 4.30 am and start to learn the art of flutter and to learn I have chosen the Udemy course conducted by Dr.Angela Yu. That course was sponsored by google and recommended by more than 35,000 students(according to the amount of reviews and total number of students is > 100k). At, the end of the day, I was able to learn the basic thing like how component tree works, how Scaffold works, Material colors, Material app, etc... and at the end of the I built a simple app with an appBar and an image at it's center. And also today, I have learned how to put an icon to my flutter app too.

My First Flutter app :

void main()=>runApp(
    MaterailApp(
        home:Scaffold(
            backgroundColor : Colors.blueGray,
            appBar : AppBar(
                title : Text("My App"),
            )
            body:Center(
                child : Image(
                    image : NetworkImage(""),//url or to access 
                                 //localfiles you can use Assets
                )
            )
        )
    ),
);
Enter fullscreen mode Exit fullscreen mode

Hope I would be able to publish blogs related to Flutter and dart in the near future and until then good bye!

Top comments (2)

Collapse
 
pablonax profile image
Pablo Discobar

Good job! If you are interested in this, you can also look at my article about Flutter templates. I made it easier for you and compared the free and paid Flutter templates. I'm sure you'll find something useful there, too. - dev.to/pablonax/free-vs-paid-flutt...

Collapse
 
shakyapeiris profile image
Shakya Peiris

Thank You