【问题标题】:Is possible to implement TextField in system_alert_window Fluttter?是否可以在 system_alert_window Flutter 中实现文本字段?
【发布时间】:2023-01-12 12:12:40
【问题描述】:

我使用system_alert_window这个库来实现系统警报窗口。我需要此对话框上的文本字段。

  1. 我们如何实施?

  2. 或者还有其他方法可以在系统警报窗口中引入文本字段吗?

      SystemWindowHeader header = SystemWindowHeader(
          title: SystemWindowText(
              text: "Incoming Call", fontSize: 10, textColor: Colors.black45),
          padding: SystemWindowPadding.setSymmetricPadding(12, 12),
          subTitle: SystemWindowText(
              text: "9898989899",
              fontSize: 14,
              fontWeight: FontWeight.BOLD,
              textColor: Colors.black87),
          decoration: SystemWindowDecoration(startColor: Colors.grey[100]),
          button: SystemWindowButton(
              text: SystemWindowText(
                  text: "Spam", fontSize: 10, textColor: Colors.black45),
              tag: "spam_btn"),
          buttonPosition: ButtonPosition.TRAILING);
      SystemWindowBody body = SystemWindowBody(
        rows: [
          EachRow(
            columns: [
              EachColumn(
                text: SystemWindowText(
                    text: "Some body", fontSize: 12, textColor: Colors.black45),
              ),
            ],
            gravity: ContentGravity.CENTER,
          ),
    
        ],
        padding: SystemWindowPadding(left: 16, right: 16, bottom: 12, top: 12),
      );
      SystemWindowFooter footer = SystemWindowFooter(
          buttons: [
            SystemWindowButton(
              text: SystemWindowText(
                  text: "Simple button", fontSize: 12, textColor: Colors.blue),
              tag: "simple_button",
              padding:
                  SystemWindowPadding(left: 10, right: 10, bottom: 10, top: 10),
              width: 0,
              height: SystemWindowButton.WRAP_CONTENT,
              decoration: SystemWindowDecoration(
                  startColor: Colors.white,
                  endColor: Colors.white,
                  borderWidth: 0,
                  borderRadius: 0.0),
            ),
            SystemWindowButton(
              text: SystemWindowText(
                  text: "Focus button", fontSize: 12, textColor: Colors.white),
              tag: "focus_button",
              width: 0,
              padding:
                  SystemWindowPadding(left: 10, right: 10, bottom: 10, top: 10),
              height: SystemWindowButton.WRAP_CONTENT,
              decoration: SystemWindowDecoration(
                  startColor: Colors.lightBlueAccent,
                  endColor: Colors.blue,
                  borderWidth: 0,
                  borderRadius: 30.0),
            )
          ],
          padding:
              SystemWindowPadding(left: 16, right: 16, bottom: 12, top: 10),
          decoration: SystemWindowDecoration(startColor: Colors.white),
          buttonsPosition: ButtonPosition.CENTER);
      SystemAlertWindow.showSystemWindow(
          height: 230,
          header: header,
          body: body,
          footer: footer,
          margin: SystemWindowMargin(left: 8, right: 8, top: 200, bottom: 0),
          gravity: SystemWindowGravity.TOP,
          notificationTitle: "Incoming Call",
          notificationBody: "+1 646 980 4741",
          prefMode: prefMode,
          backgroundColor: Colors.black12,
          isDisableClicks: false);
      setState(() {
        _isShowingWindow = true;
      });
    

【问题讨论】:

    标签: android flutter dart system-alert-window


    【解决方案1】:

    我不这么认为..但是通过警告对话框你可以实现这样的东西

    AlertDialog( 
            title: Text('TextField in Dialog'), 
            content: TextField( 
              onChanged: (value) { }, 
              controller: _textFieldController, 
              decoration: InputDecoration(hintText: "Text Field in Dialog"), 
            ),
        ),
    

    【讨论】:

      猜你喜欢
      • 2021-11-01
      • 2018-03-04
      • 1970-01-01
      • 2011-09-01
      • 2012-05-28
      • 2021-01-28
      • 2021-11-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多