0

单击时我有一个 Inkwell 应该显示对话框,但该对话框不显示并且页面只是变暗而没有错误。我只在页面上使用 TextFormFields 调用 AlertDialog 时遇到这种情况。

下面提供的代码摘录。将不胜感激任何帮助。

Stack(
                          alignment: Alignment.centerRight,
                          children: [
                            Form(
                              key: _vvformkey,
                              autovalidateMode: AutovalidateMode.onUserInteraction,
                              child: TextFormField(
                                keyboardType: TextInputType.number,
                                style: GoogleFonts.sourceSansPro(
                                    textStyle: MyTextStyle(18, tblack, FontWeight.w600)
                                ),
                                onFieldSubmitted: (String value){
                                  setState(() {
                                    _vvsubmitted = true;
                                  });
                                },
                                controller: _vvController,
                                decoration: InputDecoration(
                                  alignLabelWithHint: true,
                                  contentPadding: EdgeInsets.only(left: 9),
                                  labelText: 'vv',
                                  labelStyle: TextStyle(fontSize: 16, color: Color.fromRGBO(104, 105, 106, 1.0),fontWeight: FontWeight.w400),
                                  enabledBorder: UnderlineInputBorder(
                                    borderSide: BorderSide(color: Color.fromRGBO(6, 57, 143, 1.0), width: 3.0),
                                  ),
                                  focusedBorder: UnderlineInputBorder(borderSide: const BorderSide(color: Color.fromRGBO(247, 126, 11, 1.0), width: 3.0),),
                                  errorStyle: TextStyle(color: Color.fromRGBO(211, 19, 19, 1.0),fontSize: 14,fontWeight: FontWeight.w700),
                                ),
                                validator: (String value) {
                                  if(__vvsubmitted ==true){
                                    if(value.length < 3){
                                      return 'Value is normally 3 to 4 digits long.';
                                    } else {return null;}
                                  } else{
                                    if(value.length < 3){
                                      return '';
                                    } else {return null;}
                                  }

                                },
                              ),
                            ),
                            InkWell(
                              child: Icon(Icons.info_outline, color: torange,size: 20,),
                              onTap: () async {
                                showDialog(context: context,
                                  builder: (BuildContext context) => _vvinfo(context, screenheight, screenwidth),
                                );
                              },
                            ),

                          ],
                        ),

Widget _vvinfo(context,screenheight,screenwidth){
    return AlertDialog(
      shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(18)),
      backgroundColor: Colors.transparent,
      title: TextWidget('About CC', 12, tblack, FontWeight.w400),
      content: TextWidget('Blah blah blah CC', 12, tblack, FontWeight.w400),
    );
  }
4

0 回答 0