Flutter Flashcards
Where is the default alignment for text widgets?
Top left corner
What is the class for creating apps that use the material design?
MaterialApp
Rewrite the code below to wrap the text widget in a center widget.
void main() {
runApp(
MaterialApp(
home: Text(‘Hello World!’),
),
);
}
void main() {
runApp(
MaterialApp(
home: Center(
child: Text(‘Hello World!’),
),
),
);
}
What is the starting point for all dart programs:
The main function
How do you add an app bar the the code below?
void main() {
runApp(
MaterialApp(
home: Scaffold(),
),
);
}
void main() {
runApp(
MaterialApp(
home: Scaffold(
appBar: AppBar(),
),
),
);
}
Add a title to the Appbar
void main() {
runApp(
MaterialApp(
home: Scaffold(
appBar: AppBar(),
),
),
);
}
void main() {
runApp(
MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text(‘This Is The Title’),
),
),
),
);
}
Write some code to include an imaged from the internet into a flutter app (no need to include the outer widgets)
Image(
image: NetworkImage(‘http://foo.com/image.jpeg’)
)
How do you create a comment in a YAML file?
With a hash #this is a comment
What are three basic rules for a YAML file
YAML is case sensitive
The files should have .yaml as the extension
YAML does not allow the use of tabs while creating YAML files; spaces are allowed instead
How many spaces is a yaml indentation?
2
After a yaml file has been eddited to inclide an asset what button needs to be pressed in Andoid Studio?
pub get
What flutter widget is a bit like a html div?
Containter
What are the steps to adding a font file to Flutter?
- Create a directory to keep the font/s in the project
- Edit pubspec.yaml to link to the file
- Click on ‘get pub’ in android studio (just above the yaml file)
- rerun app (so not a hot reload)
What is the property of class Row and Colume and it's value that is responible for aligning it's children? Compleat the code below to align childern to the start, center and end,
Row(
//start
)
Row(
//center
)
Row(
//end
)
mainAxisAlignment: MainAxisAlignment.start,
Row(
mainAxisAlignment: MainAxisAlignment.start,
)
Row(
mainAxisAlignment: MainAxisAlignment.center,
)
Row(
mainAxisAlignment: MainAxisAlignment.end
)
Create a round avatar widgit that links uses an image from images/me.jpeg and that is of a radius of 100
CircleAvatar(
radius: 100.00,
backgroundImage: AssetImage(‘images/me.jpeg’),
),