How to align the text in AppBar Actions?

To make the text to the center of the AppBar instead of the top of the AppBar.

To align the text lower a bit

 appBar: AppBar(
          backgroundColor: Colors.white,
          title: const Text("Test", style:TextStyle(color: Colors.black)),
          actions: [Text( formattedDate, style:TextStyle(color: Colors.black))
          ],
        ),

>Solution :

Wrap the Text widget with an Align widget like this:

appBar: AppBar(
  backgroundColor: Colors.white,
  title: Text(
    "Test",
    style: TextStyle(color: Colors.black),
  ),
  actions: [
    Align(
      alignment: Alignment.center,
      child: Text(
        formattedDate,
        style: TextStyle(color: Colors.black),
      ),
    ),
  ],
),

Leave a Reply