Flutter Flashcards

1
Q

Where is the default alignment for text widgets?

A

Top left corner

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the class for creating apps that use the material design?

A

MaterialApp

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Rewrite the code below to wrap the text widget in a center widget.

void main() {
runApp(
MaterialApp(
home: Text(‘Hello World!’),
),
);
}

A

void main() {
runApp(
MaterialApp(
home: Center(
child: Text(‘Hello World!’),
),
),
);
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the starting point for all dart programs:

A

The main function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How do you add an app bar the the code below?

void main() {
runApp(
MaterialApp(
home: Scaffold(),
),
);
}

A

void main() {
runApp(
MaterialApp(
home: Scaffold(
appBar: AppBar(),
),
),
);
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Add a title to the Appbar

void main() {
runApp(
MaterialApp(
home: Scaffold(
appBar: AppBar(),
),
),
);
}

A

void main() {
runApp(
MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text(‘This Is The Title’),
),
),
),
);
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Write some code to include an imaged from the internet into a flutter app (no need to include the outer widgets)

A

Image(
image: NetworkImage(‘http://foo.com/image.jpeg’)
)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How do you create a comment in a YAML file?

A
With a hash 
#this is a comment
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are three basic rules for a YAML file

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How many spaces is a yaml indentation?

A

2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

After a yaml file has been eddited to inclide an asset what button needs to be pressed in Andoid Studio?

A

pub get

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What flutter widget is a bit like a html div?

A

Containter

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are the steps to adding a font file to Flutter?

A
  1. Create a directory to keep the font/s in the project
  2. Edit pubspec.yaml to link to the file
  3. Click on ‘get pub’ in android studio (just above the yaml file)
  4. rerun app (so not a hot reload)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q
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
)

A

mainAxisAlignment: MainAxisAlignment.start,

Row(
mainAxisAlignment: MainAxisAlignment.start,
)

Row(
mainAxisAlignment: MainAxisAlignment.center,
)

Row(
mainAxisAlignment: MainAxisAlignment.end
)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Create a round avatar widgit that links uses an image from images/me.jpeg and that is of a radius of 100

A

CircleAvatar(
radius: 100.00,
backgroundImage: AssetImage(‘images/me.jpeg’),
),

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Create a Text widget with:

font family DancingScript
is bold
a font weight of 40
is white

A

Text(
‘Doggy Dog’,
style: TextStyle(
fontFamily: ‘DancingScript’,
fontWeight: FontWeight.bold,
fontSize: 40,
color: Colors.white,
),

17
Q

Create an Icon widget with a phone icon

A

Icon(
Icons.phone,
),

18
Q

Useing the apropiat widget, create an empty box of 20 pixles wide

A

SizedBox(
width: 10.00,
),

19
Q

Wrap an image widget with a widget that will expand it to the avalable space of the screen and will also not go behond the screen border. The Widget in question can only be a child of Row, Column or Flex

Image.asset(‘images/dice1.png’)

A

Wrap it in an Expanded widget.

Expanded(
child: Image.asset(‘images/dice1.png’),
),

20
Q

What property of the Expanded widget is used to size it in relation to other widgets?

A

flex: