We are a non-profit association and hacking community
formed by
students from đPolitecnico di Milano
We promote the use of đFree and Open Source Software through courses, talks and workshops
We tinker with software and hardware and share knowledge with anyone who is curious about technology
...but also
Creative Cazzeggio Development
Politecnico di Milano (Leonardo campus), building 9A
Come visit us!
Make sure to check đBITS to know if the headquarters are open!
Itâs the lowest layer and itâs built specifically for every platform
Itâs the layer built on top of the embedder, built with C and C++
Itâs the layer on top of everything:
Multiplatform object-oriented programming language
Means that we have to work with classes and objects
A class is not made just by variables but also methods
There are two type of methods:
Inheritance gives the ability to reuse code:
It allows the child to override âthingsâ inherited from the parent
Can compile to native ARM or x64 machine code, assuring also short startup time
Uses incremental recompilation enabling:
If you know the type of a certain variable you should use static types
The difference is that:
âA widget is an immutable description of part of a user interfaceâ
Widget(
propertyA: ,
propertyB: ,
... ,
);
Widget(propertyA: , propertyB: , ... ,);
Widget(propertyA: , propertyB: , ... ,);
User(nickname: 'Amogus', age: 3, height: 3.47);
Widgets are just objects
So a widget is an instance of a class
class User{
User({required this.nickname, required this.age, this.height=2});
final String nickname;
final int age;
final double height;
sayHi(){
print("Hi");
}
}
class Spacer extends StatelessWidget {
const Spacer({super.key, this.flex = 1}): assert(flex > 0);
final int flex;
@override
Widget build(BuildContext context) {
return Expanded(
flex: flex,
child: const SizedBox.shrink(),
);
}
}
Letâs say that I want some text in a yellow box
ColoredBox(
color: Colors.yellow,
child: Text("hi"),
)
Letâs say that I also need the Scaffold widget
Scaffold(
body: ColoredBox(
color: Colors.yellow,
child: Text("hi"),
)
)
Since I have a Scaffold widget I can add an AppBar with a title
Scaffold(
appbar: AppBar(
title: Text("Hello"),
),
body: ColoredBox(
color: Colors.yellow,
child: Text("hi"),
)
)
From this short example I just want to show how easy it is to create a nested structure:
A widget is immutable, so how can we use it in a world where we need interactive programs?
Here come the concepts of:
A Stateless widget is immutable, so it doesnât change, no matter what
A Stateful widget has a state, so it can change
If you want to use Flutter you need to know multiple widgets
There are plenty of widgets and itâs almost impossible to know all of them, so now we are going to see just some of those that we will use in the next days
Itâs the base of a Flutter app and you can put a lot of different widgets inside of it
It centers the child widget inside
Itâs a highly customizable bar
Itâs a floating button
It puts a list of widgets in a row
It puts a list of widgets in a column
It puts a list of widgets in a scrollable view
Itâs a nice combination of two widgets:
Combining Card + ListTile with ListView.builder creates a nice scrollable list
It forces a widget to occupy the max amount of space
|
|