flutter 實現 文字中插入圖標並能夠點擊


Container(
                                  padding:
                                      EdgeInsets.only(left: 8.0, right: 12.0),
                                  child: Text.rich(
                                    TextSpan(
                                      style: TextStyle(
                                        fontSize: 12,
                                      ),
                                      recognizer: TapGestureRecognizer()
                                        ..onTap = () async {
                                          print('-->>>>>>>>>-');
                                        },
                                      children: [
                                        TextSpan(
                                            text:
                                                '如客戶是你的微信好友,可復制昵稱到微信搜索,開啟會話。 ',
                                            style: TextStyle(
                                                fontSize: 12.0,
                                                color: Color(0xB2FFFFFF))),
                                        WidgetSpan(
                                            child: SizedBox(
                                          height: 23.0,
                                          width: 23.0,
                                          child:InkWell(
                                            onTap: (){
                                              print('---------------------');
                                            },
                                            child:  Card(
                                                child: Center(
                                                  child: Icon(
                                                    IconData(0xe63c,
                                                        fontFamily: 'saas'),
                                                    size: 12.0,
                                                    color: Colors.black,
                                                  ),
                                                )),
                                          )
                                        ))
                                      ],
                                    ),
                                  )
                                  // Text(
                                  //   "如客戶是你的微信好友,可復制昵稱到微信搜索,開啟會話。",
                                  //   style: TextStyle(
                                  //       fontSize: 12.0, color: Color(0xB2FFFFFF)),
                                  // ),
                                  )),

 

效果

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM