Flutter: Difference between revisions

From Han Wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
 
Line 23: Line 23:
}
}
</source>
</source>
A widget's main job is to implement a '''build''' function, which describes the widget in terms of other, lower-level widgets.

Latest revision as of 01:31, 27 September 2018

Set up

Get all packages based on pubspec.yaml.

$ flutter packages get
Running "flutter packages get" in a1...                      1.0s


Programming Notes

runApp() function takes the given Widget and makes it the root of the widget tree. The following makes the Center widget the root.

void main() {
	runApp(
		Center: Text(
			'Hello, world!',
			textDirection: TextDirection.ltr
		)
	);
}

A widget's main job is to implement a build function, which describes the widget in terms of other, lower-level widgets.