颤抖地在带有动画容器的文本字段附近添加图标按钮

时间:2020-08-27 08:55:11

标签: flutter flutter-layout flutter-dependencies flutter-animation flutter-test

我试图在文本附近(在动画容器内)添加一个图标按钮。我不能放在里面。同样,图标按钮应作为文本字段触发。我应该在哪里放置带有巫婆包装之类的图标按钮小部件? ................................................... ................................................... ................................................... ................................................... ................................................... ................................................... ................................................... ................................................... .......

                     Visibility(
                          visible: kapaac == 1 || kapaac == 0,
                          child: AnimatedContainer(
                            duration: Duration(milliseconds: 200),
                            width: isTextOpen ? 200 : 55,
                            height: 50,
                            decoration: BoxDecoration(
                              borderRadius:
                                  BorderRadius.all(Radius.circular(3)),
                              border: isTextOpen
                                  ? Border.all(
                                      color: Colors.deepOrangeAccent,
                                      width: 1.0,
                                    )
                                  : null,
                            ),

                            child: isTextOpen
                                ? TextField(


                                    controller: _controller,
                                    autofocus: true,
                                    onChanged: (text){
                                      setState(() {
                                        deneme = text;
                                      });
                                    },
                                    textCapitalization:
                                        TextCapitalization.sentences,
                                    decoration: InputDecoration(
                                      hintText: "İsminizi giriniz",
                                      hintStyle: TextStyle(
                                          color: Colors.deepOrangeAccent),
                                      prefixIcon: Icon(
                                        Icons.check,
                                        color: Colors.orange,
                                      ),
                                      border: InputBorder.none,
                                    ),
                                    onSubmitted: ( value) async {
                                      await showDialog<void>(
                                        context: context,
                                        builder: (BuildContext context) {
                                          return
                                              FlatButton(
                                                onPressed: () {
                                                  setState(() {
                                                    isTextOpen = false;
                                                    kapaac = 0;
                                                  });
                                                  Navigator.pop(context);
                                                },
                                                child: const Text('ok'),
                                              );

                                        },
                                      );
                                    },
                                  )
                                : GestureDetector(
                                    onTap: () {
                                      setState(() {
                                        isTextOpen = !isTextOpen;
                                        kapaac = 1;
                                      });
                                    },
                                    child: Text(
                                      deneme.length>0 ? deneme : "Kristin Watson",
                                      style: GoogleFonts.nunitoSans(
                                        textStyle: TextStyle(color: Colors.deepOrangeAccent, letterSpacing: .5),
                                        fontSize: 13.0,
                                        fontWeight: FontWeight.bold,

                                      ),

                                      maxLines: 2,
                                      ),
                                    ),
                                  ),
                          ),

0 个答案:

没有答案