info_popup icon indicating copy to clipboard operation
info_popup copied to clipboard

How can I touch outside to close the popup?

Open huynguyen96419 opened this issue 9 months ago • 2 comments

Currently, when i tap out side of popup, then cannot close the pop up? Can you help me for this? My code:

InfoPopupWidget(
            arrowTheme: const InfoPopupArrowTheme(
              arrowDirection: ArrowDirection.down,
              color: Colors.transparent,
            ),
            contentOffset: const Offset(-75, 0),
            customContent: () => Container(
              decoration: BoxDecoration(
                color: Colors.white,
                borderRadius: BorderRadiusConstants.c15wr,
              ),
              padding: PaddingConstants.a10R,
              width: 200.ww,
              child: ListView.separated(
                itemCount: readAtList.values.toList().length,
                physics: const NeverScrollableScrollPhysics(),
                shrinkWrap: true,
                separatorBuilder: (context, index) => 15.wVerticalSpace,
                itemBuilder: (_, index) {
                  return Row(
                    children: <Widget>[
                      _buildReaderAvatar(
                          readAtList.values.toList()[index].avatar),
                      10.wHorizontalSpace,
                      Expanded(
                        child: Text(
                          readAtList.values.toList()[index].name ??
                              AppConstant.empty,
                          textAlign: TextAlign.left,
                          overflow: TextOverflow.ellipsis,
                          maxLines: 1,
                          style: TextStyle(
                            fontSize: 14.zsp(context),
                            fontWeight: FontWeight.normal,
                            color: Colors.black,
                          ),
                        ),
                      ),
                    ],
                  );
                },
              ),
            ),
            child: Container(
              height: 20,
              color: Colors.transparent,
              child: Row(
                mainAxisAlignment: MainAxisAlignment.end,
                children: showReadAtList.keys.map((String key) {
                  final int index = readAtList.keys.toList().indexOf(key);
                  return Padding(
                    padding: const EdgeInsets.only(left: 2),
                    child: index >= _indexReadMore
                        ? _buildMoreReader('$moreReader')
                        : _buildReader(
                            key,
                            userInfo: showReadAtList[key]!,
                          ),
                  );
                }).toList(),
              ),
            ),
          )

huynguyen96419 avatar Apr 24 '24 02:04 huynguyen96419

When I tried to simulate the code as in the example below, I saw that everything was working correctly. When I clicked outside the area, the popup closed. I tried it on an iOS emulator. Can you provide more information? @huynguyen96419

InfoPopupWidget(
                arrowTheme: const InfoPopupArrowTheme(
                  color: Colors.black87,
                  arrowDirection: ArrowDirection.down,
                ),
                customContent: () => Container(
                  width: 200,
                  child: ListView.separated(
                    itemCount: [1, 2, 3, 4, 5].length,
                    physics: const NeverScrollableScrollPhysics(),
                    shrinkWrap: true,
                    separatorBuilder: (context, index) => const Divider(),
                    itemBuilder: (_, index) {
                      return Row(
                        children: <Widget>[
                          Expanded(
                            child: Text(
                              [1, 2, 3, 4, 5][index].toString(),
                              textAlign: TextAlign.left,
                              overflow: TextOverflow.ellipsis,
                              maxLines: 1,
                              style: const TextStyle(
                                fontSize: 14,
                                fontWeight: FontWeight.normal,
                                color: Colors.black,
                              ),
                            ),
                          ),
                        ],
                      );
                    },
                  ),
                ),
                child: const Text('Info Popup Custom Widget Example'),
              ),

SalihCanBinboga avatar May 03 '24 20:05 SalihCanBinboga

Use this dismissTriggerBehavior: PopupDismissTriggerBehavior.onTapArea

Vetukuritejovarma avatar May 12 '24 05:05 Vetukuritejovarma

This issue has been automatically closed due to inactivity. Please feel free to reopen it if you are still experiencing this problem.

github-actions[bot] avatar May 27 '24 01:05 github-actions[bot]