September 2019
Beginner
512 pages
12h 52m
English
Let's start by looking at stateless widgets in code. The very first stateless widget in the application is the application class itself:
class MyApp extends statelessWidget { @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', theme: ThemeData( primarySwatch: Colors.blue, ), home: MyHomePage(title: 'Flutter Demo Home Page'), ); }}
As you can see, the MyApp class extends statelessWidget and overrides the build(BuildContext) method. This method describes a UI part; that is, it builds the widgets subtree below it. In the preceding case, MyApp is the root of the widget tree and, therefore, it builds all the widgets down the tree. In this case, its direct child is MaterialApp. According ...
Read now
Unlock full access