如何向未启用的 textformfeld 添加验证?

How can I add validation to not enabled textformfeld?

我正在尝试在 textformfield 为空时显示错误文本,这工作正常,但只有当用户点击文本字段时他才会看到错误。我想要的是,如果用户点击上传视频并且主题标签的 textfomrfield 为空,则显示错误文本,因此在其未启用时也是如此。 希望有人能帮忙 这是我的代码

Container(
                              width: 170,
                              height: 65,
                                margin: EdgeInsets.only(left: 12, right: 10),
                              child: TextFormField(
                                controller: hashtagcontroller2,
                                decoration: InputDecoration(
                                  hintText: 'Hashtag',
                                  prefixText: '#',
                                   contentPadding: EdgeInsets.fromLTRB(12, 8, 8, 8),
                                    errorText: _validatehashtag2 ? 'Hashtag Can\'t Be Empty' : null,
                                  border: OutlineInputBorder(
                                    borderRadius: const BorderRadius.all(
                                      const Radius.circular(10.0),
                                    ),
                                    borderSide: BorderSide(
                                        width: 2, color: Colors.black),
                                  ),
                                  focusedBorder: OutlineInputBorder(
                                    
                                    borderRadius: const BorderRadius.all( 
                                      const Radius.circular(20.0),
                                    ),
                                    
                                    borderSide: BorderSide(
                                        width: 2, color: Colors.black),
                                  ),//prefixIcon: Icon(Icons.h)
                                ),
                   
                              ),
                            ),
``

首先将容器与列绑定并尝试

Column(
          children: [
            Container(
              width: 170,
              height: 65,
              margin: EdgeInsets.only(left: 12, right: 10),
              child: TextFormField(
                controller: hashtagcontroller2,
                decoration: InputDecoration(
                  hintText: 'Hashtag',
                  prefixText: '#',
                  contentPadding: EdgeInsets.fromLTRB(12, 8, 8, 8),
                  errorText: _validatehashtag2 ? 'Hashtag Can\'t Be Empty' : null,
                  border: OutlineInputBorder(
                    borderRadius: const BorderRadius.all(
                      const Radius.circular(10.0),
                    ),
                    borderSide: BorderSide(
                        width: 2, color: Colors.black),
                  ),
                  focusedBorder: OutlineInputBorder(

                    borderRadius: const BorderRadius.all(
                      const Radius.circular(20.0),
                    ),

                    borderSide: BorderSide(
                        width: 2, color: Colors.black),
                  ),//prefixIcon: Icon(Icons.h)
                ),

              ),
            ),
            RaisedButton(
              onPressed: () {
                setState(() {
                  hashtagcontroller2.text.isEmpty ? _validatehashtag2 = true : _validatehashtag2 = false;
                });
              },
              child: Text('Submit'),
              textColor: Colors.white,
              color: Colors.blueAccent,
            ),],),