skip to Main Content

Positioning the icon same line with the text

      title: const Text("Test", style: TextStyle(color: Colors.black)),
          actions: [
            Column(children: <Widget>[
              Align(alignment: Alignment.topLeft),
              Image.asset(
                'Assets/Images/calendar.png',
              ),
              Text(formattedDate, style: TextStyle(color: Colors.black))
            ]),

To position the icon same line with text

2

Answers


  1. You can use Row widget.

          title: const Text("Test", style: TextStyle(color: Colors.black)),
              actions: [
                Row(
                 mainAxisSize: MainAxisSize.min,
                 children: <Widget>[
                 // Align(alignment: Alignment.topLeft),
                  Image.asset(
                    'Assets/Images/calendar.png',
                  ),
                  Text(formattedDate, style: TextStyle(color: Colors.black))
                ]),
    

    More about layout in flutter

    Login or Signup to reply.
  2. This may work !!

    title: const Text("Test", style: TextStyle(color: Colors.black)),
                  actions: const [
                    Center(
                      child: Padding(
                        padding: EdgeInsets.only(right: 8.0),
                        child: Column(
                            mainAxisAlignment: MainAxisAlignment.center,
                            crossAxisAlignment: CrossAxisAlignment.center,
                            children: <Widget>[
                              // Align(alignment: Alignment.topLeft),
                              Icon(Icons.calendar_month),
                              Text("formattedDate",
                                  style: TextStyle(color: Colors.black))
                            ]),
                      ),
                    ),
                  ]
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search