Max's Flutter Course
If in \src\flutter and you run flutter create my_app it will create the folder in . this is what you want to do.
https://www.udemy.com/course/learn-flutter-dart-to-build-ios-android-apps/learn/lecture/37213694#overview
Install flutter extension if on new machines
https://www.udemy.com/course/learn-flutter-dart-to-build-ios-android-apps/learn/lecture/37213700#overview
CTRL+SHIFT-+P for command palette. From there type flutter.
https://www.udemy.com/course/learn-flutter-dart-to-build-ios-android-apps/learn/lecture/37130450#overview
Widgets etc.
https://www.udemy.com/course/learn-flutter-dart-to-build-ios-android-apps/learn/lecture/37130454#overview
Max goes through the different files and folders.
Build.. don't work in there. Some like pubspec are useful.
https://www.udemy.com/course/learn-flutter-dart-to-build-ios-android-apps/learn/lecture/37130456#overview
Parsed, Translated... to
https://www.udemy.com/course/learn-flutter-dart-to-build-ios-android-apps/learn/lecture/37130478#overview
So we can use built-in widgets, but also can build our own.
https://www.udemy.com/course/learn-flutter-dart-to-build-ios-android-apps/learn/lecture/37130480#overview
check out Flutter's built in Widgets.. Yup will use main 10.. 20 widgets..
https://www.udemy.com/course/learn-flutter-dart-to-build-ios-android-apps/learn/lecture/37130480#overview
Material app widget being passed to runApp( )
https://www.udemy.com/course/learn-flutter-dart-to-build-ios-android-apps/learn/lecture/37130484#overview
Positional and Named Parameters.
For Named Parameters with use { num1, num2 } and the addNum( num2:2, num1:4 )
Positional arguments can be made optional by wrapping them with square brackets ([]):
- void add(a, [b]) { // b is optional
- print(a + b);
- }
Once a parameter is optional, you can also assign a default value to it - this value would be used if no value is provided for the argument:
- void add(a, [b = 5]) { // b is optional, 5 will be used as a default value
- print(a + b);
- }
- add(10); // b would still be 5 because it's not overwritten
- add(10, 6); // here, b would be 6
You can also make named parameters required by using the built-in
requiredkeyword:
- void add({required a, required b}) { // a & b are no longer optional
- print(a + b);
- }
For Named Max demo'd very cleaningly
The home positional argument (got to see them by CTRL-SPACE) and then passed Text widget in.
https://www.udemy.com/course/learn-flutter-dart-to-build-ios-android-apps/learn/lecture/37130498#overview
const. help optimise runtime performance. if it's a const, then use it. flutter will reuse.
although not my VS config didn't give me a blue squiggle.
https://www.udemy.com/course/learn-flutter-dart-to-build-ios-android-apps/learn/lecture/37130502#overview
use the trailing commas.
https://www.udemy.com/course/learn-flutter-dart-to-build-ios-android-apps/learn/lecture/37130504#overview
Dart is type-safe. all values are of certain Types, of more than one type e.g. "hello world" is of type String and Object (in fact they all are of Object)
29 is of type int, num and then Object. Material App is type Material App, Widget and then Object.
Max states that Objects are just data structures in memory.
Max goes throught type-safety. We can add types to parameter list e.g int num1, int num2.
and also void funcname as return type.
https://www.udemy.com/course/learn-flutter-dart-to-build-ios-android-apps/learn/lecture/37130508#overview
OK interesting point Max made here.. using the Color() function is actually the constructor we using. We can also use colors.red etc with the palette picker.
https://www.udemy.com/course/learn-flutter-dart-to-build-ios-android-apps/learn/lecture/37130516#overview
He's going on about [list] which is fine. What I noticed was const had to move from the MaterialApp he's did, mine didn't prompt that the BoxDecoration could be a const so flutter can cache/store it.
https://www.udemy.com/course/learn-flutter-dart-to-build-ios-android-apps/learn/lecture/37130518#content
using gradient is nice touch
CTRL - Space gives suggestions. Also the main docs on flutter.com
https://www.udemy.com/course/learn-flutter-dart-to-build-ios-android-apps/learn/lecture/37130520#content
1st step look within the ( rather than any same-level keyword arguments)
https://www.udemy.com/course/learn-flutter-dart-to-build-ios-android-apps/learn/lecture/37130522#content
custom widgets...
Max gives some backround about why you might want to break this up
https://www.udemy.com/course/learn-flutter-dart-to-build-ios-android-apps/learn/lecture/37130526#content
Classes
Create Object based on a Class
https://www.udemy.com/course/learn-flutter-dart-to-build-ios-android-apps/learn/lecture/37130528#content
Finally we going to build a custom widget class.
Good module. Goes through extends StatelessWidget, @override, build method, context (flutter will send metadata - eg where it is posistoned in WidgeTree)
build returns a Widget. So return
https://www.udemy.com/course/learn-flutter-dart-to-build-ios-android-apps/learn/lecture/37130530#overview
Right this is why Max is good. So here the blue squiggles were
1) Complaining about not passing keys
2) This is verbose key handler... receive a {named parameter 'key'} and : pass to abstract class StatelessWidget.
But that's long winded so..
3) You can just write
And it will work
4) Still had blue wiggles.. and that recommending you put the const
Like that.
https://www.udemy.com/course/learn-flutter-dart-to-build-ios-android-apps/learn/lecture/37130534#overview
splitting code across files.
for class GradientContainer
https://www.udemy.com/course/learn-flutter-dart-to-build-ios-android-apps/learn/lecture/37130538#overview
I got to move Styled_Text
https://www.udemy.com/course/learn-flutter-dart-to-build-ios-android-apps/learn/lecture/37130542#content
variables! IMPORTANT FOR YOU: startAlignment is a correctly capitalised VARIABLE NAME.
So here we have problem as it can't be const.
https://www.udemy.com/course/learn-flutter-dart-to-build-ios-android-apps/learn/lecture/37130544#content
You can use dynamic type (but it's bad, as we know)
So better use Alignment startAlignment
remember ? and !
https://www.udemy.com/course/learn-flutter-dart-to-build-ios-android-apps/learn/lecture/37130550#content
final is a built in keyword. multi-person teams this might screw.
const is compile time constant. flutter likes this.
use const if possible, otherwise final, and then <type> or in worst case var =
https://www.udemy.com/course/learn-flutter-dart-to-build-ios-android-apps/learn/lecture/37130552#content
instance variable (properties) and configuration widgets.
buff!
Just a "max clarification"
This : text = text could accept the
but shorthand is to use the this.varname notation
lots of squiggles came and went, all were highlights by flutter via vscode. "add final", "remove const" etc. note we were able to add a const into the style.


Comments
Post a Comment