Revision - Widget Flashcards

(19 cards)

1
Q

How to push the screen to the new SecondPage() screen?

A
Navigator.push(
context,
MaterialPageRoute(builder: (context) => SecondPage())
);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How to place a Text (“Hello”) in the center?

A
return Scaffold(
body: Center(
child: Text("Hello"),
),
);

Omit full StatelessWidget code

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

Create a text widget with Font Size set to 20, and Bold

A

Text("Hello", style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold))

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

How to grey out the button in Flutter?

A

Add null value to the button’s onPressed parameter

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

List out the 3 important parameters for Scaffold

A
  1. appBar
  2. body
  3. floatingActionButton
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

List out the 3 important parameters for AppBar

A
  1. title
  2. leading
  3. actions
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

List out the 5 important parameters for MaterialApp

A
  1. home
  2. title
  3. theme
  4. initialRoute
  5. routes
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

List out the 3 important parameters for Column and Row

A
  1. children
  2. mainAxisAlignment
  3. crossAxisAlignment

Stacks widgets vertically / horizontally

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

List out the important parameters for Container

A
  1. child
  2. color
  3. padding
  4. margin
  5. decoration
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

List out the important parameter for Center

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

List out 2 important parameters for Padding

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

Usually what objects is needed for padding parameter?

A

EdgeInsects class

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

List out 3 important parameters for SizedBox

A
  1. width
  2. height
  3. child
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

List out the important parameters for TextStyle (Used inside Text)

A
  1. fontSize
  2. fontWeight
  3. color
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

List out the 3 important parameters for TextField

A
  1. controller (TextEditingController)
  2. decoration (InputDecoration)
  3. obscureText (for passwords)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is the difference between onPressed and onTap?

A
  1. onPressed is for Buttons (Material widget that has the word Button)
  2. onTap is for Detectors, non-clickable widget (Container, Image, InkWell)
17
Q

List out 2 key parameter for
1. ElevatedButton
2. FilledButton
3. TextButton

A
  1. onPressed
  2. child

  1. Has a solid background and Drop Shadow
  2. Has a solid background and No Shadow
  3. No Background, No Shadow, Just Text

18
Q

List out 2 key parameter for IconButton

A
  1. onPressed
  2. icon
19
Q

List out important parameters for Input Decoration

A
  1. labelText
  2. hintText
  3. border
  4. prefixIcon