concept counter app in category flutter

appears as: counter app, The counter app
Flutter in Action

This is an excerpt from Manning's book Flutter in Action.

  • Take an in-depth look at the counter app, which is the app that’s generated when you start a new Flutter project with the CLI.
  • The most commonly used layout style in Flutter is known as the flexible layout, just like FlexBox. You can use flex layouts with Column and Row widgets. The counter app already has a Column widget in it, as shown in the next listing.

    Listing 3.4. Column widget in the counter app
    // _MyHomePageState
    body: Center(
      child: Column(                                             #1
        mainAxisAlignment: MainAxisAlignment.center,             #2
        children: <Widget>[                                      #3
          Text('You have pushed the button this many times:'),
          Text(
            '$_counter',
            style: Theme.of(context).textTheme.display1,
          ),
          RaisedButton(
            child: Text("Decrement Counter"),
            onPressed: _decrementCounter,
          ),
        ],
      ),
    ),

    3.4. Enhancing the counter app with the most important widgets

    The default counter app isn’t useful right now. You can’t even reset your count. In this section, we’ll extend the functionality of the counter app and explore some of the most important widgets in Flutter. According to the documentation, the absolute basic widgets are the following: