Question: please answer flutter programming for this requirements Task 1. Create a Flutter app. Your app should have four widgets: MyApp, MyHomePage, LightBulb and LightButton. Among
please answer flutter programming for this requirements
Task 1.
Create a Flutter app. Your app should have four widgets: MyApp, MyHomePage, LightBulb and LightButton. Among these, MyApp and MyHomePage are already there in the example project you start with. You need to modify MyHomePage a bit, as explained below.
Each of these four widgets should be stateless widgets with build() functions.
MyApp has a MaterialApp that contains MyHomePage as its home child (this is already there).
MyHomePage has a Scaffold, receives a title in its constructor and uses it in its appBar (this is already there). The value of this title is Lab 2. However, we want MyHomePage to be a stateless widget, unlike the sample code.
In the body of the Scaffold, it should have a Center with a Column widget that holds the LightBulb and LightButton widgets as its children (Center and Column are already there). We do not want a floatingActionButton, so remove it.
LightBulb and LightButton are also stateless widgets. They do not receive anything in their constructors, yet.
LightBulb has a Container, which has green color (Colors.green) and a padding of 5 (new EdgeInsets.all(5.0)). The Container has a Text as its child. The Text has OFF as its data.
LightButton has a Container, which has red color and a padding of 5. The Container has a MaterialButton as a child, which has blue color, black textColor, and null as the onPressed handler. The MaterialButton has a Text as a child, which says Turn light on.
The app should look like the screenshot below.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
