flutter ios提示框

ios提示框

使用:

Padding(
            padding: const EdgeInsets.only(top: 28.0),
            child: Row(
              children: <Widget>[
                Expanded(
                  child: RaisedButton(
                    padding: EdgeInsets.all(15.0),
                    child: Text("登录"),
                    color: Theme.of(context).primaryColor,
                    textColor: Colors.white,
                    onPressed: () async {
    
    
                      if ((formKey.currentState as FormState).validate()) {
    
    
                        //验证通过提交数据
                        await _neverSatisfied();
                      }
                    },
                  ),
                ),
              ],
            ),
          )


-------------------------------------------------------------------------------------------
ios提示框的实现:
_neverSatisfied() async {
    
    
    return showDialog<void>(
        context: context,
        barrierDismissible: false, //必须点击按钮才能退出对话框
        builder: (BuildContext context) {
    
    
          return CupertinoAlertDialog(
            title: Text("ios般喜欢"),
            content: Column(
              children: <Widget>[
                SizedBox(
                  height: 10,
                ),
                Align(
                  child: Text("登录成功!"),
                  alignment: Alignment(0, 0),
                ),
              ],
            ),
            actions: <Widget>[
              CupertinoDialogAction(
                child: Text("确定"),
                onPressed: () {
    
    
                  //点击确定跳转到主页
                  Navigator.push(
                    context,
                      new MaterialPageRoute(builder: (context) =>zhuye()
                      ).then((value) => print(value));
                },
              ),
            ],
          );
        });
  }

猜你喜欢

转载自blog.csdn.net/txaz6/article/details/108997224
今日推荐