信息弹出框 (pub.dev)

向用户显示所选小部件信息的简单方法。

特点

  • 具有动态尺寸的信息容器
  • 完全可编辑的内容区域

Alt Text

入门

将此包用作库


用法

您所要做的就是将其包装在您想显示信息的小部件中,使用 InfoPopupWidget。通过 InfoPopupController,您可以根据需要自定义它,并打开和关闭它。

正常信息文本用法

InfoPopupWidget(
  onControllerCreated: (InfoPopupController controller) {
    controller.show();
  },
  arrowTheme: const InfoPopupArrowTheme(
  arrowDirection: ArrowDirection.down, color: Colors.pink),
  infoText: 'This is a popup',
  child: const Text('Info Popup Info Text Example'),
),
自定义弹出窗口小部件

InfoPopupWidget(
    onControllerCreated: (InfoPopupController controller) {
    controller.show();
  },
  arrowTheme: const InfoPopupArrowTheme(
    color: Colors.black87,
  ),
  infoWidget: Container(
    width: context.screenWidth * .8,
    height: 100,
    decoration: BoxDecoration(
      color: Colors.red,
      borderRadius: BorderRadius.circular(10),
    ),
    child: const Center(
      child: Text(
        'This is a custom widget',
        style: TextStyle(
          color: Colors.white,
        ),
      ),
    ),
  ),
  child: const Text('Info Popup Custom Widget Example'),
),

GitHub

查看 Github