简体   繁体   中英

Flutter: Expand row widget inside column in stack

I have a CustomScrollView and inside this widget I have SliverGrid. In SliverGrid I am showing my custom widget :

   return Stack(
      children: [
        Image.asset("assets/icons/folder_icon.png"),
        Positioned(
          top: 30,
          left: 10,
          child: Column(
            mainAxisAlignment: MainAxisAlignment.start,
            children: [
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  InkWell(
                    child: Icon(Icons.add),
                    onTap: onTapSync,
                  ),
                  InkWell(
                    child: Icon(Icons.sync),
                    onTap: onTapSync,
                  ),
                ],
              ),
              Text(
                title,
                style: TextStyle(fontSize: 16),
              ),
            ],
          ),
        )
      ],
    )

the result is:

在此处输入图像描述

How can I expand the Row widget according to the folder Icon so that 2 icons are located in the left and right folder image?

I don't want to use for example SizedBox(width: xx) between 2 icons. or extract icons from the column.

Lets try this:

    Positioned(
      top: 30,
      left: 10,
      right: 0,

      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              InkWell(
                child: Icon(Icons.add),
                onTap: onTapSync,
              ),
              InkWell(
                child: Icon(Icons.sync),
                onTap: onTapSync,
              ),
            ],
          ),
        ],
      ),
    )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM