From cfcad2400943b13d13d24912d2c8085f3e04c74a Mon Sep 17 00:00:00 2001 From: wurong <953969641@qq.com> Date: Tue, 24 Sep 2024 15:31:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=8D=E5=88=B6=E5=BC=B9=E7=AA=97=E6=9B=B4?= =?UTF-8?q?=E6=94=B9=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/im/chat_details_page.dart | 441 ++++++++++++++++++---------------- 1 file changed, 232 insertions(+), 209 deletions(-) diff --git a/lib/im/chat_details_page.dart b/lib/im/chat_details_page.dart index 6529616c..1daff184 100644 --- a/lib/im/chat_details_page.dart +++ b/lib/im/chat_details_page.dart @@ -335,9 +335,6 @@ class _ChatDetailsPage extends State refresh().then((value) { refreshState(); }); - // setState(() { - // copyIndex = 0; - // }); }, child: Container( alignment: Alignment.center, @@ -457,90 +454,90 @@ class _ChatDetailsPage extends State // SizedBox( // height: 16.h, // ), - if (copyIndex == 1) - Stack( - alignment: Alignment.bottomCenter, - children: [ - Container( - padding: EdgeInsets.only(bottom: 13.h), - child: Container( - width: 180.w, - decoration: BoxDecoration( - color: Color(0xFF2A2A2A), - borderRadius: BorderRadius.circular(6), - ), - padding: EdgeInsets.symmetric( - horizontal: 32.w, - vertical: 7.5.h, - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - GestureDetector( - onTap: () { - setState(() { - copyIndex = 0; - this.copy(tex); - }); - }, - child: Column( - children: [ - Image.asset( - "assets/image/icon_chat_copy.webp", - height: 16, - width: 16, - ), - SizedBox( - height: 2.h, - ), - Text( - "复制", - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.white, - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - ), - ), - ], - ), - ), - GestureDetector( - onTap: () {}, - child: Column( - children: [ - Image.asset( - "assets/image/icon_chat_delete.webp", - height: 16, - width: 16, - ), - SizedBox( - height: 2.h, - ), - Text( - S.of(context).shanchu, - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.white, - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - ), - ), - ], - ), - ) - ], - ), - ), - ), - Image.asset( - "assets/image/icon_copy_j.webp", - height: 17, - width: 17, - ), - ], - ), + // if (copyIndex == -1) + // Stack( + // alignment: Alignment.bottomCenter, + // children: [ + // Container( + // padding: EdgeInsets.only(bottom: 13.h), + // child: Container( + // width: 180.w, + // decoration: BoxDecoration( + // color: Color(0xFF2A2A2A), + // borderRadius: BorderRadius.circular(6), + // ), + // padding: EdgeInsets.symmetric( + // horizontal: 32.w, + // vertical: 7.5.h, + // ), + // child: Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // crossAxisAlignment: CrossAxisAlignment.center, + // children: [ + // GestureDetector( + // onTap: () { + // setState(() { + // copyIndex = 0; + // this.copy(tex); + // }); + // }, + // child: Column( + // children: [ + // Image.asset( + // "assets/image/icon_chat_copy.webp", + // height: 16, + // width: 16, + // ), + // SizedBox( + // height: 2.h, + // ), + // Text( + // "复制", + // textAlign: TextAlign.center, + // style: TextStyle( + // color: Colors.white, + // fontSize: 12.sp, + // fontWeight: MyFontWeight.regular, + // ), + // ), + // ], + // ), + // ), + // GestureDetector( + // onTap: () {}, + // child: Column( + // children: [ + // Image.asset( + // "assets/image/icon_chat_delete.webp", + // height: 16, + // width: 16, + // ), + // SizedBox( + // height: 2.h, + // ), + // Text( + // S.of(context).shanchu, + // textAlign: TextAlign.center, + // style: TextStyle( + // color: Colors.white, + // fontSize: 12.sp, + // fontWeight: MyFontWeight.regular, + // ), + // ), + // ], + // ), + // ) + // ], + // ), + // ), + // ), + // Image.asset( + // "assets/image/icon_copy_j.webp", + // height: 17, + // width: 17, + // ), + // ], + // ), /// not self if (!isSelf && isText) @@ -617,88 +614,88 @@ class _ChatDetailsPage extends State ), ), - if (copyIndex == 1) - Stack( - alignment: Alignment.bottomCenter, - children: [ - Container( - padding: EdgeInsets.only(bottom: 13.h), - child: Container( - width: 180.w, - decoration: BoxDecoration( - color: Color(0xFF2A2A2A), - borderRadius: BorderRadius.circular(6), - ), - padding: - EdgeInsets.symmetric(horizontal: 32.w, vertical: 7.5.h), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - GestureDetector( - onTap: () { - setState(() { - copyIndex = 0; - this.copy(tex); - }); - }, - child: Column( - children: [ - Image.asset( - "assets/image/icon_chat_copy.webp", - height: 16, - width: 16, - ), - SizedBox( - height: 2.h, - ), - Text( - "复制", - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.white, - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - ), - ), - ], - ), - ), - GestureDetector( - onTap: () {}, - child: Column( - children: [ - Image.asset( - "assets/image/icon_chat_delete.webp", - height: 16, - width: 16, - ), - SizedBox( - height: 2.h, - ), - Text( - S.of(context).shanchu, - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.white, - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - ), - ), - ], - ), - ) - ], - ), - ), - ), - Image.asset( - "assets/image/icon_copy_j.webp", - height: 17, - width: 17, - ), - ], - ), + // if (copyIndex == 1) + // Stack( + // alignment: Alignment.bottomCenter, + // children: [ + // Container( + // padding: EdgeInsets.only(bottom: 13.h), + // child: Container( + // width: 180.w, + // decoration: BoxDecoration( + // color: Color(0xFF2A2A2A), + // borderRadius: BorderRadius.circular(6), + // ), + // padding: + // EdgeInsets.symmetric(horizontal: 32.w, vertical: 7.5.h), + // child: Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // crossAxisAlignment: CrossAxisAlignment.center, + // children: [ + // GestureDetector( + // onTap: () { + // setState(() { + // copyIndex = 0; + // this.copy(tex); + // }); + // }, + // child: Column( + // children: [ + // Image.asset( + // "assets/image/icon_chat_copy.webp", + // height: 16, + // width: 16, + // ), + // SizedBox( + // height: 2.h, + // ), + // Text( + // "复制", + // textAlign: TextAlign.center, + // style: TextStyle( + // color: Colors.white, + // fontSize: 12.sp, + // fontWeight: MyFontWeight.regular, + // ), + // ), + // ], + // ), + // ), + // GestureDetector( + // onTap: () {}, + // child: Column( + // children: [ + // Image.asset( + // "assets/image/icon_chat_delete.webp", + // height: 16, + // width: 16, + // ), + // SizedBox( + // height: 2.h, + // ), + // Text( + // S.of(context).shanchu, + // textAlign: TextAlign.center, + // style: TextStyle( + // color: Colors.white, + // fontSize: 12.sp, + // fontWeight: MyFontWeight.regular, + // ), + // ), + // ], + // ), + // ) + // ], + // ), + // ), + // ), + // Image.asset( + // "assets/image/icon_copy_j.webp", + // height: 17, + // width: 17, + // ), + // ], + // ), /// self if (isSelf && isText) @@ -757,6 +754,7 @@ class _ChatDetailsPage extends State onLongPress: () { setState(() { copyIndex = 1; + // showCustomDialog(position); }); }, child: Text( @@ -1114,64 +1112,89 @@ class _ChatDetailsPage extends State ); } - showCustomDialog(BuildContext context, int position) { + ///复制弹窗 + showCustomDialog(int position) { showDialog( context: context, builder: (BuildContext context) { - return new AlertDialog( - backgroundColor: Color(0xFF2A2A2A), - elevation: 0, + return AlertDialog( + // backgroundColor: Color(0xFF2A2A2A), + // elevation: 0, contentPadding: EdgeInsets.only( top: 8.h, bottom: 5.h, ), content: Container( - height: 40.h, - // width:20.w, - alignment: Alignment.center, + width: 160.w, + height:50.h, + decoration: BoxDecoration( + color: Color(0xFF2A2A2A), + borderRadius: BorderRadius.circular(6), + ), + padding: EdgeInsets.symmetric( + horizontal: 32.w, + vertical: 7.5.h, + ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: [ - Column( - children: [ - Image.asset( - "assets/image/icon_chat_copy.webp", - height: 16, - width: 16, - ), - Text( - "复制", - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.white, - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, + GestureDetector( + onTap: () { + setState(() { + copyIndex = 0; + this.copy(tex); + }); + }, + child: Column( + children: [ + Image.asset( + "assets/image/icon_chat_copy.webp", + height: 16, + width: 16, ), - ), - ], + SizedBox( + height: 2.h, + ), + Text( + "复制", + textAlign: TextAlign.center, + style: TextStyle( + color: Colors.white, + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + ), + ), + ], + ), ), - Column( - children: [ - Image.asset( - "assets/image/icon_chat_delete.webp", - height: 16, - width: 16, - ), - Text( - S.of(context).shanchu, - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.white, - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, + GestureDetector( + onTap: () {}, + child: Column( + children: [ + Image.asset( + "assets/image/icon_chat_delete.webp", + height: 16, + width: 16, ), - ), - ], + SizedBox( + height: 2.h, + ), + Text( + S.of(context).shanchu, + textAlign: TextAlign.center, + style: TextStyle( + color: Colors.white, + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + ), + ), + ], + ), ) ], ), - ), + ) ); }); }