diff --git a/circle_app/assets/images/base/bg.png b/circle_app/assets/images/base/bg.png deleted file mode 100644 index 6f00371..0000000 Binary files a/circle_app/assets/images/base/bg.png and /dev/null differ diff --git a/circle_app/assets/images/base/close_icon.png b/circle_app/assets/images/base/close_icon.png deleted file mode 100644 index 84b4eb8..0000000 Binary files a/circle_app/assets/images/base/close_icon.png and /dev/null differ diff --git a/circle_app/assets/images/base/day2_icon.png b/circle_app/assets/images/base/day2_icon.png deleted file mode 100644 index bdfc7bb..0000000 Binary files a/circle_app/assets/images/base/day2_icon.png and /dev/null differ diff --git a/circle_app/assets/images/base/day3_icon.png b/circle_app/assets/images/base/day3_icon.png deleted file mode 100644 index f8ad30d..0000000 Binary files a/circle_app/assets/images/base/day3_icon.png and /dev/null differ diff --git a/circle_app/assets/images/base/home_back.png b/circle_app/assets/images/base/home_back.png deleted file mode 100644 index 60a420d..0000000 Binary files a/circle_app/assets/images/base/home_back.png and /dev/null differ diff --git a/circle_app/assets/images/base/ic_launcher.png b/circle_app/assets/images/base/ic_launcher.png deleted file mode 100644 index cf3bc73..0000000 Binary files a/circle_app/assets/images/base/ic_launcher.png and /dev/null differ diff --git a/circle_app/assets/images/base/icon_white_vip.png b/circle_app/assets/images/base/icon_white_vip.png deleted file mode 100644 index 75562f6..0000000 Binary files a/circle_app/assets/images/base/icon_white_vip.png and /dev/null differ diff --git a/circle_app/assets/images/base/icon_white_yearvip.png b/circle_app/assets/images/base/icon_white_yearvip.png deleted file mode 100644 index c3b52fb..0000000 Binary files a/circle_app/assets/images/base/icon_white_yearvip.png and /dev/null differ diff --git a/circle_app/assets/images/base/launch_back.webp b/circle_app/assets/images/base/launch_back.webp deleted file mode 100644 index 60810aa..0000000 Binary files a/circle_app/assets/images/base/launch_back.webp and /dev/null differ diff --git a/circle_app/assets/images/base/newgui_bg.png b/circle_app/assets/images/base/newgui_bg.png deleted file mode 100644 index cade16c..0000000 Binary files a/circle_app/assets/images/base/newgui_bg.png and /dev/null differ diff --git a/circle_app/assets/images/base/no_result.png b/circle_app/assets/images/base/no_result.png deleted file mode 100644 index 4f58dad..0000000 Binary files a/circle_app/assets/images/base/no_result.png and /dev/null differ diff --git a/circle_app/assets/images/base/vip.png b/circle_app/assets/images/base/vip.png deleted file mode 100644 index c2dfbe7..0000000 Binary files a/circle_app/assets/images/base/vip.png and /dev/null differ diff --git a/circle_app/assets/images/base/vip_fun_1.png b/circle_app/assets/images/base/vip_fun_1.png deleted file mode 100644 index 2ee4cbf..0000000 Binary files a/circle_app/assets/images/base/vip_fun_1.png and /dev/null differ diff --git a/circle_app/assets/images/base/vip_fun_10.png b/circle_app/assets/images/base/vip_fun_10.png deleted file mode 100644 index b1528f5..0000000 Binary files a/circle_app/assets/images/base/vip_fun_10.png and /dev/null differ diff --git a/circle_app/assets/images/base/vip_fun_11.png b/circle_app/assets/images/base/vip_fun_11.png deleted file mode 100644 index e5dd991..0000000 Binary files a/circle_app/assets/images/base/vip_fun_11.png and /dev/null differ diff --git a/circle_app/assets/images/base/vip_fun_12.png b/circle_app/assets/images/base/vip_fun_12.png deleted file mode 100644 index 435f368..0000000 Binary files a/circle_app/assets/images/base/vip_fun_12.png and /dev/null differ diff --git a/circle_app/assets/images/base/vip_fun_13.png b/circle_app/assets/images/base/vip_fun_13.png deleted file mode 100644 index a66df0d..0000000 Binary files a/circle_app/assets/images/base/vip_fun_13.png and /dev/null differ diff --git a/circle_app/assets/images/base/vip_fun_14.png b/circle_app/assets/images/base/vip_fun_14.png deleted file mode 100644 index d55ccb6..0000000 Binary files a/circle_app/assets/images/base/vip_fun_14.png and /dev/null differ diff --git a/circle_app/assets/images/base/vip_fun_2.png b/circle_app/assets/images/base/vip_fun_2.png deleted file mode 100644 index 788735b..0000000 Binary files a/circle_app/assets/images/base/vip_fun_2.png and /dev/null differ diff --git a/circle_app/assets/images/base/vip_fun_3.png b/circle_app/assets/images/base/vip_fun_3.png deleted file mode 100644 index 581afec..0000000 Binary files a/circle_app/assets/images/base/vip_fun_3.png and /dev/null differ diff --git a/circle_app/assets/images/base/vip_fun_4.png b/circle_app/assets/images/base/vip_fun_4.png deleted file mode 100644 index ca54a1a..0000000 Binary files a/circle_app/assets/images/base/vip_fun_4.png and /dev/null differ diff --git a/circle_app/assets/images/base/vip_fun_5.png b/circle_app/assets/images/base/vip_fun_5.png deleted file mode 100644 index dfb0fb4..0000000 Binary files a/circle_app/assets/images/base/vip_fun_5.png and /dev/null differ diff --git a/circle_app/assets/images/base/vip_fun_6.png b/circle_app/assets/images/base/vip_fun_6.png deleted file mode 100644 index 6448e9c..0000000 Binary files a/circle_app/assets/images/base/vip_fun_6.png and /dev/null differ diff --git a/circle_app/assets/images/base/vip_fun_7.png b/circle_app/assets/images/base/vip_fun_7.png deleted file mode 100644 index 57751e8..0000000 Binary files a/circle_app/assets/images/base/vip_fun_7.png and /dev/null differ diff --git a/circle_app/assets/images/base/vip_fun_8.png b/circle_app/assets/images/base/vip_fun_8.png deleted file mode 100644 index 41fa802..0000000 Binary files a/circle_app/assets/images/base/vip_fun_8.png and /dev/null differ diff --git a/circle_app/assets/images/base/vip_fun_9.png b/circle_app/assets/images/base/vip_fun_9.png deleted file mode 100644 index f272ede..0000000 Binary files a/circle_app/assets/images/base/vip_fun_9.png and /dev/null differ diff --git a/circle_app/assets/images/base/year_vip.png b/circle_app/assets/images/base/year_vip.png deleted file mode 100644 index 3de0b0f..0000000 Binary files a/circle_app/assets/images/base/year_vip.png and /dev/null differ diff --git a/circle_app/assets/images/circle/QA_icon.png b/circle_app/assets/images/circle/QA_icon.png deleted file mode 100644 index 9f2d136..0000000 Binary files a/circle_app/assets/images/circle/QA_icon.png and /dev/null differ diff --git a/circle_app/assets/images/circle/add.png b/circle_app/assets/images/circle/add.png deleted file mode 100644 index 823b60d..0000000 Binary files a/circle_app/assets/images/circle/add.png and /dev/null differ diff --git a/circle_app/assets/images/circle/add_tip_bg.png b/circle_app/assets/images/circle/add_tip_bg.png deleted file mode 100644 index 881a331..0000000 Binary files a/circle_app/assets/images/circle/add_tip_bg.png and /dev/null differ diff --git a/circle_app/assets/images/circle/avatar_bg.png b/circle_app/assets/images/circle/avatar_bg.png deleted file mode 100644 index ee0256f..0000000 Binary files a/circle_app/assets/images/circle/avatar_bg.png and /dev/null differ diff --git a/circle_app/assets/images/circle/callout_icon.png b/circle_app/assets/images/circle/callout_icon.png deleted file mode 100644 index 4341393..0000000 Binary files a/circle_app/assets/images/circle/callout_icon.png and /dev/null differ diff --git a/circle_app/assets/images/circle/chat.png b/circle_app/assets/images/circle/chat.png deleted file mode 100644 index adfcd89..0000000 Binary files a/circle_app/assets/images/circle/chat.png and /dev/null differ diff --git a/circle_app/assets/images/circle/chat_icon.png b/circle_app/assets/images/circle/chat_icon.png deleted file mode 100644 index ed83062..0000000 Binary files a/circle_app/assets/images/circle/chat_icon.png and /dev/null differ diff --git a/circle_app/assets/images/circle/check.png b/circle_app/assets/images/circle/check.png deleted file mode 100644 index d18a60f..0000000 Binary files a/circle_app/assets/images/circle/check.png and /dev/null differ diff --git a/circle_app/assets/images/circle/circile_all_icon.png b/circle_app/assets/images/circle/circile_all_icon.png deleted file mode 100644 index 68ef933..0000000 Binary files a/circle_app/assets/images/circle/circile_all_icon.png and /dev/null differ diff --git a/circle_app/assets/images/circle/circle_bg.png b/circle_app/assets/images/circle/circle_bg.png deleted file mode 100644 index 8b93d3f..0000000 Binary files a/circle_app/assets/images/circle/circle_bg.png and /dev/null differ diff --git a/circle_app/assets/images/circle/circle_desc.png b/circle_app/assets/images/circle/circle_desc.png deleted file mode 100644 index eb83fbe..0000000 Binary files a/circle_app/assets/images/circle/circle_desc.png and /dev/null differ diff --git a/circle_app/assets/images/circle/circle_line.png b/circle_app/assets/images/circle/circle_line.png deleted file mode 100644 index f4da51c..0000000 Binary files a/circle_app/assets/images/circle/circle_line.png and /dev/null differ diff --git a/circle_app/assets/images/circle/circle_selected_bg.png b/circle_app/assets/images/circle/circle_selected_bg.png deleted file mode 100644 index d7d5695..0000000 Binary files a/circle_app/assets/images/circle/circle_selected_bg.png and /dev/null differ diff --git a/circle_app/assets/images/circle/clocked_icon.png b/circle_app/assets/images/circle/clocked_icon.png deleted file mode 100644 index bb09c55..0000000 Binary files a/circle_app/assets/images/circle/clocked_icon.png and /dev/null differ diff --git a/circle_app/assets/images/circle/close.png b/circle_app/assets/images/circle/close.png deleted file mode 100644 index 66e76c9..0000000 Binary files a/circle_app/assets/images/circle/close.png and /dev/null differ diff --git a/circle_app/assets/images/circle/delete.png b/circle_app/assets/images/circle/delete.png deleted file mode 100644 index 767e2a0..0000000 Binary files a/circle_app/assets/images/circle/delete.png and /dev/null differ diff --git a/circle_app/assets/images/circle/hello_icon.png b/circle_app/assets/images/circle/hello_icon.png deleted file mode 100644 index 086cda4..0000000 Binary files a/circle_app/assets/images/circle/hello_icon.png and /dev/null differ diff --git a/circle_app/assets/images/circle/icon_city.png b/circle_app/assets/images/circle/icon_city.png deleted file mode 100644 index 7a60635..0000000 Binary files a/circle_app/assets/images/circle/icon_city.png and /dev/null differ diff --git a/circle_app/assets/images/circle/icon_list_null.png b/circle_app/assets/images/circle/icon_list_null.png deleted file mode 100644 index b42dfac..0000000 Binary files a/circle_app/assets/images/circle/icon_list_null.png and /dev/null differ diff --git a/circle_app/assets/images/circle/icon_location.png b/circle_app/assets/images/circle/icon_location.png deleted file mode 100644 index a6947d6..0000000 Binary files a/circle_app/assets/images/circle/icon_location.png and /dev/null differ diff --git a/circle_app/assets/images/circle/icon_perfect_next.png b/circle_app/assets/images/circle/icon_perfect_next.png deleted file mode 100644 index 3223e18..0000000 Binary files a/circle_app/assets/images/circle/icon_perfect_next.png and /dev/null differ diff --git a/circle_app/assets/images/circle/icon_screen.png b/circle_app/assets/images/circle/icon_screen.png deleted file mode 100644 index c8b524a..0000000 Binary files a/circle_app/assets/images/circle/icon_screen.png and /dev/null differ diff --git a/circle_app/assets/images/circle/like_icon.png b/circle_app/assets/images/circle/like_icon.png deleted file mode 100644 index f91c91f..0000000 Binary files a/circle_app/assets/images/circle/like_icon.png and /dev/null differ diff --git a/circle_app/assets/images/circle/line.png b/circle_app/assets/images/circle/line.png deleted file mode 100644 index a1b3fa0..0000000 Binary files a/circle_app/assets/images/circle/line.png and /dev/null differ diff --git a/circle_app/assets/images/circle/location.png b/circle_app/assets/images/circle/location.png deleted file mode 100644 index 801db5e..0000000 Binary files a/circle_app/assets/images/circle/location.png and /dev/null differ diff --git a/circle_app/assets/images/circle/love_gift_icon.png b/circle_app/assets/images/circle/love_gift_icon.png deleted file mode 100644 index 64f004b..0000000 Binary files a/circle_app/assets/images/circle/love_gift_icon.png and /dev/null differ diff --git a/circle_app/assets/images/circle/love_icon.png b/circle_app/assets/images/circle/love_icon.png deleted file mode 100644 index 38d22b0..0000000 Binary files a/circle_app/assets/images/circle/love_icon.png and /dev/null differ diff --git a/circle_app/assets/images/circle/more.png b/circle_app/assets/images/circle/more.png deleted file mode 100644 index b4d5c3c..0000000 Binary files a/circle_app/assets/images/circle/more.png and /dev/null differ diff --git a/circle_app/assets/images/circle/my_circle.png b/circle_app/assets/images/circle/my_circle.png deleted file mode 100644 index 1554f90..0000000 Binary files a/circle_app/assets/images/circle/my_circle.png and /dev/null differ diff --git a/circle_app/assets/images/circle/no_look_icon.png b/circle_app/assets/images/circle/no_look_icon.png deleted file mode 100644 index e36b656..0000000 Binary files a/circle_app/assets/images/circle/no_look_icon.png and /dev/null differ diff --git a/circle_app/assets/images/circle/no_look_icon_h.png b/circle_app/assets/images/circle/no_look_icon_h.png deleted file mode 100644 index 9af64c5..0000000 Binary files a/circle_app/assets/images/circle/no_look_icon_h.png and /dev/null differ diff --git a/circle_app/assets/images/circle/nor_like_icon.png b/circle_app/assets/images/circle/nor_like_icon.png deleted file mode 100644 index beb5aae..0000000 Binary files a/circle_app/assets/images/circle/nor_like_icon.png and /dev/null differ diff --git a/circle_app/assets/images/circle/normal_bg.png b/circle_app/assets/images/circle/normal_bg.png deleted file mode 100644 index e225e34..0000000 Binary files a/circle_app/assets/images/circle/normal_bg.png and /dev/null differ diff --git a/circle_app/assets/images/circle/open_vip_bg.png b/circle_app/assets/images/circle/open_vip_bg.png deleted file mode 100644 index 01c9105..0000000 Binary files a/circle_app/assets/images/circle/open_vip_bg.png and /dev/null differ diff --git a/circle_app/assets/images/circle/photo.png b/circle_app/assets/images/circle/photo.png deleted file mode 100644 index 761a3a5..0000000 Binary files a/circle_app/assets/images/circle/photo.png and /dev/null differ diff --git a/circle_app/assets/images/circle/pic_bg.png b/circle_app/assets/images/circle/pic_bg.png deleted file mode 100644 index a159085..0000000 Binary files a/circle_app/assets/images/circle/pic_bg.png and /dev/null differ diff --git a/circle_app/assets/images/circle/play.png b/circle_app/assets/images/circle/play.png deleted file mode 100644 index 0fa9f08..0000000 Binary files a/circle_app/assets/images/circle/play.png and /dev/null differ diff --git a/circle_app/assets/images/circle/push.png b/circle_app/assets/images/circle/push.png deleted file mode 100644 index ffe2b82..0000000 Binary files a/circle_app/assets/images/circle/push.png and /dev/null differ diff --git a/circle_app/assets/images/circle/right_icon.png b/circle_app/assets/images/circle/right_icon.png deleted file mode 100644 index e505f8b..0000000 Binary files a/circle_app/assets/images/circle/right_icon.png and /dev/null differ diff --git a/circle_app/assets/images/circle/search_bg_icon.png b/circle_app/assets/images/circle/search_bg_icon.png deleted file mode 100644 index 13c1681..0000000 Binary files a/circle_app/assets/images/circle/search_bg_icon.png and /dev/null differ diff --git a/circle_app/assets/images/circle/search_icon.png b/circle_app/assets/images/circle/search_icon.png deleted file mode 100644 index f088f6f..0000000 Binary files a/circle_app/assets/images/circle/search_icon.png and /dev/null differ diff --git a/circle_app/assets/images/circle/selected.png b/circle_app/assets/images/circle/selected.png deleted file mode 100644 index 4fdfaee..0000000 Binary files a/circle_app/assets/images/circle/selected.png and /dev/null differ diff --git a/circle_app/assets/images/circle/send_msg.png b/circle_app/assets/images/circle/send_msg.png deleted file mode 100644 index 0ce77c9..0000000 Binary files a/circle_app/assets/images/circle/send_msg.png and /dev/null differ diff --git a/circle_app/assets/images/circle/share_more.png b/circle_app/assets/images/circle/share_more.png deleted file mode 100644 index b60ea37..0000000 Binary files a/circle_app/assets/images/circle/share_more.png and /dev/null differ diff --git a/circle_app/assets/images/circle/today_heart_icon.png b/circle_app/assets/images/circle/today_heart_icon.png deleted file mode 100644 index 9edd220..0000000 Binary files a/circle_app/assets/images/circle/today_heart_icon.png and /dev/null differ diff --git a/circle_app/assets/images/circle/top_circle_bg.png b/circle_app/assets/images/circle/top_circle_bg.png deleted file mode 100644 index 0820909..0000000 Binary files a/circle_app/assets/images/circle/top_circle_bg.png and /dev/null differ diff --git a/circle_app/assets/images/circle/uncheck.png b/circle_app/assets/images/circle/uncheck.png deleted file mode 100644 index dcbb85e..0000000 Binary files a/circle_app/assets/images/circle/uncheck.png and /dev/null differ diff --git a/circle_app/assets/images/circle/unclock_icon.png b/circle_app/assets/images/circle/unclock_icon.png deleted file mode 100644 index d54a598..0000000 Binary files a/circle_app/assets/images/circle/unclock_icon.png and /dev/null differ diff --git a/circle_app/assets/images/circle/video.png b/circle_app/assets/images/circle/video.png deleted file mode 100644 index acb4ebd..0000000 Binary files a/circle_app/assets/images/circle/video.png and /dev/null differ diff --git a/circle_app/assets/images/circle/vip.png b/circle_app/assets/images/circle/vip.png deleted file mode 100644 index 11d065a..0000000 Binary files a/circle_app/assets/images/circle/vip.png and /dev/null differ diff --git a/circle_app/assets/images/circle/vip_func.png b/circle_app/assets/images/circle/vip_func.png deleted file mode 100644 index 4b5c57a..0000000 Binary files a/circle_app/assets/images/circle/vip_func.png and /dev/null differ diff --git a/circle_app/assets/images/circle/vip_say.png b/circle_app/assets/images/circle/vip_say.png deleted file mode 100644 index 46f7462..0000000 Binary files a/circle_app/assets/images/circle/vip_say.png and /dev/null differ diff --git a/circle_app/assets/images/circle/wx.png b/circle_app/assets/images/circle/wx.png deleted file mode 100644 index e36abd7..0000000 Binary files a/circle_app/assets/images/circle/wx.png and /dev/null differ diff --git a/circle_app/assets/images/circle/year_vip.png b/circle_app/assets/images/circle/year_vip.png deleted file mode 100644 index 3de0b0f..0000000 Binary files a/circle_app/assets/images/circle/year_vip.png and /dev/null differ diff --git a/circle_app/assets/images/home/icon_in.png b/circle_app/assets/images/home/icon_in.png deleted file mode 100644 index 1e52d02..0000000 Binary files a/circle_app/assets/images/home/icon_in.png and /dev/null differ diff --git a/circle_app/assets/images/home/icon_one_vip.png b/circle_app/assets/images/home/icon_one_vip.png deleted file mode 100644 index 01e225b..0000000 Binary files a/circle_app/assets/images/home/icon_one_vip.png and /dev/null differ diff --git a/circle_app/assets/images/home/icon_vip.png b/circle_app/assets/images/home/icon_vip.png deleted file mode 100644 index e933853..0000000 Binary files a/circle_app/assets/images/home/icon_vip.png and /dev/null differ diff --git a/circle_app/assets/images/home/icon_vip_android.png b/circle_app/assets/images/home/icon_vip_android.png deleted file mode 100644 index 684becf..0000000 Binary files a/circle_app/assets/images/home/icon_vip_android.png and /dev/null differ diff --git a/circle_app/assets/images/home/icon_vip_more.png b/circle_app/assets/images/home/icon_vip_more.png deleted file mode 100644 index c208d0f..0000000 Binary files a/circle_app/assets/images/home/icon_vip_more.png and /dev/null differ diff --git a/circle_app/assets/images/home/im_more.png b/circle_app/assets/images/home/im_more.png deleted file mode 100644 index 762b340..0000000 Binary files a/circle_app/assets/images/home/im_more.png and /dev/null differ diff --git a/circle_app/assets/images/home/mine_circle.png b/circle_app/assets/images/home/mine_circle.png deleted file mode 100644 index d3f1721..0000000 Binary files a/circle_app/assets/images/home/mine_circle.png and /dev/null differ diff --git a/circle_app/assets/images/home/mine_help.png b/circle_app/assets/images/home/mine_help.png deleted file mode 100644 index 2e1f29e..0000000 Binary files a/circle_app/assets/images/home/mine_help.png and /dev/null differ diff --git a/circle_app/assets/images/home/mine_setup.png b/circle_app/assets/images/home/mine_setup.png deleted file mode 100644 index a41cfdb..0000000 Binary files a/circle_app/assets/images/home/mine_setup.png and /dev/null differ diff --git a/circle_app/assets/images/home/mine_vip_icon.png b/circle_app/assets/images/home/mine_vip_icon.png deleted file mode 100644 index 8fb2b57..0000000 Binary files a/circle_app/assets/images/home/mine_vip_icon.png and /dev/null differ diff --git a/circle_app/assets/images/home/open_vip.png b/circle_app/assets/images/home/open_vip.png deleted file mode 100644 index a70b4e6..0000000 Binary files a/circle_app/assets/images/home/open_vip.png and /dev/null differ diff --git a/circle_app/assets/images/home/pay_vip.png b/circle_app/assets/images/home/pay_vip.png deleted file mode 100644 index e8f977d..0000000 Binary files a/circle_app/assets/images/home/pay_vip.png and /dev/null differ diff --git a/circle_app/assets/images/home/wx_close.png b/circle_app/assets/images/home/wx_close.png deleted file mode 100644 index 30fb55f..0000000 Binary files a/circle_app/assets/images/home/wx_close.png and /dev/null differ diff --git a/circle_app/assets/images/home/wx_tip_bg.png b/circle_app/assets/images/home/wx_tip_bg.png deleted file mode 100644 index 1b3884c..0000000 Binary files a/circle_app/assets/images/home/wx_tip_bg.png and /dev/null differ diff --git a/circle_app/assets/images/home/wx_tip_title.png b/circle_app/assets/images/home/wx_tip_title.png deleted file mode 100644 index 0b86770..0000000 Binary files a/circle_app/assets/images/home/wx_tip_title.png and /dev/null differ diff --git a/circle_app/assets/images/login/add.png b/circle_app/assets/images/login/add.png deleted file mode 100644 index 180b83f..0000000 Binary files a/circle_app/assets/images/login/add.png and /dev/null differ diff --git a/circle_app/assets/images/login/desc_bg.png b/circle_app/assets/images/login/desc_bg.png deleted file mode 100644 index 8ea0dc7..0000000 Binary files a/circle_app/assets/images/login/desc_bg.png and /dev/null differ diff --git a/circle_app/assets/images/login/down_arr.png b/circle_app/assets/images/login/down_arr.png deleted file mode 100644 index 8e82b55..0000000 Binary files a/circle_app/assets/images/login/down_arr.png and /dev/null differ diff --git a/circle_app/assets/images/login/edit.png b/circle_app/assets/images/login/edit.png deleted file mode 100644 index 5dadc0b..0000000 Binary files a/circle_app/assets/images/login/edit.png and /dev/null differ diff --git a/circle_app/assets/images/login/icon_logo_name.png b/circle_app/assets/images/login/icon_logo_name.png deleted file mode 100644 index d45c005..0000000 Binary files a/circle_app/assets/images/login/icon_logo_name.png and /dev/null differ diff --git a/circle_app/assets/images/login/start_bg.png b/circle_app/assets/images/login/start_bg.png deleted file mode 100644 index 1f6d4f6..0000000 Binary files a/circle_app/assets/images/login/start_bg.png and /dev/null differ diff --git a/circle_app/assets/images/mine/add_code_icon.png b/circle_app/assets/images/mine/add_code_icon.png deleted file mode 100644 index a2d51d6..0000000 Binary files a/circle_app/assets/images/mine/add_code_icon.png and /dev/null differ diff --git a/circle_app/assets/images/mine/bi_icon1.png b/circle_app/assets/images/mine/bi_icon1.png deleted file mode 100644 index 3cfc788..0000000 Binary files a/circle_app/assets/images/mine/bi_icon1.png and /dev/null differ diff --git a/circle_app/assets/images/mine/bi_icon2.png b/circle_app/assets/images/mine/bi_icon2.png deleted file mode 100644 index dbe5537..0000000 Binary files a/circle_app/assets/images/mine/bi_icon2.png and /dev/null differ diff --git a/circle_app/assets/images/mine/bi_icon3.png b/circle_app/assets/images/mine/bi_icon3.png deleted file mode 100644 index 50370f1..0000000 Binary files a/circle_app/assets/images/mine/bi_icon3.png and /dev/null differ diff --git a/circle_app/assets/images/mine/bi_icon4.png b/circle_app/assets/images/mine/bi_icon4.png deleted file mode 100644 index cae2479..0000000 Binary files a/circle_app/assets/images/mine/bi_icon4.png and /dev/null differ diff --git a/circle_app/assets/images/mine/chevron_left.png b/circle_app/assets/images/mine/chevron_left.png deleted file mode 100644 index e840643..0000000 Binary files a/circle_app/assets/images/mine/chevron_left.png and /dev/null differ diff --git a/circle_app/assets/images/mine/edit_good_review.png b/circle_app/assets/images/mine/edit_good_review.png deleted file mode 100644 index 7ae188c..0000000 Binary files a/circle_app/assets/images/mine/edit_good_review.png and /dev/null differ diff --git a/circle_app/assets/images/mine/gift_no_data.png b/circle_app/assets/images/mine/gift_no_data.png deleted file mode 100644 index e5ec3a0..0000000 Binary files a/circle_app/assets/images/mine/gift_no_data.png and /dev/null differ diff --git a/circle_app/assets/images/mine/gift_no_data_bg.png b/circle_app/assets/images/mine/gift_no_data_bg.png deleted file mode 100644 index 100b1bf..0000000 Binary files a/circle_app/assets/images/mine/gift_no_data_bg.png and /dev/null differ diff --git a/circle_app/assets/images/mine/gift_shop_icon.png b/circle_app/assets/images/mine/gift_shop_icon.png deleted file mode 100644 index efabbdf..0000000 Binary files a/circle_app/assets/images/mine/gift_shop_icon.png and /dev/null differ diff --git a/circle_app/assets/images/mine/gift_top_star.png b/circle_app/assets/images/mine/gift_top_star.png deleted file mode 100644 index dbb7765..0000000 Binary files a/circle_app/assets/images/mine/gift_top_star.png and /dev/null differ diff --git a/circle_app/assets/images/mine/hb.png b/circle_app/assets/images/mine/hb.png deleted file mode 100644 index a147ca4..0000000 Binary files a/circle_app/assets/images/mine/hb.png and /dev/null differ diff --git a/circle_app/assets/images/mine/icon_block.png b/circle_app/assets/images/mine/icon_block.png deleted file mode 100644 index 490bca8..0000000 Binary files a/circle_app/assets/images/mine/icon_block.png and /dev/null differ diff --git a/circle_app/assets/images/mine/icon_cooperate_ali.png b/circle_app/assets/images/mine/icon_cooperate_ali.png deleted file mode 100644 index b0d177e..0000000 Binary files a/circle_app/assets/images/mine/icon_cooperate_ali.png and /dev/null differ diff --git a/circle_app/assets/images/mine/icon_cooperate_wx.png b/circle_app/assets/images/mine/icon_cooperate_wx.png deleted file mode 100644 index 69a3e0f..0000000 Binary files a/circle_app/assets/images/mine/icon_cooperate_wx.png and /dev/null differ diff --git a/circle_app/assets/images/mine/icon_dialog_black.png b/circle_app/assets/images/mine/icon_dialog_black.png deleted file mode 100644 index 2de0b6b..0000000 Binary files a/circle_app/assets/images/mine/icon_dialog_black.png and /dev/null differ diff --git a/circle_app/assets/images/mine/icon_img_add.png b/circle_app/assets/images/mine/icon_img_add.png deleted file mode 100644 index e21998d..0000000 Binary files a/circle_app/assets/images/mine/icon_img_add.png and /dev/null differ diff --git a/circle_app/assets/images/mine/icon_img_del.png b/circle_app/assets/images/mine/icon_img_del.png deleted file mode 100644 index de13ae5..0000000 Binary files a/circle_app/assets/images/mine/icon_img_del.png and /dev/null differ diff --git a/circle_app/assets/images/mine/icon_like.png b/circle_app/assets/images/mine/icon_like.png deleted file mode 100644 index ef94259..0000000 Binary files a/circle_app/assets/images/mine/icon_like.png and /dev/null differ diff --git a/circle_app/assets/images/mine/icon_pay_is_no_select.png b/circle_app/assets/images/mine/icon_pay_is_no_select.png deleted file mode 100644 index 0b1ab7a..0000000 Binary files a/circle_app/assets/images/mine/icon_pay_is_no_select.png and /dev/null differ diff --git a/circle_app/assets/images/mine/icon_pay_select.png b/circle_app/assets/images/mine/icon_pay_select.png deleted file mode 100644 index d253a42..0000000 Binary files a/circle_app/assets/images/mine/icon_pay_select.png and /dev/null differ diff --git a/circle_app/assets/images/mine/icon_play.png b/circle_app/assets/images/mine/icon_play.png deleted file mode 100644 index 7df0ddb..0000000 Binary files a/circle_app/assets/images/mine/icon_play.png and /dev/null differ diff --git a/circle_app/assets/images/mine/icon_recommend_pay_way.png b/circle_app/assets/images/mine/icon_recommend_pay_way.png deleted file mode 100644 index e956039..0000000 Binary files a/circle_app/assets/images/mine/icon_recommend_pay_way.png and /dev/null differ diff --git a/circle_app/assets/images/mine/icon_report.png b/circle_app/assets/images/mine/icon_report.png deleted file mode 100644 index 7a57447..0000000 Binary files a/circle_app/assets/images/mine/icon_report.png and /dev/null differ diff --git a/circle_app/assets/images/mine/icon_upload.png b/circle_app/assets/images/mine/icon_upload.png deleted file mode 100644 index c766b29..0000000 Binary files a/circle_app/assets/images/mine/icon_upload.png and /dev/null differ diff --git a/circle_app/assets/images/mine/icon_user_content.png b/circle_app/assets/images/mine/icon_user_content.png deleted file mode 100644 index b520828..0000000 Binary files a/circle_app/assets/images/mine/icon_user_content.png and /dev/null differ diff --git a/circle_app/assets/images/mine/icon_yean_vip.png b/circle_app/assets/images/mine/icon_yean_vip.png deleted file mode 100644 index 31cf540..0000000 Binary files a/circle_app/assets/images/mine/icon_yean_vip.png and /dev/null differ diff --git a/circle_app/assets/images/mine/im_act_phone.png b/circle_app/assets/images/mine/im_act_phone.png deleted file mode 100644 index 83ae420..0000000 Binary files a/circle_app/assets/images/mine/im_act_phone.png and /dev/null differ diff --git a/circle_app/assets/images/mine/im_down.png b/circle_app/assets/images/mine/im_down.png deleted file mode 100644 index 9558843..0000000 Binary files a/circle_app/assets/images/mine/im_down.png and /dev/null differ diff --git a/circle_app/assets/images/mine/im_feedback.png b/circle_app/assets/images/mine/im_feedback.png deleted file mode 100644 index b74ad7d..0000000 Binary files a/circle_app/assets/images/mine/im_feedback.png and /dev/null differ diff --git a/circle_app/assets/images/mine/im_feedback_write.png b/circle_app/assets/images/mine/im_feedback_write.png deleted file mode 100644 index 27157fc..0000000 Binary files a/circle_app/assets/images/mine/im_feedback_write.png and /dev/null differ diff --git a/circle_app/assets/images/mine/im_first.png b/circle_app/assets/images/mine/im_first.png deleted file mode 100644 index 56754e4..0000000 Binary files a/circle_app/assets/images/mine/im_first.png and /dev/null differ diff --git a/circle_app/assets/images/mine/im_ky_bc.png b/circle_app/assets/images/mine/im_ky_bc.png deleted file mode 100644 index 806e275..0000000 Binary files a/circle_app/assets/images/mine/im_ky_bc.png and /dev/null differ diff --git a/circle_app/assets/images/mine/im_lock.png b/circle_app/assets/images/mine/im_lock.png deleted file mode 100644 index 926956b..0000000 Binary files a/circle_app/assets/images/mine/im_lock.png and /dev/null differ diff --git a/circle_app/assets/images/mine/im_mail.png b/circle_app/assets/images/mine/im_mail.png deleted file mode 100644 index 3af8ebe..0000000 Binary files a/circle_app/assets/images/mine/im_mail.png and /dev/null differ diff --git a/circle_app/assets/images/mine/im_neglect.png b/circle_app/assets/images/mine/im_neglect.png deleted file mode 100644 index f3020eb..0000000 Binary files a/circle_app/assets/images/mine/im_neglect.png and /dev/null differ diff --git a/circle_app/assets/images/mine/im_right.png b/circle_app/assets/images/mine/im_right.png deleted file mode 100644 index ed95647..0000000 Binary files a/circle_app/assets/images/mine/im_right.png and /dev/null differ diff --git a/circle_app/assets/images/mine/im_right_look.png b/circle_app/assets/images/mine/im_right_look.png deleted file mode 100644 index 8606c42..0000000 Binary files a/circle_app/assets/images/mine/im_right_look.png and /dev/null differ diff --git a/circle_app/assets/images/mine/im_service.png b/circle_app/assets/images/mine/im_service.png deleted file mode 100644 index 93197d4..0000000 Binary files a/circle_app/assets/images/mine/im_service.png and /dev/null differ diff --git a/circle_app/assets/images/mine/im_shield.png b/circle_app/assets/images/mine/im_shield.png deleted file mode 100644 index 39e4cd6..0000000 Binary files a/circle_app/assets/images/mine/im_shield.png and /dev/null differ diff --git a/circle_app/assets/images/mine/im_visit.png b/circle_app/assets/images/mine/im_visit.png deleted file mode 100644 index 13d1b12..0000000 Binary files a/circle_app/assets/images/mine/im_visit.png and /dev/null differ diff --git a/circle_app/assets/images/mine/im_wx.png b/circle_app/assets/images/mine/im_wx.png deleted file mode 100644 index da4a565..0000000 Binary files a/circle_app/assets/images/mine/im_wx.png and /dev/null differ diff --git a/circle_app/assets/images/mine/invite_count_bg.png b/circle_app/assets/images/mine/invite_count_bg.png deleted file mode 100644 index f8832d5..0000000 Binary files a/circle_app/assets/images/mine/invite_count_bg.png and /dev/null differ diff --git a/circle_app/assets/images/mine/invite_icon.png b/circle_app/assets/images/mine/invite_icon.png deleted file mode 100644 index be4c34e..0000000 Binary files a/circle_app/assets/images/mine/invite_icon.png and /dev/null differ diff --git a/circle_app/assets/images/mine/invite_line.png b/circle_app/assets/images/mine/invite_line.png deleted file mode 100644 index 2fb034e..0000000 Binary files a/circle_app/assets/images/mine/invite_line.png and /dev/null differ diff --git a/circle_app/assets/images/mine/invite_right_icon.png b/circle_app/assets/images/mine/invite_right_icon.png deleted file mode 100644 index 1290742..0000000 Binary files a/circle_app/assets/images/mine/invite_right_icon.png and /dev/null differ diff --git a/circle_app/assets/images/mine/invite_sys_bg.png b/circle_app/assets/images/mine/invite_sys_bg.png deleted file mode 100644 index 238b719..0000000 Binary files a/circle_app/assets/images/mine/invite_sys_bg.png and /dev/null differ diff --git a/circle_app/assets/images/mine/invite_title.png b/circle_app/assets/images/mine/invite_title.png deleted file mode 100644 index 6c1bee7..0000000 Binary files a/circle_app/assets/images/mine/invite_title.png and /dev/null differ diff --git a/circle_app/assets/images/mine/invite_vip_desc.png b/circle_app/assets/images/mine/invite_vip_desc.png deleted file mode 100644 index eeb4bfb..0000000 Binary files a/circle_app/assets/images/mine/invite_vip_desc.png and /dev/null differ diff --git a/circle_app/assets/images/mine/no_show_icon.png b/circle_app/assets/images/mine/no_show_icon.png deleted file mode 100644 index 0c670be..0000000 Binary files a/circle_app/assets/images/mine/no_show_icon.png and /dev/null differ diff --git a/circle_app/assets/images/mine/phone_icon.png b/circle_app/assets/images/mine/phone_icon.png deleted file mode 100644 index 6248b97..0000000 Binary files a/circle_app/assets/images/mine/phone_icon.png and /dev/null differ diff --git a/circle_app/assets/images/mine/qq.png b/circle_app/assets/images/mine/qq.png deleted file mode 100644 index 98f50f0..0000000 Binary files a/circle_app/assets/images/mine/qq.png and /dev/null differ diff --git a/circle_app/assets/images/mine/save.png b/circle_app/assets/images/mine/save.png deleted file mode 100644 index c662df7..0000000 Binary files a/circle_app/assets/images/mine/save.png and /dev/null differ diff --git a/circle_app/assets/images/mine/share.png b/circle_app/assets/images/mine/share.png deleted file mode 100644 index 1581274..0000000 Binary files a/circle_app/assets/images/mine/share.png and /dev/null differ diff --git a/circle_app/assets/images/mine/share_content_bg.png b/circle_app/assets/images/mine/share_content_bg.png deleted file mode 100644 index 7aed732..0000000 Binary files a/circle_app/assets/images/mine/share_content_bg.png and /dev/null differ diff --git a/circle_app/assets/images/mine/share_title.png b/circle_app/assets/images/mine/share_title.png deleted file mode 100644 index 76badff..0000000 Binary files a/circle_app/assets/images/mine/share_title.png and /dev/null differ diff --git a/circle_app/assets/images/mine/show_icon.png b/circle_app/assets/images/mine/show_icon.png deleted file mode 100644 index 9790e7c..0000000 Binary files a/circle_app/assets/images/mine/show_icon.png and /dev/null differ diff --git a/circle_app/assets/images/mine/un_check_icon.png b/circle_app/assets/images/mine/un_check_icon.png deleted file mode 100644 index aae1478..0000000 Binary files a/circle_app/assets/images/mine/un_check_icon.png and /dev/null differ diff --git a/circle_app/assets/images/mine/wallet.png b/circle_app/assets/images/mine/wallet.png deleted file mode 100644 index e17f92c..0000000 Binary files a/circle_app/assets/images/mine/wallet.png and /dev/null differ diff --git a/circle_app/assets/images/mine/wb.png b/circle_app/assets/images/mine/wb.png deleted file mode 100644 index f6a314f..0000000 Binary files a/circle_app/assets/images/mine/wb.png and /dev/null differ diff --git a/circle_app/assets/images/mine/wen.png b/circle_app/assets/images/mine/wen.png deleted file mode 100644 index 98a9991..0000000 Binary files a/circle_app/assets/images/mine/wen.png and /dev/null differ diff --git a/circle_app/assets/images/mine/wx.png b/circle_app/assets/images/mine/wx.png deleted file mode 100644 index 001705a..0000000 Binary files a/circle_app/assets/images/mine/wx.png and /dev/null differ diff --git a/circle_app/assets/images/mine/wxq.png b/circle_app/assets/images/mine/wxq.png deleted file mode 100644 index fd71535..0000000 Binary files a/circle_app/assets/images/mine/wxq.png and /dev/null differ diff --git a/circle_app/assets/images/msg/CD.png b/circle_app/assets/images/msg/CD.png deleted file mode 100644 index 4fc86ef..0000000 Binary files a/circle_app/assets/images/msg/CD.png and /dev/null differ diff --git a/circle_app/assets/images/msg/FTM.png b/circle_app/assets/images/msg/FTM.png deleted file mode 100644 index 091f6a1..0000000 Binary files a/circle_app/assets/images/msg/FTM.png and /dev/null differ diff --git a/circle_app/assets/images/msg/MTF.png b/circle_app/assets/images/msg/MTF.png deleted file mode 100644 index 60016f4..0000000 Binary files a/circle_app/assets/images/msg/MTF.png and /dev/null differ diff --git a/circle_app/assets/images/msg/emoji.png b/circle_app/assets/images/msg/emoji.png deleted file mode 100644 index 740fe9c..0000000 Binary files a/circle_app/assets/images/msg/emoji.png and /dev/null differ diff --git a/circle_app/assets/images/msg/gift.png b/circle_app/assets/images/msg/gift.png deleted file mode 100644 index b9024f2..0000000 Binary files a/circle_app/assets/images/msg/gift.png and /dev/null differ diff --git a/circle_app/assets/images/msg/gift_bg.png b/circle_app/assets/images/msg/gift_bg.png deleted file mode 100644 index 5f4ac5a..0000000 Binary files a/circle_app/assets/images/msg/gift_bg.png and /dev/null differ diff --git a/circle_app/assets/images/msg/heart_icon.png b/circle_app/assets/images/msg/heart_icon.png deleted file mode 100644 index b60562c..0000000 Binary files a/circle_app/assets/images/msg/heart_icon.png and /dev/null differ diff --git a/circle_app/assets/images/msg/hello.png b/circle_app/assets/images/msg/hello.png deleted file mode 100644 index bf00d24..0000000 Binary files a/circle_app/assets/images/msg/hello.png and /dev/null differ diff --git a/circle_app/assets/images/msg/hu_icon.png b/circle_app/assets/images/msg/hu_icon.png deleted file mode 100644 index e810924..0000000 Binary files a/circle_app/assets/images/msg/hu_icon.png and /dev/null differ diff --git a/circle_app/assets/images/msg/icon_video.png b/circle_app/assets/images/msg/icon_video.png deleted file mode 100644 index 5dd31c2..0000000 Binary files a/circle_app/assets/images/msg/icon_video.png and /dev/null differ diff --git a/circle_app/assets/images/msg/icon_video_camera.png b/circle_app/assets/images/msg/icon_video_camera.png deleted file mode 100644 index 00ac844..0000000 Binary files a/circle_app/assets/images/msg/icon_video_camera.png and /dev/null differ diff --git a/circle_app/assets/images/msg/keyboard.png b/circle_app/assets/images/msg/keyboard.png deleted file mode 100644 index c94598b..0000000 Binary files a/circle_app/assets/images/msg/keyboard.png and /dev/null differ diff --git a/circle_app/assets/images/msg/msg_add_black.png b/circle_app/assets/images/msg/msg_add_black.png deleted file mode 100644 index d31d378..0000000 Binary files a/circle_app/assets/images/msg/msg_add_black.png and /dev/null differ diff --git a/circle_app/assets/images/msg/msg_arr.png b/circle_app/assets/images/msg/msg_arr.png deleted file mode 100644 index c9dbc00..0000000 Binary files a/circle_app/assets/images/msg/msg_arr.png and /dev/null differ diff --git a/circle_app/assets/images/msg/msg_first.png b/circle_app/assets/images/msg/msg_first.png deleted file mode 100644 index 044c8e8..0000000 Binary files a/circle_app/assets/images/msg/msg_first.png and /dev/null differ diff --git a/circle_app/assets/images/msg/msg_love.png b/circle_app/assets/images/msg/msg_love.png deleted file mode 100644 index 2b68134..0000000 Binary files a/circle_app/assets/images/msg/msg_love.png and /dev/null differ diff --git a/circle_app/assets/images/msg/msg_more.png b/circle_app/assets/images/msg/msg_more.png deleted file mode 100644 index 63b1e73..0000000 Binary files a/circle_app/assets/images/msg/msg_more.png and /dev/null differ diff --git a/circle_app/assets/images/msg/msg_pipei.png b/circle_app/assets/images/msg/msg_pipei.png deleted file mode 100644 index 8ff6602..0000000 Binary files a/circle_app/assets/images/msg/msg_pipei.png and /dev/null differ diff --git a/circle_app/assets/images/msg/msg_report.png b/circle_app/assets/images/msg/msg_report.png deleted file mode 100644 index 89e9436..0000000 Binary files a/circle_app/assets/images/msg/msg_report.png and /dev/null differ diff --git a/circle_app/assets/images/msg/msg_share.png b/circle_app/assets/images/msg/msg_share.png deleted file mode 100644 index 5c549f4..0000000 Binary files a/circle_app/assets/images/msg/msg_share.png and /dev/null differ diff --git a/circle_app/assets/images/msg/photo.png b/circle_app/assets/images/msg/photo.png deleted file mode 100644 index f1f07f6..0000000 Binary files a/circle_app/assets/images/msg/photo.png and /dev/null differ diff --git a/circle_app/assets/images/msg/send.png b/circle_app/assets/images/msg/send.png deleted file mode 100644 index b4e5c93..0000000 Binary files a/circle_app/assets/images/msg/send.png and /dev/null differ diff --git a/circle_app/assets/images/msg/share_circle.png b/circle_app/assets/images/msg/share_circle.png deleted file mode 100644 index ecfc831..0000000 Binary files a/circle_app/assets/images/msg/share_circle.png and /dev/null differ diff --git a/circle_app/assets/images/msg/take_photo.png b/circle_app/assets/images/msg/take_photo.png deleted file mode 100644 index 1a91a8f..0000000 Binary files a/circle_app/assets/images/msg/take_photo.png and /dev/null differ diff --git a/circle_app/assets/images/msg/vip_month.png b/circle_app/assets/images/msg/vip_month.png deleted file mode 100644 index 8295c83..0000000 Binary files a/circle_app/assets/images/msg/vip_month.png and /dev/null differ diff --git a/circle_app/assets/images/msg/vip_quarter.png b/circle_app/assets/images/msg/vip_quarter.png deleted file mode 100644 index f768bf4..0000000 Binary files a/circle_app/assets/images/msg/vip_quarter.png and /dev/null differ diff --git a/circle_app/assets/images/msg/vip_year.png b/circle_app/assets/images/msg/vip_year.png deleted file mode 100644 index 33031f2..0000000 Binary files a/circle_app/assets/images/msg/vip_year.png and /dev/null differ diff --git a/circle_app/assets/images/msg/voice.png b/circle_app/assets/images/msg/voice.png deleted file mode 100644 index 6cca7c9..0000000 Binary files a/circle_app/assets/images/msg/voice.png and /dev/null differ diff --git a/circle_app/assets/images/msg/wish.png b/circle_app/assets/images/msg/wish.png deleted file mode 100644 index 84d076d..0000000 Binary files a/circle_app/assets/images/msg/wish.png and /dev/null differ diff --git a/circle_app/assets/images/msg/女.png b/circle_app/assets/images/msg/女.png deleted file mode 100644 index 34558fb..0000000 Binary files a/circle_app/assets/images/msg/女.png and /dev/null differ diff --git a/circle_app/assets/images/msg/男.png b/circle_app/assets/images/msg/男.png deleted file mode 100644 index a3fde53..0000000 Binary files a/circle_app/assets/images/msg/男.png and /dev/null differ diff --git a/circle_app/assets/images/msg/酷儿.png b/circle_app/assets/images/msg/酷儿.png deleted file mode 100644 index 9b4bcfb..0000000 Binary files a/circle_app/assets/images/msg/酷儿.png and /dev/null differ diff --git a/circle_app/assets/images/navigator/back.png b/circle_app/assets/images/navigator/back.png deleted file mode 100644 index 8f6e274..0000000 Binary files a/circle_app/assets/images/navigator/back.png and /dev/null differ diff --git a/circle_app/assets/images/tabbar/call_normal.png b/circle_app/assets/images/tabbar/call_normal.png deleted file mode 100644 index c8a4a0d..0000000 Binary files a/circle_app/assets/images/tabbar/call_normal.png and /dev/null differ diff --git a/circle_app/assets/images/tabbar/call_selected.png b/circle_app/assets/images/tabbar/call_selected.png deleted file mode 100644 index 3eecc8e..0000000 Binary files a/circle_app/assets/images/tabbar/call_selected.png and /dev/null differ diff --git a/circle_app/assets/images/tabbar/circle_normal.png b/circle_app/assets/images/tabbar/circle_normal.png deleted file mode 100644 index 980a8f2..0000000 Binary files a/circle_app/assets/images/tabbar/circle_normal.png and /dev/null differ diff --git a/circle_app/assets/images/tabbar/circle_selected.png b/circle_app/assets/images/tabbar/circle_selected.png deleted file mode 100644 index d168104..0000000 Binary files a/circle_app/assets/images/tabbar/circle_selected.png and /dev/null differ diff --git a/circle_app/assets/images/tabbar/like_normal.png b/circle_app/assets/images/tabbar/like_normal.png deleted file mode 100644 index 1fb9c3b..0000000 Binary files a/circle_app/assets/images/tabbar/like_normal.png and /dev/null differ diff --git a/circle_app/assets/images/tabbar/like_selected.png b/circle_app/assets/images/tabbar/like_selected.png deleted file mode 100644 index de146fa..0000000 Binary files a/circle_app/assets/images/tabbar/like_selected.png and /dev/null differ diff --git a/circle_app/assets/images/tabbar/mine_normal.png b/circle_app/assets/images/tabbar/mine_normal.png deleted file mode 100644 index 3013476..0000000 Binary files a/circle_app/assets/images/tabbar/mine_normal.png and /dev/null differ diff --git a/circle_app/assets/images/tabbar/mine_selected.png b/circle_app/assets/images/tabbar/mine_selected.png deleted file mode 100644 index 96f8bc1..0000000 Binary files a/circle_app/assets/images/tabbar/mine_selected.png and /dev/null differ diff --git a/circle_app/assets/images/tabbar/msg_normal.png b/circle_app/assets/images/tabbar/msg_normal.png deleted file mode 100644 index e95c16b..0000000 Binary files a/circle_app/assets/images/tabbar/msg_normal.png and /dev/null differ diff --git a/circle_app/assets/images/tabbar/msg_selected.png b/circle_app/assets/images/tabbar/msg_selected.png deleted file mode 100644 index bd85fbf..0000000 Binary files a/circle_app/assets/images/tabbar/msg_selected.png and /dev/null differ diff --git a/circle_app/assets/images/tabbar/tabbar_bg.png b/circle_app/assets/images/tabbar/tabbar_bg.png deleted file mode 100644 index 02ccdfd..0000000 Binary files a/circle_app/assets/images/tabbar/tabbar_bg.png and /dev/null differ diff --git a/circle_app/assets/images/tabbar/world_normal.png b/circle_app/assets/images/tabbar/world_normal.png deleted file mode 100644 index c8a4a0d..0000000 Binary files a/circle_app/assets/images/tabbar/world_normal.png and /dev/null differ diff --git a/circle_app/assets/images/tabbar/world_selected.png b/circle_app/assets/images/tabbar/world_selected.png deleted file mode 100644 index 3eecc8e..0000000 Binary files a/circle_app/assets/images/tabbar/world_selected.png and /dev/null differ diff --git a/circle_app/assets/province.json b/circle_app/assets/province.json deleted file mode 100644 index b47ed12..0000000 --- a/circle_app/assets/province.json +++ /dev/null @@ -1,5355 +0,0 @@ -[ - - { - "name": "北京市", - "city": [ - { - "name": "北京市", - "area": [ - "东城区", - "西城区", - "崇文区", - "宣武区", - "朝阳区", - "丰台区", - "石景山区", - "海淀区", - "门头沟区", - "房山区", - "通州区", - "顺义区", - "昌平区", - "大兴区", - "平谷区", - "怀柔区", - "密云县", - "延庆县" - ] - } - ] - }, - { - "name": "天津市", - "city": [ - { - "name": "天津市", - "area": [ - "和平区", - "河东区", - "河西区", - "南开区", - "河北区", - "红桥区", - "塘沽区", - "汉沽区", - "大港区", - "东丽区", - "西青区", - "津南区", - "北辰区", - "武清区", - "宝坻区", - "宁河县", - "静海县", - "蓟 县" - ] - } - ] - }, - { - "name": "河北省", - "city": [ - { - "name": "石家庄市", - "area": [ - "长安区", - "桥东区", - "桥西区", - "新华区", - "郊 区", - "井陉矿区", - "井陉县", - "正定县", - "栾城县", - "行唐县", - "灵寿县", - "高邑县", - "深泽县", - "赞皇县", - "无极县", - "平山县", - "元氏县", - "赵 县", - "辛集市", - "藁", - "晋州市", - "新乐市", - "鹿泉市" - ] - }, - { - "name": "唐山市", - "area": [ - "路南区", - "路北区", - "古冶区", - "开平区", - "新 区", - "丰润县", - "滦 县", - "滦南县", - "乐亭县", - "迁西县", - "玉田县", - "唐海县", - "遵化市", - "丰南市", - "迁安市" - ] - }, - { - "name": "秦皇岛市", - "area": [ - "海港区", - "山海关区", - "北戴河区", - "青龙满族自治县", - "昌黎县", - "抚宁县", - "卢龙县" - ] - }, - { - "name": "邯郸市", - "area": [ - "邯山区", - "丛台区", - "复兴区", - "峰峰矿区", - "邯郸县", - "临漳县", - "成安县", - "大名县", - "涉 县", - "磁 县", - "肥乡县", - "永年县", - "邱 县", - "鸡泽县", - "广平县", - "馆陶县", - "魏 县", - "曲周县", - "武安市" - ] - }, - { - "name": "邢台市", - "area": [ - "桥东区", - "桥西区", - "邢台县", - "临城县", - "内丘县", - "柏乡县", - "隆尧县", - "任 县", - "南和县", - "宁晋县", - "巨鹿县", - "新河县", - "广宗县", - "平乡县", - "威 县", - "清河县", - "临西县", - "南宫市", - "沙河市" - ] - }, - { - "name": "保定市", - "area": [ - "新市区", - "北市区", - "南市区", - "满城县", - "清苑县", - "涞水县", - "阜平县", - "徐水县", - "定兴县", - "唐 县", - "高阳县", - "容城县", - "涞源县", - "望都县", - "安新县", - "易 县", - "曲阳县", - "蠡 县", - "顺平县", - "博野", - "雄县", - "涿州市", - "定州市", - "安国市", - "高碑店市" - ] - }, - { - "name": "张家口", - "area": [ - "桥东区", - "桥西区", - "宣化区", - "下花园区", - "宣化县", - "张北县", - "康保县", - "沽源县", - "尚义县", - "蔚 县", - "阳原县", - "怀安县", - "万全县", - "怀来县", - "涿鹿县", - "赤城县", - "崇礼县" - ] - }, - { - "name": "承德市", - "area": [ - "双桥区", - "双滦区", - "鹰手营子矿区", - "承德县", - "兴隆县", - "平泉县", - "滦平县", - "隆化县", - "丰宁满族自治县", - "宽城满族自治县", - "围场满族蒙古族自治县" - ] - }, - { - "name": "沧州市", - "area": [ - "新华区", - "运河区", - "沧 县", - "青 县", - "东光县", - "海兴县", - "盐山县", - "肃宁县", - "南皮县", - "吴桥县", - "献 县", - "孟村回族自治县", - "泊头市", - "任丘市", - "黄骅市", - "河间市" - ] - }, - { - "name": "廊坊市", - "area": [ - "安次区", - "固安县", - "永清县", - "香河县", - "大城县", - "文安县", - "大厂回族自治县", - "霸州市", - "三河市" - ] - }, - { - "name": "衡水市", - "area": [ - "桃城区", - "枣强县", - "武邑县", - "武强县", - "饶阳县", - "安平县", - "故城县", - "景 县", - "阜城县", - "冀州市", - "深州市" - ] - } - ] - }, - { - "name": "山西省", - "city": [ - { - "name": "太原市", - "area": [ - "小店区", - "迎泽区", - "杏花岭区", - "尖草坪区", - "万柏林区", - "晋源区", - "清徐县", - "阳曲县", - "娄烦县", - "古交市" - ] - }, - { - "name": "大同市", - "area": [ - "城 区", - "矿 区", - "南郊区", - "新荣区", - "阳高县", - "天镇县", - "广灵县", - "灵丘县", - "浑源县", - "左云县", - "大同县" - ] - }, - { - "name": "阳泉市", - "area": [ - "城 区", - "矿 区", - "郊 区", - "平定县", - "盂 县" - ] - }, - { - "name": "长治市", - "area": [ - "城 区", - "郊 区", - "长治县", - "襄垣县", - "屯留县", - "平顺县", - "黎城县", - "壶关县", - "长子县", - "武乡县", - "沁 县", - "沁源县", - "潞城市" - ] - }, - { - "name": "晋城市", - "area": [ - "城 区", - "沁水县", - "阳城县", - "陵川县", - "泽州县", - "高平市" - ] - }, - { - "name": "朔州市", - "area": [ - "朔城区", - "平鲁区", - "山阴县", - "应 县", - "右玉县", - "怀仁县" - ] - }, - { - "name": "忻州市", - "area": [ - "忻府区", - "原平市", - "定襄县", - "五台县", - "代 县", - "繁峙县", - "宁武县", - "静乐县", - "神池县", - "五寨县", - "岢岚县", - "河曲县", - "保德县", - "偏关县" - ] - }, - { - "name": "吕梁市", - "area": [ - "离石区", - "孝义市", - "汾阳市", - "文水县", - "交城县", - "兴 县", - "临 县", - "柳林县", - "石楼县", - "岚 县", - "方山县", - "中阳县", - "交口县" - ] - }, - { - "name": "晋中市", - "area": [ - "榆次市", - "介休市", - "榆社县", - "左权县", - "和顺县", - "昔阳县", - "寿阳县", - "太谷县", - "祁 县", - "平遥县", - "灵石县" - ] - }, - { - "name": "临汾市", - "area": [ - "临汾市", - "侯马市", - "霍州市", - "曲沃县", - "翼城县", - "襄汾县", - "洪洞县", - "古 县", - "安泽县", - "浮山县", - "吉 县", - "乡宁县", - "蒲 县", - "大宁县", - "永和县", - "隰 县", - "汾西县" - ] - }, - { - "name": "运城市", - "area": [ - "运城市", - "永济市", - "河津市", - "芮城县", - "临猗县", - "万荣县", - "新绛县", - "稷山县", - "闻喜县", - "夏 县", - "绛 县", - "平陆县", - "垣曲县" - ] - } - ] - }, - { - "name": "内蒙古", - "city": [ - { - "name": "呼和浩特市", - "area": [ - "新城区", - "回民区", - "玉泉区", - "郊 区", - "土默特左旗", - "托克托县", - "和林格尔县", - "清水河县", - "武川县" - ] - }, - { - "name": "包头市", - "area": [ - "东河区", - "昆都伦区", - "青山区", - "石拐矿区", - "白云矿区", - "郊 区", - "土默特右旗", - "固阳县", - "达尔罕茂明安联合旗" - ] - }, - { - "name": "乌海市", - "area": [ - "海勃湾区", - "海南区", - "乌达区" - ] - }, - { - "name": "赤峰市", - "area": [ - "红山区", - "元宝山区", - "松山区", - "阿鲁科尔沁旗", - "巴林左旗", - "巴林右旗", - "林西县", - "克什克腾旗", - "翁牛特旗", - "喀喇沁旗", - "宁城县", - "敖汉旗" - ] - }, - { - "name": "呼伦贝尔市", - "area": [ - "海拉尔市", - "满洲里市", - "扎兰屯市", - "牙克石市", - "根河市", - "额尔古纳市", - "阿荣旗", - "莫力达瓦达斡尔族自治旗", - "鄂伦春自治旗", - "鄂温克族自治旗", - "新巴尔虎右旗", - "新巴尔虎左旗", - "陈巴尔虎旗" - ] - }, - { - "name": "兴安盟", - "area": [ - "乌兰浩特市", - "阿尔山市", - "科尔沁右翼前旗", - "科尔沁右翼中旗", - "扎赉特旗", - "突泉县" - ] - }, - { - "name": "通辽市", - "area": [ - "科尔沁区", - "霍林郭勒市", - "科尔沁左翼中旗", - "科尔沁左翼后旗", - "开鲁县", - "库伦旗", - "奈曼旗", - "扎鲁特旗" - ] - }, - { - "name": "锡林郭勒盟", - "area": [ - "二连浩特市", - "锡林浩特市", - "阿巴嘎旗", - "苏尼特左旗", - "苏尼特右旗", - "东乌珠穆沁旗", - "西乌珠穆沁旗", - "太仆寺旗", - "镶黄旗", - "正镶白旗", - "正蓝旗", - "多伦县" - ] - }, - { - "name": "乌兰察布盟", - "area": [ - "集宁市", - "丰镇市", - "卓资县", - "化德县", - "商都县", - "兴和县", - "凉城县", - "察哈尔右翼前旗", - "察哈尔右翼中旗", - "察哈尔右翼后旗", - "四子王旗" - ] - }, - { - "name": "鄂尔多斯", - "area": [ - "东胜市", - "达拉特旗", - "准格尔旗", - "鄂托克前旗", - "鄂托克旗", - "杭锦旗", - "乌审旗", - "伊金霍洛旗" - ] - }, - { - "name": "巴彦淖尔", - "area": [ - "临河市", - "五原县", - "磴口县", - "乌拉特前旗", - "乌拉特中旗", - "乌拉特后旗", - "杭锦后旗" - ] - }, - { - "name": "阿拉善盟", - "area": [ - "阿拉善左旗", - "阿拉善右旗", - "额济纳旗" - ] - } - ] - }, - { - "name": "辽宁省", - "city": [ - { - "name": "沈阳市", - "area": [ - "沈河区", - "皇姑区", - "和平区", - "大东区", - "铁西区", - "苏家屯区", - "东陵区", - "于洪区", - "新民市", - "法库县", - "辽中县", - "康平县", - "新城子区", - "其他" - ] - }, - { - "name": "大连市", - "area": [ - "西岗区", - "中山区", - "沙河口区", - "甘井子区", - "旅顺口区", - "金州区", - "瓦房店市", - "普兰店市", - "庄河市", - "长海县", - "其他" - ] - }, - { - "name": "鞍山市", - "area": [ - "铁东区", - "铁西区", - "立山区", - "千山区", - "海城市", - "台安县", - "岫岩满族自治县", - "其他" - ] - }, - { - "name": "抚顺市", - "area": [ - "顺城区", - "新抚区", - "东洲区", - "望花区", - "抚顺县", - "清原满族自治县", - "新宾满族自治县", - "其他" - ] - }, - { - "name": "本溪市", - "area": [ - "平山区", - "明山区", - "溪湖区", - "南芬区", - "本溪满族自治县", - "桓仁满族自治县", - "其他" - ] - }, - { - "name": "丹东市", - "area": [ - "振兴区", - "元宝区", - "振安区", - "东港市", - "凤城市", - "宽甸满族自治县", - "其他" - ] - }, - { - "name": "锦州市", - "area": [ - "太和区", - "古塔区", - "凌河区", - "凌海市", - "黑山县", - "义县", - "北宁市", - "其他" - ] - }, - { - "name": "营口市", - "area": [ - "站前区", - "西市区", - "鲅鱼圈区", - "老边区", - "大石桥市", - "盖州市", - "其他" - ] - }, - { - "name": "阜新市", - "area": [ - "海州区", - "新邱区", - "太平区", - "清河门区", - "细河区", - "彰武县", - "阜新蒙古族自治县", - "其他" - ] - }, - { - "name": "辽阳市", - "area": [ - "白塔区", - "文圣区", - "宏伟区", - "太子河区", - "弓长岭区", - "灯塔市", - "辽阳县", - "其他" - ] - }, - { - "name": "盘锦", - "area": [ - "双台子区", - "兴隆台区", - "盘山县", - "大洼县", - "其他" - ] - }, - { - "name": "铁岭市", - "area": [ - "银州区", - "清河区", - "调兵山市", - "开原市", - "铁岭县", - "昌图县", - "西丰县", - "其他" - ] - }, - { - "name": "朝阳市", - "area": [ - "双塔区", - "龙城区", - "凌源市", - "北票市", - "朝阳县", - "建平县", - "喀喇沁左翼蒙古族自治县", - "其他" - ] - }, - { - "name": "葫芦岛市", - "area": [ - "龙港区", - "南票区", - "连山区", - "兴城市", - "绥中县", - "建昌县", - "其他" - ] - }, - { - "name": "其他", - "area": [ - "其他" - ] - } - ] - }, - { - "name": "吉林省", - "city": [ - { - "name": "长春市", - "area": [ - "朝阳区", - "宽城区", - "二道区", - "南关区", - "绿园区", - "双阳区", - "九台市", - "榆树市", - "德惠市", - "农安县", - "其他" - ] - }, - { - "name": "吉林市", - "area": [ - "船营区", - "昌邑区", - "龙潭区", - "丰满区", - "舒兰市", - "桦甸市", - "蛟河市", - "磐石市", - "永吉县", - "其他" - ] - }, - { - "name": "四平", - "area": [ - "铁西区", - "铁东区", - "公主岭市", - "双辽市", - "梨树县", - "伊通满族自治县", - "其他" - ] - }, - { - "name": "辽源市", - "area": [ - "龙山区", - "西安区", - "东辽县", - "东丰县", - "其他" - ] - }, - { - "name": "通化市", - "area": [ - "东昌区", - "二道江区", - "梅河口市", - "集安市", - "通化县", - "辉南县", - "柳河县", - "其他" - ] - }, - { - "name": "白山市", - "area": [ - "八道江区", - "江源区", - "临江市", - "靖宇县", - "抚松县", - "长白朝鲜族自治县", - "其他" - ] - }, - { - "name": "松原市", - "area": [ - "宁江区", - "乾安县", - "长岭县", - "扶余县", - "前郭尔罗斯蒙古族自治县", - "其他" - ] - }, - { - "name": "白城市", - "area": [ - "洮北区", - "大安市", - "洮南市", - "镇赉县", - "通榆县", - "其他" - ] - }, - { - "name": "延边朝鲜族自治州", - "area": [ - "延吉市", - "图们市", - "敦化市", - "龙井市", - "珲春市", - "和龙市", - "安图县", - "汪清县", - "其他" - ] - }, - { - "name": "其他", - "area": [ - "其他" - ] - } - ] - }, - { - "name": "黑龙江省", - "city": [ - { - "name": "哈尔滨市", - "area": [ - "松北区", - "道里区", - "南岗区", - "平房区", - "香坊区", - "道外区", - "呼兰区", - "阿城区", - "双城市", - "尚志市", - "五常市", - "宾县", - "方正县", - "通河县", - "巴彦县", - "延寿县", - "木兰县", - "依兰县", - "其他" - ] - }, - { - "name": "齐齐哈尔市", - "area": [ - "龙沙区", - "昂昂溪区", - "铁锋区", - "建华区", - "富拉尔基区", - "碾子山区", - "梅里斯达斡尔族区", - "讷河市", - "富裕县", - "拜泉县", - "甘南县", - "依安县", - "克山县", - "泰来县", - "克东县", - "龙江县", - "其他" - ] - }, - { - "name": "鹤岗市", - "area": [ - "兴山区", - "工农区", - "南山区", - "兴安区", - "向阳区", - "东山区", - "萝北县", - "绥滨县", - "其他" - ] - }, - { - "name": "双鸭山", - "area": [ - "尖山区", - "岭东区", - "四方台区", - "宝山区", - "集贤县", - "宝清县", - "友谊县", - "饶河县", - "其他" - ] - }, - { - "name": "鸡西市", - "area": [ - "鸡冠区", - "恒山区", - "城子河区", - "滴道区", - "梨树区", - "麻山区", - "密山市", - "虎林市", - "鸡东县", - "其他" - ] - }, - { - "name": "大庆市", - "area": [ - "萨尔图区", - "红岗区", - "龙凤区", - "让胡路区", - "大同区", - "林甸县", - "肇州县", - "肇源县", - "杜尔伯特蒙古族自治县", - "其他" - ] - }, - { - "name": "伊春市", - "area": [ - "伊春区", - "带岭区", - "南岔区", - "金山屯区", - "西林区", - "美溪区", - "乌马河区", - "翠峦区", - "友好区", - "上甘岭区", - "五营区", - "红星区", - "新青区", - "汤旺河区", - "乌伊岭区", - "铁力市", - "嘉荫县", - "其他" - ] - }, - { - "name": "牡丹江市", - "area": [ - "爱民区", - "东安区", - "阳明区", - "西安区", - "绥芬河市", - "宁安市", - "海林市", - "穆棱市", - "林口县", - "东宁县", - "其他" - ] - }, - { - "name": "佳木斯市", - "area": [ - "向阳区", - "前进区", - "东风区", - "郊区", - "同江市", - "富锦市", - "桦川县", - "抚远县", - "桦南县", - "汤原县", - "其他" - ] - }, - { - "name": "七台河市", - "area": [ - "桃山区", - "新兴区", - "茄子河区", - "勃利县", - "其他" - ] - }, - { - "name": "黑河市", - "area": [ - "爱辉区", - "北安市", - "五大连池市", - "逊克县", - "嫩江县", - "孙吴县", - "其他" - ] - }, - { - "name": "绥化市", - "area": [ - "北林区", - "安达市", - "肇东市", - "海伦市", - "绥棱县", - "兰西县", - "明水县", - "青冈县", - "庆安县", - "望奎县", - "其他" - ] - }, - { - "name": "大兴安岭地区", - "area": [ - "呼玛县", - "塔河县", - "漠河县", - "大兴安岭辖区", - "其他" - ] - }, - { - "name": "其他", - "area": [ - "其他" - ] - } - ] - }, - { - "name": "上海市", - "city": [ - { - "name": "上海市", - "area": [ - "黄浦区", - "卢湾区", - "徐汇区", - "长宁区", - "静安区", - "普陀区", - "闸北区", - "虹口区", - "杨浦区", - "宝山区", - "闵行区", - "嘉定区", - "松江区", - "金山区", - "青浦区", - "南汇区", - "奉贤区", - "浦东新区", - "崇明县", - "其他" - ] - } - ] - }, - { - "name": "江苏省", - "city": [ - { - "name": "南京市", - "area": [ - "玄武区", - "白下区", - "秦淮区", - "建邺区", - "鼓楼区", - "下关区", - "栖霞区", - "雨花台区", - "浦口区", - "江宁区", - "六合区", - "溧水县", - "高淳县", - "其他" - ] - }, - { - "name": "苏州市", - "area": [ - "金阊区", - "平江区", - "沧浪区", - "虎丘区", - "吴中区", - "相城区", - "常熟市", - "张家港市", - "昆山市", - "吴江市", - "太仓市", - "其他" - ] - }, - { - "name": "无锡市", - "area": [ - "崇安区", - "南长区", - "北塘区", - "滨湖区", - "锡山区", - "惠山区", - "江阴市", - "宜兴市", - "其他" - ] - }, - { - "name": "常州市", - "area": [ - "钟楼区", - "天宁区", - "戚墅堰区", - "新北区", - "武进区", - "金坛市", - "溧阳市", - "其他" - ] - }, - { - "name": "镇江市", - "area": [ - "京口区", - "润州区", - "丹徒区", - "丹阳市", - "扬中市", - "句容市", - "其他" - ] - }, - { - "name": "南通市", - "area": [ - "崇川区", - "港闸区", - "通州市", - "如皋市", - "海门市", - "启东市", - "海安县", - "如东县", - "其他" - ] - }, - { - "name": "泰州市", - "area": [ - "海陵区", - "高港区", - "姜堰市", - "泰兴市", - "靖江市", - "兴化市", - "其他" - ] - }, - { - "name": "扬州市", - "area": [ - "广陵区", - "维扬区", - "邗江区", - "江都市", - "仪征市", - "高邮市", - "宝应县", - "其他" - ] - }, - { - "name": "盐城市", - "area": [ - "亭湖区", - "盐都区", - "大丰市", - "东台市", - "建湖县", - "射阳县", - "阜宁县", - "滨海县", - "响水县", - "其他" - ] - }, - { - "name": "连云港市", - "area": [ - "新浦区", - "海州区", - "连云区", - "东海县", - "灌云县", - "赣榆县", - "灌南县", - "其他" - ] - }, - { - "name": "徐州市", - "area": [ - "云龙区", - "鼓楼区", - "九里区", - "泉山区", - "贾汪区", - "邳州市", - "新沂市", - "铜山县", - "睢宁县", - "沛县", - "丰县", - "其他" - ] - }, - { - "name": "淮安市", - "area": [ - "清河区", - "清浦区", - "楚州区", - "淮阴区", - "涟水县", - "洪泽县", - "金湖县", - "盱眙县", - "其他" - ] - }, - { - "name": "宿迁市", - "area": [ - "宿城区", - "宿豫区", - "沭阳县", - "泗阳县", - "泗洪县", - "其他" - ] - }, - { - "name": "其他", - "area": [ - "其他" - ] - } - ] - }, - { - "name": "浙江省", - "city": [ - { - "name": "杭州市", - "area": [ - "拱墅区", - "西湖区", - "上城区", - "下城区", - "江干区", - "滨江区", - "余杭区", - "萧山区", - "建德市", - "富阳市", - "临安市", - "桐庐县", - "淳安县", - "其他" - ] - }, - { - "name": "宁波市", - "area": [ - "海曙区", - "江东区", - "江北区", - "镇海区", - "北仑区", - "鄞州区", - "余姚市", - "慈溪市", - "奉化市", - "宁海县", - "象山县", - "其他" - ] - }, - { - "name": "温州市", - "area": [ - "鹿城区", - "龙湾区", - "瓯海区", - "瑞安市", - "乐清市", - "永嘉县", - "洞头县", - "平阳县", - "苍南县", - "文成县", - "泰顺县", - "其他" - ] - }, - { - "name": "嘉兴市", - "area": [ - "秀城区", - "秀洲区", - "海宁市", - "平湖市", - "桐乡市", - "嘉善县", - "海盐县", - "其他" - ] - }, - { - "name": "湖州市", - "area": [ - "吴兴区", - "南浔区", - "长兴县", - "德清县", - "安吉县", - "其他" - ] - }, - { - "name": "绍兴市", - "area": [ - "越城区", - "诸暨市", - "上虞市", - "嵊州市", - "绍兴县", - "新昌县", - "其他" - ] - }, - { - "name": "金华市", - "area": [ - "婺城区", - "金东区", - "兰溪市", - "义乌市", - "东阳市", - "永康市", - "武义县", - "浦江县", - "磐安县", - "其他" - ] - }, - { - "name": "衢州市", - "area": [ - "柯城区", - "衢江区", - "江山市", - "龙游县", - "常山县", - "开化县", - "其他" - ] - }, - { - "name": "舟山市", - "area": [ - "定海区", - "普陀区", - "岱山县", - "嵊泗县", - "其他" - ] - }, - { - "name": "台州市", - "area": [ - "椒江区", - "黄岩区", - "路桥区", - "临海市", - "温岭市", - "玉环县", - "天台县", - "仙居县", - "三门县", - "其他" - ] - }, - { - "name": "丽水市", - "area": [ - "莲都区", - "龙泉市", - "缙云县", - "青田县", - "云和县", - "遂昌县", - "松阳县", - "庆元县", - "景宁畲族自治县", - "其他" - ] - }, - { - "name": "其他市", - "area": [ - "其他" - ] - } - ] - }, - { - "name": "安徽省", - "city": [ - { - "name": "合肥市", - "area": [ - "庐阳区", - "瑶海区", - "蜀山区", - "包河区", - "长丰县", - "肥东县", - "肥西县", - "其他" - ] - }, - { - "name": "芜湖市", - "area": [ - "镜湖区", - "弋江区", - "鸠江区", - "三山区", - "芜湖县", - "南陵县", - "繁昌县", - "其他" - ] - }, - { - "name": "蚌埠市", - "area": [ - "蚌山区", - "龙子湖区", - "禹会区", - "淮上区", - "怀远县", - "固镇县", - "五河县", - "其他" - ] - }, - { - "name": "淮南市", - "area": [ - "田家庵区", - "大通区", - "谢家集区", - "八公山区", - "潘集区", - "凤台县", - "其他" - ] - }, - { - "name": "马鞍山市", - "area": [ - "雨山区", - "花山区", - "金家庄区", - "当涂县", - "其他" - ] - }, - { - "name": "淮北市", - "area": [ - "相山区", - "杜集区", - "烈山区", - "濉溪县", - "其他" - ] - }, - { - "name": "铜陵市", - "area": [ - "铜官山区", - "狮子山区", - "郊区", - "铜陵县", - "其他" - ] - }, - { - "name": "安庆市", - "area": [ - "迎江区", - "大观区", - "宜秀区", - "桐城市", - "宿松县", - "枞阳县", - "太湖县", - "怀宁县", - "岳西县", - "望江县", - "潜山县", - "其他" - ] - }, - { - "name": "黄山市", - "area": [ - "屯溪区", - "黄山区", - "徽州区", - "休宁县", - "歙县", - "祁门县", - "黟县", - "其他" - ] - }, - { - "name": "滁州市", - "area": [ - "琅琊区", - "南谯区", - "天长市", - "明光市", - "全椒县", - "来安县", - "定远县", - "凤阳县", - "其他" - ] - }, - { - "name": "阜阳市", - "area": [ - "颍州区", - "颍东区", - "颍泉区", - "界首市", - "临泉县", - "颍上县", - "阜南县", - "太和县", - "其他" - ] - }, - { - "name": "宿州市", - "area": [ - "埇桥区", - "萧县", - "泗县", - "砀山县", - "灵璧县", - "其他" - ] - }, - { - "name": "巢湖市", - "area": [ - "居巢区", - "含山县", - "无为县", - "庐江县", - "和县", - "其他" - ] - }, - { - "name": "六安市", - "area": [ - "金安区", - "裕安区", - "寿县", - "霍山县", - "霍邱县", - "舒城县", - "金寨县", - "其他" - ] - }, - { - "name": "亳州市", - "area": [ - "谯城区", - "利辛县", - "涡阳县", - "蒙城县", - "其他" - ] - }, - { - "name": "池州市", - "area": [ - "贵池区", - "东至县", - "石台县", - "青阳县", - "其他" - ] - }, - { - "name": "宣城市", - "area": [ - "宣州区", - "宁国市", - "广德县", - "郎溪县", - "泾县", - "旌德县", - "绩溪县", - "其他" - ] - }, - { - "name": "其他市", - "area": [ - "其他" - ] - } - ] - }, - { - "name": "福建省", - "city": [ - { - "name": "福州市", - "area": [ - "鼓楼区", - "台江区", - "仓山区", - "马尾区", - "晋安区", - "福清市", - "长乐市", - "闽侯县", - "闽清县", - "永泰县", - "连江县", - "罗源县", - "平潭县", - "其他" - ] - }, - { - "name": "厦门市", - "area": [ - "思明区", - "海沧区", - "湖里区", - "集美区", - "同安区", - "翔安区", - "其他" - ] - }, - { - "name": "莆田市", - "area": [ - "城厢区", - "涵江区", - "荔城区", - "秀屿区", - "仙游县", - "其他" - ] - }, - { - "name": "三明市", - "area": [ - "梅列区", - "三元区", - "永安市", - "明溪县", - "将乐县", - "大田县", - "宁化县", - "建宁县", - "沙县", - "尤溪县", - "清流县", - "泰宁县", - "其他" - ] - }, - { - "name": "泉州市", - "area": [ - "鲤城区", - "丰泽区", - "洛江区", - "泉港区", - "石狮市", - "晋江市", - "南安市", - "惠安县", - "永春县", - "安溪县", - "德化县", - "金门县", - "其他" - ] - }, - { - "name": "漳州市", - "area": [ - "芗城区", - "龙文区", - "龙海市", - "平和县", - "南靖县", - "诏安县", - "漳浦县", - "华安县", - "东山县", - "长泰县", - "云霄县", - "其他" - ] - }, - { - "name": "南平市", - "area": [ - "延平区", - "建瓯市", - "邵武市", - "武夷山市", - "建阳市", - "松溪县", - "光泽县", - "顺昌县", - "浦城县", - "政和县", - "其他" - ] - }, - { - "name": "龙岩市", - "area": [ - "新罗区", - "漳平市", - "长汀县", - "武平县", - "上杭县", - "永定县", - "连城县", - "其他" - ] - }, - { - "name": "宁德市", - "area": [ - "蕉城区", - "福安市", - "福鼎市", - "寿宁县", - "霞浦县", - "柘荣县", - "屏南县", - "古田县", - "周宁县", - "其他" - ] - }, - { - "name": "其他", - "area": [ - "其他" - ] - } - ] - }, - { - "name": "江西省", - "city": [ - { - "name": "南昌市", - "area": [ - "东湖区", - "西湖区", - "青云谱区", - "湾里区", - "青山湖区", - "新建县", - "南昌县", - "进贤县", - "安义县", - "其他" - ] - }, - { - "name": "景德镇市", - "area": [ - "珠山区", - "昌江区", - "乐平市", - "浮梁县", - "其他" - ] - }, - { - "name": "萍乡市", - "area": [ - "安源区", - "湘东区", - "莲花县", - "上栗县", - "芦溪县", - "其他" - ] - }, - { - "name": "九江市", - "area": [ - "浔阳区", - "庐山区", - "瑞昌市", - "九江县", - "星子县", - "武宁县", - "彭泽县", - "永修县", - "修水县", - "湖口县", - "德安县", - "都昌县", - "其他" - ] - }, - { - "name": "新余市", - "area": [ - "渝水区", - "分宜县", - "其他" - ] - }, - { - "name": "鹰潭市", - "area": [ - "月湖区", - "贵溪市", - "余江县", - "其他" - ] - }, - { - "name": "赣州市", - "area": [ - "章贡区", - "瑞金市", - "南康市", - "石城县", - "安远县", - "赣县", - "宁都县", - "寻乌县", - "兴国县", - "定南县", - "上犹县", - "于都县", - "龙南县", - "崇义县", - "信丰县", - "全南县", - "大余县", - "会昌县", - "其他" - ] - }, - { - "name": "吉安市", - "area": [ - "吉州区", - "青原区", - "井冈山市", - "吉安县", - "永丰县", - "永新县", - "新干县", - "泰和县", - "峡江县", - "遂川县", - "安福县", - "吉水县", - "万安县", - "其他" - ] - }, - { - "name": "宜春市", - "area": [ - "袁州区", - "丰城市", - "樟树市", - "高安市", - "铜鼓县", - "靖安县", - "宜丰县", - "奉新县", - "万载县", - "上高县", - "其他" - ] - }, - { - "name": "抚州市", - "area": [ - "临川区", - "南丰县", - "乐安县", - "金溪县", - "南城县", - "东乡县", - "资溪县", - "宜黄县", - "广昌县", - "黎川县", - "崇仁县", - "其他" - ] - }, - { - "name": "上饶市", - "area": [ - "信州区", - "德兴市", - "上饶县", - "广丰县", - "鄱阳县", - "婺源县", - "铅山县", - "余干县", - "横峰县", - "弋阳县", - "玉山县", - "万年县", - "其他" - ] - }, - { - "name": "其他", - "area": [ - "其他" - ] - } - ] - }, - { - "name": "山东省", - "city": [ - { - "name": "济南市", - "area": [ - "市中区", - "历下区", - "天桥区", - "槐荫区", - "历城区", - "长清区", - "章丘市", - "平阴县", - "济阳县", - "商河县", - "其他" - ] - }, - { - "name": "青岛市", - "area": [ - "市南区", - "市北区", - "城阳区", - "四方区", - "李沧区", - "黄岛区", - "崂山区", - "胶南市", - "胶州市", - "平度市", - "莱西市", - "即墨市", - "其他" - ] - }, - { - "name": "淄博市", - "area": [ - "张店区", - "临淄区", - "淄川区", - "博山区", - "周村区", - "桓台县", - "高青县", - "沂源县", - "其他" - ] - }, - { - "name": "枣庄市", - "area": [ - "市中区", - "山亭区", - "峄城区", - "台儿庄区", - "薛城区", - "滕州市", - "其他" - ] - }, - { - "name": "东营市", - "area": [ - "东营区", - "河口区", - "垦利县", - "广饶县", - "利津县", - "其他" - ] - }, - { - "name": "烟台市", - "area": [ - "芝罘区", - "福山区", - "牟平区", - "莱山区", - "龙口市", - "莱阳市", - "莱州市", - "招远市", - "蓬莱市", - "栖霞市", - "海阳市", - "长岛县", - "其他" - ] - }, - { - "name": "潍坊市", - "area": [ - "潍城区", - "寒亭区", - "坊子区", - "奎文区", - "青州市", - "诸城市", - "寿光市", - "安丘市", - "高密市", - "昌邑市", - "昌乐县", - "临朐县", - "其他" - ] - }, - { - "name": "济宁市", - "area": [ - "市中区", - "任城区", - "曲阜市", - "兖州市", - "邹城市", - "鱼台县", - "金乡县", - "嘉祥县", - "微山县", - "汶上县", - "泗水县", - "梁山县", - "其他" - ] - }, - { - "name": "泰安市", - "area": [ - "泰山区", - "岱岳区", - "新泰市", - "肥城市", - "宁阳县", - "东平县", - "其他" - ] - }, - { - "name": "威海市", - "area": [ - "环翠区", - "乳山市", - "文登市", - "荣成市", - "其他" - ] - }, - { - "name": "日照市", - "area": [ - "东港区", - "岚山区", - "五莲县", - "莒县", - "其他" - ] - }, - { - "name": "莱芜市", - "area": [ - "莱城区", - "钢城区", - "其他" - ] - }, - { - "name": "临沂市", - "area": [ - "兰山区", - "罗庄区", - "河东区", - "沂南县", - "郯城县", - "沂水县", - "苍山县", - "费县", - "平邑县", - "莒南县", - "蒙阴县", - "临沭县", - "其他" - ] - }, - { - "name": "德州市", - "area": [ - "德城区", - "乐陵市", - "禹城市", - "陵县", - "宁津县", - "齐河县", - "武城县", - "庆云县", - "平原县", - "夏津县", - "临邑县", - "其他" - ] - }, - { - "name": "聊城市", - "area": [ - "东昌府区", - "临清市", - "高唐县", - "阳谷县", - "茌平县", - "莘县", - "东阿县", - "冠县", - "其他" - ] - }, - { - "name": "滨州市", - "area": [ - "滨城区", - "邹平县", - "沾化县", - "惠民县", - "博兴县", - "阳信县", - "无棣县", - "其他" - ] - }, - { - "name": "菏泽市", - "area": [ - "牡丹区", - "鄄城县", - "单县", - "郓城县", - "曹县", - "定陶县", - "巨野县", - "东明县", - "成武县", - "其他" - ] - }, - { - "name": "其他", - "area": [ - "其他" - ] - } - ] - }, - { - "name": "河南省", - "city": [ - { - "name": "郑州市", - "area": [ - "中原区", - "金水区", - "二七区", - "管城回族区", - "上街区", - "惠济区", - "巩义市", - "新郑市", - "新密市", - "登封市", - "荥阳市", - "中牟县", - "其他" - ] - }, - { - "name": "开封市", - "area": [ - "鼓楼区", - "龙亭区", - "顺河回族区", - "禹王台区", - "金明区", - "开封县", - "尉氏县", - "兰考县", - "杞县", - "通许县", - "其他" - ] - }, - { - "name": "洛阳市", - "area": [ - "西工区", - "老城区", - "涧西区", - "瀍河回族区", - "洛龙区", - "吉利区", - "偃师市", - "孟津县", - "汝阳县", - "伊川县", - "洛宁县", - "嵩县", - "宜阳县", - "新安县", - "栾川县", - "其他" - ] - }, - { - "name": "平顶山市", - "area": [ - "新华区", - "卫东区", - "湛河区", - "石龙区", - "汝州市", - "舞钢市", - "宝丰县", - "叶县", - "郏县", - "鲁山县", - "其他" - ] - }, - { - "name": "安阳市", - "area": [ - "北关区", - "文峰区", - "殷都区", - "龙安区", - "林州市", - "安阳县", - "滑县", - "内黄县", - "汤阴县", - "其他" - ] - }, - { - "name": "鹤壁市", - "area": [ - "淇滨区", - "山城区", - "鹤山区", - "浚县", - "淇县", - "其他" - ] - }, - { - "name": "新乡市", - "area": [ - "卫滨区", - "红旗区", - "凤泉区", - "牧野区", - "卫辉市", - "辉县市", - "新乡县", - "获嘉县", - "原阳县", - "长垣县", - "封丘县", - "延津县", - "其他" - ] - }, - { - "name": "焦作市", - "area": [ - "解放区", - "中站区", - "马村区", - "山阳区", - "沁阳市", - "孟州市", - "修武县", - "温县", - "武陟县", - "博爱县", - "其他" - ] - }, - { - "name": "濮阳市", - "area": [ - "华龙区", - "濮阳县", - "南乐县", - "台前县", - "清丰县", - "范县", - "其他" - ] - }, - { - "name": "许昌市", - "area": [ - "魏都区", - "禹州市", - "长葛市", - "许昌县", - "鄢陵县", - "襄城县", - "其他" - ] - }, - { - "name": "漯河市", - "area": [ - "源汇区", - "郾城区", - "召陵区", - "临颍县", - "舞阳县", - "其他" - ] - }, - { - "name": "三门峡市", - "area": [ - "湖滨区", - "义马市", - "灵宝市", - "渑池县", - "卢氏县", - "陕县", - "其他" - ] - }, - { - "name": "南阳市", - "area": [ - "卧龙区", - "宛城区", - "邓州市", - "桐柏县", - "方城县", - "淅川县", - "镇平县", - "唐河县", - "南召县", - "内乡县", - "新野县", - "社旗县", - "西峡县", - "其他" - ] - }, - { - "name": "商丘市", - "area": [ - "梁园区", - "睢阳区", - "永城市", - "宁陵县", - "虞城县", - "民权县", - "夏邑县", - "柘城县", - "睢县", - "其他" - ] - }, - { - "name": "信阳市", - "area": [ - "浉河区", - "平桥区", - "潢川县", - "淮滨县", - "息县", - "新县", - "商城县", - "固始县", - "罗山县", - "光山县", - "其他" - ] - }, - { - "name": "周口市", - "area": [ - "川汇区", - "项城市", - "商水县", - "淮阳县", - "太康县", - "鹿邑县", - "西华县", - "扶沟县", - "沈丘县", - "郸城县", - "其他" - ] - }, - { - "name": "驻马店市", - "area": [ - "驿城区", - "确山县", - "新蔡县", - "上蔡县", - "西平县", - "泌阳县", - "平舆县", - "汝南县", - "遂平县", - "正阳县", - "其他" - ] - }, - { - "name": "焦作市", - "area": [ - "济源市", - "其他" - ] - }, - { - "name": "其他", - "area": [ - "其他" - ] - } - ] - }, - { - "name": "湖北省", - "city": [ - { - "name": "武汉市", - "area": [ - "江岸区", - "武昌区", - "江汉区", - "硚口区", - "汉阳区", - "青山区", - "洪山区", - "东西湖区", - "汉南区", - "蔡甸区", - "江夏区", - "黄陂区", - "新洲区", - "其他" - ] - }, - { - "name": "黄石市", - "area": [ - "黄石港区", - "西塞山区", - "下陆区", - "铁山区", - "大冶市", - "阳新县", - "其他" - ] - }, - { - "name": "十堰市", - "area": [ - "张湾区", - "茅箭区", - "丹江口市", - "郧县", - "竹山县", - "房县", - "郧西县", - "竹溪县", - "其他" - ] - }, - { - "name": "荆州市", - "area": [ - "沙市区", - "荆州区", - "洪湖市", - "石首市", - "松滋市", - "监利县", - "公安县", - "江陵县", - "其他" - ] - }, - { - "name": "宜昌市", - "area": [ - "西陵区", - "伍家岗区", - "点军区", - "猇亭区", - "夷陵区", - "宜都市", - "当阳市", - "枝江市", - "秭归县", - "远安县", - "兴山县", - "五峰土家族自治县", - "长阳土家族自治县", - "其他" - ] - }, - { - "name": "襄樊市", - "area": [ - "襄城区", - "樊城区", - "襄阳区", - "老河口市", - "枣阳市", - "宜城市", - "南漳县", - "谷城县", - "保康县", - "其他" - ] - }, - { - "name": "鄂州市", - "area": [ - "鄂城区", - "华容区", - "梁子湖区", - "其他" - ] - }, - { - "name": "荆门市", - "area": [ - "东宝区", - "掇刀区", - "钟祥市", - "京山县", - "沙洋县", - "其他" - ] - }, - { - "name": "孝感市", - "area": [ - "孝南区", - "应城市", - "安陆市", - "汉川市", - "云梦县", - "大悟县", - "孝昌县", - "其他" - ] - }, - { - "name": "黄冈市", - "area": [ - "黄州区", - "麻城市", - "武穴市", - "红安县", - "罗田县", - "浠水县", - "蕲春县", - "黄梅县", - "英山县", - "团风县", - "其他" - ] - }, - { - "name": "咸宁市", - "area": [ - "咸安区", - "赤壁市", - "嘉鱼县", - "通山县", - "崇阳县", - "通城县", - "其他" - ] - }, - { - "name": "随州市", - "area": [ - "曾都区", - "广水市", - "其他" - ] - }, - { - "name": "恩施土家族苗族自治州", - "area": [ - "恩施市", - "利川市", - "建始县", - "来凤县", - "巴东县", - "鹤峰县", - "宣恩县", - "咸丰县", - "其他" - ] - }, - { - "name": "仙桃市", - "area": [ - "仙桃" - ] - }, - { - "name": "天门市", - "area": [ - "天门" - ] - }, - { - "name": "潜江市", - "area": [ - "潜江" - ] - }, - { - "name": "神农架林区", - "area": [ - "神农架林区" - ] - }, - { - "name": "其他", - "area": [ - "其他" - ] - } - ] - }, - { - "name": "湖南省", - "city": [ - { - "name": "长沙市", - "area": [ - "岳麓区", - "芙蓉区", - "天心区", - "开福区", - "雨花区", - "浏阳市", - "长沙县", - "望城县", - "宁乡县", - "其他" - ] - }, - { - "name": "株洲市", - "area": [ - "天元区", - "荷塘区", - "芦淞区", - "石峰区", - "醴陵市", - "株洲县", - "炎陵县", - "茶陵县", - "攸县", - "其他" - ] - }, - { - "name": "湘潭市", - "area": [ - "岳塘区", - "雨湖区", - "湘乡市", - "韶山市", - "湘潭县", - "其他" - ] - }, - { - "name": "衡阳市", - "area": [ - "雁峰区", - "珠晖区", - "石鼓区", - "蒸湘区", - "南岳区", - "耒阳市", - "常宁市", - "衡阳县", - "衡东县", - "衡山县", - "衡南县", - "祁东县", - "其他" - ] - }, - { - "name": "邵阳市", - "area": [ - "双清区", - "大祥区", - "北塔区", - "武冈市", - "邵东县", - "洞口县", - "新邵县", - "绥宁县", - "新宁县", - "邵阳县", - "隆回县", - "城步苗族自治县", - "其他" - ] - }, - { - "name": "岳阳市", - "area": [ - "岳阳楼区", - "云溪区", - "君山区", - "临湘市", - "汨罗市", - "岳阳县", - "湘阴县", - "平江县", - "华容县", - "其他" - ] - }, - { - "name": "常德市", - "area": [ - "武陵区", - "鼎城区", - "津市市", - "澧县", - "临澧县", - "桃源县", - "汉寿县", - "安乡县", - "石门县", - "其他" - ] - }, - { - "name": "张家界市", - "area": [ - "永定区", - "武陵源区", - "慈利县", - "桑植县", - "其他" - ] - }, - { - "name": "益阳市", - "area": [ - "赫山区", - "资阳区", - "沅江市", - "桃江县", - "南县", - "安化县", - "其他" - ] - }, - { - "name": "郴州市", - "area": [ - "北湖区", - "苏仙区", - "资兴市", - "宜章县", - "汝城县", - "安仁县", - "嘉禾县", - "临武县", - "桂东县", - "永兴县", - "桂阳县", - "其他" - ] - }, - { - "name": "永州市", - "area": [ - "冷水滩区", - "零陵区", - "祁阳县", - "蓝山县", - "宁远县", - "新田县", - "东安县", - "江永县", - "道县", - "双牌县", - "江华瑶族自治县", - "其他" - ] - }, - { - "name": "怀化市", - "area": [ - "鹤城区", - "洪江市", - "会同县", - "沅陵县", - "辰溪县", - "溆浦县", - "中方县", - "新晃侗族自治县", - "芷江侗族自治县", - "通道侗族自治县", - "靖州苗族侗族自治县", - "麻阳苗族自治县", - "其他" - ] - }, - { - "name": "娄底市", - "area": [ - "娄星区", - "冷水江市", - "涟源市", - "新化县", - "双峰县", - "其他" - ] - }, - { - "name": "湘西土家族苗族自治州", - "area": [ - "吉首市", - "古丈县", - "龙山县", - "永顺县", - "凤凰县", - "泸溪县", - "保靖县", - "花垣县", - "其他" - ] - }, - { - "name": "其他", - "area": [ - "其他" - ] - } - ] - }, - { - "name": "广东省", - "city": [ - { - "name": "广州市", - "area": [ - "越秀区", - "荔湾区", - "海珠区", - "天河区", - "白云区", - "黄埔区", - "番禺区", - "花都区", - "南沙区", - "萝岗区", - "增城市", - "从化市", - "其他" - ] - }, - { - "name": "深圳市", - "area": [ - "福田区", - "罗湖区", - "南山区", - "宝安区", - "龙岗区", - "盐田区", - "其他" - ] - }, - { - "name": "东莞市", - "area": [ - "莞城", - "常平", - "塘厦", - "塘厦", - "塘厦", - "其他" - ] - }, - { - "name": "中山市", - "area": [ - "中山" - ] - }, - { - "name": "潮州市", - "area": [ - "湘桥区", - "潮安县", - "饶平县", - "其他" - ] - }, - { - "name": "揭阳市", - "area": [ - "榕城区", - "揭东县", - "揭西县", - "惠来县", - "普宁市", - "其他" - ] - }, - { - "name": "云浮市", - "area": [ - "云城区", - "新兴县", - "郁南县", - "云安县", - "罗定市", - "其他" - ] - }, - { - "name": "珠海市", - "area": [ - "香洲区", - "斗门区", - "金湾区", - "其他" - ] - }, - { - "name": "汕头市", - "area": [ - "金平区", - "濠江区", - "龙湖区", - "潮阳区", - "潮南区", - "澄海区", - "南澳县", - "其他" - ] - }, - { - "name": "韶关市", - "area": [ - "浈江区", - "武江区", - "曲江区", - "乐昌市", - "南雄市", - "始兴县", - "仁化县", - "翁源县", - "新丰县", - "乳源瑶族自治县", - "其他" - ] - }, - { - "name": "佛山市", - "area": [ - "禅城区", - "南海区", - "顺德区", - "三水区", - "高明区", - "其他" - ] - }, - { - "name": "江门市", - "area": [ - "蓬江区", - "江海区", - "新会区", - "恩平市", - "台山市", - "开平市", - "鹤山市", - "其他" - ] - }, - { - "name": "湛江市", - "area": [ - "赤坎区", - "霞山区", - "坡头区", - "麻章区", - "吴川市", - "廉江市", - "雷州市", - "遂溪县", - "徐闻县", - "其他" - ] - }, - { - "name": "茂名市", - "area": [ - "茂南区", - "茂港区", - "化州市", - "信宜市", - "高州市", - "电白县", - "其他" - ] - }, - { - "name": "肇庆市", - "area": [ - "端州区", - "鼎湖区", - "高要市", - "四会市", - "广宁县", - "怀集县", - "封开县", - "德庆县", - "其他" - ] - }, - { - "name": "惠州市", - "area": [ - "惠城区", - "惠阳区", - "博罗县", - "惠东县", - "龙门县", - "其他" - ] - }, - { - "name": "梅州市", - "area": [ - "梅江区", - "兴宁市", - "梅县", - "大埔县", - "丰顺县", - "五华县", - "平远县", - "蕉岭县", - "其他" - ] - }, - { - "name": "汕尾市", - "area": [ - "城区", - "陆丰市", - "海丰县", - "陆河县", - "其他" - ] - }, - { - "name": "河源市", - "area": [ - "源城区", - "紫金县", - "龙川县", - "连平县", - "和平县", - "东源县", - "其他" - ] - }, - { - "name": "阳江市", - "area": [ - "江城区", - "阳春市", - "阳西县", - "阳东县", - "其他" - ] - }, - { - "name": "清远市", - "area": [ - "清城区", - "英德市", - "连州市", - "佛冈县", - "阳山县", - "清新县", - "连山壮族瑶族自治县", - "连南瑶族自治县", - "其他" - ] - } - ] - }, - { - "name": "广西", - "city": [ - { - "name": "南宁市", - "area": [ - "青秀区", - "兴宁区", - "西乡塘区", - "良庆区", - "江南区", - "邕宁区", - "武鸣县", - "隆安县", - "马山县", - "上林县", - "宾阳县", - "横县", - "其他" - ] - }, - { - "name": "柳州市", - "area": [ - "城中区", - "鱼峰区", - "柳北区", - "柳南区", - "柳江县", - "柳城县", - "鹿寨县", - "融安县", - "融水苗族自治县", - "三江侗族自治县", - "其他" - ] - }, - { - "name": "桂林市", - "area": [ - "象山区", - "秀峰区", - "叠彩区", - "七星区", - "雁山区", - "阳朔县", - "临桂县", - "灵川县", - "全州县", - "平乐县", - "兴安县", - "灌阳县", - "荔浦县", - "资源县", - "永福县", - "龙胜各族自治县", - "恭城瑶族自治县", - "其他" - ] - }, - { - "name": "梧州市", - "area": [ - "万秀区", - "蝶山区", - "长洲区", - "岑溪市", - "苍梧县", - "藤县", - "蒙山县", - "其他" - ] - }, - { - "name": "北海市", - "area": [ - "海城区", - "银海区", - "铁山港区", - "合浦县", - "其他" - ] - }, - { - "name": "防城港市", - "area": [ - "港口区", - "防城区", - "东兴市", - "上思县", - "其他" - ] - }, - { - "name": "钦州市", - "area": [ - "钦南区", - "钦北区", - "灵山县", - "浦北县", - "其他" - ] - }, - { - "name": "贵港市", - "area": [ - "港北区", - "港南区", - "覃塘区", - "桂平市", - "平南县", - "其他" - ] - }, - { - "name": "玉林市", - "area": [ - "玉州区", - "北流市", - "容县", - "陆川县", - "博白县", - "兴业县", - "其他" - ] - }, - { - "name": "百色市", - "area": [ - "右江区", - "凌云县", - "平果县", - "西林县", - "乐业县", - "德保县", - "田林县", - "田阳县", - "靖西县", - "田东县", - "那坡县", - "隆林各族自治县", - "其他" - ] - }, - { - "name": "贺州市", - "area": [ - "八步区", - "钟山县", - "昭平县", - "富川瑶族自治县", - "其他" - ] - }, - { - "name": "河池市", - "area": [ - "金城江区", - "宜州市", - "天峨县", - "凤山县", - "南丹县", - "东兰县", - "都安瑶族自治县", - "罗城仫佬族自治县", - "巴马瑶族自治县", - "环江毛南族自治县", - "大化瑶族自治县", - "其他" - ] - }, - { - "name": "来宾市", - "area": [ - "兴宾区", - "合山市", - "象州县", - "武宣县", - "忻城县", - "金秀瑶族自治县", - "其他" - ] - }, - { - "name": "崇左市", - "area": [ - "江州区", - "凭祥市", - "宁明县", - "扶绥县", - "龙州县", - "大新县", - "天等县", - "其他" - ] - }, - { - "name": "其他市", - "area": [ - "其他" - ] - } - ] - }, - { - "name": "海南省", - "city": [ - { - "name": "海口市", - "area": [ - "龙华区", - "秀英区", - "琼山区", - "美兰区", - "其他" - ] - }, - { - "name": "三亚市", - "area": [ - "三亚市", - "其他" - ] - }, - { - "name": "五指山市", - "area": [ - "五指山" - ] - }, - { - "name": "琼海市", - "area": [ - "琼海" - ] - }, - { - "name": "儋州市", - "area": [ - "儋州" - ] - }, - { - "name": "文昌市", - "area": [ - "文昌" - ] - }, - { - "name": "万宁市", - "area": [ - "万宁" - ] - }, - { - "name": "东方市", - "area": [ - "东方" - ] - }, - { - "name": "澄迈县", - "area": [ - "澄迈县" - ] - }, - { - "name": "定安县", - "area": [ - "定安县" - ] - }, - { - "name": "屯昌县", - "area": [ - "屯昌县" - ] - }, - { - "name": "临高县", - "area": [ - "临高县" - ] - }, - { - "name": "白沙黎族自治县", - "area": [ - "白沙黎族自治县" - ] - }, - { - "name": "昌江黎族自治县", - "area": [ - "昌江黎族自治县" - ] - }, - { - "name": "乐东黎族自治县", - "area": [ - "乐东黎族自治县" - ] - }, - { - "name": "陵水黎族自治县", - "area": [ - "陵水黎族自治县" - ] - }, - { - "name": "保亭黎族苗族自治县", - "area": [ - "保亭黎族苗族自治县" - ] - }, - { - "name": "琼中黎族苗族自治县", - "area": [ - "琼中黎族苗族自治县" - ] - }, - { - "name": "其他", - "area": [ - "其他" - ] - } - ] - }, - { - "name": "重庆市", - "city": [ - { - "name": "重庆市", - "area": [ - "渝中区", - "大渡口区", - "江北区", - "南岸区", - "北碚区", - "渝北区", - "巴南区", - "长寿区", - "双桥区", - "沙坪坝区", - "万盛区", - "万州区", - "涪陵区", - "黔江区", - "永川区", - "合川区", - "江津区", - "九龙坡区", - "南川区", - "綦江县", - "潼南县", - "荣昌县", - "璧山县", - "大足县", - "铜梁县", - "梁平县", - "开县", - "忠县", - "城口县", - "垫江县", - "武隆县", - "丰都县", - "奉节县", - "云阳县", - "巫溪县", - "巫山县", - "石柱土家族自治县", - "秀山土家族苗族自治县", - "酉阳土家族苗族自治县", - "彭水苗族土家族自治县", - "其他" - ] - } - ] - }, - { - "name": "四川省", - "city": [ - { - "name": "成都市", - "area": [ - "青羊区", - "锦江区", - "金牛区", - "武侯区", - "成华区", - "龙泉驿区", - "青白江区", - "新都区", - "温江区", - "都江堰市", - "彭州市", - "邛崃市", - "崇州市", - "金堂县", - "郫县", - "新津县", - "双流县", - "蒲江县", - "大邑县", - "其他" - ] - }, - { - "name": "自贡市", - "area": [ - "大安区", - "自流井区", - "贡井区", - "沿滩区", - "荣县", - "富顺县", - "其他" - ] - }, - { - "name": "攀枝花市", - "area": [ - "仁和区", - "米易县", - "盐边县", - "东区", - "西区", - "其他" - ] - }, - { - "name": "泸州市", - "area": [ - "江阳区", - "纳溪区", - "龙马潭区", - "泸县", - "合江县", - "叙永县", - "古蔺县", - "其他" - ] - }, - { - "name": "德阳市", - "area": [ - "旌阳区", - "广汉市", - "什邡市", - "绵竹市", - "罗江县", - "中江县", - "其他" - ] - }, - { - "name": "绵阳市", - "area": [ - "涪城区", - "游仙区", - "江油市", - "盐亭县", - "三台县", - "平武县", - "安县", - "梓潼县", - "北川羌族自治县", - "其他" - ] - }, - { - "name": "广元市", - "area": [ - "元坝区", - "朝天区", - "青川县", - "旺苍县", - "剑阁县", - "苍溪县", - "市中区", - "其他" - ] - }, - { - "name": "遂宁市", - "area": [ - "船山区", - "安居区", - "射洪县", - "蓬溪县", - "大英县", - "其他" - ] - }, - { - "name": "内江市", - "area": [ - "市中区", - "东兴区", - "资中县", - "隆昌县", - "威远县", - "其他" - ] - }, - { - "name": "乐山市", - "area": [ - "市中区", - "五通桥区", - "沙湾区", - "金口河区", - "峨眉山市", - "夹江县", - "井研县", - "犍为县", - "沐川县", - "马边彝族自治县", - "峨边彝族自治县", - "其他" - ] - }, - { - "name": "南充", - "area": [ - "顺庆区", - "高坪区", - "嘉陵区", - "阆中市", - "营山县", - "蓬安县", - "仪陇县", - "南部县", - "西充县", - "其他" - ] - }, - { - "name": "眉山市", - "area": [ - "东坡区", - "仁寿县", - "彭山县", - "洪雅县", - "丹棱县", - "青神县", - "其他" - ] - }, - { - "name": "宜宾市", - "area": [ - "翠屏区", - "宜宾县", - "兴文县", - "南溪县", - "珙县", - "长宁县", - "高县", - "江安县", - "筠连县", - "屏山县", - "其他" - ] - }, - { - "name": "广安市", - "area": [ - "广安区", - "华蓥市", - "岳池县", - "邻水县", - "武胜县", - "其他" - ] - }, - { - "name": "达州市", - "area": [ - "通川区", - "万源市", - "达县", - "渠县", - "宣汉县", - "开江县", - "大竹县", - "其他" - ] - }, - { - "name": "雅安市", - "area": [ - "雨城区", - "芦山县", - "石棉县", - "名山县", - "天全县", - "荥经县", - "宝兴县", - "汉源县", - "其他" - ] - }, - { - "name": "巴中市", - "area": [ - "巴州区", - "南江县", - "平昌县", - "通江县", - "其他" - ] - }, - { - "name": "资阳市", - "area": [ - "雁江区", - "简阳市", - "安岳县", - "乐至县", - "其他" - ] - }, - { - "name": "阿坝藏族羌族自治州", - "area": [ - "马尔康县", - "九寨沟县", - "红原县", - "汶川县", - "阿坝县", - "理县", - "若尔盖县", - "小金县", - "黑水县", - "金川县", - "松潘县", - "壤塘县", - "茂县", - "其他" - ] - }, - { - "name": "甘孜藏族自治州", - "area": [ - "康定县", - "丹巴县", - "炉霍县", - "九龙县", - "甘孜县", - "雅江县", - "新龙县", - "道孚县", - "白玉县", - "理塘县", - "德格县", - "乡城县", - "石渠县", - "稻城县", - "色达县", - "巴塘县", - "泸定县", - "得荣县", - "其他" - ] - }, - { - "name": "凉山彝族自治州", - "area": [ - "西昌市", - "美姑县", - "昭觉县", - "金阳县", - "甘洛县", - "布拖县", - "雷波县", - "普格县", - "宁南县", - "喜德县", - "会东县", - "越西县", - "会理县", - "盐源县", - "德昌县", - "冕宁县", - "木里藏族自治县", - "其他" - ] - }, - { - "name": "其他", - "area": [ - "其他" - ] - } - ] - }, - { - "name": "贵州省", - "city": [ - { - "name": "贵阳市", - "area": [ - "南明区", - "云岩区", - "花溪区", - "乌当区", - "白云区", - "小河区", - "清镇市", - "开阳县", - "修文县", - "息烽县", - "其他" - ] - }, - { - "name": "六盘水市", - "area": [ - "钟山区", - "水城县", - "盘县", - "六枝特区", - "其他" - ] - }, - { - "name": "遵义市", - "area": [ - "红花岗区", - "汇川区", - "赤水市", - "仁怀市", - "遵义县", - "绥阳县", - "桐梓县", - "习水县", - "凤冈县", - "正安县", - "余庆县", - "湄潭县", - "道真仡佬族苗族自治县", - "务川仡佬族苗族自治县", - "其他" - ] - }, - { - "name": "安顺市", - "area": [ - "西秀区", - "普定县", - "平坝县", - "镇宁布依族苗族自治县", - "紫云苗族布依族自治县", - "关岭布依族苗族自治县", - "其他" - ] - }, - { - "name": "铜仁地区", - "area": [ - "铜仁市", - "德江县", - "江口县", - "思南县", - "石阡县", - "玉屏侗族自治县", - "松桃苗族自治县", - "印江土家族苗族自治县", - "沿河土家族自治县", - "万山特区", - "其他" - ] - }, - { - "name": "毕节地区", - "area": [ - "毕节市", - "黔西县", - "大方县", - "织金县", - "金沙县", - "赫章县", - "纳雍县", - "威宁彝族回族苗族自治县", - "其他" - ] - }, - { - "name": "黔西南布依族苗族自治州", - "area": [ - "兴义市", - "望谟县", - "兴仁县", - "普安县", - "册亨县", - "晴隆县", - "贞丰县", - "安龙县", - "其他" - ] - }, - { - "name": "黔东南苗族侗族自治州", - "area": [ - "凯里市", - "施秉县", - "从江县", - "锦屏县", - "镇远县", - "麻江县", - "台江县", - "天柱县", - "黄平县", - "榕江县", - "剑河县", - "三穗县", - "雷山县", - "黎平县", - "岑巩县", - "丹寨县", - "其他" - ] - }, - { - "name": "黔南布依族苗族自治州", - "area": [ - "都匀市", - "福泉市", - "贵定县", - "惠水县", - "罗甸县", - "瓮安县", - "荔波县", - "龙里县", - "平塘县", - "长顺县", - "独山县", - "三都水族自治县", - "其他" - ] - }, - { - "name": "其他", - "area": [ - "其他" - ] - } - ] - }, - { - "name": "云南省", - "city": [ - { - "name": "昆明市", - "area": [ - "盘龙区", - "五华区", - "官渡区", - "西山区", - "东川区", - "安宁市", - "呈贡县", - "晋宁县", - "富民县", - "宜良县", - "嵩明县", - "石林彝族自治县", - "禄劝彝族苗族自治县", - "寻甸回族彝族自治县", - "其他" - ] - }, - { - "name": "曲靖市", - "area": [ - "麒麟区", - "宣威市", - "马龙县", - "沾益县", - "富源县", - "罗平县", - "师宗县", - "陆良县", - "会泽县", - "其他" - ] - }, - { - "name": "玉溪市", - "area": [ - "红塔区", - "江川县", - "澄江县", - "通海县", - "华宁县", - "易门县", - "峨山彝族自治县", - "新平彝族傣族自治县", - "元江哈尼族彝族傣族自治县", - "其他" - ] - }, - { - "name": "保山市", - "area": [ - "隆阳区", - "施甸县", - "腾冲县", - "龙陵县", - "昌宁县", - "其他" - ] - }, - { - "name": "昭通市", - "area": [ - "昭阳区", - "鲁甸县", - "巧家县", - "盐津县", - "大关县", - "永善县", - "绥江县", - "镇雄县", - "彝良县", - "威信县", - "水富县", - "其他" - ] - }, - { - "name": "丽江市", - "area": [ - "古城区", - "永胜县", - "华坪县", - "玉龙纳西族自治县", - "宁蒗彝族自治县", - "其他" - ] - }, - { - "name": "普洱市", - "area": [ - "思茅区", - "普洱哈尼族彝族自治县", - "墨江哈尼族自治县", - "景东彝族自治县", - "景谷傣族彝族自治县", - "镇沅彝族哈尼族拉祜族自治县", - "江城哈尼族彝族自治县", - "孟连傣族拉祜族佤族自治县", - "澜沧拉祜族自治县", - "西盟佤族自治县", - "其他" - ] - }, - { - "name": "临沧市", - "area": [ - "临翔区", - "凤庆县", - "云县", - "永德县", - "镇康县", - "双江拉祜族佤族布朗族傣族自治县", - "耿马傣族佤族自治县", - "沧源佤族自治县", - "其他" - ] - }, - { - "name": "德宏傣族景颇族自治州", - "area": [ - "潞西市", - "瑞丽市", - "梁河县", - "盈江县", - "陇川县", - "其他" - ] - }, - { - "name": "怒江傈僳族自治州", - "area": [ - "泸水县", - "福贡县", - "贡山独龙族怒族自治县", - "兰坪白族普米族自治县", - "其他" - ] - }, - { - "name": "迪庆藏族自治州", - "area": [ - "香格里拉县", - "德钦县", - "维西傈僳族自治县", - "其他" - ] - }, - { - "name": "大理白族自治州", - "area": [ - "大理市", - "祥云县", - "宾川县", - "弥渡县", - "永平县", - "云龙县", - "洱源县", - "剑川县", - "鹤庆县", - "漾濞彝族自治县", - "南涧彝族自治县", - "巍山彝族回族自治县", - "其他" - ] - }, - { - "name": "楚雄彝族自治州", - "area": [ - "楚雄市", - "双柏县", - "牟定县", - "南华县", - "姚安县", - "大姚县", - "永仁县", - "元谋县", - "武定县", - "禄丰县", - "其他" - ] - }, - { - "name": "红河哈尼族彝族自治州", - "area": [ - "蒙自县", - "个旧市", - "开远市", - "绿春县", - "建水县", - "石屏县", - "弥勒县", - "泸西县", - "元阳县", - "红河县", - "金平苗族瑶族傣族自治县", - "河口瑶族自治县", - "屏边苗族自治县", - "其他" - ] - }, - { - "name": "文山壮族苗族自治州", - "area": [ - "文山县", - "砚山县", - "西畴县", - "麻栗坡县", - "马关县", - "丘北县", - "广南县", - "富宁县", - "其他" - ] - }, - { - "name": "西双版纳傣族自治州", - "area": [ - "景洪市", - "勐海县", - "勐腊县", - "其他" - ] - }, - { - "name": "其他", - "area": [ - "其他" - ] - } - ] - }, - { - "name": "西藏", - "city": [ - { - "name": "拉萨市", - "area": [ - "城关区", - "林周县", - "当雄县", - "尼木县", - "曲水县", - "堆龙德庆县", - "达孜县", - "墨竹工卡县", - "其他" - ] - }, - { - "name": "那曲地区", - "area": [ - "那曲县", - "嘉黎县", - "比如县", - "聂荣县", - "安多县", - "申扎县", - "索县", - "班戈县", - "巴青县", - "尼玛县", - "其他" - ] - }, - { - "name": "昌都地区", - "area": [ - "昌都县", - "江达县", - "贡觉县", - "类乌齐县", - "丁青县", - "察雅县", - "八宿县", - "左贡县", - "芒康县", - "洛隆县", - "边坝县", - "其他" - ] - }, - { - "name": "林芝地区", - "area": [ - "林芝县", - "工布江达县", - "米林县", - "墨脱县", - "波密县", - "察隅县", - "朗县", - "其他" - ] - }, - { - "name": "山南地区", - "area": [ - "乃东县", - "扎囊县", - "贡嘎县", - "桑日县", - "琼结县", - "曲松县", - "措美县", - "洛扎县", - "加查县", - "隆子县", - "错那县", - "浪卡子县", - "其他" - ] - }, - { - "name": "日喀则地区", - "area": [ - "日喀则市", - "南木林县", - "江孜县", - "定日县", - "萨迦县", - "拉孜县", - "昂仁县", - "谢通门县", - "白朗县", - "仁布县", - "康马县", - "定结县", - "仲巴县", - "亚东县", - "吉隆县", - "聂拉木县", - "萨嘎县", - "岗巴县", - "其他" - ] - }, - { - "name": "阿里地区", - "area": [ - "噶尔县", - "普兰县", - "札达县", - "日土县", - "革吉县", - "改则县", - "措勤县", - "其他" - ] - }, - { - "name": "其他", - "area": [ - "其他" - ] - } - ] - }, - { - "name": "陕西省", - "city": [ - { - "name": "西安市", - "area": [ - "莲湖区", - "新城区", - "碑林区", - "雁塔区", - "灞桥区", - "未央区", - "阎良区", - "临潼区", - "长安区", - "高陵县", - "蓝田县", - "户县", - "周至县", - "其他" - ] - }, - { - "name": "铜川市", - "area": [ - "耀州区", - "王益区", - "印台区", - "宜君县", - "其他" - ] - }, - { - "name": "宝鸡市", - "area": [ - "渭滨区", - "金台区", - "陈仓区", - "岐山县", - "凤翔县", - "陇县", - "太白县", - "麟游县", - "扶风县", - "千阳县", - "眉县", - "凤县", - "其他" - ] - }, - { - "name": "咸阳市", - "area": [ - "秦都区", - "渭城区", - "杨陵区", - "兴平市", - "礼泉县", - "泾阳县", - "永寿县", - "三原县", - "彬县", - "旬邑县", - "长武县", - "乾县", - "武功县", - "淳化县", - "其他" - ] - }, - { - "name": "渭南市", - "area": [ - "临渭区", - "韩城市", - "华阴市", - "蒲城县", - "潼关县", - "白水县", - "澄城县", - "华县", - "合阳县", - "富平县", - "大荔县", - "其他" - ] - }, - { - "name": "延安市", - "area": [ - "宝塔区", - "安塞县", - "洛川县", - "子长县", - "黄陵县", - "延川县", - "富县", - "延长县", - "甘泉县", - "宜川县", - "志丹县", - "黄龙县", - "吴起县", - "其他" - ] - }, - { - "name": "汉中市", - "area": [ - "汉台区", - "留坝县", - "镇巴县", - "城固县", - "南郑县", - "洋县", - "宁强县", - "佛坪县", - "勉县", - "西乡县", - "略阳县", - "其他" - ] - }, - { - "name": "榆林市", - "area": [ - "榆阳区", - "清涧县", - "绥德县", - "神木县", - "佳县", - "府谷县", - "子洲县", - "靖边县", - "横山县", - "米脂县", - "吴堡县", - "定边县", - "其他" - ] - }, - { - "name": "安康市", - "area": [ - "汉滨区", - "紫阳县", - "岚皋县", - "旬阳县", - "镇坪县", - "平利县", - "石泉县", - "宁陕县", - "白河县", - "汉阴县", - "其他" - ] - }, - { - "name": "商洛市", - "area": [ - "商州区", - "镇安县", - "山阳县", - "洛南县", - "商南县", - "丹凤县", - "柞水县", - "其他" - ] - }, - { - "name": "其他", - "area": [ - "其他" - ] - } - ] - }, - { - "name": "甘肃省", - "city": [ - { - "name": "兰州市", - "area": [ - "城关区", - "七里河区", - "西固区", - "安宁区", - "红古区", - "永登县", - "皋兰县", - "榆中县", - "其他" - ] - }, - { - "name": "嘉峪关市", - "area": [ - "嘉峪关市", - "其他" - ] - }, - { - "name": "金昌市", - "area": [ - "金川区", - "永昌县", - "其他" - ] - }, - { - "name": "白银市", - "area": [ - "白银区", - "平川区", - "靖远县", - "会宁县", - "景泰县", - "其他" - ] - }, - { - "name": "天水市", - "area": [ - "清水县", - "秦安县", - "甘谷县", - "武山县", - "张家川回族自治县", - "北道区", - "秦城区", - "其他" - ] - }, - { - "name": "武威市", - "area": [ - "凉州区", - "民勤县", - "古浪县", - "天祝藏族自治县", - "其他" - ] - }, - { - "name": "酒泉市", - "area": [ - "肃州区", - "玉门市", - "敦煌市", - "金塔县", - "肃北蒙古族自治县", - "阿克塞哈萨克族自治县", - "安西县", - "其他" - ] - }, - { - "name": "张掖市", - "area": [ - "甘州区", - "民乐县", - "临泽县", - "高台县", - "山丹县", - "肃南裕固族自治县", - "其他" - ] - }, - { - "name": "庆阳市", - "area": [ - "西峰区", - "庆城县", - "环县", - "华池县", - "合水县", - "正宁县", - "宁县", - "镇原县", - "其他" - ] - }, - { - "name": "平凉市", - "area": [ - "崆峒区", - "泾川县", - "灵台县", - "崇信县", - "华亭县", - "庄浪县", - "静宁县", - "其他" - ] - }, - { - "name": "定西市", - "area": [ - "安定区", - "通渭县", - "临洮县", - "漳县", - "岷县", - "渭源县", - "陇西县", - "其他" - ] - }, - { - "name": "陇南市", - "area": [ - "武都区", - "成县", - "宕昌县", - "康县", - "文县", - "西和县", - "礼县", - "两当县", - "徽县", - "其他" - ] - }, - { - "name": "临夏回族自治州", - "area": [ - "临夏市", - "临夏县", - "康乐县", - "永靖县", - "广河县", - "和政县", - "东乡族自治县", - "积石山保安族东乡族撒拉族自治县", - "其他" - ] - }, - { - "name": "甘南藏族自治州", - "area": [ - "合作市", - "临潭县", - "卓尼县", - "舟曲县", - "迭部县", - "玛曲县", - "碌曲县", - "夏河县", - "其他" - ] - }, - { - "name": "其他", - "area": [ - "其他" - ] - } - ] - }, - { - "name": "青海省", - "city": [ - { - "name": "西宁市", - "area": [ - "城中区", - "城东区", - "城西区", - "城北区", - "湟源县", - "湟中县", - "大通回族土族自治县", - "其他" - ] - }, - { - "name": "海东地区", - "area": [ - "平安县", - "乐都县", - "民和回族土族自治县", - "互助土族自治县", - "化隆回族自治县", - "循化撒拉族自治县", - "其他" - ] - }, - { - "name": "海北藏族自治州", - "area": [ - "海晏县", - "祁连县", - "刚察县", - "门源回族自治县", - "其他" - ] - }, - { - "name": "海南藏族自治州", - "area": [ - "共和县", - "同德县", - "贵德县", - "兴海县", - "贵南县", - "其他" - ] - }, - { - "name": "黄南藏族自治州", - "area": [ - "同仁县", - "尖扎县", - "泽库县", - "河南蒙古族自治县", - "其他" - ] - }, - { - "name": "果洛藏族自治州", - "area": [ - "玛沁县", - "班玛县", - "甘德县", - "达日县", - "久治县", - "玛多县", - "其他" - ] - }, - { - "name": "玉树藏族自治州", - "area": [ - "玉树县", - "杂多县", - "称多县", - "治多县", - "囊谦县", - "曲麻莱县", - "其他" - ] - }, - { - "name": "海西蒙古族藏族自治州", - "area": [ - "德令哈市", - "格尔木市", - "乌兰县", - "都兰县", - "天峻县", - "其他" - ] - }, - { - "name": "其他", - "area": [ - "其他" - ] - } - ] - }, - { - "name": "宁夏", - "city": [ - { - "name": "银川市", - "area": [ - "兴庆区", - "西夏区", - "金凤区", - "灵武市", - "永宁县", - "贺兰县", - "其他" - ] - }, - { - "name": "石嘴山市", - "area": [ - "大武口区", - "惠农区", - "平罗县", - "其他" - ] - }, - { - "name": "吴忠市", - "area": [ - "利通区", - "青铜峡市", - "盐池县", - "同心县", - "其他" - ] - }, - { - "name": "固原市", - "area": [ - "原州区", - "西吉县", - "隆德县", - "泾源县", - "彭阳县", - "其他" - ] - }, - { - "name": "中卫市", - "area": [ - "沙坡头区", - "中宁县", - "海原县", - "其他" - ] - }, - { - "name": "其他", - "area": [ - "其他" - ] - } - ] - }, - { - "name": "新疆", - "city": [ - { - "name": "乌鲁木齐市", - "area": [ - "天山区", - "沙依巴克区", - "新市区", - "水磨沟区", - "头屯河区", - "达坂城区", - "东山区", - "乌鲁木齐县", - "其他" - ] - }, - { - "name": "克拉玛依市", - "area": [ - "克拉玛依区", - "独山子区", - "白碱滩区", - "乌尔禾区", - "其他" - ] - }, - { - "name": "吐鲁番地区", - "area": [ - "吐鲁番市", - "托克逊县", - "鄯善县", - "其他" - ] - }, - { - "name": "哈密地区", - "area": [ - "哈密市", - "伊吾县", - "巴里坤哈萨克自治县", - "其他" - ] - }, - { - "name": "和田地区", - "area": [ - "和田市", - "和田县", - "洛浦县", - "民丰县", - "皮山县", - "策勒县", - "于田县", - "墨玉县", - "其他" - ] - }, - { - "name": "阿克苏地区", - "area": [ - "阿克苏市", - "温宿县", - "沙雅县", - "拜城县", - "阿瓦提县", - "库车县", - "柯坪县", - "新和县", - "乌什县", - "其他" - ] - }, - { - "name": "喀什地区", - "area": [ - "喀什市", - "巴楚县", - "泽普县", - "伽师县", - "叶城县", - "岳普湖县", - "疏勒县", - "麦盖提县", - "英吉沙县", - "莎车县", - "疏附县", - "塔什库尔干塔吉克自治县", - "其他" - ] - }, - { - "name": "克孜勒苏柯尔克孜自治州", - "area": [ - "阿图什市", - "阿合奇县", - "乌恰县", - "阿克陶县", - "其他" - ] - }, - { - "name": "巴音郭楞蒙古自治州", - "area": [ - "库尔勒市", - "和静县", - "尉犁县", - "和硕县", - "且末县", - "博湖县", - "轮台县", - "若羌县", - "焉耆回族自治县", - "其他" - ] - }, - { - "name": "昌吉回族自治州", - "area": [ - "昌吉市", - "阜康市", - "奇台县", - "玛纳斯县", - "吉木萨尔县", - "呼图壁县", - "木垒哈萨克自治县", - "米泉市", - "其他" - ] - }, - { - "name": "博尔塔拉蒙古自治州", - "area": [ - "博乐市", - "精河县", - "温泉县", - "其他" - ] - }, - { - "name": "石河子", - "area": [ - "石河子" - ] - }, - { - "name": "阿拉尔", - "area": [ - "阿拉尔" - ] - }, - { - "name": "图木舒克", - "area": [ - "图木舒克" - ] - }, - { - "name": "五家渠", - "area": [ - "五家渠" - ] - }, - { - "name": "伊犁哈萨克自治州", - "area": [ - "伊宁市", - "奎屯市", - "伊宁县", - "特克斯县", - "尼勒克县", - "昭苏县", - "新源县", - "霍城县", - "巩留县", - "察布查尔锡伯自治县", - "塔城地区", - "阿勒泰地区", - "其他" - ] - }, - { - "name": "其他", - "area": [ - "其他" - ] - } - ] - }, - { - "name": "台湾省", - "city": [ - { - "name": "台北市", - "area": [ - "内湖区", - "南港区", - "中正区", - "万华区", - "大同区", - "中山区", - "松山区", - "大安区", - "信义区", - "文山区", - "士林区", - "北投区" - ] - }, - { - "name": "新北市", - "area": [ - "板桥区", - "汐止区", - "新店区", - "其他" - ] - }, - { - "name": "桃园市", - "area": [ - "其他" - ] - }, - { - "name": "台中市", - "area": [ - "其他" - ] - }, - { - "name": "台南市", - "area": [ - "其他" - ] - }, - { - "name": "高雄市", - "area": [ - "其他" - ] - } - ] - }, - { - "name": "澳门", - "city": [ - { - "name": "澳门", - "area": [ - "花地玛堂区", - "圣安多尼堂区", - "大堂区", - "望德堂区", - "风顺堂区", - "嘉模堂区", - "圣方济各堂区", - "路凼", - "其他" - ] - } - ] - }, - { - "name": "香港", - "city": [ - { - "name": "香港", - "area": [ - "深水埗区", - "油尖旺区", - "九龙城区", - "黄大仙区", - "观塘区", - "北区", - "大埔区", - "沙田区", - "西贡区", - "元朗区", - "屯门区", - "荃湾区", - "葵青区", - "离岛区", - "中西区", - "湾仔区", - "东区", - "南区", - "其他" - ] - } - ] - } -] diff --git a/circle_app/lib/app/aboutapp/binding.dart b/circle_app/lib/app/aboutapp/binding.dart deleted file mode 100644 index 7959a84..0000000 --- a/circle_app/lib/app/aboutapp/binding.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:get/get.dart'; - -import 'logic.dart'; - -class AboutappBinding extends Bindings { - @override - void dependencies() { - Get.lazyPut(() => AboutappLogic()); - } -} diff --git a/circle_app/lib/app/aboutapp/logic.dart b/circle_app/lib/app/aboutapp/logic.dart deleted file mode 100644 index f373a0e..0000000 --- a/circle_app/lib/app/aboutapp/logic.dart +++ /dev/null @@ -1,82 +0,0 @@ -// import 'package:flutter_install_app/flutter_install_app.dart'; -import 'package:dio/dio.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -// import 'package:flutter_install_app/flutter_install_app.dart'; -import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; -import 'package:get/get.dart'; - -import '../../network/api.dart'; -import '../../network/dio_manager.dart'; -import '../../util/util.dart'; -import '../dialog/UpdateDialog.dart'; -import 'state.dart'; -import 'package:package_info_plus/package_info_plus.dart'; - -class AboutappLogic extends GetxController { - final AboutappState state = AboutappState(); - String version = ""; - UpdateInfo? _updateInfo; - bool isUpdate = false; - String currentVersion = ""; - @override - void onInit() async{ - super.onInit(); - getVersion(); - var data = await DioManager.instance.get(url: Api.APP_VERSION); - var bean = BaseResponse.fromJson( - data, (data) => UpdateInfo.fromJson(data)); - if (bean.isSuccess()) { - isUpdate = bean.data.update == 1; - _updateInfo = bean.data; - version = bean.data.version; - update(); - if (isUpdate) { - showReportDialog(Get.context!, bean.data.constraint == 0, bean.data); - } - } - - //getVersion(); - // getAppVersion(); - } - - getVersion() async { - final info = await PackageInfo.fromPlatform(); - currentVersion = "V${info.version}"; - //version = info.version; - update(); - return version; - } - - getUpVersion() async { - if(isUpdate){ - showReportDialog(Get.context!, _updateInfo!.constraint == 0, _updateInfo!); - }else { - showOKToast("当前已经是最新版本!"); - } - - } - - void showReportDialog( - BuildContext context, bool isDismiss, UpdateInfo updateInfo) { - showDialog( - context: context, - barrierDismissible: isDismiss, - builder: (BuildContext context) { - return UpdateDialog( - isDismiss: isDismiss, - updateInfo: updateInfo, - ); - }, - ); - } - - Future getAppVersion() async { - final info = await PackageInfo.fromPlatform(); - print(info.appName); - print(info.packageName); - print(info.version); - print(info.buildNumber); - } -} diff --git a/circle_app/lib/app/aboutapp/state.dart b/circle_app/lib/app/aboutapp/state.dart deleted file mode 100644 index 7bc6c49..0000000 --- a/circle_app/lib/app/aboutapp/state.dart +++ /dev/null @@ -1,6 +0,0 @@ -class AboutappState { - AboutappState() { - ///Initialize variables - } - -} diff --git a/circle_app/lib/app/aboutapp/view.dart b/circle_app/lib/app/aboutapp/view.dart deleted file mode 100644 index 8389b6f..0000000 --- a/circle_app/lib/app/aboutapp/view.dart +++ /dev/null @@ -1,211 +0,0 @@ -import 'package:circle_app/util/util.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; - -import '../../components/my_app_bar.dart'; -import 'logic.dart'; - -class AboutappPage extends StatelessWidget { - AboutappPage({Key? key}) : super(key: key); - - final logic = Get.find(); - final state = Get.find().state; - - @override - Widget build(BuildContext context) { - return GetBuilder(builder: (logic) { - return Container( - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage(getBaseImage("home_back")), - fit: BoxFit.cover, - ), - ), - child: Scaffold( - backgroundColor: Colors.transparent, - appBar: const MyAppBar( - centerTitle: '关于微乐园', - ), - body: Scaffold( - backgroundColor: Colors.transparent, - // Replace with your desired color - body: Container( - margin: EdgeInsets.only(left: 11.sp, right: 11.sp), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - GestureDetector( - onTap: () { - // showToast("13"); - }, - child: Image.asset( - getBaseImage( - "ic_launcher"), // Replace with your image path - width: 100.sp, - height: 100.sp, - fit: BoxFit.contain, - ), - ), - SizedBox(height: 20.sp), - Text( - logic.currentVersion, - style: TextStyle( - color: const Color(0xFFF7FAFA), - fontSize: 12.sp, - ), - ), - SizedBox(height: 10.sp), - Text( - '微乐园', - style: TextStyle( - color: const Color(0xFFF7FAFA), - fontSize: 16.sp, - ), - ), - SizedBox(height: 40.sp), - Container( - width: double.infinity, - height: 0.4.sp, - color: const Color(0xFF2E2E3B), - ), - // SizedBox(height: 20), - // GestureDetector( - // behavior: HitTestBehavior.opaque, - // onTap: () { - // _openBrowser(); - // }, - // child: Row( - // children: [ - // Text( - // '评价圈子', - // style: TextStyle( - // color: Color(0xFFF7FAFA), - // fontSize: 16, - // ), - // ), - // Spacer(), - // - // SizedBox(width: 8), - // Image( - // image: AssetImage(getHomeImage("icon_in")), - // width: 24.sp, - // height: 24.sp, - // fit: BoxFit.fill, - // ), - // - // ], - // ), - // ), - - SizedBox(height: 20.sp), - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - navigateToUserAgreement(); - }, - child: Row( - children: [ - Text( - '用户协议', - style: TextStyle( - color: const Color(0xFFF7FAFA), - fontSize: 16.sp, - ), - ), - const Spacer(), - Image( - image: AssetImage(getHomeImage("icon_in")), - width: 24.sp, - height: 24.sp, - fit: BoxFit.fill, - ), - ], - ), - ), - SizedBox(height: 20.sp), - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - navigateToPrivacyPolicy(); - }, - child: Row( - children: [ - Text( - '隐私政策', - style: TextStyle( - color: const Color(0xFFF7FAFA), - fontSize: 16.sp, - ), - ), - const Spacer(), - Image( - image: AssetImage(getHomeImage("icon_in")), - width: 24.sp, - height: 24.sp, - fit: BoxFit.fill, - ), - ], - ), - ), - SizedBox(height: 20.sp), - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - logic.getUpVersion(); - }, - child: Row( - children: [ - Text( - '版本更新', - style: TextStyle( - color: const Color(0xFFF7FAFA), - fontSize: 16.sp, - ), - ), - const Spacer(), - logic.isUpdate - ? Container( - width: 10.sp, - height: 10.sp, - margin: EdgeInsets.only(right: 4.sp), - decoration: const BoxDecoration( - color: Colors.red, - shape: BoxShape.circle), - ) - : Container(), - Text( - logic.isUpdate ? '有新版本啦' : "", - style: TextStyle( - color: const Color(0xFFB7BECC), - fontSize: 14.sp, - ), - ), - Image( - image: AssetImage(getHomeImage("icon_in")), - width: 24.sp, - height: 24.sp, - fit: BoxFit.fill, - ), - ], - ), - ), - ], - ), - )), - ), - ); - }); - } - - // String url = 'https://www.baidu.com'; // Replace with your desired URL - // - // void _openBrowser() async { - // if (await canLaunch(url)) { - // await launch(url); - // } else { - // throw 'Could not launch $url'; - // } - // } -} diff --git a/circle_app/lib/app/account/binding.dart b/circle_app/lib/app/account/binding.dart deleted file mode 100644 index 7c726d5..0000000 --- a/circle_app/lib/app/account/binding.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:get/get.dart'; - -import 'logic.dart'; - -class AccountBinding extends Bindings { - @override - void dependencies() { - Get.lazyPut(() => AccountLogic()); - } -} diff --git a/circle_app/lib/app/account/logic.dart b/circle_app/lib/app/account/logic.dart deleted file mode 100644 index c958aaa..0000000 --- a/circle_app/lib/app/account/logic.dart +++ /dev/null @@ -1,24 +0,0 @@ -import 'package:get/get.dart'; - -import '../../util/SharedPreferencesHelper.dart'; -import 'state.dart'; - -class AccountLogic extends GetxController { - String photo = ""; - final AccountState state = AccountState(); - @override - void onInit() async{ - - super.onInit(); - SharedPreferencesHelper.getInstance().then((sharedPreferences) { - // 在这里使用 SharedPreferences - photo = sharedPreferences.getString(SharedPreferencesHelper.PHOTO); - print(photo.toString()); - update(); - }); - - - - - } -} diff --git a/circle_app/lib/app/account/state.dart b/circle_app/lib/app/account/state.dart deleted file mode 100644 index 9cb151e..0000000 --- a/circle_app/lib/app/account/state.dart +++ /dev/null @@ -1,5 +0,0 @@ -class AccountState { - AccountState() { - ///Initialize variables - } -} diff --git a/circle_app/lib/app/account/view.dart b/circle_app/lib/app/account/view.dart deleted file mode 100644 index bfc4d8f..0000000 --- a/circle_app/lib/app/account/view.dart +++ /dev/null @@ -1,319 +0,0 @@ - -import 'package:circle_app/app/minefragment/logic.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; - -import '../../components/my_app_bar.dart'; -import '../../router/app_routers.dart'; -import '../../util/util.dart'; -import 'logic.dart'; - -class AccountPage extends StatelessWidget { - AccountPage({Key? key}) : super(key: key); - - final mineLogic = Get.find(); - final logic = Get.find(); - final state = Get - .find() - .state; - - @override - Widget build(BuildContext context) { - return GetBuilder(builder: (logic) { - return Container( - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage(getBaseImage("home_back")), - fit: BoxFit.cover, - ), - ), - child: Scaffold( - backgroundColor: Colors.transparent, - appBar: const MyAppBar( - centerTitle: '账号中心', - ), - body: Scaffold( - backgroundColor: Colors.transparent, - body: SafeArea( - child: ListView( - padding: EdgeInsets.all(16.0.sp), - children: [ - if (mineLogic.has_pwd) - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - Get.toNamed(AppRoutes.EditPwd); - }, - child: Container( - margin: EdgeInsets.only(top: 16.0), - child: Row( - children: [ - - Text( - "修改密码", - style: TextStyle( - color: Color(0xFFF7FAFA), - fontSize: 16.0, - ), - ), - Spacer(), - Image.asset( - getHomeImage("icon_in"), - width: 24.0, - height: 24.0, - ), - ], - ), - ), - ), - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - Get.toNamed(AppRoutes.PhotoActivity); - }, - child: Container( - margin: EdgeInsets.only(top: 16.0.sp), - child: Row( - children: [ - Text( - "换绑手机号", - style: TextStyle( - color: const Color(0xFFF7FAFA), - fontSize: 16.0.sp, - ), - ), - const Spacer(), - Text( - logic.photo, - style: TextStyle( - color: const Color(0xFFB7BECC), - fontSize: 16.0.sp, - ), - ), - SizedBox(width: 8.0.sp), - Image.asset( - getHomeImage("icon_in"), - width: 24.0.sp, - height: 24.0.sp, - ), - ], - ), - ), - ), - // Container( - // margin: EdgeInsets.only(top: 16.0), - // child: Row( - // children: [ - // Text( - // "修改密码", - // style: TextStyle( - // color: Color(0xFFF7FAFA), - // fontSize: 16.0, - // ), - // ), - // Spacer(), - // Image.asset( - // getHomeImage("icon_in"), - // width: 24.0, - // height: 24.0, - // ), - // ], - // ), - // ), - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - Get.toNamed(AppRoutes.OffAccountActivity); - }, - child: Container( - margin: EdgeInsets.only(top: 16.0.sp), - child: Row( - children: [ - Text( - "注销账号", - style: TextStyle( - color: const Color(0xFFF7FAFA), - fontSize: 16.0.sp, - ), - ), - const Spacer(), - Image.asset( - getHomeImage("icon_in"), - width: 24.0.sp, - height: 24.0.sp, - ), - ], - ), - ),) - , - // Container( - // margin: EdgeInsets.only(top: 0.0.sp, left: 0.sp), - // child: Text( - // "账号绑定", - // style: TextStyle( - // color: Color(0xFFF7FAFA), - // fontSize: 16.0.sp, - // ), - // ), - // ), - // Container( - // margin: EdgeInsets.only(top: 16.0.sp), - // child: Row( - // children: [ - // Text( - // "已绑定手机号", - // style: TextStyle( - // color: Color(0xFFB7BECC), - // fontSize: 16.0.sp, - // ), - // ), - // Spacer(), - // Container( - // alignment: Alignment.center, - // width: 60.sp, - // height: 28.sp, - // decoration: BoxDecoration( - // borderRadius: BorderRadius.circular(14.0.sp), - // border: Border.all( - // width: 0.4.sp, - // color: Colors.white, - // ), - // ), - // child: GestureDetector( - // onTap: (){ - // Get.toNamed(AppRoutes.PhotoActivity); - // }, - // child:Text( - // "换绑", - // style: TextStyle( - // color: Color(0xFFB7BECC), - // fontSize: 14.0.sp, - // ), - // )) ,) - // ], - // ), - // ), - // Container( - // margin: EdgeInsets.only(top: 16.0.sp), - // child: Row( - // children: [ - // Text( - // "微信", - // style: TextStyle( - // color: Color(0xFFB7BECC), - // fontSize: 16.0.sp, - // ), - // ), - // Spacer(), - // Container( - // alignment: Alignment.center, - // width: 60.sp, - // height: 28.sp, - // decoration: BoxDecoration( - // borderRadius: BorderRadius.circular(14.0.sp), - // border: Border.all( - // width: 0.4.sp, - // color: Colors.white, - // ), - // ), - // child: Text( - // "去绑定", - // style: TextStyle( - // color: Color(0xFFB7BECC), - // fontSize: 14.0.sp, - // ), - // )), - // ], - // ), - // ), - // Container( - // margin: EdgeInsets.only(top: 16.0.sp), - // child: Row( - // children: [ - // Text( - // "邮箱", - // style: TextStyle( - // color: Color(0xFFB7BECC), - // fontSize: 16.0.sp, - // ), - // ), - // Spacer(), - // GestureDetector( - // onTap: (){ - // Get.toNamed(AppRoutes.BindMailActivity); - // }, - // child: Container( - // alignment: Alignment.center, - // width: 60.sp, - // height: 28.sp, - // decoration: BoxDecoration( - // borderRadius: BorderRadius.circular(14.0.sp), - // border: Border.all( - // width: 0.4.sp, - // color: Colors.white, - // ), - // ), - // child: Text( - // "去绑定", - // style: TextStyle( - // color: Color(0xFFB7BECC), - // fontSize: 14.0.sp, - // ), - // )),) - // - // ], - // ), - // ), - // Container( - // margin: EdgeInsets.only(top: 16.0.sp), - // child: Text( - // "温馨提示:完成账号绑定后,手机丢失或忘记密码也可以通过其他方式登录", - // style: TextStyle( - // color: Color(0xFFB7BECC), - // fontSize: 12.0.sp, - // ), - // ), - // ), - GestureDetector(onTap: () { - getAuthorization(); - }, - child: Container( - margin: EdgeInsets.only( - top: 40.0.sp, left: 72.0.sp, right: 72.0.sp), - height: 42.sp, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(21), - gradient: const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - child: Center( - child: Text( - "退出登录", - style: TextStyle( - color: const Color(0xFFF7FAFA), - fontSize: 16.0.sp, - ), - ), - ), - ),) - , - ], - ), - ), - ), - ), - ); - }); - } - - getAuthorization() async { - await pushLoginPage(); - } -} diff --git a/circle_app/lib/app/bill/binding.dart b/circle_app/lib/app/bill/binding.dart deleted file mode 100644 index c5f2d2d..0000000 --- a/circle_app/lib/app/bill/binding.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:get/get.dart'; - -import 'logic.dart'; - -class BillBinding extends Bindings { - @override - void dependencies() { - Get.lazyPut(() => BillLogic()); - } -} diff --git a/circle_app/lib/app/bill/logic.dart b/circle_app/lib/app/bill/logic.dart deleted file mode 100644 index 35c52f4..0000000 --- a/circle_app/lib/app/bill/logic.dart +++ /dev/null @@ -1,148 +0,0 @@ -import 'dart:convert'; - -import 'package:get/get.dart'; -import 'package:circle_app/network/dio_manager.dart'; -import 'package:pull_to_refresh/pull_to_refresh.dart'; - -import '../../network/api.dart'; -import 'state.dart'; - -class BillLogic extends GetxController { - final BillState state = BillState(); - final int rechargePage = 1; - List rechargeList=[]; - final RefreshController rechargeController = RefreshController(); - - final int consumePage = 1; - List consumeList=[]; - final RefreshController consumeController = RefreshController(); - - final int incomePage = 1; - List incomeList=[]; - final RefreshController incomeController = RefreshController(); - - final int withdrawalPage = 1; - List withdrawalList=[]; - final RefreshController withdrawalController = RefreshController(); - - @override - void onInit() async { - super.onInit(); - getBillList(1,1); - getBillList(2,1); - getBillList(3,1); - } - - getBillList(int type, int page) async { - var data = await DioManager.getInstance().post(url: Api.userBill, params: { - "type": type, - "page": page, - "pageSize": 20, - }); - - if (data['code'] == 200) { - BillResponse billResponse = BillResponse.fromJson(data); - RefreshController? controller; - switch (type) { - case 1: - if (page == 1) { - rechargeList.clear(); - } - controller = rechargeController; - rechargeList.addAll(billResponse.list); - if (rechargeList.length < 10) { - controller!.loadNoData(); - } - break; - case 2: - if (page == 1) - consumeList.clear(); - controller = consumeController; - consumeList.addAll(billResponse.list); - if (consumeList.length < 10) { - controller!.loadNoData(); - } - break; - case 3: - if (page == 1) - incomeList.clear(); - controller = incomeController; - incomeList.addAll(billResponse.list); - if (incomeList.length < 10) { - controller!.loadNoData(); - } - break; - case 4: - if (page == 1) - withdrawalList.clear(); - controller = withdrawalController; - withdrawalList.addAll(billResponse.list); - if (withdrawalList.length < 10) { - controller!.loadNoData(); - } - break; - } - - - if (page == 1) { - controller!.refreshCompleted(); - } else { - controller!.loadComplete(); - } - - update(); - } - } - - - -} - -class BillResponse { - int code; - String msg; - int total; - List list; - - BillResponse({ - required this.code, - required this.msg, - required this.total, - required this.list, - }); - - factory BillResponse.fromJson(Map json) { - return BillResponse( - code: json['code'], - msg: json['msg'], - total: json['data']['total'], - list: List.from( - json['data']['lists'].map((item) => BillItem.fromJson(item))), - ); - } -} - -class BillItem { - int billId; - String billDate; - String billName; - double amount; - Map user; - BillItem({ - required this.billId, - required this.billDate, - required this.billName, - required this.amount, - required this.user, - }); - - factory BillItem.fromJson(Map json) { - return BillItem( - billId: json['billId'], - user: json['user'] ?? {}, - billDate: json['billDate'], - billName: json['billName'], - amount: json['amount']?.toDouble() ?? 0.0, - ); - } -} diff --git a/circle_app/lib/app/bill/state.dart b/circle_app/lib/app/bill/state.dart deleted file mode 100644 index ade6f54..0000000 --- a/circle_app/lib/app/bill/state.dart +++ /dev/null @@ -1,5 +0,0 @@ -class BillState { - BillState() { - ///Initialize variables - } -} diff --git a/circle_app/lib/app/bill/view.dart b/circle_app/lib/app/bill/view.dart deleted file mode 100644 index fb1e4d0..0000000 --- a/circle_app/lib/app/bill/view.dart +++ /dev/null @@ -1,312 +0,0 @@ -import 'package:circle_app/app/userinfo/logic.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:pull_to_refresh/pull_to_refresh.dart'; - -import '../../router/app_routers.dart'; -import '../../util/util.dart'; -import 'logic.dart'; - -class BillPage extends StatefulWidget { - BillPage({Key? key}) : super(key: key); - - @override - _BillState createState() => _BillState(); -} - -class _BillState extends State with SingleTickerProviderStateMixin { - final logic = Get.find(); - final state = Get.find().state; - - late TabController _tabController; - late PageController _pageController; - - ScrollController scrollController = ScrollController(); - bool isShowBlackTitle = false; - - @override - void initState() { - super.initState(); - _pageController = PageController(); - _tabController = - TabController(length: 3, vsync: this, initialIndex: Get.arguments ?? 0); - _tabController.animation!.addListener(_handleTabChange); - // _tabController.addListener(_handleTabChange); - // _tabController - } - - void _handleTabChange() { - // 在这里可以执行滑动监听后的逻辑操作 - // 比如根据当前选中的标签执行其他操作 - // int currentIndex = .toString()); - // logic.isShowAlbum = _tabController.index == 0; - // logic.update(); - } - - @override - void dispose() { - _tabController.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - // _getFormat(context); - return GetBuilder(builder: (logic) { - return Container( - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage(getBaseImage("bg")), - fit: BoxFit.cover, - ), - ), - child: Scaffold( - backgroundColor: Colors.transparent, - // appBar: MyAppBar(centerTitle: '账单',), - body: SafeArea( - child: Container( - margin: EdgeInsets.only(top: 13.sp), - child: Stack( - children: [ - Positioned( - left: 18.sp, - child: GestureDetector( - onTap: () { - Get.back(); - }, - child: Image.asset( - "assets/images/navigator/back.png", - width: 24.sp, - height: 24.sp, - ), - )), - Column( - children: [ - titleTab(logic), - Expanded( - child: TabBarView( - controller: _tabController, - // onPageChanged: (index) { - // _tabController.animateTo(index); - // }, - children: [ - billListView(3), - billListView(1), - billListView(2), - - // billListView(4), - ], - ), - ), - ], - ) - ], - ), - ), - ), - ), - ); - }); - } - - Widget billListView(int type) { - List list = []; - int page = 0; - RefreshController? controller; - - switch (type) { - case 1: - page = logic.rechargePage; - controller = logic.rechargeController; - list = logic.rechargeList; - break; - case 2: - page = logic.consumePage; - controller = logic.consumeController; - list = logic.consumeList; - break; - case 3: - page = logic.incomePage; - controller = logic.incomeController; - list = logic.incomeList; - break; - case 4: - page = logic.withdrawalPage; - controller = logic.withdrawalController; - list = logic.withdrawalList; - break; - } - - return list.isNotEmpty - ? Container( - margin: EdgeInsets.only(top: 22.sp), - child: SmartRefresher( - controller: controller!, - onRefresh: () => onRefresh(type, page), - onLoading: () => onLoading(type, page), - enablePullUp: true, - child: ListView.builder( - itemCount: list.length, - // Replace 'yourList' with the actual list you want to display - itemBuilder: (context, index) { - return ListItemWidget( - item: list[index], - type: type, - ); - }, - ), - ), - ) - : noResultWidget(); - } - - onRefresh(int type, int page) async { - logic.getBillList(type, page); - // logic.page = 1; - // logic.initList(); - } - - onLoading(int type, int page) async { - page = page + 1; - logic.getBillList(type, page); - // logic.page = logic.page + 1; - // logic.initList(); - } - - Widget titleTab(BillLogic controller) { - return Container( - alignment: Alignment.centerLeft, - // padding: EdgeInsets.symmetric(horizontal: 10.sp), - height: 30.sp, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - TabBar( - isScrollable: true, - controller: _tabController, - indicator: UnderlineTabIndicator( - borderSide: BorderSide( - color: const Color(0xFFCE51FF), - ), - insets: EdgeInsets.symmetric(horizontal: 6.0.sp), - // borderRadius: BorderRadius.circular(18.0), - ), - indicatorColor: const Color(0xFFCE51FF), - indicatorWeight: 2.sp, - labelColor: const Color(0xFFCE51FF), - unselectedLabelColor: const Color(0xB3FFFFFF), - indicatorSize: TabBarIndicatorSize.label, - labelStyle: TextStyle(fontSize: 16.sp), - tabs: const [ - Tab(text: "收入"), - Tab( - text: "充值/奖励", - ), - Tab(text: "支出"), - ], - onTap: (index) { - // _pageController.animateToPage( - // index, // 目标页面索引 - // duration: const Duration(milliseconds: 300), // 动画时长 - // curve: Curves.ease, // 动画曲线 - // ); - }, - ), - ], - ), - ); - } -} - -class ListItemWidget extends StatelessWidget { - final BillItem item; - final int type; - ListItemWidget({required this.item, required this.type}); - @override - Widget build(BuildContext context) { - return GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - if (item.user.isNotEmpty) { - if (Get.isRegistered()) { - Get.delete(); - } - - Get.toNamed(AppRoutes.UserInfoActivity, - arguments: item.user['id'].toString()); - } - }, - child: Container( - margin: EdgeInsets.only(left: 16.0, bottom: 16.0, right: 16.sp), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - if (item.user.isNotEmpty) - ClipOval( - child: Image.network( - item.user['avatar'], - fit: BoxFit.cover, - width: 40.sp, - height: 40.sp, - )), - if (item.user.isEmpty) - Image.asset( - getMineImage("bi_icon1"), - // Assuming you have the image in the 'assets/images/' directory - width: 24.sp, - height: 24.sp, - ), - SizedBox(width: 8.0.sp), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - item.billName, - style: TextStyle( - color: Color(0xfff7fafa), - fontSize: 14.0.sp, - ), - ), - SizedBox(height: 4.0.sp), - Text( - item.billDate, - style: TextStyle( - color: Color(0xffb7becc), - fontSize: 12.0.sp, - ), - ), - ], - ), - Spacer(), - Column( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Text( - type == 2 - ? '-' + item.amount.toString() + '小票' - : '+' + - '${type == 3 ? (item.amount * 0.01).toStringAsFixed(2) + '元' : item.amount.toString() + '小票'}', - style: TextStyle( - color: const Color(0xffefd84e), - fontSize: 14.0.sp, - ), - ), - ], - ), - ], - ), - SizedBox(height: 8.0.sp), - Divider( - height: 10.0.sp, - color: Colors.white.withOpacity(0.3.sp), - ), - ], - ), - ), - ); - } -} diff --git a/circle_app/lib/app/bindmail/binding.dart b/circle_app/lib/app/bindmail/binding.dart deleted file mode 100644 index 4faad6b..0000000 --- a/circle_app/lib/app/bindmail/binding.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:get/get.dart'; - -import 'logic.dart'; - -class BindmailBinding extends Bindings { - @override - void dependencies() { - Get.lazyPut(() => BindmailLogic()); - } -} diff --git a/circle_app/lib/app/blacklist/binding.dart b/circle_app/lib/app/blacklist/binding.dart deleted file mode 100644 index 1904482..0000000 --- a/circle_app/lib/app/blacklist/binding.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:get/get.dart'; - -import 'logic.dart'; - -class BlacklistBinding extends Bindings { - @override - void dependencies() { - Get.lazyPut(() => BlacklistLogic()); - } -} diff --git a/circle_app/lib/app/blacklist/logic.dart b/circle_app/lib/app/blacklist/logic.dart deleted file mode 100644 index e174945..0000000 --- a/circle_app/lib/app/blacklist/logic.dart +++ /dev/null @@ -1,128 +0,0 @@ -import 'package:get/get.dart'; -import 'package:pull_to_refresh/pull_to_refresh.dart'; - -import '../../network/api.dart'; -import '../../network/dio_manager.dart'; -import '../../util/util.dart'; -import 'state.dart'; - -class BlacklistLogic extends GetxController { - final BlacklistState state = BlacklistState(); - final RefreshController refreshController = RefreshController(); - int page = 1; - List lists = []; - - bool isLoad = true; - @override - void onInit() async{ - super.onInit(); - initList(); - } - - initList() async{ - if(page==1){ - lists.clear(); - } - var data = - await DioManager.instance.get(url: Api.blackList, params: { - 'page': page, - 'page_size':20 - }); - var bean = BaseResponse.fromJson( - data, (data) => UserList.fromJson(data)); - if (bean.isSuccess()) { - lists.addAll(bean.data.lists); - } - isLoad = false; - update(); - if (page == 1) { - refreshController.refreshCompleted(); - } else { - refreshController.loadComplete(); - } - - } - - - setBlock(String userId) async { - var data = await DioManager.instance - .post(url: "${Api.setBlock + userId}/block", params: { - 'status': "0" - }); - var bean = BaseResponse.fromJson(data, (jsonData) => jsonData,); - if(bean.isSuccess()){ - page = 1; - initList(); - update(); - } - showOKToast(bean.msg); - } - -} - - -class User { - final int id; - final String nickname; - final String avatar; - final String signature; - final String birthday; - final int age; - final int vip; - final int gender; - final int role; - final int orientation; - final double lng; - final double lat; - final String city; - final String avatarThumb; - - User({ - required this.id, - required this.nickname, - required this.avatar, - required this.signature, - required this.birthday, - required this.age, - required this.vip, - required this.gender, - required this.role, - required this.orientation, - required this.lng, - required this.lat, - required this.city, - required this.avatarThumb, - }); - - factory User.fromJson(Map json) { - return User( - id: json['id'], - nickname: json['nickname'], - avatar: json['avatar'], - signature: json['signature'], - birthday: json['birthday'], - age: json['age'], - vip: json['vip'], - gender: json['gender'], - role: json['role'], - orientation: json['orientation'], - lng: json['lng'], - lat: json['lat'], - city: json['city'], - avatarThumb: json['avatar_thumb'], - ); - } -} - -class UserList { - final List lists; - - UserList({required this.lists}); - - factory UserList.fromJson(Map json) { - var list = json['lists'] as List; - List userList = list.map((item) => User.fromJson(item)).toList(); - return UserList(lists: userList); - } -} - diff --git a/circle_app/lib/app/blacklist/state.dart b/circle_app/lib/app/blacklist/state.dart deleted file mode 100644 index 745d0fc..0000000 --- a/circle_app/lib/app/blacklist/state.dart +++ /dev/null @@ -1,5 +0,0 @@ -class BlacklistState { - BlacklistState() { - ///Initialize variables - } -} diff --git a/circle_app/lib/app/blacklist/view.dart b/circle_app/lib/app/blacklist/view.dart deleted file mode 100644 index 8cd3d16..0000000 --- a/circle_app/lib/app/blacklist/view.dart +++ /dev/null @@ -1,194 +0,0 @@ - -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; - -import '../../components/my_app_bar.dart'; -import '../../router/app_routers.dart'; -import '../../util/util.dart'; -import 'logic.dart'; -import 'package:pull_to_refresh/pull_to_refresh.dart'; - -class BlacklistPage extends StatelessWidget { - BlacklistPage({Key? key}) : super(key: key); - - final logic = Get.find(); - final state = Get - .find() - .state; - - @override - Widget build(BuildContext context) { - return GetBuilder(builder: (logic) { - return Container( - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage(getBaseImage("home_back")), - fit: BoxFit.cover, - ), - ), - child: Scaffold( - backgroundColor: Colors.transparent, - appBar: const MyAppBar(centerTitle: '黑名单',), - body: SafeArea( - child: logic.isLoad ? loaddingWidget(true) : logic.lists.isEmpty ? noResultWidget() : SmartRefresher( - controller: logic.refreshController, - onRefresh: _onRefresh, - onLoading: _onLoading, - enablePullUp: true, - child: ListView.builder( - - itemCount: logic.lists.length, - itemBuilder: (context, index) { - return ListTile( - title: ListItem(logic.lists[index]), - ); - }, - ), - ), - ),), - ); - }); - } - - - Widget ListItem(User item) { - return GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.UserInfoActivity, arguments: item.id.toString()); - }, - child: Container( - margin: const EdgeInsets.only(bottom: 16), - child: Row( - children: [ - Stack(children: [ - ClipOval( - child: GestureDetector( - onTap: () { - var imgList = []; - imgList.add(item.avatar); - Get.toNamed(AppRoutes.Swiper, arguments: { - 'imaglist': imgList, - 'index': 0 - }); - }, - child: CachedNetworkImage( - imageUrl: item.avatar, - width: 53.sp, - height: 53.sp, - fit: BoxFit.cover, - ), - ), - ), - Positioned( - right: 0, - left: 0, - bottom: 0, - - child: item.vip > 0 ? - Image( - image: AssetImage(getBaseImage(item.vip == 1 ? "vip" : 'year_vip')), - width: 44.sp, - height: 18.sp, - ) : Container(),) - ],), - SizedBox(width: 10.sp), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Text( - item.nickname, - style: TextStyle(color: Colors.white70, - fontSize: 12.sp, - fontWeight: FontWeight.bold), - ), - SizedBox(width: 4.sp), - // SizedBox(height: 8.sp), - _buildInfoRow(item), - // Placeholder image - ], - ), - - SizedBox(height: 8.sp), - SizedBox( - width: 150.sp, - child: Text( - item.signature, - overflow: TextOverflow.ellipsis, // 超出部分使用省略号表示 - maxLines: 1, - style: TextStyle(fontSize: 12.sp, color: const Color(0xFFB7BECC)), - ), - ), - ], - ), - // Pla - const Spacer(), - GestureDetector(onTap: () { - logic.setBlock(item.id.toString()); - }, - child: Container( - width: 80, - height: 28, - decoration: BoxDecoration( - color: const Color(0xFFFF4D7C), - borderRadius: BorderRadius.circular(14), - ), - child: - const Center( - child: Text( - "移出黑名单", - style: TextStyle(fontSize: 14, color: Colors.white), - ), - ), - ),), - ], - ), - ),); - } - Widget _buildInfoRow(User userInfoBean) { - String ageMsg = getAgeCOntent(userInfoBean.gender, userInfoBean.age, - userInfoBean.role, userInfoBean.orientation); - return Row( - children: [ - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color.fromRGBO(141, 255, 248, 1.0), - Color.fromRGBO(181, 211, 255, 1.0), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 2.sp, bottom: 2.sp, left: 10.sp, right: 10.sp), - child: Text( - ageMsg , - style: const TextStyle( - color: Colors.black, - fontSize: 10, - ), - ), - ), - SizedBox(width: 6.sp), - - ], - ); - } - - void _onRefresh() async { - logic.page = 1; - logic.initList(); - } - - void _onLoading() async { - logic.page = logic.page + 1; - logic.initList(); - } - -} diff --git a/circle_app/lib/app/call_out/binding.dart b/circle_app/lib/app/call_out/binding.dart deleted file mode 100644 index 028896d..0000000 --- a/circle_app/lib/app/call_out/binding.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:get/get.dart'; - -import 'logic.dart'; - -class Call_outBinding extends Bindings { - @override - void dependencies() { - Get.lazyPut(() => Call_outLogic()); - } -} diff --git a/circle_app/lib/app/call_out/logic.dart b/circle_app/lib/app/call_out/logic.dart deleted file mode 100644 index 25eff4b..0000000 --- a/circle_app/lib/app/call_out/logic.dart +++ /dev/null @@ -1,478 +0,0 @@ -import 'dart:async'; -import 'dart:io'; -import 'dart:typed_data'; - -import 'package:circle_app/util/util.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; -import 'package:get/get.dart'; -import 'package:image_picker/image_picker.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_setting_model.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/services_locatar.dart'; -import 'package:video_player/video_player.dart'; -import 'package:video_thumbnail/video_thumbnail.dart'; - -import '../../common/Widgets/base_tip_widget.dart'; -import '../../common/Widgets/open_vip_tip/view.dart'; -import '../../network/api.dart'; -import '../../network/dio_manager.dart'; -import '../../router/app_routers.dart'; -import '../../util/SharedPreferencesHelper.dart'; -import '../../util/eventBus.dart'; -import '../../util/qiniu.dart'; -import '../circle/logic.dart'; -import '../dialog/UnlockCallDialog.dart'; -import '../select_circle/logic.dart'; -import 'state.dart'; -import '../../common/config.dart'; -import 'package:image/image.dart' as img; - -class Call_outLogic extends GetxController { - final Call_outState state = Call_outState(); - TextEditingController textEditingController = TextEditingController(); - bool isCheck = false; - late ConfigBean configBean; - String circleName = ""; - final ImagePicker _picker = ImagePicker(); - var quToken = ''; - VideoPlayerController? videoPlayerController; - List numbers = []; - List? myConfigData; - int vip = 0; - - bool isZfbPrice = true; - - final TUISettingModel settingModel = serviceLocator(); - - @override - void onClose() { - super.onClose(); - videoPlayerController?.dispose(); - } - - @override - void onInit() async { - super.onInit(); - - - var data = - await DioManager.instance.get(url: Api.getCircleList, params: {}); - var bean = BaseResponse.fromJson( - data, (data) => ConfigBean.fromJson(data)); - if (bean.isSuccess()) { - configBean = bean.data!; - } else { - showOKToast(bean.msg); - } - - Map arg = Get.arguments; - - if (arg != null) { - // print(myConfigData.name); - List myConfigData = Get.arguments['numbers']; - numbers.addAll(myConfigData); - if(numbers.length>0) { - circleName = numbers[0].name; - } - update(); - } else { - var data = await DioManager.instance - .get(url: Api.getMyCircleInterests, params: {"page": 1,'page_size':20}); - - var bean = BaseResponse.fromJson( - data, (data) => InterestsBean.fromJson(data)); - - InterestsBean info = bean.data; - - if (info.lists.isNotEmpty) { - Circle circle = info.lists.first; - MyConfigData configData = MyConfigData(circle.id.toString(),circle.title,true); - numbers.add(configData); - if(numbers.length>0){ - circleName = numbers[0].name; - } - - - update(); - } - - - } - - SharedPreferencesHelper.getInstance().then((sharedPreferences) { - vip = sharedPreferences.getInt(SharedPreferencesHelper.VIP); - print(vip); - if (vip == 2) { - isCheck = true; - } - update(); - }); - - - loadQiniuToken(); - - StreamSubscription subscription = - EventBusManager.on().listen((event) { - vip = event.vip; - }); - } - - Future loadQiniuToken() async { - var quniuData = - await DioManager.instance.get(url: Api.getqiniuToken, params: {}); - var qiniuBean = BaseResponse.fromJson( - quniuData, (quniuData) => QnTokenData.fromJson(quniuData)); - quToken = qiniuBean.data!.token.toString(); - } - - showRechargeDialog() { - Get.bottomSheet( - Scaffold( - backgroundColor: Colors.transparent, - body: Open_vip_tipPage(true), - ), - isScrollControlled: true, - enableDrag: false); - } - - sendShout() async { - if (numbers.isEmpty) { - showOKToast("请选择要喊话的圈子。"); - return; - } - if (textEditingController.text.isEmpty) { - showOKToast("请输入喊话内容"); - return; - } - if (state.imaglist.isEmpty && state.videolist.isEmpty) { - if (textEditingController.text.length < 10) { - showOKToast("您当前未添加图片或视频,请至少输入10字喊话内容。"); - return; - } - } else { - if (!state.imaglist.isEmpty) { - if (textEditingController.text.length < 5) { - showOKToast("请至少输入5个字内容"); - return; - } - } - if (!state.videolist.isEmpty) { - if (textEditingController.text.length < 5) { - showOKToast("请至少输入5个字内容"); - return; - } - } - } - - List myBean = []; - if (!state.imaglist.isEmpty) { - state.imaglist.forEach((element) { - myBean.add(MyBean(type: 1, url: element).toJson()); - }); - } - if (!state.videolist.isEmpty) { - myBean.add(MyBean(type: 2, url: state.videolist[0]).toJson()); - } - print(myBean.toString()); - SmartDialog.showLoading(); - var data = await DioManager.instance.post(url: Api.SendShout, params: { - 'album': myBean, - 'content': textEditingController.text.trim(), - 'interest_id': numbers[0].id, - 'use_queen': isCheck ? 1 : 0, - }); - - var beandata = BaseResponse.fromJson( - data, - (jsonData) => jsonData, - ); - SmartDialog.dismiss(); - if (beandata.isSuccess()) { - showOKToast(beandata.msg); - final logic = Get.put(CircleLogic()); - logic.setCircle(numbers[0].id); - logic.refresh(); - - EventBusManager.fire(CallRefreshCircle(numbers[0].id)); - // logic.update(); - // Navigator.pop(Get.context!, numbers); - Get.back(result: '1'); - } else if (beandata.code == 30503) { - // if (beandata.data == null) { - // return; - // } - showOKToast(beandata.msg); - var callOutBean = BaseResponse>.fromJson( - data, - (jsonData) => List.from(jsonData), - ); - - textEditingController.text = - filterSensitiveWords(textEditingController.text, callOutBean.data!); - print( - filterSensitiveWords(textEditingController.text, callOutBean.data!)); - update(); - } else if (beandata.code == 30505) { - var callOutBean = BaseResponse.fromJson( - data, - (jsonData) => CirclePaymentBean.fromJson(jsonData), - ); - // showDialog(); - print(numbers[0].id); - - // showJoinCiclePiker(numbers[0].id.toString(),callOutBean.data.amount.toString(),callOutBean.data.oldAmount.toString(),0,(payResult){ - // final logic = Get.put(CircleLogic()); - // logic.circle.lists.forEach((element) { - // if(element.id == numbers[0].id){ - // element.is_limit = false; - // } - // }); - // // widget.bean.is_limit = false; - // }); - - UnlockCallDialog().showUnlockBottomSheet(numbers[0].id,callOutBean.data.amount.toString(),callOutBean.data.oldAmount.toString(),iositem: callOutBean.data.ios_item); - // tipWdiget() - } else { - showOKToast(beandata.msg); - } - } - - - - startSelectCircleActivity() async { - var data = await Get.toNamed(AppRoutes.SelectCircleActivity, arguments: { - "interestMap": configBean.interestMap, - 'selectCircle': numbers, - "isRodio": true - }); - if (null != data) { - numbers = data; - circleName = numbers[0].name; - - print(circleName); - update(); - } - } - - showImg() async { - try { - checkPhotosStatus(); - if (state.videolist.length != 0) { - showOKToast("已添加视频,无法添加图片。"); - return; - } - if (state.imaglist.length == 6) { - showOKToast("最多上传6张图片哦~"); - return; - } - final XFile? pickedFile = await _picker.pickImage(source: ImageSource.gallery,); - if (null == pickedFile) { - return; - } - // final image = img.decodeImage(File(pickedFile.path).readAsBytesSync())!; - // img.Image watermarkedImage = img.Image(image.width, image.height); - // watermarkedImage = img.copyResize(image, width: image.width, height: image.height); - // - // // 添加文字水印 - // img.drawString(watermarkedImage, img.arial_48, 10, 1000, 'Watermark Text', color: img.getColor(255, 0, 0)); - // - // var path = await getApplicationSupportDirectoryPath(); - // String outputPath = path+"ceshishuiyin"; - // File(outputPath).writeAsBytesSync(img.encodeJpg(watermarkedImage)); - - SmartDialog.showLoading(); - uploadImage(quToken, pickedFile!, CONFIG.CALL_OUT_IMAGE, (result) { - SmartDialog.dismiss(); - state.imaglist.add(result); - update(); - }); - } catch (e) { - print(e); - } - } - - Future getFirstPic(url) async { - Uint8List? bytes = await VideoThumbnail.thumbnailData(video: url); - final Completer completer = Completer(); - if (bytes != null) { - int _imageDataSize = bytes.length; - print("image size: $_imageDataSize"); - - final _image = Image.memory(bytes); - _image.image - .resolve(ImageConfiguration()) - .addListener(ImageStreamListener((ImageInfo info, bool _) { - completer.complete(ThumbnailResult( - image: _image, - dataSize: _imageDataSize, - height: info.image.height, - width: info.image.width, - )); - })); - } - - return completer.future; - } - - showVideo() async { - if (state.imaglist.length != 0) { - showOKToast("已添加图片,无法添加视频。"); - return; - } - if (state.videolist.length != 0) { - showOKToast("最多上传1个视频哦~"); - return; - } - - checkPhotosStatus(); - try { - final XFile? pickedFile = await _picker.pickVideo( - source: ImageSource.gallery, - ); - if (null == pickedFile) { - return; - } - SmartDialog.showLoading(); - // var path = await getApplicationSupportDirectoryPath(); - videoPlayerController = VideoPlayerController.file( - File(pickedFile.path), - videoPlayerOptions: VideoPlayerOptions(mixWithOthers: true), - ); - await videoPlayerController?.initialize(); - final Duration videoDuration = videoPlayerController!.value.duration; - final double durationInSeconds = videoDuration.inSeconds.toDouble(); - if (durationInSeconds >= 5 && durationInSeconds <= 30) { - videoPlayerController?.setLooping(true); - videoPlayerController?.addListener(() { - if (!videoPlayerController!.value.isPlaying) { - // Navigator.pop(context); - } - }); - - uploadQiniuVideo( - File(pickedFile.path), pickedFile.name, CONFIG.CALL_OUT_VIDEO, quToken, - (result) { - SmartDialog.dismiss(); - state.videolist.add(result); - update(); - }); - } else { - SmartDialog.dismiss(); - showOKToast("请上传5-30秒的视频,当前视频长度为:$durationInSeconds" "秒"); - } - } catch (e) {} - - //压缩 感觉越压越大 - // try { - // final XFile? pickedFile = await _picker.pickVideo( - // source: ImageSource.gallery, - // ); - // if(null==pickedFile){ - // return; - // } - // SmartDialog.showLoading(); - // var path = await getApplicationSupportDirectoryPath(); - // - // - // compressVideo(pickedFile.path, path, (result) async { - // print(result); - // videoPlayerController = VideoPlayerController.file( - // File(result), - // videoPlayerOptions: VideoPlayerOptions(mixWithOthers: true), - // ); - // await videoPlayerController?.initialize(); - // final Duration videoDuration = videoPlayerController!.value.duration; - // final double durationInSeconds = videoDuration.inSeconds.toDouble(); - // print("////////////"); - // print(durationInSeconds.toString()); - // if (durationInSeconds >= 5 && durationInSeconds <= 30) { - // videoPlayerController?.setLooping(true); - // videoPlayerController?.addListener(() { - // if (!videoPlayerController!.value.isPlaying) { - // // Navigator.pop(context); - // } - // }); - // - // updataQiniu(result, pickedFile.name, CONFIG.CALL_OUT_VIDEO, quToken, - // (result) { - // SmartDialog.dismiss(); - // state.videolist.add(result); - // update(); - // }); - // } else { - // SmartDialog.dismiss(); - // showToast("请上传5-30秒的视频"); - // } - // }); - // } catch (e) {} - } - - Future _loadCaptions(BuildContext context) async { - final String fileContents = await DefaultAssetBundle.of(context) - .loadString('assets/bumble_bee_captions.vtt'); - return WebVTTCaptionFile( - fileContents); // For vtt files, use WebVTTCaptionFile - } -} - -class MyBean { - int type; - String url; - - MyBean({required this.type, required this.url}); - - factory MyBean.fromJson(Map json) { - return MyBean( - type: json['type'], - url: json['url'], - ); - } - - Map toJson() { - return { - 'type': type, - 'url': url, - }; - } -} - -class ThumbnailResult { - final Image image; - final int dataSize; - final int height; - final int width; - - const ThumbnailResult( - {required this.image, - required this.dataSize, - required this.height, - required this.width}); -} - -class CirclePaymentBean { - final int id; - final String title; - final String ios_item; - final double amount; - final double oldAmount; - - CirclePaymentBean({ - required this.id, - required this.title, - required this.ios_item, - required this.amount, - required this.oldAmount, - }); - - factory CirclePaymentBean.fromJson(Map json) { - return CirclePaymentBean( - id: json['id'] as int, - ios_item: json['ios_item'] ?? '', - title: json['title'] as String, - amount: json['amount'] as double, - oldAmount: json['old_amount'] as double, - ); - } -} diff --git a/circle_app/lib/app/call_out/state.dart b/circle_app/lib/app/call_out/state.dart deleted file mode 100644 index 91bd948..0000000 --- a/circle_app/lib/app/call_out/state.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'logic.dart'; - -class Call_outState { - Call_outState() { - ///Initialize variables - } - List imaglist = []; - List videolist = []; -} - diff --git a/circle_app/lib/app/call_out/view.dart b/circle_app/lib/app/call_out/view.dart deleted file mode 100644 index 306f3cc..0000000 --- a/circle_app/lib/app/call_out/view.dart +++ /dev/null @@ -1,749 +0,0 @@ -import 'package:circle_app/components/my_app_bar.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:video_player/video_player.dart'; - -import '../../router/app_routers.dart'; -import 'logic.dart'; - -class Call_outPage extends StatefulWidget { - Call_outPage({Key? key}) : super(key: key); - - @override - State createState() => _Call_outPageState(); -} - -class _Call_outPageState extends State { - final logic = Get.find(); - - final state = Get.find().state; - - bool isShowKeyboard = false; - - @override - Widget build(BuildContext context) { - return GetBuilder(builder: (controller) { - var keyboardSize = MediaQuery.of(context).viewInsets.bottom; - - return GestureDetector( - onTap: () { - FocusManager.instance.primaryFocus?.unfocus(); - }, - child: Container( - width: MediaQuery.of(context).size.width, - height: MediaQuery.of(context).size.height, - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.fill, - image: AssetImage(getBaseImage('home_back')))), - child: Scaffold( - resizeToAvoidBottomInset: false, - backgroundColor: Colors.transparent, - appBar: MyAppBar( - centerTitle: '圈内喊话', - actionWdiget: Image.asset( - getCircleImage('push'), - width: 54.sp, - ), - onPressed: () { - logic.sendShout(); - }, - ), - body: SafeArea( - child: Stack( - fit: StackFit.expand, - children: [ - Column( - children: [ - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () async { - logic.startSelectCircleActivity(); - }, - child: Container( - height: 45.sp, - padding: - EdgeInsets.only(left: 17.sp, right: 17.sp), - child: Row( - children: [ - Text( - '选择圈子:', - style: TextStyle( - color: Colors.white, fontSize: 16.sp), - ), - Expanded(child: Container()), - logic.circleName == '' - ? Container() - : Container( - padding: EdgeInsets.only( - left: 7.sp, right: 7.sp), - height: 21.sp, - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular( - 21 * 0.5.sp), - gradient: const LinearGradient( - begin: Alignment.centerLeft, - end: Alignment.centerRight, - colors: [ - Color(0xff0AFCFF), - Color(0xffD739EA) - ])), - child: Text( - logic.circleName, - style: TextStyle( - color: Colors.white, - fontSize: 12.sp), - ), - ), - Image.asset( - getHomeImage('icon_in'), - width: 24.sp, - ), - ], - ), - ), - ), - Image.asset( - getCircleImage('line'), - width: Get.width, - fit: BoxFit.fill, - ), - Expanded( - child: Container( - padding: EdgeInsets.only(top: 15.sp), - child: Stack( - children: [ - Column( - children: [ - SizedBox( - height: 150.sp, - child: TextField( - controller: - controller.textEditingController, - onChanged: (value) { - controller.update(); - }, - onTap: () { - isShowKeyboard = true; - setState(() {}); - }, - style: TextStyle( - color: Colors.white, fontSize: 17.0.sp), - maxLines: 32, - maxLength: 200, - decoration: InputDecoration( - hintStyle: TextStyle( - color: const Color.fromRGBO( - 255, 255, 255, 0.6), - fontSize: 14.sp), - hintText: '请输入...(左下角上传图片或视频哦)', - border: InputBorder.none, - contentPadding: EdgeInsets.only( - left: 17.sp, right: 17.sp), - counter: const Text('')), - ), - ), - Row( - children: [ - Expanded(child: Container()), - Text( - '${controller.textEditingController.text.length}/200', - style: TextStyle( - color: Colors.white, fontSize: 12.sp), - ), - SizedBox(width: 15.sp,) - ], - ) - ], - ), - // Positioned( - // right: 15.sp, - // top: 100.sp, - // child:), - Container( - margin: EdgeInsets.only(top: 180.sp), - child: _imageAdapter(controller)), - Container( - margin: EdgeInsets.only( - top: 180.sp, left: 15.sp, right: 15.sp), - child: _showVideo(controller), - ) - ], - ), - )), - if (!isShowKeyboard) - Container( - height: 60.sp, - padding: EdgeInsets.only( - left: 17.sp, right: 17.sp, bottom: 5.sp), - child: Row( - children: [ - GestureDetector( - onTap: () { - logic.showImg(); - }, - child: Image.asset( - getCircleImage('photo'), - width: 30.sp, - ), - ), - const SizedBox( - width: 16, - ), - GestureDetector( - onTap: () { - logic.showVideo(); - }, - child: Image.asset( - getCircleImage('video'), - width: 30.sp, - ), - ), - Expanded( - child: GestureDetector( - onTap: () { - if (controller.vip == 2) { - controller.isCheck = - !controller.isCheck; - controller.update(); - } else { - showOKToast("至尊喊话为年会员特权,开通年会员即可享受哦~"); - controller.showRechargeDialog(); - } - }, - child: Row( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Image.asset( - getCircleImage(controller.isCheck - ? 'check' - : 'uncheck'), - width: 17.5.sp, - ), - SizedBox( - width: 4.sp, - ), - Text( - '使用至尊喊话', - style: TextStyle( - color: Colors.white, - fontSize: 16.sp), - ) - ], - ), - ), - ), - GestureDetector( - onTap: () { - navigateToContentGuidelines(); - }, - child: Text( - '内容规范', - style: TextStyle( - color: const Color(0xff00FFF4), - fontSize: 14.sp), - ), - ) - ], - ), - ) - ], - ), - if (isShowKeyboard) - Positioned( - bottom: keyboardSize, - child: Container( - width: Get.width, - height: 60.sp, - padding: EdgeInsets.only( - left: 17.sp, right: 17.sp, bottom: 5.sp), - child: Row( - children: [ - GestureDetector( - onTap: () { - logic.showImg(); - }, - child: Image.asset( - getCircleImage('photo'), - width: 30.sp, - ), - ), - const SizedBox( - width: 16, - ), - GestureDetector( - onTap: () { - logic.showVideo(); - }, - child: Image.asset( - getCircleImage('video'), - width: 30.sp, - ), - ), - Expanded( - child: GestureDetector( - onTap: () { - if (controller.vip == 2) { - controller.isCheck = - !controller.isCheck; - controller.update(); - } else { - showOKToast("至尊喊话为年会员特权,开通年会员即可享受哦~"); - controller.showRechargeDialog(); - } - }, - child: Row( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Image.asset( - getCircleImage(controller.isCheck - ? 'check' - : 'uncheck'), - width: 17.5.sp, - ), - SizedBox( - width: 4.sp, - ), - Text( - '使用至尊喊话', - style: TextStyle( - color: Colors.white, - fontSize: 16.sp), - ) - ], - ), - ), - ), - GestureDetector( - onTap: () { - navigateToContentGuidelines(); - }, - child: Text( - '内容规范', - style: TextStyle( - color: const Color(0xff00FFF4), - fontSize: 14.sp), - ), - ) - ], - ), - )) - ], - ), - ), - ))); - }); - } - - Widget _showVideo(Call_outLogic controller) { - if (controller.videoPlayerController == null) { - return Container(); - } else { - return _mixVideo(controller); - } - } - - // Widget _maxVideo(Call_outLogic controller){ - Widget _mixVideo(Call_outLogic controller) { - return SizedBox( - width: controller.videoPlayerController!.value.size.width < - controller.videoPlayerController!.value.size.height - ? 135.sp - : 240.sp, - height: controller.videoPlayerController!.value.size.width < - controller.videoPlayerController!.value.size.height - ? 135.sp / controller.videoPlayerController!.value.aspectRatio - : 240.sp / controller.videoPlayerController!.value.aspectRatio, - child: GestureDetector( - onTap: () { - if (controller.videoPlayerController!.value.isPlaying) { - controller.videoPlayerController!.pause(); - } else { - controller.videoPlayerController!.play(); - } - controller.update(); - }, - child: AspectRatio( - aspectRatio: controller.videoPlayerController!.value.aspectRatio, - child: Stack( - children: [ - VideoPlayer(controller.videoPlayerController!), - Center( - child: controller.videoPlayerController!.value.isPlaying - ? Container() - : Image( - image: AssetImage(getMineImage("icon_play")), - width: 30.sp, - height: 30.sp, - ), - ), - Positioned( - top: 0, - right: 0, - child: GestureDetector( - onTap: () { - // showToast("删除"); - _showDelVideoDialog(Get.context!, controller); - }, - child: Image( - image: AssetImage(getMineImage("icon_img_del")), - width: 20.sp, - height: 20.sp, - ), - )) - - // ClosedCaption(text: controller.videoPlayerController!.value.caption.text), - // _ControlsOverlay(controller: controller.videoPlayerController), - // VideoProgressIndicator(controller.videoPlayerController!, allowScrubbing: true), - ], - ), - ), - ), - ); - } - - Widget _imageAdapter(Call_outLogic controller) { - return GridView.builder( - gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 3, // 每行显示的项目数量 - ), - itemCount: controller.state.imaglist.length, // 项目的总数量,包括固定图片和接口获取的项目 - itemBuilder: (BuildContext context, int index) { - return Container( - margin: EdgeInsets.all(5.sp), - child: Center( - child: _buildImageItem( - controller.state.imaglist[index], controller, index)), - ); - }, - ); - } - - Widget _buildImageItem(String url, Call_outLogic controller, int index) { - return Stack( - children: [ - ClipRRect( - borderRadius: BorderRadius.circular(0.0), - child: SizedBox( - width: double.infinity, // 设置容器宽度为屏幕宽度 - height: double.infinity, // 设置容器高度为屏幕高度 - child: ClipRRect( - borderRadius: BorderRadius.circular(0.0), - child: GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.Swiper, arguments: { - 'imaglist': controller.state.imaglist, - 'index': index - }); - }, - child: Image.network( - fit: BoxFit.cover, - url, - ), - ), - ), - ), - ), - Positioned( - top: 5, - right: 5, - child: GestureDetector( - onTap: () { - // showToast("删除"); - _showDelImgDialog(Get.context!, controller, index); - }, - child: Image( - image: AssetImage(getMineImage("icon_img_del")), - width: 20.sp, - height: 20.sp, - ), - )) - ], - ); - } - - void _showDelImgDialog( - BuildContext context, Call_outLogic controller, int index) { - showDialog( - context: context, - builder: (BuildContext context) { - return Dialog( - backgroundColor: Colors.transparent, - child: Container( - height: 160.sp, - padding: const EdgeInsets.all(1.0), - child: Stack( - children: [ - Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: const LinearGradient( - colors: [Color(0xFFDD3DF4), Color(0xFF30FFD9)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Container( - margin: EdgeInsets.all(1.sp), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: const LinearGradient( - colors: [Color(0xFF4C3E5F), Color(0xFF324140)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Container( - margin: EdgeInsets.only(top: 24.sp), - child: Column( - children: [ - Center( - child: Text( - "提示", - style: - TextStyle(color: Colors.white, fontSize: 16.sp), - ), - ), - Container( - margin: EdgeInsets.only( - top: 12.sp, left: 14.sp, right: 14.sp), - alignment: Alignment.center, - child: Text( - "是否确认删除该照片。", - textAlign: TextAlign.center, - style: TextStyle( - color: const Color(0xCCF7FAFA), fontSize: 16.sp), - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - onTap: () { - Navigator.pop(context); - }, - child: Container( - margin: EdgeInsets.only(top: 30.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color(0x26FFFFFF), - Color(0x26FFFFFF), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 10.sp, - bottom: 10.sp, - left: 52.sp, - right: 52.sp), - child: const Text( - "否", - style: TextStyle( - color: Colors.white, - fontSize: 12, - ), - ), - ), - ), - SizedBox(width: 24.sp), - GestureDetector( - onTap: () { - Navigator.pop(context); - controller.state.imaglist.removeAt(index); - controller.update(); - }, - child: Container( - margin: EdgeInsets.only(top: 24.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 10.sp, - bottom: 10.sp, - left: 52.sp, - right: 52.sp), - child: const Text( - "是", - style: TextStyle( - color: Colors.white, - fontSize: 12, - ), - ), - ), - ) - ], - ) - ], - ), - ) - ], - ), - ), - ); - }, - ); - } - - void _showDelVideoDialog(BuildContext context, Call_outLogic controller) { - showDialog( - context: context, - builder: (BuildContext context) { - return Dialog( - backgroundColor: Colors.transparent, - child: Container( - height: 160.sp, - padding: const EdgeInsets.all(1.0), - child: Stack( - children: [ - Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: const LinearGradient( - colors: [Color(0xFFDD3DF4), Color(0xFF30FFD9)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Container( - margin: EdgeInsets.all(1.sp), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: const LinearGradient( - colors: [Color(0xFF4C3E5F), Color(0xFF324140)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Container( - margin: EdgeInsets.only(top: 24.sp), - child: Column( - children: [ - Center( - child: Text( - "提示", - style: - TextStyle(color: Colors.white, fontSize: 16.sp), - ), - ), - Container( - margin: EdgeInsets.only( - top: 12.sp, left: 14.sp, right: 14.sp), - alignment: Alignment.center, - child: Text( - "是否确认删除该视频。", - textAlign: TextAlign.center, - style: TextStyle( - color: const Color(0xCCF7FAFA), fontSize: 16.sp), - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - onTap: () { - Navigator.pop(context); - }, - child: Container( - margin: EdgeInsets.only(top: 30.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color(0x26FFFFFF), - Color(0x26FFFFFF), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 10.sp, - bottom: 10.sp, - left: 52.sp, - right: 52.sp), - child: const Text( - "否", - style: TextStyle( - color: Colors.white, - fontSize: 12, - ), - ), - ), - ), - SizedBox(width: 24.sp), - GestureDetector( - onTap: () { - Navigator.pop(context); - controller.videoPlayerController?.dispose(); - controller.videoPlayerController = null; - controller.state.videolist = []; - controller.update(); - }, - child: Container( - margin: EdgeInsets.only(top: 24.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 10.sp, - bottom: 10.sp, - left: 52.sp, - right: 52.sp), - child: const Text( - "是", - style: TextStyle( - color: Colors.white, - fontSize: 12, - ), - ), - ), - ) - ], - ) - ], - ), - ) - ], - ), - ), - ); - }, - ); - } -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKItMessageList/TIMUIKitTongue/tim_uikit_chat_history_message_list_tongue.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKItMessageList/TIMUIKitTongue/tim_uikit_chat_history_message_list_tongue.dart deleted file mode 100644 index 769b053..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKItMessageList/TIMUIKitTongue/tim_uikit_chat_history_message_list_tongue.dart +++ /dev/null @@ -1,64 +0,0 @@ -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_statelesswidget.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKItMessageList/TIMUIKitTongue/tim_uikit_chat_history_message_list_tongue.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKItMessageList/TIMUIKitTongue/tim_uikit_tongue_item.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart'; - -enum TIMMessageListTongueType { - none, - toLatest, - showUnread, - atMe, - showPrevious, - atAll, -} - -typedef TIMTongueItemBuilder = Widget Function( - VoidCallback onClick, MessageListTongueType valueType, int unreadCount); - -class TIMUIKitHistoryMessageListTongue extends TIMUIKitStatelessWidget { - /// the value type currently - final MessageListTongueType valueType; - - /// the callback after clicking - final VoidCallback onClick; - - /// unread amount currently - final int unreadCount; - - /// the builder for tongue item - final TIMTongueItemBuilder? tongueItemBuilder; - - /// total amount of messages at me - final String atNum; - - final int previousCount; - - TIMUIKitHistoryMessageListTongue({ - Key? key, - required this.valueType, - required this.onClick, - required this.previousCount, - required this.unreadCount, - this.tongueItemBuilder, - this.atNum = "", - }) : super(key: key); - - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - late Widget tongueItem; - if (tongueItemBuilder != null) { - tongueItem = tongueItemBuilder!(onClick, valueType, unreadCount); - } else { - tongueItem = TIMUIKitTongueItem( - onClick: onClick, - unreadCount: unreadCount, - valueType: valueType, - atNum: atNum, - previousCount: previousCount, - ); - } - return valueType != TIMMessageListTongueType.none ? tongueItem : Container(); - } -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKItMessageList/TIMUIKitTongue/tim_uikit_chat_history_message_list_tongue_container.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKItMessageList/TIMUIKitTongue/tim_uikit_chat_history_message_list_tongue_container.dart deleted file mode 100644 index 321c8f9..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKItMessageList/TIMUIKitTongue/tim_uikit_chat_history_message_list_tongue_container.dart +++ /dev/null @@ -1,201 +0,0 @@ -import 'package:flutter/cupertino.dart'; -import 'package:provider/provider.dart'; -import 'package:scroll_to_index/scroll_to_index.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/common_utils.dart'; -import 'package:tencent_im_base/tencent_im_base.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_state.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/separate_models/tui_chat_separate_view_model.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_chat_global_model.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/services_locatar.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKItMessageList/TIMUIKitTongue/tim_uikit_chat_history_message_list_tongue.dart'; -import 'package:tuple/tuple.dart'; - -class TIMUIKitHistoryMessageListTongueContainer extends StatefulWidget { - final Widget Function(void Function(), MessageListTongueType, int)? - tongueItemBuilder; - final List? groupAtInfoList; - final Function(String targetSeq) scrollToIndexBySeq; - final AutoScrollController scrollController; - final TUIChatSeparateViewModel model; - final V2TimConversation conversation; - - const TIMUIKitHistoryMessageListTongueContainer({ - Key? key, - this.tongueItemBuilder, - this.groupAtInfoList, - required this.conversation, - required this.scrollToIndexBySeq, - required this.scrollController, - required this.model, - }) : super(key: key); - - @override - State createState() => - _TIMUIKitHistoryMessageListTongueContainerState(); -} - -class _TIMUIKitHistoryMessageListTongueContainerState - extends TIMUIKitState { - bool isFinishJumpToAt = false; - List? groupAtInfoList = []; - final TUIChatGlobalModel globalModel = serviceLocator(); - bool isClickShowPrevious = false; - - @override - void initState() { - super.initState(); - initScrollListener(); - groupAtInfoList = widget.groupAtInfoList?.reversed.toList(); - } - - void changePositionState(HistoryMessagePosition newPosition) { - if (globalModel.getMessageListPosition(widget.model.conversationID) != - newPosition) { - globalModel.setMessageListPosition( - widget.model.conversationID, newPosition); - } - } - - scrollHandler() { - final screenHeight = MediaQuery.of(context).size.height; - final offset = widget.scrollController.offset; - final conversationUnreadCount = widget.model.getConversationUnreadCount(); - if (offset <= 0.0 && conversationUnreadCount != 0) { - widget.model.showLatestUnread(); - } - if (widget.scrollController.offset <= - widget.scrollController.position.minScrollExtent && - !widget.scrollController.position.outOfRange && - !widget.model.haveMoreLatestData) { - changePositionState(HistoryMessagePosition.bottom); - } else if (widget.scrollController.offset <= screenHeight * 1.6 && - widget.scrollController.offset > 0 && - !widget.scrollController.position.outOfRange && - !widget.model.haveMoreLatestData) { - changePositionState(HistoryMessagePosition.inTwoScreen); - } else if (widget.scrollController.offset > screenHeight * 1.6 && - !widget.scrollController.position.outOfRange && - !widget.model.haveMoreLatestData) { - changePositionState(HistoryMessagePosition.awayTwoScreen); - } - } - - void initScrollListener() { - widget.scrollController.addListener(scrollHandler); - } - - MessageListTongueType _getTongueValueType( - List? groupAtInfoList) { - if (globalModel.getMessageListPosition(widget.model.conversationID) == - HistoryMessagePosition.notShowLatest) { - return MessageListTongueType.none; - } - if (groupAtInfoList != null && - groupAtInfoList.isNotEmpty && - !isFinishJumpToAt) { - if (groupAtInfoList[0]!.atType == 1) { - return MessageListTongueType.atMe; - } else { - return MessageListTongueType.atAll; - } - } - - if ((widget.conversation.unreadCount ?? 0) > 20 && !isClickShowPrevious) { - return MessageListTongueType.showPrevious; - } - - if (globalModel.unreadCountForConversation > 0) { - return MessageListTongueType.showUnread; - } - - if (globalModel.getMessageListPosition(widget.model.conversationID) == - HistoryMessagePosition.awayTwoScreen) { - return MessageListTongueType.toLatest; - } - - return MessageListTongueType.none; - } - - @override - void dispose() { - super.dispose(); - widget.scrollController.removeListener(scrollHandler); - } - - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - return Selector>( - builder: (context, value, child) { - return Positioned( - bottom: _getTongueValueType(groupAtInfoList) != - MessageListTongueType.showPrevious - ? 16 - : null, - top: _getTongueValueType(groupAtInfoList) == - MessageListTongueType.showPrevious - ? 16 - : null, - right: 16, - child: TIMUIKitHistoryMessageListTongue( - previousCount: widget.conversation.unreadCount ?? 0, - tongueItemBuilder: widget.tongueItemBuilder, - unreadCount: globalModel.unreadCountForConversation, - onClick: () async { - if (groupAtInfoList != null && groupAtInfoList!.isNotEmpty) { - if (groupAtInfoList?.length == 1) { - widget.scrollToIndexBySeq(groupAtInfoList![0]!.seq); - widget.model.markMessageAsRead(); - setState(() { - groupAtInfoList = []; - isFinishJumpToAt = true; - }); - } else { - widget.scrollToIndexBySeq(groupAtInfoList!.removeAt(0)!.seq); - } - } else if ((widget.conversation.unreadCount ?? 0) > 20 && - !isClickShowPrevious) { - try { - isClickShowPrevious = true; - final String? lastSeqString = - widget.conversation.lastMessage?.seq; - final int? lastSeq = - TencentUtils.checkString(lastSeqString) != null - ? int.parse(lastSeqString!) - : null; - final int? previousCount = widget.conversation.unreadCount; - if (lastSeq != null && previousCount != null) { - final targetSeq = lastSeq - previousCount; - await widget.model - .loadListForSpecificMessage(seq: targetSeq); - // widget.scrollToIndexBySeq((targetSeq + 1).toString()); - } - } catch (e) { - // TODO: 这里后续加个弹窗提示客户,找消息失败了 - } - // widget.model.loadListForSpecificMessage(seq: count); - } else if (value.item1 == HistoryMessagePosition.awayTwoScreen || - globalModel.unreadCountForConversation > 0) { - widget.model.showLatestUnread(); - widget.scrollController.animateTo( - widget.scrollController.position.minScrollExtent, - duration: const Duration(milliseconds: 200), - curve: Curves.ease, - ); - return; - } - }, - atNum: groupAtInfoList?.length.toString() ?? "", - valueType: _getTongueValueType(groupAtInfoList), - ), - ); - }, - selector: (c, model) { - final mesageListPosition = - model.getMessageListPosition(widget.model.conversationID); - final unreadCountForConversation = model.unreadCountForConversation; - return Tuple2(mesageListPosition, unreadCountForConversation); - }, - ); - } -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKItMessageList/TIMUIKitTongue/tim_uikit_tongue_item.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKItMessageList/TIMUIKitTongue/tim_uikit_tongue_item.dart deleted file mode 100644 index 5f0b663..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKItMessageList/TIMUIKitTongue/tim_uikit_tongue_item.dart +++ /dev/null @@ -1,104 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_statelesswidget.dart'; - -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart'; -import 'package:tencent_im_base/tencent_im_base.dart'; - -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKItMessageList/TIMUIKitTongue/tim_uikit_chat_history_message_list_tongue.dart'; - -class TIMUIKitTongueItem extends TIMUIKitStatelessWidget { - /// the callback after clicking - final VoidCallback onClick; - - /// the value type currently - final MessageListTongueType valueType; - - /// unread amount currently - final int unreadCount; - - /// total amount of messages at me - final String atNum; - - final int previousCount; - - TIMUIKitTongueItem({ - Key? key, - required this.onClick, - required this.valueType, - required this.previousCount, - required this.unreadCount, - required this.atNum, - }) : super(key: key); - - Map textType(BuildContext context) { - final option1 = unreadCount.toString(); - final option2 = atNum.toString(); - final option3 = previousCount.toString(); - final String atMeString = option2 != "" - ? TIM_t_para("有{{option2}}条@我消息", "有$option2条@我消息")(option2: option2) - : TIM_t("有人@我"); - - return { - MessageListTongueType.showPrevious: - TIM_t_para("{{option3}}条未读消息", "$option3条未读消息")(option3: option3), - MessageListTongueType.toLatest: TIM_t("回到最新位置"), - MessageListTongueType.showUnread: - TIM_t_para("{{option1}}条新消息", "$option1条新消息")(option1: option1), - MessageListTongueType.atMe: atMeString, - MessageListTongueType.atAll: TIM_t("@所有人"), - }; - } - - final Map iconType = { - MessageListTongueType.toLatest: Icons.arrow_downward_outlined, - MessageListTongueType.showUnread: Icons.arrow_downward_outlined, - MessageListTongueType.atMe: Icons.arrow_upward_outlined, - MessageListTongueType.atAll: Icons.arrow_upward_outlined, - MessageListTongueType.showPrevious: Icons.arrow_upward_outlined, - }; - - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - final TUITheme theme = value.theme; - return GestureDetector( - onTap: onClick, - child: Container( - decoration: BoxDecoration( - color: Colors.white, - border: Border.all(color: hexToColor("E5E5E5"), width: 1), - boxShadow: [ - BoxShadow( - color: theme.weakDividerColor ?? hexToColor("E6E9EB"), - offset: const Offset(0.0, 0.0), - blurRadius: 10, - spreadRadius: 2), - ], - ), - padding: const EdgeInsets.all(10), - // width: 112, - // height: 37, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - margin: const EdgeInsets.only(right: 6), - child: Icon( - iconType[valueType], - color: theme.primaryColor, - size: 12, - ), - ), - Text( - textType(context)[valueType] ?? "", - style: TextStyle( - color: theme.primaryColor, - fontSize: 12.0, - fontWeight: FontWeight.w400), - ), - ], - ), - ), - ); - } -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKItMessageList/tim_uikit_chat_history_message_list.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKItMessageList/tim_uikit_chat_history_message_list.dart deleted file mode 100644 index 3447a8d..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKItMessageList/tim_uikit_chat_history_message_list.dart +++ /dev/null @@ -1,570 +0,0 @@ -import 'package:collection/collection.dart'; -import 'package:flutter/foundation.dart'; -import 'package:flutter/gestures.dart'; -import 'package:flutter/material.dart'; -import 'package:loading_animation_widget/loading_animation_widget.dart'; -import 'package:provider/provider.dart'; -import 'package:scroll_to_index/scroll_to_index.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_state.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKItMessageList/TIMUIKitTongue/tim_uikit_chat_history_message_list_tongue.dart'; -import 'package:tencent_im_base/tencent_im_base.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_statelesswidget.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/separate_models/tui_chat_separate_view_model.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_chat_global_model.dart'; -// ignore: unused_import -import 'package:tencent_cloud_chat_uikit/ui/utils/optimize_utils.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKItMessageList/tim_uikit_chat_history_message_list_config.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKItMessageList/utils.dart'; -import 'package:tencent_cloud_chat_uikit/ui/widgets/keepalive_wrapper.dart'; -import 'TIMUIKitTongue/tim_uikit_chat_history_message_list_tongue.dart'; -import 'TIMUIKitTongue/tim_uikit_chat_history_message_list_tongue_container.dart'; - -enum LoadingPlace { - none, - top, - bottom, -} - -enum ScrollType { toIndex, toIndexBegin } - -class TIMUIKitHistoryMessageListController extends ChangeNotifier { - AutoScrollController? scrollController = AutoScrollController(); - late ScrollType scrollType; - late V2TimMessage targetMessage; - - TIMUIKitHistoryMessageListController({ - AutoScrollController? scrollController, - }) { - if (scrollController != null) { - this.scrollController = scrollController; - } - } - - scrollToIndex(V2TimMessage message) { - scrollType = ScrollType.toIndex; - targetMessage = message; - notifyListeners(); - } - - scrollToIndexBegin(V2TimMessage message) { - scrollType = ScrollType.toIndexBegin; - targetMessage = message; - notifyListeners(); - } -} - -class TIMHistoryMessageList extends StatefulWidget { - /// message list - final List messageList; - - /// tongue item builder - final TongueItemBuilder? tongueItemBuilder; - - /// group at info, it can get from conversation info - final List? groupAtInfoList; - - /// use for build message item - final Widget Function(BuildContext, V2TimMessage?)? itemBuilder; - - /// can controll message list scroll - final TIMUIKitHistoryMessageListController? controller; - - /// use for message jump, if passed will jump to target message. - final V2TimMessage? initFindingMsg; - - /// use for load more message - final Future Function(String?, LoadDirection direction, [int?]) - onLoadMore; - - /// configuration for list view - final TIMUIKitHistoryMessageListConfig? mainHistoryListConfig; - - final TUIChatSeparateViewModel model; - - final bool isAllowScroll; - - final V2TimConversation conversation; - - const TIMHistoryMessageList( - {Key? key, - required this.model, - required this.messageList, - this.itemBuilder, - this.controller, - required this.onLoadMore, - this.tongueItemBuilder, - this.groupAtInfoList, - this.initFindingMsg, - this.isAllowScroll = true, - this.mainHistoryListConfig, - required this.conversation}) - : super(key: key); - - @override - State createState() => _TIMHistoryMessageListState(); -} - -class _TIMHistoryMessageListState - extends TIMUIKitState { - V2TimMessage? findingMsg; - String findingSeq = ""; - late TIMUIKitHistoryMessageListController _controller; - late AutoScrollController _autoScrollController; - LoadingPlace loadingPlace = LoadingPlace.none; - - @override - void initState() { - super.initState(); - _controller = widget.controller ?? TIMUIKitHistoryMessageListController(); - _autoScrollController = - _controller.scrollController ?? AutoScrollController(); - _controller.addListener(_controllerListener); - initFinding(); - } - - initFinding() async { - if (widget.initFindingMsg != null) { - await widget.onLoadMore(null, LoadDirection.previous); - setState(() { - findingMsg = widget.initFindingMsg!; - }); - } - } - - _controllerListener() { - final scrollType = _controller.scrollType; - final targetMessage = _controller.targetMessage; - switch (scrollType) { - case ScrollType.toIndex: - _onScrollToIndex(targetMessage); - break; - case ScrollType.toIndexBegin: - _onScrollToIndexBegin(targetMessage); - break; - default: - } - } - - Widget _getMessageItemBuilder(V2TimMessage? messageItem) { - if (widget.itemBuilder != null) { - return widget.itemBuilder!(context, messageItem); - } - return Container(); - } - - _getMessageId(int index) { - if (widget.messageList[index]!.elemType == 11) { - return _getMessageId(index - 1); - } - return widget.messageList[index]!.msgID; - } - - void showCantFindMsg() { - findingMsg = null; - findingSeq = ""; - loadingPlace = LoadingPlace.none; - onTIMCallback(TIMCallback( - type: TIMCallbackType.INFO, - infoRecommendText: TIM_t("无法定位到原消息"), - infoCode: 6660401)); - } - - _onScrollToIndex(V2TimMessage targetMsg) { - // This method called by @ messages or messages been searched, aims to jump to target message - loadingPlace = LoadingPlace.top; - const int singleLoadAmount = kIsWeb ? 15 : 40; - final lastTimestamp = - widget.messageList[widget.messageList.length - 1]?.timestamp; - final msgList = widget.messageList; - final targetTimeStamp = targetMsg.timestamp!; - - if (targetTimeStamp >= lastTimestamp!) { - // 当前列表里应该有这个消息,试试能不能直接定位到那去 - bool isFound = false; - int targetIndex = 1; - for (int i = msgList.length - 1; i >= 0; i--) { - final currentMsg = msgList[i]; - if (currentMsg?.timestamp == targetTimeStamp && - currentMsg?.elemType != 11 && - currentMsg!.msgID == targetMsg.msgID) { - // find the target index by timestamp and msgID - isFound = true; - targetIndex = -i; - break; - } - } - - if (isFound && targetIndex != 1) { - findingMsg = null; - _autoScrollController.scrollToIndex( - targetIndex, - preferPosition: AutoScrollPosition.middle, - ); - - // execute twice for accurate position, as the position located firstly can be wrong - _autoScrollController.scrollToIndex(targetIndex, - preferPosition: AutoScrollPosition.middle); - _autoScrollController.scrollToIndex(targetIndex, - preferPosition: AutoScrollPosition.middle); - - widget.model.jumpMsgID = targetMsg.msgID!; - loadingPlace = LoadingPlace.none; - } else { - showCantFindMsg(); - } - } else { - if (widget.model.haveMoreData) { - // if the target message not in current message list, load more - findingMsg = targetMsg; - final lastMsgId = _getMessageId(widget.messageList.length - 1); - widget.onLoadMore(lastMsgId, LoadDirection.previous, singleLoadAmount); - } else { - showCantFindMsg(); - } - } - } - - _onScrollToIndexBySeq(String targetSeq) { - // This method called by tongue request jumping to target @ message - loadingPlace = LoadingPlace.top; - const int singleLoadAmount = 40; - final msgList = widget.messageList; - String lastSeq = ""; - for (int i = msgList.length - 1; i >= 0; i--) { - final currentMsg = msgList[i]; - if (currentMsg!.seq != null && currentMsg.seq != "") { - lastSeq = currentMsg.seq!; - break; - } - } - - if (int.parse(lastSeq) <= int.parse(targetSeq)) { - bool isFound = false; - int targetIndex = 1; - String? targetMsgID = ""; - for (int i = msgList.length - 1; i >= 0; i--) { - final currentMsg = msgList[i]; - if (currentMsg?.seq == targetSeq) { - isFound = true; - targetMsgID = currentMsg?.msgID; - targetIndex = -i; - break; - } - } - - if (isFound && targetIndex != 1) { - findingSeq = ""; - _autoScrollController.scrollToIndex( - targetIndex, - preferPosition: AutoScrollPosition.middle, - ); - _autoScrollController.scrollToIndex(targetIndex, - preferPosition: AutoScrollPosition.middle); - if (targetMsgID != null && targetMsgID != "") { - widget.model.jumpMsgID = targetMsgID; - } - loadingPlace = LoadingPlace.none; - } else { - showCantFindMsg(); - } - } else { - if (widget.model.haveMoreData) { - findingSeq = targetSeq; - widget.onLoadMore(_getMessageId(widget.messageList.length - 1), - LoadDirection.previous, singleLoadAmount); - } else { - showCantFindMsg(); - } - } - } - - _onScrollToIndexBegin(V2TimMessage targetMsg) { - final lastTimestamp = - widget.messageList[widget.messageList.length - 1]?.timestamp; - final msgList = widget.messageList; - final int targetTimeStamp = targetMsg.timestamp!; - - if (targetTimeStamp >= lastTimestamp!) { - bool isFound = false; - int targetIndex = 1; - for (int i = msgList.length - 1; i >= 0; i--) { - final currentMsg = msgList[i]; - if (currentMsg?.timestamp == targetTimeStamp && - currentMsg?.elemType != 11 && - currentMsg!.msgID == targetMsg.msgID) { - isFound = true; - targetIndex = -i; - break; - } - } - if (isFound && targetIndex != 1) { - _autoScrollController.scrollToIndex( - targetIndex, - preferPosition: AutoScrollPosition.end, - ); - } - } - } - - List _getReceivedMessageList(int receivedMessageListCount) { - if (receivedMessageListCount == 0) { - return []; - } - final haveTimeStampMessage = - widget.messageList[receivedMessageListCount]?.elemType == 11; - final endPoint = haveTimeStampMessage - ? receivedMessageListCount + 1 - : receivedMessageListCount; - return widget.messageList.sublist(0, endPoint).reversed.toList(); - } - - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - // center key should generate everytime when build method called. - final GlobalKey centerKey = GlobalKey(); - - final theme = value.theme; - if (widget.messageList.isEmpty) { - return Container(); - } - - final messageList = widget.messageList; - final globalModel = context.read(); - final receivedNewMessageList = globalModel.receivedMessageListCount; - final shouldShowUnreadMessage = receivedNewMessageList > 0; - final unreadMessageList = _getReceivedMessageList(receivedNewMessageList); - final readMessageList = messageList - .sublist(unreadMessageList.length, messageList.length) - .toList(); - - final throttleFunction = - OptimizeUtils.multiThrottle((index, LoadDirection direction) async { - final msgID = - TIMUIKitChatUtils.getMessageIDWithinIndex(readMessageList, index); - await widget.onLoadMore(msgID, direction); - }, 20); - - final throttleFunctionWithMsgID = - OptimizeUtils.multiThrottle((msgID, LoadDirection direction) async { - await widget.onLoadMore(msgID, direction); - }, 200); - - if (findingMsg != null) { - _onScrollToIndex(findingMsg!); - } else if (findingSeq != "") { - _onScrollToIndexBySeq(findingSeq); - } - - String getMessageIdentifier(V2TimMessage? message, int index) { - return "${message?.msgID} - ${message?.timestamp} - ${message?.seq} -${message?.id}"; - } - - return Stack( - alignment: Alignment.topCenter, - children: [ - Scrollbar( - controller: _autoScrollController, - child: CustomScrollView( - center: shouldShowUnreadMessage ? centerKey : null, - key: widget.mainHistoryListConfig?.key, - primary: widget.mainHistoryListConfig?.primary, - physics: (widget.isAllowScroll == false) - ? const NeverScrollableScrollPhysics() - : widget.mainHistoryListConfig?.physics, - // padding: widget.mainHistoryListConfig?.padding ?? EdgeInsets.zero, - // itemExtent: widget.mainHistoryListConfig?.itemExtent, - // prototypeItem: widget.mainHistoryListConfig?.prototypeItem, - cacheExtent: widget.mainHistoryListConfig?.cacheExtent ?? 1500, - semanticChildCount: - widget.mainHistoryListConfig?.semanticChildCount, - dragStartBehavior: - widget.mainHistoryListConfig?.dragStartBehavior ?? - DragStartBehavior.start, - keyboardDismissBehavior: - widget.mainHistoryListConfig?.keyboardDismissBehavior ?? - ScrollViewKeyboardDismissBehavior.manual, - restorationId: widget.mainHistoryListConfig?.restorationId, - clipBehavior: - widget.mainHistoryListConfig?.clipBehavior ?? Clip.hardEdge, - reverse: true, - shrinkWrap: !shouldShowUnreadMessage, - controller: _autoScrollController, - slivers: [ - SliverPadding( - padding: - widget.mainHistoryListConfig?.padding ?? EdgeInsets.zero, - sliver: SliverList( - delegate: SliverChildBuilderDelegate( - (BuildContext context, int index) { - final messageItem = unreadMessageList[index]; - if (index == unreadMessageList.length - 1 && - widget.model.haveMoreLatestData == true) { - throttleFunctionWithMsgID( - messageItem?.msgID ?? "", - LoadDirection.latest); - } - return AutoScrollTag( - controller: _autoScrollController, - index: -index, - key: ValueKey( - getMessageIdentifier(messageItem, index)), - highlightColor: Colors.black.withOpacity(0.1), - child: KeepAliveWrapper( - keepAlive: messageItem?.elemType == - MessageElemType.V2TIM_ELEM_TYPE_SOUND, - child: Container( - padding: const EdgeInsets.symmetric( - horizontal: 16), - child: - _getMessageItemBuilder(messageItem))), - ); - }, - childCount: unreadMessageList.length, - findChildIndexCallback: (Key key) { - final ValueKey valueKey = - key as ValueKey; - final String data = valueKey.value; - final int index = unreadMessageList.indexWhere( - (element) => - getMessageIdentifier(element, 0) == data); - return index != -1 ? index : null; - })), - ), - SliverPadding( - padding: EdgeInsets.zero, - key: centerKey, - ), - SliverPadding( - padding: - widget.mainHistoryListConfig?.padding ?? EdgeInsets.zero, - sliver: Selector( - selector: (context, model) { - return model.haveMoreData; - }, - shouldRebuild: (previous, next) { - return previous != next; - }, - builder: (context, haveMoreData, child) { - return SliverList( - delegate: SliverChildBuilderDelegate( - (BuildContext context, int index) { - final messageItem = readMessageList[index]; - final isSelf = messageItem?.isSelf ?? true; - if (index == readMessageList.length - 1) { - if (haveMoreData) { - throttleFunction( - index, LoadDirection.previous); - return Column( - children: [ - LoadingAnimationWidget - .staggeredDotsWave( - color: theme.weakTextColor ?? - Colors.grey, - size: 28, - ), - AutoScrollTag( - controller: _autoScrollController, - index: -index, - key: ValueKey(getMessageIdentifier( - messageItem, index)), - highlightColor: - Colors.black.withOpacity(0.1), - child: KeepAliveWrapper( - keepAlive: messageItem - ?.elemType == - MessageElemType - .V2TIM_ELEM_TYPE_SOUND, - child: Container( - padding: const EdgeInsets - .symmetric( - horizontal: 16), - child: _getMessageItemBuilder( - messageItem))), - ), - ], - ); - } - } - if (index == 0 && - widget.model.haveMoreLatestData == true && - globalModel.receivedMessageListCount < 10) { - throttleFunction(index, LoadDirection.latest); - } - return AutoScrollTag( - controller: _autoScrollController, - index: -index, - key: ValueKey( - getMessageIdentifier(messageItem, index)), - highlightColor: Colors.black.withOpacity(0.1), - child: KeepAliveWrapper( - keepAlive: messageItem?.elemType == - MessageElemType.V2TIM_ELEM_TYPE_SOUND, - child: Container( - padding: EdgeInsets.only( - left: isSelf ? 0 : 16, - right: isSelf ? 16 : 0), - child: _getMessageItemBuilder( - messageItem))), - ); - }, - childCount: readMessageList.length, - findChildIndexCallback: (Key key) { - final ValueKey valueKey = - key as ValueKey; - final String data = valueKey.value; - final int index = readMessageList.indexWhere( - (element) => - getMessageIdentifier(element, 0) == - data); - return index > -1 ? index : null; - })); - }, - ), - ), - ], - )), - TIMUIKitHistoryMessageListTongueContainer( - conversation: widget.conversation, - model: widget.model, - scrollController: _autoScrollController, - scrollToIndexBySeq: _onScrollToIndexBySeq, - groupAtInfoList: widget.groupAtInfoList, - tongueItemBuilder: widget.tongueItemBuilder, - ), - if (loadingPlace == LoadingPlace.top) - Positioned( - top: 8, - child: LoadingAnimationWidget.staggeredDotsWave( - color: theme.weakTextColor ?? Colors.grey, - size: 28, - ), - ), - ], - ); - } -} - -class TIMUIKitHistoryMessageListSelector extends TIMUIKitStatelessWidget { - final Widget Function(BuildContext, List, Widget?) builder; - final String conversationID; - - TIMUIKitHistoryMessageListSelector( - {Key? key, required this.builder, required this.conversationID}) - : super(key: key); - - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - return Selector>( - builder: builder, - shouldRebuild: (previous, next) { - final isEquals = - const DeepCollectionEquality.unordered().equals(previous, next); - return !isEquals; - }, - selector: (context, model) { - final messageList = model.getMessageList(conversationID) ?? []; - return messageList; - }); - } -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKItMessageList/tim_uikit_chat_history_message_list_config.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKItMessageList/tim_uikit_chat_history_message_list_config.dart deleted file mode 100644 index b7a29aa..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKItMessageList/tim_uikit_chat_history_message_list_config.dart +++ /dev/null @@ -1,171 +0,0 @@ -import 'package:flutter/gestures.dart'; -import 'package:flutter/material.dart'; - -// The definition of the following parameters is the same with [ListView.builder] -class TIMHistoryMessageListConfig { - Key? key; - - /// {@template flutter.widgets.scroll_view.scrollDirection} - /// The axis along which the scroll view scrolls. - /// - /// Defaults to [Axis.vertical]. - /// {@endtemplate} - Axis? scrollDirection; - - /// {@template flutter.widgets.scroll_view.primary} - /// Whether this is the primary scroll view associated with the parent - /// [PrimaryScrollController]. - /// - /// When this is true, the scroll view is scrollable even if it does not have - /// sufficient content to actually scroll. Otherwise, by default the user can - /// only scroll the view if it has sufficient content. See [physics]. - /// - /// Also when true, the scroll view is used for default [ScrollAction]s. If a - /// ScrollAction is not handled by an otherwise focused part of the application, - /// the ScrollAction will be evaluated using this scroll view, for example, - /// when executing [Shortcuts] key events like page up and down. - /// - /// On iOS, this also identifies the scroll view that will scroll to top in - /// response to a tap in the status bar. - /// {@endtemplate} - /// - /// Defaults to true when [scrollDirection] is [Axis.vertical] and - /// [controller] is null. - bool? primary; - - /// {@template flutter.widgets.scroll_view.physics} - /// How the scroll view should respond to user input. - /// - /// For example, determines how the scroll view continues to animate after the - /// user stops dragging the scroll view. - /// - /// Defaults to matching platform conventions. Furthermore, if [primary] is - /// false, then the user cannot scroll if there is insufficient content to - /// scroll, while if [primary] is true, they can always attempt to scroll. - /// - /// To force the scroll view to always be scrollable even if there is - /// insufficient content, as if [primary] was true but without necessarily - /// setting it to true, provide an [AlwaysScrollableScrollPhysics] physics - /// object, as in: - /// - /// ```dart - /// physics: const AlwaysScrollableScrollPhysics(), - /// ``` - /// - /// To force the scroll view to use the default platform conventions and not - /// be scrollable if there is insufficient content, regardless of the value of - /// [primary], provide an explicit [ScrollPhysics] object, as in: - /// - /// ```dart - /// physics: const ScrollPhysics(), - /// ``` - /// - /// The physics can be changed dynamically (by providing a new object in a - /// subsequent build), but new physics will only take effect if the _class_ of - /// the provided object changes. Merely constructing a new instance with a - /// different configuration is insufficient to cause the physics to be - /// reapplied. (This is because the final object used is generated - /// dynamically, which can be relatively expensive, and it would be - /// inefficient to speculatively create this object each frame to see if the - /// physics should be updated.) - /// {@endtemplate} - /// - /// If an explicit [ScrollBehavior] is provided to [scrollBehavior], the - /// [ScrollPhysics] provided by that behavior will take precedence after - /// [physics]. - ScrollPhysics? physics; - - /// The amount of space by which to inset the children. - EdgeInsetsGeometry? padding; - - /// {@template flutter.widgets.list_view.itemExtent} - /// If non-null, forces the children to have the given extent in the scroll - /// direction. - /// - /// Specifying an [itemExtent] is more efficient than letting the children - /// determine their own extent because the scrolling machinery can make use of - /// the foreknowledge of the children's extent to save work, for example when - /// the scroll position changes drastically. - /// - /// See also: - /// - /// * [SliverFixedExtentList], the sliver used internally when this property - /// is provided. It constrains its box children to have a specific given - /// extent along the main axis. - /// * The [prototypeItem] property, which allows forcing the children's - /// extent to be the same as the given widget. - /// {@endtemplate} - double? itemExtent; - - /// {@template flutter.widgets.list_view.prototypeItem} - /// If non-null, forces the children to have the same extent as the given - /// widget in the scroll direction. - /// - /// Specifying an [prototypeItem] is more efficient than letting the children - /// determine their own extent because the scrolling machinery can make use of - /// the foreknowledge of the children's extent to save work, for example when - /// the scroll position changes drastically. - /// - /// See also: - /// - /// * [SliverPrototypeExtentList], the sliver used internally when this - /// property is provided. It constrains its box children to have the same - /// extent as a prototype item along the main axis. - /// * The [itemExtent] property, which allows forcing the children's extent - /// to a given value. - /// {@endtemplate} - Widget? prototypeItem; - - /// {@macro flutter.rendering.RenderViewportBase.cacheExtent} - double? cacheExtent; - - /// The number of children that will contribute semantic information. - /// - /// Some subtypes of [ScrollView] can infer this value automatically. For - /// example [ListView] will use the number of widgets in the child list, - /// while the [ListView.separated] constructor will use half that amount. - /// - /// For [CustomScrollView] and other types which do not receive a builder - /// or list of widgets, the child count must be explicitly provided. If the - /// number is unknown or unbounded this should be left unset or set to null. - /// - /// See also: - /// - /// * [SemanticsConfiguration.scrollChildCount], the corresponding semantics property. - int? semanticChildCount; - - /// {@macro flutter.widgets.scrollable.dragStartBehavior} - DragStartBehavior? dragStartBehavior; - - /// {@template flutter.widgets.scroll_view.keyboardDismissBehavior} - /// [ScrollViewKeyboardDismissBehavior] the defines how this [ScrollView] will - /// dismiss the keyboard automatically. - /// {@endtemplate} - ScrollViewKeyboardDismissBehavior? keyboardDismissBehavior; - - /// {@macro flutter.widgets.scrollable.restorationId} - String? restorationId; - - /// {@macro flutter.material.Material.clipBehavior} - /// - /// Defaults to [Clip.hardEdge]. - Clip? clipBehavior; - - bool? shrinkWrap; - - TIMHistoryMessageListConfig( - {this.key, - this.scrollDirection, - this.primary, - this.physics, - this.padding, - this.itemExtent, - this.prototypeItem, - this.cacheExtent, - this.semanticChildCount, - this.dragStartBehavior, - this.keyboardDismissBehavior, - this.restorationId, - this.shrinkWrap, - this.clipBehavior}); -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKItMessageList/tim_uikit_chat_history_message_list_item.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKItMessageList/tim_uikit_chat_history_message_list_item.dart deleted file mode 100644 index 706ba7d..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKItMessageList/tim_uikit_chat_history_message_list_item.dart +++ /dev/null @@ -1,1887 +0,0 @@ -import 'dart:convert'; -import 'dart:math'; - -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:circle_app/app/chat/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_text_elem.dart'; -import 'package:circle_app/app/chat/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_merger_message_elem.dart'; -import 'package:circle_app/app/chat/widget/chat_msg_card_item.dart'; -import 'package:circle_app/app/chat/widget/chat_msg_invent_wish_item.dart'; -import 'package:circle_app/app/chat/widget/chat_msg_partner_item.dart'; -import 'package:circle_app/app/chat/widget/chat_msg_wish_info_item.dart'; -import 'package:circle_app/router/app_routers.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/gestures.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:loading_animation_widget/loading_animation_widget.dart'; -import 'package:provider/provider.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/core/tim_uikit_wide_modal_operation_key.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/screen_utils.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKItMessageList/tim_uikit_chat_message_tooltip.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitMessageItem/TIMUIKitMessageReaction/tim_uikit_message_reaction_select_emoji.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_text_translate_elem.dart'; -import 'package:tencent_cloud_chat_uikit/ui/widgets/forward_message_screen.dart'; -import 'package:tencent_cloud_chat_uikit/ui/widgets/wide_popup.dart'; -import 'package:tencent_super_tooltip/tencent_super_tooltip.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_state.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_statelesswidget.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/separate_models/tui_chat_separate_view_model.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_chat_global_model.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_self_info_view_model.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/message/message_services.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/services_locatar.dart'; -import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; -import 'package:tencent_cloud_chat_uikit/ui/constants/history_message_constant.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/message.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/platform.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/time_ago.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKItMessageList/tim_uikit_message_read_receipt.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitMessageItem/TIMUIKitMessageReaction/tim_uikit_message_reaction_utils.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitMessageItem/main.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_custom_elem.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_face_elem.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/tim_uikit_cloud_custom_data.dart'; -import 'package:tencent_cloud_chat_uikit/ui/widgets/avatar.dart'; -import 'package:tencent_cloud_chat_uikit/ui/widgets/radio_button.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart'; - -import '../../../../common/Widgets/text_more.dart'; -import '../../../../network/api.dart'; -import '../../../../network/dio_manager.dart'; -import '../../../circle/logic.dart'; -import '../../widget/chat_msg_get_gift_item.dart'; -import '../../widget/chat_msg_user_home_item.dart'; -import '../TIMUIKitMessageItem/TIMUIKitMessageReaction/tim_uikit_chat_gift_elem.dart'; -import '../TIMUIKitMessageItem/TIMUIKitMessageReaction/tim_uikit_message_reaction_select_emoji.dart'; - -typedef MessageRowBuilder = Widget? Function( - /// current message - V2TimMessage message, - - /// the message widget for current message, build by your custom builder or our default builder - Widget messageWidget, - - /// scroll to the specific message, it will shows in the screen center, and call isNeedShowJumpStatus if necessary - Function onScrollToIndex, - - /// if current message been called to jumped by other message - bool isNeedShowJumpStatus, - - /// clear the been jumped status, recommend to execute after get 'isNeedShowJumpStatus' - VoidCallback clearJumpStatus, - - /// scroll to specific message, it will shows on the screen top, without the call isNeedShowJumpStatus - Function onScrollToIndexBegin, -); - -typedef MessageNickNameBuilder = Widget Function( - BuildContext context, V2TimMessage message, TUIChatSeparateViewModel model); - -typedef MessageItemContent = Widget? Function( - V2TimMessage message, - bool isShowJump, - VoidCallback clearJump, -); - -class MessageHoverControlItem { - String name; - Widget icon; - ValueChanged onClick; - - MessageHoverControlItem( - {required this.name, required this.icon, required this.onClick}); -} - -class TIMMessageItemBuilder { - /// text message builder - final MessageItemContent? textMessageItemBuilder; - - /// text message builder for reply message - final MessageItemContent? textReplyMessageItemBuilder; - - /// custom message builder - final MessageItemContent? customMessageItemBuilder; - - /// image message builder - final MessageItemContent? imageMessageItemBuilder; - - /// sound message builder - final MessageItemContent? soundMessageItemBuilder; - - /// video message builder - final MessageItemContent? videoMessageItemBuilder; - - /// file message builder - final MessageItemContent? fileMessageItemBuilder; - - /// location message (LBS) item builder; - /// recommend to use our LBS plug-in: https://pub.dev/packages/tim_ui_kit_lbs_plugin - final MessageItemContent? locationMessageItemBuilder; - - /// face message, like emoji, message builder - final MessageItemContent? faceMessageItemBuilder; - - /// group tips message builder - final MessageItemContent? groupTipsMessageItemBuilder; - - /// merger message builder - final MessageItemContent? mergerMessageItemBuilder; - - /// The builder for the whole message line, expect for those message type without avatar and nickname. - /// [Update] You can only re-define the message types you need, returns null means using default row layout. - final MessageRowBuilder? messageRowBuilder; - - /// message nick name builder - final MessageNickNameBuilder? messageNickNameBuilder; - - TIMMessageItemBuilder({ - this.locationMessageItemBuilder, - this.textMessageItemBuilder, - this.textReplyMessageItemBuilder, - this.customMessageItemBuilder, - this.imageMessageItemBuilder, - this.soundMessageItemBuilder, - this.videoMessageItemBuilder, - this.fileMessageItemBuilder, - this.faceMessageItemBuilder, - this.groupTipsMessageItemBuilder, - this.mergerMessageItemBuilder, - this.messageRowBuilder, - this.messageNickNameBuilder, - }); -} - -class MessageToolTipItem { - final String label; - final String id; - final String iconImageAsset; - final VoidCallback onClick; - - MessageToolTipItem( - {required this.label, - required this.id, - required this.iconImageAsset, - required this.onClick}); -} - -class TIMToolTipsConfig { - final bool showReplyMessage; - final bool showMultipleChoiceMessage; - final bool showDeleteMessage; - final bool showRecallMessage; - final bool showCopyMessage; - final bool showForwardMessage; - final bool showTranslation; - final Widget? Function(V2TimMessage message, Function() closeTooltip, - [Key? key, BuildContext? context])? additionalItemBuilder; - List Function( - V2TimMessage message, Function() closeTooltip)? additionalMessageToolTips; - - TIMToolTipsConfig( - {this.showDeleteMessage = true, - this.showMultipleChoiceMessage = true, - this.showRecallMessage = true, - this.showReplyMessage = true, - this.showTranslation = true, - this.showCopyMessage = true, - this.showForwardMessage = true, - this.additionalMessageToolTips, - @Deprecated("Please use `additionalMessageToolTips` instead. You are now only expected to specify the data, rather than providing a whole widget. This makes usage easier, as you no longer need to worry about the UI display.") - this.additionalItemBuilder}); -} - -class TIMHistoryMessageListItem extends StatefulWidget { - /// message instance - final V2TimMessage message; - - /// tap remote user avatar callback function - final void Function(String userID, TapDownDetails tapDetails)? - onTapForOthersPortrait; - - /// the function use for reply message, when click replied message can scroll to it. - final Function? onScrollToIndex; - - /// message is too long should scroll this message to begin so that the tool tips panel can show correctly. - final Function? onScrollToIndexBegin; - - /// the callback for long press event, except myself avatar - final Function(String? userId, String? nickName)? - onLongPressForOthersHeadPortrait; - - /// message item builder, works for customize all message types and row layout. - final MessageItemBuilder? messageItemBuilder; - - /// Control avatar hide or show - final bool showAvatar; - - /// message sending status - final bool showMessageSending; - - /// message is read status - final bool showMessageReadRecipt; - - /// message read status in group - final bool showGroupMessageReadRecipt; - - /// allow message can long press - final bool allowLongPress; - - /// allow avatar can tap - final bool allowAvatarTap; - - /// Auto mention user when send reply message - final bool allowAtUserWhenReply; - - @Deprecated( - "Nickname will not show in one-to-one chat, if you tend to control it in group chat, please use `isShowSelfNameInGroup` and `isShowOthersNameInGroup` from `config: TIMUIKitChatConfig` instead") - - /// allow show user nick name - final bool showNickName; - - /// on message long press callback - final Function(BuildContext context, V2TimMessage message)? onLongPress; - - /// tool tips panel configuration, long press message will show tool tips panel - final ToolTipsConfig? toolTipsConfig; - - /// padding for each message item - final EdgeInsetsGeometry? padding; - - /// The controller for text field. - final TIMUIKitInputTextFieldController? textFieldController; - - /// padding for text message、sound message、reply message - final EdgeInsetsGeometry? textPadding; - - /// avatar builder - final Widget Function(BuildContext context, V2TimMessage message)? - userAvatarBuilder; - - /// theme info for message and avatar - final MessageThemeData? themeData; - - /// builder for nick name row - final Widget Function(BuildContext context, V2TimMessage message)? - topRowBuilder; - - /// builder for bottom raw which under message content - final Widget Function(BuildContext context, V2TimMessage message)? - bottomRowBuilder; - - // open MessageReaction - final bool? isUseMessageReaction; - - /// Whether to use the default emoji - final bool isUseDefaultEmoji; - - final List customEmojiStickerList; - - const TIMHistoryMessageListItem( - {Key? key, - required this.message, - @Deprecated("Nickname will not show in one-to-one chat, if you tend to control it in group chat, please use `isShowSelfNameInGroup` and `isShowOthersNameInGroup` from `config: TIMUIKitChatConfig` instead") - this.showNickName = false, - this.onScrollToIndex, - this.onScrollToIndexBegin, - this.onTapForOthersPortrait, - this.messageItemBuilder, - this.onLongPressForOthersHeadPortrait, - this.showAvatar = true, - this.showMessageSending = true, - this.showMessageReadRecipt = true, - this.allowLongPress = true, - this.toolTipsConfig, - this.onLongPress, - this.showGroupMessageReadRecipt = false, - this.allowAtUserWhenReply = true, - this.allowAvatarTap = true, - this.userAvatarBuilder, - this.themeData, - this.padding, - this.textPadding, - this.topRowBuilder, - this.isUseMessageReaction, - this.bottomRowBuilder, - this.isUseDefaultEmoji = false, - this.customEmojiStickerList = const [], - this.textFieldController}) - : super(key: key); - - @override - State createState() => _TIMUIKItHistoryMessageListItemState(); -} - -class TipsActionItem extends TIMUIKitStatelessWidget { - final String label; - final String icon; - final String? package; - - TipsActionItem( - {Key? key, required this.label, required this.icon, this.package}) - : super(key: key); - - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - return Column( - children: [ - Image.asset( - icon, - package: package, - width: 20, - height: 20, - ), - const SizedBox( - height: 4, - ), - Text( - label, - style: const TextStyle( - decoration: TextDecoration.none, - color: Color(0xFF444444), - fontSize: 10, - ), - ) - ], - ); - } -} - -class _TIMUIKItHistoryMessageListItemState - extends TIMUIKitState - with TickerProviderStateMixin { - SuperTooltip? tooltip; - - // ignore: unused_field - final MessageService _messageService = serviceLocator(); - final TUISelfInfoViewModel selfInfoModel = - serviceLocator(); - final TUIThemeViewModel themeModel = serviceLocator(); - - // bool isChecked = false; - final GlobalKey _key = GlobalKey(); - bool isShowWideToolTip = false; - TapDownDetails? _tapDetails; - - closeTooltip() { - tooltip?.close(); - } - - bool isReplyMessage(V2TimMessage message) { - final hasCustomData = - message.cloudCustomData != null && message.cloudCustomData != ""; - if (hasCustomData) { - try { - final CloudCustomData messageCloudCustomData = CloudCustomData.fromJson( - json.decode( - TencentUtils.checkString(message.cloudCustomData) != null - ? message.cloudCustomData! - : "{}")); - if (messageCloudCustomData.messageReply != null) { - MessageRepliedData.fromJson(messageCloudCustomData.messageReply!); - return true; - } - return false; - } catch (error) { - return false; - } - } - return false; - } - - Widget _messageItemBuilder( - V2TimMessage messageItem, TUIChatSeparateViewModel model) { - final msgType = messageItem.elemType; - final isShowJump = (model.jumpMsgID == messageItem.msgID) && - (messageItem.msgID?.isNotEmpty ?? false); - final MessageItemBuilder? messageItemBuilder = widget.messageItemBuilder; - final isFromSelf = messageItem.isSelf ?? true; - void clearJump() { - Future.delayed(const Duration(milliseconds: 100), () { - model.jumpMsgID = ""; - }); - } - - switch (msgType) { - case MessageElemType.V2TIM_ELEM_TYPE_CUSTOM: - if (messageItemBuilder?.customMessageItemBuilder != null) { - return messageItemBuilder!.customMessageItemBuilder!( - messageItem, - isShowJump, - () => model.jumpMsgID = "", - )!; - } - // sendVip - - - if (messageItem.customElem?.data?.contains('giftImageUrl') ?? false) { - return GiftElem( - chatModel: model, - message: messageItem, - isFromSelf: messageItem.isSelf ?? true, - clearJump: clearJump, - isShowJump: isShowJump, - borderRadius: widget.themeData?.messageBorderRadius, - fontStyle: widget.themeData?.messageTextStyle, - backgroundColor: widget.themeData?.messageBackgroundColor, - textPadding: widget.textPadding, - isShowMessageReaction: widget.isUseMessageReaction, - isUseDefaultEmoji: widget.isUseDefaultEmoji, - customEmojiStickerList: widget.customEmojiStickerList, - ); - } - - if (messageItem.customElem?.extension?.contains('getGiftData') ?? false) { - return ChatMsgGetGiftItem(messageItem); - } - - if (messageItem.customElem?.extension?.contains('getInventWishData') ?? false) { - return ChatMsgInventWishItem(messageItem); - } - - if (messageItem.customElem?.extension?.contains('getWishData') ?? false) { - return ChatMsgWishInfoItem(messageItem); - } - - if (messageItem.customElem?.extension?.contains('sendVip') ?? false) { - return ChatMsgPartnerItem(messageItem); - } - - if (messageItem.customElem?.extension?.contains('cardData') ?? false) { - Map info = jsonDecode(messageItem.customElem?.data ?? ''); - - String title = ''; - - if (info.containsKey('title')) { - Map recommendCircleFriendData= info['title']; - - - - if (recommendCircleFriendData['is_follow_me'] && isFromSelf) { - title = '对方喜欢了你'; - } else if (recommendCircleFriendData['is_follow_to'] && !isFromSelf) { - title = '对方喜欢了你'; - } else if (recommendCircleFriendData['is_follow_to']) { - title = '你喜欢了TA'; - } else if (recommendCircleFriendData['has_both_friend']) { - title = '你们有共同喜欢的圈友'; - } else if (recommendCircleFriendData.containsKey('is_new_user') && !isFromSelf) { - title = '我刚来到这里哦'; - } else if (recommendCircleFriendData['has_friend_follow_to'] && isFromSelf) { - title = '你喜欢的圈友也喜欢TA'; - } else if (recommendCircleFriendData['is_wanna_meet'] && isFromSelf) { - title = '很多圈友都喜欢TA'; - } else if (recommendCircleFriendData['is_excellent_qz_leader'] && isFromSelf) { - title = 'TA是乐园优秀圈主哦~'; - } else if (recommendCircleFriendData['is_most_fans'] && isFromSelf) { - title = '可能是你想认识的人'; - } - } - - - - return ChatMsgCardItem(isFromSelf, info, title,model.conversationID); - } else if (messageItem.customElem?.extension?.contains('circleData') ?? false) { - Map info = jsonDecode(messageItem.customElem?.data ?? ''); - var bean = Circle.fromJson(info); - return Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - SizedBox( - width: Get.width, - child: Container( - width: Get.width, - margin: EdgeInsets.only(left: isFromSelf ? 16 : 0,right: isFromSelf ? 0 : 16), - alignment: Alignment.center, - child: circleInfoItem(bean), - - ), - ) - ], - ); - } else if (messageItem.customElem?.extension?.contains('userHomeData') ?? false) { - return ChatMsgUserHomeItem(messageItem); - } - - return TIMUIKitCustomElem( - message: messageItem, - customElem: messageItem.customElem, - isFromSelf: isFromSelf, - messageBackgroundColor: widget.themeData?.messageBackgroundColor, - messageBorderRadius: widget.themeData?.messageBorderRadius, - messageFontStyle: widget.themeData?.messageTextStyle, - textPadding: widget.textPadding, - isShowMessageReaction: widget.isUseMessageReaction, - ); - case MessageElemType.V2TIM_ELEM_TYPE_SOUND: - if (messageItemBuilder?.soundMessageItemBuilder != null) { - return messageItemBuilder!.soundMessageItemBuilder!( - messageItem, - isShowJump, - clearJump, - )!; - } - return TIMUIKitSoundElem( - chatModel: model, - message: messageItem, - soundElem: messageItem.soundElem!, - msgID: messageItem.msgID ?? "", - isFromSelf: messageItem.isSelf ?? true, - clearJump: clearJump, - isShowJump: isShowJump, - localCustomInt: messageItem.localCustomInt, - borderRadius: widget.themeData?.messageBorderRadius, - fontStyle: widget.themeData?.messageTextStyle, - backgroundColor: widget.themeData?.messageBackgroundColor, - textPadding: widget.textPadding, - isShowMessageReaction: widget.isUseMessageReaction, - ); - case MessageElemType.V2TIM_ELEM_TYPE_TEXT: - if (isReplyMessage(messageItem)) { - if (messageItemBuilder?.textReplyMessageItemBuilder != null) { - return messageItemBuilder!.textReplyMessageItemBuilder!( - messageItem, - isShowJump, - clearJump, - )!; - } - return TIMUIKitReplyElem( - message: messageItem, - clearJump: clearJump, - isShowJump: isShowJump, - scrollToIndex: widget.onScrollToIndex ?? () {}, - borderRadius: widget.themeData?.messageBorderRadius, - fontStyle: widget.themeData?.messageTextStyle, - backgroundColor: widget.themeData?.messageBackgroundColor, - textPadding: widget.textPadding, - isUseDefaultEmoji: widget.isUseDefaultEmoji, - customEmojiStickerList: widget.customEmojiStickerList, - chatModel: model, - isShowMessageReaction: widget.isUseMessageReaction, - ); - } - if (messageItemBuilder?.textMessageItemBuilder != null) { - return messageItemBuilder!.textMessageItemBuilder!( - messageItem, - isShowJump, - clearJump, - )!; - } - return TIMTextElem( - chatModel: model, - message: messageItem, - isFromSelf: messageItem.isSelf ?? true, - clearJump: clearJump, - isShowJump: isShowJump, - borderRadius: widget.themeData?.messageBorderRadius, - fontStyle: widget.themeData?.messageTextStyle, - backgroundColor: widget.themeData?.messageBackgroundColor, - textPadding: widget.textPadding, - isShowMessageReaction: widget.isUseMessageReaction, - isUseDefaultEmoji: widget.isUseDefaultEmoji, - customEmojiStickerList: widget.customEmojiStickerList, - ); - case MessageElemType.V2TIM_ELEM_TYPE_FACE: - if (messageItemBuilder?.faceMessageItemBuilder != null) { - return messageItemBuilder!.faceMessageItemBuilder!( - messageItem, - isShowJump, - clearJump, - )!; - } - return TIMUIKitFaceElem( - model: model, - path: messageItem.faceElem!.data ?? "", - clearJump: clearJump, - isShowJump: isShowJump, - message: messageItem, - isShowMessageReaction: widget.isUseMessageReaction, - ); - case MessageElemType.V2TIM_ELEM_TYPE_FILE: - if (messageItemBuilder?.fileMessageItemBuilder != null) { - return messageItemBuilder!.fileMessageItemBuilder!( - messageItem, - isShowJump, - clearJump, - )!; - } - return TIMUIKitFileElem( - chatModel: model, - message: messageItem, - messageID: messageItem.msgID, - fileElem: messageItem.fileElem, - isSelf: messageItem.isSelf ?? true, - clearJump: clearJump, - isShowJump: isShowJump, - isShowMessageReaction: widget.isUseMessageReaction, - ); - case MessageElemType.V2TIM_ELEM_TYPE_GROUP_TIPS: - if (messageItemBuilder?.groupTipsMessageItemBuilder != null) { - return messageItemBuilder!.groupTipsMessageItemBuilder!( - messageItem, - isShowJump, - clearJump, - )!; - } - return Text(TIM_t("[群系统消息]")); - case MessageElemType.V2TIM_ELEM_TYPE_IMAGE: - if (messageItemBuilder?.imageMessageItemBuilder != null) { - return messageItemBuilder!.imageMessageItemBuilder!( - messageItem, - isShowJump, - clearJump, - )!; - } - return TIMUIKitImageElem( - clearJump: clearJump, - isShowJump: isShowJump, - chatModel: model, - message: messageItem, - isShowMessageReaction: widget.isUseMessageReaction, - key: Key("${messageItem.seq}_${messageItem.timestamp}"), - ); - case MessageElemType.V2TIM_ELEM_TYPE_VIDEO: - if (messageItemBuilder?.videoMessageItemBuilder != null) { - return messageItemBuilder!.videoMessageItemBuilder!( - messageItem, - isShowJump, - clearJump, - )!; - } - return TIMUIKitVideoElem( - messageItem, - isShowJump: isShowJump, - chatModel: model, - clearJump: clearJump, - isShowMessageReaction: widget.isUseMessageReaction, - ); - case MessageElemType.V2TIM_ELEM_TYPE_LOCATION: - if (messageItemBuilder?.locationMessageItemBuilder != null) { - return messageItemBuilder!.locationMessageItemBuilder!( - messageItem, - isShowJump, - clearJump, - )!; - } - return Text(TIM_t("[位置]")); - case MessageElemType.V2TIM_ELEM_TYPE_MERGER: - if (messageItemBuilder?.mergerMessageItemBuilder != null) { - return messageItemBuilder!.mergerMessageItemBuilder!( - messageItem, - isShowJump, - clearJump, - )!; - } - return TIMUIKitMergerElem( - messageItemBuilder: messageItemBuilder, - model: model, - isShowJump: isShowJump, - clearJump: clearJump, - message: messageItem, - isShowMessageReaction: widget.isUseMessageReaction, - mergerElem: messageItem.mergerElem!, - messageID: messageItem.msgID ?? "", - isSelf: messageItem.isSelf ?? true); - default: - return Text(TIM_t("[未知消息]")); - } - } - - circleWidget(String url, String userId, {double width = 24}) { - return Stack( - alignment: Alignment.center, - children: [ - Image.asset( - getCircleImage('avatar_bg'), - width: width.sp, - ), - ClipOval( - child: CachedNetworkImage( - imageUrl: url ?? - "https://qiniuyun.leyuan666.com/quanzi/avatar/default.png", - width: (width - 1).sp, - height: (width - 1).sp, - fit: BoxFit.cover, - ), - ) - ], - ); - } - - circleInfoItem(Circle bean) { - List urlList = bean.lastJoinUsers; - List widgets = []; - int i = 0; - // print(urlList); - if (null != urlList) { - urlList.forEach((element) { - if (widgets.length > 2) { - return; - } - widgets.add(Positioned( - left: 15.sp * i, - child: circleWidget( - element.avatar! ?? - "https://qiniuyun.leyuan666.com/quanzi/avatar/default.png", - element.id.toString()), - )); - i++; - }); - } - return Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10.sp), - gradient: LinearGradient(colors: [Color(0xFF261240),Color(0xFF132C40),]) - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - ClipRRect( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(10.sp), - topRight: Radius.circular(10.sp)), - child: Container( - padding: EdgeInsets.only(left: 12.sp, right: 12.sp), - height: 72.sp, - width: Get.width - 30.sp, - decoration: BoxDecoration( - - image: DecorationImage( - fit: BoxFit.fill, - image: AssetImage(getCircleImage('top_circle_bg'))), - - ), - child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - width: 42.sp, - height: 42.sp, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8.0), - gradient: const LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [ - Color(0xFF71F3F2), - Color(0xFFF558FF), - ], - stops: [0.0365, 0.9427], - ), - ), - padding: EdgeInsets.all(1.sp), - child: ClipRRect( - borderRadius: BorderRadius.circular(8.0), - child: CachedNetworkImage( - imageUrl: bean.image, - width: 40.sp, - height: 40.sp, - fit: BoxFit.cover), - ), - ), - Expanded( - child: Container( - padding: EdgeInsets.only(left: 8.sp, top: 12.sp), - // alignment: Alignment., - height: 72.sp, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - bean.title, - style: TextStyle( - color: Colors.white, - fontSize: 18.sp, - fontWeight: FontWeight.w600), - ), - SizedBox( - height: 4.sp, - ), - Text( - '${convertToTenThousand(bean.viewTotal)}人看过', - textAlign: TextAlign.left, - style: TextStyle( - color: const Color(0xff03FEFB), - fontSize: 12.sp, - ), - ), - ], - ), - )), - - GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.Signal_circle_list, arguments: bean.id); - }, - child: Stack( - alignment: Alignment.center, - children: [ - Image.asset( - getCircleImage('add'), - width: 77.sp, - ), - Text( - '查看圈子', - style: TextStyle( - color: Colors.white, fontSize: 12.sp), - ) - ], - ), - ) - ], - ), - )), - Container( - padding: EdgeInsets.only(left: 12.sp, right: 12.sp), - // height:urlList.length==0?47.sp: 118.sp, - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.fill, - image: AssetImage(getCircleImage('circle_desc'))) - ), - child: Container( - margin: EdgeInsets.only(top: 10.sp, bottom: 10.sp), - child: Column( - children: [ - Container( - margin: EdgeInsets.only(bottom: 7.sp), - width: Get.width - 20.sp - 32, - // height: 50.sp, - child: HideText( - text: bean.intro, - maxWidth: Get.width - 84.sp, - additionText: '查看更多', - maxLines: 3, - style: TextStyle(color: Colors.white, fontSize: 14.sp), - additionStyle: TextStyle( - color: const Color(0xFFFF4DF6), fontSize: 14.sp), - onTap: () { - - }, - )), - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - // showToast("点个鸡毛,星哥还没做"); - // Get.toNamed(AppRoutes.FriendsActivity,arguments: '3'); - }, - child: urlList.length == 0 - ? Container() - : Row( - children: [ - SizedBox( - height: 30.sp, - width: - 30.0.sp + 14.sp * (widgets.length - 1.sp), - child: Stack( - alignment: Alignment.center, - children: widgets, - ), - ), - SizedBox( - width: 4.sp, - ), - Text( - '${convertToTenThousand(bean.joinTotal)}圈友加入', - style: TextStyle( - color: Colors.white, fontSize: 12.sp), - ), - SizedBox( - width: 4.sp, - ), - // GestureDetector( - // onTap: () { - // Get.bottomSheet( - // CircleShare('code','link,',bean), isScrollControlled: true, - // enableDrag: false - // ); - // }, - // behavior: HitTestBehavior.opaque, - // child: Container( - // height: 30.sp, - // alignment: Alignment.center, - // child: Image.asset( - // getCircleImage('play'), - // width: 20.sp, - // ), - // ), - // ) - ], - ), - ), - ], - ), - ), - ), - ], - ), - ); - } - - interestWdiget(List data) { - if (!data.isNotEmpty) return Container(height: 0,); - return Container( - alignment: Alignment.centerLeft, - height: 49.sp, - width: Get.width, - child: ListView.builder( - scrollDirection: Axis.horizontal, - itemCount: data.length, - padding: EdgeInsets.symmetric(vertical: 11.sp), - itemBuilder: (context, index) { - return GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.Signal_circle_list, - arguments: data[index]['id']); - }, - child: Container( - margin: EdgeInsets.only(right: 11.sp), // 替换为实际的 item 间距 - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17.0), // 设置圆角半径 - gradient: LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - ), - color: Color(0xFF392D53), - ), - child: Container( - margin: EdgeInsets.all(0.5.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17.0), - // shape: BoxShape.circle, - color: Color(0xFF392D53), - ), - child: Padding( - padding: EdgeInsets.only( - top: 2.sp, bottom: 2.sp, left: 15.sp, right: 15.sp), - child: Center( - child: Text( - data[index]['title'], - style: TextStyle( - fontSize: 11.0, - color: Colors.white, - ), - ), - ), - ), - ), - ), // 替换为实际的列表项小部件 - ), - ); - }, - ), - ); - } - - Widget _groupTipsMessageBuilder(TUIChatSeparateViewModel model) { - final messageItem = widget.message; - return Container( - padding: const EdgeInsets.only(bottom: 20), - child: TIMUIKitGroupTipsElem( - groupTipsElem: messageItem.groupTipsElem!, - groupMemberList: model.groupMemberList ?? [])); - } - - Widget _selfRevokeEditMessageBuilder(theme, model) { - return Container( - margin: const EdgeInsets.symmetric(vertical: 20), - alignment: Alignment.center, - child: Text.rich(TextSpan(children: [ - TextSpan( - text: TIM_t("您撤回了一条消息,"), - style: TextStyle(color: theme.weakTextColor), - ), - TextSpan( - text: TIM_t("重新编辑"), - recognizer: TapGestureRecognizer() - ..onTap = () { - model.editRevokedMsg = widget.message.textElem?.text ?? ""; - }, - style: TextStyle(color: theme.primaryColor), - ) - ], style: const TextStyle(fontSize: 12)))); - } - - Widget _revokedMessageBuilder(theme, String option2) { - return Container( - margin: const EdgeInsets.symmetric(vertical: 20), - alignment: Alignment.center, - child: Text( - TIM_t_para("{{option2}}撤回了一条消息", "$option2撤回了一条消息")(option2: option2), - style: TextStyle(color: theme.weakTextColor, fontSize: 12), - )); - } - - Widget _timeDividerBuilder( - theme, int timeStamp, TUIChatSeparateViewModel model) { - return Container( - alignment: Alignment.center, - margin: const EdgeInsets.symmetric(vertical: 20), - child: Text( - model.chatConfig.timeDividerConfig?.timestampParser != null - ? (model.chatConfig.timeDividerConfig?.timestampParser!(timeStamp))! - : TimeAgo().getTimeForMessage(timeStamp), - style: widget.themeData?.timelineTextStyle ?? - TextStyle( - fontSize: 12, - color: theme.chatTimeDividerTextColor, - ), - ), - ); - } - - Widget _latestDividerBuilder(TUITheme theme) { - return Container( - alignment: Alignment.center, - margin: const EdgeInsets.symmetric(vertical: 20), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - margin: const EdgeInsets.only(right: 20), - child: SizedBox( - height: 1, - width: 100, - child: Container( - decoration: BoxDecoration( - gradient: LinearGradient(colors: [ - const Color(0x00C0E1FF), - theme.primaryColor ?? CommonColor.lightPrimaryColor - ]), - )), - ), - ), - Text( - TIM_t("以下为未读消息"), - style: widget.themeData?.timelineTextStyle ?? - TextStyle( - fontSize: 12, - fontWeight: FontWeight.w500, - color: theme.primaryColor, - ), - ), - Container( - margin: const EdgeInsets.only(left: 20), - child: SizedBox( - height: 1, - width: 100, - child: Container( - decoration: BoxDecoration( - gradient: LinearGradient(colors: [ - theme.primaryColor ?? CommonColor.primaryColor, - const Color(0x00C0E1FF), - ]), - )), - ), - ), - ], - ), - ); - } - - bool isRevocable(int timestamp) => - (DateTime.now().millisecondsSinceEpoch / 1000).ceil() - timestamp < 120; - - _onOpenToolTip( - c, - V2TimMessage message, - TUIChatSeparateViewModel model, - TUITheme theme, - TapDownDetails? details, - bool? isFromWideTooltip, - bool? isShowMoreSticker, - ) { - if (tooltip != null && tooltip!.isOpen) { - tooltip!.close(); - return; - } - tooltip = null; - - final screenHeight = MediaQuery.of(context).size.height; - final screenWidth = MediaQuery.of(context).size.width; - final isLongMessage = - context.size!.height + 350 > screenHeight && PlatformUtils().isMobile; - final isDesktopScreen = - TUIKitScreenUtils.getFormFactor(context) == DeviceType.Desktop; - final tapDetails = - (isDesktopScreen || isLongMessage) ? (details ?? _tapDetails) : details; - final isSelf = message.isSelf ?? true; - - final targetWidth = - min(MediaQuery.of(context).size.width * 0.84, 350).toDouble(); - final double dx = !isSelf - ? min(tapDetails?.globalPosition.dx ?? targetWidth, - screenWidth - targetWidth) - : max(tapDetails?.globalPosition.dx ?? targetWidth, targetWidth) - .toDouble(); - final double dy = min( - tapDetails?.globalPosition.dy ?? MediaQuery.of(context).size.height, - MediaQuery.of(context).size.height - 320) - .toDouble(); - final finalTapDetail = tapDetails != null - ? TapDownDetails( - globalPosition: Offset(dx, dy), - ) - : null; - - initTools( - context: c, - model: model, - isShowMoreSticker: isShowMoreSticker, - details: finalTapDetail, - theme: theme, - isFromWideToolTip: isFromWideTooltip); - tooltip!.show(c, targetCenter: finalTapDetail?.globalPosition); - } - - _clickOnCurrentSticker(int sticker) async { - for (int i = 0; i < 5; i++) { - final res = await _modifySticker(sticker); - if (res.code == 0) { - break; - } - } - } - - Future> _modifySticker( - int sticker) async { - return await Future.delayed(const Duration(milliseconds: 50), () async { - return await MessageReactionUtils.clickOnSticker(widget.message, sticker); - }); - } - - initTools( - {BuildContext? context, - bool isLongMessage = false, - required TUIChatSeparateViewModel model, - TUITheme? theme, - bool? isShowMoreSticker, - TapDownDetails? details, - bool? isFromWideToolTip}) { - final isUseMessageReaction = widget.message.elemType == 2 - ? false - : model.chatConfig.isUseMessageReaction; - final isDesktopScreen = - TUIKitScreenUtils.getFormFactor(context) == DeviceType.Desktop; - final isSelf = widget.message.isSelf ?? true; - double arrowTipDistance = 30; - double arrowBaseWidth = 10; - double arrowLength = 10; - bool hasArrow = true; - TooltipDirection popupDirection = TooltipDirection.up; - double? left; - double? right; - SelectEmojiPanelPosition selectEmojiPanelPosition = - SelectEmojiPanelPosition.down; - if (context != null) { - RenderBox? box = _key.currentContext?.findRenderObject() as RenderBox?; - if (details != null && box != null) { - double screenWidth = MediaQuery.of(context).size.width; - final mousePosition = details.globalPosition; - hasArrow = isDesktopScreen ? false : true; - arrowTipDistance = 0; - arrowBaseWidth = 0; - arrowLength = 0; - popupDirection = TooltipDirection.down; - if (isSelf || (isFromWideToolTip ?? false)) { - right = screenWidth - mousePosition.dx; - } else { - left = mousePosition.dx; - } - } else { - if (box != null) { - double screenWidth = MediaQuery.of(context).size.width; - double viewInsetsBottom = MediaQuery.of(context).viewInsets.bottom; - Offset offset = box.localToGlobal(Offset.zero); - double boxWidth = box.size.width; - if (isSelf) { - right = screenWidth - - offset.dx - - ((isUseMessageReaction) ? boxWidth : (boxWidth / 1.3)); - } else { - left = offset.dx; - } - if (offset.dy < 300 && !isLongMessage && viewInsetsBottom == 0) { - selectEmojiPanelPosition = SelectEmojiPanelPosition.up; - popupDirection = TooltipDirection.down; - } else if (viewInsetsBottom != 0 && offset.dy < 220) { - selectEmojiPanelPosition = SelectEmojiPanelPosition.up; - popupDirection = TooltipDirection.down; - } - } - arrowTipDistance = (context.size!.height / 2).roundToDouble() + - (isLongMessage ? -120 : 10); - } - } - - tooltip = SuperTooltip( - popupDirection: popupDirection, - minimumOutSidePadding: 0, - arrowTipDistance: arrowTipDistance, - arrowBaseWidth: arrowBaseWidth, - arrowLength: arrowLength, - right: right, - left: left, - hasArrow: hasArrow, - borderColor: theme?.white ?? Colors.white, - backgroundColor: theme?.white ?? Colors.white, - shadowColor: Colors.black26, - hasShadow: isDesktopScreen ? false : true, - borderWidth: 1.0, - showCloseButton: ShowCloseButton.none, - touchThroughAreaShape: ClipAreaShape.rectangle, - content: TIMUIKitMessageTooltip( - model: model, - isShowMoreSticker: isShowMoreSticker ?? false, - toolTipsConfig: widget.toolTipsConfig, - isUseMessageReaction: isUseMessageReaction, - message: widget.message, - allowAtUserWhenReply: widget.allowAtUserWhenReply, - onLongPressForOthersHeadPortrait: - widget.onLongPressForOthersHeadPortrait, - selectEmojiPanelPosition: selectEmojiPanelPosition, - onCloseTooltip: () => tooltip?.close(), - onSelectSticker: (int value) { - tooltip?.close(); - _clickOnCurrentSticker(value); - }, - ), - ); - } - - Widget _getMessageItemBuilder(V2TimMessage message, int? messageStatues, - TUIChatSeparateViewModel model) { - final messageBuilder = _messageItemBuilder; - - return messageBuilder(widget.message, model); - } - - // 弹出对话框 - Future showResendMsgFailDialog(BuildContext context) { - return showDialog( - context: context, - builder: (context) { - return CupertinoAlertDialog( - title: Text(TIM_t("您确定要重发这条消息么?")), - actions: [ - CupertinoDialogAction( - child: Text(TIM_t("确定")), - onPressed: () { - Navigator.of(context).pop(true); - }, - ), - CupertinoDialogAction( - child: Text(TIM_t("取消")), - isDestructiveAction: true, - onPressed: () { - Navigator.of(context).pop(); - }, - ), - ], - ); - }, - ); - } - - @override - void dispose() { - super.dispose(); - if (tooltip?.isOpen ?? false) { - tooltip?.close(); - } - } - - bool isVoteMessage(V2TimMessage message) { - bool isvote = false; - V2TimCustomElem? custom = message.customElem; - - if (custom != null) { - String? data = custom.data; - if (data != null && data.isNotEmpty) { - try { - Map mapData = json.decode(data); - if (mapData["businessID"] == "group_poll") { - isvote = true; - } - } catch (err) { - // err - } - } - } - return isvote; - } - - List getMessageHoverControlBar( - TUIChatSeparateViewModel model, TUITheme theme) { - return [ - if (widget.isUseMessageReaction ?? false) - MessageHoverControlItem( - name: TIM_t("表情回应"), - icon: Icon( - Icons.emoji_emotions, - size: 13, - color: hexToColor("8f959e"), - ), - onClick: (details) { - _onOpenToolTip( - context, widget.message, model, theme, details, true, true); - }, - ), - if (widget.toolTipsConfig?.showReplyMessage ?? true) - MessageHoverControlItem( - name: TIM_t("回复"), - icon: Icon( - Icons.message, - size: 13, - color: hexToColor("8f959e"), - ), - onClick: (_) { - model.repliedMessage = widget.message; - if (widget.allowAtUserWhenReply && - widget.onLongPressForOthersHeadPortrait != null && - !(widget.message.isSelf ?? true)) { - widget.onLongPressForOthersHeadPortrait!( - widget.message.sender, widget.message.nickName); - } - }, - ), - if ((widget.toolTipsConfig?.showForwardMessage ?? true) && - !isVoteMessage(widget.message)) - MessageHoverControlItem( - name: TIM_t("转发"), - icon: Icon( - Icons.send, - size: 13, - color: hexToColor("8f959e"), - ), - onClick: (_) { - model.addToMultiSelectedMessageList(widget.message); - TUIKitWidePopup.showPopupWindow( - operationKey: TUIKitWideModalOperationKey.forward, - context: context, - title: TIM_t("转发"), - submitWidget: Text(TIM_t("发送")), - width: MediaQuery.of(context).size.width * 0.5, - height: MediaQuery.of(context).size.height * 0.8, - onSubmit: () { - forwardMessageScreenKey.currentState?.handleForwardMessage(); - }, - child: (onClose) => Container( - padding: const EdgeInsets.symmetric(horizontal: 10), - child: ForwardMessageScreen( - conversationType: ConvType.c2c, - key: forwardMessageScreenKey, - onClose: onClose, - model: model, - ), - ), - theme: theme); - }, - ), - MessageHoverControlItem( - name: TIM_t("更多"), - icon: Icon( - Icons.more_horiz, - size: 13, - color: hexToColor("8f959e"), - ), - onClick: (details) { - _onOpenToolTip( - context, widget.message, model, theme, details, true, false); - }, - ), - ]; - } - - _onMsgSendFailIconTap(V2TimMessage message, TUIChatSeparateViewModel model) { - final convID = model.conversationID; - final convType = model.conversationType; - MessageUtils.handleMessageError( - model.reSendFailMessage( - message: message, - convType: convType ?? ConvType.c2c, - convID: convID), - context); - } - - Widget renderHoverTipAndReadStatus(TUIChatSeparateViewModel model, - bool isSelf, V2TimMessage message, bool isPeerRead, TUITheme theme) { - final isDesktopScreen = - TUIKitScreenUtils.getFormFactor(context) == DeviceType.Desktop; - final wideHoverTipList = getMessageHoverControlBar(model, theme); - final lastItemName = wideHoverTipList.last.name; - return Column( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - if (isDesktopScreen && isShowWideToolTip) - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(4), - border: Border.all(color: hexToColor("d9dde0"), width: 1)), - margin: const EdgeInsets.symmetric(horizontal: 4), - child: Row( - children: wideHoverTipList - .map((e) => Tooltip( - message: e.name, - preferBelow: false, - textStyle: TextStyle(fontSize: 12, color: theme.white), - child: Row( - children: [ - InkWell( - onTapDown: e.onClick, - child: SizedBox( - width: 22, - height: 22, - child: e.icon, - ), - ), - if (lastItemName != e.name) - SizedBox( - width: 1, - height: 22, - child: Container( - color: theme.weakDividerColor, - ), - ) - ], - ), - )) - .toList(), - ), - ), - if (!isDesktopScreen || !isShowWideToolTip) - const SizedBox( - height: 24, - ), - if (isSelf && - message.status == MessageStatus.V2TIM_MSG_STATUS_SEND_FAIL) - Container( - padding: const EdgeInsets.only(bottom: 3), - margin: const EdgeInsets.only(right: 6), - child: GestureDetector( - onTap: () async { - final reSend = await showResendMsgFailDialog(context); - if (reSend != null) { - _onMsgSendFailIconTap(message, model); - } - }, - child: Icon(Icons.error, color: theme.cautionColor, size: 18), - )), - if (model.chatConfig.isShowReadingStatus && - widget.showMessageReadRecipt && - model.conversationType == ConvType.c2c && - isSelf && - (message.status == MessageStatus.V2TIM_MSG_STATUS_SEND_SUCC || - message.status == MessageStatus.V2TIM_MSG_STATUS_SENDING)) - // Container( - // padding: const EdgeInsets.only(bottom: 3), - // margin: const EdgeInsets.only(right: 6), - // child: Text( - // isPeerRead ? TIM_t("已读") : TIM_t("未读"), - // style: TextStyle( - // color: theme.chatMessageItemUnreadStatusTextColor, - // fontSize: 12), - // ), - // ), - if (model.chatConfig.isShowGroupReadingStatus && - model.chatConfig.isShowGroupMessageReadReceipt && - model.conversationType == ConvType.group && - isSelf && - (message.status == MessageStatus.V2TIM_MSG_STATUS_SEND_SUCC || - message.status == MessageStatus.V2TIM_MSG_STATUS_SENDING)) - TIMUIKitMessageReadReceipt( - messageItem: widget.message, - onTapAvatar: widget.onTapForOthersPortrait, - ), - ], - ); - } - - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - final TUIChatSeparateViewModel model = - Provider.of(context); - final isDownloadWaiting = context.select( - (value) => value.isWaiting(widget.message.msgID ?? "")); - final TUITheme theme = value.theme; - final message = widget.message; - final msgType = message.elemType; - final isSelf = message.isSelf ?? true; - final msgStatus = message.status; - final isGroupTipsMsg = - msgType == MessageElemType.V2TIM_ELEM_TYPE_GROUP_TIPS; - final isRevokedMsg = msgStatus == 6; - final isTimeDivider = msgType == 11; - final isLatestDivider = msgType == 101; - final isPeerRead = message.isPeerRead ?? false; - final isGroupMessage = model.conversationType == ConvType.group; - final bool isRevokeEditable = - widget.message.elemType == MessageElemType.V2TIM_ELEM_TYPE_TEXT; - final isShowNickNameForSelf = - isGroupMessage && model.chatConfig.isShowSelfNameInGroup; - final isShowNickNameForOthers = - isGroupMessage && model.chatConfig.isShowOthersNameInGroup; - final isDesktopScreen = - TUIKitScreenUtils.getFormFactor(context) == DeviceType.Desktop; - if (isTimeDivider) { - return _timeDividerBuilder(theme, message.timestamp ?? 0, model); - } - if (isLatestDivider) { - return _latestDividerBuilder(theme); - } - void clearJump() { - Future.delayed(const Duration(milliseconds: 100), () { - model.jumpMsgID = ""; - }); - } - - if (isGroupTipsMsg) { - if (widget.messageItemBuilder?.groupTipsMessageItemBuilder != null) { - final groupTipsMessage = - widget.messageItemBuilder!.groupTipsMessageItemBuilder!( - message, - (model.jumpMsgID == message.msgID), - clearJump, - ); - return groupTipsMessage ?? _groupTipsMessageBuilder(model); - } - return _groupTipsMessageBuilder(model); - } - - if (isRevokedMsg) { - final displayName = - isSelf ? TIM_t("您") : message.nickName ?? message.sender; - return isSelf && isRevokeEditable && isRevocable(message.timestamp!) - ? _selfRevokeEditMessageBuilder(theme, model) - : _revokedMessageBuilder(theme, displayName ?? ""); - } - - // 使用自定义行 - if (widget.messageItemBuilder?.messageRowBuilder != null) { - final customRow = widget.messageItemBuilder!.messageRowBuilder!( - message, - _getMessageItemBuilder(message, message.status, model), - widget.onScrollToIndex ?? () {}, - message.msgID == model.jumpMsgID, - clearJump, - widget.onScrollToIndexBegin ?? () {}, - ); - if (customRow != null) { - return customRow; - } - } - - return LayoutBuilder( - builder: (context, constraints) => Container( - margin: widget.padding ?? const EdgeInsets.only(bottom: 20), - child: Row( - key: _key, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if (model.isMultiSelect) - Container( - margin: - EdgeInsets.only(right: 12, top: 10, left: isSelf ? 16 : 0), - child: CheckBoxButton( - isChecked: model.multiSelectedMessageList.contains(message), - onChanged: (value) { - if (value) { - model.addToMultiSelectedMessageList(message); - } else { - model.removeFromMultiSelectedMessageList(message); - } - }, - ), - ), - Expanded( - child: MouseRegion( - onEnter: (_) { - if (isDesktopScreen) { - setState(() { - isShowWideToolTip = true; - }); - } - }, - onExit: (_) { - if (isDesktopScreen) { - setState(() { - isShowWideToolTip = false; - }); - } - }, - child: GestureDetector( - behavior: - model.isMultiSelect ? HitTestBehavior.translucent : null, - onTap: () { - if (model.isMultiSelect) { - final checked = - model.multiSelectedMessageList.contains(message); - if (checked) { - model.removeFromMultiSelectedMessageList(message); - } else { - model.addToMultiSelectedMessageList(message); - } - } - }, - child: (message.customElem?.extension?.contains('cardData') ?? - false) || (message.customElem?.extension?.contains('circleData') ?? - false) - ? _getMessageItemBuilder(message, 1, model) - : Row( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: isSelf - ? MainAxisAlignment.end - : MainAxisAlignment.start, - children: [ - if (!isSelf && widget.showAvatar) - InkWell( - onLongPress: () { - if (widget.onLongPressForOthersHeadPortrait != - null) {} - if (model - .chatConfig.isAllowLongPressAvatarToAt) { - widget.onLongPressForOthersHeadPortrait!( - message.sender, message.nickName); - } - }, - onTapDown: isDesktopScreen - ? (details) { - if (widget.onTapForOthersPortrait != - null && - widget.allowAvatarTap) { - widget.onTapForOthersPortrait!( - message.sender ?? "", details); - } - } - : null, - onTap: isDesktopScreen - ? null - : () { - if (widget.onTapForOthersPortrait != - null && - widget.allowAvatarTap) { - widget.onTapForOthersPortrait!( - message.sender ?? "", - TapDownDetails()); - } - }, - child: widget.userAvatarBuilder != null - ? widget.userAvatarBuilder!( - context, message) - : Container( - margin: - (isSelf && isShowNickNameForSelf) || - (!isSelf && - isShowNickNameForOthers) - ? const EdgeInsets.only(top: 2) - : null, - child: SizedBox( - width: 40, - height: 40, - child: Avatar( - faceUrl: message.faceUrl ?? "", - showName: - MessageUtils.getDisplayName( - message), - ), - ), - ), - ), - Container( - margin: widget.showAvatar - ? (isSelf - ? const EdgeInsets.only(right: 13) - : const EdgeInsets.only(left: 13)) - : null, - child: Column( - crossAxisAlignment: isSelf - ? CrossAxisAlignment.end - : CrossAxisAlignment.start, - children: [ - if ((isSelf && isShowNickNameForSelf) || - (!isSelf && isShowNickNameForOthers)) - widget.topRowBuilder != null - ? widget.topRowBuilder!( - context, message) - : Container( - margin: const EdgeInsets.only( - bottom: 4), - child: ConstrainedBox( - constraints: BoxConstraints( - maxWidth: - MediaQuery.of(context) - .size - .width / - 1.7), - child: Text( - MessageUtils.getDisplayName( - message), - overflow: TextOverflow.ellipsis, - style: widget.themeData - ?.nickNameTextStyle ?? - TextStyle( - fontSize: 12, - color: theme - .weakTextColor), - ), - )), - Row( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - if (isSelf && message.elemType != 2) - renderHoverTipAndReadStatus(model, - isSelf, message, isPeerRead, theme), - Container( - constraints: BoxConstraints( - maxWidth: constraints.maxWidth * 0.77, - ), - child: Builder(builder: (context) { - return Column( - crossAxisAlignment: - (message.isSelf ?? true) - ? CrossAxisAlignment.end - : CrossAxisAlignment.start, - children: [ - GestureDetector( - child: IgnorePointer( - ignoring: - model.isMultiSelect, - child: - _getMessageItemBuilder( - message, - message.status, - model)), - onSecondaryTapDown: (details) { - if (widget.onLongPress != - null) { - widget.onLongPress!( - context, message); - return; - } - if (!PlatformUtils() - .isMobile) { - if (widget.allowLongPress) { - _onOpenToolTip( - context, - message, - model, - theme, - details, - false, - false); - } - } - }, - onLongPress: () { - if (widget.onLongPress != - null) { - widget.onLongPress!( - context, message); - return; - } - if (widget.allowLongPress && - PlatformUtils() - .isMobile) { - _onOpenToolTip( - context, - message, - model, - theme, - null, - false, - false); - } - }, - onTapDown: (details) { - _tapDetails = details; - }, - ), - TIMUIKitTextTranslationElem( - message: message, - isUseDefaultEmoji: - widget.isUseDefaultEmoji, - customEmojiStickerList: widget - .customEmojiStickerList, - isFromSelf: - message.isSelf ?? true, - isShowJump: false, - clearJump: () {}, - chatModel: model) - ], - ); - }), - ), - if (!isSelf && - message.elemType == - MessageElemType - .V2TIM_ELEM_TYPE_SOUND && - message.localCustomInt != null && - message.localCustomInt != - HistoryMessageDartConstant.read) - Padding( - padding: const EdgeInsets.only( - left: 5, bottom: 12), - child: Icon(Icons.circle, - color: theme.cautionColor, - size: 10)), - if (!isSelf && message.elemType != 2) - renderHoverTipAndReadStatus(model, - isSelf, message, isPeerRead, theme), - ], - ), - if (widget.bottomRowBuilder != null) - widget.bottomRowBuilder!(context, message) - ], - ), - ), - if (widget.message.elemType == 6 && - isDownloadWaiting) - Container( - margin: const EdgeInsets.only(top: 24, left: 6), - child: LoadingAnimationWidget.threeArchedCircle( - color: theme.weakTextColor ?? Colors.grey, - size: 20, - ), - ), - if (isSelf && - widget.showAvatar) - widget.userAvatarBuilder != null - ? widget.userAvatarBuilder!(context, message) - : SizedBox( - width: 40, - height: 40, - child: InkWell( - onTapDown: (details) { - if (widget.onTapForOthersPortrait != - null && - widget.allowAvatarTap) { - widget.onTapForOthersPortrait!( - message.sender ?? "", details); - } - }, - child: Avatar( - faceUrl: message.faceUrl ?? "", - showName: - MessageUtils.getDisplayName( - message)), - ), - ), - ], - ), - ), - ), - ), - ], - ), - ), - ); - } - -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKItMessageList/tim_uikit_chat_message_tooltip.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKItMessageList/tim_uikit_chat_message_tooltip.dart deleted file mode 100644 index e8997c7..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKItMessageList/tim_uikit_chat_message_tooltip.dart +++ /dev/null @@ -1,600 +0,0 @@ -// ignore_for_file: non_constant_identifier_names, avoid_print - -import 'dart:convert'; -import 'dart:io'; -import 'dart:math'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:provider/provider.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/services_locatar.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/common_utils.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/message.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitMessageItem/TIMUIKitMessageReaction/tim_uikit_message_reaction_select_emoji.dart'; -import 'package:tencent_im_base/tencent_im_base.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_state.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/separate_models/tui_chat_separate_view_model.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_chat_global_model.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/platform.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/screen_utils.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKItMessageList/tim_uikit_chat_history_message_list_item.dart'; -import 'package:tencent_cloud_chat_uikit/ui/widgets/forward_message_screen.dart'; -import 'package:tencent_open_file/tencent_open_file.dart'; -import 'package:url_launcher/url_launcher.dart'; -import 'package:path/path.dart' as path; - -class TIMUIKitMessageTooltip extends StatefulWidget { - /// tool tips panel configuration, long press message will show tool tips panel - final ToolTipsConfig? toolTipsConfig; - - /// current message - final V2TimMessage message; - - /// allow notifi user when send reply message - final bool allowAtUserWhenReply; - - /// the callback for long press event, except myself avatar - final Function(String? userId, String? nickName)? - onLongPressForOthersHeadPortrait; - - final bool isUseMessageReaction; - - /// direction - final SelectEmojiPanelPosition selectEmojiPanelPosition; - - /// on add sticker reaction to a message - final ValueChanged onSelectSticker; - - /// on close tooltip area - final VoidCallback onCloseTooltip; - - final TUIChatSeparateViewModel model; - - final bool isShowMoreSticker; - - const TIMUIKitMessageTooltip( - {Key? key, - this.toolTipsConfig, - this.isUseMessageReaction = true, - required this.model, - required this.message, - required this.allowAtUserWhenReply, - this.onLongPressForOthersHeadPortrait, - required this.selectEmojiPanelPosition, - required this.onCloseTooltip, - required this.onSelectSticker, - this.isShowMoreSticker = false}) - : super(key: key); - - @override - State createState() => TIMUIKitMessageTooltipState(); -} - -class TIMUIKitMessageTooltipState - extends TIMUIKitState { - final TUIChatGlobalModel globalModal = serviceLocator(); - bool isShowMoreSticker = false; - bool isShowOpenFile = false; - String filePath = ""; - - @override - void initState() { - super.initState(); - hasFile(); - isShowMoreSticker = widget.isShowMoreSticker; - } - - hasFile() { - if (PlatformUtils().isMobile || widget.message.fileElem == null) { - isShowOpenFile = false; - return; - } - if (PlatformUtils().isWeb) { - isShowOpenFile = true; - return; - } - if (PlatformUtils().isDesktop) { - if (globalModal.getMessageProgress(widget.message.msgID) == 100) { - String savePath = - TencentUtils.checkString(widget.message.fileElem!.localUrl) ?? - globalModal.getFileMessageLocation(widget.message.msgID); - File f = File(savePath); - if (f.existsSync() && widget.message.msgID != null) { - filePath = savePath; - isShowOpenFile = true; - return; - } - isShowOpenFile = false; - return; - } - String savePath = widget.message.fileElem!.localUrl ?? ''; - File f = File(savePath); - if (f.existsSync() && widget.message.msgID != null) { - filePath = savePath; - globalModal.setMessageProgress(widget.message.msgID!, 100); - isShowOpenFile = true; - return; - } - } - isShowOpenFile = false; - } - - bool isRevocable(int timestamp, int upperTimeLimit) => - (DateTime.now().millisecondsSinceEpoch / 1000).ceil() - timestamp < - upperTimeLimit; - - Widget ItemInkWell({ - Widget? child, - GestureTapCallback? onTap, - }) { - return SizedBox( - width: 44, - child: InkWell( - onTap: onTap, - splashColor: Colors.white, - child: Container( - padding: const EdgeInsets.only(bottom: 6, top: 6), - child: child, - ), - ), - ); - } - - bool isVoteMessage(V2TimMessage message) { - bool isvote = false; - V2TimCustomElem? custom = message.customElem; - - if (custom != null) { - String? data = custom.data; - if (data != null && data.isNotEmpty) { - try { - Map mapData = json.decode(data); - if (mapData["businessID"] == "group_poll") { - isvote = true; - } - } catch (err) { - // err - } - } - } - return isvote; - } - - _buildLongPressTipItem( - TUITheme theme, TUIChatSeparateViewModel model, V2TimMessage message) { - final isDesktopScreen = - TUIKitScreenUtils.getFormFactor(context) == DeviceType.Desktop; - final isCanRevoke = isRevocable( - widget.message.timestamp!, model.chatConfig.upperRecallTime); - final shouldShowRevokeAction = isCanRevoke && - (widget.message.isSelf ?? true) && - widget.message.status != MessageStatus.V2TIM_MSG_STATUS_SEND_FAIL; - final shouldShowReplyAction = !(widget.message.customElem?.data != null && - MessageUtils.isCallingData(widget.message.customElem!.data!)); - final shouldShowForwardAction = !(widget.message.customElem?.data != null && - MessageUtils.isCallingData(widget.message.customElem!.data!)); - final tooltipsConfig = widget.toolTipsConfig; - final List defaultTipsList = [ - if (isShowOpenFile) - MessageToolTipItem( - label: TIM_t("打开"), - id: "open", - iconImageAsset: "images/open_in_new.png", - onClick: () => _onTap("open", model)), - if (isShowOpenFile && PlatformUtils().isDesktop) - MessageToolTipItem( - label: PlatformUtils().isMacOS ? TIM_t("在访达中打开") : TIM_t("查看文件夹"), - id: "finder", - iconImageAsset: "images/folder_open.png", - onClick: () => _onTap("finder", model)), - MessageToolTipItem( - label: TIM_t("复制"), - id: "copyMessage", - iconImageAsset: "images/copy_message.png", - onClick: () => _onTap("copyMessage", model)), - // if (shouldShowForwardAction && !isVoteMessage(widget.message)) - // MessageToolTipItem( - // label: TIM_t("转发"), - // id: "forwardMessage", - // iconImageAsset: "images/forward_message.png", - // onClick: () => _onTap("forwardMessage", model)), - // MessageToolTipItem( - // label: TIM_t("多选"), - // id: "multiSelect", - // iconImageAsset: "images/multi_message.png", - // onClick: () => _onTap("multiSelect", model)), - if (shouldShowReplyAction) - MessageToolTipItem( - label: TIM_t(model.chatConfig.isAtWhenReply ? "回复" : "引用"), - id: "replyMessage", - iconImageAsset: "images/reply_message.png", - onClick: () => _onTap("replyMessage", model)), - MessageToolTipItem( - label: TIM_t("删除"), - id: "delete", - iconImageAsset: "images/delete_message.png", - onClick: () => _onTap("delete", model)), - // MessageToolTipItem( - // label: TIM_t("翻译"), - // id: "translate", - // iconImageAsset: "images/translate.png", - // onClick: () => _onTap("translate", model)), - if (shouldShowRevokeAction) - MessageToolTipItem( - label: TIM_t("撤回"), - id: "revoke", - iconImageAsset: "images/revoke_message.png", - onClick: () => _onTap("revoke", model)), - ]; - List defaultFormattedTipsList = defaultTipsList; - if (tooltipsConfig != null) { - defaultFormattedTipsList = defaultTipsList.where((element) { - final type = element.id; - if (type == "copyMessage") { - return tooltipsConfig.showCopyMessage && - widget.message.elemType == MessageElemType.V2TIM_ELEM_TYPE_TEXT; - } - // if (type == "forwardMessage") { - // return tooltipsConfig.showForwardMessage && !isDesktopScreen; - // } - if (type == "replyMessage") { - return tooltipsConfig.showReplyMessage && !isDesktopScreen; - } - if (type == "delete") { - return (!PlatformUtils().isWeb) && tooltipsConfig.showDeleteMessage; - } - // if (type == "multiSelect") { - // return tooltipsConfig.showMultipleChoiceMessage; - // } - - if (type == "revoke") { - return tooltipsConfig.showRecallMessage; - } - // if (type == "translate") { - // return tooltipsConfig.showTranslation && - // widget.message.elemType == MessageElemType.V2TIM_ELEM_TYPE_TEXT; - // } - return true; - }).toList(); - } - - final List? customList = - widget.toolTipsConfig?.additionalMessageToolTips != null - ? (widget.toolTipsConfig?.additionalMessageToolTips!( - message, widget.onCloseTooltip)) - : []; - - List formattedTipsList = [ - ...defaultFormattedTipsList, - ...?customList, - ]; - - List widgetList = []; - if (isDesktopScreen) { - widgetList = formattedTipsList - .map( - (item) => Material( - color: Colors.white, - child: InkWell( - onTap: () { - item.onClick(); - }, - child: Container( - padding: const EdgeInsets.all(6), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Image.asset( - item.iconImageAsset, - package: 'tencent_cloud_chat_uikit', - width: 20, - height: 20, - ), - const SizedBox( - height: 4, - width: 8, - ), - Text( - item.label, - style: TextStyle( - decoration: TextDecoration.none, - color: theme.darkTextColor, - fontSize: 12, - ), - ) - ], - ), - ), - ), - ), - ) - .toList(); - } else { - widgetList = formattedTipsList - .map( - (item) => Material( - color: Colors.white, - child: ItemInkWell( - onTap: () { - item.onClick(); - }, - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Image.asset( - item.iconImageAsset, - package: 'tencent_cloud_chat_uikit', - width: 20, - height: 20, - ), - const SizedBox( - height: 4, - width: 60, - ), - Text( - item.label, - style: TextStyle( - decoration: TextDecoration.none, - color: theme.darkTextColor, - fontSize: 10, - ), - ) - ], - ), - ), - ), - ) - .toList(); - } - if (widgetList.isEmpty && widget.isUseMessageReaction == false) { - widget.onCloseTooltip(); - } - - return widgetList; - } - - _onTap(String operation, TUIChatSeparateViewModel model) async { - final messageItem = widget.message; - final msgID = messageItem.msgID as String; - switch (operation) { - case "open": - if (PlatformUtils().isDesktop) { - final String savePath = - TencentUtils.checkString(widget.message.fileElem!.localUrl) ?? - globalModal.getFileMessageLocation(widget.message.msgID); - launchUrl(Uri.file(savePath)); - } else { - if (PlatformUtils().isWindows) { - OpenFile.open(widget.message.fileElem?.path ?? ""); - } else { - launchUrl( - Uri.parse(widget.message.fileElem?.path ?? ""), - mode: LaunchMode.externalApplication, - ); - } - } - break; - case "finder": - final String savePath = - TencentUtils.checkString(widget.message.fileElem!.localUrl) ?? - globalModal.getFileMessageLocation(widget.message.msgID); - final String fileDir = path.dirname(savePath); - if (PlatformUtils().isWindows) { - OpenFile.open(fileDir); - } else { - launchUrl(Uri.file(fileDir)); - } - break; - case "delete": - model.deleteMsg(msgID, webMessageInstance: messageItem.messageFromWeb); - break; - case "revoke": - model.revokeMsg(msgID, messageItem.messageFromWeb); - break; - case 'translate': - model.translateText(widget.message); - break; - case "multiSelect": - model.updateMultiSelectStatus(true); - model.addToMultiSelectedMessageList(widget.message); - break; - case "forwardMessage": - model.addToMultiSelectedMessageList(widget.message); - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => ForwardMessageScreen( - conversationType: ConvType.c2c, - model: model, - ))); - break; - case "copyMessage": - if (widget.message.elemType == MessageElemType.V2TIM_ELEM_TYPE_TEXT) { - try { - await Clipboard.setData( - ClipboardData(text: widget.message.textElem?.text ?? "")); - onTIMCallback(TIMCallback( - type: TIMCallbackType.INFO, - infoRecommendText: TIM_t("已复制"), - infoCode: 6660408)); - // ignore: empty_catches - } catch (e) {} - } - break; - case "replyMessage": - model.repliedMessage = widget.message; - if (widget.allowAtUserWhenReply && - widget.onLongPressForOthersHeadPortrait != null && - !(widget.message.isSelf ?? true)) { - widget.onLongPressForOthersHeadPortrait!( - widget.message.sender, widget.message.nickName); - } - break; - default: - onTIMCallback(TIMCallback( - type: TIMCallbackType.INFO, - infoRecommendText: TIM_t("暂未实现"), - infoCode: 6660409)); - } - widget.onCloseTooltip(); - } - - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - final TUITheme theme = value.theme; - final isDesktopScreen = - TUIKitScreenUtils.getFormFactor(context) == DeviceType.Desktop; - return MultiProvider( - providers: [ - ChangeNotifierProvider.value(value: widget.model), - ], - builder: (BuildContext context, Widget? w) { - final TUIChatSeparateViewModel model = - Provider.of(context); - final bool haveExtraTipsConfig = widget.toolTipsConfig != null && - widget.toolTipsConfig?.additionalItemBuilder != null; - Widget? extraTipsActionItem = haveExtraTipsConfig - ? widget.toolTipsConfig!.additionalItemBuilder!( - widget.message, widget.onCloseTooltip, null, context) - : null; - final message = widget.message; - return Container( - decoration: isDesktopScreen - ? BoxDecoration( - boxShadow: const [ - BoxShadow( - color: Color(0xCCbebebe), - offset: Offset(2, 2), - blurRadius: 10, - spreadRadius: 1, - ), - ], - border: Border.all( - width: 1, - color: hexToColor("dee0e3"), - ), - color: Colors.white, - borderRadius: const BorderRadius.all(Radius.circular(10)), - ) - : null, - color: isDesktopScreen ? null : Colors.white, - padding: EdgeInsets.symmetric( - horizontal: 8, vertical: isDesktopScreen ? 8 : 4), - child: ConstrainedBox( - constraints: BoxConstraints( - maxWidth: min(MediaQuery.of(context).size.width * 0.75, 350), - ), - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - if ((!isDesktopScreen || widget.isShowMoreSticker) && - widget.isUseMessageReaction && - widget.selectEmojiPanelPosition == - SelectEmojiPanelPosition.up) - TIMUIKitMessageReactionEmojiSelectPanel( - isShowMoreSticker: isShowMoreSticker, - onSelect: (int value) => widget.onSelectSticker(value), - onClickShowMore: (bool value) { - setState(() { - isShowMoreSticker = value; - }); - }, - ), - if (!isDesktopScreen && - widget.isUseMessageReaction && - widget.selectEmojiPanelPosition == - SelectEmojiPanelPosition.up && - isShowMoreSticker == false) - Container( - margin: const EdgeInsets.symmetric(vertical: 6), - child: const Divider( - thickness: 1, - indent: 0, - // endIndent: 10, - color: Colors.black12)), - if (isShowMoreSticker == false) - Row( - mainAxisSize: MainAxisSize.min, - children: [ - if (!isDesktopScreen && widget.isUseMessageReaction) - Expanded( - child: Wrap( - direction: Axis.horizontal, - alignment: - TUIKitScreenUtils.getFormFactor(context) == - DeviceType.Mobile - ? WrapAlignment.spaceBetween - : WrapAlignment.start, - spacing: 4, - runSpacing: 8, - children: [ - ..._buildLongPressTipItem(theme, model, message), - if (extraTipsActionItem != null) - extraTipsActionItem - ], - )), - if (!isDesktopScreen && !widget.isUseMessageReaction) - ConstrainedBox( - constraints: BoxConstraints( - maxWidth: min( - MediaQuery.of(context).size.width * 0.75, - 350), - ), - child: Wrap( - direction: Axis.horizontal, - alignment: - TUIKitScreenUtils.getFormFactor(context) == - DeviceType.Mobile - ? WrapAlignment.spaceBetween - : WrapAlignment.start, - spacing: 4, - runSpacing: 8, - children: [ - ..._buildLongPressTipItem( - theme, model, message), - if (extraTipsActionItem != null) - extraTipsActionItem - ], - ), - ), - if (isDesktopScreen) - Table(columnWidths: const { - 0: IntrinsicColumnWidth(), - }, children: [ - ..._buildLongPressTipItem(theme, model, message) - .map((e) => TableRow(children: [e])) - ]) - ], - ), - if (!isDesktopScreen && - widget.isUseMessageReaction && - widget.selectEmojiPanelPosition == - SelectEmojiPanelPosition.down && - isShowMoreSticker == false) - Container( - margin: const EdgeInsets.symmetric(vertical: 6), - child: const Divider( - thickness: 1, - indent: 0, - // endIndent: 10, - color: Colors.black12)), - if ((!isDesktopScreen || widget.isShowMoreSticker) && - widget.isUseMessageReaction && - widget.selectEmojiPanelPosition == - SelectEmojiPanelPosition.down) - TIMUIKitMessageReactionEmojiSelectPanel( - isShowMoreSticker: isShowMoreSticker, - onSelect: (int value) => widget.onSelectSticker(value), - onClickShowMore: (bool value) { - setState(() { - isShowMoreSticker = value; - }); - }, - ), - ], - ), - )); - }, - ); - } -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKItMessageList/tim_uikit_history_message_list_container.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKItMessageList/tim_uikit_history_message_list_container.dart deleted file mode 100644 index 824242a..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKItMessageList/tim_uikit_history_message_list_container.dart +++ /dev/null @@ -1,193 +0,0 @@ -// ignore_for_file: deprecated_member_use_from_same_package - -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; -import 'package:scroll_to_index/scroll_to_index.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field_controller.dart'; -import 'package:tencent_im_base/tencent_im_base.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_state.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/separate_models/tui_chat_separate_view_model.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_chat_global_model.dart'; -import 'package:tencent_cloud_chat_uikit/ui/constants/history_message_constant.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKItMessageList/TIMUIKitTongue/tim_uikit_chat_history_message_list_tongue.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKItMessageList/tim_uikit_chat_history_message_list_config.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKItMessageList/tim_uikit_chat_history_message_list_item.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKItMessageList/tim_uikit_chat_history_message_list.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/tim_uikit_chat_config.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart'; - -import 'tim_uikit_chat_history_message_list_item.dart'; - -enum LoadingPlace { - none, - top, - bottom, -} - -class TIMUIKitHistoryMessageListContainer extends StatefulWidget { - final Widget Function(BuildContext, V2TimMessage?)? itemBuilder; - final AutoScrollController? scrollController; - final String conversationID; - final Function(String? userId, String? nickName)? - onLongPressForOthersHeadPortrait; - final List? groupAtInfoList; - final V2TimMessage? initFindingMsg; - - /// message item builder, works for customize all message types and row layout. - final MessageItemBuilder? messageItemBuilder; - - /// The controller for text field. - final TIMUIKitInputTextFieldController? textFieldController; - - /// the builder for avatar - final Widget Function(BuildContext context, V2TimMessage message)? - userAvatarBuilder; - - /// the builder for tongue - final TongueItemBuilder? tongueItemBuilder; - - final Widget? Function(V2TimMessage message, Function() closeTooltip, - [Key? key, BuildContext? context])? extraTipsActionItemBuilder; - - /// conversation type - final ConvType conversationType; - - final void Function(String userID, TapDownDetails tapDetails)? onTapAvatar; - - @Deprecated( - "Nickname will not show in one-to-one chat, if you tend to control it in group chat, please use `isShowSelfNameInGroup` and `isShowOthersNameInGroup` from `config: TIMUIKitChatConfig` instead") - final bool showNickName; - - final TIMUIKitHistoryMessageListConfig? mainHistoryListConfig; - - /// tool tips panel configuration, long press message will show tool tips panel - final ToolTipsConfig? toolTipsConfig; - - /// Whether to use the default emoji - final bool isUseDefaultEmoji; - - final List customEmojiStickerList; - - final bool isAllowScroll; - - final V2TimConversation conversation; - - const TIMUIKitHistoryMessageListContainer({ - Key? key, - this.itemBuilder, - this.scrollController, - required this.conversationID, - required this.conversationType, - this.userAvatarBuilder, - this.onLongPressForOthersHeadPortrait, - this.groupAtInfoList, - this.messageItemBuilder, - this.tongueItemBuilder, - this.extraTipsActionItemBuilder, - this.isAllowScroll = true, - this.onTapAvatar, - @Deprecated("Nickname will not show in one-to-one chat, if you tend to control it in group chat, please use `isShowSelfNameInGroup` and `isShowOthersNameInGroup` from `config: TIMUIKitChatConfig` instead") - this.showNickName = true, - this.initFindingMsg, - this.mainHistoryListConfig, - this.toolTipsConfig, - this.isUseDefaultEmoji = false, - this.customEmojiStickerList = const [], - this.textFieldController, - required this.conversation, - }) : super(key: key); - - @override - State createState() => - _TIMUIKitHistoryMessageListContainerState(); -} - -class _TIMUIKitHistoryMessageListContainerState - extends TIMUIKitState { - late TIMUIKitHistoryMessageListController _historyMessageListController; - - List historyMessageList = []; - - Future requestForData(String? lastMsgID, LoadDirection direction, - TUIChatSeparateViewModel model, - [int? count]) async { - if ((direction == LoadDirection.previous && model.haveMoreData) || - (direction == LoadDirection.latest && model.haveMoreLatestData)) { - await model.loadChatRecord( - direction: direction, - count: count ?? (kIsWeb ? 15 : HistoryMessageDartConstant.getCount), - lastMsgID: lastMsgID); - } - } - - Widget Function(BuildContext, V2TimMessage)? _getTopRowBuilder( - TUIChatSeparateViewModel model) { - if (widget.messageItemBuilder?.messageNickNameBuilder != null) { - return (BuildContext context, V2TimMessage message) { - return widget.messageItemBuilder!.messageNickNameBuilder!( - context, message, model); - }; - } - return null; - } - - @override - void initState() { - super.initState(); - _historyMessageListController = TIMUIKitHistoryMessageListController( - scrollController: widget.scrollController); - } - - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - final chatConfig = Provider.of(context); - final TUIChatSeparateViewModel model = - Provider.of(context, listen: false); - - return TIMUIKitHistoryMessageListSelector( - conversationID: model.conversationID, - builder: (context, messageList, child) { - return TIMUIKitHistoryMessageList( - conversation: widget.conversation, - model: model, - isAllowScroll: widget.isAllowScroll, - controller: _historyMessageListController, - groupAtInfoList: widget.groupAtInfoList, - mainHistoryListConfig: widget.mainHistoryListConfig, - itemBuilder: (context, message) { - return TIMHistoryMessageListItem( - textFieldController: widget.textFieldController, - userAvatarBuilder: widget.userAvatarBuilder, - customEmojiStickerList: widget.customEmojiStickerList, - isUseDefaultEmoji: widget.isUseDefaultEmoji, - topRowBuilder: _getTopRowBuilder(model), - onScrollToIndex: _historyMessageListController.scrollToIndex, - onScrollToIndexBegin: - _historyMessageListController.scrollToIndexBegin, - toolTipsConfig: widget.toolTipsConfig ?? - ToolTipsConfig( - additionalItemBuilder: - widget.extraTipsActionItemBuilder), - message: message!, - showAvatar: chatConfig.isShowAvatar, - onTapForOthersPortrait: widget.onTapAvatar, - messageItemBuilder: widget.messageItemBuilder, - onLongPressForOthersHeadPortrait: - widget.onLongPressForOthersHeadPortrait, - allowAtUserWhenReply: chatConfig.isAtWhenReply, - allowAvatarTap: chatConfig.isAllowClickAvatar, - allowLongPress: chatConfig.isAllowLongPressMessage, - isUseMessageReaction: chatConfig.isUseMessageReaction); - }, - tongueItemBuilder: widget.tongueItemBuilder, - initFindingMsg: widget.initFindingMsg, - messageList: messageList, - onLoadMore: (String? a, LoadDirection direction, [int? b]) async { - return await requestForData(a, direction, model, b); - }, - ); - }, - ); - } -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKItMessageList/tim_uikit_message_read_receipt.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKItMessageList/tim_uikit_message_read_receipt.dart deleted file mode 100644 index 2b1c04a..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKItMessageList/tim_uikit_message_read_receipt.dart +++ /dev/null @@ -1,101 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_statelesswidget.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/separate_models/tui_chat_separate_view_model.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_chat_global_model.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/core/tim_uikit_wide_modal_operation_key.dart'; -import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/screen_utils.dart'; -import 'package:tencent_cloud_chat_uikit/ui/widgets/message_read_receipt.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart'; -import 'package:tencent_cloud_chat_uikit/ui/widgets/wide_popup.dart'; - -class TIMUIKitMessageReadReceipt extends TIMUIKitStatelessWidget { - final V2TimMessage messageItem; - final void Function(String, TapDownDetails tapDetails)? onTapAvatar; - - TIMUIKitMessageReadReceipt( - {Key? key, this.onTapAvatar, required this.messageItem}) - : super(key: key); - - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - final TUITheme theme = value.theme; - final TUIChatSeparateViewModel model = - Provider.of(context, listen: false); - final isDesktopScreen = TUIKitScreenUtils.getFormFactor(context) == DeviceType.Desktop; - - return Selector( - builder: (context, value, child) { - // if (value == null || value.unreadCount == 0 && value.readCount == 0) { - // return Container(); - // } - return GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - if ((value?.readCount ?? 0) > 0) { - if(isDesktopScreen){ - TUIKitWidePopup.showPopupWindow( - operationKey: TUIKitWideModalOperationKey.messageReadDetails, - context: context, - width: MediaQuery.of(context).size.width * 0.5, - height: MediaQuery.of(context).size.height * 0.8, - title: TIM_t("消息详情"), - child: (onClose) => MessageReadReceipt( - model: model, - onTapAvatar: onTapAvatar, - messageItem: messageItem, - unreadCount: value?.unreadCount ?? 0, - readCount: value?.readCount ?? 0) - ); - }else{ - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => MessageReadReceipt( - model: model, - onTapAvatar: onTapAvatar, - messageItem: messageItem, - unreadCount: value?.unreadCount ?? 0, - readCount: value?.readCount ?? 0))); - } - } - }, - child: Container( - padding: EdgeInsets.only( - bottom: 3, right: 6, left: 6, top: isDesktopScreen ? 2 : 6), - child: ((value?.unreadCount ?? 0) == 0 && (value?.readCount ?? 0) > 0) - ? Icon( - Icons.check_circle_outline, - size: 18, - color: theme.weakTextColor, - ) - : Container( - width: 14, - height: 14, - alignment: Alignment.center, - decoration: BoxDecoration( - shape: BoxShape.circle, - border: Border.all( - width: 1.3, - color: (value?.readCount ?? 0) > 0 - ? theme.primaryColor! - : theme.weakTextColor!)), - child: (value?.readCount ?? 0) > 0 - ? Text( - '${value?.readCount ?? 0}', - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 8, color: theme.primaryColor), - ) - : null, - ), - ), - ); - }, - selector: (c, model) { - return model.getMessageReadReceipt(messageItem.msgID ?? ""); - }, - ); - } -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKItMessageList/utils.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKItMessageList/utils.dart deleted file mode 100644 index 20c1a30..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKItMessageList/utils.dart +++ /dev/null @@ -1,13 +0,0 @@ -import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; - -class TIMUIKitChatUtils { - static String? getMessageIDWithinIndex( - List messageList, int index) { - if (messageList[index]!.elemType == 11) { - if (index > 0) { - return getMessageIDWithinIndex(messageList, index - 1); - } - } - return messageList[index]!.msgID; - } -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitAppBar/tim_uikit_appbar.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitAppBar/tim_uikit_appbar.dart deleted file mode 100644 index 7becfde..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitAppBar/tim_uikit_appbar.dart +++ /dev/null @@ -1,280 +0,0 @@ -// ignore_for_file: deprecated_member_use - -import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; -import 'package:tencent_chat_push_for_china/tencent_chat_push_for_china.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_state.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/separate_models/tui_chat_separate_view_model.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_chat_global_model.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/friendShip/friendship_services.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/group/group_services.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/services_locatar.dart'; -import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/screen_utils.dart'; - -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitAppBar/tim_uikit_appbar_title.dart'; -import 'package:tuple/tuple.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart'; - -class TIMUIKitAppBar extends StatefulWidget implements PreferredSizeWidget { - /// Appbar config - final AppBar? config; - - /// Allow show conversation total unread count - final bool showTotalUnReadCount; - - /// Conversation id - final String conversationID; - - /// conversation name - final String conversationShowName; - - /// If allow update the conversation show name automatically. - final bool isConversationShowNameFixed; - - final bool showC2cMessageEditStatus; - - final GestureTapDownCallback? onClickTitle; - - const TIMUIKitAppBar({ - Key? key, - this.config, - this.isConversationShowNameFixed = false, - this.showTotalUnReadCount = true, - this.conversationID = "", - this.conversationShowName = "", - this.showC2cMessageEditStatus = true, - this.onClickTitle, - }) : super(key: key); - - @override - Size get preferredSize => - config?.preferredSize ?? const Size.fromHeight(56.0); - - @override - State createState() => _TIMUIKitAppBarState(); -} - -class _TIMUIKitAppBarState extends TIMUIKitState { - final FriendshipServices _friendshipServices = - serviceLocator(); - final GroupServices _groupServices = serviceLocator(); - - V2TimFriendshipListener? _friendshipListener; - V2TimGroupListener? _groupListener; - - String _conversationShowName = ""; - - _addConversationShowNameListener() { - _friendshipListener = V2TimFriendshipListener( - onFriendInfoChanged: (infoList) { - try { - final changedInfo = infoList.firstWhere( - (element) => element.userID == widget.conversationID, - ); - if (changedInfo.friendRemark != null && - changedInfo.friendRemark!.isNotEmpty) { - _conversationShowName = changedInfo.friendRemark!; - setState(() {}); - } else { - _conversationShowName = (changedInfo.userProfile?.nickName ?? - changedInfo.userProfile?.userID) ?? - ""; - } - // ignore: empty_catches - } catch (e) { - } - }, - ); - if (_friendshipListener != null) { - _friendshipServices.addFriendListener(listener: _friendshipListener!); - } - } - - _addGroupListener() { - _groupListener = V2TimGroupListener( - onGroupInfoChanged: (groupID, changeInfos) { - try { - if (groupID == widget.conversationID) { - final groupNameChangeInfo = changeInfos.firstWhere((element) => - element.type == - GroupChangeInfoType.V2TIM_GROUP_INFO_CHANGE_TYPE_NAME); - if (groupNameChangeInfo.value != null) { - _conversationShowName = groupNameChangeInfo.value!; - setState(() {}); - } - } - // ignore: empty_catches - } catch (e) { - } - }, - ); - if (_groupListener != null) { - _groupServices.addGroupListener(listener: _groupListener!); - } - } - - String _getTotalUnReadCount(int unreadCount) { - return unreadCount < 99 ? unreadCount.toString() : "99"; - } - final TimUiKitPushPlugin cPush = TimUiKitPushPlugin(); - - - @override - void initState() { - super.initState(); - _conversationShowName = widget.conversationShowName; - if (!widget.isConversationShowNameFixed) { - _addConversationShowNameListener(); - _addGroupListener(); - } - } - - @override - void dispose() { - super.dispose(); - if (!widget.isConversationShowNameFixed) { - _groupServices.removeGroupListener(listener: _groupListener); - _friendshipServices.removeFriendListener(listener: _friendshipListener); - } - } - - @override - void didUpdateWidget(TIMUIKitAppBar oldWidget) { - super.didUpdateWidget(oldWidget); - if (oldWidget.conversationShowName != widget.conversationShowName) { - if (widget.conversationShowName.isNotEmpty) { - setState(() { - _conversationShowName = widget.conversationShowName; - }); - } else { - updateTitleFuture(); - } - } - } - - void updateTitleFuture() async { - try { - final res = await _friendshipServices - .getFriendsInfo(userIDList: [widget.conversationID]); - if (res != null && res.isNotEmpty && res.first.resultCode == 0) { - setState(() { - _conversationShowName = res.first.friendInfo?.userProfile?.nickName ?? - res.first.friendInfo?.userProfile?.userID ?? - ""; - }); - } - // ignore: empty_catches - } catch (e) { - } - } - - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - final TUITheme theme = value.theme; - - final setAppbar = widget.config; - final TUIChatSeparateViewModel chatVM = - Provider.of(context); - final isDesktopScreen = - TUIKitScreenUtils.getFormFactor(context) == DeviceType.Desktop; - return AppBar( - backgroundColor: setAppbar?.backgroundColor ?? - theme.chatHeaderBgColor ?? - theme.appbarBgColor ?? - theme.primaryColor, - actionsIconTheme: setAppbar?.actionsIconTheme, - foregroundColor: setAppbar?.foregroundColor, - elevation: setAppbar?.elevation ?? (isDesktopScreen ? 0 : 1), - bottom: setAppbar?.bottom, - bottomOpacity: setAppbar?.bottomOpacity ?? 1.0, - titleSpacing: setAppbar?.titleSpacing, - automaticallyImplyLeading: setAppbar?.automaticallyImplyLeading ?? false, - shadowColor: setAppbar?.shadowColor ?? theme.weakDividerColor, - excludeHeaderSemantics: setAppbar?.excludeHeaderSemantics ?? false, - toolbarHeight: setAppbar?.toolbarHeight, - titleTextStyle: setAppbar?.titleTextStyle, - toolbarOpacity: setAppbar?.toolbarOpacity ?? 1.0, - toolbarTextStyle: setAppbar?.toolbarTextStyle, - textTheme: setAppbar?.textTheme, - iconTheme: setAppbar?.iconTheme ?? - const IconThemeData( - color: Colors.white, - ), - title: TIMUIKitAppBarTitle( - title: setAppbar?.title, - onClick: widget.onClickTitle, - textStyle: setAppbar?.textTheme?.titleMedium ?? - TextStyle( - color: theme.appbarTextColor ?? hexToColor("010000"), - fontSize: 16), - conversationShowName: _conversationShowName, - showC2cMessageEditStatus: widget.showC2cMessageEditStatus, - fromUser: widget.conversationID, - ), - centerTitle: setAppbar?.centerTitle ?? (isDesktopScreen ? false : true), - leadingWidth: setAppbar?.leadingWidth ?? (isDesktopScreen ? 8 : 70), - leading: Selector>( - builder: (context, data, _) { - final isMultiSelect = data.item1; - final unReadCount = data.item2; - return (!isDesktopScreen && isMultiSelect) - ? TextButton( - onPressed: () { - chatVM.updateMultiSelectStatus(false); - }, - child: Text( - TIM_t('取消'), - style: setAppbar?.textTheme?.titleMedium ?? - TextStyle( - color: - theme.appbarTextColor ?? hexToColor("010000"), - fontSize: 16, - ), - ), - ) - : setAppbar?.leading ?? - (isDesktopScreen - ? Container() - : Row( - children: [ - IconButton( - padding: const EdgeInsets.only(left: 16), - constraints: const BoxConstraints(), - icon: Icon( - Icons.arrow_back_ios, - color: setAppbar - ?.textTheme?.titleMedium?.color ?? - theme.appbarTextColor ?? - hexToColor("010000"), - size: 17, - ), - onPressed: () async { - chatVM.repliedMessage = null; - Navigator.pop(context); - }, - ), - if (widget.showTotalUnReadCount && - unReadCount > 0) - Container( - width: 22, - height: 22, - alignment: Alignment.center, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: theme.cautionColor, - ), - child: - Text(_getTotalUnReadCount(unReadCount)), - ), - ], - )); - }, - shouldRebuild: (prev, next) => - prev.item1 != next.item1 || prev.item2 != next.item2, - selector: (_, model) => - Tuple2(chatVM.isMultiSelect, model.totalUnReadCount)), - actions: setAppbar?.actions, - ); - } -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitAppBar/tim_uikit_appbar_title.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitAppBar/tim_uikit_appbar_title.dart deleted file mode 100644 index 92126d2..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitAppBar/tim_uikit_appbar_title.dart +++ /dev/null @@ -1,62 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; -import 'package:tencent_im_base/i18n/i18n_utils.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_chat_global_model.dart'; - -class TIMUIKitAppBarTitle extends StatelessWidget { - final Widget? title; - final String conversationShowName; - final bool showC2cMessageEditStatus; - final String fromUser; - final GestureTapDownCallback? onClick; - final TextStyle? textStyle; - - const TIMUIKitAppBarTitle( - {Key? key, - this.title, - this.textStyle, - required this.conversationShowName, - required this.showC2cMessageEditStatus, - required this.fromUser, this.onClick}) - : super(key: key); - - Widget titleText(String text){ - return InkWell( - onTapDown: onClick, - child: Text( - text, - style: textStyle ?? - const TextStyle( - color: Colors.white, - fontSize: 17, - ), - ), - ); - } - - // String conversationShowName; - @override - Widget build(BuildContext context) { - int status = Provider.of(context, listen: true) - .getC2cMessageEditStatus(fromUser); - if (status == 0) { - if (title != null) { - return title!; - } - return titleText(conversationShowName,); - } else { - if (showC2cMessageEditStatus) { - return titleText( - TIM_t("对方正在输入中..."),); - - } else { - if (title != null) { - return title!; - } - return titleText( - conversationShowName,); - - } - } - } -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/TIMUIKitMessageReaction/message_reaction_emoji.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/TIMUIKitMessageReaction/message_reaction_emoji.dart deleted file mode 100644 index cba1731..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/TIMUIKitMessageReaction/message_reaction_emoji.dart +++ /dev/null @@ -1,36 +0,0 @@ -List> messageReactionEmojiData = [ - {"name": "red heart", "unicode": 10084}, - {"name": "OK", "unicode": 128076}, - {"name": "thumbs up", "unicode": 128077}, - {"name": "flexed biceps", "unicode": 128170}, - {"name": "waving hand", "unicode": 128079}, - {"name": "handshake", "unicode": 129309}, - {"name": "folded hands", "unicode": 128591}, - {"name": "raised fist", "unicode": 9994}, - {"name": "thumbs down", "unicode": 128078}, - {"name": "smiling face with sunglasses", "unicode": 128526}, - {"name": "GRINNING FACE WITH SMILING EYES", "unicode": 128513}, - {"name": "SMILING FACE WITH SMILING EYES", "unicode": 128522}, - {"name": "smiling face with hearts", "unicode": 129392}, - {"name": "SMILING FACE WITH HEART-SHAPED EYES", "unicode": 128525}, - {"name": "FACE WITH TEARS OF JOY", "unicode": 128514}, - {"name": "flushed face", "unicode": 128563}, - {"name": "SMILING FACE WITH OPEN MOUTH AND COLD SWEAT", "unicode": 128517}, - {"name": "FACE WITH COLD SWEAT", "unicode": 128531}, - {"name": "loudly crying face", "unicode": 128557}, - {"name": "CONFOUNDED FACE", "unicode": 128534}, - {"name": "KISSING FACE WITH CLOSED EYES", "unicode": 128538}, - { - "name": "FACE WITH STUCK-OUT TONGUE AND TIGHTLY-CLOSED EYES", - "unicode": 128541 - }, - {"name": "DISAPPOINTED FACE", "unicode": 128542}, - {"name": "ANGRY FACE", "unicode": 128544}, - {"name": "POUTING FACE", "unicode": 128545}, - {"name": "CRYING FACE", "unicode": 128546}, - {"name": "FACE WITH LOOK OF TRIUMPH", "unicode": 128548}, - {"name": "FEARFUL FACE", "unicode": 128552}, - {"name": "SLEEPY FACE", "unicode": 128554}, - {"name": "FACE WITH NO GOOD GESTURE", "unicode": 128581}, - {"name": "FACE WITH OK GESTURE", "unicode": 128582}, -]; diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/TIMUIKitMessageReaction/tim_uikit_chat_gift_elem.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/TIMUIKitMessageReaction/tim_uikit_chat_gift_elem.dart deleted file mode 100644 index 575549b..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/TIMUIKitMessageReaction/tim_uikit_chat_gift_elem.dart +++ /dev/null @@ -1,371 +0,0 @@ -import 'dart:async'; -import 'dart:convert'; - -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:circle_app/common/colors/app_color.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/screen_utils.dart'; -import 'package:tencent_extended_text/extended_text.dart'; -import 'package:flutter/material.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_state.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/separate_models/tui_chat_separate_view_model.dart'; -import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; -import 'package:tencent_cloud_chat_uikit/ui/widgets/link_preview/link_preview_entry.dart'; -import 'package:tencent_cloud_chat_uikit/ui/widgets/link_preview/widgets/link_preview.dart'; - -import '../../../widget/chat_gift_pannel.dart'; - -class GiftElem extends StatefulWidget { - final V2TimMessage message; - final bool isFromSelf; - final bool isShowJump; - final VoidCallback clearJump; - final TextStyle? fontStyle; - final BorderRadius? borderRadius; - final Color? backgroundColor; - final EdgeInsetsGeometry? textPadding; - final TUIChatSeparateViewModel chatModel; - final bool? isShowMessageReaction; - final bool isUseDefaultEmoji; - final List customEmojiStickerList; - - const GiftElem( - {Key? key, - required this.message, - required this.isFromSelf, - required this.isShowJump, - required this.clearJump, - this.fontStyle, - this.borderRadius, - this.isShowMessageReaction, - this.backgroundColor, - this.textPadding, - required this.chatModel, - this.isUseDefaultEmoji = false, - this.customEmojiStickerList = const []}) - : super(key: key); - - @override - State createState() => _GiftElemState(); -} - -class _GiftElemState extends TIMUIKitState { - bool isShowJumpState = false; - bool isShining = false; - - @override - void initState() { - super.initState(); - // get the link preview info - _getLinkPreview(); - } - - @override - void didUpdateWidget(var oldWidget) { - super.didUpdateWidget(oldWidget); - if (oldWidget.message.msgID == null && widget.message.msgID != null) { - _getLinkPreview(); - } - } - - _showJumpColor() { - if ((widget.chatModel.jumpMsgID != widget.message.msgID) && - (widget.message.msgID?.isNotEmpty ?? true)) { - return; - } - isShining = true; - int shineAmount = 6; - setState(() { - isShowJumpState = true; - }); - Timer.periodic(const Duration(milliseconds: 300), (timer) { - if (mounted) { - setState(() { - isShowJumpState = shineAmount.isOdd ? true : false; - }); - } - if (shineAmount == 0 || !mounted) { - isShining = false; - timer.cancel(); - } - shineAmount--; - }); - Future.delayed(const Duration(milliseconds: 100), () { - widget.clearJump(); - }); - } - - // get the link preview info - _getLinkPreview() { - if (widget.chatModel.chatConfig.urlPreviewType != - UrlPreviewType.previewCardAndHyperlink) { - return; - } - try { - if (widget.message.localCustomData != null && - widget.message.localCustomData!.isNotEmpty) { - final String localJSON = widget.message.localCustomData!; - final LocalCustomDataModel? localPreviewInfo = - LocalCustomDataModel.fromMap(json.decode(localJSON)); - // If [localCustomData] is not empty, check if the link preview info exists - if (localPreviewInfo == null || localPreviewInfo.isLinkPreviewEmpty()) { - // If not exists, get it - _initLinkPreview(); - } - } else { - // It [localCustomData] is empty, get the link info - _initLinkPreview(); - } - } catch (e) { - return null; - } - } - - _initLinkPreview() async { - // Get the link preview info from extension, let it update the message UI automatically by providing a [onUpdateMessage]. - // The `onUpdateMessage` can use the `updateMessage()` from the [TIMUIKitChatController] directly. - LinkPreviewEntry.getFirstLinkPreviewContent( - message: widget.message, - onUpdateMessage: (message) { - widget.chatModel.updateMessageFromController( - msgID: widget.message.msgID!, message: message); - }); - } - - Widget? _renderPreviewWidget() { - // If the link preview info from [localCustomData] is available, use it to render the preview card. - // Otherwise, it will returns null. - if (widget.message.localCustomData != null && - widget.message.localCustomData!.isNotEmpty) { - try { - final String localJSON = widget.message.localCustomData!; - final LocalCustomDataModel? localPreviewInfo = - LocalCustomDataModel.fromMap(json.decode(localJSON)); - if (localPreviewInfo != null && - !localPreviewInfo.isLinkPreviewEmpty()) { - return Container( - margin: const EdgeInsets.only(top: 8), - child: - // You can use this default widget [LinkPreviewWidget] to render preview card, or you can use custom widget. - LinkPreviewWidget(linkPreview: localPreviewInfo), - ); - } else { - return null; - } - } catch (e) { - return null; - } - } else { - return null; - } - } - - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - final theme = value.theme; - final isDesktopScreen = - TUIKitScreenUtils.getFormFactor(context) == DeviceType.Desktop; - final textWithLink = LinkPreviewEntry.getHyperlinksText( - widget.message.textElem?.text ?? "", - widget.chatModel.chatConfig.isSupportMarkdownForTextMessage, - onLinkTap: widget.chatModel.chatConfig.onTapLink, - isUseDefaultEmoji: widget.isUseDefaultEmoji, - customEmojiStickerList: widget.customEmojiStickerList, - isEnableTextSelection: - widget.chatModel.chatConfig.isEnableTextSelection); - final borderRadius = widget.isFromSelf - ? const BorderRadius.only( - topLeft: Radius.circular(10), - topRight: Radius.circular(10), - bottomLeft: Radius.circular(10), - bottomRight: Radius.circular(2)) - : const BorderRadius.only( - topLeft: Radius.circular(10), - topRight: Radius.circular(10), - bottomLeft: Radius.circular(2), - bottomRight: Radius.circular(10)); - if ((widget.chatModel.jumpMsgID == widget.message.msgID)) {} - if (widget.isShowJump) { - if (!isShining) { - Future.delayed(Duration.zero, () { - _showJumpColor(); - }); - } else { - if ((widget.chatModel.jumpMsgID == widget.message.msgID) && - (widget.message.msgID?.isNotEmpty ?? false)) { - widget.clearJump(); - } - } - } - - final defaultStyle = widget.isFromSelf - ? (theme.chatMessageItemFromSelfBgColor ?? - theme.lightPrimaryMaterialColor.shade50) - : (theme.chatMessageItemFromOthersBgColor); - - final backgroundColor = isShowJumpState - ? const Color.fromRGBO(245, 166, 35, 1) - : (defaultStyle ?? widget.backgroundColor); - - if (!widget.isFromSelf) { - return Container( - // decoration: BoxDecoration( - // gradient: - // LinearGradient(colors: [Color(0xFF04FCFB), Color(0xFFE540FE)]), - // // color: backgroundColor, - // borderRadius: widget.borderRadius ?? borderRadius, - // ), - child: Container( - margin: EdgeInsets.all(1), - // padding: - // widget.textPadding ?? EdgeInsets.all(isDesktopScreen ? 11 : 9), - // decoration: BoxDecoration( - // color: const Color(0xFF493E5C), - // // color: backgroundColor, - // borderRadius: widget.borderRadius ?? borderRadius, - // ), - constraints: - BoxConstraints(maxWidth: MediaQuery.of(context).size.width * 0.6), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - ChatMsgGiftItem(widget.message, widget.isFromSelf), - GestureDetector( - onTap: () { - showGiftPannel(widget.message); - }, - child: Container( - height: 30.sp, - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(6.sp), - gradient: AppColor.mainVerLinearGradient, - ), - child: Text( - '给TA回个礼,让感情升升温', - style: TextStyle(color: Colors.white), - ), - ), - ) - ], - ), - ), - ); - } - - return Container( - // padding: - // widget.textPadding ?? EdgeInsets.all(isDesktopScreen ? 12 : 10), - decoration: BoxDecoration( - gradient: - LinearGradient(colors: [Color(0xFF04FCFB), Color(0xFFE540FE)]), - // color: backgroundColor, - borderRadius: widget.borderRadius ?? borderRadius, - ), - constraints: - BoxConstraints(maxWidth: MediaQuery.of(context).size.width * 0.6), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ChatMsgGiftItem(widget.message, widget.isFromSelf)], - ), - ); - } -} - -class ChatMsgGiftItem extends StatelessWidget { - final V2TimMessage message; - bool isMe; - // TODO: add state variables, methods and constructor params - ChatMsgGiftItem(this.message, this.isMe); - - @override - Widget build(BuildContext context) { - Map giftData = jsonDecode(message.customElem!.data!); - - // "msg" -> "{\"giftImageUrl\":\"http://qiniuyun.ikuayou.com/live/gifts/2.png\",\"giftName\":\"舔狗楷模\",\"gmtNotice\":\"2023-0..." - // TODO: add widget build method - return Container( - width: MediaQuery.of(context).size.width * 0.6, - color: isMe ? Colors.transparent : Colors.transparent, - child: Stack( - alignment: Alignment.center, - children: [ - if (!isMe) - Container( - height: 78.sp, - // padding: - // widget.textPadding ?? EdgeInsets.all(isDesktopScreen ? 12 : 10), - decoration: BoxDecoration( - gradient: LinearGradient( - colors: [Color(0xFF04FCFB), Color(0xFFE540FE)]), - // color: backgroundColor, - borderRadius: BorderRadius.circular(8.sp), - ), - constraints: BoxConstraints( - maxWidth: MediaQuery.of(context).size.width * 0.6), - ), - Container( - height: 76.sp, - margin: EdgeInsets.all(1.sp), - decoration: BoxDecoration( - color: isMe ? Colors.transparent : Color(0xFF493E5C), - borderRadius: BorderRadius.circular(8.sp)), - child: Row( - children: [ - Container( - margin: EdgeInsets.only(left: 10.sp), - child: CachedNetworkImage( - imageUrl: giftData['giftImageUrl'], - width: 60.sp, - height: 60.sp, - )), - Expanded( - child: Container( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - // crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - // color: Colors.red, - // alignment: Alignment.center, - child: Text( - (!isMe ? '送出' : '送你') + - '${giftData['num']}个${giftData['giftName']}', - style: TextStyle( - color: Color(0xFFF7FAFA), fontSize: 14.sp), - overflow: TextOverflow.ellipsis, - ), - ), - SizedBox( - height: 8.sp, - ), - Container( - child: Text( - '价值${giftData['totalPrice']}小票', - style: TextStyle( - color: Color(0xFFF7FAFA), fontSize: 14.sp), - overflow: TextOverflow.ellipsis, - ), - ) - ], - ), - ), - ), - ], - ), - ), - ], - ), - ); - } -} - -showGiftPannel(var message) { - Get.bottomSheet( - ChatGiftPannel(accid: message.sender!), - isScrollControlled: false, - enableDrag: false, - ); -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/TIMUIKitMessageReaction/tim_uikit_message_reaction_detail.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/TIMUIKitMessageReaction/tim_uikit_message_reaction_detail.dart deleted file mode 100644 index d69f4b5..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/TIMUIKitMessageReaction/tim_uikit_message_reaction_detail.dart +++ /dev/null @@ -1,192 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:tencent_im_base/tencent_im_base.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_state.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_self_info_view_model.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/services_locatar.dart'; - -import 'package:tencent_cloud_chat_uikit/ui/widgets/avatar.dart'; - -class TIMUIKitMessageReactionDetail extends StatefulWidget { - /// the index of the current emoji sticker - final int currentStickerIndex; - - /// the list of member - final List? memberList; - - /// message reaction map - final Map messageReaction; - - /// the sticker list from message reaction - final List stickerList; - - final Function(String userID, TapDownDetails tapDetails)? onTapAvatar; - - const TIMUIKitMessageReactionDetail( - {required this.currentStickerIndex, - this.memberList, - required this.messageReaction, - Key? key, - required this.stickerList, - this.onTapAvatar}) - : super(key: key); - - @override - State createState() => TIMUIKitMessageReactionDetailState(); -} - -class TIMUIKitMessageReactionDetailState - extends TIMUIKitState - with TickerProviderStateMixin { - final TUISelfInfoViewModel selfInfoModel = - serviceLocator(); - - Widget getUserItem( - String userID, TUITheme theme, Function(String userID, TapDownDetails tapDetails)? onTapAvatar) { - V2TimGroupMemberFullInfo? memberInfo; - String showName = userID; - try { - memberInfo = - widget.memberList?.firstWhere((element) => element?.userID == userID); - if (memberInfo != null) { - if (memberInfo.friendRemark != null && - memberInfo.friendRemark!.isNotEmpty) { - showName = memberInfo.friendRemark!; - } else if (memberInfo.nameCard != null && - memberInfo.nameCard!.isNotEmpty) { - showName = memberInfo.nameCard!; - } else if (memberInfo.nickName != null && - memberInfo.nickName!.isNotEmpty) { - showName = memberInfo.nickName!; - } else { - showName = memberInfo.userID; - } - } - } catch (e) { - // e - } - - return InkWell( - onTapDown: (tapDetails) { - if (onTapAvatar != null) { - if (userID != selfInfoModel.loginInfo?.userID) { - onTapAvatar(userID, tapDetails); - } - } - }, - child: Container( - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: theme.weakDividerColor ?? - CommonColor.weakDividerColor))), - child: Row( - children: [ - Container( - margin: const EdgeInsets.only(right: 12), - child: SizedBox( - height: 40, - width: 40, - child: (memberInfo?.faceUrl != null) - ? Avatar(faceUrl: memberInfo!.faceUrl!, showName: userID) - : Container(), - ), - ), - Expanded( - child: Container( - alignment: Alignment.centerLeft, - padding: const EdgeInsets.only(top: 20, bottom: 20, right: 28), - child: Text( - showName, - style: TextStyle(color: theme.black, fontSize: 18), - ), - )), - ], - ), - ), - ); - } - - Widget stickerItem(int sticker, int length) { - return Container( - margin: const EdgeInsets.only(top: 12, bottom: 12), - padding: const EdgeInsets.only(left: 10, right: 10, top: 2, bottom: 1), - decoration: const BoxDecoration( - color: Color(0x198a8a8a), - borderRadius: BorderRadius.all(Radius.circular(20)), - ), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Container( - padding: const EdgeInsets.only(bottom: 3), - child: Text( - String.fromCharCode(sticker), - style: const TextStyle( - fontSize: 16, - ), - ), - ), - Container( - margin: const EdgeInsets.only(left: 6), - child: Text(length.toString()), - ), - ], - ), - ); - } - - Widget getStickerNameList( - int sticker, TUITheme theme, Function(String userID, TapDownDetails tapDetails)? onTapAvatar) { - final nameList = widget.messageReaction[sticker.toString()]; - return SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [...nameList.map((e) => getUserItem(e, theme, onTapAvatar))], - ), - ); - } - - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - final theme = value.theme; - return DefaultTabController( - initialIndex: widget.currentStickerIndex, - length: widget.stickerList.length, - child: Container( - padding: const EdgeInsets.symmetric(horizontal: 12), - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: const EdgeInsets.only(bottom: 4), - child: TabBar( - isScrollable: true, - labelColor: theme.primaryColor, - labelStyle: const TextStyle(fontWeight: FontWeight.bold), - unselectedLabelColor: hexToColor("62626b"), - unselectedLabelStyle: - const TextStyle(fontWeight: FontWeight.normal), - indicatorSize: TabBarIndicatorSize.label, - indicatorColor: theme.primaryColor ?? hexToColor("62626b"), - tabs: [ - ...widget.stickerList.map((element) { - return stickerItem(element, - widget.messageReaction[element.toString()].length); - }) - ], - ), - ), - Expanded( - child: TabBarView( - children: widget.stickerList - .map((int sticker) => getStickerNameList( - sticker, theme, widget.onTapAvatar)) - .toList())) - ], - ), - )); - } -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/TIMUIKitMessageReaction/tim_uikit_message_reaction_select_emoji.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/TIMUIKitMessageReaction/tim_uikit_message_reaction_select_emoji.dart deleted file mode 100644 index a6cffa3..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/TIMUIKitMessageReaction/tim_uikit_message_reaction_select_emoji.dart +++ /dev/null @@ -1,92 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_state.dart'; -import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/screen_utils.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitMessageItem/TIMUIKitMessageReaction/message_reaction_emoji.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitTextField/tim_uikit_emoji_panel.dart' - as emoji; -import 'package:tencent_cloud_chat_uikit/ui/widgets/emoji.dart'; -import 'package:tencent_cloud_chat_uikit/ui/widgets/extended_wrap/extended_wrap.dart'; - -enum TIMSelectEmojiPanelPosition { up, down } - -class TIMUIKitMessageReactionEmojiSelectPanel extends StatefulWidget { - final ValueChanged onSelect; - final bool isShowMoreSticker; - final ValueChanged onClickShowMore; - - const TIMUIKitMessageReactionEmojiSelectPanel( - {Key? key, - required this.onSelect, - required this.isShowMoreSticker, - required this.onClickShowMore}) - : super(key: key); - - @override - State createState() => - TIMUIKitMessageReactionEmojiSelectPanelState(); -} - -class TIMUIKitMessageReactionEmojiSelectPanelState - extends TIMUIKitState { - bool isShowMore = false; - - _buildSimplePanel(TUITheme theme) { - final List> emojiData = messageReactionEmojiData; - final isDesktopScreen = TUIKitScreenUtils.getFormFactor() == DeviceType.Desktop; - return Material( - color: Colors.white, - child: ExtendedWrap( - maxLines: widget.isShowMoreSticker ? 5 : 1, - spacing: 18, - crossAxisAlignment: WrapCrossAlignment.center, - runSpacing: 24, - children: [ - if(!isDesktopScreen) - GestureDetector( - onTap: () { - widget.onClickShowMore(!widget.isShowMoreSticker); - }, - child: SizedBox( - height: 34, - child: Icon( - widget.isShowMoreSticker - ? Icons.cancel_outlined - : Icons.add_circle_outline_outlined, - color: hexToColor("444444"), - size: 26), - ), - ), - ...emojiData.map( - (e) { - var item = Emoji.fromJson(e); - return SizedBox( - // width: 50, - child: InkWell( - splashColor: Colors.white, - onTap: () { - widget.onSelect(item.unicode); - }, - child: emoji.EmojiItem( - name: item.name, - unicode: item.unicode, - ), - ), - ); - }, - ).toList() - ], - ), - ); - } - - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - final TUITheme theme = value.theme; - - return Container( - child: _buildSimplePanel(theme), - ); - } -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/TIMUIKitMessageReaction/tim_uikit_message_reaction_show_item.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/TIMUIKitMessageReaction/tim_uikit_message_reaction_show_item.dart deleted file mode 100644 index 2506e71..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/TIMUIKitMessageReaction/tim_uikit_message_reaction_show_item.dart +++ /dev/null @@ -1,171 +0,0 @@ -// ignore_for_file: unused_field - -import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; -import 'package:tencent_im_base/tencent_im_base.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_statelesswidget.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/separate_models/tui_chat_separate_view_model.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_self_info_view_model.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/message/message_services.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/services_locatar.dart'; - -import 'package:tencent_cloud_chat_uikit/ui/utils/platform.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitMessageItem/TIMUIKitMessageReaction/tim_uikit_message_reaction_utils.dart'; -import 'package:tencent_cloud_chat_uikit/ui/widgets/extended_wrap/extended_wrap.dart'; - -class TIMUIKitMessageReactionShowItem extends TIMUIKitStatelessWidget { - /// the unicode of the emoji - final int sticker; - - /// the list contains the name who choose the current emoji - final List nameList; - - /// current message - final V2TimMessage message; - - /// show the details of message reaction - final Function(int sticker) onShowDetail; - - /// the member in current chat - final List memberList; - - TIMUIKitMessageReactionShowItem( - {required this.message, - required this.sticker, - required this.memberList, - required this.onShowDetail, - required this.nameList, - Key? key}) - : super(key: key); - - final TUISelfInfoViewModel selfInfoModel = - serviceLocator(); - final MessageService _messageService = serviceLocator(); - - clickOnCurrentSticker() async { - for (int i = 0; i < 5; i++) { - final res = await modifySticker(); - if (res.code == 0) { - break; - } - } - } - - Future> modifySticker() async { - return await Future.delayed(const Duration(milliseconds: 50), () async { - return await MessageReactionUtils.clickOnSticker(message, sticker); - }); - } - - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - final theme = value.theme; - final option1 = nameList.length; - final TUIChatSeparateViewModel model = - Provider.of(context); - return LayoutBuilder(builder: (context, constraints) { - return Container( - padding: const EdgeInsets.only( - left: 10, - right: 10, - ), - decoration: const BoxDecoration( - color: Color(0x19727271), - borderRadius: BorderRadius.all(Radius.circular(20)), - ), - child: Row( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - InkWell( - onTap: clickOnCurrentSticker, - child: Container( - margin: EdgeInsets.only( - bottom: (!PlatformUtils().isIOS) ? 4 : 2, - top: (!PlatformUtils().isIOS) ? 4 : 0), - child: Text( - String.fromCharCode(sticker), - style: TextStyle( - fontSize: (!PlatformUtils().isIOS) ? 12 : 16, - color: hexToColor("f9453d")), - ), - ), - ), - Container( - margin: const EdgeInsets.only(left: 6, right: 6), - child: SizedBox( - width: 1, - height: 14, - child: DecoratedBox( - decoration: BoxDecoration(color: theme.weakTextColor), - ), - ), - ), - Container( - constraints: BoxConstraints( - maxWidth: constraints.maxWidth * 0.8, - ), - child: ExtendedWrap( - maxLines: 1, - spacing: 8, - crossAxisAlignment: WrapCrossAlignment.center, - overflowWidget: GestureDetector( - onTap: () { - onShowDetail(sticker); - }, - child: Text( - TIM_t_para("...共{{option1}}人", "...共$option1人")( - option1: option1), - style: TextStyle(fontSize: 12, color: hexToColor("616669")), - ), - ), - children: [ - ...nameList.map((e) { - String showName = e; - if (memberList.isNotEmpty) { - try { - final V2TimGroupMemberFullInfo? memberInfo = memberList - .firstWhere((element) => element?.userID == e); - if (memberInfo != null) { - if (memberInfo.friendRemark != null && - memberInfo.friendRemark!.isNotEmpty) { - showName = memberInfo.friendRemark!; - } else if (memberInfo.nameCard != null && - memberInfo.nameCard!.isNotEmpty) { - showName = memberInfo.nameCard!; - } else if (memberInfo.nickName != null && - memberInfo.nickName!.isNotEmpty) { - showName = memberInfo.nickName!; - } else { - showName = memberInfo.userID; - } - } - } catch (e) { - // e - } - } - return InkWell( - onTapDown: (tapDetails) { - if (model.onTapAvatar != null) { - if (e != selfInfoModel.loginInfo?.userID) { - model.onTapAvatar!(e, tapDetails); - } - } - }, - child: Text( - showName, - style: TextStyle( - fontSize: 12, color: hexToColor("616669")), - ), - ); - }) - ], - ), - ) - ], - ), - ); - }); - } -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/TIMUIKitMessageReaction/tim_uikit_message_reaction_show_panel.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/TIMUIKitMessageReaction/tim_uikit_message_reaction_show_panel.dart deleted file mode 100644 index 270a9cb..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/TIMUIKitMessageReaction/tim_uikit_message_reaction_show_panel.dart +++ /dev/null @@ -1,169 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_statelesswidget.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/separate_models/tui_chat_separate_view_model.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_chat_global_model.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_self_info_view_model.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/services_locatar.dart'; -import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/platform.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitMessageItem/TIMUIKitMessageReaction/tim_uikit_message_reaction_detail.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitMessageItem/TIMUIKitMessageReaction/tim_uikit_message_reaction_show_item.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitMessageItem/TIMUIKitMessageReaction/tim_uikit_message_reaction_utils.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/tim_uikit_cloud_custom_data.dart'; - -class TIMUIKitMessageReactionShowPanel extends TIMUIKitStatelessWidget { - /// current message - final V2TimMessage message; - - TIMUIKitMessageReactionShowPanel({required this.message, Key? key}) - : super(key: key); - - final TUISelfInfoViewModel selfInfoModel = - serviceLocator(); - - void showMore( - BuildContext context, - List? memberList, - Map messageReaction, - int currentSticker, - List stickerList, - TUIChatSeparateViewModel model) async { - _showCustomModalBottomSheet(context, memberList, messageReaction, - currentSticker, stickerList, model); - } - - Future> _showCustomModalBottomSheet( - context, - List? memberList, - Map messageReaction, - int currentSticker, - List stickerList, - TUIChatSeparateViewModel model) async { - return showModalBottomSheet( - backgroundColor: Colors.transparent, - isScrollControlled: true, - context: context, - builder: (BuildContext context) { - return Container( - clipBehavior: Clip.antiAlias, - decoration: const BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(20.0), - topRight: Radius.circular(20.0), - ), - ), - constraints: BoxConstraints( - maxHeight: MediaQuery.of(context).size.height * 0.66, - minHeight: MediaQuery.of(context).size.height * 0.2, - ), - child: Column(children: [ - SizedBox( - height: 50, - child: Stack( - textDirection: TextDirection.rtl, - children: [ - Center( - child: Text( - TIM_t("回应详情"), - style: const TextStyle( - fontWeight: FontWeight.bold, fontSize: 16.0), - ), - ), - IconButton( - icon: const Icon(Icons.close), - onPressed: () { - Navigator.of(context).pop(); - }), - ], - ), - ), - const Divider(height: 1.0), - Expanded( - child: TIMUIKitMessageReactionDetail( - onTapAvatar: model.onTapAvatar, - stickerList: stickerList, - currentStickerIndex: stickerList - .indexWhere((element) => element == currentSticker), - memberList: memberList, - messageReaction: messageReaction, - )), - ]), - ); - }, - ); - } - - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - Map messageReaction = {}; - CloudCustomData messageCloudCustomData = - MessageReactionUtils.getCloudCustomData(message); - final TUIChatSeparateViewModel model = - Provider.of(context); - if (messageCloudCustomData.messageReaction != null && - messageCloudCustomData.messageReaction!.isNotEmpty) { - messageReaction = messageCloudCustomData.messageReaction!; - } else { - return const SizedBox(width: 0, height: 0); - } - - final List messageReactionStickerList = []; - - messageReaction.forEach((key, value) { - messageReactionStickerList.add(int.parse(key)); - }); - - final filteredMessageReactionStickerList = - messageReactionStickerList.where((sticker) { - if (messageReaction[sticker.toString()] == null || - messageReaction[sticker.toString()] is! List || - messageReaction[sticker.toString()].length == 0) { - return false; - } - return true; - }).toList(); - - final ConvType convType = model.conversationType ?? ConvType.c2c; - List memberList = []; - if (convType == ConvType.group) { - memberList = model.groupMemberList ?? []; - } else { - final V2TimGroupMemberFullInfo selfInfo = V2TimGroupMemberFullInfo( - userID: selfInfoModel.loginInfo?.userID ?? "", - nickName: selfInfoModel.loginInfo?.nickName, - faceUrl: selfInfoModel.loginInfo?.faceUrl, - ); - - final V2TimGroupMemberFullInfo targetInfo = V2TimGroupMemberFullInfo( - userID: model.conversationID, - ); - memberList = [selfInfo, model.currentChatUserInfo ?? targetInfo]; - } - - return filteredMessageReactionStickerList.isNotEmpty - ? Container( - margin: const EdgeInsets.only(top: 12), - child: Wrap( - spacing: 8, - runSpacing: (!PlatformUtils().isIOS) ? 12 : 8, - children: [ - ...filteredMessageReactionStickerList.map((sticker) { - return TIMUIKitMessageReactionShowItem( - memberList: memberList, - message: message, - nameList: messageReaction[sticker.toString()], - sticker: sticker, - onShowDetail: (int sticker) { - showMore(context, memberList, messageReaction, sticker, - filteredMessageReactionStickerList, model); - }); - }).toList(), - ], - ), - ) - : const SizedBox(width: 0, height: 0); - } -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/TIMUIKitMessageReaction/tim_uikit_message_reaction_utils.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/TIMUIKitMessageReaction/tim_uikit_message_reaction_utils.dart deleted file mode 100644 index 041dc9f..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/TIMUIKitMessageReaction/tim_uikit_message_reaction_utils.dart +++ /dev/null @@ -1,57 +0,0 @@ -import 'dart:convert'; - -import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_self_info_view_model.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/message/message_services.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/services_locatar.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/platform.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/tim_uikit_cloud_custom_data.dart'; - -class MessageReactionUtils { - static final TUISelfInfoViewModel selfInfoModel = - serviceLocator(); - static final MessageService _messageService = - serviceLocator(); - - static CloudCustomData getCloudCustomData(V2TimMessage message) { - CloudCustomData messageCloudCustomData; - try { - messageCloudCustomData = CloudCustomData.fromJson(json.decode( - TencentUtils.checkString(message.cloudCustomData) != null - ? message.cloudCustomData! - : "{}")); - } catch (e) { - messageCloudCustomData = CloudCustomData(); - } - - return messageCloudCustomData; - } - - static Map getMessageReaction(V2TimMessage message) { - return getCloudCustomData(message).messageReaction ?? {}; - } - - static Future> clickOnSticker( - V2TimMessage message, int sticker) async { - final CloudCustomData messageCloudCustomData = getCloudCustomData(message); - final Map messageReaction = - messageCloudCustomData.messageReaction ?? {}; - List targetList = messageReaction["$sticker"] ?? []; - if (targetList.contains(selfInfoModel.loginInfo!.userID!)) { - targetList.remove(selfInfoModel.loginInfo!.userID!); - } else { - targetList = [selfInfoModel.loginInfo!.userID!, ...targetList]; - } - messageReaction["$sticker"] = targetList; - - if (PlatformUtils().isWeb) { - final decodedMessage = jsonDecode(message.messageFromWeb!); - decodedMessage["cloudCustomData"] = - jsonEncode(messageCloudCustomData.toMap()); - message.messageFromWeb = jsonEncode(decodedMessage); - } else { - message.cloudCustomData = json.encode(messageCloudCustomData.toMap()); - } - return await _messageService.modifyMessage(message: message); - } -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/TIMUIKitMessageReaction/tim_uikit_message_reaction_wrapper.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/TIMUIKitMessageReaction/tim_uikit_message_reaction_wrapper.dart deleted file mode 100644 index 3387b40..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/TIMUIKitMessageReaction/tim_uikit_message_reaction_wrapper.dart +++ /dev/null @@ -1,190 +0,0 @@ -import 'dart:async'; -import 'dart:convert'; - -import 'package:flutter/material.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/common_utils.dart'; -import 'package:tencent_im_base/tencent_im_base.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_state.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/separate_models/tui_chat_separate_view_model.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitMessageItem/TIMUIKitMessageReaction/tim_uikit_message_reaction_show_panel.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/tim_uikit_cloud_custom_data.dart'; - -class TIMUIKitMessageReactionWrapper extends StatefulWidget { - final Widget child; - final V2TimMessage message; - final Color? backgroundColor; - final bool isFromSelf; - final BorderRadius? borderRadius; - final bool isShowJump; - final VoidCallback? clearJump; - final bool isShowMessageReaction; - final TUIChatSeparateViewModel chatModel; - - const TIMUIKitMessageReactionWrapper( - {Key? key, - required this.isShowJump, - this.clearJump, - required this.isFromSelf, - this.backgroundColor, - required this.chatModel, - required this.message, - this.borderRadius, - required this.child, - this.isShowMessageReaction = true}) - : super(key: key); - - @override - State createState() => _TIMUIKitMessageReactionWrapperState(); -} - -class _TIMUIKitMessageReactionWrapperState - extends TIMUIKitState { - bool isShowJumpState = false; - bool isShining = false; - bool isShowBorder = false; - - _showJumpColor() { - if ((widget.chatModel.jumpMsgID != widget.message.msgID) && - (widget.message.msgID?.isNotEmpty ?? true)) { - return; - } - isShining = true; - int shineAmount = 6; - setState(() { - isShowJumpState = true; - isShowBorder = true; - }); - Timer.periodic(const Duration(milliseconds: 300), (timer) { - if (mounted) { - setState(() { - isShowJumpState = shineAmount.isOdd ? true : false; - isShowBorder = shineAmount.isOdd ? true : false; - }); - } - if (shineAmount == 0 || !mounted) { - isShining = false; - timer.cancel(); - } - shineAmount--; - }); - if (widget.clearJump != null) { - widget.clearJump!(); - } - } - - bool isHaveMessageReaction() { - Map messageReaction = {}; - CloudCustomData messageCloudCustomData; - try { - messageCloudCustomData = CloudCustomData.fromJson(json.decode( - TencentUtils.checkString(widget.message.cloudCustomData) != null - ? widget.message.cloudCustomData! - : "{}")); - } catch (e) { - messageCloudCustomData = CloudCustomData(); - } - - if (messageCloudCustomData.messageReaction != null && - messageCloudCustomData.messageReaction!.isNotEmpty) { - messageReaction = messageCloudCustomData.messageReaction!; - } else { - return false; - } - - final List messageReactionStickerList = []; - - messageReaction.forEach((key, value) { - messageReactionStickerList.add(int.parse(key)); - }); - - final filteredMessageReactionStickerList = - messageReactionStickerList.where((sticker) { - if (messageReaction[sticker.toString()] == null || - messageReaction[sticker.toString()] is! List || - messageReaction[sticker.toString()].length == 0) { - return false; - } - return true; - }); - - if (filteredMessageReactionStickerList.isEmpty) { - return false; - } - return true; - } - - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - final theme = value.theme; - final borderRadius = widget.isFromSelf - ? const BorderRadius.only( - topLeft: Radius.circular(10), - topRight: Radius.circular(2), - bottomLeft: Radius.circular(10), - bottomRight: Radius.circular(10)) - : const BorderRadius.only( - topLeft: Radius.circular(2), - topRight: Radius.circular(10), - bottomLeft: Radius.circular(10), - bottomRight: Radius.circular(10)); - - if (widget.isShowJump) { - if (!isShining) { - Future.delayed(Duration.zero, () { - _showJumpColor(); - }); - } else { - if ((widget.chatModel.jumpMsgID == widget.message.msgID) && - (widget.message.msgID?.isNotEmpty ?? false)) { - if(widget.clearJump != null){ - widget.clearJump!(); - } - } - } - } - - final defaultStyle = widget.isFromSelf - ? theme.lightPrimaryMaterialColor.shade50 - : theme.weakBackgroundColor; - final backgroundColor = isShowJumpState - ? const Color.fromRGBO(245, 166, 35, 1) - : (widget.backgroundColor ?? defaultStyle); - - if (!widget.isShowMessageReaction || !isHaveMessageReaction()) { - return Container( - decoration: BoxDecoration( - borderRadius: const BorderRadius.all(Radius.circular(5)), - border: Border.all( - color: Color.fromRGBO(245, 166, 35, (isShowBorder ? 1 : 0)), - width: 2)), - child: widget.child, - ); - } - - return Container( - padding: const EdgeInsets.all(10), - decoration: BoxDecoration( - color: backgroundColor, - borderRadius: widget.borderRadius ?? borderRadius, - ), - constraints: - BoxConstraints(maxWidth: MediaQuery.of(context).size.width * 0.7), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - decoration: BoxDecoration( - borderRadius: const BorderRadius.all(Radius.circular(5)), - border: Border.all( - color: Color.fromRGBO(245, 166, 35, (isShowBorder ? 1 : 0)), - width: 2)), - child: widget.child, - ), - if (widget.isShowMessageReaction) - TIMUIKitMessageReactionShowPanel(message: widget.message) - ], - ), - ); - } -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/main.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/main.dart deleted file mode 100644 index f19041e..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/main.dart +++ /dev/null @@ -1,8 +0,0 @@ -export 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_file_elem.dart'; -export 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_group_tips_elem.dart'; -export 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_image_elem.dart'; -export 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_sound_elem.dart'; -export 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_text_elem.dart'; -export 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_video_elem.dart'; -export 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_merger_message_elem.dart'; -export 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_reply_elem.dart'; diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_custom_elem.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_custom_elem.dart deleted file mode 100644 index a158842..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_custom_elem.dart +++ /dev/null @@ -1,62 +0,0 @@ -// ignore_for_file: unrelated_type_equality_checks - - -import 'package:flutter/material.dart'; -import 'package:tencent_im_base/tencent_im_base.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_statelesswidget.dart'; - - -class TIMUIKitCustomElem extends TIMUIKitStatelessWidget { - final V2TimCustomElem? customElem; - final bool isFromSelf; - final TextStyle? messageFontStyle; - final BorderRadius? messageBorderRadius; - final Color? messageBackgroundColor; - final EdgeInsetsGeometry? textPadding; - final V2TimMessage message; - final bool? isShowMessageReaction; - - TIMUIKitCustomElem({ - Key? key, - required this.message, - this.isShowMessageReaction, - this.customElem, - this.isFromSelf = false, - this.messageFontStyle, - this.messageBorderRadius, - this.messageBackgroundColor, - this.textPadding, - }) : super(key: key); - - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - final theme = value.theme; - final borderRadius = isFromSelf - ? const BorderRadius.only( - topLeft: Radius.circular(10), - topRight: Radius.circular(2), - bottomLeft: Radius.circular(10), - bottomRight: Radius.circular(10)) - : const BorderRadius.only( - topLeft: Radius.circular(2), - topRight: Radius.circular(10), - bottomLeft: Radius.circular(10), - bottomRight: Radius.circular(10)); - final backgroundColor = isFromSelf - ? theme.lightPrimaryMaterialColor.shade50 - : theme.weakBackgroundColor; - return Container( - padding: textPadding ?? const EdgeInsets.all(10), - decoration: BoxDecoration( - color: messageBackgroundColor ?? backgroundColor, - borderRadius: messageBorderRadius ?? borderRadius, - ), - constraints: const BoxConstraints(maxWidth: 240), - child: Column( - children: [ - Text(TIM_t("自定义消息")) - ], - )); - } -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_face_elem.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_face_elem.dart deleted file mode 100644 index fd10412..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_face_elem.dart +++ /dev/null @@ -1,68 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/screen_utils.dart'; -import 'package:tencent_im_base/tencent_im_base.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_state.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/separate_models/tui_chat_separate_view_model.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitMessageItem/TIMUIKitMessageReaction/tim_uikit_message_reaction_wrapper.dart'; - -class TIMUIKitFaceElem extends StatefulWidget { - final String path; - final bool isShowJump; - final VoidCallback? clearJump; - final V2TimMessage message; - final bool? isShowMessageReaction; - final TUIChatSeparateViewModel model; - - const TIMUIKitFaceElem( - {Key? key, - required this.path, - required this.isShowJump, - this.clearJump, - required this.message, - this.isShowMessageReaction, - required this.model}) - : super(key: key); - - @override - State createState() => _TIMUIKitTextElemState(); -} - -class _TIMUIKitTextElemState extends TIMUIKitState { - - bool isFromNetwork() { - return widget.path.startsWith('http'); - } - - createPathFromNative(String path) { - String prefix = ""; - String suffix = ""; - if (widget.model.chatConfig.faceURIPrefix != null) { - prefix = widget.model.chatConfig.faceURIPrefix!(path); - } - if (widget.model.chatConfig.faceURISuffix != null) { - suffix = widget.model.chatConfig.faceURISuffix!(path); - } - return "$prefix$path$suffix"; - } - - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - final isDesktopScreen = TUIKitScreenUtils.getFormFactor(context) == DeviceType.Desktop; - return TIMUIKitMessageReactionWrapper( - chatModel: widget.model, - isShowJump: widget.isShowJump, - isFromSelf: widget.message.isSelf ?? true, - clearJump: widget.clearJump, - message: widget.message, - isShowMessageReaction: widget.isShowMessageReaction ?? true, - child: Container( - padding: const EdgeInsets.all(10), - constraints: - BoxConstraints(maxWidth: MediaQuery.of(context).size.width * (isDesktopScreen ? 0.1 : 0.3)), - child: isFromNetwork() - ? Image.network(widget.path) - : Image.asset(createPathFromNative(widget.path)), - )); - } -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_file_elem.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_file_elem.dart deleted file mode 100644 index f121465..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_file_elem.dart +++ /dev/null @@ -1,327 +0,0 @@ -// ignore_for_file: avoid_print - -import 'dart:io'; -import 'dart:math'; - -import 'package:device_info_plus/device_info_plus.dart'; -import 'package:flutter/material.dart'; -import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/permission.dart'; -import 'package:tencent_open_file/tencent_open_file.dart'; -import 'package:provider/provider.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_state.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/separate_models/tui_chat_separate_view_model.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_chat_global_model.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/services_locatar.dart'; - -import 'package:tencent_cloud_chat_uikit/ui/utils/platform.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitMessageItem/TIMUIKitMessageReaction/tim_uikit_message_reaction_wrapper.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_file_icon.dart'; -import 'package:tencent_cloud_chat_uikit/ui/widgets/textSize.dart'; -import 'package:url_launcher/url_launcher.dart'; - -class TIMUIKitFileElem extends StatefulWidget { - final String? messageID; - final V2TimFileElem? fileElem; - final bool isSelf; - final bool isShowJump; - final VoidCallback? clearJump; - final V2TimMessage message; - final bool? isShowMessageReaction; - final TUIChatSeparateViewModel chatModel; - - const TIMUIKitFileElem( - {Key? key, - required this.chatModel, - required this.messageID, - required this.fileElem, - required this.isSelf, - required this.isShowJump, - this.clearJump, - required this.message, - this.isShowMessageReaction}) - : super(key: key); - - @override - State createState() => _TIMUIKitFileElemState(); -} - -class _TIMUIKitFileElemState extends TIMUIKitState { - String filePath = ""; - bool isDownloading = false; - final TUIChatGlobalModel model = serviceLocator(); - - @override - void initState() { - super.initState(); - if (!PlatformUtils().isWeb) { - Future.delayed(const Duration(microseconds: 10), () { - hasFile(); - }); - } - } - - Future getSavePath() async { - String savePathWithAppPath = - '/storage/emulated/0/Android/data/com.tencent.flutter.tuikit/cache/' + - (widget.message.msgID ?? "") + - widget.fileElem!.fileName!; - return savePathWithAppPath; - } - - Future hasFile() async { - if (PlatformUtils().isWeb) { - return true; - } - - if (model.getMessageProgress(widget.messageID) == 100) { - String savePath = TencentUtils.checkString(widget.message.fileElem!.localUrl) ?? - model.getFileMessageLocation(widget.messageID); - File f = File(savePath); - if (f.existsSync() && widget.messageID != null) { - filePath = savePath; - return true; - } - return false; - } - String savePath = widget.message.fileElem!.localUrl ?? ''; - File f = File(savePath); - if (f.existsSync() && widget.messageID != null) { - filePath = savePath; - model.setMessageProgress(widget.messageID!, 100); - return true; - } - return false; - } - - String showFileSize(int fileSize) { - if (fileSize < 1024) { - return fileSize.toString() + "B"; - } else if (fileSize < 1024 * 1024) { - return (fileSize / 1024).toStringAsFixed(2) + "KB"; - } else if (fileSize < 1024 * 1024 * 1024) { - return (fileSize / 1024 / 1024).toStringAsFixed(2) + "MB"; - } else { - return (fileSize / 1024 / 1024 / 1024).toStringAsFixed(2) + "GB"; - } - } - - addUrlToWaitingPath() async { - if(widget.messageID !=null ){ - model.addWaitingList(widget.messageID!); - print("add path success"); - } - } - - checkIsWaiting() { - bool res = false; - try { - if (widget.messageID!.isNotEmpty) { - res = model.isWaiting(widget.messageID!); - } - } catch (err) { - // err - } - return res; - } - - downloadFile(TUITheme theme) async { - if(PlatformUtils().isMobile){ - if (PlatformUtils().isIOS) { - if (!await Permissions.checkPermission( - context, Permission.photosAddOnly.value, theme, false)) { - return; - } - } else { - final DeviceInfoPlugin deviceInfo = DeviceInfoPlugin(); - AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo; - if ((androidInfo.version.sdkInt ?? 0) >= 33) { - } else { - var storage = await Permissions.checkPermission( - context, Permission.storage.value, - ); - if(!storage){ - return; - } - } - } - } - await model.downloadFile(); - } - - tryOpenFile(context, theme) async { - if(PlatformUtils().isMobile){ - if (PlatformUtils().isIOS) { - if (!await Permissions.checkPermission( - context, Permission.photosAddOnly.value, theme!, false)) { - return; - } - } else { - final DeviceInfoPlugin deviceInfo = DeviceInfoPlugin(); - AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo; - if ((androidInfo.version.sdkInt ?? 0) >= 33) { - } else { - var storage = await Permissions.checkPermission( - context, Permission.storage.value, - ); - if(!storage){ - return; - } - } - } - } - - try { - if(PlatformUtils().isDesktop && !PlatformUtils().isWindows){ - launchUrl(Uri.file(filePath)); - }else{ - OpenFile.open(filePath); - } - // ignore: empty_catches - } catch (e) { - } - } - - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - final theme = value.theme; - return TIMUIKitMessageReactionWrapper( - chatModel: widget.chatModel, - isShowJump: widget.isShowJump, - clearJump: widget.clearJump, - isFromSelf: widget.message.isSelf ?? true, - isShowMessageReaction: widget.isShowMessageReaction ?? true, - message: widget.message, - child: ChangeNotifierProvider.value( - value: model, - child: - Consumer(builder: (context, value, child) { - final received = value.getMessageProgress(widget.messageID); - final fileName = widget.fileElem!.fileName ?? ""; - final fileSize = widget.fileElem!.fileSize; - final borderRadius = widget.isSelf - ? const BorderRadius.only( - topLeft: Radius.circular(10), - topRight: Radius.circular(2), - bottomLeft: Radius.circular(10), - bottomRight: Radius.circular(10)) - : const BorderRadius.only( - topLeft: Radius.circular(2), - topRight: Radius.circular(10), - bottomLeft: Radius.circular(10), - bottomRight: Radius.circular(10)); - String? fileFormat; - if (widget.fileElem?.fileName != null && - widget.fileElem!.fileName!.isNotEmpty) { - final String fileName = widget.fileElem!.fileName!; - fileFormat = - fileName.split(".")[max(fileName.split(".").length - 1, 0)]; - } - return InkWell( - onTap: () async { - if (PlatformUtils().isWeb) { - launchUrl( - Uri.parse(widget.fileElem?.path ?? ""), - mode: LaunchMode.externalApplication, - ); - return; - } - if (await hasFile()) { - if (received == 100) { - tryOpenFile(context, theme); - } else { - // 正在下载中,文件可能不完整 - onTIMCallback( - TIMCallback( - type: TIMCallbackType.INFO, - infoRecommendText: TIM_t("正在下载中"), - infoCode: 6660411, - ), - ); - } - return; - } - - if (checkIsWaiting()) { - onTIMCallback( - TIMCallback( - type: TIMCallbackType.INFO, - infoRecommendText: TIM_t("已加入待下载队列,其他文件下载中"), - infoCode: 6660413), - ); - return; - } else { - await addUrlToWaitingPath(); - } - await downloadFile(theme); - }, - child: Container( - width: 237, - decoration: BoxDecoration( - border: Border.all( - color: theme.weakDividerColor ?? - CommonColor.weakDividerColor, - ), - borderRadius: borderRadius), - child: Stack(children: [ - ClipRRect( - //剪裁为圆角矩形 - borderRadius: borderRadius, - child: LinearProgressIndicator( - minHeight: 66, - value: (received == 100 ? 0 : received) / 100, - backgroundColor: received == 100 - ? theme.weakBackgroundColor - : Colors.white, - valueColor: AlwaysStoppedAnimation( - theme.lightPrimaryMaterialColor.shade50)), - ), - Padding( - padding: const EdgeInsets.symmetric( - vertical: 8, horizontal: 12), - child: Row( - mainAxisAlignment: widget.isSelf - ? MainAxisAlignment.end - : MainAxisAlignment.start, - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - constraints: - const BoxConstraints(maxWidth: 160), - child: LayoutBuilder( - builder: - (buildContext, boxConstraints) { - return CustomText( - fileName, - width: boxConstraints.maxWidth, - style: TextStyle( - color: theme.darkTextColor, - fontSize: 16, - ), - ); - }, - ), - ), - if (fileSize != null) - Text( - showFileSize(fileSize), - // "${received > 0 ? (received / 1024).ceil() : (received / 1024).ceil()} KB", - style: TextStyle( - fontSize: 14, - color: theme.weakTextColor), - ) - ], - )), - TIMUIKitFileIcon( - fileFormat: fileFormat, - ), - ])), - ]), - )); - }))); - } -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_file_icon.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_file_icon.dart deleted file mode 100644 index e2853cb..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_file_icon.dart +++ /dev/null @@ -1,60 +0,0 @@ -// ignore_for_file: must_be_immutable - -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_statelesswidget.dart'; - -class TIMUIKitFileIcon extends TIMUIKitStatelessWidget { - final String? fileFormat; - final double? size; - - TIMUIKitFileIcon( {this.size, this.fileFormat, Key? key}) : super(key: key); - - Map fileMap = { - "doc": "images/word.png", - "docx": "images/word.png", - "ppt": "images/ppt.png", - "pptx": "images/ppt.png", - "xls": "images/excel.png", - "xlsx": "images/excel.png", - "pdf": "images/pdf.png", - "zip": "images/zip.png", - "rar": "images/zip.png", - "7z": "images/zip.png", - "tar": "images/zip.png", - "gz": "images/zip.png", - "xz": "images/zip.png", - "bz2": "images/zip.png", - "txt": "images/txt.png", - "jpg": "images/image_icon.png", - "bmp": "images/image_icon.png", - "gif": "images/image_icon.png", - "png": "images/image_icon.png", - "jpeg": "images/image_icon.png", - "tif": "images/image_icon.png", - "wmf": "images/image_icon.png", - "dib": "images/image_icon.png", - "mp4": "images/video_icon.png", - "avi": "images/video_icon.png", - "mov": "images/video_icon.png", - "wmv": "images/video_icon.png", - "flv": "images/video_icon.png", - }; - - Widget _getFileIcon() { - return Image.asset( - fileMap[fileFormat?.toLowerCase()] ?? "images/unknown.png", - package: 'tencent_cloud_chat_uikit', - ); - } - - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - return SizedBox( - height: size ?? 50, - width: size ?? 50, - child: Container(padding: const EdgeInsets.all(4), child: _getFileIcon()), - ); - } -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_group_tips_elem.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_group_tips_elem.dart deleted file mode 100644 index 3e386d8..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_group_tips_elem.dart +++ /dev/null @@ -1,51 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_state.dart'; -import 'package:tencent_im_base/tencent_im_base.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/message.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart'; - -class TIMUIKitGroupTipsElem extends StatefulWidget { - final V2TimGroupTipsElem groupTipsElem; - final List groupMemberList; - - const TIMUIKitGroupTipsElem({Key? key, required this.groupMemberList, required this.groupTipsElem}) - : super(key: key); - - @override - State createState() => _TIMUIKitGroupTipsElemState(); -} - -class _TIMUIKitGroupTipsElemState extends TIMUIKitState { - - String groupTipsAbstractText = ""; - - @override - void initState() { - super.initState(); - getText(); - } - - void getText() async { - final newText = await MessageUtils.groupTipsMessageAbstract(widget.groupTipsElem, widget.groupMemberList); - setState(() { - groupTipsAbstractText = newText; - }); - } - - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - final TUITheme theme = value.theme; - - return MessageUtils.wrapMessageTips( - Text( - groupTipsAbstractText, - softWrap: true, - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.w400, - color: hexToColor("888888")), - ), - theme); - } -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_image_elem.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_image_elem.dart deleted file mode 100644 index 2b1eed1..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_image_elem.dart +++ /dev/null @@ -1,630 +0,0 @@ -// ignore_for_file: prefer_typing_uninitialized_variables, unused_import - -import 'dart:async'; -import 'dart:convert'; -import 'package:crypto/crypto.dart'; -import 'package:device_info_plus/device_info_plus.dart'; -import 'package:http/http.dart' as http; -import 'package:tencent_cloud_chat_uikit/business_logic/separate_models/tui_chat_separate_view_model.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/message/message_services.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/screen_utils.dart'; -import 'package:tencent_open_file/tencent_open_file.dart'; -import 'package:universal_html/html.dart' as html; -import 'dart:io'; -import 'dart:math'; -import 'dart:typed_data'; -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:flutter/material.dart'; -import 'package:loading_animation_widget/loading_animation_widget.dart'; -import 'package:path_provider/path_provider.dart'; -import 'package:provider/provider.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_state.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_chat_global_model.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/services_locatar.dart'; -import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; -import 'package:tencent_cloud_chat_uikit/ui/constants/history_message_constant.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/message.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/permission.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/platform.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitMessageItem/TIMUIKitMessageReaction/tim_uikit_message_reaction_wrapper.dart'; -import 'package:tencent_cloud_chat_uikit/ui/widgets/image_screen.dart'; -import 'package:transparent_image/transparent_image.dart'; -import 'package:image_gallery_saver/image_gallery_saver.dart'; -import 'package:url_launcher/url_launcher.dart'; - -class TIMUIKitImageElem extends StatefulWidget { - final V2TimMessage message; - final bool isShowJump; - final VoidCallback? clearJump; - final String? isFrom; - final bool? isShowMessageReaction; - final TUIChatSeparateViewModel chatModel; - - const TIMUIKitImageElem( - {required this.message, - this.isShowJump = false, - required this.chatModel, - this.clearJump, - this.isFrom, - Key? key, - this.isShowMessageReaction}) - : super(key: key); - - @override - State createState() => _TIMUIKitImageElem(); -} - -class _TIMUIKitImageElem extends TIMUIKitState { - double? networkImagePositionRadio; // 加这个字段用于异步获取被安全打击后的兜底图的比例 - final TUIChatGlobalModel model = serviceLocator(); - final MessageService _messageService = serviceLocator(); - Widget? imageItem; - bool isSent = false; - - @override - didUpdateWidget(oldWidget) { - super.didUpdateWidget(oldWidget); - } - - String getBigPicUrl() { - // 实际拿的是原图 - V2TimImage? img = MessageUtils.getImageFromImgList( - widget.message.imageElem!.imageList, - HistoryMessageDartConstant.oriImgPrior); - return img == null ? widget.message.imageElem!.path! : img.url!; - } - - Widget errorDisplay(BuildContext context, TUITheme? theme) { - return Container( - decoration: BoxDecoration( - borderRadius: const BorderRadius.all(Radius.circular(5)), - border: Border.all( - width: 2, - color: theme?.weakDividerColor ?? Colors.grey, - )), - height: 170, - width: 170, - child: Center( - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - LoadingAnimationWidget.staggeredDotsWave( - color: theme?.weakTextColor ?? Colors.grey, - size: 28, - ) - ], - ), - ), - ); - } - - Widget getImage(image, {imageElem}) { - Widget res = ClipRRect( - clipper: ImageClipper(), - child: image, - ); - - return res; - } - - //保存网络图片到本地 - Future _saveImageToLocal( - context, - String imageUrl, { - bool isAsset = true, - TUITheme? theme, - }) async { - if (PlatformUtils().isWeb) { - download(imageUrl) async { - final http.Response r = await http.get(Uri.parse(imageUrl)); - final data = r.bodyBytes; - final base64data = base64Encode(data); - final a = - html.AnchorElement(href: 'data:image/jpeg;base64,$base64data'); - a.download = md5.convert(utf8.encode(imageUrl)).toString(); - a.click(); - a.remove(); - } - - download(imageUrl); - return; - } - - if (PlatformUtils().isIOS) { - if (!await Permissions.checkPermission( - context, Permission.photosAddOnly.value, theme!, false)) { - return; - } - } else { - final DeviceInfoPlugin deviceInfo = DeviceInfoPlugin(); - AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo; - if (PlatformUtils().isMobile) { - if ((androidInfo.version.sdkInt ?? 0) >= 33) { - final photos = await Permissions.checkPermission( - context, - Permission.photos.value, - theme, - ); - if (!photos) { - return; - } - } else { - final storage = await Permissions.checkPermission( - context, - Permission.storage.value, - ); - if (!storage) { - return; - } - } - } - } - - // 本地资源的情况下 - if (!isAsset) { - if (widget.message.msgID == null || widget.message.msgID!.isEmpty) { - return; - } - - if (model.getMessageProgress(widget.message.msgID) == 100) { - String savePath; - if (widget.message.imageElem!.path != null && - widget.message.imageElem!.path != '') { - savePath = widget.message.imageElem!.path!; - } else { - savePath = model.getFileMessageLocation(widget.message.msgID); - } - File f = File(savePath); - if (f.existsSync()) { - var result = await ImageGallerySaver.saveFile(savePath); - - if (PlatformUtils().isIOS) { - if (result['isSuccess']) { - onTIMCallback(TIMCallback( - type: TIMCallbackType.INFO, - infoRecommendText: TIM_t("图片保存成功"), - infoCode: 6660406)); - } else { - onTIMCallback(TIMCallback( - type: TIMCallbackType.INFO, - infoRecommendText: TIM_t("图片保存失败"), - infoCode: 6660407)); - } - } else { - if (result != null) { - onTIMCallback(TIMCallback( - type: TIMCallbackType.INFO, - infoRecommendText: TIM_t("图片保存成功"), - infoCode: 6660406)); - } else { - onTIMCallback(TIMCallback( - type: TIMCallbackType.INFO, - infoRecommendText: TIM_t("图片保存失败"), - infoCode: 6660407)); - } - } - return; - } - } else { - onTIMCallback(TIMCallback( - type: TIMCallbackType.INFO, - infoRecommendText: TIM_t("the message is downloading"), - infoCode: -1)); - } - return; - } - // model.setMessageProgress(widget.message.msgID!, 0); - // var result = - // await ImageGallerySaver.saveImage(Uint8List.fromList(response)); - - var result = await ImageGallerySaver.saveFile(imageUrl); - - if (PlatformUtils().isIOS) { - if (result['isSuccess']) { - onTIMCallback(TIMCallback( - type: TIMCallbackType.INFO, - infoRecommendText: TIM_t("图片保存成功"), - infoCode: 6660406)); - } else { - onTIMCallback(TIMCallback( - type: TIMCallbackType.INFO, - infoRecommendText: TIM_t("图片保存失败"), - infoCode: 6660407)); - } - } else { - if (result != null) { - onTIMCallback(TIMCallback( - type: TIMCallbackType.INFO, - infoRecommendText: TIM_t("图片保存成功"), - infoCode: 6660406)); - } else { - onTIMCallback(TIMCallback( - type: TIMCallbackType.INFO, - infoRecommendText: TIM_t("图片保存失败"), - infoCode: 6660407)); - } - } - return; - } - - Future _saveImg(TUITheme theme) async { - String? path = widget.message.imageElem!.path; - if (path != null && PlatformUtils().isWeb - ? true - : File(path!).existsSync()) { - return await _saveImageToLocal(context, path, - isAsset: true, theme: theme); - } else { - String imgUrl = getBigPicUrl(); - if (widget.message.imageElem!.imageList![0]!.localUrl != '' && - widget.message.imageElem!.imageList![0]!.localUrl != null) { - File f = File(widget.message.imageElem!.imageList![0]!.localUrl!); - if (f.existsSync()) { - return await _saveImageToLocal( - context, - widget.message.imageElem!.imageList![0]!.localUrl!, - isAsset: true, - theme: theme, - ); - } - } - if (widget.message.imageElem!.path != '' && - widget.message.imageElem!.path != null) { - File f = File(widget.message.imageElem!.path!); - if (f.existsSync()) { - return await _saveImageToLocal( - context, - widget.message.imageElem!.path!, - isAsset: true, - theme: theme, - ); - } - } - return await _saveImageToLocal( - context, - imgUrl, - isAsset: false, - theme: theme, - ); - } - } - - V2TimImage? getImageFromList(V2TimImageTypesEnum imgType) { - V2TimImage? img = MessageUtils.getImageFromImgList( - widget.message.imageElem!.imageList, - HistoryMessageDartConstant.imgPriorMap[imgType] ?? - HistoryMessageDartConstant.oriImgPrior); - - return img; - } - - Widget errorPage(theme) => Container( - height: MediaQuery.of(context).size.height, - color: theme.black, - child: GestureDetector( - onTap: () { - Navigator.of(context).pop(); - }, - child: errorDisplay(context, theme), - )); - - Widget _renderLocalImage(String smallImage, dynamic heroTag, - double? positionRadio, TUITheme? theme, String? originImage) { - double? currentPositionRadio = positionRadio; - File imgF = File(smallImage); - - bool isExist = imgF.existsSync(); - if (!isExist) { - return errorDisplay(context, theme); - } - - Image image = Image.file(imgF); - - String showImage = (originImage != null && File(originImage).existsSync()) - ? originImage - : smallImage; - - image.image - .resolve(const ImageConfiguration()) - .addListener(ImageStreamListener((image, synchronousCall) { - if (image.image.width != 0 && image.image.height != 0) { - currentPositionRadio = image.image.width / image.image.height; - } - })); - final message = widget.message; - final preloadImage = model.preloadImageMap[ - message.seq! + message.timestamp.toString() + (message.msgID ?? "")]; - - final isDesktopScreen = - TUIKitScreenUtils.getFormFactor(context) == DeviceType.Desktop; - - return Stack( - alignment: AlignmentDirectional.topStart, - children: [ - if (!isDesktopScreen && currentPositionRadio != null) - AspectRatio( - aspectRatio: currentPositionRadio!, - child: Container( - decoration: const BoxDecoration(color: Colors.transparent), - ), - ), - getImage( - InkWell( - onTap: () { - if (PlatformUtils().isDesktop) { - if(PlatformUtils().isWindows){ - OpenFile.open(showImage); - } else{ - launchUrl(Uri.file(showImage)); - } - } else { - Navigator.of(context).push( - PageRouteBuilder( - opaque: false, // set to false - pageBuilder: (_, __, ___) => ImageScreen( - imageProvider: FileImage(File(showImage)), - heroTag: heroTag, - messageID: widget.message.msgID, - downloadFn: () async { - return await _saveImg(theme!); - }), - ), - ); - } - }, - child: Container( - constraints: - const BoxConstraints(minWidth: 20, minHeight: 20), - child: Hero( - tag: heroTag, - child: preloadImage != null - ? RawImage( - image: preloadImage, - fit: BoxFit.contain, - ) - : Image.file( - File(smallImage), - fit: BoxFit.contain, - ), - ), - )), - imageElem: null) - ], - ); - } - - @override - void initState() { - super.initState(); - if (!PlatformUtils().isWeb) { - if ((widget.message.msgID != null && widget.message.msgID != '') && - (widget.message.imageElem!.imageList![0]!.localUrl == null || - widget.message.imageElem!.imageList![0]!.localUrl!.isEmpty)) { - _messageService.downloadMessage( - msgID: widget.message.msgID!, - messageType: 3, - imageType: 0, - isSnapshot: false); - _messageService.downloadMessage( - msgID: widget.message.msgID!, - messageType: 3, - imageType: 1, - isSnapshot: false); - _messageService.downloadMessage( - msgID: widget.message.msgID!, - messageType: 3, - imageType: 2, - isSnapshot: false); - } - } - // 先暂时下掉用网络图片计算尺寸比例的feature,在没有找到准确的判断图片是否被打击前 - // setOnlineImageRatio(); - } - - void setOnlineImageRatio() { - if (networkImagePositionRadio == null) { - V2TimImage? smallImg = getImageFromList(V2TimImageTypesEnum.small); - V2TimImage? originalImg = getImageFromList(V2TimImageTypesEnum.original); - Image image = Image.network(smallImg?.url ?? originalImg?.url ?? ""); - - image.image - .resolve(const ImageConfiguration()) - .addListener(ImageStreamListener((ImageInfo info, bool _) { - if (info.image.width != 0 && info.image.height != 0) { - setState(() { - networkImagePositionRadio = (info.image.width / info.image.height); - }); - } - })); - } - } - - Widget _renderNetworkImage( - dynamic heroTag, double? positionRadio, TUITheme? theme, - {String? path, V2TimImage? originalImg, V2TimImage? smallImg}) { - try { - final isDesktopScreen = - TUIKitScreenUtils.getFormFactor(context) == DeviceType.Desktop; - String bigImgUrl = originalImg?.url ?? getBigPicUrl(); - if (bigImgUrl.isEmpty && smallImg?.url != null) { - bigImgUrl = smallImg!.url!; - } - return Stack( - alignment: widget.message.isSelf ?? true - ? AlignmentDirectional.topEnd - : AlignmentDirectional.topStart, - children: [ - getImage( - GestureDetector( - onTap: () { - if (isDesktopScreen) { - onTIMCallback(TIMCallback( - infoCode: 6660414, - infoRecommendText: TIM_t("正在下载中"), - type: TIMCallbackType.INFO - )); - } else { - Navigator.of(context).push( - PageRouteBuilder( - opaque: false, // set to false - pageBuilder: (_, __, ___) => ImageScreen( - imageProvider: CachedNetworkImageProvider( - path ?? bigImgUrl, - cacheKey: widget.message.msgID, - ), - heroTag: heroTag, - messageID: widget.message.msgID, - downloadFn: () async { - return await _saveImg(theme!); - })), - ); - } - }, - child: Container( - constraints: - const BoxConstraints(minWidth: 20, minHeight: 20), - child: Hero( - tag: heroTag, - child: PlatformUtils().isWeb - ? Image.network( - path ?? smallImg?.url ?? originalImg!.url!, - fit: BoxFit.contain) - : - // Image.network(smallImg?.url ?? ""), - CachedNetworkImage( - // width: double.infinity, - alignment: Alignment.topCenter, - imageUrl: - path ?? smallImg?.url ?? originalImg!.url!, - // use small image in message list as priority - errorWidget: (context, error, stackTrace) => - errorPage(theme), - fit: BoxFit.contain, - cacheKey: smallImg?.uuid ?? originalImg!.uuid, - placeholder: (context, url) => - Image(image: MemoryImage(kTransparentImage)), - fadeInDuration: const Duration(milliseconds: 0), - )), - ), - ), - imageElem: e) - ], - ); - } catch (e) { - return errorDisplay(context, theme); - } - } - - bool isNeedShowLocalPath() { - final current = (DateTime.now().millisecondsSinceEpoch / 1000).ceil(); - final timeStamp = widget.message.timestamp ?? current; - return (widget.message.isSelf ?? true) && - (isSent || current - timeStamp < 300); - } - - Widget? _renderImage(dynamic heroTag, TUITheme? theme, - {V2TimImage? originalImg, V2TimImage? smallImg}) { - double? positionRadio; - if (smallImg?.width != null && - smallImg?.height != null && - smallImg?.width != 0 && - smallImg?.height != 0) { - positionRadio = (smallImg!.width! / smallImg.height!); - } - - if (PlatformUtils().isWeb && widget.message.imageElem!.path != null) { - // Displaying on Web only - return _renderNetworkImage(heroTag, positionRadio, theme, - smallImg: smallImg, - originalImg: originalImg, - path: widget.message.imageElem!.path); - } - - try { - if ((isNeedShowLocalPath() && - widget.message.imageElem!.path != null && - widget.message.imageElem!.path!.isNotEmpty && - File(widget.message.imageElem!.path!).existsSync())) { - return _renderLocalImage( - widget.message.imageElem!.path!, - heroTag, - networkImagePositionRadio ?? positionRadio, - theme, - widget.message.imageElem!.path!); - } - } catch (e) { - // ignore: avoid_print - print(e); - } - - try { - if (smallImg?.localUrl != null && - smallImg?.localUrl != "" && - File((smallImg?.localUrl!)!).existsSync()) { - return _renderLocalImage(smallImg!.localUrl!, heroTag, positionRadio, - theme, originalImg?.localUrl); - } - } catch (e) { - // ignore: avoid_print - print(e); - return _renderNetworkImage(heroTag, positionRadio, theme, - smallImg: smallImg, originalImg: originalImg); - } - - if ( - (smallImg?.url ?? originalImg?.url) != null && - (smallImg?.url ?? originalImg?.url)!.isNotEmpty) { - return _renderNetworkImage(heroTag, positionRadio, theme, - smallImg: smallImg, originalImg: originalImg); - } - - return errorDisplay(context, theme); - } - - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - final theme = value.theme; - if (widget.message.status == MessageStatus.V2TIM_MSG_STATUS_SENDING) { - isSent = true; - } - final heroTag = - "${widget.message.msgID ?? widget.message.id ?? widget.message.timestamp ?? DateTime.now().millisecondsSinceEpoch}${widget.isFrom}"; - - V2TimImage? originalImg = getImageFromList(V2TimImageTypesEnum.original); - V2TimImage? smallImg = getImageFromList(V2TimImageTypesEnum.small); - return TIMUIKitMessageReactionWrapper( - chatModel: widget.chatModel, - isShowJump: widget.isShowJump, - clearJump: widget.clearJump, - isFromSelf: widget.message.isSelf ?? true, - isShowMessageReaction: widget.isShowMessageReaction ?? true, - message: widget.message, - child: LayoutBuilder( - builder: (BuildContext context, BoxConstraints constraints) { - return ConstrainedBox( - constraints: BoxConstraints( - maxWidth: constraints.maxWidth * 0.5, - minWidth: 64, - maxHeight: 256, - ), - child: _renderImage(heroTag, theme, - originalImg: originalImg, smallImg: smallImg), - ); - })); - } -} - -class ImageClipper extends CustomClipper { - @override - RRect getClip(Size size) { - return RRect.fromRectAndRadius( - Rect.fromLTWH(0, 0, size.width, min(size.height, 256)), - const Radius.circular(5)); - } - - @override - bool shouldReclip(CustomClipper oldClipper) { - return oldClipper != this; - } -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_reply_elem.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_reply_elem.dart deleted file mode 100644 index fb8c83a..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_reply_elem.dart +++ /dev/null @@ -1,382 +0,0 @@ -// ignore_for_file: unused_import - -import 'dart:async'; -import 'dart:convert'; -import 'package:flutter/material.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/common_utils.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/screen_utils.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitTextField/special_text/DefaultSpecialTextSpanBuilder.dart'; -import 'package:tencent_extended_text/extended_text.dart'; -import 'package:tencent_im_base/tencent_im_base.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_state.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/separate_models/tui_chat_separate_view_model.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_chat_global_model.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/services_locatar.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitMessageItem/TIMUIKitMessageReaction/tim_uikit_message_reaction_show_panel.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitMessageItem/main.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_face_elem.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/tim_uikit_chat_config.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/tim_uikit_cloud_custom_data.dart'; -import 'package:tencent_cloud_chat_uikit/ui/widgets/link_preview/link_preview_entry.dart'; -import 'package:tencent_cloud_chat_uikit/ui/widgets/link_preview/models/link_preview_content.dart'; -import 'package:tencent_cloud_chat_uikit/ui/widgets/link_preview/widgets/link_preview.dart'; - -class TIMUIKitReplyElem extends StatefulWidget { - final V2TimMessage message; - final Function scrollToIndex; - final bool isShowJump; - final VoidCallback clearJump; - final TextStyle? fontStyle; - final BorderRadius? borderRadius; - final Color? backgroundColor; - final EdgeInsetsGeometry? textPadding; - final TUIChatSeparateViewModel chatModel; - final bool? isShowMessageReaction; - final bool isUseDefaultEmoji; - final List customEmojiStickerList; - - const TIMUIKitReplyElem({ - Key? key, - required this.message, - required this.scrollToIndex, - this.isShowJump = false, - required this.clearJump, - this.fontStyle, - this.borderRadius, - this.isShowMessageReaction, - this.backgroundColor, - this.textPadding, - this.isUseDefaultEmoji = false, - this.customEmojiStickerList = const [], - required this.chatModel, - }) : super(key: key); - - @override - State createState() => _TIMUIKitReplyElemState(); -} - -class _TIMUIKitReplyElemState extends TIMUIKitState { - MessageRepliedData? repliedMessage; - V2TimMessage? rawMessage; - bool isShowJumpState = false; - bool isShining = false; - - MessageRepliedData? _getRepliedMessage() { - try { - final CloudCustomData messageCloudCustomData = CloudCustomData.fromJson( - json.decode( - TencentUtils.checkString(widget.message.cloudCustomData) != null - ? widget.message.cloudCustomData! - : "{}")); - if (messageCloudCustomData.messageReply != null) { - final MessageRepliedData repliedMessage = - MessageRepliedData.fromJson(messageCloudCustomData.messageReply!); - return repliedMessage; - } - return null; - } catch (error) { - return null; - } - } - - _getMessageByMessageID() async { - final cloudCustomData = _getRepliedMessage(); - if (cloudCustomData != null) { - final messageID = cloudCustomData.messageID; - final message = await widget.chatModel.findMessage(messageID); - if (message != null) { - if (mounted) { - setState(() { - rawMessage = message; - }); - } - } - } - if (mounted) { - setState(() { - repliedMessage = cloudCustomData; - }); - } - } - - Widget _defaultRawMessageText(String text, TUITheme? theme) { - return Text(text, - style: TextStyle( - fontSize: 12, - color: theme?.weakTextColor, - fontWeight: FontWeight.w400)); - } - - _rawMessageBuilder(V2TimMessage? message, TUITheme? theme) { - if (repliedMessage == null) { - return const SizedBox(width: 0, height: 12); - } - if (message == null) { - if (repliedMessage?.messageAbstract != null) { - return _defaultRawMessageText(repliedMessage!.messageAbstract, theme); - } - return const SizedBox(width: 0, height: 12); - } - final messageType = message.elemType; - final isSelf = message.isSelf ?? true; - if (widget.chatModel.abstractMessageBuilder != null) { - return _defaultRawMessageText( - widget.chatModel.abstractMessageBuilder!(message), - theme, - ); - } - switch (messageType) { - case MessageElemType.V2TIM_ELEM_TYPE_CUSTOM: - return _defaultRawMessageText(TIM_t("[自定义]"), theme); - case MessageElemType.V2TIM_ELEM_TYPE_SOUND: - return _defaultRawMessageText(TIM_t("[语音消息]"), theme); - case MessageElemType.V2TIM_ELEM_TYPE_TEXT: - return _defaultRawMessageText(message.textElem?.text ?? "", theme); - case MessageElemType.V2TIM_ELEM_TYPE_FACE: - return TIMUIKitFaceElem( - model: widget.chatModel, - isShowJump: false, - isShowMessageReaction: false, - path: message.faceElem!.data ?? "", - message: message, - ); - case MessageElemType.V2TIM_ELEM_TYPE_FILE: - return TIMUIKitFileElem( - chatModel: widget.chatModel, - isShowMessageReaction: false, - message: message, - messageID: message.msgID, - fileElem: message.fileElem, - isSelf: isSelf, - isShowJump: false); - case MessageElemType.V2TIM_ELEM_TYPE_IMAGE: - return TIMUIKitImageElem( - chatModel: widget.chatModel, - message: message, - isFrom: "reply", - isShowMessageReaction: false); - case MessageElemType.V2TIM_ELEM_TYPE_VIDEO: - return TIMUIKitVideoElem(message, - chatModel: widget.chatModel, - isFrom: "reply", - isShowMessageReaction: false); - case MessageElemType.V2TIM_ELEM_TYPE_LOCATION: - return _defaultRawMessageText(TIM_t("[位置]"), theme); - case MessageElemType.V2TIM_ELEM_TYPE_MERGER: - return TIMUIKitMergerElem( - model: widget.chatModel, - isShowJump: false, - isShowMessageReaction: false, - message: message, - mergerElem: message.mergerElem!, - messageID: message.msgID ?? "", - isSelf: isSelf); - default: - return _defaultRawMessageText(TIM_t("[未知消息]"), theme); - } - } - - @override - void initState() { - _getMessageByMessageID(); - super.initState(); - } - - @override - void didUpdateWidget(covariant TIMUIKitReplyElem oldWidget) { - WidgetsBinding.instance.addPostFrameCallback((mag) { - super.didUpdateWidget(oldWidget); - _getMessageByMessageID(); - }); - } - - _showJumpColor() { - if ((widget.chatModel.jumpMsgID != widget.message.msgID) && - (widget.message.msgID?.isNotEmpty ?? true)) { - return; - } - isShining = true; - int shineAmount = 6; - setState(() { - isShowJumpState = true; - }); - Timer.periodic(const Duration(milliseconds: 300), (timer) { - if (mounted) { - setState(() { - isShowJumpState = shineAmount.isOdd ? true : false; - }); - } - if (shineAmount == 0 || !mounted) { - isShining = false; - timer.cancel(); - } - shineAmount--; - }); - widget.clearJump(); - } - - void _jumpToRawMsg() { - if (rawMessage?.timestamp != null) { - widget.scrollToIndex(rawMessage); - } else { - onTIMCallback(TIMCallback( - type: TIMCallbackType.INFO, - infoRecommendText: TIM_t("无法定位到原消息"), - infoCode: 6660401)); - } - } - - Widget? _renderPreviewWidget() { - // If the link preview info from [localCustomData] is available, use it to render the preview card. - // Otherwise, it will returns null. - if (widget.message.localCustomData != null && - widget.message.localCustomData!.isNotEmpty) { - try { - final String localJSON = widget.message.localCustomData!; - final LocalCustomDataModel? localPreviewInfo = - LocalCustomDataModel.fromMap(json.decode(localJSON)); - if (localPreviewInfo != null && - !localPreviewInfo.isLinkPreviewEmpty()) { - return Container( - margin: const EdgeInsets.only(top: 8), - child: - // You can use this default widget [LinkPreviewWidget] to render preview card, or you can use custom widget. - LinkPreviewWidget(linkPreview: localPreviewInfo), - ); - } else { - return null; - } - } catch (e) { - return null; - } - } else { - return null; - } - } - - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - final theme = value.theme; - final isDesktopScreen = - TUIKitScreenUtils.getFormFactor(context) == DeviceType.Desktop; - if (widget.isShowJump) { - if (!isShining) { - Future.delayed(Duration.zero, () { - _showJumpColor(); - }); - } else { - if ((widget.chatModel.jumpMsgID == widget.message.msgID) && - (widget.message.msgID?.isNotEmpty ?? false)) { - widget.clearJump(); - } - } - } - - final isFromSelf = widget.message.isSelf ?? true; - - final defaultStyle = isFromSelf - ? (theme.chatMessageItemFromSelfBgColor ?? - theme.lightPrimaryMaterialColor.shade50) - : (theme.chatMessageItemFromOthersBgColor); - - final backgroundColor = isShowJumpState - ? const Color.fromRGBO(245, 166, 35, 1) - : (defaultStyle ?? widget.backgroundColor); - - final borderRadius = isFromSelf - ? const BorderRadius.only( - topLeft: Radius.circular(10), - topRight: Radius.circular(2), - bottomLeft: Radius.circular(10), - bottomRight: Radius.circular(10)) - : const BorderRadius.only( - topLeft: Radius.circular(2), - topRight: Radius.circular(10), - bottomLeft: Radius.circular(10), - bottomRight: Radius.circular(10)); - final textWithLink = LinkPreviewEntry.getHyperlinksText( - widget.message.textElem?.text ?? "", - widget.chatModel.chatConfig.isSupportMarkdownForTextMessage, - onLinkTap: widget.chatModel.chatConfig.onTapLink, - isUseDefaultEmoji: widget.isUseDefaultEmoji, - customEmojiStickerList: widget.customEmojiStickerList, - isEnableTextSelection: - widget.chatModel.chatConfig.isEnableTextSelection); - return Container( - padding: widget.textPadding ?? EdgeInsets.all(isDesktopScreen ? 12 : 10), - decoration: BoxDecoration( - color: backgroundColor, - borderRadius: widget.borderRadius ?? borderRadius, - ), - constraints: - BoxConstraints(maxWidth: MediaQuery.of(context).size.width * 0.6), - child: GestureDetector( - onTap: _jumpToRawMsg, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - // 这里是引用的部分 - padding: const EdgeInsets.symmetric(vertical: 3, horizontal: 6), - constraints: const BoxConstraints(minWidth: 120), - decoration: const BoxDecoration( - color: Color.fromRGBO(68, 68, 68, 0.05), - border: Border( - left: BorderSide( - color: Color.fromRGBO(68, 68, 68, 0.1), width: 2))), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - repliedMessage != null - ? "${repliedMessage!.messageSender}:" - : "", - style: TextStyle( - fontSize: 12, - color: theme.weakTextColor, - fontWeight: FontWeight.w500), - ), - const SizedBox( - height: 4, - ), - _rawMessageBuilder(rawMessage, theme) - ], - ), - ), - const SizedBox( - height: 12, - ), - // If the [elemType] is text message, it will not be null here. - // You can render the widget from extension directly, with a [TextStyle] optionally. - widget.chatModel.chatConfig.urlPreviewType != UrlPreviewType.none - ? textWithLink!( - style: widget.fontStyle ?? - TextStyle( - fontSize: isDesktopScreen ? 14 : 16, - textBaseline: TextBaseline.ideographic, - height: widget.chatModel.chatConfig.textHeight)) - : ExtendedText(widget.message.textElem?.text ?? "", - softWrap: true, - style: widget.fontStyle ?? - TextStyle( - fontSize: isDesktopScreen ? 14 : 16, - height: widget.chatModel.chatConfig.textHeight), - specialTextSpanBuilder: DefaultSpecialTextSpanBuilder( - isUseDefaultEmoji: widget.isUseDefaultEmoji, - customEmojiStickerList: widget.customEmojiStickerList, - showAtBackground: true, - )), - // If the link preview info is available, render the preview card. - if (_renderPreviewWidget() != null && - widget.chatModel.chatConfig.urlPreviewType == - UrlPreviewType.previewCardAndHyperlink) - _renderPreviewWidget()!, - if (widget.isShowMessageReaction ?? true) - TIMUIKitMessageReactionShowPanel(message: widget.message) - ], - ), - ), - ); - } -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_sound_elem.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_sound_elem.dart deleted file mode 100644 index d3ab96e..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_sound_elem.dart +++ /dev/null @@ -1,281 +0,0 @@ - -import 'dart:async'; -import 'dart:math'; -import 'package:audioplayers/audioplayers.dart'; -import 'package:flutter/material.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_state.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/separate_models/tui_chat_separate_view_model.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_chat_global_model.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/message/message_services.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/services_locatar.dart'; -import 'package:tencent_cloud_chat_uikit/ui/constants/history_message_constant.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/platform.dart'; -import 'package:tencent_im_base/tencent_im_base.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/sound_record.dart'; -import 'TIMUIKitMessageReaction/tim_uikit_message_reaction_show_panel.dart'; - -class TIMUIKitSoundElem extends StatefulWidget { - final V2TimMessage message; - final V2TimSoundElem soundElem; - final String msgID; - final bool isFromSelf; - final int? localCustomInt; - final bool isShowJump; - final VoidCallback? clearJump; - final TextStyle? fontStyle; - final BorderRadius? borderRadius; - final Color? backgroundColor; - final EdgeInsetsGeometry? textPadding; - final bool? isShowMessageReaction; - final TUIChatSeparateViewModel chatModel; - - const TIMUIKitSoundElem( - {Key? key, - required this.soundElem, - required this.msgID, - required this.isFromSelf, - this.isShowJump = false, - this.clearJump, - this.localCustomInt, - this.fontStyle, - this.borderRadius, - this.backgroundColor, - this.textPadding, - required this.message, - this.isShowMessageReaction, - required this.chatModel}) - : super(key: key); - - @override - State createState() => _TIMUIKitSoundElemState(); -} - -class _TIMUIKitSoundElemState extends TIMUIKitState { - final int charLen = 8; - bool isPlaying = false; - StreamSubscription? subscription; - bool isShowJumpState = false; - bool isShining = false; - final TUIChatGlobalModel globalModel = serviceLocator(); - final MessageService _messageService = serviceLocator(); - late V2TimSoundElem stateElement = widget.message.soundElem!; - - _playSound() async { - if (!SoundPlayer.isInited) { - SoundPlayer.initSoundPlayer(); - } - if (widget.localCustomInt == null || - widget.localCustomInt != HistoryMessageDartConstant.read) { - globalModel.setLocalCustomInt(widget.msgID, - HistoryMessageDartConstant.read, widget.chatModel.conversationID); - } - if (isPlaying) { - SoundPlayer.stop(); - widget.chatModel.currentPlayedMsgId = ""; - } else { - SoundPlayer.play(url: stateElement.url!); - widget.chatModel.currentPlayedMsgId = widget.msgID; - } - } - - downloadMessageDetailAndSave() async { - if (widget.message.msgID != null && widget.message.msgID != '') { - if (widget.message.soundElem!.url == null || - widget.message.soundElem!.url == '') { - final response = await _messageService.getMessageOnlineUrl( - msgID: widget.message.msgID!); - if(response.data != null){ - widget.message.soundElem = response.data!.soundElem; - Future.delayed(const Duration(microseconds: 10), () { - setState(() => stateElement = response.data!.soundElem!); - }); - } - } - if (!PlatformUtils().isWeb) { - if (widget.message.soundElem!.localUrl == null || - widget.message.soundElem!.localUrl == '') { - _messageService.downloadMessage( - msgID: widget.message.msgID!, - messageType: 4, - imageType: 0, - isSnapshot: false); - } - } - } - } - - @override - void didUpdateWidget(oldWidget) { - super.didUpdateWidget(oldWidget); - setState(() { - isPlaying = widget.chatModel.currentPlayedMsgId != '' && - widget.chatModel.currentPlayedMsgId == widget.msgID; - }); - } - - @override - void initState() { - super.initState(); - - subscription = - SoundPlayer.playStateListener(listener: (PlayerState state) { - if(state == PlayerState.completed){ - widget.chatModel.currentPlayedMsgId = ""; - } - }); - - downloadMessageDetailAndSave(); - } - - @override - void dispose() { - if (isPlaying) { - SoundPlayer.stop(); - widget.chatModel.currentPlayedMsgId = ""; - } - subscription?.cancel(); - super.dispose(); - } - - double _getSoundLen() { - double soundLen = 32; - if (stateElement.duration != null) { - final realSoundLen = stateElement.duration!; - int sdLen = 32; - if (realSoundLen > 10) { - sdLen = 12 * charLen + ((realSoundLen - 10) * charLen / 0.5).floor(); - } else if (realSoundLen > 2) { - sdLen = 2 * charLen + realSoundLen * charLen; - } - sdLen = min(sdLen, 20 * charLen); - soundLen = sdLen.toDouble(); - } - - return soundLen; - } - - _showJumpColor() { - if ((widget.chatModel.jumpMsgID != widget.message.msgID) && - (widget.message.msgID?.isNotEmpty ?? true)) { - return; - } - isShining = true; - int shineAmount = 6; - setState(() { - isShowJumpState = true; - }); - Timer.periodic(const Duration(milliseconds: 300), (timer) { - if (mounted) { - setState(() { - isShowJumpState = shineAmount.isOdd ? true : false; - }); - } - if (shineAmount == 0 || !mounted) { - isShining = false; - timer.cancel(); - } - shineAmount--; - }); - widget.clearJump!(); - } - - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - final theme = value.theme; - - final backgroundColor = widget.isFromSelf - ? (theme.chatMessageItemFromSelfBgColor ?? - theme.lightPrimaryMaterialColor.shade50) - : (theme.chatMessageItemFromOthersBgColor); - - final borderRadius = widget.isFromSelf - ? const BorderRadius.only( - topLeft: Radius.circular(10), - topRight: Radius.circular(2), - bottomLeft: Radius.circular(10), - bottomRight: Radius.circular(10)) - : const BorderRadius.only( - topLeft: Radius.circular(2), - topRight: Radius.circular(10), - bottomLeft: Radius.circular(10), - bottomRight: Radius.circular(10)); - if (widget.isShowJump) { - if (!isShining) { - Future.delayed(Duration.zero, () { - _showJumpColor(); - }); - } else { - if ((widget.chatModel.jumpMsgID == widget.message.msgID) && - (widget.message.msgID?.isNotEmpty ?? false)) { - widget.clearJump!(); - } - } - } - return InkWell( - onTap: () => _playSound(), - child: Container( - padding: widget.textPadding ?? const EdgeInsets.all(10), - decoration: BoxDecoration( - color: isShowJumpState - ? const Color.fromRGBO(245, 166, 35, 1) - : (widget.backgroundColor ?? backgroundColor), - borderRadius: widget.borderRadius ?? borderRadius, - ), - constraints: const BoxConstraints(maxWidth: 240), - child: Column( - children: [ - Row( - mainAxisSize: MainAxisSize.min, - children: widget.isFromSelf - ? [ - Container(width: _getSoundLen()), - Text( - "''${stateElement.duration} ", - style: widget.fontStyle, - ), - isPlaying - ? Image.asset( - 'images/play_voice_send.gif', - package: 'tencent_cloud_chat_uikit', - width: 16, - height: 16, - ) - : Image.asset( - 'images/voice_send.png', - package: 'tencent_cloud_chat_uikit', - width: 16, - height: 16, - ), - ] - : [ - isPlaying - ? Image.asset( - 'images/play_voice_receive.gif', - package: 'tencent_cloud_chat_uikit', - width: 16, - height: 16, - ) - : Image.asset( - 'images/voice_receive.png', - width: 16, - height: 16, - package: 'tencent_cloud_chat_uikit', - ), - Text( - " ${stateElement.duration}''", - style: widget.fontStyle, - ), - Container(width: _getSoundLen()), - ], - ), - if (widget.isShowMessageReaction ?? true) - TIMUIKitMessageReactionShowPanel( - message: widget.message, - ) - ], - ), - ), - ); - } -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_text_elem.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_text_elem.dart deleted file mode 100644 index 06f422c..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_text_elem.dart +++ /dev/null @@ -1,314 +0,0 @@ -import 'dart:async'; -import 'dart:convert'; - -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/screen_utils.dart'; -import 'package:tencent_extended_text/extended_text.dart'; -import 'package:flutter/material.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_state.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/separate_models/tui_chat_separate_view_model.dart'; -import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitTextField/special_text/DefaultSpecialTextSpanBuilder.dart'; -import 'package:tencent_cloud_chat_uikit/ui/widgets/link_preview/link_preview_entry.dart'; -import 'package:tencent_cloud_chat_uikit/ui/widgets/link_preview/widgets/link_preview.dart'; -import 'TIMUIKitMessageReaction/tim_uikit_message_reaction_show_panel.dart'; - -class TIMTextElem extends StatefulWidget { - final V2TimMessage message; - final bool isFromSelf; - final bool isShowJump; - final VoidCallback clearJump; - final TextStyle? fontStyle; - final BorderRadius? borderRadius; - final Color? backgroundColor; - final EdgeInsetsGeometry? textPadding; - final TUIChatSeparateViewModel chatModel; - final bool? isShowMessageReaction; - final bool isUseDefaultEmoji; - final List customEmojiStickerList; - - const TIMTextElem( - {Key? key, - required this.message, - required this.isFromSelf, - required this.isShowJump, - required this.clearJump, - this.fontStyle, - this.borderRadius, - this.isShowMessageReaction, - this.backgroundColor, - this.textPadding, - required this.chatModel, - this.isUseDefaultEmoji = false, - this.customEmojiStickerList = const []}) - : super(key: key); - - @override - State createState() => _TIMTextElemState(); -} - -class _TIMTextElemState extends TIMUIKitState { - bool isShowJumpState = false; - bool isShining = false; - - @override - void initState() { - super.initState(); - // get the link preview info - _getLinkPreview(); - } - - @override - void didUpdateWidget(TIMTextElem oldWidget) { - super.didUpdateWidget(oldWidget); - if (oldWidget.message.msgID == null && widget.message.msgID != null) { - _getLinkPreview(); - } - } - - _showJumpColor() { - if ((widget.chatModel.jumpMsgID != widget.message.msgID) && - (widget.message.msgID?.isNotEmpty ?? true)) { - return; - } - isShining = true; - int shineAmount = 6; - setState(() { - isShowJumpState = true; - }); - Timer.periodic(const Duration(milliseconds: 300), (timer) { - if (mounted) { - setState(() { - isShowJumpState = shineAmount.isOdd ? true : false; - }); - } - if (shineAmount == 0 || !mounted) { - isShining = false; - timer.cancel(); - } - shineAmount--; - }); - Future.delayed(const Duration(milliseconds: 100), () { - widget.clearJump(); - }); - } - - // get the link preview info - _getLinkPreview() { - if (widget.chatModel.chatConfig.urlPreviewType != - UrlPreviewType.previewCardAndHyperlink) { - return; - } - try { - if (widget.message.localCustomData != null && - widget.message.localCustomData!.isNotEmpty) { - final String localJSON = widget.message.localCustomData!; - final LocalCustomDataModel? localPreviewInfo = - LocalCustomDataModel.fromMap(json.decode(localJSON)); - // If [localCustomData] is not empty, check if the link preview info exists - if (localPreviewInfo == null || localPreviewInfo.isLinkPreviewEmpty()) { - // If not exists, get it - _initLinkPreview(); - } - } else { - // It [localCustomData] is empty, get the link info - _initLinkPreview(); - } - } catch (e) { - return null; - } - } - - _initLinkPreview() async { - // Get the link preview info from extension, let it update the message UI automatically by providing a [onUpdateMessage]. - // The `onUpdateMessage` can use the `updateMessage()` from the [TIMUIKitChatController] directly. - LinkPreviewEntry.getFirstLinkPreviewContent( - message: widget.message, - onUpdateMessage: (message) { - widget.chatModel.updateMessageFromController( - msgID: widget.message.msgID!, message: message); - }); - } - - Widget? _renderPreviewWidget() { - // If the link preview info from [localCustomData] is available, use it to render the preview card. - // Otherwise, it will returns null. - if (widget.message.localCustomData != null && - widget.message.localCustomData!.isNotEmpty) { - try { - final String localJSON = widget.message.localCustomData!; - final LocalCustomDataModel? localPreviewInfo = - LocalCustomDataModel.fromMap(json.decode(localJSON)); - if (localPreviewInfo != null && - !localPreviewInfo.isLinkPreviewEmpty()) { - return Container( - margin: const EdgeInsets.only(top: 8), - child: - // You can use this default widget [LinkPreviewWidget] to render preview card, or you can use custom widget. - LinkPreviewWidget(linkPreview: localPreviewInfo), - ); - } else { - return null; - } - } catch (e) { - return null; - } - } else { - return null; - } - } - - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - final theme = value.theme; - final isDesktopScreen = - TUIKitScreenUtils.getFormFactor(context) == DeviceType.Desktop; - final textWithLink = LinkPreviewEntry.getHyperlinksText( - widget.message.textElem?.text ?? "", - widget.chatModel.chatConfig.isSupportMarkdownForTextMessage, - onLinkTap: widget.chatModel.chatConfig.onTapLink, - isUseDefaultEmoji: widget.isUseDefaultEmoji, - customEmojiStickerList: widget.customEmojiStickerList, - isEnableTextSelection: - widget.chatModel.chatConfig.isEnableTextSelection); - final borderRadius = widget.isFromSelf - ? const BorderRadius.only( - topLeft: Radius.circular(10), - topRight: Radius.circular(10), - bottomLeft: Radius.circular(10), - bottomRight: Radius.circular(2)) - : const BorderRadius.only( - topLeft: Radius.circular(10), - topRight: Radius.circular(10), - bottomLeft: Radius.circular(2), - bottomRight: Radius.circular(10)); - if ((widget.chatModel.jumpMsgID == widget.message.msgID)) {} - if (widget.isShowJump) { - if (!isShining) { - Future.delayed(Duration.zero, () { - _showJumpColor(); - }); - } else { - if ((widget.chatModel.jumpMsgID == widget.message.msgID) && - (widget.message.msgID?.isNotEmpty ?? false)) { - widget.clearJump(); - } - } - } - - final defaultStyle = widget.isFromSelf - ? (theme.chatMessageItemFromSelfBgColor ?? - theme.lightPrimaryMaterialColor.shade50) - : (theme.chatMessageItemFromOthersBgColor); - - final backgroundColor = isShowJumpState - ? const Color.fromRGBO(245, 166, 35, 1) - : (defaultStyle ?? widget.backgroundColor); - - if (!widget.isFromSelf) { - return - Container( - decoration: BoxDecoration( - gradient: - LinearGradient(colors: [Color(0xFF04FCFB), Color(0xFFE540FE)]), - // color: backgroundColor, - borderRadius: widget.borderRadius ?? borderRadius, - ), - child:Container( - margin: EdgeInsets.all(1), - padding: - widget.textPadding ?? EdgeInsets.all(isDesktopScreen ? 11 : 9), - decoration: BoxDecoration( - color: const Color(0xFF493E5C), - // color: backgroundColor, - borderRadius: widget.borderRadius ?? borderRadius, - ), - constraints: - BoxConstraints(maxWidth: MediaQuery.of(context).size.width * 0.6), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - // If the [elemType] is text message, it will not be null here. - // You can render the widget from extension directly, with a [TextStyle] optionally. - widget.chatModel.chatConfig.urlPreviewType != UrlPreviewType.none - ? textWithLink!( - style: TextStyle( - fontSize: isDesktopScreen ? 14 : 16, - color: - widget.isFromSelf ? Colors.black : Colors.white, - textBaseline: TextBaseline.ideographic, - height: widget.chatModel.chatConfig.textHeight)) - : ExtendedText(widget.message.textElem?.text ?? "", - softWrap: true, - style: TextStyle( - fontSize: isDesktopScreen ? 14 : 16, - color: - widget.isFromSelf ? Colors.black : Colors.white, - height: widget.chatModel.chatConfig.textHeight), - specialTextSpanBuilder: DefaultSpecialTextSpanBuilder( - isUseDefaultEmoji: widget.isUseDefaultEmoji, - customEmojiStickerList: widget.customEmojiStickerList, - showAtBackground: true, - )), - // If the link preview info is available, render the preview card. - if (_renderPreviewWidget() != null && - widget.chatModel.chatConfig.urlPreviewType == - UrlPreviewType.previewCardAndHyperlink) - _renderPreviewWidget()!, - if (widget.isShowMessageReaction ?? true) - TIMUIKitMessageReactionShowPanel(message: widget.message) - ], - ), - ), - ); - } - return Container( - padding: - widget.textPadding ?? EdgeInsets.all(isDesktopScreen ? 12 : 10), - decoration: BoxDecoration( - gradient: - LinearGradient(colors: [Color(0xFF04FCFB), Color(0xFFE540FE)]), - // color: backgroundColor, - borderRadius: widget.borderRadius ?? borderRadius, - ), - constraints: - BoxConstraints(maxWidth: MediaQuery.of(context).size.width * 0.6), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - // If the [elemType] is text message, it will not be null here. - // You can render the widget from extension directly, with a [TextStyle] optionally. - widget.chatModel.chatConfig.urlPreviewType != UrlPreviewType.none - ? textWithLink!( - style: TextStyle( - fontSize: isDesktopScreen ? 14 : 16, - color: - widget.isFromSelf ? Colors.black : Colors.white, - textBaseline: TextBaseline.ideographic, - height: widget.chatModel.chatConfig.textHeight)) - : ExtendedText(widget.message.textElem?.text ?? "", - softWrap: true, - style: TextStyle( - fontSize: isDesktopScreen ? 14 : 16, - color: - widget.isFromSelf ? Colors.black : Colors.white, - height: widget.chatModel.chatConfig.textHeight), - specialTextSpanBuilder: DefaultSpecialTextSpanBuilder( - isUseDefaultEmoji: widget.isUseDefaultEmoji, - customEmojiStickerList: widget.customEmojiStickerList, - showAtBackground: true, - )), - // If the link preview info is available, render the preview card. - if (_renderPreviewWidget() != null && - widget.chatModel.chatConfig.urlPreviewType == - UrlPreviewType.previewCardAndHyperlink) - _renderPreviewWidget()!, - if (widget.isShowMessageReaction ?? true) - TIMUIKitMessageReactionShowPanel(message: widget.message) - ], - ), - ); - - } -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_text_translate_elem.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_text_translate_elem.dart deleted file mode 100644 index a703ee5..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_text_translate_elem.dart +++ /dev/null @@ -1,193 +0,0 @@ -import 'dart:async'; -import 'dart:convert'; - -import 'package:tencent_cloud_chat_uikit/ui/utils/screen_utils.dart'; -import 'package:tencent_extended_text/extended_text.dart'; -import 'package:flutter/material.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_state.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/separate_models/tui_chat_separate_view_model.dart'; -import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitTextField/special_text/DefaultSpecialTextSpanBuilder.dart'; -import 'package:tencent_cloud_chat_uikit/ui/widgets/link_preview/link_preview_entry.dart'; - -class TIMUIKitTextTranslationElem extends StatefulWidget { - final V2TimMessage message; - final bool isFromSelf; - final bool isShowJump; - final VoidCallback clearJump; - final TextStyle? fontStyle; - final BorderRadius? borderRadius; - final Color? backgroundColor; - final EdgeInsetsGeometry? textPadding; - final TUIChatSeparateViewModel chatModel; - final bool? isShowMessageReaction; - final bool isUseDefaultEmoji; - final List customEmojiStickerList; - - const TIMUIKitTextTranslationElem( - {Key? key, - required this.message, - required this.isFromSelf, - required this.isShowJump, - required this.clearJump, - this.fontStyle, - this.borderRadius, - this.isShowMessageReaction, - this.backgroundColor, - this.textPadding, - required this.chatModel, - this.isUseDefaultEmoji = false, - this.customEmojiStickerList = const []}) - : super(key: key); - - @override - State createState() => _TIMUIKitTextTranslationElemState(); -} - -class _TIMUIKitTextTranslationElemState - extends TIMUIKitState { - bool isShowJumpState = false; - bool isShining = false; - - _showJumpColor() { - if ((widget.chatModel.jumpMsgID != widget.message.msgID) && - (widget.message.msgID?.isNotEmpty ?? true)) { - return; - } - isShining = true; - int shineAmount = 6; - setState(() { - isShowJumpState = true; - }); - Timer.periodic(const Duration(milliseconds: 300), (timer) { - if (mounted) { - setState(() { - isShowJumpState = shineAmount.isOdd ? true : false; - }); - } - if (shineAmount == 0 || !mounted) { - isShining = false; - timer.cancel(); - } - shineAmount--; - }); - Future.delayed(const Duration(milliseconds: 100), () { - widget.clearJump(); - }); - } - - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - final theme = value.theme; - final isDesktopScreen = - TUIKitScreenUtils.getFormFactor(context) == DeviceType.Desktop; - final borderRadius = widget.isFromSelf - ? const BorderRadius.only( - topLeft: Radius.circular(10), - topRight: Radius.circular(2), - bottomLeft: Radius.circular(10), - bottomRight: Radius.circular(10)) - : const BorderRadius.only( - topLeft: Radius.circular(2), - topRight: Radius.circular(10), - bottomLeft: Radius.circular(10), - bottomRight: Radius.circular(10)); - if ((widget.chatModel.jumpMsgID == widget.message.msgID)) {} - if (widget.isShowJump) { - if (!isShining) { - Future.delayed(Duration.zero, () { - _showJumpColor(); - }); - } else { - if ((widget.chatModel.jumpMsgID == widget.message.msgID) && - (widget.message.msgID?.isNotEmpty ?? false)) { - widget.clearJump(); - } - } - } - - final defaultStyle = widget.isFromSelf - ? (theme.chatMessageItemFromSelfBgColor ?? - theme.lightPrimaryMaterialColor.shade50) - : (theme.chatMessageItemFromOthersBgColor); - - final backgroundColor = isShowJumpState - ? const Color.fromRGBO(245, 166, 35, 1) - : (defaultStyle ?? widget.backgroundColor); - - final LocalCustomDataModel localCustomData = LocalCustomDataModel.fromMap( - json.decode( - TencentUtils.checkString(widget.message.localCustomData) ?? "{}")); - final String? translateText = localCustomData.translatedText; - - final textWithLink = LinkPreviewEntry.getHyperlinksText(translateText ?? "", - widget.chatModel.chatConfig.isSupportMarkdownForTextMessage, - onLinkTap: widget.chatModel.chatConfig.onTapLink, - isUseDefaultEmoji: widget.isUseDefaultEmoji, - customEmojiStickerList: widget.customEmojiStickerList, - isEnableTextSelection: - widget.chatModel.chatConfig.isEnableTextSelection); - - return TencentUtils.checkString(translateText) != null - ? Container( - margin: const EdgeInsets.only(top: 6), - padding: - widget.textPadding ?? EdgeInsets.all(isDesktopScreen ? 12 : 10), - decoration: BoxDecoration( - color: backgroundColor, - borderRadius: widget.borderRadius ?? borderRadius, - ), - constraints: BoxConstraints( - maxWidth: MediaQuery.of(context).size.width * 0.6), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - // If the [elemType] is text message, it will not be null here. - // You can render the widget from extension directly, with a [TextStyle] optionally. - widget.chatModel.chatConfig.urlPreviewType != - UrlPreviewType.none - ? textWithLink!( - style: widget.fontStyle ?? - TextStyle( - fontSize: isDesktopScreen ? 14 : 16, - textBaseline: TextBaseline.ideographic, - height: widget.chatModel.chatConfig.textHeight)) - : ExtendedText(translateText!, - softWrap: true, - style: widget.fontStyle ?? - TextStyle( - fontSize: isDesktopScreen ? 14 : 16, - height: widget.chatModel.chatConfig.textHeight), - specialTextSpanBuilder: DefaultSpecialTextSpanBuilder( - isUseDefaultEmoji: widget.isUseDefaultEmoji, - customEmojiStickerList: widget.customEmojiStickerList, - showAtBackground: true, - )), - const SizedBox(height: 6), - Row( - mainAxisAlignment: MainAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - const Icon( - Icons.check_circle, - color: Color(0x72282c34), - size: 12, - ), - const SizedBox( - width: 4, - ), - Text( - TIM_t("翻译完成"), - style: const TextStyle( - color: Color(0x72282c34), fontSize: 10), - ) - ], - ) - ], - ), - ) - : const SizedBox(width: 0, height: 0); - } -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_video_elem.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_video_elem.dart deleted file mode 100644 index eb6481e..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_video_elem.dart +++ /dev/null @@ -1,298 +0,0 @@ -import 'dart:io'; -import 'dart:math'; - -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; -import 'package:loading_animation_widget/loading_animation_widget.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_state.dart'; -import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/separate_models/tui_chat_separate_view_model.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_chat_global_model.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/message/message_services.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/services_locatar.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/message.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/platform.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitMessageItem/TIMUIKitMessageReaction/tim_uikit_message_reaction_wrapper.dart'; -import 'package:tencent_cloud_chat_uikit/ui/widgets/video_screen.dart'; -import 'package:tencent_open_file/tencent_open_file.dart'; -import 'package:url_launcher/url_launcher.dart'; - -class TIMUIKitVideoElem extends StatefulWidget { - final V2TimMessage message; - final bool isShowJump; - final VoidCallback? clearJump; - final String? isFrom; - final TUIChatSeparateViewModel chatModel; - final bool? isShowMessageReaction; - - const TIMUIKitVideoElem(this.message, - {Key? key, - this.isShowJump = false, - this.clearJump, - this.isFrom, - this.isShowMessageReaction, - required this.chatModel}) - : super(key: key); - - @override - State createState() => _TIMUIKitVideoElemState(); -} - -class _TIMUIKitVideoElemState extends TIMUIKitState { - final TUIChatGlobalModel globalModel = serviceLocator(); - final MessageService _messageService = serviceLocator(); - late V2TimVideoElem stateElement = widget.message.videoElem!; - - Widget errorDisplay(TUITheme? theme) { - return Container( - decoration: BoxDecoration( - border: Border.all( - width: 1, - color: Colors.black12, - )), - height: 100, - child: Center( - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon( - Icons.warning_amber_outlined, - color: theme?.cautionColor, - size: 16, - ), - Text( - TIM_t("视频加载失败"), - style: TextStyle(color: theme?.cautionColor), - ), - ], - ), - ), - ); - } - - Widget generateSnapshot(TUITheme theme, int height) { - if (!PlatformUtils().isWeb) { - final current = (DateTime.now().millisecondsSinceEpoch / 1000).ceil(); - final timeStamp = widget.message.timestamp ?? current; - if (current - timeStamp < 300) { - if (stateElement.snapshotPath != null && - stateElement.snapshotPath != '') { - File imgF = File(stateElement.snapshotPath!); - bool isExist = imgF.existsSync(); - if (isExist) { - return Image.file(File(stateElement.snapshotPath!), - fit: BoxFit.fitWidth); - } - } - } - } - - if ((stateElement.snapshotUrl == null || stateElement.snapshotUrl == '') && - (stateElement.snapshotPath == null || - stateElement.snapshotPath == '')) { - return Container( - decoration: BoxDecoration( - borderRadius: const BorderRadius.all(Radius.circular(5)), - border: Border.all( - width: 1, - color: Colors.black12, - )), - height: double.parse(height.toString()), - child: Center( - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - LoadingAnimationWidget.staggeredDotsWave( - color: theme.weakTextColor ?? Colors.grey, - size: 28, - ) - ], - ), - ), - ); - } - return (!kIsWeb && stateElement.snapshotUrl == null || - widget.message.status == MessageStatus.V2TIM_MSG_STATUS_SENDING) - ? (stateElement.snapshotPath!.isNotEmpty - ? Image.file(File(stateElement.snapshotPath!), fit: BoxFit.fitWidth) - : Image.file(File(stateElement.localSnapshotUrl!), - fit: BoxFit.fitWidth)) - : (kIsWeb || - stateElement.localSnapshotUrl == null || - stateElement.localSnapshotUrl == "") - ? Image.network(stateElement.snapshotUrl!, fit: BoxFit.fitWidth) - : Image.file(File(stateElement.localSnapshotUrl!), - fit: BoxFit.fitWidth); - } - - downloadMessageDetailAndSave() async { - if (widget.message.msgID != null && widget.message.msgID != '') { - if (widget.message.videoElem!.videoUrl == null || - widget.message.videoElem!.videoUrl == '') { - final response = await _messageService.getMessageOnlineUrl( - msgID: widget.message.msgID!); - if (response.data != null) { - widget.message.videoElem = response.data!.videoElem; - Future.delayed(const Duration(microseconds: 10), () { - setState(() => stateElement = response.data!.videoElem!); - }); - } - } - if (!PlatformUtils().isWeb) { - if (widget.message.videoElem!.localVideoUrl == null || - widget.message.videoElem!.localVideoUrl == '') { - _messageService.downloadMessage( - msgID: widget.message.msgID!, - messageType: 5, - imageType: 0, - isSnapshot: false); - } - if (widget.message.videoElem!.localSnapshotUrl == null || - widget.message.videoElem!.localSnapshotUrl == '') { - _messageService.downloadMessage( - msgID: widget.message.msgID!, - messageType: 5, - imageType: 0, - isSnapshot: true); - } - } - } - } - - @override - void initState() { - super.initState(); - downloadMessageDetailAndSave(); - } - - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - final theme = value.theme; - final heroTag = - "${widget.message.msgID ?? widget.message.id ?? widget.message.timestamp ?? DateTime.now().millisecondsSinceEpoch}${widget.isFrom}"; - - return InkWell( - onTap: () { - if (PlatformUtils().isDesktop) { - final videoElem = widget.message.videoElem; - if (videoElem != null) { - final localVideoUrl = TencentUtils.checkString(videoElem.localVideoUrl); - final videoPath = TencentUtils.checkString(videoElem.videoPath); - final videoUrl = videoElem.videoUrl; - - if (localVideoUrl != null) { - if(PlatformUtils().isWindows){ - OpenFile.open(localVideoUrl); - } else{ - launchUrl(Uri.file(localVideoUrl)); - } - } else if (videoPath != null) { - if(PlatformUtils().isWindows){ - OpenFile.open(videoPath); - } else{ - launchUrl(Uri.file(videoPath)); - } - } else if (TencentUtils.isTextNotEmpty(videoUrl)) { - onTIMCallback(TIMCallback( - infoCode: 6660414, - infoRecommendText: TIM_t("正在下载中"), - type: TIMCallbackType.INFO - )); - } - } - } else { - Navigator.of(context).push( - PageRouteBuilder( - opaque: false, // set to false - pageBuilder: (_, __, ___) => VideoScreen( - message: widget.message, - heroTag: heroTag, - videoElement: stateElement, - ), - ), - ); - } - }, - child: Hero( - tag: heroTag, - child: TIMUIKitMessageReactionWrapper( - chatModel: widget.chatModel, - message: widget.message, - isShowJump: widget.isShowJump, - isShowMessageReaction: widget.isShowMessageReaction ?? true, - clearJump: widget.clearJump, - isFromSelf: widget.message.isSelf ?? true, - child: ClipRRect( - borderRadius: const BorderRadius.all(Radius.circular(5)), - child: LayoutBuilder(builder: - (BuildContext context, BoxConstraints constraints) { - double positionRadio = 0.56; - if (stateElement.snapshotWidth != null && - stateElement.snapshotHeight != null && - stateElement.snapshotWidth != 0 && - stateElement.snapshotHeight != 0) { - positionRadio = (stateElement.snapshotWidth! / - stateElement.snapshotHeight!); - } - - return ConstrainedBox( - constraints: BoxConstraints( - maxWidth: PlatformUtils().isWeb - ? 300 - : constraints.maxWidth * 0.5, - maxHeight: min(constraints.maxHeight * 0.8, 300), - minHeight: 20, - minWidth: 20), - child: AspectRatio( - aspectRatio: positionRadio, - child: Stack( - children: [ - if (stateElement.snapshotUrl != null || - stateElement.snapshotUrl != null) - AspectRatio( - aspectRatio: positionRadio, - child: Container( - decoration: const BoxDecoration( - color: Colors.transparent), - ), - ), - Row( - children: [ - Expanded( - child: generateSnapshot(theme, - stateElement.snapshotHeight ?? 100)) - ], - ), - if (widget.message.status != - MessageStatus - .V2TIM_MSG_STATUS_SENDING && - (stateElement.snapshotUrl != null || - stateElement.snapshotPath != null) && - stateElement.videoPath != null || - stateElement.videoUrl != null) - Positioned.fill( - // alignment: Alignment.center, - child: Center( - child: Image.asset('images/play.png', - package: 'tencent_cloud_chat_uikit', - height: 64)), - ), - Positioned( - right: 10, - bottom: 10, - child: Text( - MessageUtils.formatVideoTime(widget - .message.videoElem?.duration ?? - 0) - .toString(), - style: const TextStyle( - color: Colors.white, fontSize: 12))), - ], - ), - )); - }), - ))), - ); - } -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_merger_message_elem.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_merger_message_elem.dart deleted file mode 100644 index ffd968d..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_merger_message_elem.dart +++ /dev/null @@ -1,227 +0,0 @@ -import 'dart:async'; - -import 'package:flutter/material.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_state.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/separate_models/tui_chat_separate_view_model.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/core/tim_uikit_wide_modal_operation_key.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/screen_utils.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKItMessageList/tim_uikit_chat_history_message_list_item.dart'; -import 'package:tencent_cloud_chat_uikit/ui/widgets/merger_message_screen.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart'; -import 'package:tencent_cloud_chat_uikit/ui/widgets/wide_popup.dart'; -import 'package:tencent_im_base/tencent_im_base.dart'; -import 'TIMUIKitMessageReaction/tim_uikit_message_reaction_show_panel.dart'; - -class TIMMergerElem extends StatefulWidget { - final V2TimMergerElem mergerElem; - final String messageID; - final bool isSelf; - final bool isShowJump; - final VoidCallback? clearJump; - final V2TimMessage message; - final bool? isShowMessageReaction; - final TUIChatSeparateViewModel model; - final MessageItemBuilder? messageItemBuilder; - - const TIMMergerElem( - {Key? key, - required this.message, - required this.model, - required this.mergerElem, - required this.isSelf, - this.isShowMessageReaction, - required this.messageID, - required this.isShowJump, - this.clearJump, - this.messageItemBuilder}) - : super(key: key); - - @override - State createState() => TIMMergerElemState(); -} - -class TIMMergerElemState extends TIMUIKitState { - bool isShowJumpState = false; - late ScrollController _scrollController; - - @override - void initState() { - super.initState(); - _scrollController = ScrollController(); - } - - _showJumpColor() { - int shineAmount = 6; - setState(() { - isShowJumpState = true; - }); - Future.delayed(const Duration(milliseconds: 100), () { - if (widget.clearJump != null) { - widget.clearJump!(); - } - }); - Timer.periodic(const Duration(milliseconds: 300), (timer) { - if (mounted) { - setState(() { - isShowJumpState = shineAmount.isOdd ? true : false; - }); - } - if (shineAmount == 0 || !mounted) { - timer.cancel(); - } - shineAmount--; - }); - } - - _handleTap(BuildContext context, TUIChatSeparateViewModel model) async { - try { - if (widget.messageID != "") { - final isDesktopScreen = - TUIKitScreenUtils.getFormFactor(context) == DeviceType.Desktop; - - if (isDesktopScreen) { - TUIKitWidePopup.showPopupWindow( - operationKey: TUIKitWideModalOperationKey.mergerMessageList, - context: context, - width: MediaQuery.of(context).size.width * 0.7, - title: TIM_t("聊天记录"), - height: MediaQuery.of(context).size.height * 0.7, - child: (onClose) => Scrollbar( - controller: _scrollController, - child: MergerMessageScreen( - messageItemBuilder: widget.messageItemBuilder, - model: model, - msgID: widget.messageID), - ), - ); - } else { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => MergerMessageScreen( - messageItemBuilder: widget.messageItemBuilder, - model: model, - msgID: widget.messageID), - )); - } - } - } catch (e) { - onTIMCallback(TIMCallback( - type: TIMCallbackType.INFO, - infoRecommendText: TIM_t("无法定位到原消息"), - infoCode: 6660401)); - } - } - - List? _getAbstractList() { - final length = widget.mergerElem.abstractList!.length; - if (length <= 4) { - return widget.mergerElem.abstractList; - } - return widget.mergerElem.abstractList!.getRange(0, 4).toList(); - } - - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - final TUITheme theme = value.theme; - if (widget.isShowJump) { - Future.delayed(Duration.zero, () { - _showJumpColor(); - }); - } - final isDesktopScreen = - TUIKitScreenUtils.getFormFactor(context) == DeviceType.Desktop; - return Container( - constraints: BoxConstraints( - maxWidth: - MediaQuery.of(context).size.width * (isDesktopScreen ? 0.3 : 0.6)), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only( - topLeft: widget.isSelf ? const Radius.circular(10) : Radius.zero, - bottomLeft: const Radius.circular(10), - topRight: widget.isSelf ? Radius.zero : const Radius.circular(10), - bottomRight: const Radius.circular(10), - ), - border: Border.all( - color: isShowJumpState - ? const Color.fromRGBO(245, 166, 35, 1) - : (theme.weakDividerColor ?? CommonColor.weakDividerColor), - width: 1, - ), - ), - child: GestureDetector( - onTap: () { - _handleTap(context, widget.model); - }, - child: Container( - padding: const EdgeInsets.all(12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Expanded( - child: Text( - widget.mergerElem.title!, - softWrap: true, - overflow: TextOverflow.ellipsis, - textAlign: TextAlign.left, - maxLines: 1, - style: const TextStyle( - fontSize: 16, - color: Colors.black, - ), - ), - ) - ], - ), - const SizedBox( - height: 4, - ), - // const Divider(), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, - children: _getAbstractList()! - .map( - (e) => Row( - children: [ - Expanded( - child: Text( - e, - textAlign: TextAlign.left, - softWrap: true, - overflow: TextOverflow.ellipsis, - maxLines: 2, - style: TextStyle( - color: theme.weakTextColor, - fontSize: 12, - ), - ), - ), - ], - ), - ) - .toList(), - ), - const SizedBox( - height: 4, - ), - const Divider(), - Text( - TIM_t("聊天记录"), - style: TextStyle( - color: theme.weakTextColor, - fontSize: 10, - ), - ), - if (widget.isShowMessageReaction ?? true) - TIMUIKitMessageReactionShowPanel(message: widget.message) - ], - ), - ), - ), - ); - } -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/at_member_panel.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/at_member_panel.dart deleted file mode 100644 index e133996..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/at_member_panel.dart +++ /dev/null @@ -1,136 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; -import 'package:scroll_to_index/scroll_to_index.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_state.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/separate_models/tui_chat_separate_view_model.dart'; - -import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; -import 'package:tencent_cloud_chat_uikit/ui/widgets/avatar.dart'; - -class AtMemberPanel extends StatefulWidget { - /// messageList widget scroll controller - final AutoScrollController atMemberPanelScroll; - - final ValueChanged onSelectMember; - - // final TextFieldWebController textFieldWebController; - const AtMemberPanel( - // this.textFieldWebController, - {Key? key, - required this.atMemberPanelScroll, - required this.onSelectMember}) - : super(key: key); - - @override - State createState() { - return _AtMemberPanelState(); - } -} - -_getShowName(V2TimGroupMemberFullInfo? item) { - return TencentUtils.checkStringWithoutSpace(item?.nameCard) ?? - TencentUtils.checkStringWithoutSpace(item?.nickName) ?? - TencentUtils.checkStringWithoutSpace(item?.userID); -} - -class _AtMemberPanelState extends TIMUIKitState { - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - final theme = value.theme; - final chatModal = Provider.of(context); - final List groupMemberList = - chatModal.showAtMemberList; - final double positionX = chatModal.atPositionX; - final double positionY = chatModal.atPositionY; - final int activeIndex = chatModal.activeAtIndex; - - if (groupMemberList.isEmpty) { - return Container(); - } - return Positioned( - left: positionX, - bottom: positionY, - child: Container( - constraints: const BoxConstraints(maxHeight: 170, maxWidth: 170), - padding: const EdgeInsets.symmetric(vertical: 5), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: const BorderRadius.all(Radius.circular(8)), - border: Border.all(color: const Color(0xFFE5E6E9))), - child: Scrollbar( - controller: widget.atMemberPanelScroll, - child: ListView.builder( - shrinkWrap: true, - itemCount: groupMemberList.length, - controller: widget.atMemberPanelScroll, - itemBuilder: ((context, index) { - final memberItem = groupMemberList[index]; - if (memberItem == null) { - return AutoScrollTag( - key: ValueKey(index), - controller: widget.atMemberPanelScroll, - index: index); - } - final showName = _getShowName(memberItem); - final isAtAll = memberItem.userID == "__kImSDK_MesssageAtALL__"; - return AutoScrollTag( - key: ValueKey(index), - controller: widget.atMemberPanelScroll, - index: index, - child: Material( - color: theme.wideBackgroundColor, - child: InkWell( - onTap: () { - chatModal.activeAtIndex = index; - widget.onSelectMember(memberItem); - }, - child: Container( - padding: const EdgeInsets.symmetric( - horizontal: 8, vertical: 4), - color: activeIndex == index - ? theme.weakBackgroundColor - : theme.wideBackgroundColor, - child: Row( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - SizedBox( - height: 24, - width: 24, - child: Avatar( - faceUrl: memberItem.faceUrl ?? "", - showName: showName), - ), - const SizedBox( - width: 8, - ), - Expanded(child: Text( - isAtAll - ? "$showName(${groupMemberList.length - 1})" - : showName, - softWrap: false, - style: TextStyle( - fontSize: 14, - overflow: TextOverflow.ellipsis, - fontWeight: memberItem.role == 400 || - memberItem.role == 300 - ? FontWeight.w500 - : FontWeight.normal, - color: memberItem.role == 400 || - memberItem.role == 300 - ? theme.primaryColor - : theme.darkTextColor), - )) - ], - ), - ), - ), - ), - ); - })), - ), - ), - ); - } -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/intl_camer_picker.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/intl_camer_picker.dart deleted file mode 100644 index 85bf61d..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/intl_camer_picker.dart +++ /dev/null @@ -1,105 +0,0 @@ -import 'package:tencent_im_base/tencent_im_base.dart'; -import 'package:tencent_wechat_camera_picker/tencent_wechat_camera_picker.dart'; - -class IntlCameraPickerTextDelegate extends CameraPickerTextDelegate { - /// Confirm string for the confirm button. - /// 确认按钮的字段 - @override - String get confirm => TIM_t('确认'); - - /// Tips string above the shooting button before shooting. - /// 拍摄前确认按钮上方的提示文字 - @override - String get shootingTips => TIM_t('轻触拍照,长按摄像'); - - /// Tips string above the shooting button before shooting. - /// 拍摄前确认按钮上方的提示文字 - @override - String get shootingWithRecordingTips => TIM_t('轻触拍照,长按摄像'); - - /// Load failed string for item. - /// 资源加载失败时的字段 - @override - String get loadFailed => TIM_t('加载失败'); - - /// Default loading string for the dialog. - /// 加载中弹窗的默认文字 - @override - String get loading => TIM_t('加载中…'); - - /// Saving string for the dialog. - /// 保存中弹窗的默认文字 - @override - String get saving => TIM_t('保存中…'); - - /// Semantics fields. - /// - /// Fields below are only for semantics usage. For customizable these fields, - /// head over to [EnglishCameraPickerTextDelegate] for better understanding. - @override - String get sActionManuallyFocusHint => TIM_t('手动聚焦'); - - @override - String get sActionPreviewHint => TIM_t('预览'); - - @override - String get sActionRecordHint => TIM_t('录像'); - - @override - String get sActionShootHint => TIM_t('拍照'); - - @override - String get sActionShootingButtonTooltip => TIM_t('拍照按钮'); - - @override - String get sActionStopRecordingHint => TIM_t('停止录像'); - - @override - String sCameraLensDirectionLabel(CameraLensDirection value) { - switch (value) { - case CameraLensDirection.front: - return TIM_t('前置'); - case CameraLensDirection.back: - return TIM_t('后置'); - case CameraLensDirection.external: - return TIM_t('外置'); - } - } - - @override - String? sCameraPreviewLabel(CameraLensDirection? value) { - if (value == null) { - return null; - } - final option1 = sCameraLensDirectionLabel(value); - return TIM_t_para("{{option1}} 画面预览", "$option1 画面预览")(option1: option1); - } - - @override - String sFlashModeLabel(FlashMode mode) { - final String _modeString; - switch (mode) { - case FlashMode.off: - _modeString = TIM_t('关闭'); - break; - case FlashMode.auto: - _modeString = TIM_t('自动'); - break; - case FlashMode.always: - _modeString = TIM_t('拍照时闪光'); - break; - case FlashMode.torch: - _modeString = TIM_t('始终闪光'); - break; - } - final option2 = _modeString; - return TIM_t_para("闪光模式: {{option2}}", "闪光模式: $option2")(option2: option2); - } - - @override - String sSwitchCameraLensDirectionLabel(CameraLensDirection value) { - final option3 = sCameraLensDirectionLabel(value); - return TIM_t_para("切换至 {{option3}} 摄像头", "切换至 $option3 摄像头")( - option3: option3); - } -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/special_text/DefaultSpecialTextSpanBuilder.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/special_text/DefaultSpecialTextSpanBuilder.dart deleted file mode 100644 index 852b017..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/special_text/DefaultSpecialTextSpanBuilder.dart +++ /dev/null @@ -1,45 +0,0 @@ - -// ignore_for_file: file_names - -import 'package:tencent_extended_text_field/extended_text_field.dart'; -import 'package:flutter/material.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitTextField/special_text/http_text.dart'; - -import 'emoji_text.dart'; - -class DefaultSpecialTextSpanBuilder extends SpecialTextSpanBuilder { - DefaultSpecialTextSpanBuilder({ - this.isUseDefaultEmoji = false, - this.customEmojiStickerList = const [], - this.showAtBackground = false, - }); - - /// whether show background for @somebody - final bool showAtBackground; - - final bool isUseDefaultEmoji; - - final List customEmojiStickerList; - - @override - SpecialText? createSpecialText(String flag, - {TextStyle? textStyle, - SpecialTextGestureTapCallback? onTap, - int? index}) { - if (flag == '') { - return null; - } - - ///index is end index of start flag, so text start index should be index-(flag.length-1) - if (isStart(flag, EmojiText.flag)) { - return EmojiText(textStyle, - start: index! - (EmojiText.flag.length - 1), - isUseDefaultEmoji: isUseDefaultEmoji, - customEmojiStickerList: customEmojiStickerList); - } else if (isStart(flag, HttpText.flag)) { - return HttpText(textStyle, onTap, - start: index! - (HttpText.flag.length - 1)); - } - return null; - } -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/special_text/emoji_text.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/special_text/emoji_text.dart deleted file mode 100644 index 2f0592b..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/special_text/emoji_text.dart +++ /dev/null @@ -1,104 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:tencent_extended_text/extended_text.dart'; -import 'package:tim_ui_kit_sticker_plugin/constant/emoji.dart'; - -///emoji/image text -class EmojiText extends SpecialText { - EmojiText(TextStyle? textStyle, - {this.start, - this.isUseDefaultEmoji = false, - this.customEmojiStickerList = const []}) - : super(EmojiText.flag, ']', textStyle); - static const String flag = '['; - final int? start; - final bool isUseDefaultEmoji; - final List customEmojiStickerList; - @override - InlineSpan finishText() { - final String key = toString(); - - if (EmojiUtil( - isUseDefaultEmoji: isUseDefaultEmoji, - customEmojiStickerList: customEmojiStickerList) - .instance - .emojiMap - .containsKey(key)) { - double size = 16; - - final TextStyle ts = textStyle!; - if (ts.fontSize != null) { - size = ts.fontSize! * 1.15; - } - - if (isUseDefaultEmoji == true) { - return ImageSpan( - AssetImage( - EmojiUtil( - isUseDefaultEmoji: isUseDefaultEmoji, - customEmojiStickerList: customEmojiStickerList) - .instance - .emojiMap[key]!, - package: "tencent_im_base"), - actualText: key, - imageWidth: size, - imageHeight: size, - start: start!, - // fit: BoxFit.cover, - margin: const EdgeInsets.all(0)); - } else { - return ImageSpan( - AssetImage(EmojiUtil( - isUseDefaultEmoji: isUseDefaultEmoji, - customEmojiStickerList: customEmojiStickerList) - .instance - .emojiMap[key]!), - actualText: key, - imageWidth: size, - imageHeight: size, - start: start!, - // fit: BoxFit.cover, - margin: const EdgeInsets.all(0)); - } - } - - return TextSpan(text: toString(), style: textStyle); - } -} - -class EmojiUtil { - EmojiUtil( - {this.isUseDefaultEmoji = false, this.customEmojiStickerList = const []}); - EmojiUtil._(this.isUseDefaultEmoji, this.customEmojiStickerList) { - if (isUseDefaultEmoji == true) { - for (int i = 0; i < ConstData.emojiList.length; i++) { - for (int j = 0; j < ConstData.emojiList[i].list.length; j++) { - String? emojiName = ConstData.emojiList[i].list[j].split('.png')[0]; - _emojiMap['[$emojiName]'] = - '$_emojiFilePath/${ConstData.emojiList[i].name}/$emojiName.png'; - _emojiMap['[${ConstData.emojiMapList[emojiName]}]'] = - '$_emojiFilePath/${ConstData.emojiList[i].name}/$emojiName.png'; - } - } - } else { - for (int i = 0; i < customEmojiStickerList.length; i++) { - for (int j = 0; j < customEmojiStickerList[i].list.length; j++) { - String? emojiName = - customEmojiStickerList[i].list[j].split('.png')[0]; - _emojiMap['[$emojiName]'] = - '$_emojiFilePath/${customEmojiStickerList[i].name}/$emojiName.png'; - } - } - } - } - final List customEmojiStickerList; - final bool isUseDefaultEmoji; - final Map _emojiMap = {}; - - Map get emojiMap => _emojiMap; - - final String _emojiFilePath = 'assets/custom_face_resource'; - // EmojiUitl? _instance; - static EmojiUtil? _instance; - EmojiUtil get instance => - _instance ??= EmojiUtil._(isUseDefaultEmoji, customEmojiStickerList); -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/special_text/http_text.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/special_text/http_text.dart deleted file mode 100644 index 3b5ef32..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/special_text/http_text.dart +++ /dev/null @@ -1,45 +0,0 @@ - -import 'package:flutter/gestures.dart'; -import 'package:flutter/material.dart'; -import 'package:tencent_cloud_chat_uikit/ui/widgets/link_preview/common/utils.dart'; -import 'package:tencent_extended_text/extended_text.dart'; - -class HttpText extends SpecialText { - HttpText(TextStyle? textStyle, SpecialTextGestureTapCallback? onTap, - {this.start}) - : super(flag, flag, textStyle, onTap: onTap); - static const String flag = '\$'; - final int? start; - @override - InlineSpan finishText() { - final String text = getContent(); - - return SpecialTextSpan( - text: text, - actualText: toString(), - start: start!, - - ///caret can move into special text - deleteAll: true, - style: TextStyle(color: LinkUtils.hexToColor("015fff")), - recognizer: TapGestureRecognizer() - ..onTap = () { - if (onTap != null) { - onTap!(toString()); - } - }); - } -} - -List dollarList = [ - '\$Dota2\$', - '\$Dota2 Ti9\$', - '\$CN dota best dota\$', - '\$Flutter\$', - '\$CN dev best dev\$', - '\$UWP\$', - '\$Nevermore\$', - '\$FlutterCandies\$', - '\$ExtendedImage\$', - '\$ExtendedText\$', -]; diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_at_text.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_at_text.dart deleted file mode 100644 index d1a27eb..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_at_text.dart +++ /dev/null @@ -1,172 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_state.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/group/group_services.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/services_locatar.dart'; - -import 'package:tencent_cloud_chat_uikit/ui/utils/platform.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/screen_utils.dart'; - -import 'package:tencent_im_base/tencent_im_base.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitGroupProfile/widgets/tim_ui_group_member_search.dart'; -import 'package:tencent_cloud_chat_uikit/ui/widgets/group_member_list.dart'; - -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart'; - -class AtText extends StatefulWidget { - final String? groupID; - final V2TimGroupInfo? groupInfo; - final List? groupMemberList; - final VoidCallback? closeFunc; - final Function( - V2TimGroupMemberFullInfo memberInfo, TapDownDetails? tapDetails)? - onChooseMember; - - // some Group type cant @all - final String? groupType; - - const AtText({ - this.groupID, - this.groupType, - Key? key, - this.groupInfo, - this.groupMemberList, - this.closeFunc, - this.onChooseMember, - }) : super(key: key); - - @override - State createState() => _AtTextState(); -} - -class _AtTextState extends TIMUIKitState { - final GroupServices _groupServices = serviceLocator(); - - List? groupMemberList; - List? searchMemberList; - - @override - void initState() { - groupMemberList = widget.groupMemberList; - searchMemberList = groupMemberList; - super.initState(); - } - - @override - void dispose() { - super.dispose(); - } - - _onTapMemberItem( - V2TimGroupMemberFullInfo memberInfo, TapDownDetails? tapDetails) { - if (widget.closeFunc != null) { - widget.closeFunc!(); - } - - if (widget.onChooseMember != null) { - widget.onChooseMember!(memberInfo, tapDetails); - } else { - Navigator.pop(context, memberInfo); - } - } - - Future> searchGroupMember( - V2TimGroupMemberSearchParam searchParam) async { - final res = - await _groupServices.searchGroupMembers(searchParam: searchParam); - - if (res.code == 0) {} - return res; - } - - handleSearchGroupMembers(String searchText, context) async { - final res = await searchGroupMember(V2TimGroupMemberSearchParam( - keywordList: [searchText], - groupIDList: [widget.groupID!], - )); - - if (res.code == 0) { - List list = []; - final searchResult = res.data!.groupMemberSearchResultItems!; - searchResult.forEach((key, value) { - if (value is List) { - for (V2TimGroupMemberFullInfo item in value) { - list.add(item); - } - } - }); - searchMemberList = list; - } - - setState(() { - searchMemberList = - isSearchTextExist(searchText) ? searchMemberList : groupMemberList; - }); - } - - bool isSearchTextExist(String? searchText) { - return searchText != null && searchText != ""; - } - - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - final TUITheme theme = value.theme; - - Widget mentionedMembersBody() { - return GroupProfileMemberList( - groupType: widget.groupType ?? "", - memberList: searchMemberList ?? [], - onTapMemberItem: _onTapMemberItem, - canAtAll: true, - canSlideDelete: false, - touchBottomCallBack: () { - // Get all by once, unnecessary to load more - }, - customTopArea: PlatformUtils().isWeb - ? null - : GroupMemberSearchTextField( - onTextChange: (text) => - handleSearchGroupMembers(text, context), - )); - } - - return TUIKitScreenUtils.getDeviceWidget( - desktopWidget: mentionedMembersBody(), - defaultWidget: Scaffold( - appBar: AppBar( - shadowColor: theme.weakBackgroundColor, - iconTheme: IconThemeData( - color: theme.appbarTextColor, - ), - backgroundColor: theme.appbarBgColor ?? - theme.primaryColor, - leading: Row( - children: [ - IconButton( - padding: const EdgeInsets.only(left: 16), - constraints: const BoxConstraints(), - icon: Image.asset( - 'images/arrow_back.png', - package: 'tencent_cloud_chat_uikit', - height: 34, - width: 34, - color: theme.appbarTextColor, - ), - onPressed: () async { - Navigator.pop(context); - }, - ), - ], - ), - centerTitle: true, - leadingWidth: 100, - title: Text( - TIM_t("选择提醒人"), - style: TextStyle( - color: theme.appbarTextColor, - fontSize: 17, - ), - ), - ), - body: mentionedMembersBody())); - } -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_call_invite_list.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_call_invite_list.dart deleted file mode 100644 index 2229fc8..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_call_invite_list.dart +++ /dev/null @@ -1,207 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:loading_animation_widget/loading_animation_widget.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_state.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/group/group_services.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/services_locatar.dart'; -import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; - -import 'package:tencent_cloud_chat_uikit/ui/utils/platform.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitGroupProfile/widgets/tim_ui_group_member_search.dart'; -import 'package:tencent_cloud_chat_uikit/ui/widgets/group_member_list.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart'; - -class SelectCallInviter extends StatefulWidget { - final String? groupID; - const SelectCallInviter({ - this.groupID, - Key? key, - }) : super(key: key); - - @override - State createState() => _SelectCallInviterState(); -} - -class _SelectCallInviterState extends TIMUIKitState { - final CoreServicesImpl _coreServicesImpl = serviceLocator(); - final GroupServices _groupServices = serviceLocator(); - List selectedMember = []; - List? _groupMemberList = []; - String _groupMemberListSeq = "0"; - List? searchMemberList; - String? searchText; - bool loading = true; - - @override - void initState() { - super.initState(); - if (widget.groupID != null) { - _loadGroupMemberList(groupID: widget.groupID!); - } - } - - @override - void dispose() { - super.dispose(); - } - - bool isSearchTextExist(String? searchText) { - return searchText != null && searchText != ""; - } - - Future _loadGroupMemberList( - {required String groupID, int count = 100, String? seq}) async { - if (seq == null || seq == "" || seq == "0") { - _groupMemberList = []; - } - final String? nextSeq = await _loadGroupMemberListFunction( - groupID: groupID, seq: seq, count: count); - if (nextSeq != null && nextSeq != "0" && nextSeq != "") { - return await _loadGroupMemberList( - groupID: groupID, count: count, seq: nextSeq); - } else { - setState(() { - _groupMemberList = _groupMemberList; - searchMemberList = _groupMemberList; - loading = true; - }); - } - } - - Future _loadGroupMemberListFunction( - {required String groupID, int count = 100, String? seq}) async { - if (seq == "0") { - _groupMemberList?.clear(); - } - final res = await _groupServices.getGroupMemberList( - groupID: widget.groupID!, - filter: GroupMemberFilterTypeEnum.V2TIM_GROUP_MEMBER_FILTER_ALL, - count: count, - nextSeq: seq ?? _groupMemberListSeq); - final groupMemberListRes = res.data; - if (res.code == 0 && groupMemberListRes != null) { - final groupMemberListTemp = groupMemberListRes.memberInfoList ?? []; - _groupMemberList = [...?_groupMemberList, ...groupMemberListTemp]; - _groupMemberListSeq = groupMemberListRes.nextSeq ?? "0"; - } - return groupMemberListRes?.nextSeq; - } - - Future> searchGroupMember( - V2TimGroupMemberSearchParam searchParam) async { - final res = - await _groupServices.searchGroupMembers(searchParam: searchParam); - - if (res.code == 0) {} - return res; - } - - handleSearchGroupMembers(String searchText, context) async { - loading = true; - if (widget.groupID == null || widget.groupID!.isEmpty) { - return; - } - List currentGroupMember = []; - final res = await searchGroupMember(V2TimGroupMemberSearchParam( - keywordList: [searchText], - groupIDList: [widget.groupID!], - )); - - if (res.code == 0) { - List list = []; - final searchResult = res.data!.groupMemberSearchResultItems!; - searchResult.forEach((key, value) { - if (value is List) { - for (V2TimGroupMemberFullInfo item in value) { - list.add(item); - } - } - }); - - currentGroupMember = list; - } else { - currentGroupMember = []; - } - setState(() { - loading = false; - searchMemberList = - isSearchTextExist(searchText) ? currentGroupMember : _groupMemberList; - }); - } - - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - final TUITheme theme = value.theme; - - return Scaffold( - appBar: AppBar( - shadowColor: theme.weakBackgroundColor, - iconTheme: IconThemeData( - color: theme.appbarTextColor, - ), - backgroundColor: theme.appbarBgColor ?? - theme.primaryColor, - leading: TextButton( - onPressed: () { - Navigator.pop(context); - }, - child: Text( - TIM_t("取消"), - style: TextStyle( - color: theme.appbarTextColor, - fontSize: 14, - ), - ), - ), - actions: [ - TextButton( - onPressed: () { - if (selectedMember.isNotEmpty) { - Navigator.pop(context, selectedMember); - } - }, - child: Text( - TIM_t("完成"), - style: TextStyle( - color: theme.appbarTextColor, - fontSize: 14, - ), - ), - ) - ], - centerTitle: true, - leadingWidth: 80, - title: Text( - TIM_t("发起呼叫"), - style: TextStyle( - color: theme.appbarTextColor, - fontSize: 17, - ), - ), - ), - body: ((searchMemberList ?? []).isNotEmpty || loading == false) - ? GroupProfileMemberList( - customTopArea: PlatformUtils().isWeb - ? null - : GroupMemberSearchTextField( - onTextChange: (text) => - handleSearchGroupMembers(text, context), - ), - memberList: (searchMemberList ?? []) - .where((element) => - element?.userID != _coreServicesImpl.loginInfo.userID) - .toList(), - canSlideDelete: false, - canSelectMember: true, - onSelectedMemberChange: (member) { - selectedMember = member; - setState(() {}); - }, - ) - : Center( - child: LoadingAnimationWidget.staggeredDotsWave( - color: theme.primaryColor ?? Colors.grey, - size: 40, - ), - )); - } -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_emoji_panel.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_emoji_panel.dart deleted file mode 100644 index a1df2dd..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_emoji_panel.dart +++ /dev/null @@ -1,87 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_statelesswidget.dart'; -import 'package:tencent_im_base/tencent_im_base.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/platform.dart'; - -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart'; - -class EmojiPanel extends TIMUIKitStatelessWidget { - final void Function(int unicode) onTapEmoji; - final void Function() onSubmitted; - final void Function() delete; - final bool showBottomContainer; - - EmojiPanel({ - Key? key, - required this.onTapEmoji, - required this.onSubmitted, - required this.delete, - this.showBottomContainer = true, // 可选参数,是否展示下方的底部导航栏 - }) : super(key: key); - - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - // ignore: avoid_print - print(TIM_t( - "暂未安装表情包插件,如需使用表情相关功能,请根据本文档安装:https://cloud.tencent.com/document/product/269/70746")); - return SingleChildScrollView( - child: Column( - children: [ - Container( - height: showBottomContainer ? 190 : 248, - // color: theme.weakBackgroundColor, - padding: const EdgeInsets.fromLTRB(24, 16, 24, 16), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text(TIM_t("暂无表情包")), - ], - ), - ), - showBottomContainer - ? Row( - mainAxisAlignment: MainAxisAlignment.end, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SingleChildScrollView( - child: Container( - // color: Colors.white, - margin: const EdgeInsets.only(right: 25), - // height: MediaQuery.of(context).padding.bottom, - child: ElevatedButton( - child: Text(TIM_t("发送")), - style: ElevatedButton.styleFrom(), - onPressed: () { - onSubmitted(); - })), - ), - ], - ) - : Container() - ], - )); - } -} - -class EmojiItem extends TIMUIKitStatelessWidget { - EmojiItem({Key? key, required this.name, required this.unicode}) - : super(key: key); - final String name; - final int unicode; - - // final String toUser; - // final int type; - // final Function close; - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - return DefaultTextStyle( - style: TextStyle( - fontSize: (PlatformUtils().isAndroid) ? 20 : 26, - color: hexToColor("f9453d") - ), - child: Text( - String.fromCharCode(unicode), - ), - ); - } -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_more_panel.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_more_panel.dart deleted file mode 100644 index 8bdfca0..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_more_panel.dart +++ /dev/null @@ -1,741 +0,0 @@ -// ignore_for_file: unused_field, avoid_print, unused_import - -import 'dart:io'; -import 'package:device_info_plus/device_info_plus.dart'; -import 'package:fc_native_video_thumbnail_for_us/fc_native_video_thumbnail_for_us.dart'; -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_svg/svg.dart'; -import 'package:image_picker/image_picker.dart'; -import 'package:file_picker/file_picker.dart'; -import 'package:path_provider/path_provider.dart'; -import 'package:provider/provider.dart'; -import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitTextField/tim_uikit_call_invite_list.dart'; -import 'package:tencent_wechat_camera_picker/tencent_wechat_camera_picker.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_state.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/separate_models/tui_chat_separate_view_model.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_chat_global_model.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_self_info_view_model.dart'; -import 'package:path/path.dart' as p; -import 'package:tencent_cloud_chat_uikit/data_services/services_locatar.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/message.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/permission.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/platform.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitTextField/intl_camer_picker.dart'; -import 'package:wechat_assets_picker/wechat_assets_picker.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart'; - -// ignore: unnecessary_import -import 'dart:typed_data'; -import 'package:universal_html/html.dart' as html; - -class MorePanelConfig { - final bool showGalleryPickAction; - final bool showCameraAction; - final bool showFilePickAction; - final bool showWebImagePickAction; - final bool showWebVideoPickAction; - final bool showVoiceCall; - final bool showVideoCall; - final List? extraAction; - final Widget Function(MorePanelItem item)? actionBuilder; - - MorePanelConfig({ - this.showFilePickAction = true, - this.showGalleryPickAction = true, - this.showCameraAction = true, - this.showWebImagePickAction = true, - this.showWebVideoPickAction = true, - this.showVoiceCall = true, - this.showVideoCall = true, - this.extraAction, - this.actionBuilder, - }); -} - -class MorePanelItem { - final String title; - final String id; - final Widget icon; - final Function(BuildContext context)? onTap; - - MorePanelItem( - {this.onTap, required this.icon, required this.id, required this.title}); -} - -class MorePanel extends StatefulWidget { - /// 会话ID - final String conversationID; - - /// 会话类型 - final ConvType conversationType; - - final MorePanelConfig? morePanelConfig; - - const MorePanel( - {required this.conversationID, - required this.conversationType, - Key? key, - this.morePanelConfig}) - : super(key: key); - - @override - State createState() => _MorePanelState(); -} - -class _MorePanelState extends TIMUIKitState { - final ImagePicker _picker = ImagePicker(); - final TUISelfInfoViewModel _selfInfoViewModel = - serviceLocator(); - Uint8List? fileContent; - String? fileName; - File? tempFile; - final _tUICore = TUICore(); - final _tUILogin = TUILogin(); - bool isInstallCallkit = false; - final ScrollController _scrollController = ScrollController(); - final DeviceInfoPlugin deviceInfo = DeviceInfoPlugin(); - - @override - void initState() { - super.initState(); - if (PlatformUtils().isMobile) { - _tUICore.getService(TUICALLKIT_SERVICE_NAME).then((value) { - setState(() { - isInstallCallkit = value; - }); - }); - } - } - - List itemList(TUIChatSeparateViewModel model, TUITheme theme) { - final config = widget.morePanelConfig ?? MorePanelConfig(); - return [ - if (PlatformUtils().isMobile) - MorePanelItem( - id: "screen", - title: TIM_t("拍摄"), - onTap: (c) { - _onFeatureTap("screen", c, model, theme); - }, - icon: Container( - height: 64, - width: 64, - margin: const EdgeInsets.only(bottom: 4), - decoration: const BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all(Radius.circular(5))), - child: SvgPicture.asset( - "images/screen.svg", - package: 'tencent_cloud_chat_uikit', - height: 64, - width: 64, - ), - )), - if (!PlatformUtils().isWeb) - MorePanelItem( - id: "photo", - title: TIM_t("照片"), - onTap: (c) { - _onFeatureTap( - "photo", - c, - model, - theme, - ); - }, - icon: Container( - height: 64, - width: 64, - margin: const EdgeInsets.only(bottom: 4), - decoration: const BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all(Radius.circular(5))), - child: SvgPicture.asset( - "images/photo.svg", - package: 'tencent_cloud_chat_uikit', - height: 64, - width: 64, - ), - )), - if (PlatformUtils().isWeb) - MorePanelItem( - id: "image", - title: TIM_t("图片"), - onTap: (c) { - _onFeatureTap( - "image", - c, - model, - theme, - ); - }, - icon: Container( - height: 64, - width: 64, - margin: const EdgeInsets.only(bottom: 4), - decoration: const BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all(Radius.circular(5))), - child: SvgPicture.asset( - "images/photo.svg", - package: 'tencent_cloud_chat_uikit', - height: 64, - width: 64, - ), - )), - if (PlatformUtils().isWeb) - MorePanelItem( - id: "video", - title: TIM_t("视频"), - onTap: (c) { - _onFeatureTap( - "video", - c, - model, - theme, - ); - }, - icon: Container( - height: 64, - width: 64, - margin: const EdgeInsets.only(bottom: 4), - decoration: const BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all(Radius.circular(5))), - child: - Icon(Icons.video_file, color: hexToColor("5c6168"), size: 26), - )), - MorePanelItem( - id: "file", - title: TIM_t("文件"), - onTap: (c) { - _onFeatureTap( - "file", - c, - model, - theme, - ); - }, - icon: Container( - height: 64, - width: 64, - margin: const EdgeInsets.only(bottom: 4), - decoration: const BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all(Radius.circular(5))), - child: SvgPicture.asset( - "images/file.svg", - package: 'tencent_cloud_chat_uikit', - height: 64, - width: 64, - ), - )), - if (isInstallCallkit && PlatformUtils().isMobile) - MorePanelItem( - id: "videoCall", - title: TIM_t("视频通话"), - onTap: (c) { - _onFeatureTap( - "videoCall", - c, - model, - theme, - ); - }, - icon: Container( - height: 64, - width: 64, - margin: const EdgeInsets.only(bottom: 4), - decoration: const BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all(Radius.circular(5))), - child: SvgPicture.asset( - "images/video-call.svg", - package: 'tencent_cloud_chat_uikit', - height: 64, - width: 64, - ), - )), - if (isInstallCallkit && PlatformUtils().isMobile) - MorePanelItem( - id: "voiceCall", - title: TIM_t("语音通话"), - onTap: (c) { - _onFeatureTap( - "voiceCall", - c, - model, - theme, - ); - }, - icon: Container( - height: 64, - width: 64, - margin: const EdgeInsets.only(bottom: 4), - decoration: const BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all(Radius.circular(5))), - child: SvgPicture.asset( - "images/voice-call.svg", - package: 'tencent_cloud_chat_uikit', - height: 64, - width: 64, - ), - )), - if (config.extraAction != null) ...?config.extraAction, - ].where((element) { - if (element.id == "screen") { - return config.showCameraAction; - } - - if (element.id == "file") { - return config.showFilePickAction; - } - - if (element.id == "photo") { - return config.showGalleryPickAction; - } - - if (element.id == "image") { - return config.showWebImagePickAction; - } - - if (element.id == "video") { - return config.showWebVideoPickAction; - } - if (element.id == "voiceCall") { - return config.showVoiceCall; - } - if (element.id == "videoCall") { - return config.showVideoCall; - } - return true; - }).toList(); - } - - _sendVideoMessage(AssetEntity asset, TUIChatSeparateViewModel model) async { - final plugin = FcNativeVideoThumbnail(); - final originFile = await asset.originFile; - final size = await originFile!.length(); - if (size >= 104857600) { - onTIMCallback(TIMCallback( - type: TIMCallbackType.INFO, - infoRecommendText: TIM_t("发送失败,视频不能大于100MB"), - infoCode: 6660405)); - return; - } - - final duration = asset.videoDuration.inSeconds; - final filePath = originFile.path; - final convID = widget.conversationID; - final convType = widget.conversationType; - - String tempPath = (await getTemporaryDirectory()).path + - p.basename(originFile.path) + - ".jpeg"; - - await plugin.getVideoThumbnail( - srcFile: originFile.path, - keepAspectRatio: true, - destFile: tempPath, - format: 'jpeg', - width: 128, - quality: 100, - height: 128, - ); - MessageUtils.handleMessageError( - model.sendVideoMessage( - videoPath: filePath, - duration: duration, - snapshotPath: tempPath, - convID: convID, - convType: convType), - context); - } - - _sendImageMessage(TUIChatSeparateViewModel model, TUITheme theme) async { - try { - if (PlatformUtils().isMobile){ - if(PlatformUtils().isAndroid){ - AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo; - if ((androidInfo.version.sdkInt ?? 0) >= 33) { - final videos = await Permissions.checkPermission( - context,Permission.videos.value, - theme, - ); - final photos = await Permissions.checkPermission( - context,Permission.photos.value, - - theme, - ); - if(!videos && !photos){ - return; - } - } else { - final storage = await Permissions.checkPermission( - context, Permission.storage.value, - theme, - ); - if(!storage){ - return; - } - } - }else{ - final photos = await Permissions.checkPermission( - context, - Permission.photos.value, - theme, - ); - if(!photos){ - return; - } - } - } - - final convID = widget.conversationID; - final convType = widget.conversationType; - - if (PlatformUtils().isMobile) { - final pickedAssets = await AssetPicker.pickAssets(context); - - if (pickedAssets != null) { - for (var asset in pickedAssets) { - final originFile = await asset.originFile; - final filePath = originFile?.path; - final type = asset.type; - if (filePath != null) { - if (type == AssetType.image) { - MessageUtils.handleMessageError( - model.sendImageMessage( - imagePath: filePath, - convID: convID, - convType: convType), - context); - } - - if (type == AssetType.video) { - _sendVideoMessage(asset, model); - } - } - } - } - } else { - FilePickerResult? result = - await FilePicker.platform.pickFiles(type: FileType.media); - if (result != null && result.files.isNotEmpty) { - File file = File(result.files.single.path!); - final String savePath = file.path; - final String type = TencentUtils.getFileType( - savePath.split(".")[savePath.split(".").length - 1]) - .split("/")[0]; - - if (type == "image") { - MessageUtils.handleMessageError( - model.sendImageMessage( - imagePath: savePath, convID: convID, convType: convType), - context); - } else if (type == "video") { - MessageUtils.handleMessageError( - model.sendVideoMessage( - videoPath: savePath, convID: convID, convType: convType), - context); - } - } else { - throw TypeError(); - } - } - } catch (err) { - print("err: $err"); - } - } - - _sendImageFromCamera( - TUIChatSeparateViewModel model, - TUITheme theme, - ) async { - try { - if (!await Permissions.checkPermission( - context, - Permission.camera.value, - theme, - )) { - return; - } - await Permissions.checkPermission( - context, - Permission.microphone.value, - theme, - ); - final convID = widget.conversationID; - final convType = widget.conversationType; - final pickedFile = await CameraPicker.pickFromCamera(context, - pickerConfig: CameraPickerConfig( - enableRecording: true, - textDelegate: IntlCameraPickerTextDelegate())); - final originFile = await pickedFile?.originFile; - if (originFile != null) { - final type = pickedFile!.type; - if (type == AssetType.image) { - MessageUtils.handleMessageError( - model.sendImageMessage( - imagePath: originFile.path, - convID: convID, - convType: convType), - context); - } - if (type == AssetType.video) { - _sendVideoMessage(pickedFile, model); - } - } else { - // Toast.showToast(ToastType.fail, TIM_t("图片不能为空"), context); - } - } catch (error) { - print("err: $error"); - } - } - - _sendImageFileOnWeb(TUIChatSeparateViewModel model) async { - try { - final pickedFile = await _picker.pickImage(source: ImageSource.gallery); - final imageContent = await pickedFile!.readAsBytes(); - fileName = pickedFile.name; - tempFile = File(pickedFile.path); - fileContent = imageContent; - - html.Node? inputElem; - inputElem = html.document - .getElementById("__image_picker_web-file-input") - ?.querySelector("input"); - final convID = widget.conversationID; - final convType = widget.conversationType; - MessageUtils.handleMessageError( - model.sendImageMessage( - inputElement: inputElem, - imagePath: tempFile?.path, - convID: convID, - convType: convType), - context); - } catch (e) { - print("_sendFileErr: ${e.toString()}"); - } - } - - _sendVideoFileOnWeb(TUIChatSeparateViewModel model) async { - try { - final pickedFile = await _picker.pickVideo(source: ImageSource.gallery); - final videoContent = await pickedFile!.readAsBytes(); - fileName = pickedFile.name; - tempFile = File(pickedFile.path); - fileContent = videoContent; - - if (fileName!.split(".")[fileName!.split(".").length - 1] != "mp4") { - onTIMCallback(TIMCallback( - type: TIMCallbackType.INFO, - infoRecommendText: TIM_t("视频消息仅限 mp4 格式"), - infoCode: 6660412)); - return; - } - - html.Node? inputElem; - inputElem = html.document - .getElementById("__image_picker_web-file-input") - ?.querySelector("input"); - final convID = widget.conversationID; - final convType = widget.conversationType; - MessageUtils.handleMessageError( - model.sendVideoMessage( - inputElement: inputElem, - videoPath: tempFile?.path, - convID: convID, - convType: convType), - context); - } catch (e) { - print("_sendFileErr: ${e.toString()}"); - } - } - - _sendFile( - TUIChatSeparateViewModel model, - TUITheme theme, - ) async { - try { - final convID = widget.conversationID; - final convType = widget.conversationType; - FilePickerResult? result = await FilePicker.platform.pickFiles(); - if (result != null && result.files.isNotEmpty) { - if (PlatformUtils().isWeb) { - html.Node? inputElem; - inputElem = html.document - .getElementById("__file_picker_web-file-input") - ?.querySelector("input"); - fileName = result.files.single.name; - - MessageUtils.handleMessageError( - model.sendFileMessage( - inputElement: inputElem, - fileName: fileName, - convID: convID, - convType: convType), - context); - return; - } - - String? option2 = result.files.single.path ?? ""; - print(TIM_t_para("选择成功{{option2}}", "选择成功$option2")(option2: option2)); - - File file = File(result.files.single.path!); - final int size = file.lengthSync(); - final String savePath = file.path; - - MessageUtils.handleMessageError( - model.sendFileMessage( - filePath: savePath, - size: size, - convID: convID, - convType: convType), - context); - } else { - throw TypeError(); - } - } catch (e) { - print("_sendFileErr: ${e.toString()}"); - } - } - - _onFeatureTap( - String id, - BuildContext context, - TUIChatSeparateViewModel model, - TUITheme theme, - ) async { - switch (id) { - case "photo": - _sendImageMessage(model, theme); - break; - case "screen": - _sendImageFromCamera(model, theme); - break; - case "file": - _sendFile(model, theme); - break; - case "image": - // only for web - _sendImageFileOnWeb(model); - break; - case "video": - // only for web - _sendVideoFileOnWeb(model); - break; - case "voiceCall": - _goToVideoUI(TYPE_AUDIO); - break; - case "videoCall": - _goToVideoUI(TYPE_VIDEO); - break; - } - } - - _goToVideoUI(String type) async { - if (!PlatformUtils().isWeb) { - final hasCameraPermission = type == TYPE_VIDEO - ? await Permissions.checkPermission(context, Permission.camera.value) - : true; - final hasMicphonePermission = await Permissions.checkPermission( - context, Permission.microphone.value); - if (!hasCameraPermission || !hasMicphonePermission) { - return; - } - } - - final isGroup = widget.conversationType == ConvType.group; - if (isGroup) { - List? selectedMember = await Navigator.push( - context, - MaterialPageRoute( - builder: (context) => SelectCallInviter( - groupID: widget.conversationID, - ), - ), - ); - if (selectedMember != null) { - final inviteMember = selectedMember.map((e) => e.userID).toList(); - _tUICore.callService(TUICALLKIT_SERVICE_NAME, METHOD_NAME_CALL, { - PARAM_NAME_TYPE: type, - PARAM_NAME_USERIDS: inviteMember, - PARAM_NAME_GROUPID: widget.conversationType == ConvType.group - ? widget.conversationID - : "" - }); - } - } else { - _tUICore.callService(TUICALLKIT_SERVICE_NAME, METHOD_NAME_CALL, { - PARAM_NAME_TYPE: type, - PARAM_NAME_USERIDS: [widget.conversationID], - PARAM_NAME_GROUPID: "" - }); - } - } - - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - final TUITheme theme = value.theme; - final TUIChatSeparateViewModel model = - Provider.of(context); - final screenWidth = MediaQuery.of(context).size.width; - return Container( - height: 248, - decoration: BoxDecoration( - // color: hexToColor("EBF0F6"), - border: Border( - top: BorderSide(width: 1, color: Colors.grey.shade300), - ), - ), - padding: const EdgeInsets.only(top: 20, left: 20, right: 20), - width: screenWidth, - child: Scrollbar( - controller: _scrollController, - child: SingleChildScrollView( - controller: _scrollController, - child: Wrap( - spacing: (screenWidth - (23 * 2) - 64 * 4) / 3, - runSpacing: 20, - children: itemList(model, theme) - .map((item) => InkWell( - onTap: () { - if (item.onTap != null) { - item.onTap!(context); - } - }, - child: widget.morePanelConfig?.actionBuilder != null - ? widget.morePanelConfig?.actionBuilder!(item) - : SizedBox( - height: 94, - width: 64, - child: Column( - children: [ - Container( - height: 64, - width: 64, - margin: const EdgeInsets.only(bottom: 4), - decoration: const BoxDecoration( - borderRadius: - BorderRadius.all(Radius.circular(5))), - child: item.icon, - ), - Text( - item.title, - style: TextStyle( - fontSize: 12, color: theme.darkTextColor), - ) - ], - ), - ))) - .toList(), - ), - ), - ), - ); - } -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_send_sound_message.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_send_sound_message.dart deleted file mode 100644 index 0672977..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_send_sound_message.dart +++ /dev/null @@ -1,325 +0,0 @@ -// ignore_for_file: avoid_print, unused_import - -import 'dart:async'; -import 'dart:io'; -import 'dart:math'; -import 'package:flutter/material.dart'; -import 'package:permission_handler/permission_handler.dart'; -import 'package:tencent_im_base/tencent_im_base.dart'; -import 'package:provider/provider.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_state.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/separate_models/tui_chat_separate_view_model.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_chat_global_model.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/services_locatar.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/message.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/permission.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/sound_record.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart'; - -import '../../../../network/api.dart'; -import '../../../../network/dio_manager.dart'; - -class TIMSendSoundMessage extends StatefulWidget { - /// conversation ID - final String conversationID; - - /// control the list to bottom - final VoidCallback onDownBottom; - - /// the conversation type - final ConvType conversationType; - - const TIMSendSoundMessage( - {required this.conversationID, - required this.conversationType, - Key? key, - required this.onDownBottom}) - : super(key: key); - - @override - State createState() => _TIMSendSoundMessageState(); -} - -class _TIMSendSoundMessageState extends TIMUIKitState { - final TUIChatGlobalModel model = serviceLocator(); - String soundTipsText = ""; - bool isRecording = false; - bool isInit = false; - bool isCancelSend = false; - DateTime startTime = DateTime.now(); - List> subscriptions = []; - - OverlayEntry? overlayEntry; - String voiceIcon = "images/voice_volume_1.png"; - double volume = 0.1; - - buildOverLayView(BuildContext context) { - if (overlayEntry == null) { - overlayEntry = OverlayEntry(builder: (content) { - return Positioned( - top: 0, - left: 0, - width: MediaQuery.of(context).size.width, - height: MediaQuery.of(context).size.height, - child: Material( - color: Colors.transparent, - type: MaterialType.canvas, - child: Center( - child: Opacity( - opacity: 0.8, - child: Container( - width: 160, - height: 160, - decoration: const BoxDecoration( - color: Colors.transparent, - // color: Color(0xff77797A), - borderRadius: BorderRadius.all(Radius.circular(20.0)), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - const SizedBox( - height: 20, - ), - Row( - crossAxisAlignment: CrossAxisAlignment.end, - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - margin: const EdgeInsets.only(top: 10), - child: Image.asset( - "images/microphone.png", - width: 50, - height: 60, - package: 'flutter_plugin_record_plus', - ), - ), - ClipRect( - clipBehavior: Clip.hardEdge, - child: Align( - heightFactor: max(min(volume, 1), 0.1), - alignment: Alignment.bottomCenter, - child: SizedBox( - width: 50, - height: 60, - child: Image.asset( - "images/voice_volume_total.png", - width: 50, - height: 60, - package: 'flutter_plugin_record_plus', - ), - ), - ), - ), - ], - ), - const SizedBox( - height: 20, - ), - Text( - soundTipsText, - style: const TextStyle( - fontStyle: FontStyle.normal, - color: Colors.white, - fontSize: 14, - ), - ) - ], - ), - ), - ), - ), - ), - ); - }); - Overlay.of(context)?.insert(overlayEntry!); - } - } - - onLongPressStart(_) { - if (isInit) { - setState(() { - soundTipsText = TIM_t("手指上滑,取消发送"); - }); - startTime = DateTime.now(); - SoundPlayer.startRecord(); - buildOverLayView(context); - } - } - - onLongPressUpdate(e) { - double height = MediaQuery.of(context).size.height * 0.5 - 240; - double dy = e.localPosition.dy; - - if (dy.abs() > height) { - if (mounted && soundTipsText != TIM_t("松开取消")) { - setState(() { - soundTipsText = TIM_t("松开取消"); - }); - } - } else { - if (mounted && soundTipsText == TIM_t("松开取消")) { - setState(() { - soundTipsText = TIM_t("手指上滑,取消发送"); - }); - } - } - } - - onLongPressEnd(e) { - double dy = e.localPosition.dy; - // 此高度为 160为录音取消组件距离顶部的预留距离 - double height = MediaQuery.of(context).size.height * 0.5 - 240; - if (dy.abs() > height) { - isCancelSend = true; - } else { - isCancelSend = false; - } - if (overlayEntry != null) { - overlayEntry!.remove(); - overlayEntry = null; - } - // Did not receive onStop from FlutterPluginRecord if the duration is too short. - if (DateTime.now().difference(startTime).inSeconds < 1) { - isCancelSend = true; - onTIMCallback(TIMCallback( - type: TIMCallbackType.INFO, - infoRecommendText: TIM_t("说话时间太短"), - infoCode: 6660404)); - } - stop(); - } - - onLonePressCancel() { - if (isRecording) { - isCancelSend = true; - if (overlayEntry != null) { - overlayEntry!.remove(); - overlayEntry = null; - } - stop(); - } - } - - void stop() { - setState(() { - isRecording = false; - }); - SoundPlayer.stopRecord(); - setState(() { - soundTipsText = TIM_t("手指上滑,取消发送"); - }); - } - - sendSound( - {required String path, - required int duration, - required TUIChatSeparateViewModel model}) { - final convID = widget.conversationID; - final convType = widget.conversationType; - - if (duration > 0) { - if (!isCancelSend) { - MessageUtils.handleMessageError( - model.sendSoundMessage( - soundPath: path, - duration: duration, - convID: convID, - convType: convType), - context); - DioManager.instance.get(url: Api.getAddTrialCount + "5"); - widget.onDownBottom(); - } else { - isCancelSend = false; - } - } else { - onTIMCallback(TIMCallback( - type: TIMCallbackType.INFO, - infoRecommendText: TIM_t("说话时间太短"), - infoCode: 6660404)); - } - } - - @override - dispose() { - for (var subscription in subscriptions) { - subscription.cancel(); - } - super.dispose(); - } - - initRecordSound(TUIChatSeparateViewModel model) { - final responseSubscription = SoundPlayer.responseListener((recordResponse) { - final status = recordResponse.msg; - if (status == "onStop") { - if (!isCancelSend) { - final soundPath = recordResponse.path; - final recordDuration = recordResponse.audioTimeLength; - sendSound( - path: soundPath!, duration: recordDuration!.ceil(), model: model); - } - } else if (status == "onStart") { - print("start record"); - setState(() { - isRecording = true; - }); - } else { - print(status); - } - }); - final amplitudesResponseSubscription = - SoundPlayer.responseFromAmplitudeListener((recordResponse) { - setState(() { - volume = double.parse(recordResponse.msg!) * 1.1; - if (overlayEntry != null) { - overlayEntry!.markNeedsBuild(); - } - }); - }); - subscriptions = [responseSubscription, amplitudesResponseSubscription]; - SoundPlayer.initSoundPlayer(); - isInit = true; - } - - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - final TUITheme theme = value.theme; - final TUIChatSeparateViewModel model = - Provider.of(context); - return GestureDetector( - behavior: HitTestBehavior.opaque, - onTapDown: (detail) async { - if (!isInit) { - bool hasMicrophonePermission = await Permissions.checkPermission( - context, - Permission.microphone.value, - theme, - ); - if (!hasMicrophonePermission) { - return; - } - initRecordSound(model); - } - }, - onLongPressStart: onLongPressStart, - onLongPressMoveUpdate: onLongPressUpdate, - onLongPressEnd: onLongPressEnd, - onLongPressCancel: onLonePressCancel, - child: Container( - height: 35, - // color: isRecording ? theme.weakBackgroundColor : Colors.white, - alignment: Alignment.center, - child: Text( - TIM_t("按住说话"), - textAlign: TextAlign.center, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 16, - color: Colors.white, - ), - ), - ), - ); - } -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field.dart deleted file mode 100644 index 4b90d5e..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field.dart +++ /dev/null @@ -1,1360 +0,0 @@ -import 'dart:async'; -import 'dart:convert'; -import 'dart:math'; -import 'package:circle_app/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field_layout/narrow.dart'; -import 'package:circle_app/main.dart'; -import 'package:circle_app/network/api.dart'; -import 'package:circle_app/network/dio_manager.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:diff_match_patch/diff_match_patch.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_setting_model.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/friendShip/friendship_services.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/screen_utils.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field_layout/narrow.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:provider/provider.dart'; -import 'package:scroll_to_index/scroll_to_index.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_state.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/separate_models/tui_chat_separate_view_model.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_chat_global_model.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_conversation_view_model.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_self_info_view_model.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/services_locatar.dart'; -import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/message.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/platform.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitTextField/tim_uikit_at_text.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field_layout/wide.dart'; - -import '../../../../common/Widgets/base_tip_widget.dart'; -import '../../../../common/Widgets/open_vip_tip/view.dart'; -import '../../../../util/eventBus.dart'; -import '../../../userinfo/logic.dart'; -import '../../widget/send_gift_dialog.dart'; - -enum MuteStatus { none, me, all } - -GlobalKey<_InputTextFieldState> myInputTextFieldState = GlobalKey(); - -class TIMInputTextField extends StatefulWidget { - /// conversation id - final String conversationID; - - /// conversation type - final ConvType conversationType; - - /// init text, use for draft text re-view - final String? initText; - - /// messageList widget scroll controller - final AutoScrollController? scrollController; - - /// messageList widget scroll controller - final AutoScrollController? atMemberPanelScroll; - - /// hint text for textField widget - String? hintText; - - /// config for more pannel - final MorePanelConfig? morePanelConfig; - - /// show send audio icon - final bool showSendAudio; - - /// show send emoji icon - final bool showSendEmoji; - - /// show more panel - final bool showMorePanel; - - /// background color - final Color? backgroundColor; - - /// control input field behavior - final TIMUIKitInputTextFieldController? controller; - - /// on text changed - final void Function(String)? onChanged; - - final TUIChatSeparateViewModel model; - - /// Whether to use the default emoji - final bool isUseDefaultEmoji; - - final List customEmojiStickerList; - - /// sticker panel customization - final CustomStickerPanel? customStickerPanel; - - /// Conversation need search - final V2TimConversation currentConversation; - - final String? groupType; - - bool? isBlack; - - TIMInputTextField( - {Key? key, - required this.conversationID, - required this.conversationType, - this.initText, - required this.isBlack, - required this.hintText, - this.scrollController, - this.morePanelConfig, - this.customStickerPanel, - this.showSendAudio = true, - this.showSendEmoji = true, - this.showMorePanel = true, - this.backgroundColor, - this.controller, - this.onChanged, - this.isUseDefaultEmoji = false, - this.customEmojiStickerList = const [], - required this.model, - required this.currentConversation, - this.groupType, - this.atMemberPanelScroll}) - : super(key: key); - - @override - State createState() => _InputTextFieldState(); -} - -class _InputTextFieldState extends TIMUIKitState { - final TUIChatGlobalModel globalModel = serviceLocator(); - final TUISettingModel settingModel = serviceLocator(); - final RegExp atTextReg = RegExp(r'@([^@\s]*)'); - late FocusNode focusNode; - String zeroWidthSpace = '\ufeff'; - String lastText = ""; - String languageType = ""; - int? currentCursor; - bool isAddingAtSearchWords = false; - bool imStatusOK = false; - double inputWidth = 900; - - String hintText = '用心聊天更容易获得回复哦~'; - - List urlList = [ - 'https://iquanpai.com', - 'https://cdtszn.net', - 'https://ikuayou.com', - 'https://leyuan666.com', - 'https://kuayou666.com', - 'https://cdts666.com', - 'https://quanpai666.com', - 'https://xidi.iquanpai.com' - ]; - - Map memberInfoMap = {}; - - late TextEditingController textEditingController; - final TUIConversationViewModel conversationModel = - serviceLocator(); - final TUISelfInfoViewModel selfModel = serviceLocator(); - MuteStatus muteStatus = MuteStatus.none; - - int latestSendEditStatusTime = DateTime.now().millisecondsSinceEpoch; - - UserBean? userInfoBean; - - setCurrentCursor(int? value) { - currentCursor = value; - } - - void addStickerToText(String sticker) { - final oldText = textEditingController.text; - if (currentCursor != null && currentCursor! > -1) { - final firstString = oldText.substring(0, currentCursor); - final secondString = oldText.substring(currentCursor!); - currentCursor = currentCursor! + sticker.length; - textEditingController.text = "$firstString$sticker$secondString"; - } else { - textEditingController.text = "$oldText$sticker"; - } - - if (TUIKitScreenUtils.getFormFactor(context) == DeviceType.Desktop) { - focusNode.unfocus(); - } - } - - String _filterU200b(String text) { - return text.replaceAll(RegExp(r'\ufeff'), ""); - } - - getShowName(message) { - return TencentUtils.checkStringWithoutSpace(message?.friendRemark) ?? - TencentUtils.checkStringWithoutSpace(message?.nickName) ?? - TencentUtils.checkStringWithoutSpace(message?.userID); - } - - handleSetDraftText([String? id, ConvType? convType]) async { - String convID = id ?? widget.conversationID; - String conversationID = - (convType ?? widget.conversationType) == ConvType.c2c - ? "c2c_$convID" - : "group_$convID"; - String text = textEditingController.text; - String? draftText = _filterU200b(text); - - if (draftText.isEmpty) { - draftText = ""; - } - await conversationModel.setConversationDraft( - conversationID: conversationID, draftText: draftText); - } - - backSpaceText() { - String originalText = textEditingController.text; - dynamic text; - - if (originalText == zeroWidthSpace) { - _handleSoftKeyBoardDelete(); - // _addDeleteTag(); - } else { - text = originalText.characters.skipLast(1); - textEditingController.text = text; - // handleSetDraftText(); - } - } - -// 和onSubmitted一样,只是保持焦点的不同 - onEmojiSubmitted() { - lastText = ""; - final text = textEditingController.text.trim(); - final convType = widget.conversationType; - if (text.isNotEmpty && text != zeroWidthSpace) { - if (widget.model.repliedMessage != null) { - MessageUtils.handleMessageError( - widget.model.sendReplyMessage( - text: text, - convID: widget.conversationID, - convType: convType, - atUserIDList: getUserIdFromMemberInfoMap(), - ), - context); - } else { - MessageUtils.handleMessageError( - widget.model.sendTextMessage( - text: text, - convID: widget.conversationID, - convType: convType, - ), - context); - } - textEditingController.clear(); - goDownBottom(); - } - currentCursor = null; - } - -// index为emoji的index,data为baseurl+name - onCustomEmojiFaceSubmitted(int index, String data) { - final convType = widget.conversationType; - if (widget.model.repliedMessage != null) { - MessageUtils.handleMessageError( - widget.model.sendFaceMessage( - index: index, - data: data, - convID: widget.conversationID, - convType: convType), - context); - } else { - MessageUtils.handleMessageError( - widget.model.sendFaceMessage( - index: index, - data: data, - convID: widget.conversationID, - convType: convType), - context); - } - } - - List getUserIdFromMemberInfoMap() { - List userList = []; - memberInfoMap.forEach((String key, V2TimGroupMemberFullInfo info) { - userList.add(info.userID); - }); - - return userList; - } - - Future checkImStatus() async { - List pressionStr = - '微信、QQ、加Q、+V、地球号、绿泡泡、公众号、网站、app、视频、手机号、id、企鹅、门槛、收费、加群'.split('、'); - - if (textEditingController.text.isNotEmpty && - (userInfoBean?.wx_num?.isEmpty ?? true)) { - bool isContain = false; - String sendText = textEditingController.text.toUpperCase(); - for (String text in pressionStr) { - if (sendText.contains(text)) { - isContain = true; - } - } - if (isContain) { - await showAddWxPicker( - userInfoBean!.wx_num!.isNotEmpty ?? false, - isHidden: userInfoBean!.wx_num!.isNotEmpty ?? false, - isWxHidden: userInfoBean!.hide_wx_num == 1, - ); - imStatusOK = false; - return imStatusOK; - } - } - - var data = await DioManager.instance.get(url: Api.imstate); - - int code = data['code']; - if (code == 200) { - try { - var result = await DioManager.instance.get( - url: Api.adImstate + widget.conversationID.split('_').last, - ); - if (result['code'] == 21201) { - Get.bottomSheet( - Scaffold( - backgroundColor: Colors.transparent, - body: Open_vip_tipPage(true), - ), - isScrollControlled: true, - enableDrag: false); - imStatusOK = false; - return false; - } - } catch (e) {} - - imStatusOK = true; - } else { - if (code == 21201) { - Get.bottomSheet( - Scaffold( - backgroundColor: Colors.transparent, - body: Open_vip_tipPage(true), - ), - isScrollControlled: true, - enableDrag: false); - } - showOKToast(data['msg']); - imStatusOK = false; - } - return imStatusOK; - } - - void _showReportDialog(BuildContext context) { - showDialog( - context: context, - builder: (BuildContext context) { - return Dialog( - backgroundColor: Colors.transparent, - child: Container( - height: 277.sp, - padding: const EdgeInsets.all(1.0), - child: Stack( - children: [ - Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: const LinearGradient( - colors: [Color(0xFFDD3DF4), Color(0xFF30FFD9)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Container( - margin: EdgeInsets.all(1.sp), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: const LinearGradient( - colors: [Color(0xFF4C3E5F), Color(0xFF324140)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Container( - margin: EdgeInsets.only(top: 24.sp), - child: Column( - children: [ - Center( - child: Text( - "是否解除拉黑", - style: - TextStyle(color: Colors.white, fontSize: 16.sp), - ), - ), - Container( - margin: EdgeInsets.only(top: 14.sp), - alignment: Alignment.center, - child: Image( - image: AssetImage(getMineImage("icon_dialog_black")), - width: 70.sp, - height: 70.sp, - ), - ), - Container( - margin: EdgeInsets.only( - top: 12.sp, left: 14.sp, right: 14.sp), - alignment: Alignment.center, - child: Text( - "解除拉黑后,你将不屏蔽对方的任何信息", - textAlign: TextAlign.center, - style: TextStyle( - color: const Color(0xCCF7FAFA), fontSize: 16.sp), - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - onTap: () { - Navigator.pop(context); - }, - child: Container( - margin: EdgeInsets.only(top: 24.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color(0x26FFFFFF), - Color(0x26FFFFFF), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 10.sp, - bottom: 10.sp, - left: 52.sp, - right: 52.sp), - child: const Text( - "否", - style: TextStyle( - color: Colors.white, - fontSize: 12, - ), - ), - ), - ), - SizedBox(width: 24.sp), - GestureDetector( - onTap: () async { - Get.back(); - var data = await DioManager.instance.post( - url: - '${Api.setBlock + widget.conversationID.split('_').last}/block', - params: {'status': '0'}); - var bean = BaseResponse.fromJson( - data, - (jsonData) => jsonData, - ); - if (bean.isSuccess()) { - final FriendshipServices _friendshipServices = - serviceLocator(); - isBlack = false; - } - showOKToast(bean.msg); - }, - child: Container( - margin: EdgeInsets.only(top: 24.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 10.sp, - bottom: 10.sp, - left: 52.sp, - right: 52.sp), - child: const Text( - "是", - style: TextStyle( - color: Colors.white, - fontSize: 12, - ), - ), - ), - ) - ], - ) - ], - ), - ) - ], - ), - ), - ); - }, - ); - } - - onSubmitted() async { - if (isBlack) { - showOKToast("您已将对方拉黑,请移除黑名单后在发送消息~"); - _showReportDialog(context); - return; - } - - if (isSending) return; - isSending = true; - bool isOK = await checkImStatus(); - - if (!isOK) { - isSending = false; - return; - } - - lastText = ""; - String text = textEditingController.text.trim(); - final convType = widget.conversationType; - - if (text.isEmpty) { - if (hintText.contains('用心聊天更容易获得回复哦~')) { - showOKToast('请输入消息内容后发送'); - Future.delayed(Duration(seconds: 1), () { - isSending = false; - }); - return; - } else { - if ((widget.currentConversation.lastMessage?.customElem ?? null) != - null) { - if (widget.currentConversation.lastMessage?.customElem!.extension == - 'cardData') { - sendHiText(); - isSending = false; - } - } else { - var result = await TencentImSDKPlugin.v2TIMManager - .getMessageManager() - .getC2CHistoryMessageList( - userID: widget.currentConversation.userID!, - count: 1, - lastMsgID: null, - ); - - if (result.code == 0 && (result.data?.isNotEmpty ?? false)) { - V2TimMessage msg = result.data!.last!; - - if (msg.customElem != null) { - if (msg.customElem!.extension == 'cardData') { - Map info = jsonDecode(msg.customElem!.data!); - sendHiTextMsg(info['guide_text']); - } - } - } else { - showOKToast('请输入消息内容后发送'); - } - } - Future.delayed(Duration(seconds: 1), () { - isSending = false; - }); - return; - } - } - - if (text.isNotEmpty && text != zeroWidthSpace) { - if (widget.model.repliedMessage != null) { - MessageUtils.handleMessageError( - widget.model.sendReplyMessage( - text: text, - convID: widget.conversationID, - convType: convType, - atUserIDList: getUserIdFromMemberInfoMap()), - context); - } else if (memberInfoMap.isNotEmpty) { - widget.model.sendTextAtMessage( - text: text, - convType: widget.conversationType, - convID: widget.conversationID, - atUserList: getUserIdFromMemberInfoMap()); - } else { - bool isOK = await loadIsShowSendGiftDialogData(); - if (!isOK) { - Future.delayed(Duration(seconds: 1), () { - isSending = false; - }); - return; - } - - - - bool isContain = false; - urlList.forEach((element) { - if (text.contains(element)) { - isContain = true; - } - }); - - List words = []; - - - if (!isContain) { - var data = await DioManager.instance - .post(url: Api.shieldWordCheck, params: {'text': text, 'type': 2}); - if (data['data']['code'] == 10000) { - words = data['data']['words']; - if (words.isNotEmpty) { - for (int i = 0; i < words.length; i++) { - text = text.replaceAll(words[i], '*'); - } - } - } - if (words.isNotEmpty) { - textEditingController.text = text; - showOKToast('含违规词汇,无法发送'); - Future.delayed(Duration(seconds: 1), () { - isSending = false; - }); - return; - } - } - - if (words.isEmpty) { - try { - var msgResult = await MessageUtils.handleMessageError( - widget.model.sendTextMessage( - text: text, - convID: widget.conversationID, - convType: convType), - context); - addChatRecord(text, msgResult!.data!.msgID ?? '', - msgResult!.data!.timestamp.toString() ?? ''); - } catch (e) {} - } - } - textEditingController.clear(); - currentCursor = null; - lastText = ""; - memberInfoMap = {}; - isSending = false; - goDownBottom(); - _handleSendEditStatus("", false); - } else { - showOKToast('请输入消息内容'); - isSending = false; - } - } - - loadIsShowSendGiftDialogData() async { - V2TimConversation con = Get.arguments; - var data = await DioManager.instance - .get(url: Api.isShow_give_gift + widget.conversationID.split('_').last); - if (data['code'] == 200) { - if (data['data']) { - Get.bottomSheet( - SendGiftDialog( - accid: widget.conversationID, - title: data['msg'], - ), - isScrollControlled: true, - enableDrag: false); - return false; - } - } - return true; - } - - sendHiText() async { - Map info = - jsonDecode(widget.currentConversation.lastMessage!.customElem!.data!); - sendHiTextMsg(info['guide_text']); - // var result = await widget.model.sendTextMessage( - // text: info['guide_text'], - // convID: widget.conversationID, - // convType: ConvType.c2c); - // - // hintText = '用心聊天更容易获得回复哦~'; - // setState(() {}); - } - - sendHiTextMsg(String text) async { - widget.model.sendTextMessage( - text: text, convID: widget.conversationID, convType: ConvType.c2c); - hintText = '用心聊天更容易获得回复哦~'; - setState(() {}); - } - - addChatRecord(String msgContent, String msgId, String sendTime) async { - String str = DateTime.now().toString().split('.').first; - var data = await DioManager.instance.post(url: Api.chatRecord, params: { - "content": msgContent, - "msgId": msgId, - "sendTime": str, - "to": widget.conversationID.split('_').last - }); - isSending = false; - } - - void goDownBottom() { - if (globalModel.getMessageListPosition(widget.conversationID) == - HistoryMessagePosition.notShowLatest) { - return; - } - Future.delayed(const Duration(milliseconds: 50), () { - try { - if (widget.scrollController != null) { - widget.scrollController!.animateTo( - widget.scrollController!.position.minScrollExtent, - duration: const Duration(milliseconds: 200), - curve: Curves.ease, - ); - } - // ignore: empty_catches - } catch (e) {} - }); - } - - void onModelChanged() { - if (widget.model.repliedMessage != null) { - narrowTextFieldKey.currentState?.showKeyboard = true; - focusNode.requestFocus(); - _addDeleteTag(); - } else {} - if (widget.model.editRevokedMsg.isNotEmpty) { - narrowTextFieldKey.currentState?.showKeyboard = true; - - textEditingController.text = widget.model.editRevokedMsg; - textEditingController.selection = TextSelection.fromPosition(TextPosition( - affinity: TextAffinity.downstream, - offset: widget.model.editRevokedMsg.length)); - widget.model.editRevokedMsg = ""; - Future.delayed(Duration(milliseconds: 300), () { - focusNode.requestFocus(); - }); - } - } - - _addDeleteTag() { - final originalText = textEditingController.text; - textEditingController.text = zeroWidthSpace + originalText; - textEditingController.selection = TextSelection.fromPosition( - TextPosition(offset: textEditingController.text.length)); - } - - _onCursorChange() { - final selection = textEditingController.selection; - currentCursor = selection.baseOffset; - } - - _handleSoftKeyBoardDelete() { - if (widget.model.repliedMessage != null) { - widget.model.repliedMessage = null; - } - } - - String _getShowName(V2TimGroupMemberFullInfo? item) { - return TencentUtils.checkStringWithoutSpace(item?.nameCard) ?? - TencentUtils.checkStringWithoutSpace(item?.nickName) ?? - TencentUtils.checkStringWithoutSpace(item?.userID) ?? - ""; - } - - _longPressToAt(String? userID, String? nickName) { - final memberInfo = V2TimGroupMemberFullInfo( - userID: userID ?? "", - nickName: nickName, - ); - final showName = _getShowName(memberInfo); - memberInfoMap["@$showName"] = memberInfo; - String text = "${textEditingController.text}@$showName "; - //please do not delete space - focusNode.requestFocus(); - textEditingController.text = text; - textEditingController.selection = - TextSelection.fromPosition(TextPosition(offset: text.length - 1)); - lastText = text; - } - - bool shouldRemoveAtTag(String atTag, String deletedChar) { - final atMemberArray = []; - memberInfoMap.forEach((key, value) { - atMemberArray.add(key); - }); - for (String member in atMemberArray) { - if (atTag == member && member.contains(deletedChar)) { - return true; - } - } - return false; - } - - Offset getAtPosition(String text, int atPlace) { - final textBeforeAt = text.substring(0, atPlace + 1); - final textPainter = TextPainter( - text: TextSpan(text: textBeforeAt, style: const TextStyle(fontSize: 14)), - textDirection: TextDirection.ltr, - maxLines: null, - ); - textPainter.layout(maxWidth: inputWidth); - final TextPosition lastLineOffset = textPainter - .getPositionForOffset(Offset(textPainter.width, textPainter.height)); - final Offset caretPosition = - textPainter.getOffsetForCaret(lastLineOffset, Rect.zero); - final dx = min(inputWidth - 180, caretPosition.dx + 16); - final dy = max(24, 110 - caretPosition.dy).toDouble(); - - return Offset(dx, dy); - } - - calculateRemoveRemainAt(String text) { - Map map = {}; - Iterable matches = atTextReg.allMatches(text); - List parseAtList = []; - for (final item in matches) { - final str = item.group(0); - parseAtList.add(str); - } - for (String? key in parseAtList) { - if (key != null && memberInfoMap[key] != null) { - map[key] = memberInfoMap[key]!; - } - } - memberInfoMap = map; - } - - _handleAtText(String text, TUIChatSeparateViewModel model) async { - final text = textEditingController.text; - String? groupID = widget.conversationType == ConvType.group - ? widget.conversationID - : null; - final isDesktopScreen = - TUIKitScreenUtils.getFormFactor(context) == DeviceType.Desktop; - - if (groupID == null) { - lastText = text; - return; - } - - int textLength = text.length; - // 删除的话 - if (lastText.length > textLength) { - final List differencesList = diff(lastText, text); - final diffIndex = differencesList.first.text.length - 1; - int atIndex = lastText.lastIndexOf('@', diffIndex); - int spaceIndex = lastText.indexOf(' ', diffIndex); - if (diffIndex < 0 || atIndex < 0 || spaceIndex <= atIndex) { - lastText = text; - } else { - String atTag = lastText.substring(atIndex, spaceIndex); - String deletedChar = lastText[diffIndex]; - if (shouldRemoveAtTag(atTag, deletedChar)) { - final newText = lastText.substring(0, atIndex) + - lastText.substring(spaceIndex + 1); - textEditingController.text = newText; - textEditingController.selection = - TextSelection.collapsed(offset: atIndex); - lastText = newText; - Map map = {}; - Iterable matches = atTextReg.allMatches(text); - List parseAtList = []; - for (final item in matches) { - final str = item.group(0); - parseAtList.add(str); - } - for (String? key in parseAtList) { - if (key != null && memberInfoMap[key] != null) { - map[key] = memberInfoMap[key]!; - } - } - memberInfoMap = map; - return; - } - } - } - - if (isDesktopScreen) { - final atPlace = text.lastIndexOf("@"); - final keyword = text.substring(atPlace + 1); - if (atPlace >= 0) { - if (text[textLength - 1] == "@") { - final atPosition = getAtPosition(text, atPlace); - model.atPositionX = atPosition.dx; - model.atPositionY = atPosition.dy; - isAddingAtSearchWords = true; - } - final List showAtMemberList = - (model.groupMemberList ?? []).where((element) { - final friendRemark = element?.friendRemark ?? ""; - final nickName = element?.nickName ?? ""; - final showName = TencentUtils.checkString(friendRemark) ?? - TencentUtils.checkString(nickName) ?? - TencentUtils.checkString(element?.userID) ?? - ""; - return showName.contains(keyword); - }).toList(); - - model.activeAtIndex = 0; - model.showAtMemberList = showAtMemberList; - - isAddingAtSearchWords = showAtMemberList.isNotEmpty; - } else { - model.activeAtIndex = -1; - model.showAtMemberList = []; - isAddingAtSearchWords = false; - } - } else if (textLength > 0 && - text[textLength - 1] == "@" && - lastText.length < textLength) { - V2TimGroupMemberFullInfo? memberInfo = await Navigator.push( - context, - MaterialPageRoute( - builder: (context) => AtText( - groupMemberList: model.groupMemberList, - groupInfo: model.groupInfo, - groupID: groupID, - groupType: widget.groupType), - ), - ); - final showName = _getShowName(memberInfo); - if (memberInfo != null) { - memberInfoMap["@$showName"] = memberInfo; - textEditingController.text = "$text$showName "; - lastText = "$text$showName "; - } - } - lastText = textEditingController.text; - } - - void replaceAtTag(String selectedMember) { - int cursorPosition = textEditingController.selection.baseOffset; - int atIndex = - textEditingController.text.lastIndexOf('@', cursorPosition - 1); - if (atIndex >= 0) { - String beforeAt = textEditingController.text.substring(0, atIndex); - String afterAt = textEditingController.text.substring(cursorPosition); - textEditingController.text = - beforeAt + '@' + selectedMember + ' ' + afterAt; - textEditingController.selection = - TextSelection.collapsed(offset: atIndex + selectedMember.length + 2); - lastText = beforeAt + '@' + selectedMember + ' ' + afterAt; - } - } - - void handleAtMember( - {V2TimGroupMemberFullInfo? memberInfo, - bool? isAddToCursorPosition = false}) { - if (memberInfo != null) { - final String showName = _getShowName(memberInfo); - memberInfoMap["@$showName"] = memberInfo; - replaceAtTag(showName); - widget.model.showAtMemberList = []; - widget.model.activeAtIndex = -1; - } - } - - @override - void initState() { - super.initState(); - loadMyInfoData(); - checkHintText(); - if (PlatformUtils().isWeb || PlatformUtils().isDesktop) { - focusNode = FocusNode( - onKey: (node, event) { - final activeIndex = widget.model.activeAtIndex; - final showMemberList = widget.model.showAtMemberList; - if (event.runtimeType == RawKeyDownEvent) { - if (event.physicalKey == PhysicalKeyboardKey.backspace) { - if (textEditingController.text.isEmpty && lastText.isEmpty) { - widget.model.repliedMessage = null; - return KeyEventResult.handled; - } - } else if ((event.isShiftPressed || - event.isAltPressed || - event.isControlPressed || - event.isMetaPressed) && - event.physicalKey == PhysicalKeyboardKey.enter) { - final offset = textEditingController.selection.baseOffset; - textEditingController.text = - '${lastText.substring(0, offset)}\n${lastText.substring(offset)}'; - textEditingController.selection = - TextSelection.fromPosition(TextPosition(offset: offset + 1)); - lastText = textEditingController.text; - - return KeyEventResult.handled; - } else if (event.physicalKey == PhysicalKeyboardKey.enter) { - if (!isAddingAtSearchWords || - widget.model.showAtMemberList.isEmpty) { - onSubmitted(); - } else { - isAddingAtSearchWords = false; - final V2TimGroupMemberFullInfo? memberInfo = - showMemberList[activeIndex]; - if (memberInfo != null) { - handleAtMember( - memberInfo: memberInfo, isAddToCursorPosition: true); - } - } - return KeyEventResult.handled; - } - - if (event.isKeyPressed(LogicalKeyboardKey.arrowUp) && - isAddingAtSearchWords && - showMemberList.isNotEmpty) { - final newIndex = max(activeIndex - 1, 0); - widget.model.activeAtIndex = newIndex; - widget.atMemberPanelScroll?.scrollToIndex(newIndex, - preferPosition: AutoScrollPosition.middle); - return KeyEventResult.handled; - } - - if (event.isKeyPressed(LogicalKeyboardKey.arrowDown) && - isAddingAtSearchWords && - showMemberList.isNotEmpty) { - final newIndex = min(activeIndex + 1, showMemberList.length - 1); - widget.model.activeAtIndex = newIndex; - widget.atMemberPanelScroll?.scrollToIndex(newIndex, - preferPosition: AutoScrollPosition.middle); - return KeyEventResult.handled; - } - } - - return KeyEventResult.ignored; - }, - ); - } else { - focusNode = FocusNode(); - } - textEditingController = - widget.controller?.textEditingController ?? TextEditingController(); - if (widget.controller != null) { - widget.controller?.addListener(() { - final actionType = widget.controller?.actionType; - if (actionType == ActionType.longPressToAt) { - _longPressToAt( - widget.controller?.atUserID, widget.controller?.atUserName); - } - }); - } - widget.model.addListener(onModelChanged); - if (widget.initText != null) { - textEditingController.text = widget.initText!; - } - final AppLocale appLocale = I18nUtils.findDeviceLocale(null); - languageType = - (appLocale == AppLocale.zhHans || appLocale == AppLocale.zhHant) - ? 'zh' - : 'en'; - if (null == commentBlackEvent) { - commentBlackEvent = - EventBusManager.on().listen((event) { - if (event.userId == widget.currentConversation.userID!) { - isBlack = event.isBlack; - } - }); - } - getBlack(); - } - - StreamSubscription? commentBlackEvent = null; - bool isBlack = false; - bool isSending = false; - getBlack() async { - isBlack = widget.isBlack!; - EventBusManager.fire(CommentBlackMoreEvent()); - } - - @override - void didUpdateWidget(TIMInputTextField oldWidget) { - super.didUpdateWidget(oldWidget); - if (widget.conversationID != oldWidget.conversationID) { - handleSetDraftText(oldWidget.conversationID, oldWidget.conversationType); - if (oldWidget.initText != widget.initText) { - textEditingController.text = widget.initText ?? ""; - } else { - textEditingController.clear(); - } - } - } - - @override - void dispose() { - // handleSetDraftText(); - widget.model.removeListener(onModelChanged); - focusNode.dispose(); - if (null != commentBlackEvent) { - print("TIMInputTextField解绑"); - EventBusManager.cancelSubscription(commentBlackEvent!); - } - - super.dispose(); - } - - Future getMemberMuteStatus(String userID) async { - // Get the mute state of the members recursively - if (widget.model.groupMemberList?.any((item) => (item?.userID == userID)) ?? - false) { - final int muteUntil = widget.model.groupMemberList - ?.firstWhere((item) => (item?.userID == userID)) - ?.muteUntil ?? - 0; - return muteUntil * 1000 > DateTime.now().millisecondsSinceEpoch; - } else { - return false; - } - } - - _getMuteType(TUIChatSeparateViewModel model) async { - if (!mounted) { - return; - } - if (widget.conversationType == ConvType.group) { - if ((model.groupInfo?.isAllMuted ?? false) && - muteStatus != MuteStatus.all) { - Future.delayed(const Duration(seconds: 0), () { - setState(() { - muteStatus = MuteStatus.all; - }); - }); - } else if (selfModel.loginInfo?.userID != null && - await getMemberMuteStatus(selfModel.loginInfo!.userID!) && - muteStatus != MuteStatus.me) { - Future.delayed(const Duration(seconds: 0), () { - setState(() { - muteStatus = MuteStatus.me; - }); - }); - } else if (!(model.groupInfo?.isAllMuted ?? false) && - !(selfModel.loginInfo?.userID != null && - await getMemberMuteStatus(selfModel.loginInfo!.userID!)) && - muteStatus != MuteStatus.none) { - Future.delayed(const Duration(seconds: 0), () { - setState(() { - muteStatus = MuteStatus.none; - }); - }); - } - } else { - Future.delayed(const Duration(seconds: 0), () { - setState(() { - muteStatus = MuteStatus.none; - }); - }); - } - } - - _handleSendEditStatus(String value, bool status) { - int now = DateTime.now().millisecondsSinceEpoch; - if (value.isNotEmpty && widget.conversationType == ConvType.c2c) { - if (status) { - if (now - latestSendEditStatusTime < 5 * 1000) { - return; - } - } - // send status - globalModel.sendEditStatusMessage(status, widget.conversationID); - latestSendEditStatusTime = now; - } else { - globalModel.sendEditStatusMessage(false, widget.conversationID); - } - } - - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - final TUIChatSeparateViewModel model = - Provider.of(context); - - _getMuteType(model); - - return Selector( - builder: ((context, value, child) { - String? getForbiddenText() { - if (!(model.isGroupExist)) { - return "群组不存在"; - } else if (model.isNotAMember) { - return "您不是群成员"; - } else if (muteStatus == MuteStatus.all) { - return "全员禁言中"; - } else if (muteStatus == MuteStatus.me) { - return "您被禁言"; - } - return null; - } - - final forbiddenText = getForbiddenText(); - return LayoutBuilder( - builder: (BuildContext context, BoxConstraints constraints) { - inputWidth = constraints.maxWidth; - - return TUIKitScreenUtils.getDeviceWidget( - defaultWidget: TIMTextFieldLayoutNarrow( - onEmojiSubmitted: onEmojiSubmitted, - onCustomEmojiFaceSubmitted: onCustomEmojiFaceSubmitted, - backSpaceText: backSpaceText, - addStickerToText: addStickerToText, - customStickerPanel: widget.customStickerPanel, - forbiddenText: forbiddenText, - onChanged: (text) async { - if (widget.onChanged != null) { - widget.onChanged!(text); - } - - await resetHiText(text); - }, - backgroundColor: widget.backgroundColor, - morePanelConfig: widget.morePanelConfig, - userId: widget.currentConversation.userID!, - repliedMessage: value, - currentCursor: currentCursor, - hintText: hintText, - isUseDefaultEmoji: widget.isUseDefaultEmoji, - languageType: languageType, - textEditingController: textEditingController, - conversationID: widget.conversationID, - conversationType: widget.conversationType, - focusNode: focusNode, - controller: widget.controller, - setCurrentCursor: setCurrentCursor, - onCursorChange: _onCursorChange, - model: model, - handleSendEditStatus: _handleSendEditStatus, - handleAtText: (text) { - _handleAtText(text, model); - }, - handleSoftKeyBoardDelete: _handleSoftKeyBoardDelete, - onSubmitted: onSubmitted, - goDownBottom: goDownBottom, - showSendAudio: false, - showSendEmoji: widget.showSendEmoji, - showMorePanel: widget.showMorePanel, - customEmojiStickerList: widget.customEmojiStickerList), - desktopWidget: TIMUIKitTextFieldLayoutWide( - currentConversation: widget.currentConversation, - onEmojiSubmitted: onEmojiSubmitted, - onCustomEmojiFaceSubmitted: onCustomEmojiFaceSubmitted, - backSpaceText: backSpaceText, - addStickerToText: addStickerToText, - customStickerPanel: widget.customStickerPanel, - forbiddenText: forbiddenText, - onChanged: widget.onChanged, - backgroundColor: widget.backgroundColor, - morePanelConfig: widget.morePanelConfig, - repliedMessage: value, - currentCursor: currentCursor, - hintText: hintText, - isUseDefaultEmoji: widget.isUseDefaultEmoji, - languageType: languageType, - textEditingController: textEditingController, - conversationID: widget.conversationID, - conversationType: widget.conversationType, - focusNode: focusNode, - controller: widget.controller, - setCurrentCursor: setCurrentCursor, - onCursorChange: _onCursorChange, - model: model, - handleSendEditStatus: _handleSendEditStatus, - handleAtText: (text) { - _handleAtText(text, model); - }, - handleSoftKeyBoardDelete: _handleSoftKeyBoardDelete, - onSubmitted: onSubmitted, - goDownBottom: goDownBottom, - showSendAudio: widget.showSendAudio, - showSendEmoji: widget.showSendEmoji, - showMorePanel: widget.showMorePanel, - customEmojiStickerList: widget.customEmojiStickerList)); - }); - }), - selector: (c, model) => model.repliedMessage); - } - - resetHiText(String text) async { - if (!hintText!.contains('用心聊天更容易获得回复哦~') && text.isNotEmpty) { - if ((widget.currentConversation.lastMessage?.customElem ?? null) != - null) { - if (widget.currentConversation.lastMessage?.customElem!.extension == - 'cardData') { - hintText = '用心聊天更容易获得回复哦~'; - setState(() {}); - } - } else { - var result = await TencentImSDKPlugin.v2TIMManager - .getMessageManager() - .getC2CHistoryMessageList( - userID: widget.currentConversation.userID!, - count: 1, - lastMsgID: null, - ); - - if (result.code == 0 && (result.data?.isNotEmpty ?? false)) { - V2TimMessage msg = result.data!.last!; - - if (msg.customElem != null) { - if (msg.customElem!.extension == 'cardData') { - hintText = '用心聊天更容易获得回复哦~'; - setState(() {}); - } - } - } - } - } - } - - checkHintText() async { - if (hintText!.contains('说些')) { - if ((widget.currentConversation.lastMessage?.customElem ?? null) != - null) { - if (widget.currentConversation.lastMessage?.customElem!.extension == - 'cardData') { - Map info = jsonDecode( - widget.currentConversation.lastMessage!.customElem!.data!); - hintText = info['guide_text']; - setState(() {}); - } - } else if (widget.currentConversation.lastMessage == null) { - getConverstationLastInfo(); - } - } - } - - getConverstationLastInfo() async { - // 拉取单聊历史消息 -// 首次拉取,lastMsgID 设置为 null -// 再次拉取时,lastMsgID 可以使用返回的消息列表中的最后一条消息的id - var result = await TencentImSDKPlugin.v2TIMManager - .getMessageManager() - .getC2CHistoryMessageList( - userID: widget.currentConversation.userID!, - count: 1, - lastMsgID: null, - ); - - if (result.code == 0 && (result.data?.isNotEmpty ?? false)) { - V2TimMessage msg = result.data!.last!; - - if (msg.customElem != null) { - if (msg.customElem!.extension == 'cardData') { - Map info = jsonDecode(msg.customElem!.data!); - hintText = info['guide_text']; - setState(() {}); - } - } - } - } - - void loadMyInfoData() async { - var data = await DioManager.instance.get(url: Api.getUserInfo); - var bean = BaseResponse.fromJson( - data, (data) => ResponseBean.fromJson(data)); - - if (bean.isSuccess()) { - userInfoBean = bean.data.user; - } - } -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field_controller.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field_controller.dart deleted file mode 100644 index 7d1b988..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field_controller.dart +++ /dev/null @@ -1,29 +0,0 @@ -import 'package:flutter/material.dart'; - -enum ActionType { hideAllPanel, longPressToAt } - -class TIMUIKitInputTextFieldController extends ChangeNotifier { - TextEditingController? textEditingController = TextEditingController(); - ActionType? actionType; - String? atUserName; - String? atUserID; - - TIMUIKitInputTextFieldController([TextEditingController? controller]) { - if (controller != null) { - textEditingController = controller; - } - } - - /// text field unfocus and hide all panel - hideAllPanel() { - actionType = ActionType.hideAllPanel; - notifyListeners(); - } - - longPressToAt(String? userName, String? userID) { - actionType = ActionType.longPressToAt; - atUserName = userName; - atUserID = userID; - notifyListeners(); - } -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field_layout/narrow.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field_layout/narrow.dart deleted file mode 100644 index a2c6e98..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field_layout/narrow.dart +++ /dev/null @@ -1,1530 +0,0 @@ -import 'dart:async'; -import 'dart:ffi'; -import 'dart:io'; -import 'dart:math'; -import 'dart:typed_data'; - -import 'package:circle_app/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_send_sound_message.dart'; -import 'package:circle_app/app/chat/widget/send_gift_dialog.dart'; -import 'package:circle_app/app/chat/widget/wish_dialog.dart'; -import 'package:circle_app/app/minefragment/logic.dart'; -import 'package:circle_app/common/Widgets/open_vip_tip/view.dart'; -import 'package:circle_app/common/colors/app_color.dart'; -import 'package:circle_app/network/api.dart'; -import 'package:circle_app/network/dio_manager.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:flutter_svg/svg.dart'; -import 'package:get/get.dart'; -import 'package:get/get_core/src/get_main.dart'; -import 'package:image_picker/image_picker.dart'; -import 'package:oktoast/oktoast.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_state.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/separate_models/tui_chat_separate_view_model.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_chat_global_model.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_setting_model.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/friendShip/friendship_services.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/services_locatar.dart'; -import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/message.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/optimize_utils.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/permission.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/platform.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitTextField/special_text/DefaultSpecialTextSpanBuilder.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitTextField/tim_uikit_emoji_panel.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitTextField/tim_uikit_send_sound_message.dart'; -import 'package:tencent_extended_text_field/extended_text_field.dart'; -import 'package:tencent_keyboard_visibility/tencent_keyboard_visibility.dart'; -import 'package:video_player/video_player.dart'; -import 'package:video_thumbnail/video_thumbnail.dart'; - -import '../../../../../common/Widgets/unlock_wx_tip.dart'; -import '../../../../../util/eventBus.dart'; -import '../../../../call_out/logic.dart'; -import '../../../../home/logic.dart'; -import '../../../../userinfo/logic.dart'; -import '../../../view.dart'; -import '../../../widget/chat_circle_share_dialog.dart'; -import '../../../widget/chat_gift_pannel.dart'; - -GlobalKey<_TIMTextFieldLayoutNarrowState> TIMnarrowTextFieldKey = GlobalKey(); - -class TIMTextFieldLayoutNarrow extends StatefulWidget { - /// sticker panel customization - final CustomStickerPanel? customStickerPanel; - - final VoidCallback onEmojiSubmitted; - final Function(int, String) onCustomEmojiFaceSubmitted; - final Function(String, bool) handleSendEditStatus; - final VoidCallback backSpaceText; - final ValueChanged addStickerToText; - - final ValueChanged handleAtText; - - /// Whether to use the default emoji - final bool isUseDefaultEmoji; - - final TUIChatSeparateViewModel model; - - /// background color - final Color? backgroundColor; - - /// control input field behavior - final TIMUIKitInputTextFieldController? controller; - - /// config for more panel - final MorePanelConfig? morePanelConfig; - - final String languageType; - - final TextEditingController textEditingController; - - /// conversation id - final String conversationID; - - /// conversation type - final ConvType conversationType; - - final FocusNode focusNode; - - /// show more panel - final bool showMorePanel; - - /// hint text for textField widget - final String? hintText; - - final String? userId; - - final int? currentCursor; - - final ValueChanged setCurrentCursor; - - final VoidCallback onCursorChange; - - /// show send audio icon - final bool showSendAudio; - - final VoidCallback handleSoftKeyBoardDelete; - - /// on text changed - final void Function(String)? onChanged; - - final V2TimMessage? repliedMessage; - - /// show send emoji icon - final bool showSendEmoji; - - final String? forbiddenText; - - final VoidCallback onSubmitted; - - final VoidCallback goDownBottom; - - final List customEmojiStickerList; - - const TIMTextFieldLayoutNarrow( - {Key? key, - this.customStickerPanel, - required this.onEmojiSubmitted, - required this.onCustomEmojiFaceSubmitted, - required this.backSpaceText, - required this.addStickerToText, - required this.isUseDefaultEmoji, - required this.languageType, - required this.textEditingController, - this.morePanelConfig, - required this.conversationID, - required this.conversationType, - required this.focusNode, - this.currentCursor, - required this.setCurrentCursor, - required this.onCursorChange, - required this.model, - this.backgroundColor, - this.onChanged, - required this.handleSendEditStatus, - required this.handleAtText, - required this.handleSoftKeyBoardDelete, - this.repliedMessage, - this.forbiddenText, - required this.onSubmitted, - required this.goDownBottom, - required this.showSendAudio, - required this.showSendEmoji, - required this.showMorePanel, - this.hintText, - this.userId, - required this.customEmojiStickerList, - this.controller}) - : super(key: key); - - @override - State createState() => - _TIMTextFieldLayoutNarrowState(); -} - -class _TIMTextFieldLayoutNarrowState - extends TIMUIKitState { - HomeLogic logic = Get.find(); - final TUISettingModel settingModel = serviceLocator(); - final ImagePicker _picker = ImagePicker(); - - bool isVip = false; - - bool imStatusOK = false; - - bool showMore = false; - bool showMoreButton = true; - bool showSendSoundText = false; - bool showEmojiPanel = false; - bool showKeyboard = false; - Function? setKeyboardHeight; - double? bottomPadding; - UserBean? userInfoBean; - - int unLockWxNum = 0; - var sub1; - @override - void initState() { - super.initState(); - sub1 = EventBusManager.on().listen((event) { - loadUserData(); - }); - if (widget.controller != null) { - widget.controller?.addListener(() { - final actionType = widget.controller?.actionType; - if (actionType == ActionType.hideAllPanel) { - hideAllPanel(); - } - }); - } - if (null == commentBlackEvent) { - commentBlackEvent = - EventBusManager.on().listen((event) { - if (event.userId == widget.userId) { - isBlack = event.isBlack; - } - }); - } - loadUserData(); - getBlack(); - } - - StreamSubscription? commentBlackEvent = null; - - @override - void dispose() { - sub1.cancel(); - print("TIMTextFieldLayoutNarrow解绑"); - if (null != commentBlackEvent) { - EventBusManager.cancelSubscription(commentBlackEvent!); - } - - super.dispose(); - } - - bool isBlack = false; - - getBlack() async { - final FriendshipServices _friendshipServices = - serviceLocator(); - List? blacklist = await _friendshipServices.getBlackList(); - if (blacklist != null) { - isBlack = false; - blacklist.forEach((element) { - print(element.userProfile!.nickName.toString()); - if (element.userID == widget.userId) { - isBlack = true; - } - }); - } - } - - void setSendButton() { - final value = widget.textEditingController.text; - if (isWebDevice() || isAndroidDevice()) { - if (value.isEmpty && showMoreButton != true) { - setState(() { - showMoreButton = true; - }); - } else if (value.isNotEmpty && showMoreButton == true) { - setState(() { - showMoreButton = false; - }); - } - } - } - - hideAllPanel() { - widget.focusNode.unfocus(); - widget.currentCursor == null; - if (showKeyboard != false || showMore != false || showEmojiPanel != false) { - setState(() { - showKeyboard = false; - showMore = false; - showEmojiPanel = false; - }); - } - } - - Widget _getBottomContainer() { - if (showEmojiPanel) { - return widget.customStickerPanel != null - ? widget.customStickerPanel!( - sendTextMessage: () { - widget.onEmojiSubmitted(); - setSendButton(); - }, - sendFaceMessage: widget.onCustomEmojiFaceSubmitted, - deleteText: () { - widget.backSpaceText(); - setSendButton(); - }, - addText: (int unicode) { - final newText = String.fromCharCode(unicode); - widget.addStickerToText(newText); - // handleSetDraftText(); - }, - addCustomEmojiText: ((String singleEmojiName) { - String? emojiName = singleEmojiName.split('.png')[0]; - if (widget.isUseDefaultEmoji && - widget.languageType == 'zh' && - ConstData.emojiMapList[emojiName] != null && - ConstData.emojiMapList[emojiName] != '') { - emojiName = ConstData.emojiMapList[emojiName]; - } - final newText = '[$emojiName]'; - widget.addStickerToText(newText); - setSendButton(); - }), - defaultCustomEmojiStickerList: - widget.isUseDefaultEmoji ? ConstData.emojiList : []) - : EmojiPanel(onTapEmoji: (unicode) { - final newText = String.fromCharCode(unicode); - widget.addStickerToText(newText); - setSendButton(); - // handleSetDraftText(); - }, onSubmitted: () { - widget.onEmojiSubmitted(); - setSendButton(); - }, delete: () { - widget.backSpaceText(); - setSendButton(); - }); - } - - if (showMore) { - return MorePanel( - morePanelConfig: widget.morePanelConfig, - conversationID: widget.conversationID, - conversationType: widget.conversationType); - } - - return const SizedBox(height: 0); - } - - double _getBottomHeight() { - if (showKeyboard) { - final currentKeyboardHeight = - MediaQuery.of(context).viewInsets.bottom + 10.sp; - double originHeight = settingModel.keyboardHeight; - if (currentKeyboardHeight != 0) { - if (currentKeyboardHeight >= originHeight) { - originHeight = currentKeyboardHeight; - } - if (setKeyboardHeight != null) { - setKeyboardHeight!(currentKeyboardHeight); - } - } - final height = originHeight != 0 ? originHeight : currentKeyboardHeight; - return height; - } else if (showMore || showEmojiPanel) { - return 240.0 + (bottomPadding ?? 0.0); - } else if (widget.textEditingController.text.length >= 46 && - showKeyboard == false) { - return 15 + (bottomPadding ?? 0.0); - } else { - return bottomPadding == 0 ? 10.sp : bottomPadding ?? 0; - } - } - - - _openEmojiPanel() { - widget.onCursorChange(); - showKeyboard = showEmojiPanel; - if (showEmojiPanel) { - widget.focusNode.requestFocus(); - } else { - widget.focusNode.unfocus(); - } - - setState(() { - showMore = false; - showSendSoundText = false; - showEmojiPanel = !showEmojiPanel; - }); - } - - _debounce( - Function(String text) fun, [ - Duration delay = const Duration(milliseconds: 30), - ]) { - Timer? timer; - return (String text) { - if (timer != null) { - timer?.cancel(); - } - - timer = Timer(delay, () { - fun(text); - }); - }; - } - - _buildRepliedMessage(V2TimMessage? repliedMessage) { - final haveRepliedMessage = repliedMessage != null; - if (haveRepliedMessage) { - final text = - "${MessageUtils.getDisplayName(widget.model.repliedMessage!)}:${widget.model.abstractMessageBuilder != null ? widget.model.abstractMessageBuilder!(widget.model.repliedMessage!) : MessageUtils.getAbstractMessageAsync(widget.model.repliedMessage!, widget.model.groupMemberList ?? [])}"; - return Container( - color: widget.backgroundColor ?? hexToColor("f5f5f6"), - alignment: Alignment.centerLeft, - padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 16), - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Text( - text, - softWrap: true, - maxLines: 3, - overflow: TextOverflow.ellipsis, - style: TextStyle(color: hexToColor("8f959e"), fontSize: 14), - ), - ), - const SizedBox( - width: 16, - ), - InkWell( - onTap: () { - widget.model.repliedMessage = null; - }, - child: Icon(Icons.clear, color: hexToColor("8f959e"), size: 18), - ) - ], - ), - ); - } - return Container(); - } - - showGiftPannel() { - Get.bottomSheet( - ChatGiftPannel( - accid: widget.conversationID, - ), - isScrollControlled: false, - enableDrag: false, - ); - } - - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - final theme = value.theme; - - setKeyboardHeight ??= OptimizeUtils.debounce((height) { - settingModel.keyboardHeight = height; - }, const Duration(seconds: 1)); - // - final debounceFunc = _debounce((value) { - if (isWebDevice() || isAndroidDevice()) { - if (value.isEmpty && showMoreButton != true) { - setState(() { - showMoreButton = true; - }); - } else if (value.isNotEmpty && showMoreButton == true) { - setState(() { - showMoreButton = false; - }); - } - } - if (widget.onChanged != null) { - widget.onChanged!(value); - } - widget.handleAtText(value); - widget.handleSendEditStatus(value, true); - final isEmpty = value.isEmpty; - if (isEmpty) { - widget.handleSoftKeyBoardDelete(); - } - }, const Duration(milliseconds: 80)); - - final MediaQueryData data = MediaQuery.of(context); - EdgeInsets padding = data.padding; - if (bottomPadding == null || padding.bottom > bottomPadding!) { - bottomPadding = padding.bottom; - } - - return Column( - children: [ - _buildRepliedMessage(widget.repliedMessage), - Stack( - children: [ - Container( - margin: EdgeInsets.only( - top: showKeyboard || showEmojiPanel ? 0 : 50.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.only( - topLeft: Radius.circular( - 16.sp, - ), - topRight: Radius.circular(16.sp)), - color: Color(0xFF423055), - // color: Colors.yellow, - ), - child: Column( - children: [ - Container( - padding: - EdgeInsets.symmetric(vertical: 8, horizontal: 12.sp), - constraints: const BoxConstraints(minHeight: 30), - child: Row( - children: [ - GestureDetector( - onTap: () async { - if (isBlack) { - showOKToast("您已将对方拉黑,请移除黑名单后在发送语音~"); - _showIsCancelBlackDialog(context); - return; - } - - bool isOK = await checkVipStatus(5); - if (!isOK) { - return; - } - isOK = await checkImStatus(); - if (!isOK) { - return; - } - - showKeyboard = showSendSoundText; - if (showSendSoundText) { - widget.focusNode.requestFocus(); - } - try { - var data = await Permission.microphone.status; - if (data.isGranted) { - setState(() { - showEmojiPanel = false; - showMore = false; - showSendSoundText = !showSendSoundText; - }); - } else { - var data = - await Permission.microphone.request(); - if (data.isGranted) { - setState(() { - showEmojiPanel = false; - showMore = false; - showSendSoundText = !showSendSoundText; - }); - } else { - Permissions.showPermissionConfirmDialog( - context, Permission.microphone.value); - } - } - } catch (e) { - print(e); - } - }, - child: Image.asset( - getMsgImage('voice'), - width: 25.sp, - ), - ), - SizedBox( - width: 10.sp, - ), - Stack( - children: [ - Container( - width: Get.width - 95.sp, - - // width: 296.sp, - padding: EdgeInsets.symmetric( - vertical: 8, horizontal: 12.sp), - constraints: - const BoxConstraints(minHeight: 30), - decoration: BoxDecoration( - color: Color(0x1AFFFFFF), - borderRadius: BorderRadius.circular(26.sp), - ), - child: Row( - children: [ - if (widget.forbiddenText == null) - Expanded( - child: showSendSoundText - ? TIMSendSoundMessage( - onDownBottom: - widget.goDownBottom, - conversationID: - widget.conversationID, - conversationType: - widget.conversationType) - : KeyboardVisibility( - child: ExtendedTextField( - style: TextStyle( - color: Colors.white, - fontSize: 14.sp), - maxLines: 4, - minLines: 1, - focusNode: widget.focusNode, - onChanged: debounceFunc, - onTap: () { - showKeyboard = true; - widget.goDownBottom(); - widget.textEditingController.value = TextEditingValue( - ///用来设置文本 controller.text = "0000" - text: widget.textEditingController.text, - ///设置光标的位置 - selection: TextSelection.fromPosition( - ///用来设置文本的位置 - TextPosition( - affinity: TextAffinity.downstream, - /// 光标向后移动的长度 - offset: widget.textEditingController.text.length),),); - - // = TextEditingController.fromValue( - // ///用来设置初始化时显示 - - // ); - - setState(() { - showEmojiPanel = false; - showMore = false; - }); - }, - keyboardType: - TextInputType.multiline, - textInputAction: - PlatformUtils() - .isAndroid - ? TextInputAction - .newline - : TextInputAction - .send, - onEditingComplete: () { - widget.onSubmitted(); - if (showKeyboard) { - widget.focusNode - .requestFocus(); - } - setState(() { - if (widget - .textEditingController - .text - .isEmpty) { - showMoreButton = true; - } - }); - }, - textAlignVertical: - TextAlignVertical.top, - decoration: InputDecoration( - border: InputBorder.none, - hintStyle: TextStyle( - fontSize: 14.sp, - color: - Color(0xB3FFFFFF), - ), - hintText: widget.hintText, - fillColor: - Colors.transparent, - filled: true, - isDense: true, - ), - controller: widget - .textEditingController, - specialTextSpanBuilder: - PlatformUtils().isWeb - ? null - : DefaultSpecialTextSpanBuilder( - isUseDefaultEmoji: - widget - .isUseDefaultEmoji, - customEmojiStickerList: - widget - .customEmojiStickerList, - showAtBackground: - true, - )), - onChanged: (bool visibility) { - if (showKeyboard != - visibility) { - setState(() { - showKeyboard = visibility; - }); - } - }), - ), - if (widget.forbiddenText == null) - const SizedBox( - width: 10, - ), - if (widget.showSendEmoji && - widget.forbiddenText == null) - InkWell( - onTap: () { - _openEmojiPanel(); - widget.goDownBottom(); - }, - child: Image.asset( - !showEmojiPanel - ? getMsgImage('emoji') - : getMsgImage('keyboard'), - height: 24.sp, - width: 24.sp, - ), - ), - ], - )), - ], - ), - if (widget.forbiddenText == null) - const SizedBox( - width: 10, - ), - InkWell( - onTap: () async { - widget.onSubmitted(); - if (showKeyboard) { - widget.focusNode.requestFocus(); - } - setState(() { - if (widget.textEditingController.text.isEmpty) { - showMoreButton = true; - } - }); - }, - child: Image.asset( - getMsgImage('send'), - height: 24.sp, - width: 24.sp, - ), - ), - ], - ), - ), - Container( - height: 40.sp, - width: Get.width, - margin: EdgeInsets.only( - bottom: showEmojiPanel - ? Platform.isIOS - ? 0.sp - : 10.sp - : 0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - GestureDetector( - onTap: () { - if (isBlack) { - showOKToast("您已将对方拉黑,请移除黑名单后在发送消息~"); - _showIsCancelBlackDialog(context); - return; - } - getImageFile(); - }, - child: - Opacity(opacity: 0.75, - child: Image.asset(getMsgImage('photo'), width: 40.sp)), - ), - GestureDetector( - onTap: () { - if (isBlack) { - showOKToast("您已将对方拉黑,请移除黑名单后在发送消息~"); - _showIsCancelBlackDialog(context); - return; - } - getTakeImageFile(); - }, - child: Opacity(opacity: 0.75, - child: Image.asset(getMsgImage('take_photo'), - width: 40.sp), - ), - ), - GestureDetector( - onTap: () async { - if (isBlack) { - showOKToast("您已将对方拉黑,请移除黑名单后在发送消息~"); - _showIsCancelBlackDialog(context); - return; - } - showGiftPannel(); - }, - child: Image.asset( - getMsgImage('gift'), - width: 40.sp, - ), - ), - GestureDetector( - onTap: () { - if (isBlack) { - showOKToast("您已将对方拉黑,请移除黑名单后在发送消息~"); - _showIsCancelBlackDialog(context); - return; - } - getVideoFile(ImageSource.gallery); - }, - child: Opacity(opacity: 0.75, - child: Image.asset(getMsgImage('icon_video'), - width: 40.sp), - ), - ), - GestureDetector( - onTap: () { - if (isBlack) { - showOKToast("您已将对方拉黑,请移除黑名单后在发送消息~"); - _showIsCancelBlackDialog(context); - return; - } - getVideoFile(ImageSource.camera); - }, - child: Opacity(opacity: 0.75, - child: Image.asset(getMsgImage('icon_video_camera'), - width: 40.sp), - ), - ), - ], - ), - ), - AnimatedContainer( - duration: Duration( - milliseconds: - (showKeyboard && PlatformUtils().isAndroid) - ? 200 - : 340), - curve: Curves.fastOutSlowIn, - height: max(_getBottomHeight(), 0.0), - // child: ListView( - // physics: const NeverScrollableScrollPhysics(), - // children: [_getBottomContainer()], - // ), - ), - ], - ), - ), - Positioned( - bottom: 0, - child: AnimatedContainer( - duration: Duration( - milliseconds: (showKeyboard && PlatformUtils().isAndroid) - ? 200 - : 340), - curve: Curves.fastOutSlowIn, - width: Get.width, - height: max(_getBottomHeight(), 0.0), - child: ListView( - physics: const NeverScrollableScrollPhysics(), - children: [_getBottomContainer()], - ), - ), - ), - if (!showKeyboard && !showEmojiPanel) - Positioned( - top: 10.sp, - child: Container( - // margin: EdgeInsets.only(bottom: 5.sp), - padding: EdgeInsets.only(left: 10.sp, right: 10.sp), - height: 28.sp, - // color: Colors.red, - width: Get.width, - child: ListView( - scrollDirection: Axis.horizontal, - children: [ - chatActionWidget('hello', '打招呼', () async { - if (isBlack) { - showOKToast("您已将对方拉黑,请移除黑名单后在发送消息~"); - _showIsCancelBlackDialog(context); - return; - } - var reulst = - await DioManager.instance.get(url: Api.msgRandOne); - String text = reulst['data']; - var result = await widget.model.sendTextMessage( - text: text, - convID: widget.conversationID, - convType: ConvType.c2c); - }), - chatActionWidget('wish', '许个愿', () { - Get.bottomSheet( - WishDialog( - accId: widget.userId!, - ), - isScrollControlled: true, - enableDrag: false); - }), - chatActionWidget('share_circle', '分享圈子', () { - Get.bottomSheet( - ChatCircleShareDialog( - accId: widget.userId!, - ), - isScrollControlled: true, - enableDrag: false); - }), - if (userInfoBean != null && logic.isProd) - userInfoBean!.contact.isNotEmpty ? chatWxActionWidget() : chatWantWxActionWidget() - ], - ), - ), - ) - ], - ) - ], - ); - } - - opacityWidget(Widget child) { - return Opacity(opacity: 0.75,child: widget,); - } - - chatActionWidget(String img, String action, GestureTapCallback onTap) { - return GestureDetector( - onTap: onTap, - child: Container( - width: 80.sp, - height: 28.sp, - margin: EdgeInsets.only(right: 4.sp), - alignment: Alignment.center, - decoration: BoxDecoration( - gradient: AppColor.mainVerLinearGradient, - borderRadius: BorderRadius.circular(14.sp)), - child: Container( - decoration: BoxDecoration( - color: Color(0xFF423055), - borderRadius: BorderRadius.circular(14.sp)), - margin: EdgeInsets.all(1.sp), - alignment: Alignment.center, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset( getMsgImage(img), - width: 20.sp, - ), - SizedBox( - width: 2.sp, - ), - Text( - action, - style: TextStyle(color: Colors.white, fontSize: 13.sp), - ) - ], - )), - ), - ); - } - - - chatWantWxActionWidget() { - double textWidth = boundingTextSize(Get.context!, userInfoBean!.contact!, TextStyle(color: Colors.white, fontSize: 16.sp)).width; - return GestureDetector( - onTap: () async { - var result = await DioManager.instance.get(url: Api.noticeWxNum + userInfoBean!.id.toString(),); - if (result['code'] == 200) { - showOKToast('已提醒对方填写'); - } else { - showOKToast(result['msg']); - } - }, - child: Container( - width:115.sp, - height: 28.sp, - margin: EdgeInsets.only(right: 4.sp), - alignment: Alignment.center, - decoration: BoxDecoration( - gradient: AppColor.mainVerLinearGradient, - borderRadius: BorderRadius.circular(14.sp)), - child: Container( - decoration: BoxDecoration( - color: Color(0xFF423055), - borderRadius: BorderRadius.circular(14.sp)), - margin: EdgeInsets.all(1.sp), - alignment: Alignment.center, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - SizedBox( - width: 4.sp, - ), - Image.asset( - getDisCoverImage('wx'), - width: 20.sp, - ), - SizedBox( - width: 2.sp, - ), - Text( - '想要联系方式', - style: TextStyle(color: Colors.white, fontSize: 13.sp), - ), - - ], - )), - ), - ); - } - - chatWxActionWidget() { - double textWidth = boundingTextSize(Get.context!, userInfoBean!.contact!, TextStyle(color: Colors.white, fontSize: 16.sp)).width; - return GestureDetector( - onTap: () async { - if (unLockWxNum != 1) { - var result = await DioManager().post(url: Api.unlockStatus,params: {'targetUserId':userInfoBean!.id!}); - if (result['code'] == 200) { - int price = result['data']['unlockPrice']; - int residueUnlockNum = result['data']['residueUnlockNum']; - if (price > 0 && (residueUnlockNum == -1 || residueUnlockNum > 0)) { - Get.bottomSheet(UnlockWxTip(userInfoBean!.id.toString(), userInfoBean!.avatar,false), - isScrollControlled: true, enableDrag: false) - .then((value) { - if (value != null) { - loadUserData(); - } - }); - } else if (price > 0) { - Get.bottomSheet(UnlockWxTip(userInfoBean!.id.toString(), userInfoBean!.avatar,true), - isScrollControlled: true, enableDrag: true) - .then((value) { - if (value != null) { - loadUserData(); - } - }); - } else { - var result = await DioManager() - .post(url: Api.unlockWx, params: {'targetUserId': userInfoBean!.id}); - if (result['code'] == 200) { - showOKToast('解锁成功'); - loadUserData(); - } else { - Get.bottomSheet(UnlockWxTip(userInfoBean!.id.toString(), userInfoBean!.avatar,true), - isScrollControlled: true, enableDrag: false) - .then((value) { - if (value != null) { - loadUserData(); - } - }); - } - } - } - } - }, - child: Container( - width: textWidth + (userInfoBean!.contact!.contains('*')? 50.sp : 30.sp), - height: 28.sp, - margin: EdgeInsets.only(right: 4.sp), - alignment: Alignment.center, - decoration: BoxDecoration( - gradient: AppColor.mainVerLinearGradient, - borderRadius: BorderRadius.circular(14.sp)), - child: Container( - decoration: BoxDecoration( - color: Color(0xFF423055), - borderRadius: BorderRadius.circular(14.sp)), - margin: EdgeInsets.all(1.sp), - alignment: Alignment.center, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - SizedBox( - width: 4.sp, - ), - Image.asset( - getMineImage(userInfoBean!.contactType! == 1 ? 'phone_icon' : userInfoBean!.contactType! == 3 ? 'qq' : 'wx'), - width: 20.sp, - ), - SizedBox( - width: 2.sp, - ), - Text( - userInfoBean!.contact!, - style: TextStyle(color: Colors.white, fontSize: 13.sp), - ), - if (userInfoBean!.contact!.contains('*')) - SizedBox( - width: 4.sp, - ), - if (userInfoBean!.contact!.contains('*')) - Image.asset( - getDisCoverImage('unclock_icon'), - width: 20.sp, - ) - ], - )), - ), - ); - } - - Future checkImStatus() async { - imStatusOK = await loadIsShowSendGiftDialogData(); - if (imStatusOK == false) { - return imStatusOK; - } - var data = await DioManager.instance.get(url: Api.imstate); - - int code = data['code']; - if (code == 200) { - try { - var result = - await DioManager.instance.get(url: Api.adImstate + widget.conversationID.split('_').last); - if (result['code'] == 21201) { - Get.bottomSheet( - Scaffold( - backgroundColor: Colors.transparent, - body: Open_vip_tipPage(true), - ), - isScrollControlled: true, - enableDrag: false); - imStatusOK = false; - return false; - } - } catch (e) { - - - } - - imStatusOK = true; - } else { - if (code == 21201) { - Get.bottomSheet( - Scaffold( - backgroundColor: Colors.transparent, - body: Open_vip_tipPage(true), - ), - isScrollControlled: true, - enableDrag: false); - } - showOKToast(data['msg']); - imStatusOK = false; - } - - return imStatusOK; - } - - loadIsShowSendGiftDialogData() async { - var data = await DioManager.instance - .get(url: Api.isShow_give_gift + widget.userId!.split('_').last); - if (data['code'] == 200) { - if (data['data']) { - Get.bottomSheet( - SendGiftDialog( - accid: widget.userId!, - title: data['msg'], - ), - isScrollControlled: true, - enableDrag: false); - return false; - } - } - return true; - } - - Future checkVipStatus(int plate) async { - var data = - await DioManager.instance.get(url: Api.getIsVips + plate.toString()); - - if (data['code'] == 200) { - isVip = !data['data']; - } - - if (!isVip) { - showOKToast(plate== 5 ? '开通会员之后才能发送语音' : (plate == 1 || plate == 3) ? '开通会员之后才能发送图片' : '开通会员之后才能发送视频'); - Get.bottomSheet( - Scaffold( - backgroundColor: Colors.transparent, - body: Open_vip_tipPage(true), - ), - isScrollControlled: true, - enableDrag: false); - - return false; - } - - return isVip; - } - - addChatRecord(String msgContent, String msgId, String sendTime) async { - String str = DateTime.now().toString().split('.').first; - - var data = await DioManager.instance.post(url: Api.chatRecord, params: { - "content": msgContent, - "msgId": msgId, - "sendTime": str, - "to": widget.conversationID.split('_').last - }); - } - - VideoPlayerController? videoPlayerController; - - Future getVideoFile(ImageSource imageSource) async { - bool isOK = await checkVipStatus(imageSource == ImageSource.camera ? 2 : 4); - - if (!isOK) { - return; - } - - await requestStoragePermission(); - - XFile? pickedFile; - String? thumbnailPath; // 声明 thumbnailPath 变量 - - try { - pickedFile = await _picker.pickVideo( - source: imageSource, maxDuration: const Duration(seconds: 30)); - if (pickedFile == null) { - return; - } - - videoPlayerController = VideoPlayerController.file( - File(pickedFile.path), - videoPlayerOptions: VideoPlayerOptions(mixWithOthers: true), - ); - await videoPlayerController?.initialize().then((_) async { - thumbnailPath = await VideoThumbnail.thumbnailFile( - video: pickedFile!.path, - imageFormat: ImageFormat.JPEG, - maxWidth: 100, - quality: 50, - ); - }); - - final Duration videoDuration = videoPlayerController!.value.duration; - final double durationInSeconds = videoDuration.inSeconds.toDouble(); - - V2TimValueCallback? msgresult = - await widget.model.sendVideoMessage( - videoPath: pickedFile.path, - snapshotPath: thumbnailPath, - // 在此处可用 - convID: widget.conversationID, - convType: widget.conversationType, - duration: durationInSeconds.toInt(), - inputElement: context, - ); - - addChatRecord('[视频]', msgresult!.data!.msgID! ?? '', - msgresult!.data!.timestamp!.toString() ?? ''); - - if (imageSource == ImageSource.camera) { - DioManager.instance.get(url: Api.getAddTrialCount + "2"); - } else { - DioManager.instance.get(url: Api.getAddTrialCount + "4"); - } - } catch (e) { - print(e); - // setState(() { - // _pickImageError = e; - // }); - } - } - - Future getFirstPic(url) async { - Uint8List? bytes = await VideoThumbnail.thumbnailData(video: url); - final Completer completer = Completer(); - if (bytes != null) { - int _imageDataSize = bytes.length; - print("image size: $_imageDataSize"); - - final _image = Image.memory(bytes); - _image.image - .resolve(ImageConfiguration()) - .addListener(ImageStreamListener((ImageInfo info, bool _) { - completer.complete(ThumbnailResult( - image: _image, - dataSize: _imageDataSize, - height: info.image.height, - width: info.image.width, - )); - })); - } - - return completer.future; - } - - Future getImageFile() async { - bool isOK = await checkVipStatus(3); - if (!isOK) { - return; - } - - if (!isOK) { - return; - } - checkPhotosStatus(); - try { - final XFile? pickedFile = await _picker.pickImage( - source: ImageSource.gallery, - ); - var msgresult = await widget.model.sendImageMessage( - imagePath: pickedFile!.path, - convID: widget.conversationID, - convType: widget.conversationType, - inputElement: context); - - addChatRecord('[图片]', msgresult!.data!.msgID! ?? '', - msgresult!.data!.timestamp!.toString() ?? ''); - var data = await DioManager.instance.get(url: Api.getAddTrialCount + "3"); - } catch (e) { - print(e); - // setState(() { - // _pickImageError = e; - // }); - } - } - - Future getTakeImageFile() async { - bool isOK = await checkVipStatus(1); - if (!isOK) { - return; - } - await requestStoragePermission(); - checkPhotosStatus(); - try { - final XFile? pickedFile = await _picker.pickImage( - source: ImageSource.camera, - ); - if (null == pickedFile) { - return; - } - var msgresult = await widget.model.sendImageMessage( - imagePath: pickedFile.path, - convID: widget.conversationID, - convType: widget.conversationType, - inputElement: context); - addChatRecord('[图片]', msgresult!.data?.msgID! ?? '', - msgresult!.data!.timestamp!.toString() ?? ''); - DioManager.instance.get(url: Api.getAddTrialCount + "1"); - } catch (e) {} - } - - //实在找不到问题 先加个权限试试 - Future requestStoragePermission() async { - final status = await Permission.storage.request(); - if (status.isGranted) { - // 权限已授予,可以执行存储操作 - } else if (status.isDenied) { - showOKToast("请打开存储权限。将为你带来更好的服务"); - // 权限被拒绝,您可以显示一条消息来解释为什么需要权限 - } else if (status.isPermanentlyDenied) { - showOKToast("请打开存储权限。将为你带来更优的服务"); - // 权限被永久拒绝,用户无法在应用程序内授予权限 - // 您可以引导用户进入应用程序设置以手动启用权限 - } - } - - _handleCameraAndMic() async { - // // 请求权限 - // Map permissions = await PermissionHandler().requestPermissions( - // [PermissionGroup.camera, PermissionGroup.microphone], - // ); - // - // //校验权限 - // if (permissions[PermissionGroup.camera] != PermissionStatus.granted) { - // print("无照相权限"); - // return false; - // } - // if (permissions[PermissionGroup.microphone] != PermissionStatus.granted) { - // print("无麦克风权限"); - // return false; - // } - // return true; - // } - // - // void _onVoiceCall() async { - // // await for camera and mic permissions before pushing video page - // if (await _handleCameraAndMic()) { - // navigatePushPage(this.context, - // new PageAVChatCallerStatefulWidget(Int64(this.sessionInfo.sessionId), this.sessionInfo.sessionName)); - // } - // } - } - - void _showIsCancelBlackDialog(BuildContext context) { - showDialog( - context: context, - builder: (BuildContext context) { - return Dialog( - backgroundColor: Colors.transparent, - child: Container( - height: 277.sp, - padding: const EdgeInsets.all(1.0), - child: Stack( - children: [ - Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: const LinearGradient( - colors: [Color(0xFFDD3DF4), Color(0xFF30FFD9)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Container( - margin: EdgeInsets.all(1.sp), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: const LinearGradient( - colors: [Color(0xFF4C3E5F), Color(0xFF324140)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Container( - margin: EdgeInsets.only(top: 24.sp), - child: Column( - children: [ - Center( - child: Text( - "是否解除拉黑", - style: - TextStyle(color: Colors.white, fontSize: 16.sp), - ), - ), - Container( - margin: EdgeInsets.only(top: 14.sp), - alignment: Alignment.center, - child: Image( - image: AssetImage(getMineImage("icon_dialog_black")), - width: 70.sp, - height: 70.sp, - ), - ), - Container( - margin: EdgeInsets.only( - top: 12.sp, left: 14.sp, right: 14.sp), - alignment: Alignment.center, - child: Text( - "解除拉黑后,你将不屏蔽对方的任何信息", - textAlign: TextAlign.center, - style: TextStyle( - color: const Color(0xCCF7FAFA), fontSize: 16.sp), - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - onTap: () { - Navigator.pop(context); - }, - child: Container( - margin: EdgeInsets.only(top: 24.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color(0x26FFFFFF), - Color(0x26FFFFFF), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 10.sp, - bottom: 10.sp, - left: 52.sp, - right: 52.sp), - child: const Text( - "否", - style: TextStyle( - color: Colors.white, - fontSize: 12, - ), - ), - ), - ), - SizedBox(width: 24.sp), - GestureDetector( - onTap: () async { - Get.back(); - var data = await DioManager.instance.post( - url: '${Api.setBlock + widget.conversationID.split('_').last}/block', params: {'status': '0'}); - var bean = BaseResponse.fromJson( - data, - (jsonData) => jsonData, - ); - if (bean.isSuccess()) { - final FriendshipServices _friendshipServices = - serviceLocator(); - isBlack = false; - } - showOKToast(bean.msg); - }, - child: Container( - margin: EdgeInsets.only(top: 24.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 10.sp, - bottom: 10.sp, - left: 52.sp, - right: 52.sp), - child: const Text( - "是", - style: TextStyle( - color: Colors.white, - fontSize: 12, - ), - ), - ), - ) - ], - ) - ], - ), - ) - ], - ), - ), - ); - }, - ); - } - - void loadUserData() async { - var data = await DioManager.instance.get( - url: - "${Api.getUserInfoTA + widget.conversationID.split('_').last}/home"); - var bean = BaseResponse.fromJson( - data, (data) => ResponseBean.fromJson(data)); - - if (bean.isSuccess()) { - try { - userInfoBean = bean.data.user; - unLockWxNum = userInfoBean!.contact!.contains('*') ? 0 : 1; - setState(() {}); - } catch (e) { - - } - - } - } -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field_layout/wide.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field_layout/wide.dart deleted file mode 100644 index 2f58a39..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field_layout/wide.dart +++ /dev/null @@ -1,962 +0,0 @@ -import 'dart:async'; -import 'dart:io'; -import 'dart:math'; -import 'package:fc_native_video_thumbnail_for_us/fc_native_video_thumbnail_for_us.dart'; -import 'package:flutter/services.dart'; -import 'package:package_info_plus/package_info_plus.dart'; -import 'package:pasteboard/pasteboard.dart'; -import 'package:path/path.dart' as p; -import 'package:file_picker/file_picker.dart'; -import 'package:flutter/material.dart'; -import 'package:image_picker/image_picker.dart'; -import 'package:path_provider/path_provider.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_state.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/separate_models/tui_chat_separate_view_model.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_chat_global_model.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_setting_model.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/core/tim_uikit_wide_modal_operation_key.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/services_locatar.dart'; -import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/message.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/optimize_utils.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/screen_shot.dart'; -import 'package:tencent_cloud_chat_uikit/ui/widgets/wide_popup.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/platform.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitTextField/special_text/DefaultSpecialTextSpanBuilder.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitTextField/tim_uikit_emoji_panel.dart'; -import 'package:tencent_cloud_chat_uikit/ui/widgets/drag_widget.dart'; -import 'package:tencent_extended_text_field/extended_text_field.dart'; -import 'package:universal_html/html.dart' as html; -import 'package:url_launcher/url_launcher.dart'; -import 'package:uuid/uuid.dart'; -import 'package:wechat_assets_picker/wechat_assets_picker.dart'; - -// ignore: unnecessary_import -import 'dart:typed_data'; - -class DesktopControlBarItem { - final String item; - final IconData? icon; - final String? imgPath; - final Color? color; - final ValueChanged onClick; - final String? showName; - final double? size; - - DesktopControlBarItem( - {required this.item, - this.icon, - this.color, - this.imgPath, - required this.onClick, - this.showName, - this.size}) - : assert(icon != null || imgPath != null); -} - -class DesktopControlBarConfig { - final bool showStickerPanel; - final bool showScreenshotButton; - final bool showSendFileButton; - final bool showSendImageButton; - final bool showSendVideoButton; - final bool showMessageHistoryButton; - - DesktopControlBarConfig({ - this.showStickerPanel = true, - this.showScreenshotButton = true, - this.showSendFileButton = true, - this.showSendImageButton = true, - this.showSendVideoButton = true, - this.showMessageHistoryButton = true, - }); -} - -class TIMUIKitTextFieldLayoutWide extends StatefulWidget { - /// sticker panel customization - final CustomStickerPanel? customStickerPanel; - final VoidCallback onEmojiSubmitted; - final Function(int, String) onCustomEmojiFaceSubmitted; - final Function(String, bool) handleSendEditStatus; - final VoidCallback backSpaceText; - final ValueChanged addStickerToText; - - final ValueChanged handleAtText; - - /// Whether to use the default emoji - final bool isUseDefaultEmoji; - - final TUIChatSeparateViewModel model; - - /// background color - final Color? backgroundColor; - - /// control input field behavior - final TIMUIKitInputTextFieldController? controller; - - /// config for more panel - final MorePanelConfig? morePanelConfig; - - final String languageType; - - final TextEditingController textEditingController; - - /// conversation id - final String conversationID; - - /// conversation type - final ConvType conversationType; - - final FocusNode focusNode; - - /// show more panel - final bool showMorePanel; - - /// hint text for textField widget - final String? hintText; - - final int? currentCursor; - - final ValueChanged setCurrentCursor; - - final VoidCallback onCursorChange; - - /// show send audio icon - final bool showSendAudio; - - final VoidCallback handleSoftKeyBoardDelete; - - /// on text changed - final void Function(String)? onChanged; - - final V2TimMessage? repliedMessage; - - /// show send emoji icon - final bool showSendEmoji; - - final String? forbiddenText; - - final VoidCallback onSubmitted; - - final VoidCallback goDownBottom; - - final List customEmojiStickerList; - - /// Conversation need search - final V2TimConversation currentConversation; - - const TIMUIKitTextFieldLayoutWide( - {Key? key, - this.customStickerPanel, - required this.onEmojiSubmitted, - required this.onCustomEmojiFaceSubmitted, - required this.backSpaceText, - required this.addStickerToText, - required this.isUseDefaultEmoji, - required this.languageType, - required this.textEditingController, - this.morePanelConfig, - required this.conversationID, - required this.conversationType, - required this.focusNode, - this.currentCursor, - required this.setCurrentCursor, - required this.onCursorChange, - required this.model, - this.backgroundColor, - this.onChanged, - required this.handleSendEditStatus, - required this.handleAtText, - required this.handleSoftKeyBoardDelete, - this.repliedMessage, - this.forbiddenText, - required this.onSubmitted, - required this.goDownBottom, - required this.showSendAudio, - required this.showSendEmoji, - required this.showMorePanel, - this.hintText, - required this.customEmojiStickerList, - this.controller, - required this.currentConversation}) - : super(key: key); - - @override - State createState() => - _TIMUIKitTextFieldLayoutWideState(); -} - -class _TIMUIKitTextFieldLayoutWideState - extends TIMUIKitState { - final TUISettingModel settingModel = serviceLocator(); - OverlayEntry? entry; - final ImagePicker _picker = ImagePicker(); - Uint8List? fileContent; - String? fileName; - File? tempFile; - Function? setKeyboardHeight; - double? bottomPadding; - late ScrollController _scrollController; - late FocusNode textFocusNode; - - @override - void initState() { - super.initState(); - if (widget.controller != null) { - widget.controller?.addListener(() { - final actionType = widget.controller?.actionType; - if (actionType == ActionType.hideAllPanel) { - hideAllPanel(); - } - }); - } - textFocusNode = FocusNode(); - widget.focusNode.requestFocus(); - _scrollController = ScrollController(); - } - - hideAllPanel() { - widget.focusNode.unfocus(); - widget.currentCursor == null; - } - - _debounce( - Function(String text) fun, [ - Duration delay = const Duration(milliseconds: 30), - ]) { - Timer? timer; - return (String text) { - if (timer != null) { - timer?.cancel(); - } - - timer = Timer(delay, () { - fun(text); - }); - }; - } - - _buildRepliedMessage(V2TimMessage? repliedMessage) { - final haveRepliedMessage = repliedMessage != null; - if (haveRepliedMessage) { - final text = - "${MessageUtils.getDisplayName(widget.model.repliedMessage!)}:${widget.model.abstractMessageBuilder != null ? widget.model.abstractMessageBuilder!(widget.model.repliedMessage!) : MessageUtils.getAbstractMessageAsync(widget.model.repliedMessage!, widget.model.groupMemberList ?? [])}"; - return Container( - color: widget.backgroundColor ?? hexToColor("f5f5f6"), - alignment: Alignment.centerLeft, - padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 16), - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Text( - text, - softWrap: true, - maxLines: 3, - overflow: TextOverflow.ellipsis, - style: TextStyle(color: hexToColor("8f959e"), fontSize: 14), - ), - ), - const SizedBox( - width: 16, - ), - InkWell( - onTap: () { - widget.model.repliedMessage = null; - }, - child: Icon(Icons.clear, color: hexToColor("8f959e"), size: 18), - ) - ], - ), - ); - } - return Container(); - } - - _sendEmoji(Offset? offset, TUITheme theme) { - widget.onCursorChange(); - if (entry != null) { - entry?.remove(); - entry = null; - } else { - entry = OverlayEntry(builder: (BuildContext context) { - return TUIKitDragArea( - closeFun: () { - if (entry != null) { - entry?.remove(); - entry = null; - } - }, - initOffset: offset ?? - Offset(MediaQuery.of(context).size.height * 0.5 + 20, - MediaQuery.of(context).size.height * 0.5 - 100), - child: Container( - decoration: BoxDecoration( - borderRadius: const BorderRadius.all(Radius.circular(8)), - color: theme.wideBackgroundColor, - border: Border.all( - width: 2, - color: theme.weakBackgroundColor ?? const Color(0xFFbebebe), - ), - boxShadow: const [ - BoxShadow( - color: Color(0xFFbebebe), - offset: Offset(5, 5), - blurRadius: 10, - spreadRadius: 1, - ), - ], - ), - child: Container( - child: widget.customStickerPanel != null - ? widget.customStickerPanel!( - height: 400, - width: 350, - sendTextMessage: () { - widget.onEmojiSubmitted(); - }, - sendFaceMessage: widget.onCustomEmojiFaceSubmitted, - deleteText: () { - widget.backSpaceText(); - }, - addText: (int unicode) { - final newText = String.fromCharCode(unicode); - widget.addStickerToText(newText); - }, - addCustomEmojiText: ((String singleEmojiName) { - String? emojiName = singleEmojiName.split('.png')[0]; - if (widget.isUseDefaultEmoji && - widget.languageType == 'zh' && - ConstData.emojiMapList[emojiName] != null && - ConstData.emojiMapList[emojiName] != '') { - emojiName = ConstData.emojiMapList[emojiName]; - } - final newText = '[$emojiName]'; - widget.addStickerToText(newText); - }), - defaultCustomEmojiStickerList: - widget.isUseDefaultEmoji ? ConstData.emojiList : []) - : EmojiPanel(onTapEmoji: (unicode) { - final newText = String.fromCharCode(unicode); - widget.addStickerToText(newText); - }, onSubmitted: () { - widget.onEmojiSubmitted(); - }, delete: () { - widget.backSpaceText(); - }), - ), - )); - }); - Overlay.of(context)?.insert(entry!); - } - } - - _addGreyOverlay() { - if (entry != null) { - _removeOverlay(); - return; - } else { - entry = OverlayEntry(builder: (BuildContext context) { - return Container( - color: const Color(0x7F000000), - ); - }); - Overlay.of(context)?.insert(entry!); - } - } - - _removeOverlay() { - entry!.remove(); - entry = null; - } - - _sendFile( - TUIChatSeparateViewModel model, - TUITheme theme, - ) async { - if (!PlatformUtils().isWeb) { - _addGreyOverlay(); - } - try { - final convID = widget.conversationID; - final convType = widget.conversationType; - FilePickerResult? result = await FilePicker.platform.pickFiles(); - _removeOverlay(); - if (result != null && result.files.isNotEmpty) { - if (PlatformUtils().isWeb) { - html.Node? inputElem; - inputElem = html.document - .getElementById("__file_picker_web-file-input") - ?.querySelector("input"); - fileName = result.files.single.name; - - MessageUtils.handleMessageError( - model.sendFileMessage( - inputElement: inputElem, - fileName: fileName, - convID: convID, - convType: convType), - context); - return; - } - - File file = File(result.files.single.path!); - final int size = file.lengthSync(); - final String savePath = file.path; - - MessageUtils.handleMessageError( - model.sendFileMessage( - filePath: savePath, - size: size, - convID: convID, - convType: convType), - context); - } else { - throw TypeError(); - } - } catch (e) { - // ignore: avoid_print - print("_sendFileErr: ${e.toString()}"); - } - } - - List generateBarIcons( - List items, TUITheme theme) { - return items.map((e) { - final GlobalKey key = GlobalKey(); - return Container( - margin: const EdgeInsets.only(right: 6), - child: InkWell( - onTap: () { - final alignBox = - key.currentContext?.findRenderObject() as RenderBox?; - var offset = alignBox?.localToGlobal(Offset.zero); - final double? dx = (offset?.dx != null) ? offset!.dx : null; - final double? dy = - (offset?.dy != null && alignBox?.size.height != null) - ? offset!.dy - 420 - : null; - e.onClick((dx != null && dy != null) ? Offset(dx, dy) : null); - }, - child: Tooltip( - preferBelow: false, - textStyle: TextStyle(fontSize: 12, color: theme.white), - message: e.showName, - child: Container( - decoration: - BoxDecoration(borderRadius: BorderRadius.circular(2)), - padding: const EdgeInsets.all(4), - child: e.imgPath != null - ? Image.asset( - e.imgPath!, - key: key, - width: e.size ?? 20, - height: e.size ?? 20, - ) - : Icon(e.icon, - key: key, - color: e.color ?? hexToColor("646a73"), - size: e.size ?? 20)), - ), - ), - ); - }).toList(); - } - - _sendImageFileOnWeb(TUIChatSeparateViewModel model) async { - try { - final pickedFile = await _picker.pickImage(source: ImageSource.gallery); - final imageContent = await pickedFile!.readAsBytes(); - fileName = pickedFile.name; - tempFile = File(pickedFile.path); - fileContent = imageContent; - - html.Node? inputElem; - inputElem = html.document - .getElementById("__image_picker_web-file-input") - ?.querySelector("input"); - final convID = widget.conversationID; - final convType = widget.conversationType; - MessageUtils.handleMessageError( - model.sendImageMessage( - inputElement: inputElem, - imagePath: tempFile?.path, - convID: convID, - convType: convType), - context); - } catch (e) { - // ignore: avoid_print - print("_sendFileErr: ${e.toString()}"); - } - } - - _sendVideoFileOnWeb(TUIChatSeparateViewModel model) async { - try { - final pickedFile = await _picker.pickVideo(source: ImageSource.gallery); - final videoContent = await pickedFile!.readAsBytes(); - fileName = pickedFile.name; - tempFile = File(pickedFile.path); - fileContent = videoContent; - - if (fileName!.split(".")[fileName!.split(".").length - 1] != "mp4") { - onTIMCallback(TIMCallback( - type: TIMCallbackType.INFO, - infoRecommendText: TIM_t("视频消息仅限 mp4 格式"), - infoCode: 6660412)); - return; - } - - html.Node? inputElem; - inputElem = html.document - .getElementById("__image_picker_web-file-input") - ?.querySelector("input"); - final convID = widget.conversationID; - final convType = widget.conversationType; - MessageUtils.handleMessageError( - model.sendVideoMessage( - inputElement: inputElem, - videoPath: tempFile?.path, - convID: convID, - convType: convType), - context); - } catch (e) { - // ignore: avoid_print - print("_sendFileErr: ${e.toString()}"); - } - } - - _sendVideoMessage(AssetEntity asset, TUIChatSeparateViewModel model) async { - try { - final plugin = FcNativeVideoThumbnail(); - final originFile = await asset.originFile; - final size = await originFile!.length(); - if (size >= 104857600) { - onTIMCallback(TIMCallback( - type: TIMCallbackType.INFO, - infoRecommendText: TIM_t("发送失败,视频不能大于100MB"), - infoCode: 6660405)); - return; - } - - final duration = asset.videoDuration.inSeconds; - final filePath = originFile.path; - final convID = widget.conversationID; - final convType = widget.conversationType; - - String tempPath = (await getTemporaryDirectory()).path + - p.extension(originFile.path, 3) + - ".jpeg"; - - await plugin.getVideoThumbnail( - srcFile: originFile.path, - keepAspectRatio: true, - destFile: tempPath, - format: 'jpeg', - width: 128, - quality: 100, - height: 128, - ); - MessageUtils.handleMessageError( - model.sendVideoMessage( - videoPath: filePath, - duration: duration, - snapshotPath: tempPath, - convID: convID, - convType: convType), - context); - } catch (e) { - onTIMCallback(TIMCallback( - type: TIMCallbackType.INFO, - infoRecommendText: TIM_t("视频文件异常"), - infoCode: 6660415)); - } - } - - _sendMediaMessage( - TUIChatSeparateViewModel model, TUITheme theme, FileType fileType) async { - try { - final convID = widget.conversationID; - final convType = widget.conversationType; - - if (PlatformUtils().isMobile) { - final pickedAssets = await AssetPicker.pickAssets(context); - - if (pickedAssets != null) { - for (var asset in pickedAssets) { - final originFile = await asset.originFile; - final filePath = originFile?.path; - final type = asset.type; - if (filePath != null) { - if (type == AssetType.image) { - MessageUtils.handleMessageError( - model.sendImageMessage( - imagePath: filePath, - convID: convID, - convType: convType), - context); - } - - if (type == AssetType.video) { - _sendVideoMessage(asset, model); - } - } - } - } - } else { - final plugin = FcNativeVideoThumbnail(); - _addGreyOverlay(); - FilePickerResult? result = - await FilePicker.platform.pickFiles(type: fileType); - _removeOverlay(); - if (result != null && result.files.isNotEmpty) { - File file = File(result.files.single.path!); - final String savePath = file.path; - final String type = TencentUtils.getFileType( - (savePath.split(".")[savePath.split(".").length - 1]) - .toLowerCase()) - .split("/")[0]; - - if (type == "image") { - MessageUtils.handleMessageError( - model.sendImageMessage( - imagePath: savePath, convID: convID, convType: convType), - context); - } else if (type == "video") { - String tempPath = (await getTemporaryDirectory()).path + - p.basename(savePath) + - ".jpeg"; - await plugin.getVideoThumbnail( - srcFile: savePath, - keepAspectRatio: true, - destFile: tempPath, - format: 'jpeg', - width: 128, - quality: 100, - height: 128, - ); - MessageUtils.handleMessageError( - model.sendVideoMessage( - videoPath: savePath, - convID: convID, - convType: convType, - snapshotPath: tempPath), - context); - } - } else { - throw TypeError(); - } - } - } catch (err) { - // ignore: avoid_print - print("send media err: $err"); - onTIMCallback(TIMCallback( - type: TIMCallbackType.INFO, - infoRecommendText: TIM_t("视频文件异常"), - infoCode: 6660415)); - } - } - - _sendImageWithConfirmation(String file) async { - final option1 = widget.currentConversation.showName ?? - (widget.conversationType == ConvType.group ? TIM_t("群聊") : TIM_t("对方")); - final size = await ScreenshotHelper.getImageSize(file); - - TUIKitWidePopup.showPopupWindow( - operationKey: TUIKitWideModalOperationKey.beforeSendScreenShot, - context: context, - isDarkBackground: false, - width: 500, - height: min(500, size.height / 2 + 140), - title: TIM_t_para("发送给{{option1}}", "发送给$option1")(option1: option1), - child: (closeFunc) => Container( - padding: const EdgeInsets.all(16), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - SizedBox( - height: min(360, size.height / 2), - child: InkWell( - onTap: () { - launchUrl(Uri.file(file)); - }, - child: Image.file( - File(file), - height: min(360, size.height / 2), - ), - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.end, - mainAxisSize: MainAxisSize.max, - children: [ - OutlinedButton( - onPressed: () { - closeFunc(); - }, - child: Text(TIM_t("取消"))), - const SizedBox( - width: 20, - ), - ElevatedButton( - onPressed: () { - MessageUtils.handleMessageError( - widget.model.sendImageMessage( - imagePath: file, - convID: widget.conversationID, - convType: widget.conversationType), - context); - closeFunc(); - }, - child: Text(TIM_t("发送"))) - ], - ) - ], - ), - )); - } - - _sendScreenShot() async { - final file = await ScreenshotHelper.captureScreen(); - if (file != null) { - _sendImageWithConfirmation(file); - } else {} - } - - List generateControlBar( - TUIChatSeparateViewModel model, TUITheme theme) { - final DesktopControlBarConfig config = - DesktopControlBarConfig(); - final List itemsList = [ - if (config.showStickerPanel) - DesktopControlBarItem( - item: "face", - showName: TIM_t("表情"), - onClick: (offset) { - _sendEmoji(offset, theme); - }, - icon: Icons.mood), - if (config.showScreenshotButton && PlatformUtils().isDesktop) - DesktopControlBarItem( - item: "screenShot", - showName: TIM_t("截图"), - onClick: (offset) { - _sendScreenShot(); - }, - icon: Icons.cut_outlined), - if (config.showSendFileButton) - DesktopControlBarItem( - item: "file", - showName: TIM_t("文件"), - onClick: (offset) { - _sendFile(widget.model, theme); - }, - icon: Icons.file_copy_outlined), - if (config.showSendImageButton) - DesktopControlBarItem( - item: "photo", - showName: TIM_t("图片"), - onClick: (offset) { - if (PlatformUtils().isWeb) { - _sendImageFileOnWeb(widget.model); - } else { - _sendMediaMessage(widget.model, theme, FileType.image); - } - }, - icon: Icons.image_outlined), - if (config.showSendVideoButton) - DesktopControlBarItem( - item: "video", - showName: TIM_t("视频"), - onClick: (offset) { - if (PlatformUtils().isWeb) { - _sendVideoFileOnWeb(widget.model); - } else { - _sendMediaMessage(widget.model, theme, FileType.video); - } - }, - icon: Icons.video_library_outlined), - if (config.showMessageHistoryButton) - DesktopControlBarItem( - item: "history", - showName: TIM_t("消息历史"), - onClick: (offset) { - TUIKitWidePopup.showPopupWindow( - operationKey: TUIKitWideModalOperationKey.chatHistory, - context: context, - width: MediaQuery.of(context).size.width * 0.5, - height: MediaQuery.of(context).size.width * 0.5, - child: (onClose) => TIMUIKitSearchMsgDetail( - currentConversation: widget.currentConversation, - keyword: '', - initMessageList: widget.model - .getOriginMessageList() - .getRange( - 0, - min(widget.model.getOriginMessageList().length, - 100)) - .toList(), - onTapConversation: (V2TimConversation conversation, - V2TimMessage? message) {}, - ), - theme: theme); - }, - icon: Icons.chat_outlined), - - ]; - - return generateBarIcons(itemsList, theme); - } - - Future _handleKeyEvent(RawKeyEvent event) async { - if ((event.isKeyPressed(LogicalKeyboardKey.controlLeft) && - event.logicalKey == LogicalKeyboardKey.keyV) || - (event.isMetaPressed && event.logicalKey == LogicalKeyboardKey.keyV)) { - final bytes = await Pasteboard.image; - if (bytes != null) { - String directory; - if (PlatformUtils().isWindows) { - final String documentsDirectoryPath = - "${Platform.environment['USERPROFILE']}"; - PackageInfo packageInfo = await PackageInfo.fromPlatform(); - String pkgName = packageInfo.packageName; - directory = p.join(documentsDirectoryPath, "Documents", - ".TencentCloudChat", pkgName, "screenshots"); - } else { - final dic = await getApplicationSupportDirectory(); - directory = dic.path; - } - const uuid = Uuid(); - final fileName = 'paste_image_${uuid.v4()}.png'; - final scDirectory = Directory(directory); - final filePath = - '${scDirectory.path}${PlatformUtils().isWindows ? "\\" : "/"}$fileName'; - final file = File(filePath); - if (!await scDirectory.exists()) { - await scDirectory.create(recursive: true); - } - await file.writeAsBytes(bytes.toList()); - _sendImageWithConfirmation(filePath); - } - } - } - - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - final theme = value.theme; - - setKeyboardHeight ??= OptimizeUtils.debounce((height) { - settingModel.keyboardHeight = height; - }, const Duration(seconds: 1)); - - final debounceFunc = _debounce((value) { - if (widget.onChanged != null) { - widget.onChanged!(value); - } - widget.handleAtText(value); - widget.handleSendEditStatus(value, true); - final isEmpty = value.isEmpty; - if (isEmpty) { - widget.handleSoftKeyBoardDelete(); - } - }, const Duration(milliseconds: 80)); - - final MediaQueryData data = MediaQuery.of(context); - EdgeInsets padding = data.padding; - if (bottomPadding == null || padding.bottom > bottomPadding!) { - bottomPadding = padding.bottom; - } - - return RawKeyboardListener( - focusNode: textFocusNode, - onKey: _handleKeyEvent, - child: Container( - color: widget.backgroundColor, - child: Column( - children: [ - SizedBox( - height: 1, - child: Container( - color: theme.weakDividerColor ?? Colors.black12)), - if (widget.forbiddenText == null) - Container( - padding: - const EdgeInsets.symmetric(vertical: 4, horizontal: 12), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: generateControlBar(widget.model, theme), - ), - ), - _buildRepliedMessage(widget.repliedMessage), - Container( - padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 6), - constraints: const BoxConstraints(minHeight: 50), - child: Row( - children: [ - if (widget.forbiddenText != null) - Expanded( - child: Container( - height: 35, - color: theme.weakBackgroundColor, - alignment: Alignment.center, - child: Text( - TIM_t(widget.forbiddenText!), - textAlign: TextAlign.center, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 16, - color: theme.weakTextColor, - ), - ), - )), - if (widget.forbiddenText == null) - Expanded( - child: Scrollbar( - controller: _scrollController, - child: ExtendedTextField( - autofocus: true, - maxLines: 6, - minLines: 6, - focusNode: widget.focusNode, - onChanged: debounceFunc, - keyboardType: TextInputType.multiline, - textInputAction: PlatformUtils().isAndroid - ? TextInputAction.newline - : TextInputAction.send, - onEditingComplete: () { - widget.onSubmitted(); - }, - textAlignVertical: TextAlignVertical.top, - style: const TextStyle(fontSize: 14), - decoration: InputDecoration( - hoverColor: hexToColor("fafafa"), - border: InputBorder.none, - hintStyle: const TextStyle( - color: Color(0xffAEA4A3), - ), - fillColor: hexToColor("fafafa"), - filled: true, - isDense: true, - hintText: widget.hintText ?? '', - ), - controller: widget.textEditingController, - specialTextSpanBuilder: PlatformUtils().isWeb - ? null - : DefaultSpecialTextSpanBuilder( - isUseDefaultEmoji: - widget.isUseDefaultEmoji, - customEmojiStickerList: - widget.customEmojiStickerList, - showAtBackground: true, - )), - ), - ), - ], - ), - ), - ], - ), - )); - } -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/tim_uikit_chat.dart b/circle_app/lib/app/chat/TIMUIKitChat/tim_uikit_chat.dart deleted file mode 100644 index 98a3f01..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/tim_uikit_chat.dart +++ /dev/null @@ -1,955 +0,0 @@ -// ignore_for_file: must_be_immutable, avoid_print - -import 'package:circle_app/app/chat/widget/more_dialog.dart'; -import 'package:circle_app/components/func_widget.dart'; -import 'package:circle_app/util/eventBus.dart'; -import 'package:desktop_drop/desktop_drop.dart'; -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:provider/provider.dart'; -import 'package:provider/single_child_widget.dart'; -import 'package:scroll_to_index/scroll_to_index.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_state.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/life_cycle/chat_life_cycle.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/listener_model/tui_group_listener_model.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/separate_models/tui_chat_separate_view_model.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_chat_global_model.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/services_locatar.dart'; -import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; -import 'package:tencent_cloud_chat_uikit/ui/constants/history_message_constant.dart'; -import 'package:tencent_cloud_chat_uikit/ui/controller/tim_uikit_chat_controller.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/frame.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/optimize_utils.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKItMessageList/tim_uikit_chat_history_message_list_config.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitTextField/at_member_panel.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/tim_uikit_multi_select_panel.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/tim_uikit_send_file.dart'; -import '../../../common/colors/app_color.dart'; -import '../../../network/api.dart'; -import '../../../network/dio_manager.dart'; -import '../../../router/app_routers.dart'; -import '../../../util/util.dart'; -import '../../userinfo/logic.dart'; -import 'TIMUIKItMessageList/TIMUIKitTongue/tim_uikit_chat_history_message_list_tongue.dart'; -import 'TIMUIKItMessageList/tim_uikit_chat_history_message_list_config.dart'; -import 'TIMUIKItMessageList/tim_uikit_history_message_list_container.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart'; - -import 'TIMUIKitTextField/tim_uikit_text_field.dart'; - -class TIMChat extends StatefulWidget { - int startTime = 0; - int endTime = 0; - - /// The chat controller you tend to used. - /// You have to provide this before using it since tencent_cloud_chat_uikit 0.1.4. - final TIMUIKitChatController? controller; - - /// [Update] It is suggested to provide the `V2TimConversation` once directly, since tencent_cloud_chat_uikit 1.5.0. - /// `conversationID` / `conversationType` / `groupAtInfoList` / `conversationShowName` are not necessary to be provided, unless you want to cover these fields manually. - final V2TimConversation conversation; - - /// The ID of the Group that the topic belongs to, only need for topic. - final String? groupID; - - /// Conversation id, use for load history message list. - /// This field is not necessary to be provided, when `conversation` is provided, unless you want to cover this field manually. - final String? conversationID; - - /// Conversation type. - /// This field is not necessary to be provided, when `conversation` is provided, unless you want to cover this field manually. - final ConvType? conversationType; - - /// use for customize avatar - final Widget Function(BuildContext context, V2TimMessage message)? - userAvatarBuilder; - - /// Use for show conversation name. - /// This field is not necessary to be provided, when `conversation` is provided, unless you want to cover this field manually. - final String? conversationShowName; - - /// Avatar and name in message reaction tap callback. - final void Function(String userID, TapDownDetails tapDetails)? onTapAvatar; - - @Deprecated( - "Nickname will not shows in one-to-one chat, if you tend to control it in group chat, please use `isShowSelfNameInGroup` and `isShowOthersNameInGroup` from `config: TIMUIKitChatConfig` instead") - - /// Should show the nick name. - final bool showNickName; - - /// Message item builder, can customize partial message item for different types or the layout for the whole line. - final MessageItemBuilder? messageItemBuilder; - - /// Is show unread message count, default value is false - final bool showTotalUnReadCount; - - /// Deprecated("Please use [extraTipsActionItemBuilder] instead") - final Widget? Function(V2TimMessage message, Function() closeTooltip, - [Key? key, BuildContext? context])? exteraTipsActionItemBuilder; - - /// The builder for extra tips action. - final Widget? Function(V2TimMessage message, Function() closeTooltip, - [Key? key, BuildContext? context])? extraTipsActionItemBuilder; - - /// The text of draft shows in TextField. - /// [Recommend]: You can specify this field with the draftText from V2TimConversation. - final String? draftText; - - /// The target message been jumped just after entering the chat page. - final V2TimMessage? initFindingMsg; - - /// The hint text shows at input field. - final String? textFieldHintText; - - /// The configuration for appbar. - final AppBar? appBarConfig; - - /// The configuration for historical message list. - final TIMUIKitHistoryMessageListConfig? mainHistoryListConfig; - - /// The configuration for more panel, can customize actions. - final MorePanelConfig? morePanelConfig; - - /// The builder for the tongue on the right bottom. - /// Used for back to bottom, shows the count of unread new messages, - /// and prompts the messages that @ user. - final TIMTongueItemBuilder? tongueItemBuilder; - - /// The `groupAtInfoList` from `V2TimConversation`. - /// This field is not necessary to be provided, when `conversation` is provided, unless you want to cover this field manually. - final List? groupAtInfoList; - - /// The configuration for the whole `TIMUIKitChat` widget. - final TIMUIKitChatConfig? config; - - /// The callback for jumping to the page for `TIMUIKitGroupApplicationList` or other pages to deal with enter group application for group administrator manually, in the case of [public group]. - /// The parameter here is `String groupID` - final ValueChanged? onDealWithGroupApplication; - - /// The builder for abstract messages, normally used in replied message and forward message. - final String Function(V2TimMessage message)? abstractMessageBuilder; - - /// The configuration for tool tips panel, long press messages will show this panel. - final ToolTipsConfig? toolTipsConfig; - - /// The life cycle for chat business logic. - final ChatLifeCycle? lifeCycle; - - /// The top fixed widget. - final Widget? topFixWidget; - - final List customEmojiStickerList; - - final PreferredSizeWidget? customAppBar; - - /// Custom emoji panel. - final CustomStickerPanel? customStickerPanel; - - /// Custom text field - final Widget Function(BuildContext context)? textFieldBuilder; - - TIMChat( - {Key? key, - this.groupID, - required this.conversation, - this.conversationID, - this.conversationType, - this.conversationShowName, - this.abstractMessageBuilder, - this.onTapAvatar, - @Deprecated("Nickname will not show in one-to-one chat, if you tend to control it in group chat, please use `isShowSelfNameInGroup` and `isShowOthersNameInGroup` from `config: TIMUIKitChatConfig` instead") - this.showNickName = false, - this.showTotalUnReadCount = false, - this.messageItemBuilder, - @Deprecated("Please use [extraTipsActionItemBuilder] instead") - this.exteraTipsActionItemBuilder, - this.extraTipsActionItemBuilder, - this.draftText, - this.textFieldHintText, - this.initFindingMsg, - this.userAvatarBuilder, - this.appBarConfig, - this.controller, - this.morePanelConfig, - this.customStickerPanel, - this.config = const TIMUIKitChatConfig(), - this.tongueItemBuilder, - this.groupAtInfoList, - this.mainHistoryListConfig, - this.onDealWithGroupApplication, - this.toolTipsConfig, - this.lifeCycle, - this.topFixWidget = const SizedBox(), - this.textFieldBuilder, - this.customEmojiStickerList = const [], - this.customAppBar}) - : super(key: key) { - startTime = DateTime.now().millisecondsSinceEpoch; - } - - @override - State createState() => _TUIChatState(); -} - -class _TUIChatState extends TIMUIKitState { - TUIChatSeparateViewModel model = TUIChatSeparateViewModel(); - final TUIThemeViewModel themeViewModel = serviceLocator(); - final TIMUIKitInputTextFieldController textFieldController = - TIMUIKitInputTextFieldController(); - bool isInit = false; - final TUIChatGlobalModel chatGlobalModel = - serviceLocator(); - bool _dragging = false; - bool isLike = false; - UserBean? otherUserBean; - bool isBlack = false; - final GlobalKey alignKey = GlobalKey(); - final GlobalKey listContainerKey = GlobalKey(); - - late AutoScrollController autoController = AutoScrollController( - viewportBoundaryGetter: () => - Rect.fromLTRB(0, 0, 0, MediaQuery.of(context).padding.bottom), - axis: Axis.vertical, - ); - - late AutoScrollController atMemberPanelScroll = AutoScrollController( - viewportBoundaryGetter: () => - Rect.fromLTRB(0, 0, 0, MediaQuery.of(context).padding.bottom), - axis: Axis.vertical, - ); - - var sub; - - @override - void initState() { - super.initState(); - sub = EventBusManager.on().listen((event) { - model.clearHistory(); - }); - if (kProfileMode) { - Frame.init(); - } - model.abstractMessageBuilder = widget.abstractMessageBuilder; - model.onTapAvatar = widget.onTapAvatar; - WidgetsBinding.instance.addPostFrameCallback((_) async { - if (kProfileMode) { - widget.endTime = DateTime.now().millisecondsSinceEpoch; - int timeSpend = widget.endTime - widget.startTime; - print("Page render time:$timeSpend ms"); - } - }); - // loadUserData(); - } - - @override - void dispose() { - super.dispose(); - sub.cancel(); - if (kProfileMode) { - Frame.destroy(); - } - try { - model.dispose(); - } catch (e) {} - } - - @override - void didUpdateWidget(TIMChat oldWidget) { - super.didUpdateWidget(oldWidget); - if (widget.conversationID != oldWidget.conversationID) { - isInit = false; - chatGlobalModel.clearCurrentConversation(); - model = TUIChatSeparateViewModel(); - model.abstractMessageBuilder = widget.abstractMessageBuilder; - model.onTapAvatar = widget.onTapAvatar; - Future.delayed(const Duration(milliseconds: 50), () { - try { - autoController.jumpTo( - autoController.position.minScrollExtent, - ); - autoController.jumpTo( - autoController.position.minScrollExtent, - ); - // ignore: empty_catches - } catch (e) {} - }); - } - } - - loadBlackStatus() async { - var result = await DioManager.instance - .get(url: '${Api.setBlock + otherUserBean!.id!.toString()}/block'); - isBlack = result["data"]["status"] == 1; - setState(() { - - }); - } - - Widget _renderJoinGroupApplication(int amount, TUITheme theme) { - String option1 = amount.toString(); - return Container( - height: 36, - decoration: BoxDecoration(color: hexToColor("f6eabc")), - child: GestureDetector( - onTap: () { - if (widget.onDealWithGroupApplication != null) { - widget.onDealWithGroupApplication!(_getConvID()); - } - }, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Text( - TIM_t_para("{{option1}} 条入群请求", "$option1 条入群请求")( - option1: option1), - style: const TextStyle( - fontSize: 12, - ), - ), - Container( - margin: const EdgeInsets.only(left: 12), - child: Text( - TIM_t("去处理"), - style: TextStyle(fontSize: 12, color: theme.primaryColor), - ), - ) - ], - ), - ), - ); - } - - String _getTitle() { - return TencentUtils.checkString(widget.conversationShowName) ?? - widget.conversation.showName ?? - "Chat"; - } - - String _getConvID() { - return TencentUtils.checkString(widget.conversationID) ?? - (widget.conversation.type == 1 - ? widget.conversation.userID - : widget.conversation.groupID) ?? - ""; - } - - ConvType _getConvType() { - return widget.conversation.type == 1 ? ConvType.c2c : ConvType.group; - } - - String _getTotalUnReadCount(int unreadCount) { - return unreadCount < 99 ? unreadCount.toString() : "99+"; - } - - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - if (otherUserBean == null) { - loadUserData(); - } - final TUITheme theme = value.theme; - final closePanel = - OptimizeUtils.throttle((_) => textFieldController.hideAllPanel(), 60); - final isBuild = isInit; - isInit = true; - - return TIMUIKitChatProviderScope( - model: model, - groupID: widget.groupID, - textFieldController: textFieldController, - conversationID: _getConvID(), - conversationType: _getConvType(), - lifeCycle: widget.lifeCycle, - config: widget.config, - isBuild: isBuild, - providers: [ - Provider(create: (_) => widget.config), - ], - builder: (context, model, w) { - final TUIChatGlobalModel chatGlobalModel = - Provider.of(context, listen: true); - - widget.controller?.model = model; - List filteredApplicationList = []; - if (widget.conversationType == ConvType.group && - widget.onDealWithGroupApplication != null) { - filteredApplicationList = - chatGlobalModel.groupApplicationList.where((item) { - return (item.groupID == widget.conversationID) && - item.handleStatus == 0; - }).toList(); - } - - final TUIGroupListenerModel groupListenerModel = - Provider.of(context, listen: true); - final NeedUpdate? needUpdate = groupListenerModel.needUpdate; - if (needUpdate != null && - needUpdate.groupID == widget.conversationID) { - groupListenerModel.needUpdate = null; - switch (needUpdate.updateType) { - case UpdateType.groupInfo: - model.loadGroupInfo(_getConvID()); - break; - case UpdateType.memberList: - model.loadGroupMemberList(groupID: _getConvID()); - model.loadGroupInfo(_getConvID()); - break; - default: - break; - } - } - - return BgWidget( - widget: GestureDetector( - onTap: () { - textFieldController.hideAllPanel(); - }, - child: Scaffold( - backgroundColor: Colors.transparent, - // resizeToAvoidBottomInset: false, - appBar: PreferredSize( - preferredSize: const Size.fromHeight(48.0), - child: Stack( - alignment: Alignment.centerLeft, - children: [ - widget.customAppBar!, - chatGlobalModel.totalUnReadCount > 0 - ? Positioned( - left: 40.sp, - bottom: 12.sp, - child: Container( - // width: 22, - height: 22, - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(11), - color: theme.cautionColor, - ), - constraints: BoxConstraints( - maxWidth: 30, - minWidth: 22, - ), - child: Text( - _getTotalUnReadCount( - chatGlobalModel.totalUnReadCount), - style: TextStyle( - color: Colors.white, fontSize: 12.sp), - ), - )) - : Container(), - if (otherUserBean != null) - Positioned( - left: 40.sp, - bottom: 4.sp, - child: titleWidget(chatGlobalModel.totalUnReadCount)), - ], - ), - ), - body: DropTarget( - onDragDone: (detail) { - setState(() { - _dragging = false; - sendFileWithConfirmation( - files: detail.files, - conversation: widget.conversation, - conversationType: _getConvType(), - model: model, - theme: theme, - context: context); - }); - }, - onDragEntered: (detail) { - setState(() { - _dragging = true; - }); - }, - onDragExited: (detail) { - setState(() { - _dragging = false; - }); - }, - child: Stack( - children: [ - Column( - children: [ - if (filteredApplicationList.isNotEmpty) - _renderJoinGroupApplication( - filteredApplicationList.length, theme), - if (widget.topFixWidget != null) widget.topFixWidget!, - Expanded( - child: Container( - // color: Colors.red, - color: theme.chatBgColor, - child: Align( - // key: alignKey, - alignment: Alignment.topCenter, - child: Listener( - onPointerMove: closePanel, - child: TIMUIKitHistoryMessageListContainer( - conversation: widget.conversation, - textFieldController: textFieldController, - customEmojiStickerList: - widget.customEmojiStickerList, - isUseDefaultEmoji: - widget.config!.isUseDefaultEmoji, - // key: listContainerKey, - isAllowScroll: true, - userAvatarBuilder: widget.userAvatarBuilder, - toolTipsConfig: widget.toolTipsConfig, - groupAtInfoList: widget.groupAtInfoList, - tongueItemBuilder: widget.tongueItemBuilder, - onLongPressForOthersHeadPortrait: - (String? userId, String? nickName) { - if (widget.conversationType != - ConvType.c2c) { - textFieldController.longPressToAt( - nickName, userId); - } - }, - mainHistoryListConfig: - widget.mainHistoryListConfig, - initFindingMsg: widget.initFindingMsg, - extraTipsActionItemBuilder: - widget.extraTipsActionItemBuilder ?? - widget.exteraTipsActionItemBuilder, - conversationType: _getConvType(), - scrollController: autoController, - onTapAvatar: widget.onTapAvatar, - // ignore: deprecated_member_use_from_same_package - showNickName: widget.showNickName, - messageItemBuilder: - widget.messageItemBuilder, - conversationID: _getConvID(), - ), - )), - )), - Selector( - builder: (context, value, child) { - return value - ? MultiSelectPanel( - conversationType: _getConvType(), - ) - : (widget.textFieldBuilder != null - ? widget.textFieldBuilder!(context) - : TIMInputTextField( - // key: inputTextFieldState, - isBlack: isBlack, - atMemberPanelScroll: - atMemberPanelScroll, - groupType: - widget.conversation.groupType, - currentConversation: - widget.conversation, - model: model, - controller: textFieldController, - customEmojiStickerList: - widget.customEmojiStickerList, - isUseDefaultEmoji: - widget.config!.isUseDefaultEmoji, - customStickerPanel: - widget.customStickerPanel, - morePanelConfig: - widget.morePanelConfig, - scrollController: autoController, - conversationID: _getConvID(), - conversationType: _getConvType(), - hintText: '用心聊天更容易获得回复哦~', - showMorePanel: widget.config - ?.isAllowShowMorePanel ?? - true, - showSendAudio: widget.config - ?.isAllowSoundMessage ?? - true, - showSendEmoji: widget - .config?.isAllowEmojiPanel ?? - true, - )); - }, - selector: (c, model) { - return model.isMultiSelect; - }, - ) - ], - ), - if (_dragging) - TIMUIKitSendFile( - conversation: widget.conversation, - ), - AtMemberPanel( - atMemberPanelScroll: atMemberPanelScroll, - onSelectMember: (member) => inputTextFieldState - .currentState - ?.handleAtMember(memberInfo: member), - ) - ], - ), - )), - )); - }); - } - - loadUserData() async { - String url = - "${Api.getUserInfoTA + widget.conversation.userID!.split('_').last}/home"; - var data = await DioManager.instance.get(url: url); - var bean = BaseResponse.fromJson( - data, (data) => ResponseBean.fromJson(data)); - - if (bean.isSuccess()) { - isLike = bean.data.isFollow; - otherUserBean = bean.data.user; - loadBlackStatus(); - setState(() {}); - } - } - - Widget titleWidget(int msgCount) { - return otherUserBean == null - ? Container() - : GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.UserInfoActivity, - arguments: otherUserBean!.id!.toString()); - }, - child: Container( - margin: EdgeInsets.only(left: msgCount > 0 ? 40.sp : 0), - child: Row( - children: [ - ClipOval( - child: Image.network( - otherUserBean!.avatar!, - width: 40.sp, - height: 40.sp, - fit: BoxFit.cover, - )), - SizedBox( - width: 4.sp, - ), - Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(otherUserBean!.nickname ?? '昵称待审核', - style: TextStyle( - color: Colors.white, - // fontSize: - // ((otherUserBean!.onlineFlag ?? '').isNotEmpty) - // ? 14.sp - // : 16.sp), - )), - if ((otherUserBean!.onlineFlag ?? '').isNotEmpty) - Text( - otherUserBean!.onlineFlag ?? '', - style: TextStyle( - color: Colors.white.withOpacity(0.75), - fontSize: 12.sp), - ), - ], - - - ), - if (!isLike) - GestureDetector( - onTap: () async { - if (isBlack) { - - _showReportDialog(context); - return; - } - - if (!isLike) { - var data = await DioManager.instance.post( - url: "${Api.setLike + otherUserBean!.id!.toString()}/follow", - params: {'status': isLike ? "0" : "1"}); - var bean = BaseResponse.fromJson( - data, - (jsonData) => jsonData, - ); - if (bean.isSuccess()) { - - isLike = !isLike; - setState(() { - - }); - } - } else { - // addFollowHeader(); - } - }, - child: Container( - margin: EdgeInsets.only( - left: 5.sp, - ), - padding: EdgeInsets.only(left: 4.sp, right: 4.sp), - height: 22.sp, - decoration: BoxDecoration( - gradient: AppColor.mainHorLinearGradient, - borderRadius: BorderRadius.circular(14), - ), - child: Center( - child: Text( - '喜欢', - style: TextStyle( - fontSize: 12.sp, color: Colors.white)), - ), - )), - ], - ), - ), - ); - } - - void _showReportDialog(BuildContext context) { - showDialog( - context: context, - builder: (BuildContext context) { - return Dialog( - backgroundColor: Colors.transparent, - child: Container( - height: 277.sp, - padding: const EdgeInsets.all(1.0), - child: Stack( - children: [ - Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: const LinearGradient( - colors: [Color(0xFFDD3DF4), Color(0xFF30FFD9)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Container( - margin: EdgeInsets.all(1.sp), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: const LinearGradient( - colors: [Color(0xFF4C3E5F), Color(0xFF324140)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Container( - margin: EdgeInsets.only(top: 24.sp), - child: Column( - children: [ - Center( - child: Text( - "是否解除拉黑", - style: - TextStyle(color: Colors.white, fontSize: 16.sp), - ), - ), - Container( - margin: EdgeInsets.only(top: 14.sp), - alignment: Alignment.center, - child: Image( - image: AssetImage(getMineImage("icon_dialog_black")), - width: 70.sp, - height: 70.sp, - ), - ), - Container( - margin: EdgeInsets.only( - top: 12.sp, left: 14.sp, right: 14.sp), - alignment: Alignment.center, - child: Text( - "解除拉黑后,你将不屏蔽对方的任何信息", - textAlign: TextAlign.center, - style: TextStyle( - color: const Color(0xCCF7FAFA), fontSize: 16.sp), - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - onTap: () { - Navigator.pop(context); - }, - child: Container( - margin: EdgeInsets.only(top: 24.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color(0x26FFFFFF), - Color(0x26FFFFFF), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 10.sp, - bottom: 10.sp, - left: 52.sp, - right: 52.sp), - child: const Text( - "否", - style: TextStyle( - color: Colors.white, - fontSize: 12, - ), - ), - ), - ), - SizedBox(width: 24.sp), - GestureDetector( - onTap: () async { - Get.back(); - var data = await DioManager.instance.post( - url: '${Api.setBlock + otherUserBean!.id.toString()}/block', params: {'status': '0'}); - var bean = BaseResponse.fromJson( - data, - (jsonData) => jsonData, - ); - if (bean.isSuccess()) { - isBlack = false; - } - showOKToast(bean.msg); - }, - child: Container( - margin: EdgeInsets.only(top: 24.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 10.sp, - bottom: 10.sp, - left: 52.sp, - right: 52.sp), - child: const Text( - "是", - style: TextStyle( - color: Colors.white, - fontSize: 12, - ), - ), - ), - ) - ], - ) - ], - ), - ) - ], - ), - ), - ); - }, - ); - } -} - -class TIMUIKitChatProviderScope extends StatelessWidget { - final TUIChatGlobalModel globalModel = serviceLocator(); - TUIChatSeparateViewModel? model; - final TUIGroupListenerModel groupListenerModel = - serviceLocator(); - final TUIThemeViewModel themeViewModel = serviceLocator(); - final Widget? child; - - /// You could get the model from here, and transfer it to other widget from TUIKit. - final Widget Function(BuildContext, TUIChatSeparateViewModel, Widget?) - builder; - final List? providers; - - /// `TIMUIKitChatController` needs to be provided if you use it outside. - final TIMUIKitChatController? controller; - - /// The global config for TIMUIKitChat. - final TIMUIKitChatConfig? config; - - /// Conversation id, use for get history message list. - final String conversationID; - - final String? groupID; - - /// Conversation type - final ConvType conversationType; - - /// The life cycle for chat business logic. - final ChatLifeCycle? lifeCycle; - - /// The controller for text field. - final TIMUIKitInputTextFieldController? textFieldController; - - final bool? isBuild; - - TIMUIKitChatProviderScope( - {Key? key, - this.child, - this.providers, - this.textFieldController, - required this.builder, - this.model, - this.groupID, - this.isBuild, - required this.conversationID, - required this.conversationType, - this.controller, - this.config, - this.lifeCycle}) - : super(key: key) { - if (isBuild ?? false) { - return; - } - model ??= TUIChatSeparateViewModel(); - controller?.model = model; - if (config != null) { - model?.chatConfig = config!; - } - model?.lifeCycle = lifeCycle; - model?.initForEachConversation( - conversationType, - conversationID, - (String value) { - textFieldController?.textEditingController?.text = value; - }, - groupID: groupID, - ); - model?.showC2cMessageEditStatus = (conversationType == ConvType.c2c - ? config?.showC2cMessageEditStatus ?? true - : false); - loadData(); - } - - loadData() { - // if (model!.haveMoreData) { - model!.loadChatRecord( - count: kIsWeb ? 15 : HistoryMessageDartConstant.getCount); - // } - } - - @override - Widget build(BuildContext context) { - return MultiProvider( - providers: [ - ChangeNotifierProvider.value(value: model), - ChangeNotifierProvider.value(value: globalModel), - ChangeNotifierProvider.value(value: themeViewModel), - ChangeNotifierProvider.value(value: groupListenerModel), - Provider(create: (_) => const TIMUIKitChatConfig()), - ...?providers - ], - child: child, - builder: (context, w) => builder(context, model!, w), - ); - } -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/tim_uikit_chat_config.dart b/circle_app/lib/app/chat/TIMUIKitChat/tim_uikit_chat_config.dart deleted file mode 100644 index 7096a47..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/tim_uikit_chat_config.dart +++ /dev/null @@ -1,223 +0,0 @@ -import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_chat_global_model.dart'; -import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; - -import 'TIMUIKitTextField/tim_uikit_text_field_layout/wide.dart'; - -enum GroupReceptAllowType { work, public, meeting } - -enum GroupReceiptAllowType { work, public, meeting } - -enum UrlPreviewType { none, onlyHyperlink, previewCardAndHyperlink } - -class TimeDividerConfig { - /// Defines the interval of adding a time divider among the two messages. - /// [Unit]: second. - /// [Default]: 300. - final int? timeInterval; - - /// Defines the parser of a specific timestamp, - /// transform it into a semantic time description. - final String Function(int timeStamp)? timestampParser; - - TimeDividerConfig({this.timeInterval, this.timestampParser}); -} - -class TIMUIKitChatConfig { - /// Customize the time divider among the two messages. - final TimeDividerConfig? timeDividerConfig; - - /// control if allowed to show reading status. - /// [Default]: true. - final bool isShowReadingStatus; - - /// Control if allowed to show reading status for group. - /// [Default]: true. - final bool isShowGroupReadingStatus; - - /// Control if allowed to report reading status for group. - /// [Default]: true. - final bool isReportGroupReadingStatus; - - /// Control if allowed to show the message operation menu after long pressing message. - /// [Default]: true. - final bool isAllowLongPressMessage; - - /// Control if allowed to callback after clicking the avatar. - /// [Default]: true. - final bool isAllowClickAvatar; - - /// Control if allowed to show emoji face message panel. - /// [Default]: true. - final bool isAllowEmojiPanel; - - /// Control if allowed to show more plus panel. - /// [Default]: true. - final bool isAllowShowMorePanel; - - /// Control if allowed to send voice sound message. - /// [Default]: true. - final bool isAllowSoundMessage; - - /// Control if allowed to at when reply automatically. - /// [Default]: true. - final bool isAtWhenReply; - - /// The main switch of the group read receipt. - final bool isShowGroupMessageReadReceipt; - - /// [Deprecated: ] Please use [groupReadReceiptPermissionList] instead. - final List? groupReadReceiptPermisionList; - - /// Control which group can send message read receipt. - final List? groupReadReceiptPermissionList; - - /// Control if show self name in group chat. - /// [Default]: false. - final bool isShowSelfNameInGroup; - - /// Control if others name in group chat. - /// [Default]: true. - final bool isShowOthersNameInGroup; - - /// Configuration for offline push. - /// If this field is specified, `notificationTitle`, `notificationOPPOChannelID`, `notificationIOSSound`, `notificationAndroidSound`, `notificationBody` and `notificationExt` will not work. - final OfflinePushInfo? Function( - V2TimMessage message, String convID, ConvType convType)? offlinePushInfo; - - /// The title shows in push notification - final String notificationTitle; - - /// The channel ID for OPPO in push notification. - final String notificationOPPOChannelID; - - /// The notification sound in iOS devices. - /// When `iOSSound` = `kIOSOfflinePushNoSound`, the sound will not play when message received. When `iOSSound` = `kIOSOfflinePushDefaultSound`, the system sound is played when message received. If you want to customize `iOSSound`, you need to link the voice file into the Xcode project, and then set the voice file name (with a suffix) to iOSSound. - final String notificationIOSSound; - - /// The notification sound in Android devices. - final String notificationAndroidSound; - - ///Used to set the line height of text messages - final double textHeight; - - /// The body content shows in push notification. - /// Returning `null` means using default body in this case. - final String? Function( - V2TimMessage message, String convID, ConvType convType)? notificationBody; - - /// External information (String) for notification message, recommend used for jumping to target conversation with JSON format, - /// Returning `null` means using default ext in this case. - final String? Function( - V2TimMessage message, String convID, ConvType convType)? notificationExt; - - /// The type of URL preview level, none preview, only hyperlink in text, or shows a preview card for website. - /// [Default]: UrlPreviewType.previewCardAndHyperlink. - final UrlPreviewType urlPreviewType; - - /// Whether to display the sending status of c2c messages - /// [Default]: true. - final bool showC2cMessageEditStatus; - - /// Control if take emoji stickers as message reaction. - /// [Default]: true. - final bool isUseMessageReaction; - - /// Determine how long a message is allowed to be recalled after it is sent. - /// You must modify the configuration on control dashboard synchronized at: https://console.cloud.tencent.com/im/login-message. - /// [Unit]: second. - /// [Default]: 120. - final int upperRecallTime; - - /// The prefix of face sticker URI. - final String Function(String data)? faceURIPrefix; - - /// The suffix of face sticker URI. - final String Function(String data)? faceURISuffix; - - /// Controls whether text and replied messages can be displayed with Markdown formatting. - /// When enabled, small image stickers, including QQ stickers, will not work in message items. - /// Also, when enabled, `isEnableTextSelection` will not works. - /// [Default]: false. - final bool isSupportMarkdownForTextMessage; - - /// The callback after user clicking the URL link in text messages. - /// The default action is opening the link with the default browser of system. - final void Function(String url)? onTapLink; - - /// Whether to use the default emoji - final bool isUseDefaultEmoji; - - /// Is show avatar on history message list. - /// [Default]: true. - final bool isShowAvatar; - - /// This list contains additional operation items that are displayed on the hover bar - /// of a message on desktop (macOS, Windows, and desktop version of Web). These items - /// are in addition to the default ones and do not affect them. - final List? additionalDesktopMessageHoverBarItem; - - /// This list contains additional items that are displayed - /// on the control bar on desktop (macOS, Windows, and desktop version of Web). - /// Use `desktopControlBarConfig` to configure whether or not to show the default control items. - final List? additionalDesktopControlBarItems; - - /// This configuration is used for the control bar - /// on desktop (macOS, Windows, and desktop version of Web). - /// Use `desktopControlBarConfig` to add additional items to the desktop control bar, in addition to the default ones. - final DesktopControlBarConfig? desktopControlBarConfig; - - /// Controls whether users are allowed to mention another user in the group by long-pressing on their avatar. - /// [Default]: true. - final bool isAllowLongPressAvatarToAt; - - /// Controls whether auto report message read status when new messages come. - /// [Default]: true. - final bool isAutoReportRead; - - /// Controls whether enable text selection. - /// [Default]: true on Desktop while false on Mobile. - final bool? isEnableTextSelection; - - const TIMUIKitChatConfig( - {this.onTapLink, - this.timeDividerConfig, - this.isAutoReportRead = true, - this.faceURIPrefix, - this.faceURISuffix, - this.textHeight = 1.3, - this.isAtWhenReply = true, - this.notificationAndroidSound = "", - this.isSupportMarkdownForTextMessage = false, - this.notificationExt, - this.isUseMessageReaction = true, - this.isShowAvatar = true, - this.isShowSelfNameInGroup = false, - this.offlinePushInfo, - @Deprecated("Please use [isShowGroupReadingStatus] instead") - this.isShowGroupMessageReadReceipt = true, - this.upperRecallTime = 120, - this.isShowOthersNameInGroup = true, - this.urlPreviewType = UrlPreviewType.onlyHyperlink, - this.notificationBody, - this.notificationOPPOChannelID = "", - this.notificationTitle = "", - this.notificationIOSSound = "", - this.isAllowSoundMessage = true, - @Deprecated("Please use [groupReadReceiptPermissionList] instead") - this.groupReadReceiptPermisionList, - this.groupReadReceiptPermissionList, - this.isAllowEmojiPanel = true, - this.isAllowShowMorePanel = true, - this.isShowReadingStatus = true, - this.desktopControlBarConfig, - this.isAllowLongPressMessage = true, - this.isAllowClickAvatar = true, - this.isEnableTextSelection, - this.additionalDesktopMessageHoverBarItem, - this.isShowGroupReadingStatus = true, - this.isReportGroupReadingStatus = true, - this.showC2cMessageEditStatus = true, - this.additionalDesktopControlBarItems, - this.isAllowLongPressAvatarToAt = true, - this.isUseDefaultEmoji = false}); -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/tim_uikit_cloud_custom_data.dart b/circle_app/lib/app/chat/TIMUIKitChat/tim_uikit_cloud_custom_data.dart deleted file mode 100644 index b21315e..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/tim_uikit_cloud_custom_data.dart +++ /dev/null @@ -1,32 +0,0 @@ -class MessageRepliedData { - late String messageAbstract; - late String messageSender; - late String messageID; - - MessageRepliedData.fromJson(Map messageReply) { - messageAbstract = messageReply["messageAbstract"]; - messageSender = messageReply["messageSender"] ?? ""; - messageID = messageReply["messageID"]; - } -} - -class CloudCustomData { - Map? messageReply; - Map? messageReaction = {}; - - CloudCustomData.fromJson(Map jsonMap) { - messageReply = jsonMap["messageReply"]; - messageReaction = jsonMap["messageReaction"] ?? {}; - } - - Map toMap() { - final Map data = {}; - if (messageReply != null) { - data['messageReply'] = messageReply; - } - data['messageReaction'] = messageReaction ?? {}; - return data; - } - - CloudCustomData(); -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/tim_uikit_multi_select_panel.dart b/circle_app/lib/app/chat/TIMUIKitChat/tim_uikit_multi_select_panel.dart deleted file mode 100644 index 93f2be6..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/tim_uikit_multi_select_panel.dart +++ /dev/null @@ -1,252 +0,0 @@ -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_statelesswidget.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/separate_models/tui_chat_separate_view_model.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_chat_global_model.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/core/tim_uikit_wide_modal_operation_key.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/screen_utils.dart'; - -import 'package:tencent_cloud_chat_uikit/ui/widgets/forward_message_screen.dart'; -import 'package:tencent_cloud_chat_uikit/ui/widgets/wide_popup.dart'; -import 'package:tencent_im_base/tencent_im_base.dart'; - -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart'; - -class MultiSelectPanel extends TIMUIKitStatelessWidget { - final ConvType conversationType; - - MultiSelectPanel({Key? key, required this.conversationType}) - : super(key: key); - - _handleForwardMessage(BuildContext context, bool isMergerForward, - TUIChatSeparateViewModel model) { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => ForwardMessageScreen( - model: model, - isMergerForward: isMergerForward, - conversationType: conversationType, - ))); - } - - _handleForwardMessageWide(BuildContext context, bool isMergerForward, - TUIChatSeparateViewModel model) { - TUIKitWidePopup.showPopupWindow( - operationKey: TUIKitWideModalOperationKey.forward, - context: context, - isDarkBackground: false, - title: TIM_t("转发"), - submitWidget: Text(TIM_t("发送")), - width: MediaQuery.of(context).size.width * 0.5, - height: MediaQuery.of(context).size.height * 0.8, - onSubmit: (){ - forwardMessageScreenKey.currentState?.handleForwardMessage(); - }, - child: (onClose) => Container( - padding: const EdgeInsets.symmetric( horizontal: 10), - child: ForwardMessageScreen( - model: model, - key: forwardMessageScreenKey, - onClose: onClose, - isMergerForward: isMergerForward, - conversationType: conversationType, - ), - ) - ); - } - - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - final TUITheme theme = value.theme; - final TUIChatSeparateViewModel model = - Provider.of(context); - - return TUIKitScreenUtils.getDeviceWidget( - desktopWidget: Container( - decoration: BoxDecoration( - color: theme.selectPanelBgColor ?? theme.primaryColor, - border: Border( - top: BorderSide( - color: theme.weakDividerColor ?? Colors.grey, - width: 1.0, - ), - ), - ), - padding: const EdgeInsets.symmetric(vertical: 32), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded( - child: Wrap( - crossAxisAlignment: WrapCrossAlignment.center, - alignment: WrapAlignment.center, - spacing: 64, - children: [ - Column( - children: [ - IconButton( - icon: Image.asset('images/forward.png', - package: 'tencent_cloud_chat_uikit', - color: theme.selectPanelTextIconColor), - iconSize: 30, - onPressed: () { - _handleForwardMessageWide(context, false, model); - }, - ), - Text(TIM_t("逐条转发"), - style: TextStyle( - color: hexToColor("646a73"), fontSize: 12)) - ], - ), - Column( - children: [ - IconButton( - icon: Image.asset('images/merge_forward.png', - package: 'tencent_cloud_chat_uikit', - color: theme.selectPanelTextIconColor), - iconSize: 30, - onPressed: () { - _handleForwardMessageWide(context, true, model); - }, - ), - Text( - TIM_t("合并转发"), - style: - TextStyle(color: theme.selectPanelTextIconColor, fontSize: 12), - ) - ], - ), - Column( - children: [ - IconButton( - icon: Image.asset('images/delete.png', - package: 'tencent_cloud_chat_uikit', - color: theme.selectPanelTextIconColor), - iconSize: 30, - onPressed: () { - TUIKitWidePopup.showSecondaryConfirmDialog( - operationKey: TUIKitWideModalOperationKey.confirmDeleteMessages, - context: context, - text: TIM_t("确定删除已选消息"), - theme: theme, - onCancel: () {}, - onConfirm: () async { - model.deleteSelectedMsg(); - model.updateMultiSelectStatus(false); - }); - }, - ), - Text(TIM_t("删除"), - style: TextStyle( - color: theme.selectPanelTextIconColor, fontSize: 12)) - ], - ), - InkWell( - onTap: (){ - model.updateMultiSelectStatus(false); - }, - child: Icon(Icons.close, color: theme.darkTextColor,), - ) - ], - )) - ], - ), - ), - defaultWidget: Container( - decoration: BoxDecoration( - border: Border( - top: BorderSide( - color: theme.weakDividerColor ?? - CommonColor.weakDividerColor)), - color: theme.selectPanelBgColor ?? theme.primaryColor, - ), - padding: const EdgeInsets.only(top: 12, bottom: 48), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Column( - children: [ - IconButton( - icon: Image.asset('images/forward.png', - package: 'tencent_cloud_chat_uikit', color: theme.selectPanelTextIconColor), - iconSize: 40, - onPressed: () { - _handleForwardMessage(context, false, model); - }, - ), - Text(TIM_t("逐条转发"), - style: TextStyle(color: theme.selectPanelTextIconColor, fontSize: 12)) - ], - ), - Column( - children: [ - IconButton( - icon: Image.asset('images/merge_forward.png', - package: 'tencent_cloud_chat_uikit', color: theme.selectPanelTextIconColor), - iconSize: 40, - onPressed: () { - _handleForwardMessage(context, true, model); - }, - ), - Text( - TIM_t("合并转发"), - style: TextStyle(color: theme.selectPanelTextIconColor, fontSize: 12), - ) - ], - ), - Column( - children: [ - IconButton( - icon: Image.asset('images/delete.png', - package: 'tencent_cloud_chat_uikit', color: theme.selectPanelTextIconColor), - iconSize: 40, - onPressed: () { - showCupertinoModalPopup( - context: context, - builder: (BuildContext context) { - return CupertinoActionSheet( - title: Text(TIM_t("确定删除已选消息")), - cancelButton: CupertinoActionSheetAction( - onPressed: () { - Navigator.pop( - context, - "cancel", - ); - }, - child: Text(TIM_t("取消")), - isDefaultAction: false, - ), - actions: [ - CupertinoActionSheetAction( - onPressed: () { - model.deleteSelectedMsg(); - model.updateMultiSelectStatus(false); - Navigator.pop( - context, - "cancel", - ); - }, - child: Text( - TIM_t("删除"), - style: TextStyle(color: theme.cautionColor), - ), - isDefaultAction: false, - ) - ], - ); - }, - ); - }, - ), - Text(TIM_t("删除"), - style: TextStyle(color: theme.selectPanelTextIconColor, fontSize: 12)) - ], - ) - ], - ), - ), - ); - } -} diff --git a/circle_app/lib/app/chat/TIMUIKitChat/tim_uikit_send_file.dart b/circle_app/lib/app/chat/TIMUIKitChat/tim_uikit_send_file.dart deleted file mode 100644 index 60bcbb0..0000000 --- a/circle_app/lib/app/chat/TIMUIKitChat/tim_uikit_send_file.dart +++ /dev/null @@ -1,227 +0,0 @@ -import 'dart:io'; -import 'package:dotted_border/dotted_border.dart'; -import 'package:flutter/material.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_statelesswidget.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/separate_models/tui_chat_separate_view_model.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_chat_global_model.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/core/tim_uikit_wide_modal_operation_key.dart'; -import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; -import 'package:cross_file/cross_file.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/message.dart'; -import 'package:tencent_cloud_chat_uikit/ui/widgets/wide_popup.dart'; -import 'package:path/path.dart' as path; -import 'package:url_launcher/url_launcher.dart'; - -import 'TIMUIKitMessageItem/tim_uikit_chat_file_icon.dart'; - -String _getConvID(V2TimConversation conversation) { - return (conversation.type == 1 - ? conversation.userID - : conversation.groupID) ?? - ""; -} - -sendFileWithConfirmation( - {required List files, - required V2TimConversation conversation, - required ConvType conversationType, - required TUIChatSeparateViewModel model, - required TUITheme theme, - required BuildContext context}) async { - bool isCanSend = true; - - files.map((e) => e.path).any((filePath) { - final directory = Directory(filePath); - final isDirectoryExists = directory.existsSync(); - if (isDirectoryExists) { - isCanSend = false; - return false; - } - return true; - }); - - if (!isCanSend) { - TUIKitWidePopup.showSecondaryConfirmDialog( - text: TIM_t("无法发送,包含文件夹"), - onConfirm: () {}, - operationKey: TUIKitWideModalOperationKey.unableToSendDueToFolders, - context: context, - theme: theme); - return; - } - - final option1 = conversation.showName ?? - (conversationType == ConvType.group ? TIM_t("群聊") : TIM_t("对方")); - TUIKitWidePopup.showPopupWindow( - operationKey: TUIKitWideModalOperationKey.beforeSendScreenShot, - context: context, - isDarkBackground: false, - width: 600, - height: files.length < 4 ? 300 : 500, - title: TIM_t_para("发送给{{option1}}", "发送给$option1")(option1: option1), - child: (closeFunc) => Container( - padding: const EdgeInsets.only(bottom: 16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Scrollbar( - child: ListView.separated( - itemBuilder: (BuildContext context, int index) { - final file = files[index]; - return Material( - color: theme.wideBackgroundColor, - child: InkWell( - onTap: () { - launchUrl(Uri.file(file.path)); - }, - child: Padding( - padding: const EdgeInsets.symmetric( - vertical: 6, horizontal: 20), - child: Row( - children: [ - TIMUIKitFileIcon( - size: 44, - fileFormat: path - .extension(file.path) - .split(".")[path - .extension(file.path) - .split(".") - .length - - 1], - ), - const SizedBox(width: 16), - Expanded( - child: Text( - path.basename(file.path), - style: TextStyle( - fontSize: 16, - color: theme.darkTextColor), - ), - ), - ], - ), - ), - ), - ); - }, - separatorBuilder: (BuildContext context, int index) { - return Divider( - height: 1, - thickness: 1, - color: theme.weakDividerColor, - ); - }, - itemCount: files.length, - ), - ), - ), - Padding( - padding: const EdgeInsets.only(right: 16, top: 16), - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - mainAxisSize: MainAxisSize.max, - children: [ - OutlinedButton( - onPressed: () { - closeFunc(); - }, - child: Text(TIM_t("取消"))), - const SizedBox( - width: 20, - ), - ElevatedButton( - onPressed: () { - sendFiles(files, model, conversation, - conversationType, context); - closeFunc(); - }, - child: Text(TIM_t("发送"))) - ], - ), - ) - ], - ), - )); -} - -Future sendFiles( - List files, - TUIChatSeparateViewModel model, - V2TimConversation conversation, - ConvType conversationType, - BuildContext context) async { - for (final file in files) { - await MessageUtils.handleMessageError( - model.sendFileMessage( - filePath: file.path, - convID: _getConvID(conversation), - convType: conversationType), - context); - await Future.delayed(const Duration(microseconds: 300)); - } -} - -class TIMUIKitSendFile extends TIMUIKitStatelessWidget { - final V2TimConversation conversation; - - TIMUIKitSendFile({required this.conversation, Key? key}) : super(key: key); - - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - final theme = value.theme; - final conversationType = conversation.type; - final option1 = conversation.showName ?? - (conversationType == 2 ? TIM_t("群聊") : TIM_t("会话")); - - return Row( - mainAxisSize: MainAxisSize.max, - children: [ - Expanded( - child: Opacity( - opacity: 0.85, - child: Container( - color: theme.wideBackgroundColor, - padding: const EdgeInsets.all(40), - child: DottedBorder( - borderType: BorderType.RRect, - radius: const Radius.circular(20), - color: theme.primaryColor ?? theme.weakTextColor!, - dashPattern: const [6, 3], - child: Row( - children: [ - Expanded( - child: Column( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Icon( - Icons.file_copy_outlined, - size: 60, - color: theme.primaryColor, - ), - const SizedBox( - height: 40, - ), - Text( - TIM_t_para("发送给{{option1}}", "发送给$option1")( - option1: option1), - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w600, - color: theme.darkTextColor), - ) - ], - )) - ], - ), - ), - ), - )) - ], - ); - } -} diff --git a/circle_app/lib/app/chat/binding.dart b/circle_app/lib/app/chat/binding.dart deleted file mode 100644 index bd6f645..0000000 --- a/circle_app/lib/app/chat/binding.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:get/get.dart'; - -import 'logic.dart'; - -class ChatBinding extends Bindings { - @override - void dependencies() { - Get.lazyPut(() => ChatLogic()); - } -} diff --git a/circle_app/lib/app/chat/logic.dart b/circle_app/lib/app/chat/logic.dart deleted file mode 100644 index e82e3bf..0000000 --- a/circle_app/lib/app/chat/logic.dart +++ /dev/null @@ -1,39 +0,0 @@ -import 'package:circle_app/network/api.dart'; -import 'package:circle_app/network/dio_manager.dart'; -import 'package:get/get.dart'; -import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; - -import 'state.dart'; -import 'widget/send_gift_dialog.dart'; - -class ChatLogic extends GetxController { - - final ChatState state = ChatState(); - V2TimConversation? selectedConversation; - - @override - void onInit() { - // TODO: implement onInit - super.onInit(); - // loadIsShowSendGiftDialogData(); - selectedConversation = Get.arguments; - } - - - sendData() async { - var data = await DioManager.instance.get(url: Api.isShow_give_gift,params: {}); - } - - Future loadIsShowSendGiftDialogData() async { - var data = await DioManager.instance.get(url: Api.isShow_give_gift + selectedConversation!.conversationID!.split('_').last); - if (data['code'] == 200) { - if (data['data']) { - Get.bottomSheet(SendGiftDialog(accid: selectedConversation!.conversationID!,title: data['msg'],), isScrollControlled: true, - enableDrag: false); - return false; - } - } - return true; - } - -} diff --git a/circle_app/lib/app/chat/state.dart b/circle_app/lib/app/chat/state.dart deleted file mode 100644 index 211105c..0000000 --- a/circle_app/lib/app/chat/state.dart +++ /dev/null @@ -1,5 +0,0 @@ -class ChatState { - ChatState() { - ///Initialize variables - } -} diff --git a/circle_app/lib/app/chat/view.dart b/circle_app/lib/app/chat/view.dart deleted file mode 100644 index a28e989..0000000 --- a/circle_app/lib/app/chat/view.dart +++ /dev/null @@ -1,537 +0,0 @@ -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:circle_app/app/chat/TIMUIKitChat/tim_uikit_chat.dart'; -import 'package:circle_app/app/chat/widget/more_dialog.dart'; -import 'package:circle_app/app/chat/widget/send_gift_dialog.dart'; -import 'package:circle_app/app/minefragment/logic.dart'; -import 'package:circle_app/components/my_app_bar.dart'; -import 'package:circle_app/main.dart'; -import 'package:circle_app/network/api.dart'; -import 'package:circle_app/network/dio_manager.dart'; -import 'package:circle_app/router/app_routers.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:circle_app/view/notice.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_chat_global_model.dart'; -import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; -import 'package:tencent_cloud_chat_uikit/ui/controller/tim_uikit_chat_controller.dart'; - -import '../../common/colors/app_color.dart'; -import '../../util/SharedPreferencesHelper.dart'; -import '../../util/eventBus.dart'; -import '../home/logic.dart'; -import '../userinfo/logic.dart'; - -class ChatPage extends StatefulWidget { - ChatPage({Key? key}) : super(key: key); - - @override - State createState() => _ChatPageState(); -} - -class _ChatPageState extends State { - // final logic = Get.find(); - // - // final state = Get.find().state; - - bool isShowTip = false; - String tip = 'Ta主页形象质量不错哦,您也完善一下呗,点击前往'; - - @override - void dispose() { - // TODO: implement dispose - sub.cancel(); - sub1.cancel(); - super.dispose(); - } - - final TIMUIKitChatController _timuiKitChatController = - TIMUIKitChatController(); - V2TimConversation con = Get.arguments; - UserBean? userInfoBean; - UserBean? otherUserBean; - String conversationID = ''; - bool isBlack = false; - var sub; - var sub1; - @override - void initState() { - // TODO: implement initState - super.initState(); - initEventBus(); - loadMyInfo(); - } - - void loadIsShowSendGiftDialogData() async { - var data = await DioManager.instance - .get(url: Api.isShow_give_gift + conversationID.split('_').last); - - if (data['code'] == 200) { - if (data['data']) { - Get.bottomSheet( - SendGiftDialog( - accid: conversationID, - title: data['msg'], - ), - isScrollControlled: true, - enableDrag: false); - } - } - } - - loadUserData() async { - conversationID = con!.conversationID!; - String url = "${Api.getUserInfoTA + conversationID.split('_').last}/home"; - var data = await DioManager.instance.get(url: url); - var bean = BaseResponse.fromJson( - data, (data) => ResponseBean.fromJson(data)); - - if (bean.isSuccess()) { - otherUserBean = bean.data.user; - - if (!isShowTip) { - - fetchMyAlbum(Api.getMyAlbum); - } - setState(() {}); - } - - loadIsShowSendGiftDialogData(); - } - - Future fetchMyAlbum(String url) async { - var myAlbumData = await DioManager.instance.get(url: url); - var myAlbumBean = BaseResponse.fromJson( - myAlbumData, (myAlbumData) => AlbumResponseBean.fromJson(myAlbumData)); - - if (myAlbumBean.isSuccess()) { - List list = myAlbumBean.data.lists ?? []; - if (list.isEmpty) { - isShowTip = true; - tip = '您还没上传照片,上传后更方便了解,点击前往'; - } else { - if (otherUserBean!.userType == 1 && userInfoBean!.userType != 1) { - isShowTip = true; - } - } - if (isShowTip) { - //处理七天后是否显示X按钮 - SharedPreferencesHelper sp = await SharedPreferencesHelper.getInstance(); - String myUserId = sp.getMyUserId(); - List msgTipList = sp.getStringList(); - - int index = -1; - - msgTipList.forEach((element) { - if (element.startsWith(myUserId)) { - index = msgTipList.indexOf(element); - } - }); - - if (index >= 0) { - String tipStr = msgTipList[index].split('_').last; - // 获取当前时间戳 - DateTime now = DateTime.now(); - int currentTimestamp = int.parse(tipStr); - - // 计算七天后的时间戳 - DateTime sevenDaysLater = now.add(Duration(days: 7)); - int sevenDaysLaterTimestamp = sevenDaysLater.millisecondsSinceEpoch; - if (currentTimestamp < sevenDaysLaterTimestamp) { - isShowTip = false; - } - } - } - - setState(() { - - }); - } - - } - - - initEventBus() async { - sub = EventBusManager.on().listen((event) async { - V2TimValueCallback? sendMessageRes = - await _timuiKitChatController.sendMessage( - messageInfo: event.createCustomMessageRes?.data?.messageInfo); - if (sendMessageRes!.code == 0) { - // 发送成功 - if (sendMessageRes.data?.customElem?.extension != 'cardData') { - showOKToast('发送成功'); - } - // - sendMessageRes.data?.customElem?.data; //自定义data - sendMessageRes.data?.customElem?.desc; //自定义desc - sendMessageRes.data?.customElem?.extension; //自定义extension - } - }); - sub1 = EventBusManager.on().listen((event) async { - _timuiKitChatController.refreshCurrentHistoryList(); - }); - } - - Widget renderCustomStickerPanel( - {sendTextMessage, - sendFaceMessage, - deleteText, - addCustomEmojiText, - addText, - List defaultCustomEmojiStickerList = const [], - double? height, - double? width}) { - final defaultEmojiList = - defaultCustomEmojiStickerList.map((customEmojiPackage) { - return CustomStickerPackage( - name: customEmojiPackage.name, - baseUrl: "assets/custom_face_resource/${customEmojiPackage.name}", - isEmoji: customEmojiPackage.isEmoji, - isDefaultEmoji: true, - stickerList: customEmojiPackage.list - .asMap() - .keys - .map((idx) => - CustomSticker(index: idx, name: customEmojiPackage.list[idx])) - .toList(), - menuItem: CustomSticker( - index: 0, - name: customEmojiPackage.icon, - )); - }).toList(); - return StickerPanel( - // height: 100.sp, - backgroundColor: Colors.transparent, - showBottomContainer: true, - sendTextMsg: sendTextMessage, - sendFaceMsg: (index, data) => - sendFaceMessage(index + 1, (data.split("/")[3]).split("@")[0]), - deleteText: deleteText, - addText: addText, - addCustomEmojiText: addCustomEmojiText, - customStickerPackageList: [ - ...defaultEmojiList, - ]); - } - - @override - Widget build(BuildContext context) { - // - return Stack( - fit: StackFit.expand, - children: [ - TIMChat( - conversation: con, - customStickerPanel: renderCustomStickerPanel, - // onTapAvatar :(String userId,TapDownDetails tapDownDetails)async{ - // var data = await Get.toNamed(AppRoutes.UserInfoActivity,arguments: userId.toString().split('_').last,preventDuplicates: false); - // // setState(() { - // // - // // }); - // }, - controller: _timuiKitChatController, - config: TIMUIKitChatConfig( - // 仅供演示,非全部配置项,实际使用中,可只传和默认项不同的参数,无需传入所有开关 - isAllowClickAvatar: true, - isUseDefaultEmoji: true, - isAllowLongPressMessage: true, - isShowReadingStatus: true, - isShowGroupReadingStatus: true, - notificationTitle: "", - isUseMessageReaction: true, - notificationBody: - (V2TimMessage message, String convID, ConvType convType) { - // V2TIM_ELEM_TYPE_NONE = 0, ///< 未知消息 - // V2TIM_ELEM_TYPE_TEXT = 1, ///< 文本消息 - // V2TIM_ELEM_TYPE_CUSTOM = 2, ///< 自定义消息 - // V2TIM_ELEM_TYPE_IMAGE = 3, ///< 图片消息 - // V2TIM_ELEM_TYPE_SOUND = 4, ///< 语音消息 - // V2TIM_ELEM_TYPE_VIDEO = 5, ///< 视频消息 - // V2TIM_ELEM_TYPE_FILE = 6, ///< 文件消息 - // V2TIM_ELEM_TYPE_LOCATION = 7, ///< 地理位置消息 - // V2TIM_ELEM_TYPE_FACE = 8, ///< 表情消息 - // V2TIM_ELEM_TYPE_GROUP_TIPS = 9, ///< 群 Tips 消息 - // V2TIM_ELEM_TYPE_MERGER = 10, ///< 合并消息 - - if (userInfoBean == null) { - loadMyInfo(); - } - - if (message.elemType == 1) { - return ((userInfoBean!.nickname ?? '昵称待审核').isNotEmpty - ? (userInfoBean!.nickname ?? '昵称待审核') + ':' - : '') + - message.textElem!.text! ?? - ''; - } else if (message.elemType == 3) { - return ((userInfoBean!.nickname ?? '昵称待审核').isNotEmpty - ? (userInfoBean!.nickname ?? '昵称待审核') + ':' - : '') + - '发了一张图片'; - } else if (message.elemType == 4) { - return ((userInfoBean!.nickname ?? '昵称待审核').isNotEmpty - ? (userInfoBean!.nickname ?? '昵称待审核') + ':' - : '') + - '发了一条语音'; - } else if (message.elemType == 5) { - return ((userInfoBean!.nickname ?? '昵称待审核').isNotEmpty - ? (userInfoBean!.nickname ?? '昵称待审核') + ':' - : '') + - '发了一条视频'; - } else { - return ((userInfoBean!.nickname ?? '昵称待审核').isNotEmpty - ? (userInfoBean!.nickname ?? '昵称待审核') + ':' - : '') + - '发了一条消息'; - } - }, - groupReadReceiptPermissionList: [ - GroupReceiptAllowType.work, - GroupReceiptAllowType.meeting, - GroupReceiptAllowType.public - ], - ), - customAppBar: MyAppBar( - centerTitle: '', - actionWdiget: GestureDetector( - onTap: () { - Get.bottomSheet( - MoreDialog( - sessionId: conversationID, - userId: (otherUserBean?.id ?? 0) > 0 - ? otherUserBean!.id!.toString() - : '', - deleteMsgCallBack: () { - // context.read().clearMsg(); - // ChatViewModel viewModel = context.read(); - // viewModel.messageList.clear(); - // viewModel.notifyListeners(); - }, - blackCallBack: () { - loadUserData(); - }, - ), - isScrollControlled: true); - // defaultAvatarTap(widget.sessionId, isSelf:false); - }, - child: Image.asset( - getMsgImage('msg_more'), - width: 24.sp, - )), - onPressed: () {}, - ), - - userAvatarBuilder: (BuildContext context, V2TimMessage message) { - return avatarWidget( - (message.faceUrl?.isNotEmpty ?? false) - ? message.faceUrl! - : 'https://qiniuyun.leyuan666.com/quanzi/avatar/default.png', - message!); - }, - ), - if (isShowTip) - Positioned(child: tipWidget(tip)), - ], - ); - } - - tipWidget(String tip) { - return Column( - children: [ - GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.UserInfoActivity)!.then((value) { - loadMyInfo(); - }); - }, - child: Container( - width: Get.width - 16, - height: 40.sp, - margin: EdgeInsets.only(top:MediaQuery.of(context).padding.top + 45), - padding: EdgeInsets.fromLTRB(16.sp, 0.sp, 16.sp, 0.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: Color(0xFF353443), - ), - child: Row( - children: [ - Expanded( - child: Text( - tip, - style: TextStyle( - color: Colors.white, - fontSize: 13.sp, - ), - maxLines: 1, - overflow: TextOverflow.ellipsis, - )), - GestureDetector( - onTap: () async { - isShowTip = false; - HomeLogic homeLogic = Get.find(); - homeLogic.showMsgTipCount++; - if (homeLogic.showMsgTipCount >= 3) { - SharedPreferencesHelper sp = await SharedPreferencesHelper.getInstance(); - // 获取当前时间戳 - DateTime now = DateTime.now(); - int currentTimestamp = now.millisecondsSinceEpoch; - String userId = sp.getMyUserId(); - List msgTipList = sp.getStringList(); - - int index = -1; - msgTipList.forEach((element) { - if (element.startsWith(userId)) { - index = msgTipList.indexOf(element); - } - }); - - if (index >= 0) { - msgTipList.remove(index); - } - msgTipList.add('${userId}_${currentTimestamp}'); - - sp.setStringList(msgTipList); - } - setState(() { - - }); - }, - child: Icon( - Icons.close, - size: 20, - color: AppColor.mainColor, - ), - ) - ], - ), - ), - ), - ], - ); - } - - avatarWidget(String url, V2TimMessage message, {double width = 34}) { - print(url); - return GestureDetector( - onTap: () async { - // V2TimConversation con = Get.arguments; - // if (message.sender == con.userID.toString()) return; - var data = await Get.toNamed(AppRoutes.UserInfoActivity, - arguments: message.sender!.toString().split('_').last, - preventDuplicates: false); - }, - child: Stack( - alignment: Alignment.center, - children: [ - Image.asset( - getCircleImage('avatar_bg'), - width: width.sp, - ), - url.contains("http") - ? ClipOval( - child: CachedNetworkImage( - imageUrl: url, - width: (width - 2).sp, - height: (width - 2).sp, - fit: BoxFit.cover, - ), - ) - : Text( - url, - style: TextStyle(color: Color(0xffF756FF), fontSize: 12.sp), - ) - ], - )); - } - - void loadMyInfo() async { - var data = await DioManager.instance.get(url: Api.getUserMine); - var bean = BaseResponse.fromJson( - data, (data) => ResponseBean.fromJson(data)); - - if (bean.code == 200) { - userInfoBean = bean.data.user!; - loadUserData(); - } - } - - Widget titleWidget() { - return userInfoBean == null - ? Container() - : GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.UserInfoActivity, - arguments: userInfoBean!.id!.toString()); - }, - child: Container( - margin: EdgeInsets.only(left: 0 > 99 ? 80.sp : 65.sp), - child: Row( - children: [ - ClipOval( - child: Image.network( - otherUserBean!.avatar!, - width: 40.sp, - height: 40.sp, - fit: BoxFit.cover, - )), - SizedBox( - width: 4.sp, - ), - // Column( - // mainAxisAlignment: MainAxisAlignment.center, - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // Text( - // userInfoBean!.nickname ?? '昵称待审核', - // style: TextStyle( - // color: Colors.white, - // fontSize: - // ((otherUserBean!.onlineFlag ?? '').isNotEmpty) - // ? 14.sp - // : 16.sp), - // ), - // if ((otherUserBean!.onlineFlag ?? '').isNotEmpty) - // Text( - // otherUserBean!.onlineFlag ?? '', - // style: TextStyle( - // color: Colors.white.withOpacity(0.75), - // fontSize: 12.sp), - // ), - // ], - // ), - // if (otherUserBean!.! <= 1 )) - // GestureDetector( - // onTap: () { - // if (userInfoBean!.followStatus! <= 1) { - // setFollow(); - // } else { - // addFollowHeader(); - // } - // }, - // child: Container( - // margin: EdgeInsets.only( - // left: 5.sp, - // ), - // padding: EdgeInsets.only(left: 4.sp, right: 4.sp), - // height: 22.sp, - // decoration: BoxDecoration( - // gradient: AppColor.newMainVerLinearGradient, - // borderRadius: BorderRadius.circular(14), - // ), - // child: Center( - // child: Text( - // userInfoBean!.followStatus! <= 1 ? '关注' : '+特别关心', - // style: TextStyle( - // fontSize: 12.sp, color: Colors.white)), - // ), - // ), - // ), - ], - ), - ), - ); - } -} - -class ChatLoadUserInfoData {} diff --git a/circle_app/lib/app/chat/widget/chat_circle_share_dialog.dart b/circle_app/lib/app/chat/widget/chat_circle_share_dialog.dart deleted file mode 100644 index 9243c1f..0000000 --- a/circle_app/lib/app/chat/widget/chat_circle_share_dialog.dart +++ /dev/null @@ -1,223 +0,0 @@ -import 'dart:convert'; - -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; - -import '../../../network/api.dart'; -import '../../../network/dio_manager.dart'; -import '../../../util/util.dart'; -import '../../circle/logic.dart'; - -class ChatCircleShareDialog extends StatefulWidget { - String accId; - ChatCircleShareDialog({super.key,required this.accId}); - - - @override - _ChatCircleShareDialogState createState() => - new _ChatCircleShareDialogState(); - -} - -class _ChatCircleShareDialogState extends State { - // TODO: add state variables and methods - - int page = 1; - bool isMore = true; - InterestsBean circle = InterestsBean(lists: []); - ScrollController scrollController = ScrollController(); - - @override - void dispose() { - // TODO: implement dispose - super.dispose(); - scrollController.dispose(); - } - - @override - void initState() { - // TODO: implement initState - super.initState(); - scrollController.addListener(() { - if (scrollController.position.pixels == - scrollController.position.maxScrollExtent) { - if (isMore) { - page = page + 1; - loadData(); - } - } - }); - loadData(); - } - - - - loadData() async { - var data = await DioManager.instance - .get(url: Api.getMyCircleInterests, params: {"page": page,'page_size':20}); - - var bean = BaseResponse.fromJson( - data, (data) => InterestsBean.fromJson(data)); - - circle = bean.data!; - if (circle.lists.length < 20) { - isMore = false; - } - setState(() { - - }); - } - - - @override - Widget build(BuildContext context) { - // TODO: add widget build method - return GestureDetector( - onTap: () { - Get.back(); - }, - child: Scaffold( - backgroundColor: Colors.transparent, - body: Column( - children: [ - Expanded(child: Container()), - - Container( - height:Get.height * 0.5, - color: Color(0xFF423055), - child: circle.lists.isEmpty - ? !isMore - ? noResultWidget() - : loaddingWidget(isMore) - : ListView.builder( - controller: scrollController, - itemBuilder: (context, index) { - if (index == circle.lists.length) { - return loaddingWidget(isMore); - } - var bean = circle.lists[index]; - - return circleInfoItemWidget( - circle.lists[index],index); - }, - itemCount: circle.lists.length + 1, - ), - ) - ], - ), - - ), - ); - } - - - circleInfoItemWidget(Circle bean,int index) { - - return Container( - margin: EdgeInsets.only(top: 10.sp, left: 10.sp, right: 10.sp), - child: Column( - children: [ - if (index == 0) - Container( - height: 28.sp, - margin: EdgeInsets.only(bottom: 10.sp), - alignment: Alignment.center, - child: Text('我的圈子',style: TextStyle(color: Colors.white,fontSize: 17.sp),), - ), - - ClipRRect( - borderRadius: BorderRadius.circular(10.sp), - child: Container( - padding: EdgeInsets.only(left: 12.sp, right: 12.sp), - height: 72.sp, - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.fill, - image: AssetImage(getCircleImage('top_circle_bg')))), - child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - width: 42.sp, - height: 42.sp, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8.0), - gradient: const LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [ - Color(0xFF71F3F2), - Color(0xFFF558FF), - ], - stops: [0.0365, 0.9427], - ), - ), - padding: EdgeInsets.all(1.sp), - child: ClipRRect( - borderRadius: BorderRadius.circular(8.0), - child: CachedNetworkImage( - imageUrl: bean.image, - width: 40.sp, - height: 40.sp, - - fit: BoxFit.cover), - ), - ), - Expanded( - child: Container( - padding: EdgeInsets.only(left: 8.sp, top: 12.sp), - // alignment: Alignment., - height: 72.sp, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - bean.title, - style: TextStyle( - color: Colors.white, - fontSize: 18.sp, - fontWeight: FontWeight.w600), - ), - SizedBox( - height: 4.sp, - ), - Text( - '${convertToTenThousand(bean.viewTotal)}人看过', - textAlign: TextAlign.left, - style: TextStyle( - color: const Color(0xff03FEFB), - fontSize: 12.sp, - ), - ), - ], - ), - )), - GestureDetector( - //分享圈子 - onTap: () async { - sendCircleCustomMsg(widget.accId, jsonEncode(bean.toJson()), '分享[${bean.title}]'); - }, - child: Stack( - alignment: Alignment.center, - children: [ - Image.asset( - getCircleImage('add'), - width: 77.sp, - ), - Text( - '立即分享', - style: TextStyle( - color: Colors.white, fontSize: 12.sp), - ) - ], - )) - ], - ), - )), - ], - ), - ); - } -} diff --git a/circle_app/lib/app/chat/widget/chat_gift_pannel.dart b/circle_app/lib/app/chat/widget/chat_gift_pannel.dart deleted file mode 100644 index fd9ae9c..0000000 --- a/circle_app/lib/app/chat/widget/chat_gift_pannel.dart +++ /dev/null @@ -1,195 +0,0 @@ -import 'package:circle_app/util/eventBus.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:circle_app/common/colors/app_color.dart'; -import 'package:circle_app/router/app_routers.dart'; -import 'package:circle_app/util/util.dart'; - -import '../../../common/Widgets/base_tip_widget.dart'; -import 'gift.dart'; -import 'partner_option.dart'; - -class ChatGiftPannel extends StatefulWidget { - String accid; - String giftId; - int selectedIndex; - bool isShowVip; - ChatGiftPannel({Key? key,required this.accid,this.selectedIndex = 0, this.giftId = '',this.isShowVip = true}) : super(key: key); - - @override - State createState() => _ChatGiftPannelState(); -} - -class _ChatGiftPannelState extends State - with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin { - late TabController tabController; - - - @override - // TODO: implement wantKeepAlive - bool get wantKeepAlive => true; - - void initState() { - // TODO: implement initState - tabController = TabController( - length:widget.isShowVip ? 2 : 1, - vsync: this, - initialIndex: widget.selectedIndex - ); - tabController.addListener(() { - setState(() { - - }); - }); - super.initState(); - // getPropMall(); - // getAsset(); - } - - - - @override - Widget build(BuildContext context) { - // TODO: implement build - return GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - Get.back(); - }, - child:Scaffold( - backgroundColor: Colors.transparent, - body: Container( - width: Get.width, - height: Get.height, - child: Column( - children: [ - Expanded(child: Container()), - Container( - margin: EdgeInsets.only(bottom: 10.sp,right: 15.sp), - child: GestureDetector( - onTap: () { - showRechargeScreenDialog().then((value) { - EventBusManager.fire(RefreshAsset()); - }); - }, - child: Container( - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Image.asset(getMineImage('bi_icon4'),width: 30.sp,), - Text('首充大礼包',style: TextStyle(color: AppColor.mainColor,fontSize: 16.sp,fontWeight: FontWeight.bold),) - ], - ), - ), - ), - ), - Container( - child: SafeArea( - top: false, - bottom: false, - child: Container( - decoration: BoxDecoration( - color: Color(0xFF423055), - borderRadius: BorderRadius.only(topLeft: Radius.circular(16.sp,),topRight: Radius.circular(16.sp)) - ), - width: Get.width, - height: 370.sp, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox(height: 5.sp,), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - height: 30.sp, - width: widget.isShowVip ? 120.sp : 60.sp, - margin: EdgeInsets.only(left: 5.sp,), - child: TabBar( - isScrollable: false, - automaticIndicatorColorAdjustment: false, - labelPadding: EdgeInsets.symmetric(horizontal: 4.0.sp), - physics: NeverScrollableScrollPhysics(), - indicatorColor: widget.isShowVip ? AppColor.mainColor : Colors.transparent, - indicatorSize: TabBarIndicatorSize.label, - unselectedLabelStyle: TextStyle( - fontSize: 16.sp, - fontWeight: FontWeight.w500, - ), - unselectedLabelColor: Color(0xB3FFFFFF), - labelColor: AppColor.mainColor, - labelStyle: TextStyle( - fontSize: 16.sp, fontWeight: FontWeight.w500), - controller: tabController, - tabs: widget.isShowVip ? [ - Tab( - text: '礼物', - ), - Tab( - text: '会员', - ), - ] : [Tab( - text: '礼物', - )], - ), - ), - tabController.index == 0 && widget.isShowVip ? Container( - margin: EdgeInsets.only(right: 15.sp), - child: InkWell( - onTap: () { - String toUserId = widget.accid!.split('_').last; - Get.toNamed(AppRoutes.GiftShopPage,arguments: toUserId); - }, - child: Container( - height:22.sp, - width: 62.sp, - decoration: BoxDecoration( - gradient: AppColor.mainVerLinearGradient, - borderRadius: BorderRadius.circular(11.sp) - ), - child: Stack( - alignment: Alignment.center, - children: [ - Container( - height:20.sp, - width: 60.sp, - decoration: BoxDecoration( - color: Color(0xFF423055), - borderRadius: BorderRadius.circular(10.sp) - )), - Text('礼物墙',style: TextStyle(color: Colors.white,fontSize: 14.sp),) - ], - ), - )), - ) : Container() - ], - ), - Expanded( - child: TabBarView( - controller: tabController, - children: [ - Gift(widget.accid,widget.giftId), - if (widget.isShowVip) - PartnerOption(accid: widget.accid), - ], - )) - ], - ), - )), - ), - Container( - height: MediaQuery.of(context).padding.bottom, - decoration: BoxDecoration( - color: Color(0xFF423055),)) - ], - ), - ), - )); - } -} - - -class RefreshAsset { - -} \ No newline at end of file diff --git a/circle_app/lib/app/chat/widget/chat_msg_card_item.dart b/circle_app/lib/app/chat/widget/chat_msg_card_item.dart deleted file mode 100644 index 3a2846a..0000000 --- a/circle_app/lib/app/chat/widget/chat_msg_card_item.dart +++ /dev/null @@ -1,307 +0,0 @@ - -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; - -import '../../../common/colors/app_color.dart'; -import '../../../network/api.dart'; -import '../../../network/dio_manager.dart'; -import '../../../router/app_routers.dart'; -import '../../../util/util.dart'; -import '../../userinfo/logic.dart'; - -class ChatMsgCardItem extends StatefulWidget { - bool isSelf; - Map info; - String title; - String conversationID; - ChatMsgCardItem(this.isSelf,this.info,this.title,this.conversationID); - - @override - _ChatMsgCardItemState createState() => new _ChatMsgCardItemState(); - -} - -class _ChatMsgCardItemState extends State { - // TODO: add state variables and methods - bool isSelf = false; - Map info = {}; - String title = ''; - - int unLockWxNum = 1; - - @override - void initState() { - // TODO: implement initState - super.initState(); - isSelf = widget.isSelf; - info = widget.info; - title = widget.title; - loadUserData(); - } - - - void loadUserData() async { - var data = await DioManager.instance.get( - url: - "${Api.getUserInfoTA + widget.conversationID.split('_').last}/home"); - var bean = BaseResponse.fromJson( - data, (data) => ResponseBean.fromJson(data)); - - if (bean.isSuccess()) { - try { - UserBean userInfoBean = bean.data.user; - unLockWxNum = userInfoBean!.contact!.contains('*') ? 0 : 1; - setState(() {}); - } catch (e) { - - } - - } - } - - - @override - Widget build(BuildContext context) { - // TODO: add widget build method - return Column( - children: [ - Container( - // height: info.containsKey('city') ? 175.sp : 135.sp, - width: Get.width, - margin: EdgeInsets.only( - left: isSelf ? 16 : 0, right: isSelf ? 0 : 16), - padding: EdgeInsets.only(left: 12.sp, right: 12.sp), - // color: Colors.red, - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.fill, - image: AssetImage( - getCircleImage('pic_bg'), - ))), - - child: Column( - children: [ - if (title.isNotEmpty) - Container( - margin: EdgeInsets.only(top: 10.sp), - child: Row( - children: [ - Container( - margin: EdgeInsets.only(right: 5.sp), - width: 3.sp, - height: 3.sp, - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(1.5.sp), - color: Color(0xFF00FFF4)), - ), - Text( - title, - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - fontWeight: FontWeight.w500), - ) - ], - ), - ), - if (info.containsKey('city')) - info['city'].toString().isNotEmpty - ? Container( - margin: EdgeInsets.only(top: 10.sp), - child: Row( - children: [ - Container( - margin: EdgeInsets.only(right: 5.sp), - width: 3.sp, - height: 3.sp, - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(1.5.sp), - color: Color(0xFF00FFF4)), - ), - Text( - info['city'], - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - fontWeight: FontWeight.w500), - ) - ], - ), - ) - : Container(), - if (info.containsKey('both_interests')) - Container( - margin: EdgeInsets.only(top: 10.sp, right: 16.sp), - child: Row( - children: [ - Container( - margin: EdgeInsets.only(right: 5.sp), - width: 3, - height: 3, - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(1.5), - color: Color(0xFF00FFF4)), - ), - Expanded( - child: Container( - child: Text( - info['both_interests'], - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - fontWeight: FontWeight.w500, - ), - overflow: TextOverflow.ellipsis, - maxLines: 1, - ), - ), - ) - ], - ), - ), - Container( - margin: - EdgeInsets.only(top: 10.sp, bottom: 10.sp), - alignment: Alignment.centerLeft, - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.only(right: 5.sp,top: 10.sp), - width: 3, - height: 3, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(1.5), - color: Color(0xFF00FFF4)), - ), - Expanded(child: Text( - isSelf - ? '交友宣言:' + info['user']['signature'] - : '交友宣言:' + info['my']['signature'], - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - fontWeight: FontWeight.w500), - maxLines: 2, - overflow: TextOverflow.ellipsis, - )), - ])), - Image.asset( - getCircleImage('line'), - width: Get.width, - fit: BoxFit.fill, - ), - interestWdiget(isSelf - ? info['interests'] - : info['myInterests']) - ], - ), - ), - if (unLockWxNum == 1) - Container( - width: Get.width, - margin: EdgeInsets.only( - top: 10.sp, - left: isSelf ? 16 : 0, - right: isSelf ? 0 : 16), - // margin: EdgeInsets.only(top: 10.sp), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - '骂人、诈骗、造谣均属于严重违规行为,请严格遵守', - style: TextStyle( - color: Colors.white, - fontSize: 11.sp, - fontWeight: FontWeight.w600), - ), - SizedBox( - width: 2.sp, - ), - GestureDetector( - onTap: () { - navigateToCodeOfConduct(); - }, - child: Text( - '《文明公约》', - style: TextStyle( - color: Color(0xff00FFF4), - fontSize: 11.sp, - fontWeight: FontWeight.w400, - ), - ), - ), - ], - ), - ), - if (unLockWxNum == 0) - Container( - margin:EdgeInsets.only(top: 4.sp),child: Text('解锁联系方式是唯一合理方式,直接发送属于诈骗高危行为',style: TextStyle(color: AppColor.mainColor,fontSize: 12.sp),)) - - ], - ); - } - - - interestWdiget(List data) { - if (!data.isNotEmpty) return Container(height: 0,); - return Container( - alignment: Alignment.centerLeft, - height: 49.sp, - width: Get.width, - child: ListView.builder( - scrollDirection: Axis.horizontal, - itemCount: data.length, - padding: EdgeInsets.symmetric(vertical: 11.sp), - itemBuilder: (context, index) { - return GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.Signal_circle_list, - arguments: data[index]['id']); - }, - child: Container( - margin: EdgeInsets.only(right: 11.sp), // 替换为实际的 item 间距 - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17.0), // 设置圆角半径 - gradient: LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - ), - color: Color(0xFF392D53), - ), - child: Container( - margin: EdgeInsets.all(0.5.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17.0), - // shape: BoxShape.circle, - color: Color(0xFF392D53), - ), - child: Padding( - padding: EdgeInsets.only( - top: 2.sp, bottom: 2.sp, left: 15.sp, right: 15.sp), - child: Center( - child: Text( - data[index]['title'], - style: TextStyle( - fontSize: 11.0, - color: Colors.white, - ), - ), - ), - ), - ), - ), // 替换为实际的列表项小部件 - ), - ); - }, - ), - ); - } -} diff --git a/circle_app/lib/app/chat/widget/chat_msg_get_gift_item.dart b/circle_app/lib/app/chat/widget/chat_msg_get_gift_item.dart deleted file mode 100644 index f1fcfdf..0000000 --- a/circle_app/lib/app/chat/widget/chat_msg_get_gift_item.dart +++ /dev/null @@ -1,115 +0,0 @@ -import 'dart:convert'; - -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:circle_app/common/colors/app_color.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; - -import 'chat_gift_pannel.dart'; - -class ChatMsgGetGiftItem extends StatelessWidget { - V2TimMessage message; - // TODO: add state variables, methods and constructor params - ChatMsgGetGiftItem(this.message); - - @override - Widget build(BuildContext context) { - - Map giftData = jsonDecode(message.customElem!.data!); - double price = giftData['price']; - // "msg" -> "{\"giftImageUrl\":\"http://qiniuyun.ikuayou.com/live/gifts/2.png\",\"giftName\":\"舔狗楷模\",\"gmtNotice\":\"2023-0..." - // TODO: add widget build method - return GestureDetector( - onTap: () { - if (!(message.isSelf ?? false)) { - showGiftPannel(); - } - }, - child: Container( - width: 203.sp, - child: Column( - children: [ - Container( - height: 80.sp, - decoration: BoxDecoration( - gradient: AppColor.mainVerLinearGradient, - borderRadius: BorderRadius.circular(8.sp)), - child: Row( - children: [ - Container( - margin: EdgeInsets.only(left: 10.sp), - child: CachedNetworkImage( - imageUrl: giftData['icon'], - width: 60.sp, - height: 60.sp, - )), - Expanded( - child: Container( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - // color: Colors.red, - // alignment: Alignment.center, - child: Text( - '求您送我${giftData['name']}', - style: TextStyle( - color: Color(0xFFF7FAFA), fontSize: 14.sp), - overflow: TextOverflow.ellipsis, - ), - ), - SizedBox( - height: 8.sp, - ), - Container( - child: Text( - '价值${price.toInt()}小票', - style: TextStyle( - color: Color(0xFFF7FAFA), fontSize: 14.sp), - overflow: TextOverflow.ellipsis, - ), - ) - ], - ), - ), - ) - ], - ), - ), - message.isSelf! ? Container() : GestureDetector( - onTap: () { - showGiftPannel(); - }, - child: Container( - height: 30.sp, - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(6.sp), - gradient: const LinearGradient( - colors: [ - Color(0xFF9457FE), - Color(0xFFCF4CFF), - ], - ), - ), - child: Text('满足TA,让感情升升温',style: TextStyle(color: Colors.white),), - ), - ) - ], - ), - ), - ); - } - - showGiftPannel() { - Get.bottomSheet( - ChatGiftPannel( - accid: message.sender!.toString(), - ), - isScrollControlled: false, - enableDrag: false, - ); - } -} diff --git a/circle_app/lib/app/chat/widget/chat_msg_gift_item.dart b/circle_app/lib/app/chat/widget/chat_msg_gift_item.dart deleted file mode 100644 index 3892662..0000000 --- a/circle_app/lib/app/chat/widget/chat_msg_gift_item.dart +++ /dev/null @@ -1,90 +0,0 @@ -import 'dart:convert'; - -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:circle_app/app/chat/widget/chat_gift_pannel.dart'; - -class ChatMsgGiftItem extends StatelessWidget { - var message; - // TODO: add state variables, methods and constructor params - ChatMsgGiftItem(this.message); - - @override - Widget build(BuildContext context) { - - Map data = message.messageAttachment!.toMap(); - Map giftData = jsonDecode(data['data']['msg']); - bool isMe = message.sessionId == message.fromAccount; - // "msg" -> "{\"giftImageUrl\":\"http://qiniuyun.ikuayou.com/live/gifts/2.png\",\"giftName\":\"舔狗楷模\",\"gmtNotice\":\"2023-0..." - // TODO: add widget build method - return Container( - width: MediaQuery.of(context).size.width * 0.6, - color: Colors.black87, - child: Column( - children: [ - Container( - height: 80.sp, - decoration: BoxDecoration( - color: Color(0xFF292836), - borderRadius: BorderRadius.circular(8.sp) - ), - child: Row( - children: [ - Container(margin: EdgeInsets.only(left: 10.sp),child: CachedNetworkImage(imageUrl: giftData['giftImageUrl'],width: 60.sp,height: 60.sp,)), - Expanded( - child: Container( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - // color: Colors.red, - // alignment: Alignment.center, - child: Text((!isMe ? '送出' : '送你') + '${giftData['num']}个${giftData['giftName']}',style: TextStyle(color: Color(0xFFF7FAFA),fontSize: 14.sp),overflow: TextOverflow.ellipsis,), - ), - SizedBox(height: 8.sp,), - Container( - child: Text('价值${giftData['totalPrice']}小票',style: TextStyle(color: Color(0xFFF7FAFA),fontSize: 14.sp),overflow: TextOverflow.ellipsis,), - ) - ], - ), - ), - ) - ], - ), - ), - !isMe ? Container() : GestureDetector( - onTap: () { - showGiftPannel(); - }, - child: Container( - height: 30.sp, - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(6.sp), - gradient: const LinearGradient( - colors: [ - Color(0xFF9457FE), - Color(0xFFCF4CFF), - ], - ), - ), - child: Text('给TA回个礼,让感情升升温',style: TextStyle(color: Colors.white),), - ), - ) - ], - ), - ); - } - - - showGiftPannel() { - Get.bottomSheet( - ChatGiftPannel(accid:message.sessionId!.toString(),), - isScrollControlled: false, - enableDrag: false, - ); - } - -} diff --git a/circle_app/lib/app/chat/widget/chat_msg_invent_wish_item.dart b/circle_app/lib/app/chat/widget/chat_msg_invent_wish_item.dart deleted file mode 100644 index dc1a256..0000000 --- a/circle_app/lib/app/chat/widget/chat_msg_invent_wish_item.dart +++ /dev/null @@ -1,93 +0,0 @@ -import 'dart:convert'; - -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:circle_app/app/chat/widget/wish_dialog.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; - -import '../../../common/colors/app_color.dart'; - -class ChatMsgInventWishItem extends StatelessWidget { - V2TimMessage message; - // TODO: add state variables, methods and constructor params - ChatMsgInventWishItem(this.message); - - @override - Widget build(BuildContext context) { - Map giftData = jsonDecode(message.customElem!.data!); - // TODO: add widget build method - return GestureDetector( - onTap: () { - if (!(message.isSelf ?? false)) { - - showWishPannel(); - } - }, - child: Container( - width: MediaQuery.of(context).size.width * 0.6, - child: Column( - children: [ - Container( - height: 80.sp, - decoration: BoxDecoration( - gradient: AppColor.mainVerLinearGradient, - borderRadius: BorderRadius.circular(8.sp)), - child: Row( - children: [ - Container( - margin: EdgeInsets.only(left: 10.sp), - child: CachedNetworkImage( - imageUrl: giftData['icon'], - width: 60.sp, - height: 60.sp, - )), - Expanded( - child: Container( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - // color: Colors.red, - // alignment: Alignment.center, - child: Text( - '邀请你许个愿', - style: TextStyle( - color: Color(0xFFF7FAFA), fontSize: 14.sp), - overflow: TextOverflow.ellipsis, - ), - ), - SizedBox( - height: 8.sp, - ), - Container( - child: Text( - '我可以考虑满足你哦~', - style: TextStyle( - color: Color(0xFFF7FAFA), fontSize: 13.sp), - overflow: TextOverflow.ellipsis, - ), - ) - ], - ), - ), - ) - ], - ), - ), - ], - ), - ), - ); - } - - showWishPannel() { - Get.bottomSheet( - WishDialog(accId:message.userID!,), - isScrollControlled: false, - enableDrag: false, - ); - } - -} diff --git a/circle_app/lib/app/chat/widget/chat_msg_partner_item.dart b/circle_app/lib/app/chat/widget/chat_msg_partner_item.dart deleted file mode 100644 index b253698..0000000 --- a/circle_app/lib/app/chat/widget/chat_msg_partner_item.dart +++ /dev/null @@ -1,139 +0,0 @@ -import 'dart:convert'; - -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:circle_app/common/colors/app_color.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:circle_app/app/chat/widget/chat_gift_pannel.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; - -class ChatMsgPartnerItem extends StatelessWidget { - V2TimMessage message; - // TODO: add state variables, methods and constructor params - ChatMsgPartnerItem(this.message); - // TODO: add state variables, methods and constructor params - List vipTitleName = [ - 365, - 90, - 30, - ]; - - List vipName = [ - "vip_year", - "vip_quarter", - "vip_month", - ]; - - @override - Widget build(BuildContext context) { - // TODO: add widget build method - // Map data = message.messageAttachment!.toMap(); - Map giftData = jsonDecode(message.customElem!.data!); - bool isMe = message.isSelf!; - int price = giftData['totalPrice']; - - int index = 0; - if (giftData['num'] == 90) { - index = 1; - } else if (giftData['num'] == 30) { - index = 2; - } - // TODO: add widget build method - return Container( - width: Get.width * 0.6, - child: Column( - children: [ - Container( - height: 78.sp, - decoration: BoxDecoration( - gradient: isMe - ? AppColor.mainVerLinearGradient - : const LinearGradient( - colors: [ - Color(0xFF493E5C), - Color(0xFF493E5C), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - // color: Color(0xFF493E5C), - borderRadius: BorderRadius.circular(8.sp)), - child: Row( - children: [ - // "propImageUrl" -> "https://qiniuyun.ikuayou.com/2023/xhPHUJ.png""monthNum" -> 3 - Container( - margin: EdgeInsets.only(left: 10.sp), - child: Image.asset( - getMsgImage(vipName[index]), - width: 60.sp, - height: 60.sp, - )), - Expanded( - child: Container( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - // color: Colors.red, - // alignment: Alignment.center, - child: Text( - (isMe ? '送出' : '送你') + '${giftData['giftName']}', - style: TextStyle( - color: Color(0xFFF7FAFA), fontSize: 14.sp), - overflow: TextOverflow.ellipsis, - ), - ), - SizedBox( - height: 8.sp, - ), - Container( - child: Text( - '价值${price.toInt()}元', - style: TextStyle( - color: Color(0xFFF7FAFA), fontSize: 14.sp), - overflow: TextOverflow.ellipsis, - ), - ) - ], - ), - ), - ) - ], - ), - ), - isMe - ? Container() - : GestureDetector( - onTap: () { - showGiftPannel(); - }, - child: Container( - height: 30.sp, - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(6.sp), - gradient: AppColor.mainVerLinearGradient), - child: Text( - '给TA回个礼,让感情升升温', - style: TextStyle(color: Colors.white), - ), - ), - ) - ], - ), - ); - } - - showGiftPannel() { - Get.bottomSheet( - ChatGiftPannel( - accid: message.sender!, - selectedIndex: 1, - ), - isScrollControlled: false, - enableDrag: false, - ); - } -} diff --git a/circle_app/lib/app/chat/widget/chat_msg_user_home_item.dart b/circle_app/lib/app/chat/widget/chat_msg_user_home_item.dart deleted file mode 100644 index 56e35e0..0000000 --- a/circle_app/lib/app/chat/widget/chat_msg_user_home_item.dart +++ /dev/null @@ -1,324 +0,0 @@ -import 'dart:convert'; - -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:gradient_borders/box_borders/gradient_box_border.dart'; -import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; - -import '../../../common/Widgets/tag_widget.dart'; -import '../../../common/colors/app_color.dart'; -import '../../../network/api.dart'; -import '../../../network/dio_manager.dart'; -import '../../../router/app_routers.dart'; -import '../../../util/util.dart'; -import '../../userinfo/logic.dart'; - -class ChatMsgUserHomeItem extends StatefulWidget { - V2TimMessage message; - // TODO: add state variables, methods and constructor params - ChatMsgUserHomeItem(this.message); - - @override - State createState() => _ChatMsgUserHomeItemState(); -} - -class _ChatMsgUserHomeItemState extends State { - late UserBean item; - List imaglist = []; - @override - void initState() { - // TODO: implement initState - super.initState(); - Map userData = jsonDecode(widget.message.customElem!.data!); - item = UserBean.fromJson(userData); - } - - loadPhotoData() async { - // "${Api.getTaAlbum + userId}/albums" - - var myAlbumData = await DioManager.instance.get(url: "${Api.getTaAlbum + item.id.toString()}/albums"); - var myAlbumBean = BaseResponse.fromJson( - myAlbumData, (myAlbumData) => AlbumResponseBean.fromJson(myAlbumData)); - - if (myAlbumBean.isSuccess()) { - imaglist.addAll(myAlbumBean.data.lists); - } - setState(() { - - }); - } - - @override - Widget build(BuildContext context) { - return GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.UserInfoActivity, arguments: item.id.toString()); - }, - child: Container( - clipBehavior: Clip.hardEdge, - margin: EdgeInsets.only(top: 10.sp), - // padding: EdgeInsets.only( left: 8.sp, right: 8.sp), - width: Get.width, - // height: 210.sp, - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(10.sp), - border: GradientBoxBorder( - gradient:AppColor.mainVerLinearGradient, - width: 1.sp, - ), - ), - // decoration: BoxDecoration( - // image: DecorationImage( - // fit: BoxFit.fill, - // image: AssetImage( - // getCircleImage('pic_bg'), - // ))), - child: Stack( - children: [ - Container( - margin: EdgeInsets.only(top: 1.sp, left: 1.sp, right: 1.sp), - child: ClipRRect( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(10.sp), - topRight: Radius.circular(10.sp), - ), - child: Stack( - children: [ - Image( - image: AssetImage(getCircleImage("icon_list_null")), - width: Get.width, - fit: BoxFit.fill, - height: 92.sp, - ), - Container( - height: 92.sp, - width: Get.width, - color: Colors.black.withOpacity(0.25), - ) - ], - ) - ), - ), - Column(children: [ - Container( - margin: EdgeInsets.only(right: 2.sp), - child: Row( - children: [ - Container( - margin: EdgeInsets.only(top: 6.sp, left: 8.sp), - width: 88.sp, - height: 88.sp, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8.0), - gradient: const LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [ - Color(0xFF71F3F2), - Color(0xFFF558FF), - ], - stops: [0.0365, 0.9427], - ), - ), - padding: EdgeInsets.all(0.2.sp), - child: ClipRRect( - borderRadius: BorderRadius.circular(8.0), - child: Image.network(item.avatarThumb, - width: 88.sp, height: 88.sp, fit: BoxFit.cover), - ), - ), - Expanded( - child: SingleChildScrollView( - scrollDirection: Axis.horizontal, - child: Container( - margin: EdgeInsets.only(top: 6.sp), - child: Row( - children: [ - for (int i = 0; i < imaglist.length; i++) - ListAlbumItem(imaglist[i].url, i), - ], - ), - ), - ), - ), - ], - ), - ), - Container( - margin: EdgeInsets.only(top: 6.sp, left: 9.sp), - child: Row( - children: [ - Text( - item.nickname.length > 5 ? item.nickname.substring(0,5) + '..' : item.nickname, - style: TextStyle( - fontWeight: FontWeight.bold, - color: const Color.fromRGBO(247, 250, 250, 1.0), - fontSize: 16.sp, - ), - ), - Expanded(child: Container()), - Container( - margin: EdgeInsets.only(left: 5.sp,right: 5.sp), - width: 60.sp, - height: 20.sp, - decoration: BoxDecoration( - gradient: - AppColor.mainVerLinearGradient, - borderRadius: - BorderRadius.circular(10.sp)), - child: Row( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Container( - - child: Text( - '查看主页', - style: TextStyle( - color: Colors.white, - fontSize: 10.sp, - ), - ), - ), - ], - ), - ), - - ], - ), - ), - Container(margin: EdgeInsets.only(top: 6.sp, left: 9.sp),child: _buildInfoRow(item)), - Container( - // height: 55.sp, // 设置固定高度 - width: Get.width, - margin: EdgeInsets.symmetric(vertical: 12.0.sp,horizontal: 9.sp), - child: Align( - alignment: Alignment.centerLeft, // 文本左对齐,垂直居中 - child: Text( - item.signature, - maxLines: 2, - style: TextStyle(color: Colors.white, fontSize: 18.sp), - overflow: TextOverflow.ellipsis, - ), - ), - ), - Container( - margin: EdgeInsets.only(left: 8.sp, right: 3.sp,bottom: 5.sp), - child: _buildInterestsListView(item.interests)) - ]), - ], - )), - ); - } - - - Widget ListAlbumItem(String item, int index) { - return Container( - margin: EdgeInsets.symmetric(horizontal: 2.sp), - child: CachedNetworkImage( - width: 88.sp, - height: 88.sp, - fit: BoxFit.cover, - imageUrl: item + "?imageView2/1/w/176/h/176/q/75", - ), - ); - } - - - Widget _buildInfoRow(UserBean item) { - String ageMsg = - getAgeCOntent(item!.gender, item!.age, item!.role, item!.orientation); - return Row( - children: [ - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color.fromRGBO(141, 255, 248, 1.0), - Color.fromRGBO(181, 211, 255, 1.0), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 2.sp, - bottom: 2.sp, - left: 10.sp, - right: 10.sp, - ), - child: Text( - ageMsg, - style: const TextStyle( - color: Colors.black, - fontSize: 10, - ), - ), - ), - const SizedBox(width: 6), - UserTagWidget(item.mark!), - ], - ); - } - - Widget _buildInterestsListView(List interests) { - return Align( - alignment: Alignment.centerLeft, - child: SingleChildScrollView( - scrollDirection: Axis.horizontal, - child: Row( - children: [ - for (int index = 0; index < interests.length; index++) - GestureDetector( - onTap: () { - // Get.toNamed(AppRoutes.Signal_circle_list, - // arguments: interests[index].id); - }, - child: Container( - margin: EdgeInsets.only(right: 11.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17.0), - gradient: const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - ), - color: const Color(0xFF392D53), - ), - child: Container( - margin: EdgeInsets.all(0.2.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17.0), - color: const Color(0xFF392D53), - ), - child: Padding( - padding: EdgeInsets.only( - top: 2.sp, - bottom: 2.sp, - left: 15.sp, - right: 15.sp, - ), - child: Center( - child: Text( - interests[index].title, - style: const TextStyle( - fontSize: 13.0, - color: Colors.white, - ), - ), - ), - ), - ), - ), - ), - ], - ), - ), - ); - } -} diff --git a/circle_app/lib/app/chat/widget/chat_msg_wish_info_item.dart b/circle_app/lib/app/chat/widget/chat_msg_wish_info_item.dart deleted file mode 100644 index 5ac098c..0000000 --- a/circle_app/lib/app/chat/widget/chat_msg_wish_info_item.dart +++ /dev/null @@ -1,126 +0,0 @@ -import 'dart:convert'; - -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; - -import '../../../common/colors/app_color.dart'; -import 'chat_gift_pannel.dart'; - -class ChatMsgWishInfoItem extends StatelessWidget { - - V2TimMessage message; - // TODO: add state variables, methods and constructor params - ChatMsgWishInfoItem(this.message); - - @override - Widget build(BuildContext context) { - Map giftData = jsonDecode(message.customElem!.data!); - // TODO: add widget build method - return GestureDetector( - onTap: () { - if (!(message.isSelf ?? false)) { - showGiftPannel(giftData['id'].toString()); - } - }, - child: Container( - width: MediaQuery.of(context).size.width * 0.6, - child: Column( - children: [ - Container( - height: 80.sp, - decoration: BoxDecoration( - gradient: message.isSelf! ? AppColor.mainVerLinearGradient : LinearGradient(colors: [Color(0xFF493E5C),Color(0xFF493E5C)]), - borderRadius: BorderRadius.circular(8.sp)), - child: Row( - children: [ - Container( - margin: EdgeInsets.only(left: 10.sp), - child: CachedNetworkImage( - imageUrl: giftData['icon'], - width: 60.sp, - height: 60.sp, - )), - Expanded( - child: Container( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - // color: Colors.red, - // alignment: Alignment.center, - child: Text( - '许愿:想要', - style: TextStyle( - color: Color(0xFFF7FAFA), fontSize: 14.sp), - overflow: TextOverflow.ellipsis, - ), - ), - Text( - giftData['name'], - style: TextStyle( - color: AppColor.mainColor, fontSize: 14.sp), - overflow: TextOverflow.ellipsis, - ), - - ], - ), - SizedBox( - height: 8.sp, - ), - Container( - child: Text( - '感恩:${giftData['option']}', - style: TextStyle( - color: Color(0xFFF7FAFA), fontSize: 14.sp), - overflow: TextOverflow.ellipsis, - ), - ) - ], - ), - ), - ) - ], - ), - ), - message.isSelf! - ? Container() - : GestureDetector( - onTap: () { - showGiftPannel(giftData['id'].toString()); - }, - child: Container( - height: 30.sp, - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(6.sp), - gradient: AppColor.mainVerLinearGradient), - child: Text( - '满足TA', - style: TextStyle(color: Colors.white), - ), - ), - ) - ], - ), - ), - ); - } - - showGiftPannel(String giftId) { - Get.bottomSheet( - ChatGiftPannel( - accid: message.sender!.toString(), - giftId: giftId, - ), - isScrollControlled: false, - enableDrag: false, - ); - } - -} diff --git a/circle_app/lib/app/chat/widget/gift.dart b/circle_app/lib/app/chat/widget/gift.dart deleted file mode 100644 index a9d9110..0000000 --- a/circle_app/lib/app/chat/widget/gift.dart +++ /dev/null @@ -1,435 +0,0 @@ -import 'dart:convert'; - -import 'package:circle_app/main.dart'; -import 'package:circle_app/util/eventBus.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:circle_app/common/colors/app_color.dart'; -import 'package:circle_app/components/func_widget.dart'; -import 'package:circle_app/network/api.dart'; -import 'package:circle_app/network/dio_manager.dart'; -import 'package:circle_app/util/util.dart'; - -import '../../../common/Widgets/RechargeScreenDialog.dart'; -import '../../../common/Widgets/base_tip_widget.dart'; -import 'chat_gift_pannel.dart'; - -class Gift extends StatefulWidget { - String accid; - String giftId; - Gift(this.accid, this.giftId, {super.key}); - @override - _GiftState createState() => _GiftState(); -} - -class _GiftState extends State { - List giftList = []; - - String giftId = ''; - - String tipStr = ''; - String balanceTipStr = '充值'; - - String incomeBalance = ''; - - int giftCount = 1; - - int selectedIndex = -1; - - bool isShowCount = false; - - var sub; - - @override - void dispose() { - // TODO: implement dispose - super.dispose(); - sub.cancel(); - } - - @override - void initState() { - // TODO: implement initState - super.initState(); - sub = EventBusManager.on().listen((event) { - getAsset(); - }); - giftId = widget.giftId; - loadGiftData(); - getAsset(); - } - - gelectThirdItem() async { - var data = - await DioManager.getInstance().get(url: Api.walletRechargeSelectItem); - if (data['code'] == 200) { - // "walletRechargeSelectItemBos" -> [_GrowableList] - List response = data['data']['priceConfs']; - - incomeBalance = data['data']['balance'].toString(); - // List walletRechargeSelectItemBos = []; - AssetsDataDataPriceConfs info = - AssetsDataDataPriceConfs.fromJson(response.last); - balanceTipStr = info.remark!.isNotEmpty - ? '首冲最高赠送' + info.remark!.split('送').last + '>' - : '充值>'; - } - } - - @override - Widget build(BuildContext context) { - return Stack( - children: [ - Container( - color: Colors.transparent, - child: Column( - children: [ - widget.accid!.isNotEmpty - ? Container( - margin: EdgeInsets.only(top: 10.sp, bottom: 10.sp), - width: Get.width, - alignment: Alignment.center, - child: Text( - tipStr.isNotEmpty ? '礼物送出后,获得$tipStr小时的消息置顶' : '', - style: TextStyle( - color: AppColor.mainColor, - fontSize: 12.sp, - fontWeight: FontWeight.w500), - ), - ) - : Container(), - Expanded( - child: Container( - width: Get.width, - child: ListView.builder( - itemCount: giftList.length, - scrollDirection: Axis.horizontal, - itemBuilder: (context, index) { - return giftGridWidget(giftList[index]); - }), - )), - Container( - padding: EdgeInsets.only(left: 10.sp, right: 10.sp), - height: 48.sp, - width: Get.width, - child: Row( - children: [ - GestureDetector( - onTap: () { - showRechargeScreenDialog().then((value) { - getAsset(); - }); - }, - child: Row( - children: [ - Container( - margin: EdgeInsets.only(right: 4.sp), - child: Image.asset( - getMineImage('bi_icon1'), - width: 24.sp, - ), - ), - Text( - '${incomeBalance}', - style: TextStyle( - color: Color(0xFFF7FAFA), - fontSize: 12.sp, - fontWeight: FontWeight.w500), - ), - SizedBox( - width: 16.sp, - ), - Text( - balanceTipStr, - style: TextStyle( - color: AppColor.mainColor, - fontSize: 12.sp, - fontWeight: FontWeight.w500), - ), - ], - ), - ), - Expanded(child: Container()), - GestureDetector( - onTap: () { - isShowCount = !isShowCount; - setState(() {}); - }, - child: Container( - height: 27.sp, - child: Row( - children: [ - GestureDetector( - onTap: () { - if (giftId.isEmpty) { - showOKToast('请选择您想求送的礼物'); - } else { - sendGetGiftData(); - } - }, - child: Container( - width: 56.sp, - height: 27.sp, - decoration: BoxDecoration( - gradient: AppColor.mainVerLinearGradient, - borderRadius: - BorderRadius.circular(13.5.sp)), - alignment: Alignment.center, - child: Text( - '求送', - style: TextStyle( - color: Colors.white, - fontSize: 12.sp, - fontWeight: FontWeight.w500), - ), - ), - ), - SizedBox( - width: 8, - ), - GestureDetector( - onTap: () { - if (giftId.isEmpty) { - showOKToast('请选择您想赠送的礼物'); - } else { - sendGiftData(); - } - }, - child: Container( - width: 56.sp, - height: 27.sp, - decoration: BoxDecoration( - gradient: AppColor.mainVerLinearGradient, - borderRadius: - BorderRadius.circular(13.5.sp)), - alignment: Alignment.center, - child: Text( - '赠送', - style: TextStyle( - color: Colors.white, - fontSize: 12.sp, - fontWeight: FontWeight.w500), - ), - ), - ), - ], - ), - ), - ) - ], - ), - ) - ], - ), - ), - isShowCount - ? Positioned(bottom: 45.sp, right: 15.sp, child: giftCountWidget()) - : Container() - ], - ); - } - - void sendGetGiftData() async { - var info = giftList[0][selectedIndex]; - sendGetGiftCustomMsg(widget.accid, jsonEncode(info), '求您送我${info['name']}'); - } - - void sendGiftData() async { - var result = await DioManager.instance.post(url: Api.sendGift, params: { - 'accid': widget.accid, - 'giftId': giftId, - 'num': giftCount, - 'toUserId': widget.accid!.split('_').last - }); - if (result['code'] == 200) { - showOKToast('赠送成功'); - getAsset(); - } else if (result['code'] == 31201) { - showOKToast(result['msg']); - showRechargeScreenDialog().then((value) => getAsset()); - } - } - - void loadGiftData() async { - var result = await DioManager.instance.get(url: Api.giftList); - if (result['code'] == 200) { - List dataList = result['data']; - List giftItemData = []; - - for (int i = 0; i < dataList.length; i++) { - var info = dataList[i]; - if (info['id'] == giftId) { - selectedIndex = i; - } - giftItemData.add(dataList[i]); - if (i % 7 == 0 && i != 0) { - List temp = []; - temp.addAll(giftItemData); - giftList.add(temp); - giftItemData.clear(); - } - } - - for (int i = 0; i < giftList[0].length; i++) { - var info = giftList[0][i]; - if (info['name'] == '浪漫告白') { - selectedIndex = i; - giftId = info['id'].toString(); - tipStr = info['topHours'] != null ? info['topHours'].toString() : ''; - } - } - - setState(() {}); - } - } - - getAsset() async { - var jsonMap = await DioManager.getInstance().get(url: Api.userAsset); - - if (jsonMap['code'] == 200) { - incomeBalance = jsonMap['data']['balance'].toString(); - await gelectThirdItem(); - setState(() {}); - } - } - - giftGridWidget(List info) { - return Container( - width: Get.width, - // color: Colors.red, - height: 255.sp, - padding: EdgeInsets.only(left: 10.sp, right: 10.sp), - child: GridView.builder( - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 4, - crossAxisSpacing: 0.0.sp, - mainAxisSpacing: 0.sp, - childAspectRatio: (Get.width - 32.sp) / 4 / 120.5.sp, - ), - itemCount: info.length, - // Replace with the actual item count - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - itemBuilder: (context, index) { - // Replace the placeholders with the actual item widgets - return giftItemWidget(info[index], index); - }, - ), - ); - } - - giftItemWidget(Map info, int index) { - bool isSelected = giftId.contains(info['id'].toString()); - double price = info['price']; - - return GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - selectedIndex = index; - giftId = info['id'].toString(); - tipStr = info['topHours'] != null ? info['topHours'].toString() : ''; - setState(() {}); - }, - child: Container( - height: 127.5.sp, - // color: Colors.red, - // decoration: BoxDecoration( - // image: DecorationImage( - // image: AssetImage(getMsgImage('gift_bg'),), - // ) - // // color: isSelected ? Color(0xFF3E3D4C) : Colors.transparent, - // // borderRadius: BorderRadius.circular(4.sp), - // // border: Border.all( - // // color: isSelected ? AppColor.mainColor : Colors.transparent, - // // width: isSelected ? 1.sp : 0.0) - // ), - child: Stack( - fit: StackFit.expand, - children: [ - isSelected - ? Image.asset( - getMsgImage('gift_bg'), - ) - : Container(), - Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.network( - info['icon'], - width: 70.sp, - height: 70.sp, - ), - Text(info['name'], - style: TextStyle( - color: Colors.white, - fontSize: 12.sp, - fontWeight: FontWeight.w500)), - Text('${price.toInt()}小票', - style: TextStyle( - color: Colors.white, - fontSize: 12.sp, - fontWeight: FontWeight.w500)) - ], - ) - ], - ), - ), - ); - } - - giftCountWidget() { - return Container( - decoration: BoxDecoration( - color: Color(0xFF3E3D4C), borderRadius: BorderRadius.circular(8.sp)), - child: Column( - children: [ - giftCountItemWidget(1314, '一生一世', () {}), - giftCountItemWidget(520, '我爱你', () {}), - giftCountItemWidget(299, '爱久久', () {}), - giftCountItemWidget(66, '六六大顺', () {}), - giftCountItemWidget(10, '十全十美', () {}), - giftCountItemWidget(1, '一心一意', () {}), - ], - ), - ); - } - - giftCountItemWidget(int count, String desc, GestureTapCallback callback) { - return GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - giftCount = count; - isShowCount = false; - setState(() {}); - }, - child: Container( - height: 30.sp, - width: 115.sp, - padding: EdgeInsets.only(right: 5.sp), - child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Container( - alignment: Alignment.center, - child: Text( - '${count}', - style: - TextStyle(color: Color(0xFFE6E6E6), fontSize: 12.sp), - ))), - Expanded( - child: Container( - alignment: Alignment.center, - child: Text( - desc, - style: - TextStyle(color: Color(0xFFE6E6E6), fontSize: 12.sp), - ))), - ], - ), - ), - ); - } -} diff --git a/circle_app/lib/app/chat/widget/more_dialog.dart b/circle_app/lib/app/chat/widget/more_dialog.dart deleted file mode 100644 index d60d36a..0000000 --- a/circle_app/lib/app/chat/widget/more_dialog.dart +++ /dev/null @@ -1,621 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/friendShip/friendship_services.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/services_locatar.dart'; -import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; -import '../../../network/api.dart'; -import '../../../network/dio_manager.dart'; -import '../../../router/app_routers.dart'; -import '../../../util/eventBus.dart'; -import '../../../util/util.dart'; -import '../../userinfo/logic.dart'; -import 'package:provider/provider.dart'; - -class MoreDialog extends StatefulWidget { - String userId; - String sessionId; - Function deleteMsgCallBack; - Function blackCallBack; - MoreDialog( - {super.key, - required this.sessionId, - required this.userId, - required this.deleteMsgCallBack, - required this.blackCallBack, - }); - - @override - _MoreDialogState createState() => new _MoreDialogState(); -} - -class _MoreDialogState extends State { - // TODO: add state variables and methods - // late ChatViewModel _viewModel; - bool isTop = false; - bool isBlack = false; - UserBean? userBean; - - - @override - void initState() { - // TODO: implement initState - super.initState(); - - loadIsTop(); - getUserData(); - } - - @override - Widget build(BuildContext context) { - // TODO: add widget build method - return Scaffold( - backgroundColor: Colors.transparent, - body: userBean != null - ? Column( - children: [ - Expanded( - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - Get.back(); - }, - child: Container())), - Container( - decoration: const BoxDecoration( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(16.0), - topRight: Radius.circular(16.0), - ), - gradient: LinearGradient( - colors: [ - Color(0xFF4A3E5D), - Color(0xFF344143), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - height: 118.0, - width: double.infinity, - child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Expanded( - child: GestureDetector( - onTap: () async { - Get.back(); - Get.toNamed(AppRoutes.UserInfoActivity, - arguments: widget.userId); - }, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image( - image: - AssetImage(getMineImage("im_right_look")), - width: 40.sp, - height: 40.sp, - ), - Container( - margin: EdgeInsets.only(top: 2.sp), - child: Text( - "查看主页", - style: TextStyle(color: Colors.white), - ), - ), - ], - ), - ), - ), - Expanded( - child: GestureDetector( - onTap: () { - Navigator.pop(context); - Get.toNamed(AppRoutes.ReportActivity, - arguments: {"userId": widget.userId}); - }, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image( - image: AssetImage(getMsgImage("msg_report")), - width: 40.sp, - height: 40.sp, - ), - Container( - margin: EdgeInsets.only(top: 2.sp), - child: const Text( - "举报", - style: TextStyle(color: Colors.white), - ), - ), - ], - ), - )), - Expanded( - child: GestureDetector( - onTap: () { - Get.back(); - if (!isBlack) { - _showReportDialog(Get.context!); - } else { - cancelBlack(); - } - // Navigator.pop(context); - }, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image( - image: AssetImage(getMsgImage("msg_add_black")), - width: 40.sp, - height: 40.sp, - ), - Container( - margin: EdgeInsets.only(top: 2.sp), - child: Text( - (isBlack) ? '取消拉黑' : " 拉黑 ", - style: TextStyle(color: Colors.white), - ), - ), - ], - ), - )), - Expanded( - child: GestureDetector( - onTap: () { - // Navigator.pop(context); - addTop(isTop, widget.sessionId); - }, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image( - image: AssetImage(getMineImage("im_first")), - width: 40.sp, - height: 40.sp, - ), - Container( - margin: EdgeInsets.only(top: 2.sp), - child: Text( - isTop ? '取消置顶' : "聊天置顶", - style: TextStyle(color: Colors.white), - ), - ), - ], - ), - )), - Expanded( - child: GestureDetector( - onTap: () { - clearMsg(widget.sessionId); - }, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image( - image: AssetImage(getMineImage("im_visit")), - width: 40.sp, - height: 40.sp, - ), - Container( - margin: EdgeInsets.only(top: 2.sp), - child: Text( - "清空记录", - style: TextStyle(color: Colors.white), - ), - ), - ], - ), - )), - ], - ), - ) - ], - ) - : loaddingWidget(true), - ); - } - - void _showReportDialog(BuildContext context) { - showDialog( - context: context, - builder: (BuildContext context) { - return Dialog( - backgroundColor: Colors.transparent, - child: Container( - height: 277.sp, - padding: const EdgeInsets.all(1.0), - child: Stack( - children: [ - Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(22.0.sp), - // gradient: const LinearGradient( - // colors: [Color(0xFFDD3DF4), Color(0xFF30FFD9)], - // begin: Alignment.topCenter, - // end: Alignment.bottomCenter, - // ), - ), - ), - Container( - margin: EdgeInsets.all(1.sp), - child: Image.asset(getMineImage("im_neglect")), - ), - Container( - margin: EdgeInsets.only(top: 12.sp), - child: Column( - children: [ - Center( - child: Text( - "是否拉黑", - style: - TextStyle(color: Colors.white, fontSize: 16.sp), - ), - ), - Container( - margin: EdgeInsets.only(top: 14.sp), - alignment: Alignment.center, - child: Image( - image: AssetImage(getMineImage("icon_dialog_black")), - width: 70.sp, - height: 70.sp, - ), - ), - Container( - margin: EdgeInsets.only( - top: 12.sp, left: 14.sp, right: 14.sp), - alignment: Alignment.center, - child: Text( - "拉黑后,你将屏蔽对方的任何信息若您关注了对方,将自动取消关注。", - textAlign: TextAlign.center, - style: TextStyle( - color: const Color(0xCCF7FAFA), fontSize: 16.sp), - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - onTap: () { - Navigator.pop(context); - }, - child: Container( - margin: EdgeInsets.only(top: 16.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color(0x26FFFFFF), - Color(0x26FFFFFF), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 10.sp, - bottom: 10.sp, - left: 52.sp, - right: 52.sp), - child: const Text( - "否", - style: TextStyle( - color: Colors.white, - fontSize: 12, - ), - ), - ), - ), - SizedBox(width: 24.sp), - GestureDetector( - onTap: () { - Get.back(); - setBlock(); - }, - child: Container( - margin: EdgeInsets.only(top: 16.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color(0x26FFFFFF), - Color(0x26FFFFFF), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 10.sp, - bottom: 10.sp, - left: 52.sp, - right: 52.sp), - child: const Text( - "是", - style: TextStyle( - color: Colors.white, - fontSize: 12, - ), - ), - ), - ) - ], - ) - ], - ), - ) - ], - ), - ), - ); - }, - ); - } - - - void _showCancelBlackReportDialog(BuildContext context) { - showDialog( - context: context, - builder: (BuildContext context) { - return Dialog( - backgroundColor: Colors.transparent, - child: Container( - height: 277.sp, - padding: const EdgeInsets.all(1.0), - child: Stack( - children: [ - Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(22.0.sp), - // gradient: const LinearGradient( - // colors: [Color(0xFFDD3DF4), Color(0xFF30FFD9)], - // begin: Alignment.topCenter, - // end: Alignment.bottomCenter, - // ), - ), - ), - Container( - margin: EdgeInsets.all(1.sp), - child: Image.asset(getMineImage("im_neglect")), - ), - Container( - margin: EdgeInsets.only(top: 12.sp), - child: Column( - children: [ - Center( - child: Text( - "是否解除拉黑", - style: - TextStyle(color: Colors.white, fontSize: 16.sp), - ), - ), - Container( - margin: EdgeInsets.only(top: 14.sp), - alignment: Alignment.center, - child: Image( - image: AssetImage(getMineImage("icon_dialog_black")), - width: 70.sp, - height: 70.sp, - ), - ), - Container( - margin: EdgeInsets.only( - top: 12.sp, left: 14.sp, right: 14.sp), - alignment: Alignment.center, - child: Text( - "解除拉黑后,你将取消屏蔽对方的任何信息", - textAlign: TextAlign.center, - style: TextStyle( - color: const Color(0xCCF7FAFA), fontSize: 16.sp), - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - onTap: () { - Navigator.pop(context); - }, - child: Container( - margin: EdgeInsets.only(top: 16.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color(0x26FFFFFF), - Color(0x26FFFFFF), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 10.sp, - bottom: 10.sp, - left: 52.sp, - right: 52.sp), - child: const Text( - "否", - style: TextStyle( - color: Colors.white, - fontSize: 12, - ), - ), - ), - ), - SizedBox(width: 24.sp), - GestureDetector( - onTap: () { - Get.back(); - cancelBlack(); - }, - child: Container( - margin: EdgeInsets.only(top: 16.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color(0x26FFFFFF), - Color(0x26FFFFFF), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 10.sp, - bottom: 10.sp, - left: 52.sp, - right: 52.sp), - child: const Text( - "是", - style: TextStyle( - color: Colors.white, - fontSize: 12, - ), - ), - ), - ) - ], - ) - ], - ), - ) - ], - ), - ), - ); - }, - ); - } - - - //聊天置顶 - addTop(bool status, String sessionId) async { - //会话置顶 - V2TimCallback pinConversationRes = await TencentImSDKPlugin.v2TIMManager - .getConversationManager() - .pinConversation( - conversationID: widget.sessionId,//需要修改置顶属性的会话id - isPinned: !status);//是否置顶 - if (pinConversationRes.code == 0) { - //设置置顶成功 - if (!status) { - isTop = true; - showOKToast('置顶成功'); - } else { - showOKToast('取消置顶成功'); - isTop = false; - } - setState(() {}); - } - - } - - //清空聊天记录 - clearMsg(String sessionId) async { - String userId = widget.sessionId.replaceAll("c2c_", ''); - //清空单聊本地及云端的消息(不删除会话) - V2TimCallback clearC2CHistoryMessageRes = await TencentImSDKPlugin - .v2TIMManager - .getMessageManager() - .clearC2CHistoryMessage(userID:userId); // 需要清空记录的用户id - if (clearC2CHistoryMessageRes.code == 0) { - EventBusManager.fire(ClearMsg()); - //清除成功 - showOKToast('记录清空成功'); - Get.back(); - } - } - - void loadIsTop() async { - V2TimValueCallback getConversationtRes = - await TencentImSDKPlugin.v2TIMManager - .getConversationManager() - .getConversation(conversationID: widget.sessionId);//会话唯一 ID,如果是 C2C 单聊,组成方式为 c2c_userID,如果是群聊,组成方式为 group_groupID - if (getConversationtRes.code == 0) { - isTop = getConversationtRes.data?.isPinned ?? false; - setState(() { - - }); - } - } - - void getUserData() async { - var data = await DioManager.instance.get( - url: Api.getUserInfoTA + widget.userId + '/home', - ); - - var bean = BaseResponse.fromJson( - data, (data) => ResponseBean.fromJson(data)); - - if (bean.isSuccess()) { - userBean = bean.data.user; - var result = await DioManager.instance - .get(url: '${Api.setBlock + widget.userId}/block'); - isBlack = result["data"]["status"] == 1; - - setState(() {}); - } - } - - setBlock() async { - await setBlack("1"); - EventBusManager.fire(CommentBlackEvent( userId: widget.userId, isBlack: true)); - - widget.blackCallBack(); - } - - cancelBlack() async { - await setBlack("0"); - EventBusManager.fire(CommentBlackEvent( userId: widget.userId, isBlack: false)); - widget.blackCallBack(); - } - - setBlack(String status) async { - List parts = widget.sessionId.split('_'); - if (parts[2] == "10") { - showOKToast("不可拉黑客服号哦~"); - return; - } - var data = await DioManager.instance.post( - url: "${Api.setBlock + widget.userId}/block", - params: {'status': status}); - var bean = BaseResponse.fromJson( - data, - (jsonData) => jsonData, - ); - if (bean.isSuccess()) { - final FriendshipServices _friendshipServices = - serviceLocator(); - - isBlack = status == "1"; - try { - if (isBlack) { - // Navigator.pop(Get.context!); - var result = await _friendshipServices - .addToBlackList(userIDList: [widget.sessionId]); - showOKToast("拉黑成功"); - } else { - var result = await _friendshipServices - .deleteFromBlackList(userIDList: [widget.sessionId]); - showOKToast("取消拉黑成功"); - } - // await Future.delayed(Duration(milliseconds: 500)); - // Future.delayed(Duration(seconds: 3),() { - EventBusManager.fire( - CommentBlackEvent(userId: widget.userId, isBlack: isBlack)); - // }); - } catch (e) {} - } - } -} - -class ClearMsg { -} diff --git a/circle_app/lib/app/chat/widget/partner_option.dart b/circle_app/lib/app/chat/widget/partner_option.dart deleted file mode 100644 index 69a4ceb..0000000 --- a/circle_app/lib/app/chat/widget/partner_option.dart +++ /dev/null @@ -1,333 +0,0 @@ -import 'dart:io'; - -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; -import 'package:get/get.dart'; -import 'package:circle_app/common/colors/app_color.dart'; -import 'package:circle_app/network/api.dart'; -import 'package:circle_app/network/dio_manager.dart'; -import 'package:circle_app/util/paymentUtil.dart'; -import 'package:circle_app/util/util.dart'; - -import '../../../common/Widgets/open_vip_tip/logic.dart'; -import '../../../util/PaymentUtils.dart'; - -class PartnerOption extends StatefulWidget { - String accid; - PartnerOption({super.key, required this.accid}); - - @override - _PartnerOptionState createState() => _PartnerOptionState(); -} - -class _PartnerOptionState extends State { - // TODO: add state variables and methods - List priceBean = []; - bool isZfbPrice = true; - List vipName = [ - "vip_year", - "vip_quarter", - "vip_month", - ]; - - List vipTitleName = [ - "年度合伙人", - "季度合伙人", - "月度合伙人", - ]; - - int propsIndex = 0; - - @override - void initState() { - // TODO: implement initState - super.initState(); - iosData(); - } - - iosData() async { - var data = await DioManager.instance.get(url: Api.getVipPrice, params: {}); - var vipPriceList = BaseResponse>.fromJson( - data, - (data) => - List.from(data.map((item) => PriceBean.fromJson(item))), - ); - priceBean = vipPriceList.data; - priceBean = priceBean.reversed.toList(); - setState(() {}); - } - - @override - Widget build(BuildContext context) { - // TODO: add widget build method - return priceBean.isNotEmpty ? vipsWidget() : loaddingWidget(true); - } - - vipsWidget() { - return Container( - width: Get.width, - height: 340.sp, - child: Column( - children: [ - Expanded( - child: ListView.builder( - itemBuilder: (context, index) { - var item = priceBean[index]; - return GestureDetector( - onTap: () { - propsIndex = index; - setState(() {}); - }, - child: Container( - // height: 60.sp, - padding: EdgeInsets.only(left: 15.sp, right: 15.sp,top: 10.sp,bottom: 10.sp), - // margin: EdgeInsets.only(right: 5.sp, bottom: 5.sp), - //height: 300, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(6.sp), - color: propsIndex == index - ? const Color(0xFF493E5C) - : Colors - .transparent, // Replace this with your desired background drawable - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Image.asset( - getMsgImage(vipName[index]), - width: 60.sp, - height: 60.sp, - fit: BoxFit.cover, - ), - SizedBox(width: 10.sp), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - vipTitleName[index], - style: TextStyle( - color: Colors.white, fontSize: 17.sp), - ), - SizedBox(height: 4.sp), - Text( - '获得会员十几种专属特权' + - (index == 0 - ? '一年' - : index == 1 - ? '3个月' - : '1个月'), - style: TextStyle( - color: Colors.grey, fontSize: 15.sp), - ), - ], - )), - SizedBox(width: 7.sp), - Text( - item.amount.toInt().toString() + '元', - style: TextStyle( - color: AppColor.mainColor, fontSize: 14.sp), - ) - ], - ), - ), - ); - ; - }, - itemCount: 3, - ), - ), - Container( - padding: EdgeInsets.only(left: 16.sp,right: 16.sp,), - height: 48.sp, - width: Get.width, - child: Row( - children: [ - if (Platform.isAndroid) - Container( - // margin: EdgeInsets.only(top: 0.sp,bottom: 20.sp), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - onTap: () { - // 处理支付宝支付逻辑 - isZfbPrice = true; - setState(() { - - }); - }, - child: Row( - children: [ - Image.asset( - isZfbPrice? - getMineImage("icon_pay_select"): getMineImage("icon_pay_is_no_select"), - width: 20.0.sp, - height: 20.0.sp, - ), - SizedBox(width: 8.0.sp), - Image.asset( - getMineImage('icon_cooperate_ali'), - width: 20.0.sp, - height: 20.0.sp, - ), - SizedBox(width: 4.0.sp), - Text( - '支付宝支付', - style: TextStyle( - color: const Color(0xFFF7FAFA), - fontSize: 14.0.sp, - ), - ), - SizedBox(width: 4.0.sp), - Image.asset( - getMineImage('icon_recommend_pay_way'), - width: 32.0.sp, - height: 16.0.sp, - ), - ], - ), - ), - SizedBox(width: 8.0.sp), - GestureDetector( - onTap: () { - isZfbPrice = false; - setState(() { - - }); - }, - child: Row( - children: [ - Image.asset( - !isZfbPrice? - getMineImage("icon_pay_select"): getMineImage("icon_pay_is_no_select"), - width: 20.0.sp, - height: 20.0.sp, - ), - SizedBox(width: 8.0.sp), - Image.asset( - getMineImage('icon_cooperate_wx'), - width: 20.0.sp, - height: 20.0.sp, - ), - SizedBox(width: 4.0.sp), - Text( - '微信支付', - style: TextStyle( - color: const Color(0xFFF7FAFA), - fontSize: 14.0.sp, - ), - ), - ], - ), - ), - ], - ), - ), - - Expanded(child: Container()), - GestureDetector( - onTap: () { - iosPay(); - }, - child: Container( - width: 56.sp, - height: 27.sp, - decoration: BoxDecoration( - gradient: AppColor.mainVerLinearGradient, - borderRadius: BorderRadius.circular(13.5.sp)), - alignment: Alignment.center, - child: Text( - '赠送', - style: TextStyle( - color: Colors.white, - fontSize: 12.sp, - fontWeight: FontWeight.w500), - ), - ), - ) - ], - ), - ) - // Container( - // padding: EdgeInsets.only(left: 16.sp, right: 16.sp), - // height: 48.sp, - // width: Get.width, - // child: Row( - // children: [ - // Expanded(child: Container()), - // GestureDetector( - // onTap: () { - // iosPay(); - // }, - // child: - // ), - // ) - // ], - // ), - // ) - ], - ), - ); - } - - iosPay() { - SmartDialog.showLoading(); - String toUserId = widget.accid!.split('_').last; - PriceBean bean = priceBean[propsIndex]; - if (Platform.isAndroid) { - startPayment(); - } else { - IOSPayment.instance - .iosPay(bean.iosItem, bean.id.toString(), 2, userId: toUserId); - } - } - - startPayment() async { - SmartDialog.showLoading(); - String toUserId = widget.accid!.split('_').last; - if (isZfbPrice) { - var data = await DioManager.instance.post( - url: Api.postAliPayOrder, - params: {"product_id": priceBean[propsIndex].id, "type": 2,'target_id':toUserId}); - var bean = BaseResponse.fromJson( - data, (data) => PayUrlBean.fromJson(data)); - if (bean.isSuccess()) { - openAliPay(bean.data.payUrl, (isSuccess, errorMsg) { - if (isSuccess) { - // 处理支付成功 - // refreshVipStatus(); - showOKToast('赠送会员成功'); - } else { - // 处理支付失败,errorMessage 可能为 null - // refreshVipStatus(); - } - }); - } else { - showOKToast(bean.msg); - } - } else { - var data = await DioManager.instance.post( - url: Api.postWxOrder, - params: {"product_id": priceBean[propsIndex].id, "type": 2,'target_id':toUserId}); - var bean = BaseResponse.fromJson( - data, (data) => PaymentData.fromJson(data)); - if (bean.isSuccess()) { - openWxPay(bean.data, (bool isSuccess, String? errorMessage) { - if (isSuccess) { - // 处理支付成功 - showOKToast('赠送会员成功'); - // refreshVipStatus(); - } else { - // 处理支付失败,errorMessage 可能为 null - } - }); - } else { - showOKToast(bean.msg); - } - } - SmartDialog.dismiss(); - } -} diff --git a/circle_app/lib/app/chat/widget/send_gift_dialog.dart b/circle_app/lib/app/chat/widget/send_gift_dialog.dart deleted file mode 100644 index 29a594f..0000000 --- a/circle_app/lib/app/chat/widget/send_gift_dialog.dart +++ /dev/null @@ -1,256 +0,0 @@ -import 'package:circle_app/common/colors/app_color.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:gradient_borders/box_borders/gradient_box_border.dart'; - -import '../../../common/Widgets/base_tip_widget.dart'; -import '../../../network/api.dart'; -import '../../../network/dio_manager.dart'; -import '../../../util/util.dart'; - -class SendGiftDialog extends StatefulWidget { - String accid; - String title; - SendGiftDialog({super.key,required this.accid,required this.title}); - @override - _SendGiftDialogState createState() => new _SendGiftDialogState(); - -} - -class _SendGiftDialogState extends State { - // TODO: add state variables and methods - List giftList = []; - String giftId = ''; - String withStr = ''; - int selectedIndex = -1; - - String tipStr = ''; - @override - void initState() { - // TODO: implement initState - super.initState(); - loadGiftData(); - } - - void loadGiftData() async { - var result = await DioManager.instance.get(url: Api.giftList); - if (result['code'] == 200) { - giftList = result['data']; - - for (int i= 0; i< giftList.length; i++) { - var info = giftList[i]; - if (info['name'] == '浪漫告白') { - selectedIndex = i ; - giftId = info['id'].toString(); - tipStr = info['topHours'] != null ? info['topHours'].toString() : ''; - } - } - - setState(() {}); - } - } - - @override - Widget build(BuildContext context) { - // TODO: add widget build method - return GestureDetector( - onTap: () { - - }, - child: Scaffold( - backgroundColor: Colors.transparent, - body: Center( - child: Container( - constraints: BoxConstraints( - maxHeight: 285.sp - ), - margin: EdgeInsets.only(left: 10.sp,right: 10.sp), - padding: EdgeInsets.only(left: 10.sp,right: 10.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10.sp), - gradient: LinearGradient(colors: [Color(0xFF4C3E5F),Color(0xFF324140)]), - border: GradientBoxBorder( - gradient: - AppColor.mainVerLinearGradient, - width: 1.sp, - ), - ), - child: Column( - children: [ - Container( - margin: EdgeInsets.only(top: 18.sp), - child: Text( - widget.title, - style: TextStyle(color: Colors.white, fontSize: 15.sp), - ), - ), - Container( - height: tipStr.isNotEmpty ? 145.sp : 122.sp, - margin: EdgeInsets.only(top: 12.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10.sp), - gradient: LinearGradient( - colors: [Color(0xFF132B40), Color(0xFF251240)])), - child: Column( - children: [ - if (tipStr.isNotEmpty) - Padding( - padding: EdgeInsets.only(top:6.sp), - child: Text( - '礼物送出后,获得$tipStr小时的消息置顶', - style: TextStyle( - color: AppColor.mainColor, - fontSize: 12.sp, - fontWeight: FontWeight.w500), - ), - ), - giftGridWidget(), - ], - ), - ), - // Container( - // height: 102.sp, - // margin: EdgeInsets.only(top: 12.sp,), - // decoration: BoxDecoration( - // borderRadius: BorderRadius.circular(10.sp), - // gradient: LinearGradient( - // colors: [Color(0xFF132B40), Color(0xFF251240)])), - // child: giftGridWidget(), - // ), - Container( - margin: EdgeInsets.only(top: 25.sp,), - padding: EdgeInsets.only(left: 15.sp, right: 15.sp), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - onTap: () { - Get.back(); - Get.back(); - }, - child: Container( - height: 42.sp, - width: 136.sp, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(21.sp), - color: Color(0x26FFFFFF) - ), - alignment: Alignment.center, - child: Text( - '放弃', - style: TextStyle( - color: Colors.white, - fontSize: 16.sp, - fontWeight: FontWeight.w600), - ), - ), - ), - GestureDetector( - onTap: () async { - if (selectedIndex < 0) { - showOKToast('请选择一个礼物'); - return; - } - var result = await DioManager.instance.post(url: Api.sendGift,params: {'accid':widget.accid,'giftId':giftId,'num':1,'toUserId':widget.accid!.split('_').last}); - if (result['code'] == 200) { - showOKToast('赠送成功'); - Get.back(); - } else if (result['code'] == 31201) { - showOKToast(result['msg']); - showRechargeScreenDialog(); - } - - }, - child: Container( - height: 42.sp, - width: 136.sp, - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(21.sp), - gradient: AppColor.mainVerLinearGradient - ), - child: Text( - '赠送', - style: TextStyle( - color: Colors.white, - fontSize: 16.sp, - fontWeight: FontWeight.w600), - ), - ), - ), - ], - ), - ) - ], - ), - ), - ), - ), - ); - } - - - giftGridWidget() { - return Container( - width: Get.width, - height: 120.sp, - padding: - EdgeInsets.only(left: 5.sp, right: 5.sp, top: 10.sp, bottom: 10.sp), - child: ListView.builder( - scrollDirection: Axis.horizontal, - itemCount: giftList.length, - itemBuilder: (context, index) { - // Replace the placeholders with the actual item widgets - return giftItemWidget(giftList[index], index); - }, - ), - ); - } - - giftItemWidget(Map info, int index) { - bool isSelected = giftId.contains(info['id'].toString()); - double price = info['price']; - - return GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - selectedIndex = index; - giftId = info['id'].toString(); - tipStr = info['topHours'] != null ? info['topHours'].toString() : ''; - setState(() {}); - }, - child: Container( - height: 120.sp, - width: 75.sp, - child: Stack( - fit: StackFit.expand, - children: [ - isSelected ? Image.asset(getMsgImage('gift_bg')) : Container(), - Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.network( - info['icon'], - width: 60.sp, - height: 60.sp, - ), - - Text(info['name'], - style: TextStyle( - color: Colors.white, - fontSize: 12.sp, - fontWeight: FontWeight.w500)), - Text('${price.toInt()}小票', - style: TextStyle( - color: Colors.white, - fontSize: 12.sp, - fontWeight: FontWeight.w500)) - ], - ) - ], - ), - ), - ); - } -} diff --git a/circle_app/lib/app/chat/widget/svg_dialog.dart b/circle_app/lib/app/chat/widget/svg_dialog.dart deleted file mode 100644 index 4108b0f..0000000 --- a/circle_app/lib/app/chat/widget/svg_dialog.dart +++ /dev/null @@ -1,55 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:flutter_svg/flutter_svg.dart'; -import 'package:get/get.dart'; -import 'package:svgaplayer_flutter/parser.dart'; -import 'package:svgaplayer_flutter/player.dart'; - -class SvgDialog extends StatefulWidget { - String url; - SvgDialog({Key? key,required this.url}) : super(key: key); - - @override - _SvgDialogState createState() => _SvgDialogState(); -} - -class _SvgDialogState extends State - with SingleTickerProviderStateMixin { - late SVGAAnimationController animationController; - - @override - void initState() { - animationController = SVGAAnimationController(vsync: this); - loadAnimation(); - super.initState(); - } - - @override - void dispose() { - this.animationController.dispose(); - super.dispose(); - } - - void loadAnimation() async { - final videoItem = await SVGAParser.shared.decodeFromURL( - widget.url); - animationController.videoItem = videoItem; - animationController - .forward() // Try to use .forward() .reverse() - .whenComplete(() { - Get.back(); - }); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - backgroundColor: Colors.transparent, - body: RSizedBox( - width: Get.width, - height: Get.height, - child: SVGAImage(animationController,fit: BoxFit.cover,), - ), - ); - } -} diff --git a/circle_app/lib/app/chat/widget/welcome_dialog.dart b/circle_app/lib/app/chat/widget/welcome_dialog.dart deleted file mode 100644 index 435f7e0..0000000 --- a/circle_app/lib/app/chat/widget/welcome_dialog.dart +++ /dev/null @@ -1,301 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:gradient_borders/box_borders/gradient_box_border.dart'; - -import '../../../common/Widgets/base_tip_widget.dart'; -import '../../../common/colors/app_color.dart'; -import '../../../network/api.dart'; -import '../../../network/dio_manager.dart'; -import '../../../util/util.dart'; - -class WelcomeDialog extends StatefulWidget { - Function callBack; - String userId; - - WelcomeDialog({super.key,required this.userId,required this.callBack}); - @override - _WelcomeDialogState createState() => new _WelcomeDialogState(); - -} - -class _WelcomeDialogState extends State { - // TODO: add state variables and methods - List giftList = []; - String giftId = ''; - String withStr = ''; - int selectedIndex = -1; - - TextEditingController descController = TextEditingController(); - - String tipStr = ''; - @override - void initState() { - // TODO: implement initState - super.initState(); - loadGiftData(); - } - - void loadGiftData() async { - var result = await DioManager.instance.get(url: Api.giftList); - if (result['code'] == 200) { - giftList = result['data']; - - // for (int i= 0; i< giftList.length; i++) { - // var info = giftList[i]; - // if (info['name'] == '浪漫告白') { - // selectedIndex = i ; - // giftId = info['id'].toString(); - // tipStr = info['topHours'] != null ? info['topHours'].toString() : ''; - // } - // } - - setState(() {}); - } - } - - @override - Widget build(BuildContext context) { - // TODO: add widget build method - return GestureDetector( - onTap: () { - FocusManager.instance.primaryFocus?.unfocus(); - }, - child: Scaffold( - backgroundColor: Colors.transparent, - resizeToAvoidBottomInset: false, - body: Center( - child: Container( - constraints: BoxConstraints( - maxHeight: 345.sp - ), - margin: EdgeInsets.only(left: 10.sp,right: 10.sp), - padding: EdgeInsets.only(left: 10.sp,right: 10.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10.sp), - gradient: LinearGradient(colors: [Color(0xFF4C3E5F),Color(0xFF324140)]), - border: GradientBoxBorder( - gradient: - AppColor.mainVerLinearGradient, - width: 1.sp, - ), - ), - child: Column( - children: [ - Container( - margin: EdgeInsets.only(top: 18.sp), - child: Text( - '❤️赠送礼物更容易获得对方的好感❤️', - style: TextStyle(color: Colors.white, fontSize: 15.sp), - ), - ), - Container( - height: tipStr.isNotEmpty ? 145.sp : 122.sp, - margin: EdgeInsets.only(top: 12.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10.sp), - gradient: LinearGradient( - colors: [Color(0xFF132B40), Color(0xFF251240)])), - child: Column( - children: [ - if (tipStr.isNotEmpty) - Padding( - padding: EdgeInsets.only(top:6.sp), - child: Text( - '礼物送出后,获得$tipStr小时的消息置顶', - style: TextStyle( - color: AppColor.mainColor, - fontSize: 12.sp, - fontWeight: FontWeight.w500), - ), - ), - giftGridWidget(), - ], - ), - ), - Container( - margin: EdgeInsets.only(top: 10.sp), - decoration: BoxDecoration( - color: Color(0xFF260C3E), - borderRadius: BorderRadius.circular(10.sp), - border: GradientBoxBorder( - gradient: - AppColor.mainVerLinearGradient, - width: 1.sp, - ), - ), - child: TextField( - controller: - descController, - maxLength: 20, - style: TextStyle( - color: Colors.white, - fontSize: 16.sp), - decoration: InputDecoration( - hintText: '输入欢迎内容,TA回复后就可以继续聊天啦', - hintStyle: TextStyle( - color: Colors.white70, - fontSize: 14.sp), - border: InputBorder.none, - counterText: '', - contentPadding: - EdgeInsets.only( - left: 14.sp)), - ), - ), - // Container( - // height: 102.sp, - // margin: EdgeInsets.only(top: 12.sp,), - // decoration: BoxDecoration( - // borderRadius: BorderRadius.circular(10.sp), - // gradient: LinearGradient( - // colors: [Color(0xFF132B40), Color(0xFF251240)])), - // child: giftGridWidget(), - // ), - Container( - margin: EdgeInsets.only(top: 25.sp,), - padding: EdgeInsets.only(left: 15.sp, right: 15.sp), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - onTap: () { - Get.back(); - }, - child: Container( - height: 42.sp, - width: 136.sp, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(21.sp), - color: Color(0x26FFFFFF) - ), - alignment: Alignment.center, - child: Text( - '放弃', - style: TextStyle( - color: Colors.white, - fontSize: 16.sp, - fontWeight: FontWeight.w600), - ), - ), - ), - GestureDetector( - onTap: () async { - if (descController.text.isEmpty) { - showOKToast('请输入欢迎内容,TA回复后就可以继续聊天啦'); - } else { - Map params = {'userId':widget.userId,'msg':descController.text}; - if (selectedIndex >= 0) { - params['giftId'] = giftId; - } - - var result = await DioManager.instance.post(url: Api.sayHelloV2,params: params); - if (result['code'] == 200) { - showOKToast('已成功欢迎,TA回复后就可以在消息列表继续聊天啦~'); - widget.callBack(); - Get.back(); - } else if (result['code'] == 31201) { - showOKToast(result['msg']); - showRechargeScreenDialog(); - } - } - }, - child: Container( - height: 42.sp, - width: 136.sp, - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(21.sp), - gradient: AppColor.mainVerLinearGradient - ), - child: Text( - '欢迎', - style: TextStyle( - color: Colors.white, - fontSize: 16.sp, - fontWeight: FontWeight.w600), - ), - ), - ), - ], - ), - ) - ], - ), - ), - ), - ), - ); - } - - - giftGridWidget() { - return Container( - width: Get.width, - height: 120.sp, - padding: - EdgeInsets.only(left: 5.sp, right: 5.sp, top: 10.sp, bottom: 10.sp), - child: ListView.builder( - scrollDirection: Axis.horizontal, - itemCount: giftList.length, - itemBuilder: (context, index) { - // Replace the placeholders with the actual item widgets - return giftItemWidget(giftList[index], index); - }, - ), - ); - } - - giftItemWidget(Map info, int index) { - bool isSelected = giftId.contains(info['id'].toString()); - double price = info['price']; - - return GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - if (selectedIndex == index) { - selectedIndex = -1; - tipStr = ''; - giftId = ''; - } else { - selectedIndex = index; - giftId = info['id'].toString(); - tipStr = info['topHours'] != null ? info['topHours'].toString() : ''; - } - - setState(() {}); - }, - child: Container( - height: 120.sp, - width: 75.sp, - child: Stack( - fit: StackFit.expand, - children: [ - isSelected ? Image.asset(getMsgImage('gift_bg')) : Container(), - Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.network( - info['icon'], - width: 60.sp, - height: 60.sp, - ), - - Text(info['name'], - style: TextStyle( - color: Colors.white, - fontSize: 12.sp, - fontWeight: FontWeight.w500)), - Text('${price.toInt()}小票', - style: TextStyle( - color: Colors.white, - fontSize: 12.sp, - fontWeight: FontWeight.w500)) - ], - ) - ], - ), - ), - ); - } -} diff --git a/circle_app/lib/app/chat/widget/wish_dialog.dart b/circle_app/lib/app/chat/widget/wish_dialog.dart deleted file mode 100644 index 3bed6c6..0000000 --- a/circle_app/lib/app/chat/widget/wish_dialog.dart +++ /dev/null @@ -1,326 +0,0 @@ -import 'dart:convert'; - -import 'package:circle_app/common/colors/app_color.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_pickers/pickers.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; - -import '../../../network/api.dart'; -import '../../../network/dio_manager.dart'; -import '../../circle/view.dart'; - -class WishDialog extends StatefulWidget { - String accId; - - WishDialog({super.key, required this.accId}); - @override - _WishDialogState createState() => new _WishDialogState(); -} - -class _WishDialogState extends State { - // TODO: add state variables and methods - List giftList = []; - String giftId = ''; - String withStr = ''; - int selectedIndex = 1; - String tipStr = ''; - - List optionList = [ - '可以考虑如你所愿', - '陪你逛一小时的街', - '陪你看一场电影', - '一起线下约饭', - '一起去旅游', - '分享一个本人视频', - '分享一张本人照片', - '给你我的联系方式', - '来一场浪漫的约会', - '来一次真诚的告白', - '玩一个刺激的游戏', - '透露一个小秘密', - '一起聊天半小时' - ]; - - @override - void initState() { - // TODO: implement initState - super.initState(); - loadGiftData(); - } - - void loadGiftData() async { - var result = await DioManager.instance.get(url: Api.giftList); - if (result['code'] == 200) { - giftList = result['data']; - for (int i = 0; i < giftList.length; i++) { - var info = giftList[i]; - if (info['name'] == '浪漫告白') { - selectedIndex = i; - giftId = info['id'].toString(); - tipStr = info['topHours'] != null ? info['topHours'].toString() : ''; - } - } - if (mounted) { - setState(() {}); - } - } - } - - giftGridWidget() { - return Container( - width: Get.width, - height: 120.sp, - padding: - EdgeInsets.only(left: 10.sp, right: 10.sp, top: 10.sp, bottom: 10.sp), - child: ListView.builder( - scrollDirection: Axis.horizontal, - itemCount: giftList.length, - itemBuilder: (context, index) { - // Replace the placeholders with the actual item widgets - return giftItemWidget(giftList[index], index); - }, - ), - ); - } - - giftItemWidget(Map info, int index) { - bool isSelected = giftId.contains(info['id'].toString()); - double price = info['price']; - - return GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - selectedIndex = index; - giftId = info['id'].toString(); - tipStr = info['topHours'] != null ? info['topHours'].toString() : ''; - setState(() {}); - }, - child: Container( - height: 120.sp, - width: 77.sp, - child: Stack( - fit: StackFit.expand, - children: [ - isSelected ? Image.asset(getMsgImage('gift_bg')) : Container(), - Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.network( - info['icon'], - width: 65.sp, - height: 65.sp, - ), - Text(info['name'], - style: TextStyle( - color: Colors.white, - fontSize: 12.sp, - fontWeight: FontWeight.w500)), - Text('${price.toInt()}小票', - style: TextStyle( - color: Colors.white, - fontSize: 12.sp, - fontWeight: FontWeight.w500)) - ], - ) - ], - ), - ), - ); - } - - @override - Widget build(BuildContext context) { - // TODO: add widget build method - return Scaffold( - backgroundColor: Colors.transparent, - body: Column( - children: [ - Expanded( - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - Get.back(); - }, - child: Container())), - SafeArea( - child: Container( - padding: EdgeInsets.only(left: 15.sp, right: 15.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.only( - topRight: Radius.circular(10.sp), - bottomRight: Radius.circular(10.sp)), - color: Color(0xFF423055), - ), - child: Column( - children: [ - Container( - margin: EdgeInsets.only(top: 8.sp, bottom: 15.sp), - width: 30.sp, - height: 3.sp, - decoration: BoxDecoration( - color: Color(0x33FFFFFF), - borderRadius: BorderRadius.circular(1.5.sp)), - ), - Text( - '对方满足你的愿望后要尽快兑现承诺哈,感恩是你们建立稳定关系的保障哦~', - style: TextStyle(color: Colors.white, fontSize: 15.sp), - ), - Container( - height: tipStr.isNotEmpty ? 145.sp : 122.sp, - margin: EdgeInsets.only(top: 12.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10.sp), - gradient: LinearGradient( - colors: [Color(0xFF132B40), Color(0xFF251240)])), - child: Column( - children: [ - if (tipStr.isNotEmpty) - Padding( - padding: EdgeInsets.only(top: 6.sp), - child: Text( - '礼物送出后,获得$tipStr小时的消息置顶', - style: TextStyle( - color: AppColor.mainColor, - fontSize: 12.sp, - fontWeight: FontWeight.w500), - ), - ), - giftGridWidget(), - ], - ), - ), - GestureDetector( - onTap: () { - showOptionPiker(withStr); - }, - // behavior: HitTestBehavior.opaque, - child: Container( - height: 30.sp, - padding: EdgeInsets.only(left: 10.sp, right: 10.sp), - margin: EdgeInsets.only(top: 12.sp), - decoration: BoxDecoration( - color: Color(0x1AFFFFFF), - borderRadius: BorderRadius.circular(15.sp)), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - '选择感恩方式', - style: TextStyle( - color: Color(0xB3FFFFFF), fontSize: 15.sp), - ), - Row( - children: [ - Text( - withStr.isNotEmpty ? withStr : '请选择', - style: TextStyle( - color: withStr.isNotEmpty - ? AppColor.mainColor - : Colors.white, - fontSize: 15.sp), - ), - Image.asset( - getHomeImage('icon_in'), - width: 24.sp, - ) - ], - ), - ], - ), - )), - Container( - margin: EdgeInsets.only(top: 12.sp, bottom: 15.sp), - padding: EdgeInsets.only(left: 30.sp, right: 30.sp), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - onTap: () { - if (selectedIndex < 0) { - showOKToast('请选择一个礼物'); - return; - } - var info = giftList[selectedIndex]; - sendInventWishCustomMsg( - widget.accId, jsonEncode(info), '邀请你许个愿'); - }, - child: Container( - height: 42.sp, - width: 136.sp, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(21.sp), - gradient: AppColor.mainVerLinearGradient, - ), - alignment: Alignment.center, - child: Text( - '邀请对方许愿', - style: TextStyle( - color: Colors.white, - fontSize: 16.sp, - fontWeight: FontWeight.w600), - ), - ), - ), - GestureDetector( - onTap: () { - if (selectedIndex < 0) { - showOKToast('请选择一个礼物'); - return; - } else if (withStr.isEmpty) { - showOKToast('请选择感恩方式'); - return; - } - var info = giftList[selectedIndex]; - info['option'] = withStr; - sendGetWishCustomMsg(widget.accId, jsonEncode(info), - '许愿:想要${info['name']}'); - }, - child: Container( - height: 42.sp, - width: 136.sp, - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(21.sp), - gradient: const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFF7660FF), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - child: Text( - '立即许愿', - style: TextStyle( - color: Colors.white, - fontSize: 16.sp, - fontWeight: FontWeight.w600), - ), - ), - ), - ], - ), - ) - ], - ), - ), - ) - ], - ), - ); - } - - showOptionPiker(String text) { - Pickers.showSinglePicker(context, - pickerStyle: DefaultPickerStyle.dark(), - data: optionList, - selectData: text.isNotEmpty ? text : optionList[2], - onConfirm: (p, position) { - withStr = p; - setState(() {}); - }); - } -} diff --git a/circle_app/lib/app/circle/binding.dart b/circle_app/lib/app/circle/binding.dart deleted file mode 100644 index bc5c673..0000000 --- a/circle_app/lib/app/circle/binding.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:get/get.dart'; - -import 'logic.dart'; - -class CircleBinding extends Bindings { - @override - void dependencies() { - Get.put(() => CircleLogic()); - } -} diff --git a/circle_app/lib/app/circle/discover_page.dart b/circle_app/lib/app/circle/discover_page.dart deleted file mode 100644 index 0fb5501..0000000 --- a/circle_app/lib/app/circle/discover_page.dart +++ /dev/null @@ -1,34 +0,0 @@ -import 'package:circle_app/app/circle/widgets/discover.dart'; -import 'package:circle_app/components/my_app_bar.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:flutter/material.dart'; - -class DiscoverPage extends StatefulWidget { - @override - _DiscoverPageState createState() => new _DiscoverPageState(); -} - -class _DiscoverPageState extends State { - // TODO: add state variables and methods - - @override - Widget build(BuildContext context) { - // TODO: add widget build method - return Container( - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage(getBaseImage("bg")), - fit: BoxFit.cover, - ), - ), - child: Scaffold( - backgroundColor: Colors.transparent, - appBar: const MyAppBar( - centerTitle: '已解锁的圈友', - // actionWdiget: , - ), - - body: Discover(1), - )); - } -} diff --git a/circle_app/lib/app/circle/logic.dart b/circle_app/lib/app/circle/logic.dart deleted file mode 100644 index 89d82d5..0000000 --- a/circle_app/lib/app/circle/logic.dart +++ /dev/null @@ -1,1183 +0,0 @@ -import 'dart:async'; -import 'dart:convert'; -import 'dart:io'; - -import 'package:circle_app/app/chat/widget/welcome_dialog.dart'; -import 'package:circle_app/app/likelist/logic.dart'; -import 'package:circle_app/app/minefragment/logic.dart'; -import 'package:circle_app/main.dart'; -import 'package:circle_app/router/app_routers.dart'; -import 'package:circle_app/util/device.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_bmflocation/flutter_bmflocation.dart'; -import 'package:flutter_swiper/flutter_swiper.dart'; -import 'package:geolocator/geolocator.dart'; -import 'package:get/get.dart'; -import 'package:permission_handler/permission_handler.dart'; -import 'package:pull_to_refresh/pull_to_refresh.dart'; -import '../../common/Widgets/open_vip_tip/view.dart'; -import '../../network/api.dart'; -import '../../network/dio_manager.dart'; -import '../../util/eventBus.dart'; -import '../../util/newbie_guide_tip.dart'; -import '../select_circle/logic.dart'; -import '../userinfo/logic.dart'; -import 'state.dart'; -import 'package:scroll_to_index/scroll_to_index.dart'; -import '../../util/util.dart'; -class CircleLogic extends GetxController { - final LocationFlutterPlugin _myLocPlugin = LocationFlutterPlugin(); - BaiduLocationAndroidOption? _options; - bool _suc = false; - Position? position; - PageController pageController = - PageController(initialPage: 1, viewportFraction: 0.8); - SwiperController swiperController = SwiperController(); - final RefreshController refreshController = RefreshController(); - final RefreshController peopleRefreshController = RefreshController(); - - - bool isShowLocationDialog = false; - - InterestsBean circle = InterestsBean(lists: []); - final CircleState state = CircleState(); - var statistics = Rx( - DataModel(visitCount: 0, lastVisitUsers: [], likeMeCount: 0)); - List lists = []; - //Map? statistics; - int page = 1; - - int vicinityPage = 1; - int currentPage = 0; - - bool isNewPeopleMore = true; - - bool isLoadFail = false; - - bool isNewPeopleRed = false; - - bool isNearLoad = true; - - int flush = 0; - bool isMore = true; - int myVip = -1; - bool isShowCircle = true; - String cityName = ""; - - Map recommendCircleFriendData = {}; - List openCallOutIdList = []; - List bannerList = []; - - List genderList - = []; - - List orientationList = []; - - List roleList = []; - - List dis_genderList = []; - - List dis_orientationList = []; - - List dis_roleList = []; - - - List new_genderList = []; - - List new_orientationList = []; - - List new_roleList = []; - - - List newPeopleList = []; - - - AutoScrollController scrollController = AutoScrollController(); - ScrollController listScrollController = ScrollController(); - - Timer? t; - int seconds = 0; - - bool? isNewPeople; - - @override - void onClose() { - // TODO: implement onClose - super.onClose(); - t?.cancel(); - } - - @override - void onInit() { - super.onInit(); - loadRecommendCircleFriendData(); - loadCircleListData(); - loadCirclePeopleData(); - initGerder(); - getCityList(); - - getBanner(); - // getNearByList(); - startTimer(); - - EventBusManager.on().listen((event) { - myVip = event.vip; - update(); - }); - } - - startTimer() { - t = Timer.periodic(const Duration(milliseconds: 1000), (timer) { - seconds++; - if (seconds == 10) { - t?.cancel(); //清除 - loadNewUserRewardData(); - } - - }); - } - - loadData() { - loadCircleListData(); - loadCirclePeopleData(); - initGerder(); - getCityList(); - } - - void loadNewUserRewardData() async { - var data = await DioManager.instance.get(url: Api.newUserConfig); - if (data['code'] == 200) { - if (data['data']['isShow']) { - if (!data['data']['todayHasReceivedReward']) { - Get.bottomSheet( - NewbieGuideTip( - data: data['data'], - ), - isScrollControlled: true, - enableDrag: false, - ); - } - } - } - } - - - loadCircleListData() async { - var data = await DioManager.instance.get( - url: Api.getCircleInterests, params: {"page": page, 'page_size': 20}); - var bean = BaseResponse.fromJson( - data, (data) => InterestsBean.fromJson(data)); - if (bean.data is InterestsBean && bean.isSuccess()) { - circle = bean.data!; - if (circle.lists.length < 20) { - isMore = false; - } - - update(); - } - } - - void initGerder() async { - var data1 = - await DioManager.instance.get(url: Api.getCircleList, params: {}); - var bean1 = BaseResponse.fromJson( - data1, (data1) => ConfigBean.fromJson(data1)); - - if (bean1.isSuccess()) { - ConfigBean configBean = bean1.data!; - - configBean.genderMap.forEach((key, value) { - genderList.add(MyConfigData(key, value, false)); - dis_genderList.add(MyConfigData(key, value, false)); - new_genderList.add(MyConfigData(key, value, false)); - }); - - configBean.orientationMap.forEach((key, value) { - orientationList.add(MyConfigData(key, value, false)); - dis_orientationList.add(MyConfigData(key, value, false)); - new_orientationList.add(MyConfigData(key, value, false)); - }); - configBean.roleMap.forEach((key, value) { - roleList.add(MyConfigData(key, value, false)); - dis_roleList.add(MyConfigData(key, value, false)); - new_roleList.add(MyConfigData(key, value, false)); - }); - } - } - - List provinceList = []; - - Map cityMap = {}; - - getCityList() async { - try { - String jsonString = await rootBundle.loadString('assets/province.json'); - List jsonData = json.decode(jsonString); - provinceList = - jsonData.map((dynamic item) => Province.fromJson(item)).toList(); - cityMap.clear(); - for (int i = 0; i < provinceList.length; i++) { - Map areaMap = {}; - for (int c = 0; c < provinceList[i].city.length; c++) { - String cityName = provinceList[i].city[c].name; - areaMap[cityName] = []; // 不再存储区域列表,直接设置为空列表 - } - cityMap[provinceList[i].name] = areaMap; - } - } catch (e) { - print('Error loading JSON file: $e'); - } - } - - loadMore() async { - if (!isMore) return; - page = page + 1; - var data = await DioManager.instance.get( - url: Api.getCircleInterests, params: {"page": page, 'page_size': 20}); - var bean = BaseResponse.fromJson( - data, (data) => InterestsBean.fromJson(data)); - - InterestsBean newcircle = bean.data!; - if (newcircle.lists.isNotEmpty) { - if (newcircle.lists.length < 20) { - isMore = false; - } - circle.lists.addAll(newcircle.lists); - update(); - } - } - - outCircle(String interest_id, bool isStatus) async { - var data = await DioManager.instance.post( - url: "${Api.outCrrcle}$interest_id/join", - params: {"status": isStatus ? "0" : "1"}); - var bean = BaseResponse.fromJson(data, (data) => data); - if (bean.code == 200) { - circle.lists.forEach((element) { - if (element.id.toString() == interest_id.toString()) { - element.isJoin = !isStatus; - } - }); - - } - showOKToast(bean.msg); - } - - updateCircleInfo(Circle circleInfo) { - for (int i = 0; i < circle.lists.length; i++) { - Circle temp = circle.lists[i]; - if (temp.id == circleInfo.id) { - circle.lists[i] = circleInfo; - break; - } - } - update(); - } - - setCircle(String circleId) { - circle.lists.forEach((element) { - if (element.id.toString() == circleId.toString()) { - element.isJoin = true; - } - }); - } - - //访问我的圈子人数 - loadCirclePeopleData() async { - var data = await DioManager.instance.get(url: Api.getInterestsCount); - var myAlbumBean = BaseResponse.fromJson( - data, (data) => DataModel.fromJson(data)); - - if (data['code'] == 200) { - statistics.value = myAlbumBean.data; - update(); - } - } - - Circle getCircleIndex() { - return circle.lists[state.index]; - } - - void pushHome(String userId) { - Get.toNamed(AppRoutes.UserInfoActivity, arguments: userId); - } - - void getPipeiData() async { - var data = await DioManager.instance.get(url: Api.getMatch); - if (data['code'] == 200) { - //发送消息 - bool isSuccess = await createCustomMsg( - data['data']['account_id'].toString().split('_').last, - data['data']['account_id']); - if (!isSuccess) { - await sendTextMsg(data['data']['account_id']); - } - } else if (data['code'] == 21201) { - showOKToast(data['msg']); - showRechargeDialog(); - } else { - showOKToast(data['msg']); - } - } - - showRechargeDialog() { - Get.bottomSheet( - Scaffold( - backgroundColor: Colors.transparent, - body: Open_vip_tipPage(true), - ), - isScrollControlled: true, - enableDrag: false); - } - - void getBanner() async { - var data = - await DioManager.instance.get(url: Api.getNearbyBeanner, params: {}); - var bean = BaseResponse.fromJson( - data, (data) => BannerList.fromJson(data)); - if (bean.code == 200) { - bannerList.clear(); - bannerList.addAll(bean.data.banners); - } - - } - - int offset = 0; - int deep = 0; - int chargeFreeNum = 0; - int chargeType = 0; - List vicinityList = []; - - int pageIndex = 1; - - void getNearByList() async { - List genders = []; - genderList.forEach((element) { - if (element.isSelect) { - genders.add(element.id); - } - }); - List roles = []; - roleList.forEach((element) { - if (element.isSelect) roles.add(element.id); - }); - - List orientations = []; - orientationList.forEach((element) { - if (element.isSelect) orientations.add(element.id); - }); - if (offset == 0) { - getBanner(); - } - - var data = await DioManager.instance.post(url: Api.postNearbyList, params: { - "offset": offset, - 'deep': deep, - 'city': cityName, - "genders": genders, - "roles": roles, - 'flush': flush, - "orientations": orientations - }); - isNearLoad = false; - var bean = BaseResponse.fromJson( - data, (data) => VicinityBean.fromJson(data)); - - - if (bean.code == 200) { - if (flush == 1) { - flush = 0; - } - try { - offset = bean.data.offset; - deep = bean.data.deep; - } catch (Exception) {} - chargeFreeNum = bean.data.chargeFreeNum; - chargeType = bean.data.chargeType; - myVip = bean.data.isVip ? 1 : 0; - if (vicinityPage == 1) { - cityName = bean.data.city; - - vicinityList.clear(); - } - - if (vicinityPage == 1) { - refreshController.refreshCompleted(); - } else { - refreshController.loadComplete(); - } - - - try { - - if (vicinityPage == 1) { - vicinityList.addAll(bean.data.users); - } else { - List info = []; - bean.data.users.forEach((element) { - bool isContain = false; - vicinityList.forEach((listInfo) { - - if (listInfo.id == element.id) { - isContain = true; - } - }); - if (!isContain) { - info.add(element); - } - }); - if (info.isNotEmpty) { - vicinityList.addAll(info); - refreshController.loadComplete(); - } else { - refreshController.loadNoData(); - } - } - - vicinityPage = vicinityPage + 1; - } on Exception {} - update(); - - - if (position == null) { - try { - if (!Platform.isAndroid) { - bool hasLocationPermission = await requestLocationPermission(); - if (hasLocationPermission) { - // 权限申请通过 - position = await getCurrentPosition(); - await getCurrentCity(); - // refreshVicinityData(); - - } else if (isShowLocationDialog == false) { - isShowLocationDialog = true; - locationDialog(); - } - } else { - if (Platform.isAndroid) { - locationResult(); - initAndroidOptions(); - } - } - - } catch (e) { - print(e); - } - } - } else if (bean.code == 21201) { - showOKToast(bean.msg); - if (vicinityPage == 1) { - showVipDialog(); - } - myVip = 0; - refreshController.loadComplete(); - update(); - } else if (bean.code == 404) { - showOKToast(bean.msg); - } - update(); - } - - getCurrentCity() async { - var data = await DioManager.instance.get(url: Api.getCity + '${position!.longitude!}/' + '${position!.latitude!}',); - if (data['code'] == 200) { - cityName = data['data']['city']; - vicinityPage = 1; - refreshVicinityData(); - } - } - - getNewPeopleListData() async { - isLoadFail = false; - List genders = []; - new_genderList.forEach((element) { - if (element.isSelect) { - genders.add(element.id); - } - }); - List roles = []; - new_roleList.forEach((element) { - if (element.isSelect) roles.add(element.id); - }); - - List orientations = []; - new_orientationList.forEach((element) { - if (element.isSelect) orientations.add(element.id); - }); - if (offset == 0) { - getBanner(); - } - - var data = await DioManager.instance.post(url: Api.queryNewUserList, params: { - "page": pageIndex, - 'pageSize': 10, - "genders": genders, - "roles": roles, - "orientations": orientations - }); - - if (data['code'] == 200) { - List list = data['data']; - if (list.isNotEmpty) { - peopleRefreshController.refreshCompleted(); - peopleRefreshController.loadComplete(); - // "signature" -> "/////////////////" - List info = []; - list.forEach((element) { - bool isContain = false; - newPeopleList.forEach((listInfo) { - if (listInfo['id']! == element['id']) { - isContain = true; - } - }); - if (!isContain) { - info.add(element); - } - }); - if (info.isNotEmpty) { - newPeopleList.addAll(info); - } - pageIndex = pageIndex + 1; - } else { - peopleRefreshController.loadNoData(); - isNewPeopleMore = false; - } - update(); - } else if (data['code'] == 404) { - isLoadFail = true; - showOKToast('网络不流畅哦,请检查网络情况'); - update(); - } else { - isNewPeopleMore = false; - } - } - - - - void loadRecommendCircleFriendData() async { - var data = await DioManager.instance.get( - url: Api.chatRecommendFriend, - ); - - if (data['code'] == 200) { - List dataList = data['data']; - if (dataList.isNotEmpty) { - recommendCircleFriendData = data['data'][0]; - } - update(); - } else { - - if ((data['code'] == 21201 || data['code'] == 21202) && recommendCircleFriendData.isNotEmpty) { - showOKToast(data['msg']); - showVipDialog(); - } - } - } - - void onRefresh() async { - pageIndex = 1; - newPeopleList.clear(); - isNewPeopleMore = true; - peopleRefreshController.resetNoData(); - update(); - getNewPeopleListData(); - } - - void onLoading() async { - - getNewPeopleListData(); - } - - - - initAndroidOptions() async { - _myLocPlugin.setAgreePrivacy(true); - - // bool _serviceEnabled; - // PermissionStatus _permissionGranted; - // - // _serviceEnabled = await location.serviceEnabled(); - // if (!_serviceEnabled) { - // _serviceEnabled = await location.requestService(); - // if (!_serviceEnabled) { - // return; - // } - // } - // - // _permissionGranted = await location.hasPermission(); - // if (_permissionGranted == PermissionStatus.denied) { - // _permissionGranted = await location.requestPermission(); - // if (_permissionGranted != PermissionStatus.granted) { - // return; - // } - // } - - - - // 申请权限 - bool hasLocationPermission = await requestLocationPermission(); - if (hasLocationPermission) { - // 权限申请通过 - } else if (isShowLocationDialog == false) { - isShowLocationDialog = true; - locationDialog(); - return; - } else { - return; - } - - BaiduLocationAndroidOption options = BaiduLocationAndroidOption( -// 定位模式,可选的模式有高精度、仅设备、仅网络。默 -// 认为高精度模式 - locationMode: BMFLocationMode.hightAccuracy, -// 是否需要返回地址信息 - isNeedAddress: false, -// 是否需要返回海拔高度信息 - isNeedAltitude: false, -// 是否需要返回周边poi信息 - isNeedLocationPoiList: false, -// 是否需要返回新版本rgc信息 - isNeedNewVersionRgc: false, -// 是否需要返回位置描述信息 - isNeedLocationDescribe: false, -// 是否使用gps - openGps: true, -// 可选,设置场景定位参数,包括签到场景、运动场景、出行场景 - locationPurpose: BMFLocationPurpose.sport, -// 坐标系 - coordType: BMFLocationCoordType.bd09ll, -// 设置发起定位请求的间隔,int类型,单位ms -// 如果设置为0,则代表单次定位,即仅定位一次,默认为0 - scanspan: 0); - _options = options; - - BaiduLocationIOSOption iosoptions = BaiduLocationIOSOption( - // 坐标系 - coordType: BMFLocationCoordType.bd09ll, - // 位置获取超时时间 - locationTimeout: 10, - // 获取地址信息超时时间 - reGeocodeTimeout: 10, - // 应用位置类型 默认为automotiveNavigation - activityType: BMFActivityType.automotiveNavigation, - // 设置预期精度参数 默认为best - desiredAccuracy: BMFDesiredAccuracy.best, - // 是否需要最新版本rgc数据 - isNeedNewVersionRgc: true, - // 指定定位是否会被系统自动暂停 - pausesLocationUpdatesAutomatically: false, - // 指定是否允许后台定位, - // 允许的话是可以进行后台定位的,但需要项目 - // 配置允许后台定位,否则会报错,具体参考开发文档 - allowsBackgroundLocationUpdates: false, - // 设定定位的最小更新距离 - distanceFilter: 10, - ); - - if (!Platform.isIOS) { - Map iosMap = iosoptions.getMap(); - Map androidMap = _options!.getMap(); - - bool result = await _myLocPlugin.prepareLoc(androidMap, iosMap); - _suc = await _myLocPlugin.startLocation(); - - print(_suc); - } - } - - /// 申请定位权限 - /// 授予定位权限返回true, 否则返回false - Future requestLocationPermission() async { - //获取当前的权限 - var status = await Permission.location.status; - if (status == PermissionStatus.granted) { - //已经授权 - return true; - } else { - //未授权则发起一次申请 - status = await Permission.location.request(); - if (status == PermissionStatus.granted) { - return true; - } else { - return false; - } - } - } - - locationResult() async { - if (Platform.isIOS) { - //接受定位回调 - _myLocPlugin.singleLocationCallback(callback: (BaiduLocation result) { - //result为定位结果 - }); - } else if (Platform.isAndroid) { - //接受定位回调 - _myLocPlugin.seriesLocationCallback(callback: (BaiduLocation result) async { - //result为定位结果 - print(result); - _myLocPlugin.stopLocation(); - position = Position(latitude: result.latitude ?? 0,longitude: result.longitude ?? 0,timestamp: DateTime.now(), accuracy: 0.0, altitude: 0.0, heading: 0.0, speed: 0.0, speedAccuracy: 0.0,); - await getCurrentCity(); - }); - } - } - - refreshVicinityData() { - vicinityPage = 1; - offset = 0; - getNearByList(); - } - - void snedHelloData(int id,int index) async { - Get.bottomSheet(WelcomeDialog(userId: id.toString(),callBack:() { - newPeopleList.removeAt(index); - update(); - if (newPeopleList.length < 5) { - onLoading(); - } - }),isScrollControlled: true,); - // var data = await DioManager.instance.post(url: Api.sayHello + id.toString(),); - // if (data['code'] == 200) { - // - - // showOKToast('已成功欢迎,TA回复后就可以在消息列表继续聊天啦~'); - // } - } - void snedHelloMoreData() async { - var data = await DioManager.instance.post(url: Api.sayHelloMore,); - if (data['code'] == 200) { - onRefresh(); - showOKToast('已成功欢迎最新加入的30人,TA回复后就可以在消息列表继续聊天啦~'); - } else if (data['code'] == 21202) { - showRechargeDialog(); - } - } - - -} - -class VicinityBean { - String city; - int offset; - bool isVip; - int deep; - int chargeFreeNum; - int chargeType; - List users; - - VicinityBean( - {required this.city, - required this.users, - required this.isVip, - required this.offset, - required this.chargeFreeNum, - required this.chargeType, - required this.deep}); - - factory VicinityBean.fromJson(Map json) { - List listsJson = json['users']; - List lists = - listsJson.map((e) => VicinityItemBean.fromJson(e)).toList(); - return VicinityBean( - users: lists, - isVip: json['isVip'] ?? false, - city: json['city'], - chargeType: json['chargeType'], - chargeFreeNum: json['chargeFreeNum'], - offset: json['offset'], - deep: json['deep']); - } -} - -class VicinityItemBean { - final int id; - final String nickname; - final String avatar; - final String signature; - final String birthday; - final int age; - final int vip; - final int mark; - final int gender; - final int role; - final int orientation; - final double lng; - final double lat; - final String city; - final String imId; - - final List interests; - final List images; - final String avatarThumb; - final String genderName; - final String roleName; - final String orientationName; - final String bgPicUrl; - final String onlineFlag; - final String joinFlag; - final bool isOnline; - - VicinityItemBean({ - required this.id, - required this.nickname, - required this.avatar, - required this.signature, - required this.birthday, - required this.mark, - required this.age, - required this.vip, - required this.gender, - required this.role, - required this.imId, - required this.orientation, - required this.lng, - required this.lat, - required this.city, - required this.interests, - required this.images, - required this.avatarThumb, - required this.genderName, - required this.roleName, - required this.orientationName, - required this.bgPicUrl, - required this.onlineFlag, - required this.joinFlag, - required this.isOnline, - }); - - factory VicinityItemBean.fromJson(Map json) { - var interestList = json['interests'] != null ? json['interests'] as List : []; - List interests = - interestList.map((interest) => Interest.fromJson(interest)).toList(); - - return VicinityItemBean( - id: json['id'], - nickname: json['nickname'], - imId: json['imId'] ?? '', - avatar: json['avatar'], - mark: json['mark'] ?? 0, - joinFlag: json['joinFlag'] ?? '', - signature: json['signature'], - birthday: json['birthday'], - age: json['age'], - vip: json['vip'], - gender: json['gender'], - role: json['role'], - orientation: json['orientation'], - lng: json['lng'], - lat: json['lat'], - city: json['city'], - interests: interests, - images: List.from(json['images']), - avatarThumb: json['avatar_thumb'], - genderName: json['gender_name'], - roleName: json['role_name'], - orientationName: json['orientation_name'], - bgPicUrl: json['bg_picUrl'], - onlineFlag: json.containsKey('online_flag') ? json['online_flag'] : json['onlineFlag'] ?? '', - isOnline: json['isOnline'] == 1 || json['isOnline'] == true, - ); - } -} - -// class Interest { -// final int id; -// final String title; -// final String intro; -// final String image; -// final double amount; -// final double oldAmount; -// final String iosItem; -// final DateTime lastCalloutTime; -// final DateTime lastJoinTime; -// final bool isJoin; -// final bool isLike; -// final bool isLimit; -// final int viewTotal; -// final int joinTotal; -// -// Interest({ -// required this.id, -// required this.title, -// required this.intro, -// required this.image, -// required this.amount, -// required this.oldAmount, -// required this.iosItem, -// required this.lastCalloutTime, -// required this.lastJoinTime, -// required this.isJoin, -// required this.isLike, -// required this.isLimit, -// required this.viewTotal, -// required this.joinTotal, -// }); -// factory Interest.fromJson(Map json) { -// return Interest( -// id: json['id'], -// title: json['title'], -// intro: json['intro'], -// image: json['image'], -// amount: json['amount'], -// oldAmount: json['oldAmount'], -// iosItem: json['iosItem'], -// lastCalloutTime: DateTime.parse(json['lastCalloutTime']), -// lastJoinTime: DateTime.parse(json['lastJoinTime']), -// isJoin: json['isJoin'], -// isLike: json['isLike'], -// isLimit: json['isLimit'], -// viewTotal: json['viewTotal'], -// joinTotal: json['joinTotal'], -// ); -// } -// } - -class InterestsBean { - List lists; - - InterestsBean({required this.lists}); - - factory InterestsBean.fromJson(Map json) { - List listsJson = json.containsKey('lists') ? json['lists'] : json; - List lists = listsJson.map((e) => Circle.fromJson(e)).toList(); - return InterestsBean(lists: lists); - } -} - -class Circle { - int id; - String image; - String title; - String intro; - String ios_item; - double amount; - bool is_limit; - bool is_top; - double oldAmount; - String lastCalloutTime; - bool isJoin; - dynamic isLike; - int viewTotal; - int joinTotal; - List lastJoinUsers; - - Circle({ - required this.id, - required this.is_limit, - required this.image, - required this.ios_item, - required this.title, - required this.intro, - required this.amount, - required this.oldAmount, - required this.is_top, - required this.lastCalloutTime, - required this.isJoin, - required this.isLike, - required this.viewTotal, - required this.joinTotal, - required this.lastJoinUsers, - }); - - Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['is_limit'] = this.is_limit; - data['image'] = this.image; - data['ios_item'] = this.ios_item; - data['title'] = this.title; - data['intro'] = this.intro; - data['amount'] = this.amount; - data['old_amount'] = this.oldAmount; - data['view_total'] = this.viewTotal; - data['join_total'] = this.joinTotal; - if (this.lastJoinUsers.isNotEmpty) { - var list = this.lastJoinUsers.map((e) => e.toJson()).toList(); - data['last_join_users'] = list; - } - - return data; - } - - factory Circle.fromJson(Map json) { - List lastJoinUsers = []; - if (json.containsKey('last_join_users')) { - List lastJoinUsersJson = json['last_join_users']; - lastJoinUsers = - lastJoinUsersJson.map((e) => JoinUser.fromJson(e)).toList(); - } - - - return Circle( - id: json['id'], - is_top: json['is_top'] ?? false, - is_limit: json['is_limit'] ?? false, - image: json['image'] ?? '', - ios_item: json['ios_item'] ?? '', - title: json['title'] ?? '', - intro: json['intro'] ?? '', - amount: json.containsKey('amount') ? json['amount'].toDouble() ?? 0 : 0, - oldAmount: json.containsKey('amount') ? json['old_amount'].toDouble() ?? 0 : 0, - lastCalloutTime: json['last_callout_time'] ?? '', - isJoin: json['is_join'] ?? false, - isLike: json['is_like'] ?? false, - viewTotal: json['view_total'] ?? 0, - joinTotal: json['join_total'] ?? 0, - lastJoinUsers: lastJoinUsers, - ); - } -} - -class JoinUser { - int id; - String avatar; - String nickname; - - - Map toJson() { - final Map data = new Map(); - data['avatar'] = this.avatar; - return data; - } - - JoinUser({ - required this.id, - required this.avatar, - required this.nickname, - }); - - - factory JoinUser.fromJson(Map json) { - return JoinUser( - id: json['id'], - avatar: json['avatar'], - nickname: json['nickname'], - ); - } -} - -class LastJoinUser { - int id; - String avatar; - String nickname; - - LastJoinUser({ - required this.id, - required this.avatar, - required this.nickname, - }); - - factory LastJoinUser.fromJson(Map json) { - return LastJoinUser( - id: json['id'], - avatar: json['avatar'], - nickname: json['nickname'], - ); - } -} - -class DataModel { - int visitCount = 0; - - List lastVisitUsers = []; - - int likeMeCount = 0; - - DataModel( - {required this.visitCount, - required this.lastVisitUsers, - required this.likeMeCount}); - - factory DataModel.fromJson(Map json) { - return DataModel( - visitCount: json['visit_count'], - lastVisitUsers: json['last_visit_users'], - likeMeCount: json['like_me_count'], - ); - } -} - -class Province { - String name; - List city; - - Province({required this.name, required this.city}); - - factory Province.fromJson(Map json) { - List cityData = json['city']; - List cityList = - cityData.map((dynamic item) => CityBean.fromJson(item)).toList(); - - return Province( - name: json['name'], - city: cityList, - ); - } - - @override - String getPickerViewText() { - return this.name; - } -} - -class CityBean { - String name; - List area; - - CityBean({required this.name, required this.area}); - - factory CityBean.fromJson(Map json) { - List areaData = json['area']; - List areaList = - areaData.map((dynamic item) => item.toString()).toList(); - - return CityBean( - name: json['name'], - area: areaList, - ); - } -} - -class BannerItem { - final String name; - final int type; - final String? param; - final String scene; - final String picUrl; - - BannerItem({ - required this.name, - required this.type, - this.param, - required this.scene, - required this.picUrl, - }); - - factory BannerItem.fromJson(Map json) { - return BannerItem( - name: json['name'], - type: json['type'], - param: json['param'], - scene: json['scene'], - picUrl: json['pic_url'], - ); - } -} - -class BannerList { - final String city; - final List banners; - - BannerList({required this.banners, required this.city}); - - factory BannerList.fromJson(Map json) { - final bannerList = json['banners'] as List; - final banners = - bannerList.map((item) => BannerItem.fromJson(item)).toList(); - - return BannerList(banners: banners, city: json['city']); - } -} diff --git a/circle_app/lib/app/circle/state.dart b/circle_app/lib/app/circle/state.dart deleted file mode 100644 index 3aef2b1..0000000 --- a/circle_app/lib/app/circle/state.dart +++ /dev/null @@ -1,193 +0,0 @@ -import 'package:get/get_rx/src/rx_types/rx_types.dart'; - -import 'logic.dart'; - -class CircleState { - String msg = ''; - int index = 0; - CircleState() { - ///Initialize variables - } -} - - -class Lists { - List? album; - Chat? chat; - String? content; - int? id; - bool? isQueen; - User? user; - Map? interest; - String? create_time; - Lists( - {this.album, this.chat, this.content, this.id, this.isQueen, this.user}); - - Lists.fromJson(Map json) { - if (json['album'] != null) { - album = []; - json['album'].forEach((v) { - album!.add(new Album.fromJson(v)); - }); - } - chat = json['chat'] != null ? new Chat.fromJson(json['chat']) : null; - content = json['content']; - id = json['id']; - interest = json['interest'] ?? {}; - create_time = json['create_time'] ?? ''; - isQueen = json['is_queen']; - user = json['user'] != null ? new User.fromJson(json['user']) : null; - } - - Map toJson() { - final Map data = new Map(); - if (this.album != null) { - data['album'] = this.album!.map((v) => v.toJson()).toList(); - } - if (this.chat != null) { - data['chat'] = this.chat!.toJson(); - } - data['content'] = this.content; - data['id'] = this.id; - data['is_queen'] = this.isQueen; - if (this.user != null) { - data['user'] = this.user!.toJson(); - } - return data; - } -} - -class Album { - int? type; - String? url; - String? create_time; - - Album({this.type, this.url}); - - Album.fromJson(Map json) { - type = json['type']; - url = json['url']; - create_time = json['create_time'] ?? ''; - } - - Map toJson() { - final Map data = new Map(); - data['type'] = this.type; - data['url'] = this.url; - return data; - } -} - -class Chat { - String? accountId; - int? count; - List? users; - - - Chat({this.accountId, this.count, this.users}); - - Chat.fromJson(Map json) { - accountId = json['account_id']; - count = json['count']; - if (json['users'] != null) { - users = []; - json['users'].forEach((v) { - users!.add(new Users.fromJson(v)); - }); - } - } - - Map toJson() { - final Map data = new Map(); - data['account_id'] = this.accountId; - data['count'] = this.count; - if (this.users != null) { - data['users'] = this.users!.map((v) => v.toJson()).toList(); - } - return data; - } -} - -class Users { - String? avatar; - int? id; - String? nickname; - - Users({this.avatar, this.id, this.nickname}); - - Users.fromJson(Map json) { - avatar = json['avatar']; - id = json['id']; - nickname = json['nickname']; - } - - Map toJson() { - final Map data = new Map(); - data['avatar'] = this.avatar; - data['id'] = this.id; - data['nickname'] = this.nickname; - return data; - } -} - -class User { - String? avatar; - String? city; - int? gender; - int? age; - int? id; - int? mark; - double? lat; - double? lng; - String? nickname; - int? orientation; - String? avatar_thumb; - int? role; - int vip = 0; - - User( - {this.avatar, - this.city, - this.gender, - this.id, - this.lat, - this.mark, - this.lng, - this.age, - this.nickname, - this.avatar_thumb, - this.orientation, - this.role, - this.vip=0}); - - User.fromJson(Map json) { - avatar = json['avatar']; - city = (json['city'] ?? '').toString().replaceAll('市', ''); - gender = json['gender']; - mark = json['mark'] ?? 0; - id = json['id']; - age = json['age'] ?? 0; - lat = json['lat'] ?? 0.0; - lng = json['lng'] ?? 0.0; - nickname = json['nickname']; - avatar_thumb = json['avatar_thumb']; - orientation = json['orientation']; - role = json['role']; - vip = json['vip']; - } - - Map toJson() { - final Map data = new Map(); - data['avatar'] = this.avatar; - data['city'] = this.city; - data['gender'] = this.gender; - data['id'] = this.id; - data['lat'] = this.lat; - data['lng'] = this.lng; - data['nickname'] = this.nickname; - data['orientation'] = this.orientation; - data['role'] = this.role; - data['vip'] = this.vip; - return data; - } -} \ No newline at end of file diff --git a/circle_app/lib/app/circle/view.dart b/circle_app/lib/app/circle/view.dart deleted file mode 100644 index 31babfc..0000000 --- a/circle_app/lib/app/circle/view.dart +++ /dev/null @@ -1,1133 +0,0 @@ -import 'dart:math'; - -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:circle_app/app/circle/widgets/discover.dart'; -import 'package:circle_app/app/circle/widgets/info_list_view.dart'; -import 'package:circle_app/app/circle/widgets/like_view.dart'; -import 'package:circle_app/app/circle/widgets/new_people.dart'; -import 'package:circle_app/app/circle/widgets/vicinity.dart'; -import 'package:circle_app/app/dialog/ScreenBottomSheetDialog.dart'; -import 'package:circle_app/app/circle/view.dart'; -import 'package:circle_app/common/Widgets/base_tip_widget.dart'; -import 'package:circle_app/router/app_routers.dart'; -import 'package:circle_app/util/eventBus.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_pickers/pickers.dart'; -import 'package:flutter_pickers/style/picker_style.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:flutter_swiper/flutter_swiper.dart'; -import 'package:get/get.dart'; -import 'package:gradient_borders/gradient_borders.dart'; -import 'package:pull_to_refresh/pull_to_refresh.dart'; - -import '../../common/Widgets/today_people_dialog.dart'; -import '../../common/colors/app_color.dart'; -import '../../network/api.dart'; -import '../../network/dio_manager.dart'; -import '../minefragment/logic.dart'; -import '../select_circle/logic.dart'; -import '../userinfo/logic.dart'; -import 'logic.dart'; - -const bgWidget = DecorationImage( - fit: BoxFit.fill, image: AssetImage('assets/images/base/home_back.png')); - -class CirclePage extends StatefulWidget { - const CirclePage({Key? key}) : super(key: key); - - @override - State createState() => _CirclePageState(); -} - -class _CirclePageState extends State - with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin { - late TabController _tabController; - late PageController _pageController; - - int currentIndex = 0; - - final logic = Get.find(); - - final state = Get.find().state; - - var getContext; - - // 是否需要缓存 - @override - bool get wantKeepAlive => true; - - var sub; - @override - void initState() { - super.initState(); - - sub = EventBusManager.on().listen((event) { - currentIndex = event.index; - _tabController.index = currentIndex; - setState(() {}); - }); - - currentIndex = Random().nextInt(3); - _pageController = PageController(initialPage: currentIndex); - _tabController = - TabController(length: 3, vsync: this, initialIndex: currentIndex); - _tabController.addListener(_handleTabChange); - getContext = context; - } - - void _handleTabChange() { - // 在这里可以执行滑动监听后的逻辑操作 - // 比如根据当前选中的标签执行其他操作 - // int currentIndex = .toString()); - logic.isShowCircle = _tabController.index == 0; - if (_tabController.indexIsChanging != 0) { - logic.isNewPeopleRed = false; - } - - logic.update(); - } - - @override - void dispose() { - sub.cancel(); - _tabController.removeListener(_handleTabChange); // 移除监听 - _tabController.dispose(); - _pageController.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - super.build(context); - - return GetBuilder(builder: (controller) { - return Scaffold( - backgroundColor: Colors.transparent, - body: SafeArea( - child: Stack( - children: [ - Column(children: [ - navigatorItem(controller.statistics.value) - , - // Text(controller.state.msg), - //组件使用 - ]), - Container( - margin: EdgeInsets.only(top: 45.sp), - child: TabBarView( - controller: _tabController, - children: [ - NewPeople(), - // circleList(controller), - Vicinity(controller), - Discover(0) - ], - ), - ), - ], - )), - ); - }); - } - - Widget vicinityList(CircleLogic controller) { - return SmartRefresher( - controller: logic.refreshController, - onRefresh: _onRefresh, - onLoading: _onLoading, - enablePullUp: logic.myVip > 0, - child: ListView.builder( - padding: EdgeInsets.all(10.sp), - itemCount: logic.myVip == 0 - ? logic.vicinityList.length + 2 - : logic.vicinityList.length + 1, - itemBuilder: (context, index) { - if (index == 0) { - return bannerView(controller); - } else { - if (logic.myVip == 0 && index == logic.vicinityList.length + 1) { - return showVipView(); - } else { - return ListItem(logic.vicinityList[index - 1], index - 1); - } - } - }, - ), - ); - } - - Widget showVipView() { - return Container( - margin: EdgeInsets.only(top: 10.sp), - color: const Color(0xB30B011B), - padding: EdgeInsets.symmetric(vertical: 14.sp, horizontal: 20.sp), - child: Column( - children: [ - Center( - child: Text( - "VIP特权", - style: TextStyle(color: Colors.white, fontSize: 16.sp), - ), - ), - Container( - padding: EdgeInsets.only(top: 18.sp), - child: Text( - "开通VIP后,才能查看更多附近的圈友,也可以根据您的喜好、属性、角色、取向等筛选出想要认识的人,还可以获得其他十几种会员特权,拥有更多不一样的体验", - style: TextStyle(color: Colors.white, fontSize: 12.sp), - ), - ), - GestureDetector( - onTap: () async { - logic.showRechargeDialog(); - }, - child: Center( - child: Container( - margin: EdgeInsets.only(top: 14.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.symmetric( - vertical: 10.sp, - horizontal: 55.sp, - ), - child: const Text( - "前往开通VIP", - style: TextStyle( - color: Colors.white, - fontSize: 12, - ), - ), - ), - )) - ], - )); - } - - Widget ListItem(VicinityItemBean item, int index) { - return GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.UserInfoActivity, arguments: item.id.toString()); - }, - child: Container( - margin: EdgeInsets.only(top: 10.sp), - // padding: EdgeInsets.only( left: 8.sp, right: 8.sp), - width: Get.width, - height: 200.sp, - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.fill, - image: AssetImage( - getCircleImage('pic_bg'), - ))), - child: Stack( - children: [ - Container( - margin: EdgeInsets.only(top: 1.sp, left: 1.sp, right: 1.sp), - child: ClipRRect( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(10.sp), - topRight: Radius.circular(10.sp), - ), - child: item.images.length == 0 - ? Image( - image: AssetImage(getCircleImage("icon_list_null")), - width: Get.width, - fit: BoxFit.fill, - height: 92.sp, - ) - : Container(), - ), - ), - Column(children: [ - Container( - margin: EdgeInsets.only(right: 2.sp), - child: Row( - children: [ - Container( - margin: EdgeInsets.only(top: 6.sp, left: 8.sp), - width: 88.sp, - height: 88.sp, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8.0), - gradient: const LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [ - Color(0xFF71F3F2), - Color(0xFFF558FF), - ], - stops: [0.0365, 0.9427], - ), - ), - padding: EdgeInsets.all(2.sp), - child: ClipRRect( - borderRadius: BorderRadius.circular(8.0), - child: Image.network(item.avatarThumb, - width: 88.sp, height: 88.sp, fit: BoxFit.cover), - ), - ), - Expanded( - child: SingleChildScrollView( - scrollDirection: Axis.horizontal, - child: Container( - margin: EdgeInsets.only(top: 6.sp), - child: Row( - children: [ - for (int i = 0; i < item.images.length; i++) - GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.Swiper, - arguments: { - 'imaglist': item.images, - 'index': i - }); - }, - child: ListAlbumItem(item.images[i], i)), - ], - ), - ), - ), - ), - ], - ), - ), - Container( - margin: EdgeInsets.only(top: 6.sp, left: 9.sp), - child: Row( - children: [ - Text( - item.nickname, - style: TextStyle( - fontWeight: FontWeight.bold, - color: const Color.fromRGBO(247, 250, 250, 1.0), - fontSize: 16.sp, - ), - ), - SizedBox(width: 8.sp), - _buildInfoRow(item), - const Spacer(), - Container( - margin: EdgeInsets.only(right: 8.sp), - child: Text( - item.onlineFlag.toString(), - style: TextStyle( - color: const Color.fromRGBO(247, 250, 250, 1.0), - fontSize: 12.sp, - ), - )), - ], - ), - ), - Container( - height: 50.sp, // 设置固定高度 - width: Get.width, - margin: EdgeInsets.symmetric(horizontal: 8.0), - child: Align( - alignment: Alignment.centerLeft, // 文本左对齐,垂直居中 - child: Text( - item.signature, - maxLines: 2, - style: TextStyle(color: Colors.white, fontSize: 14.sp), - overflow: TextOverflow.ellipsis, - ), - ), - ), - Container( - margin: EdgeInsets.only(left: 8.sp, right: 3.sp), - child: _buildInterestsListView(item.interests)) - ]), - ], - )), - ); - } - - Widget _buildInterestsListView(List interests) { - return Align( - alignment: Alignment.centerLeft, - child: SingleChildScrollView( - scrollDirection: Axis.horizontal, - child: Row( - children: [ - for (int index = 0; index < interests.length; index++) - GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.Signal_circle_list, - arguments: interests[index].id); - }, - child: Container( - margin: EdgeInsets.only(right: 11.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17.0), - gradient: const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - ), - color: const Color(0xFF392D53), - ), - child: Container( - margin: EdgeInsets.all(0.2.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17.0), - color: const Color(0xFF392D53), - ), - child: Padding( - padding: EdgeInsets.only( - top: 2.sp, - bottom: 2.sp, - left: 15.sp, - right: 15.sp, - ), - child: Center( - child: Text( - interests[index].title, - style: const TextStyle( - fontSize: 13.0, - color: Colors.white, - ), - ), - ), - ), - ), - ), - ), - ], - ), - ), - ); - } - - Widget _buildInfoRow(VicinityItemBean item) { - String ageMsg = - getAgeCOntent(item!.gender, item!.age, item!.role, item!.orientation); - return Row( - children: [ - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color.fromRGBO(141, 255, 248, 1.0), - Color.fromRGBO(181, 211, 255, 1.0), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 2.sp, - bottom: 2.sp, - left: 10.sp, - right: 10.sp, - ), - child: Text( - ageMsg, - style: const TextStyle( - color: Colors.black, - fontSize: 10, - ), - ), - ), - const SizedBox(width: 6), - if (item.vip > 0) - Image( - image: AssetImage(getBaseImage(item.vip == 1 ? "vip" : 'year_vip')), - width: 44.sp, - height: 18.sp, - ), - ], - ); - } - - Widget ListAlbumItem(String item, int index) { - return Container( - margin: EdgeInsets.symmetric(horizontal: 2.sp), - child: CachedNetworkImage( - width: 88.sp, - height: 88.sp, - fit: BoxFit.cover, - imageUrl: item + "?imageView2/1/w/176/h/176/q/75", - ), - ); - } - - void _onRefresh() async { - logic.vicinityPage = 1; - logic.offset = 0; - logic.getNearByList(); - // logic.refreshController.refreshCompleted(); - } - - void _onLoading() async { - if (logic.myVip > 0) { - logic.vicinityPage = logic.vicinityPage + 1; - // logic.offset = 0; - // - logic.getNearByList(); - } else { - logic.refreshController.loadComplete(); - } - } - - Widget bannerView(CircleLogic controller) { - return SizedBox( - height: 160.sp, - // margin: EdgeInsets.symmetric(horizontal: 16.sp), - child: Swiper( - autoplay: logic.bannerList.length > 1, - controller: logic.swiperController, - autoplayDelay: 6000, - loop: logic.bannerList.length > 1 ? true : false, - // index:logic.index, - itemBuilder: (BuildContext context, int index) { - return GestureDetector( - onTap: () async { - // print(logic.bannerList[index].param); - navigateToCustomRoute(logic.bannerList[index]); - }, - child: SizedBox( - width: Get.width, - child: ClipRRect( - borderRadius: BorderRadius.circular(15.sp), - child: CachedNetworkImage( - imageUrl: logic.bannerList[index].picUrl, - fit: BoxFit.fill, - width: Get.width, - ), - )), - ); - }, - itemCount: logic.bannerList.length, - pagination: SwiperPagination( - margin: EdgeInsets.all(5.0.sp), // 设置外边距 - alignment: Alignment.bottomCenter, - builder: DotSwiperPaginationBuilder( - color: Color(0x00FFFFFF), // 小圆点的颜色 - activeColor: logic.bannerList.length == 1 - ? Color(0x00FFFFFF) - : Color(0x00FFFFFF), // 当前索引小圆点的颜色 - ), - ), -// control: new SwiperControl(), //左右的那个箭头,在某模拟器中会出现蓝线 - ), - ); - } - - Widget circleList(CircleLogic controller) { - return Swiper( - itemBuilder: (BuildContext context, int index) { - var bean = logic.circle.lists[index]; - // final GlobalKey infoListViewKey = GlobalKey(); - return InfoListView(index, bean, logic); - }, - onIndexChanged: (index) async { - controller.state.index = index; - if (index == logic.circle.lists.length - 1) { - await logic.loadMore(); - if (!logic.isMore) { - showOKToast('小主,换个方向滑动呗~'); - } - } else if (index == 0) { - showOKToast('小主,换个方向滑动呗~'); - } - - print(index.toString()); - }, - index: controller.state.index, - itemCount: logic.circle.lists.length, - viewportFraction: 0.93, - // scale: 0.9, - loop: false, - // key: UniqueKey(), - // pagination: new SwiperPagination(),//如果不填则不显示指示点 - // control: new SwiperControl(),//如果不填则不显示左右按钮 - ); - } - - Widget navigatorItem(DataModel statistics) { - List urlList = []; - List infoList = []; - if (statistics != null) { - infoList = statistics.lastVisitUsers; - if (infoList.isNotEmpty) { - for (var element in infoList) { - if (element["avatar"] != null && element["avatar"].contains("http")) { - urlList.add(element["avatar"]); - } - - // urlList.add(element["avatar"]); - } - } - } - - List widgets = []; - - for (int i = 0; i < urlList.length; i++) { - var element = urlList[i]; - widgets.add(Positioned( - left: 15.sp * i, - child: circleWidget(element), - )); - } - if (statistics != null && widgets.isNotEmpty) { - widgets.add(Positioned( - left: 15.sp * urlList.length, - child: circleWidget(statistics.visitCount.toString()), - )); - } - - return Container( - width: Get.width, - padding: EdgeInsets.only(left: 10.sp, right: 10.sp), - height: 44.sp, - child: Stack( - alignment: Alignment.center, - children: [ - _tabController.index == 0 - ? Positioned( - left: 0, - child: GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.Invite); - }, - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17.0), - gradient: const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - ), - color: const Color(0xFF392D53), - ), - child: Container( - margin: EdgeInsets.all(0.6.sp), - padding: EdgeInsets.only( - left: 6.sp, right: 6.sp, top: 4.sp, bottom: 4.sp), - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17.0), - color: const Color(0xFF392D53), - ), - child: Row( - children: [ - Image.asset( - getMsgImage('gift'), - width: 14.sp, - ), - SizedBox(width: 2.sp,), - Text( - "邀请赚钱", - style: TextStyle( - fontSize: 12.sp, - color: Colors.white, - ), - ), - ], - ), - ), - ), - )) - : _tabController.index == 1 - ? Positioned( - left: 0, - child: GestureDetector( - onTap: () { - showCityPiker(context); - }, - child: Row( - children: [ - Image.asset( - getCircleImage('icon_city'), - width: 24.sp, - ), - Container( - width: 80.sp, - margin: EdgeInsets.only(left: 4.sp, top: 4.sp), - child: Text( - modifyCityName(logic.cityName), - style: TextStyle( - color: Colors.white, fontSize: 16.sp), - )) - ], - ), - )) - : Positioned( - left: 0, - child: GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.DisCover); - }, - child: Image.asset( - getCircleImage('clocked_icon'), - width: 65.sp, - ), - )), - Container( - alignment: Alignment.center, - //padding: EdgeInsets.symmetric(horizontal: 10.sp), - - height: 27.sp, - child: Stack( - alignment: Alignment.center, - children: [ - TabBar( - isScrollable: true, - controller: _tabController, - labelPadding: EdgeInsets.symmetric(horizontal: 12.0.sp), - indicator: UnderlineTabIndicator( - borderSide: BorderSide( - color: const Color(0xFF00FFF4), - ), - ), - indicatorColor: const Color(0xFF00FFF4), - indicatorWeight: 2.sp, - labelColor: const Color(0xFF00FFF4), - unselectedLabelColor: const Color(0xB3FFFFFF), - indicatorSize: TabBarIndicatorSize.label, - indicatorPadding: EdgeInsets.only(left: 12.sp, right: 12.sp), - tabs: [ - Tab( - child: Text( - '新人', - style: TextStyle( - fontSize: 18.sp, - ), - ), - ), - Tab( - child: Text( - '附近', - style: TextStyle( - fontSize: 18.sp, - ), - ), - ), - Tab( - child: Text( - '精选', - style: TextStyle( - fontSize: 18.sp, - ), - ), - ), - ], - labelStyle: TextStyle( - color: const Color(0xFF00FFF4), - fontSize: 18.sp, - shadows: [ - Shadow( - color: const Color(0xFFF657FF).withOpacity(0.5), - offset: Offset(0, -2), // 阴影偏移 - blurRadius: 3, // 阴影模糊半径 - // spreadRadius: 0 - ), - ], - ), - unselectedLabelStyle: TextStyle( - // color: const Color(0xB3FFFFFF), - fontSize: 18.sp, - shadows: [ - Shadow( - // color: const Color(0xFFF657FF), - offset: const Offset(0, -1), - blurRadius: 3.0.sp, - ), - ], - ), - onTap: (index) { - if (currentIndex == index) { - if (index == 2) { - EventBusManager.fire(DiscovrScrollTap()); - } else if (index == 1) { - EventBusManager.fire(NearScrollTap()); - } else if (index == 0) { - EventBusManager.fire(ScrollToTop()); - } - return; - } - currentIndex = index; - // _pageController.animateToPage( - // index, // 目标页面索引 - // duration: const Duration(milliseconds: 300), // 动画时长 - // curve: Curves.ease, // 动画曲线 - // ); - }, - ), - if (logic.isNewPeopleRed) - Positioned( - left: 42.5.sp, - top: 0.sp, - child: Container( - height: 10.sp, - width: 10.sp, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: Colors.red, - ), - )) - ], - ), - ), - Positioned( - right: 0, - child: _tabController.index == 0 - ? Row( - children: [ - InkWell( - onTap: () { - logic.snedHelloMoreData(); - }, - child: Container( - padding: EdgeInsets.only(left: 2.sp,right: 2.sp), - child: Row( - children: [ - Image.asset( - getCircleImage('hello_icon'), - width: 25.sp, - ), - // SizedBox(width: 2.sp,), - Container( - margin: EdgeInsets.only(top: 4.sp), - - child: Text( - '30', - style: TextStyle( - color: Colors.white, fontSize: 14.sp), - ), - ) - ], - ), - ), - ), - SizedBox( - width: 0.sp, - ), - GestureDetector( - onTap: () { - _showBottomSheet(context); - }, - child: Image.asset( - getCircleImage('icon_screen'), - width: 30.sp, - ), - ), - ], - ) - : Row( - children: [ - InkWell( - onTap: ()async { - if (_tabController.index == 2) { - var data = await DioManager.instance.get(url: Api.getUserMine); - var bean = BaseResponse.fromJson( - data, (data) => MineResponseBean.fromJson(data)); - User userInfoBean = bean.data.user; - - if (userInfoBean.vip > 0) { - navigateToQueen(); - } else { - showOKToast('领取特权之后更容易上精选'); - showOepnVipDialog(); - } - - - } else { - Get.bottomSheet( - TodayPeopleDialog(isShow: true), - isScrollControlled: true, - enableDrag: false, - ); - } - }, - child: Image.asset( - _tabController.index == 2 - ? getCircleImage('QA_icon') - : getMsgImage('heart_icon'), - width: 24.sp, - ), - ), - SizedBox( - width: 8.sp, - ), - GestureDetector( - onTap: () { - _showBottomSheet(context); - }, - child: Image.asset( - getCircleImage('icon_screen'), - width: 30.sp, - ), - ), - ], - )), - ], - ), - ); - } - - void _showBottomSheet(BuildContext context) { - showModalBottomSheet( - context: context, - backgroundColor: Colors.transparent, - builder: (BuildContext context) { - return ScreenBottomSheetDialog( - genderList: _tabController.index == 1 - ? logic.genderList - : _tabController.index == 0 - ? logic.new_genderList - : logic.dis_genderList, - orientationList: _tabController.index == 1 - ? logic.orientationList - : _tabController.index == 0 - ? logic.new_orientationList - :logic.dis_orientationList, - roleList: - _tabController.index == 1 ? logic.roleList : _tabController.index == 0 ? logic.new_roleList : logic.dis_roleList, - isHaveCity: _tabController.index == 1, - callback: (genderList, orientationList, roleList) { - if (_tabController.index == 1) { - _onRefresh(); - } else if (_tabController.index == 0) { - List genders = []; - logic.new_genderList.forEach((element) { - if (element.isSelect) { - genders.add(element.id); - } - }); - List roles = []; - logic.new_orientationList.forEach((element) { - if (element.isSelect) roles.add(element.id); - }); - - List orientations = []; - logic.new_roleList.forEach((element) { - if (element.isSelect) orientations.add(element.id); - }); - logic.onRefresh(); - } else { - List genders = []; - logic.dis_genderList.forEach((element) { - if (element.isSelect) { - genders.add(element.id); - } - }); - List roles = []; - logic.dis_orientationList.forEach((element) { - if (element.isSelect) roles.add(element.id); - }); - - List orientations = []; - logic.dis_roleList.forEach((element) { - if (element.isSelect) orientations.add(element.id); - }); - - EventBusManager.fire( - OptionFindclass(genders, roles, orientations)); - } - }, - ); // Use your custom widget here - }, - ); - } - - circleWidget(String url, {double width = 30}) { - return GestureDetector( - child: Stack( - alignment: Alignment.center, - children: [ - Image.asset( - getCircleImage('avatar_bg'), - width: width.sp, - ), - url.contains("http") - ? ClipOval( - child: Image.network( - url, - width: (width - 1).sp, - height: (width - 1).sp, - fit: BoxFit.cover, - ), - ) - : Text( - url, - style: TextStyle(color: Color(0xffF756FF), fontSize: 12.sp), - ) - ], - )); - } - - void _showTextContentDialog(BuildContext context, String msg) { - showDialog( - context: context, - builder: (BuildContext context) { - return Dialog( - backgroundColor: Colors.transparent, - child: Container( - height: 300.sp, - padding: EdgeInsets.all(1.0), - child: Stack( - children: [ - Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: LinearGradient( - colors: [Color(0xFFDD3DF4), Color(0xFF30FFD9)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Container( - margin: EdgeInsets.all(1.sp), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: LinearGradient( - colors: [Color(0xFF4C3E5F), Color(0xFF324140)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Container( - margin: EdgeInsets.only(top: 24.sp), - child: Column( - children: [ - Container( - margin: EdgeInsets.only( - top: 12.sp, left: 14.sp, right: 14.sp), - alignment: Alignment.center, - child: Text( - msg, - textAlign: TextAlign.center, - style: TextStyle( - color: Color(0xCCF7FAFA), fontSize: 16.sp), - ), - ), - ], - ), - ) - ], - ), - ), - ); - }, - ); - } - - showCityPiker(context) { - Pickers.showMultiLinkPicker(context, - pickerStyle: DefaultPickerStyle.dark(), - data: logic.cityMap, - columeNum: 2, onConfirm: (List res, List position) { - print(res); - // print(logic.cityMap[res[0]][res[1]][0]); - // controller.state.city = controller.cityMap[res[0]][res[1]][0]; - // logic.state.city = res[1]; - logic.cityName = res[1]; - - _onRefresh(); - // logic.getSuccess(); - // logic.update(); - } - - // onConfirm:(String province, String city, String? town){ - // controller.state.role = city; - // controller.update(); - // - // } - - ); - } - - String modifyCityName(String cityName) { - if (cityName.endsWith("市")) { - cityName = cityName.substring(0, cityName.length - 1); - } - - if (cityName.length > 4) { - cityName = cityName.substring(0, 4) + "..."; - } - - return cityName; - } -} - -class DefaultPickerStyle extends PickerStyle { - DefaultPickerStyle({bool haveRadius: false, String? title}) { - if (haveRadius) { - this.headDecoration = BoxDecoration( - color: Colors.white, - borderRadius: const BorderRadius.only( - topLeft: Radius.circular(10), topRight: Radius.circular(10))); - } - if (title != null && title != '') { - this.title = Center( - child: - Text(title, style: TextStyle(color: Colors.grey, fontSize: 14))); - } - } - - /// 夜间 - DefaultPickerStyle.dark({bool haveRadius: false, String? title}) { - this.commitButton = Container( - alignment: Alignment.center, - padding: const EdgeInsets.only(left: 12, right: 22), - child: Text('确定', style: TextStyle(color: Colors.white, fontSize: 16.0)), - ); - - this.cancelButton = Container( - alignment: Alignment.center, - padding: const EdgeInsets.only(left: 22, right: 12), - child: Text('取消', style: TextStyle(color: Colors.white, fontSize: 16.0)), - ); - - this.headDecoration = BoxDecoration( - color: Color(0xFF4A3E5D), - borderRadius: !haveRadius - ? null - : BorderRadius.only( - topLeft: Radius.circular(10), topRight: Radius.circular(10))); - - if (title != null && title != '') { - this.title = Center( - child: - Text(title, style: TextStyle(color: Colors.white, fontSize: 14))); - } - - this.backgroundColor = Color(0xFF4A3E5D)!; - this.textColor = Colors.white; - } -} - -class DiscovrScrollTap {} - -class NearScrollTap {} - -class CircleScrollTap {} - -class OptionFindclass { - List? genderList; - List? orientationList; - List? roleList; - - OptionFindclass(this.genderList, this.orientationList, this.roleList); -} - -class ChangeIndex { - int index; - ChangeIndex(this.index); -} diff --git a/circle_app/lib/app/circle/widgets/discover.dart b/circle_app/lib/app/circle/widgets/discover.dart deleted file mode 100644 index 2520966..0000000 --- a/circle_app/lib/app/circle/widgets/discover.dart +++ /dev/null @@ -1,1578 +0,0 @@ -import 'dart:io'; - -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:circle_app/app/circle/view.dart'; -import 'package:circle_app/common/Widgets/base_tip_widget.dart'; -import 'package:circle_app/common/Widgets/genderview.dart'; -import 'package:circle_app/common/Widgets/tag_widget.dart'; -import 'package:circle_app/common/colors/app_color.dart'; -import 'package:circle_app/common/const.dart'; -import 'package:circle_app/main.dart'; -import 'package:circle_app/network/api.dart'; -import 'package:circle_app/network/dio_manager.dart'; -import 'package:circle_app/router/app_routers.dart'; -import 'package:circle_app/util/SharedPreferencesHelper.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:flutter_swiper/flutter_swiper.dart'; -import 'package:get/get.dart'; -import 'package:get/utils.dart'; -import 'package:gradient_borders/gradient_borders.dart'; -import 'package:intl/intl.dart'; -import 'package:pull_to_refresh/pull_to_refresh.dart'; -import '../../../../util/eventBus.dart'; -import '../../chat/widget/chat_gift_pannel.dart'; -import '../../home/logic.dart'; - -import 'dart:ui' as ui show PlaceholderAlignment; - -const String todayAddWxStatus = 'todayAddWxStatus'; - -class Discover extends StatefulWidget { - int unlockWxNum; - Discover(this.unlockWxNum, {super.key}); - @override - _DiscoverState createState() => _DiscoverState(); -} - -class _DiscoverState extends State - with AutomaticKeepAliveClientMixin { -// TODO: add state variables and methods - @override - bool get wantKeepAlive => true; - // TODO: add state variables and methods - ScrollController _scrollController = ScrollController(); - RefreshController refreshController = RefreshController(); - HomeLogic logic = Get.find(); - var refreshSignSub; - var sub; - var sub1; - var subscripition; - List list = []; - List giftList = []; - bool isMore = true; - - bool loadFail = false; - int index = 1; - List tagList = []; - - List genderList = []; - List orientationList = []; - List roleList = []; - bool isPop = false; -//获取屏幕宽度 - - Offset pointerStart = Offset.zero; - Offset pointerEnd = Offset.zero; - double touchRangeY = 0; - double nextOffset = 0; - int lastPage = 0; - - double screenHeight = 0; - - void animateToOffset(ScrollController controller, double offset, - void Function() onScrollCompleted) { - controller - .animateTo(offset, - duration: const Duration(milliseconds: 200), curve: Curves.easeIn) - .then((value) { - if (onScrollCompleted != null) { - onScrollCompleted(); - } - }).catchError((e) { - print(e); - }); - } -// 按下时保存当前的点 - -// 按下时保存当前的点 - PointerDownEventListener getPointDownListenerInHorizontal() { - return (event) { - pointerStart = event.position; - }; - } - -// 抬起时触发 - PointerUpEventListener getPointUpListenerInHorizontal() { - return (event) { - pointerEnd = event.position; - touchRangeY = pointerStart.dy - pointerEnd.dy; - - if (touchRangeY.abs() < screenHeight / 8) { - // 滑动距离大于屏幕宽度的1/8就可以继续翻页了 - nextOffset = (screenHeight + 5.sp) * lastPage; - animateToOffset(_scrollController, nextOffset, () {}); - return; - } - if (touchRangeY < 0 && lastPage > 0) { - // 手指从下向上滑动 - lastPage--; - animateToOffset( - _scrollController, lastPage * (screenHeight + 5.sp), () {}); - } else if (touchRangeY > 0 && lastPage < list.length - 1) { - // 从上向下 - lastPage++; - animateToOffset( - _scrollController, lastPage * (screenHeight + 5.sp), () {}); - if (lastPage == 3 && isPop == false && widget.unlockWxNum == 0) { - isPop = true; - //弹窗提示 - checkIsPopWxTip(); - } - - if (lastPage == list.length - 2) { - loadData(); - } - } - }; - } - - @override - void dispose() { - // TODO: implement dispose - super.dispose(); - if (widget.unlockWxNum == 0) { - subscripition.cancel(); - } - sub.cancel(); - sub1.cancel(); - } - - @override - void initState() { - // TODO: implement initState - super.initState(); - loadData(); - if (widget.unlockWxNum == 0) { - subscripition = EventBusManager.on().listen((event) { - refreshData(); - }); - } - - sub = EventBusManager.on().listen((event) { - pointerStart = Offset.zero; - pointerEnd = Offset.zero; - lastPage = 0; - _scrollController.animateTo(0, - duration: const Duration(milliseconds: 300), curve: Curves.easeInOut); - refreshData(); - }); - sub1 = EventBusManager.on().listen((event) { - genderList = event.genderList!; - orientationList = event.orientationList!; - roleList = event.roleList!; - index = 1; - loadData(); - }); - - refreshSignSub = EventBusManager.on().listen((event) { - loadSignDiscoverData(event.userId); - }); - } - - setLike(String userId, bool isLike, Function callBack) async { - // if (isBlack || isDestroy) { - // showOKToast("喜欢失败,存在拉黑关系或者该账户已注销"); - // return; - // } - - var data = await DioManager.instance.post( - url: "${Api.setLike + userId}/follow", - params: {'status': isLike ? "0" : "1"}); - var bean = BaseResponse.fromJson( - data, - (jsonData) => jsonData, - ); - if (bean.isSuccess()) { - callBack(); - } - showOKToast(bean.msg); - } - - loadSignDiscoverData(String userId) async { - try { - var result = await DioManager.instance - .get(url: Api.getFindPageUserByUserId, params: { - 'userId': userId, - 'lat': '0', - 'lng': '0', - }); - - int initIndex = 0; - list.forEach((element) { - if (element['id'].toString() == userId) { - initIndex = list.indexOf(element); - } - }); - - list[initIndex] = result['data']; - setState(() {}); - } catch (e) {} - } - - loadData() async { - var data = await DioManager.instance.post(url: Api.findPage, params: { - 'page': index, - 'pageSize': 8, - 'unlockWxNum': widget.unlockWxNum, - "genders": genderList, - "roles": roleList, - "orientations": orientationList, - 'lat': '0', - 'lng': '0', - }); - // - if (data['code'] == 200) { - List dataList = data['data']; - - if (dataList.isNotEmpty) { - if (index == 1) { - list = dataList; - refreshController.refreshCompleted(); - } else { - List info = []; - dataList.forEach((element) { - var user = Users.fromJson(element); - bool isContain = false; - list.forEach((listInfo) { - var user1 = Users.fromJson(listInfo); - if (user1.userId == user.userId) { - isContain = true; - } - }); - if (!isContain) { - info.add(element); - } - }); - if (info.isNotEmpty) { - list.addAll(info); - } - // list.addAll(dataList); - } - - index = index + 1; - isMore = true; - refreshController.loadComplete(); - } else { - isMore = false; - refreshController.loadNoData(); - } - if (mounted) { - setState(() {}); - } - } else { - loadFail = true; - isMore = false; - showOKToast(data['msg']); - setState(() { - - }); - } - } - - void refreshData() { - index = 1; - loadFail = false; - loadData(); - } - - _onLoading() { - loadData(); - } - - @override - Widget build(BuildContext context) { - // TODO: add widget build method - - /// 延时一下,需要等state layout结束之后才能获取size - Future.delayed(Duration(milliseconds: 100), () { - if (!mounted) return; - if (screenHeight == 0 && list.isNotEmpty) { - var size = context?.findRenderObject()?.paintBounds?.size; - screenHeight = size!.height - 20.sp; - setState(() {}); - print(size.toString()); - } - }); - - return list.isEmpty - ? loadFail ? noResultWidget(tip: '',callBack: () { - isMore = true; - loadFail = false; - setState(() { - - }); - refreshData(); - }) : isMore - ? loaddingWidget(true) - : noResultWidget(tip: '已解锁联系方式的圈友会展示在这里哦~') - : Stack( - fit: StackFit.expand, - children: [ - Container(color: Colors.transparent), - Listener( - onPointerDown: getPointDownListenerInHorizontal(), - onPointerUp: getPointUpListenerInHorizontal(), - child: SmartRefresher( - footer: DiyLoadFooter( - noDataText: '只展示一些精选过的圈友哦~', - ), - onRefresh: refreshData, - controller: refreshController, - onLoading: _onLoading, - enablePullUp: true, - child: ListView.builder( - itemBuilder: (context, index) { - var user = Users.fromJson(list[index]); - - String onLineStr = ''; - if (user.online_flag?.isNotEmpty ?? false) { - onLineStr = user.online_flag!; - if (user.distance != null) { - if (user.distance! < 100) { - onLineStr = - '${user.online_flag!}· ${user.distance!.toInt()}km'; - } - } - } else { - if (user.distance != null) { - if ((user.distance! ?? 10) < 100) { - onLineStr = '${user.distance!.toInt()}km'; - } - } - } - - return FeaturedItem(info: list[index], index: index, screenHeight: screenHeight, sendNoLookData: () { - sendNoLookData(user.userId!.toString(),index); - },setLike: () { - setLike(user.userId!.toString(), - user.is_follow!, () { - list[index]['is_follow'] = - !user.is_follow!; - setState(() {}); - }); - }, loadSignDiscoverData: loadSignDiscoverData, showGiftPannel: showGiftPannel); - }, - itemCount: list.length, - physics: BouncingScrollPhysics(), - controller: _scrollController, - ), - ), - ), - ], - ); - } - - tagItem(List item) { - return Container( - width: Get.width, - margin: EdgeInsets.only(top: 5.sp, bottom: 5.sp), - // color: Colors.red, - // height: 45.sp, - child: ListView.builder( - scrollDirection: Axis.horizontal, - itemCount: item.length, - itemBuilder: (context, index) { - return tagWidget(item[index]['title'], item[index]['id']); - }), - ); - } - - tagWidget(String tagName, int id) { - return GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.Signal_circle_list, arguments: id); - }, - child: Container( - margin: EdgeInsets.only(right: 6.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17.0), - gradient: const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - ), - color: const Color(0xFF392D53), - ), - child: Container( - margin: EdgeInsets.all(0.2.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17.0), - color: const Color(0xFF392D53), - ), - child: Padding( - padding: EdgeInsets.only( - top: 2.sp, - bottom: 2.sp, - left: 10.sp, - right: 10.sp, - ), - child: Center( - child: Text( - tagName, - style: const TextStyle( - fontSize: 11.0, - color: Colors.white, - ), - ), - ), - ), - ), - ), - ); - } - - addWxPicker() { - return Get.bottomSheet( - Container(), - isScrollControlled: false, - enableDrag: false, - ); - } - - void checkIsPopWxTip() async { - SharedPreferencesHelper sp = await SharedPreferencesHelper.getInstance(); - var date = DateTime.now(); - final dateFormat = DateFormat("yyyy-MM-dd"); - final date2 = dateFormat.format(date); - if (sp.preferences!.containsKey(todayAddWxStatus)) { - var lastDate = sp.preferences!.getString(todayAddWxStatus); - if (lastDate != date2) { - loadWxNumData(); - sp.preferences!.setString(todayAddWxStatus, date2); - } - } else { - sp.preferences!.setString(todayAddWxStatus, date2); - loadWxNumData(); - } - } - - loadWxNumData() async { - loadWXEditStatus() async { - var data = await DioManager.instance.get( - url: Api.checkWxNumState, - ); - if (data['code'] == 200) { - var data = await DioManager.instance.get(url: Api.getUserInfo); - - if (data['code'] != 4000) { - if (data['data']['user']['wxNum'] == null) { - showAddWxPicker(false); - } else if (data['data']['user']['wxNum'].toString().isEmpty) { - showAddWxPicker(false); - } - } - } else { - // wxStatusInfo['${data['code']}'] = data['msg']; - } - } - } - - void sendNoLookData(String userId, int index) async { - var data = await DioManager.instance.post(url: Api.uninterested + userId); - if (data['code'] == 200) { - showOKToast('操作成功'); - list.removeAt(index); - setState(() {}); - } - } - - void _showReportDialog( - BuildContext context, String userId, int currentIndex) { - showDialog( - context: context, - builder: (BuildContext context) { - return Dialog( - backgroundColor: Colors.transparent, - child: Container( - height: 277.sp, - padding: const EdgeInsets.all(1.0), - child: Stack( - children: [ - Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: const LinearGradient( - colors: [Color(0xFFDD3DF4), Color(0xFF30FFD9)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Container( - margin: EdgeInsets.all(1.sp), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: const LinearGradient( - colors: [Color(0xFF4C3E5F), Color(0xFF324140)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Container( - margin: EdgeInsets.only(top: 24.sp), - child: Column( - children: [ - Center( - child: Text( - "温馨提示", - style: - TextStyle(color: Colors.white, fontSize: 16.sp), - ), - ), - Container( - margin: EdgeInsets.only(top: 14.sp), - alignment: Alignment.center, - child: Image( - image: AssetImage(getCircleImage("no_look_icon_h")), - width: 70.sp, - height: 70.sp, - ), - ), - Container( - margin: EdgeInsets.only( - top: 12.sp, left: 14.sp, right: 14.sp), - alignment: Alignment.center, - child: Text( - "您确认对TA不感兴趣吗?确认之后在这个板块就看不见TA了。", - textAlign: TextAlign.center, - style: TextStyle( - color: const Color(0xCCF7FAFA), fontSize: 16.sp), - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - onTap: () { - Navigator.pop(context); - }, - child: Container( - margin: EdgeInsets.only(top: 24.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color(0x26FFFFFF), - Color(0x26FFFFFF), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 10.sp, - bottom: 10.sp, - left: 27.sp, - right: 27.sp), - child: const Text( - "再考虑考虑", - style: TextStyle( - color: Colors.white, - fontSize: 12, - ), - ), - ), - ), - SizedBox(width: 24.sp), - GestureDetector( - onTap: () { - Get.back(); - sendNoLookData(userId, currentIndex); - }, - child: Container( - margin: EdgeInsets.only(top: 24.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 10.sp, - bottom: 10.sp, - left: 52.sp, - right: 52.sp), - child: const Text( - "确定", - style: TextStyle( - color: Colors.white, - fontSize: 12, - ), - ), - ), - ) - ], - ) - ], - ), - ) - ], - ), - ), - ); - }, - ); - } - - showGiftPannel(String accId) { - Get.bottomSheet( - ChatGiftPannel( - accid: accId, - isShowVip: false, - ), - isScrollControlled: false, - enableDrag: false, - ); - } -} - -class FeaturedItem extends StatefulWidget { - var info; - int index; - double screenHeight; - Function sendNoLookData; - Function setLike; - Function loadSignDiscoverData; - Function showGiftPannel; - FeaturedItem( - {super.key, - required this.info, - required this.index, - required this.screenHeight,required this.sendNoLookData,required this.setLike,required this.loadSignDiscoverData,required this.showGiftPannel}); - - @override - State createState() => _FeaturedItemState(); -} - -class _FeaturedItemState extends State { - int currentIndex = 0; - - PageController pageController = PageController(); - @override - Widget build(BuildContext context) { - var info = widget.info; - int index = widget.index; - var user = Users.fromJson(info); - double screenHeight = widget.screenHeight; - String onLineStr = ''; - if (user.online_flag?.isNotEmpty ?? false) { - onLineStr = user.online_flag!; - if (user.distance != null) { - if (user.distance! < 100) { - onLineStr = '${user.online_flag!}· ${user.distance!.toInt()}km'; - } - } - } else { - if (user.distance != null) { - if ((user.distance! ?? 10) < 100) { - onLineStr = '${user.distance!.toInt()}km'; - } - } - } - - - List pointWidget = []; - int count = 0; - - for (var item in user.images!) { - pointWidget.add( Expanded( - child: Container( - margin: EdgeInsets.only( - right: user.images!.indexOf(item) == - user.images!.last - ? 0 - : 4.sp), - decoration: BoxDecoration( - color: currentIndex == count - ? Colors.white - : Colors.white.withOpacity(0.25), - borderRadius: BorderRadius.circular(2.sp), - ), - ))); - count = count + 1; - } - - - return Container( - height: screenHeight, - width: Get.width, - margin: EdgeInsets.only(top: 5.sp, left: 16.sp, right: 16.sp), - child: Stack( - children: [ - Container( - clipBehavior: Clip.hardEdge, - decoration: BoxDecoration( - color: Colors.black.withOpacity(0.25), - borderRadius: BorderRadius.circular(10.sp), - // border: GradientBoxBorder( - // gradient: - // AppColor.mainVerLinearGradient, - // width: 1.sp, - // ), - // image: DecorationImage( - // fit: BoxFit.fill, - // image: AssetImage( - // getCircleImage('open_vip_bg'), - // )) - ), - height: screenHeight, - width: Get.width, - child: ClipRRect( - borderRadius: BorderRadius.circular(10), - // clipBehavior: Clip.hardEdge, - child: Container( - // padding: EdgeInsets.all(2.sp), - child: PageView.builder( - controller: pageController, - //当页面选中后回调此方法 - //参数[index]是当前滑动到的页面角标索引 从0开始 - onPageChanged: (int index) { - print("当前的页面是 $index"); - currentIndex = index; - setState(() { - - }); - }, - //值为flase时 显示第一个页面 然后从左向右开始滑动 - //值为true时 显示最后一个页面 然后从右向左开始滑动 - reverse: false, - //滑动到页面底部无回弹效果 - physics: BouncingScrollPhysics(), - //纵向滑动切换 - scrollDirection: Axis.horizontal, - //页面控制器 - // controller: pageController, - //所有的子Widget - itemBuilder: (BuildContext context, int index) { - return GestureDetector( - onTapDown: (TapDownDetails details) { - if (details.localPosition.dx < - (Get.width - 10.sp) * 0.5) { - pageController.animateToPage(currentIndex - 1 >= 0 ? currentIndex -1 : user.images!.length - 1,duration: Duration(milliseconds: currentIndex - 1 >= 0 ? 200 : 10),curve: Curves.ease); - } else { - pageController.animateToPage(currentIndex+1 >= user.images!.length ? 0 : currentIndex+1,duration: Duration(milliseconds: currentIndex+1 >= user.images!.length ? 10 : 200),curve: Curves.ease); - } - }, - child: CachedNetworkImage( - imageUrl: user.images![index], - fit: BoxFit.cover, - // width: Get.width, - height: screenHeight, - )); - }, - itemCount: user.images!.length, - ) - - // Swiper( - // autoplay: false, - // loop: user.images!.length == 1 - // ? false - // : true, - // itemBuilder: - // (BuildContext context, int index) { - // // print(index); - - // }, - // itemCount: user.images!.length, - // ), - )), - ), - if (user.images!.length > 1) - Positioned( - top: 4.sp, - child: Container( - height: 4.sp, - margin: EdgeInsets.only(left: 10.sp, right: 10.sp), - width: Get.width - 30.sp, - child: Row( - children: pointWidget, - ), - )), - Positioned( - left: 5.sp, - top: 15.sp, - child: Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if (onLineStr.isNotEmpty) - Container( - height: 24.sp, - padding: EdgeInsets.only(left: 6.sp, right: 6.sp), - decoration: BoxDecoration( - color: Colors.black.withOpacity(0.35), - borderRadius: BorderRadius.circular(12.sp)), - child: Row( - children: [ - Container( - width: 6.sp, - height: 6.sp, - margin: EdgeInsets.only(right: 4.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(3.sp), - color: AppColor.mainColor, - ), - ), - // if (logic.online) - Text( - onLineStr, - style: TextStyle( - color: Colors.white, fontSize: 16.sp), - ), - ], - ), - ), - if (onLineStr!.isNotEmpty) - SizedBox( - height: 8.sp, - ), - if (user.both_cities!.isNotEmpty) - Container( - height: 24.sp, - padding: EdgeInsets.only(left: 6.sp, right: 6.sp), - decoration: BoxDecoration( - color: Colors.black.withOpacity(0.35), - borderRadius: BorderRadius.circular(12.sp)), - child: Row( - children: [ - Container( - width: 6.sp, - height: 6.sp, - margin: EdgeInsets.only(right: 4.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(3.sp), - color: AppColor.mainColor, - ), - ), - // if (logic.online) - Text( - "你们都来过${user.both_cities!.first}", - style: TextStyle( - color: Colors.white, fontSize: 16.sp), - ), - ], - )), - if (user.both_cities!.isNotEmpty) - SizedBox( - height: 8.sp, - ), - if (user.both_interests!.isNotEmpty) - Container( - height: 24.sp, - padding: EdgeInsets.only(left: 6.sp, right: 6.sp), - decoration: BoxDecoration( - color: Colors.black.withOpacity(0.35), - borderRadius: BorderRadius.circular(12.sp)), - child: Row( - children: [ - Container( - width: 6.sp, - height: 6.sp, - margin: EdgeInsets.only(right: 4.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(3.sp), - color: AppColor.mainColor, - ), - ), - // if (logic.online) - Text( - "你们有共同的圈子:${user.both_interests!.first['title']}", - style: TextStyle( - color: Colors.white, fontSize: 16.sp), - ), - ], - )), - ], - ), - )), - Positioned( - right: 16.sp, - top: 15.sp, - child: GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.UserInfoActivity, - arguments: user.userId!.toString()); - }, - child: Container( - width: 73.sp, - height: 24.sp, - decoration: BoxDecoration( - color: Colors.black.withOpacity(0.35), - borderRadius: BorderRadius.circular(12.5.sp)), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - margin: EdgeInsets.only(left: 5.sp), - child: Text( - '查看主页', - style: TextStyle( - color: Colors.white, - fontSize: 10.sp, - ), - ), - ), - Image( - width: 15.sp, - image: AssetImage(getDisCoverImage("right_icon")), - // width: 44.sp, - ), - ], - ), - ), - )), - Positioned( - left: 6.sp, - bottom: 6.sp, - child: Container( - width: Get.width - 32.sp, - padding: EdgeInsets.only(right: 0.sp), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if (user.contact!.isNotEmpty) - wxStatusWidget( - !user.contact!.contains('*'), - user.contact!, - user.userId.toString(), - user.contactType!, - user.avatarUrl!, () { - widget.loadSignDiscoverData(user.userId.toString()); - }), - SizedBox( - height: 15.sp, - ), - Row( - children: [ - Text( - user.nickname ?? '', - style: TextStyle( - fontSize: 18.sp, - color: Color(0XFFF7FAFA), - fontWeight: FontWeight.bold), - ), - Container( - margin: EdgeInsets.only(left: 5.sp), - alignment: Alignment.center, - height: 18.sp, - padding: EdgeInsets.only(left: 6.sp, right: 6.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(9.sp), - gradient: const LinearGradient( - begin: Alignment(0.25, 0.5), - end: Alignment(0.75, 0.5), - colors: [ - Color(0xff8DFFF8), - Color(0xffB5D3FF) - ])), - child: Text( - getAgeCOntent(user!.gender ?? 0, user!.age ?? 0, - user!.role ?? 0, user!.orientation ?? 0), - style: TextStyle( - color: Colors.black, - fontSize: 12.sp, - ), - ), - ), - Container( - margin: EdgeInsets.only( - left: 4.sp, - ), - child: UserTagWidget(user.mark!), - ), - ], - ), - Container( - width: Get.width - 120.sp, - margin: EdgeInsets.only(top: 15.sp, bottom: 15.sp), - child: RichText( - overflow: TextOverflow.ellipsis, - maxLines: 2, - text: TextSpan( - children: [ - WidgetSpan( - alignment: ui.PlaceholderAlignment.middle, - // alignment: Rect.fromCenter(center: center, width: width, height: height), - child: Container( - margin: EdgeInsets.only(right: 2.sp,), - padding: EdgeInsets.only(left: 4.sp,right: 4.sp), - height: 20.sp, - width: user.city!.length > 4 ? 70.sp : user.city!.contains('km') ? user.city!.length * 13.sp : user.city!.length * 20.sp, - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(22), - color: AppColor.cityBgColor, - ), - child: Text( - user.city!, - style: TextStyle( - color: Colors.white, - fontSize: 11.sp, - fontWeight: FontWeight.w600), - ), - ), - ), - TextSpan( - text: user.signature!, - // overflow: TextOverflow.ellipsis, - style: TextStyle( - color: Colors.white, - fontSize: 18.sp,)), - ], - ), - ) - ), - Container( - width: Get.width - 110.sp, - height: 35.sp, - child: tagItem(user.interests!), - ), - ], - ), - )), - Positioned( - bottom: 5.sp, - right: 15.sp, - child: Container( - child: Column( - children: [ - GestureDetector( - onTap: () async { - widget.showGiftPannel(user.imAccid!.toString()); - }, - child: Image.asset( - getMsgImage('gift'), - width: 50.sp, - ), - ), - SizedBox( - height: 25.sp, - ), - GestureDetector( - onTap: () { - pushChatPage(user.userId.toString(), - user.imAccid!.toString(), user.nickname!); - }, - child: Image.asset( - getCircleImage( - 'chat_icon', - ), - width: 50.sp, - ), - ), - SizedBox( - height: 25.sp, - ), - GestureDetector( - onTap: () { - widget.setLike(); - }, - child: Image.asset( - getCircleImage( - user.is_follow! ? 'like_icon' : 'nor_like_icon', - ), - width: 50.sp, - ), - ), - SizedBox( - height: 20.sp, - ), - GestureDetector( - onTap: () { - _showReportDialog( - context, user.userId!.toString(), index); - }, - child: Image.asset( - getCircleImage( - 'no_look_icon', - ), - width: 50.sp, - ), - ) - ], - ), - )) - ], - )); - } - - - tagItem(List item) { - return Container( - width: Get.width, - margin: EdgeInsets.only(top: 5.sp, bottom: 5.sp), - // color: Colors.red, - // height: 45.sp, - child: ListView.builder( - scrollDirection: Axis.horizontal, - itemCount: item.length, - itemBuilder: (context, index) { - return tagWidget(item[index]['title'], item[index]['id']); - }), - ); - } - - tagWidget(String tagName, int id) { - return GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.Signal_circle_list, arguments: id); - }, - child: Container( - margin: EdgeInsets.only(right: 6.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17.0), - border: GradientBoxBorder( - gradient: - AppColor.mainVerLinearGradient, - width: 0.5.sp, - ), - color: const Color(0xFF392D53), - ), - child: Padding( - padding: EdgeInsets.only( - top: 2.sp, - bottom: 2.sp, - left: 10.sp, - right: 10.sp, - ), - child: Center( - child: Text( - tagName, - style: const TextStyle( - fontSize: 11.0, - color: Colors.white, - ), - ), - ), - ), - ), - ); - } - - void _showReportDialog( - BuildContext context, String userId, int currentIndex) { - showDialog( - context: context, - builder: (BuildContext context) { - return Dialog( - backgroundColor: Colors.transparent, - child: Container( - height: 277.sp, - padding: const EdgeInsets.all(1.0), - child: Stack( - children: [ - Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: const LinearGradient( - colors: [Color(0xFFDD3DF4), Color(0xFF30FFD9)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Container( - margin: EdgeInsets.all(1.sp), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: const LinearGradient( - colors: [Color(0xFF4C3E5F), Color(0xFF324140)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Container( - margin: EdgeInsets.only(top: 24.sp), - child: Column( - children: [ - Center( - child: Text( - "温馨提示", - style: - TextStyle(color: Colors.white, fontSize: 16.sp), - ), - ), - Container( - margin: EdgeInsets.only(top: 14.sp), - alignment: Alignment.center, - child: Image( - image: AssetImage(getCircleImage("no_look_icon_h")), - width: 70.sp, - height: 70.sp, - ), - ), - Container( - margin: EdgeInsets.only( - top: 12.sp, left: 14.sp, right: 14.sp), - alignment: Alignment.center, - child: Text( - "您确认对TA不感兴趣吗?确认之后在这个板块就看不见TA了。", - textAlign: TextAlign.center, - style: TextStyle( - color: const Color(0xCCF7FAFA), fontSize: 16.sp), - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - onTap: () { - Navigator.pop(context); - }, - child: Container( - margin: EdgeInsets.only(top: 24.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color(0x26FFFFFF), - Color(0x26FFFFFF), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 10.sp, - bottom: 10.sp, - left: 27.sp, - right: 27.sp), - child: const Text( - "再考虑考虑", - style: TextStyle( - color: Colors.white, - fontSize: 12, - ), - ), - ), - ), - SizedBox(width: 24.sp), - GestureDetector( - onTap: () { - Get.back(); - widget.sendNoLookData(); - }, - child: Container( - margin: EdgeInsets.only(top: 24.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 10.sp, - bottom: 10.sp, - left: 52.sp, - right: 52.sp), - child: const Text( - "确定", - style: TextStyle( - color: Colors.white, - fontSize: 12, - ), - ), - ), - ) - ], - ) - ], - ), - ) - ], - ), - ), - ); - }, - ); - } -} - -class DiscoverDataRefresh { - String userId; - DiscoverDataRefresh(this.userId); -} - -class Users { - int? age; - bool? auth; - String? avatarUrl; - String? bgPicUrl; - String? birthday; - bool? blacklist; - String? city; - double? distance; - bool? dust; - String? email; - bool? followBag; - int? followStatus; - int? gender; - String? genderName; - String? heartbeatValue; - int? height; - int? hugCount; - String? imAccid; - List? images; - List? interests; - String? inviteCode; - int? kyNum; - String? lastLoginLog; - String? lastLoginTime; - int? level; - List? litGifts; - int? lvType; - MapUserJumpAo? mapUserJumpAo; - String? nickname; - String? nicknameNote; - bool? online; - String? openId; - String? online_flag; - bool? partner; - bool? is_follow; - String? phoneNum; - int? popularityValue; - bool? realPersonAuth; - int? relationshipStatus; - String? signature; - bool? specialConcern; - int? storyCount; - List? tags; - int? touchTime; - int? unLockWxNum; - int? userId; - int? weight; - int? orientation; - int? role; - int? vip; - String? wxNum; - int? mark; - int? contactType; - String? contact; - List? both_cities; - List? both_interests; - - Users( - {this.age, - this.auth, - this.avatarUrl, - this.bgPicUrl, - this.birthday, - this.blacklist, - this.mark, - this.contact, - this.contactType, - this.online_flag, - this.city, - this.both_interests, - this.distance, - this.dust, - this.email, - this.is_follow, - this.vip, - this.followBag, - this.followStatus, - this.gender, - this.genderName, - this.heartbeatValue, - this.height, - this.hugCount, - this.imAccid, - this.role, - this.images, - this.interests, - this.inviteCode, - this.kyNum, - this.lastLoginLog, - this.lastLoginTime, - this.level, - this.litGifts, - this.lvType, - this.mapUserJumpAo, - this.nickname, - this.nicknameNote, - this.online, - this.openId, - this.partner, - this.phoneNum, - this.popularityValue, - this.realPersonAuth, - this.relationshipStatus, - this.signature, - this.specialConcern, - this.storyCount, - this.tags, - this.touchTime, - this.unLockWxNum, - this.both_cities, - this.userId, - this.orientation, - this.weight, - this.wxNum}); - - Users.fromJson(Map json) { - age = json['age']; - mark = json['mark']; - vip = json['vip']; - role = json['role']; - auth = json['auth']; - contactType = json['contactType'] ?? 0; - contact = json['contact'] ?? ''; - online_flag = json['online_flag']; - both_interests = json['both_interests'] ?? []; - both_cities = json['both_cities'] ?? []; - is_follow = json['is_follow']; - interests = json['interests']; - avatarUrl = json['avatar']; - bgPicUrl = json['bgPicUrl']; - birthday = json['birthday']; - blacklist = json['blacklist']; - city = json['city']; - orientation = json['orientation']; - distance = json['distance']; - dust = json['dust']; - email = json['email']; - followBag = json['followBag']; - followStatus = json['followStatus']; - gender = json['gender']; - genderName = json['genderName']; - heartbeatValue = json['heartbeatValue'].toString(); - height = json['height']; - hugCount = json['hugCount']; - imAccid = json['account_id']; - images = json['images']; - inviteCode = json['inviteCode']; - kyNum = json['kyNum']; - lastLoginLog = json['lastLoginLog']; - lastLoginTime = json['lastLoginTime']; - level = json['level']; - litGifts = json['litGifts']; - lvType = json['lvType']; - mapUserJumpAo = json['mapUserJumpAo'] != null - ? new MapUserJumpAo.fromJson(json['mapUserJumpAo']) - : null; - nickname = json['nickname']; - nicknameNote = json['nicknameNote']; - online = json['isOnline']; - openId = json['openId']; - partner = json['partner']; - phoneNum = json['phoneNum']; - popularityValue = json['popularityValue']; - realPersonAuth = json['realPersonAuth']; - relationshipStatus = json['relationshipStatus']; - signature = json['signature']; - specialConcern = json['specialConcern']; - storyCount = json['storyCount']; - tags = json['tags']; - touchTime = json['touchTime']; - unLockWxNum = json['unLockWxNum']; - userId = json['id']; - weight = json['weight']; - wxNum = json['wx_num']; - } - - Map toJson() { - final Map data = new Map(); - data['age'] = this.age; - data['auth'] = this.auth; - data['avatarUrl'] = this.avatarUrl; - data['bgPicUrl'] = this.bgPicUrl; - data['birthday'] = this.birthday; - data['blacklist'] = this.blacklist; - data['city'] = this.city; - data['distance'] = this.distance; - data['dust'] = this.dust; - data['email'] = this.email; - data['followBag'] = this.followBag; - data['followStatus'] = this.followStatus; - data['gender'] = this.gender; - data['genderName'] = this.genderName; - data['heartbeatValue'] = this.heartbeatValue; - data['height'] = this.height; - data['hugCount'] = this.hugCount; - data['imAccid'] = this.imAccid; - if (this.images != null) { - data['images'] = this.images!.map((v) => v.toJson()).toList(); - } - data['inviteCode'] = this.inviteCode; - data['kyNum'] = this.kyNum; - data['lastLoginLog'] = this.lastLoginLog; - data['lastLoginTime'] = this.lastLoginTime; - data['level'] = this.level; - if (this.litGifts != null) { - data['litGifts'] = this.litGifts!.map((v) => v.toJson()).toList(); - } - data['lvType'] = this.lvType; - if (this.mapUserJumpAo != null) { - data['mapUserJumpAo'] = this.mapUserJumpAo!.toJson(); - } - data['nickname'] = this.nickname; - data['nicknameNote'] = this.nicknameNote; - data['online'] = this.online; - data['openId'] = this.openId; - data['partner'] = this.partner; - data['phoneNum'] = this.phoneNum; - data['popularityValue'] = this.popularityValue; - data['realPersonAuth'] = this.realPersonAuth; - data['relationshipStatus'] = this.relationshipStatus; - data['signature'] = this.signature; - data['specialConcern'] = this.specialConcern; - data['storyCount'] = this.storyCount; - if (this.tags != null) { - data['tags'] = this.tags!.map((v) => v.toJson()).toList(); - } - data['touchTime'] = this.touchTime; - data['unLockWxNum'] = this.unLockWxNum; - data['userId'] = this.userId; - data['weight'] = this.weight; - data['wxNum'] = this.wxNum; - return data; - } -} - -class MapUserJumpAo { - int? id; - String? roomId; - String? title; - int? type; - - MapUserJumpAo({this.id, this.roomId, this.title, this.type}); - - MapUserJumpAo.fromJson(Map json) { - id = json['id']; - roomId = json['roomId']; - title = json['title']; - type = json['type']; - } - - Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['roomId'] = this.roomId; - data['title'] = this.title; - data['type'] = this.type; - return data; - } -} - -class msgPageRefresh {} diff --git a/circle_app/lib/app/circle/widgets/discover_item.dart b/circle_app/lib/app/circle/widgets/discover_item.dart deleted file mode 100644 index f9aae45..0000000 --- a/circle_app/lib/app/circle/widgets/discover_item.dart +++ /dev/null @@ -1,697 +0,0 @@ -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:flutter_swiper/flutter_swiper.dart'; -import 'package:get/get.dart'; -import 'package:gradient_borders/box_borders/gradient_box_border.dart'; - -import '../../../common/colors/app_color.dart'; -import '../../../common/const.dart'; -import '../../../network/api.dart'; -import '../../../network/dio_manager.dart'; -import '../../../router/app_routers.dart'; -import '../../../util/util.dart'; -import '../../chat/TIMUIKitChat/TIMUIKitMessageItem/TIMUIKitMessageReaction/tim_uikit_chat_gift_elem.dart'; -import '../../home/logic.dart'; -import 'discover.dart'; - - -class DiscoverItem extends StatefulWidget { - double screenHeight; - Function deleteCallBack; - Function likeCallBack; - List list; - int index; - String onLineStr; - - DiscoverItem(this.screenHeight,this.list,this.index,this.onLineStr,this.deleteCallBack,this.likeCallBack, {super.key}); - - - // screenHeight - @override - _DiscoverItemState createState() => new _DiscoverItemState(); - -} - -class _DiscoverItemState extends State { - // TODO: add state variables and methods - var user; - String onLineStr = ''; - HomeLogic logic = Get.find(); - - @override - void initState() { - // TODO: implement initState - super.initState(); - user = Users.fromJson(widget.list[widget.index]); - onLineStr= widget.onLineStr; - } - - @override - Widget build(BuildContext context) { - // TODO: add widget build method - return Container( - height: widget.screenHeight, - width: Get.width, - margin: EdgeInsets.only( - top: 5.sp, left: 16.sp, right: 16.sp), - child: Stack( - children: [ - Container( - clipBehavior: Clip.hardEdge, - decoration: BoxDecoration( - color: Colors.black.withOpacity(0.25), - borderRadius: BorderRadius.circular(10.sp), - // border: GradientBoxBorder( - // gradient: - // AppColor.mainVerLinearGradient, - // width: 1.sp, - // ), - // image: DecorationImage( - // fit: BoxFit.fill, - // image: AssetImage( - // getCircleImage('open_vip_bg'), - // )) - ), - height: widget.screenHeight, - width: Get.width, - child: ClipRRect( - borderRadius: BorderRadius.circular(10), - // clipBehavior: Clip.hardEdge, - child: Container( - // padding: EdgeInsets.all(2.sp), - child: Swiper( - autoplay: false, - loop: user.images!.length == 1 - ? false - : true, - itemBuilder: - (BuildContext context, int index) { - // print(index); - return GestureDetector( - onTap: () { - List imgList = []; - user.images!.forEach((element) { - imgList.add(element); - }); - - Get.toNamed(AppRoutes.Swiper, - arguments: { - 'imaglist': imgList, - 'index': index, - 'userId':user.id.toString() - }); - }, - child: CachedNetworkImage( - imageUrl: user.images![index], - fit: BoxFit.cover, - width: Get.width, - height:widget.screenHeight, - )); - }, - itemCount: user.images!.length, - ), - )), - ), - Positioned( - left: 5.sp, - top: 10.sp, - child: Container( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - if (onLineStr.isNotEmpty) - Container( - height: 24.sp, - padding: EdgeInsets.only( - left: 6.sp, right: 6.sp), - decoration: BoxDecoration( - color: Colors.black - .withOpacity(0.35), - borderRadius: - BorderRadius.circular( - 12.sp)), - child: Row( - children: [ - Container( - width: 6.sp, - height: 6.sp, - margin: EdgeInsets.only( - right: 4.sp), - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular( - 3.sp), - color: - const Color(0xFFCE51FF), - ), - ), - // if (logic.online) - Text( - onLineStr, - style: TextStyle( - color: Colors.white, - fontSize: 16.sp), - ), - ], - ), - ), - if (user.both_cities!.isNotEmpty) - SizedBox( - height: 8.sp, - ), - if (user.both_cities!.isNotEmpty) - Container( - height: 24.sp, - padding: EdgeInsets.only( - left: 6.sp, right: 6.sp), - decoration: BoxDecoration( - color: Colors.black - .withOpacity(0.35), - borderRadius: - BorderRadius.circular( - 12.sp)), - child: Row( - children: [ - Container( - width: 6.sp, - height: 6.sp, - margin: EdgeInsets.only( - right: 4.sp), - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular( - 3.sp), - color: const Color( - 0xFFCE51FF), - ), - ), - // if (logic.online) - Text( - "你们都来过${user.both_cities!.first}", - style: TextStyle( - color: Colors.white, - fontSize: 16.sp), - ), - ], - )), - if (user.both_cities!.isNotEmpty) - SizedBox( - height: 8.sp, - ), - if (user.both_interests!.isNotEmpty) - Container( - height: 24.sp, - padding: EdgeInsets.only( - left: 6.sp, right: 6.sp), - decoration: BoxDecoration( - color: Colors.black - .withOpacity(0.35), - borderRadius: - BorderRadius.circular( - 12.sp)), - child: Row( - children: [ - Container( - width: 6.sp, - height: 6.sp, - margin: EdgeInsets.only( - right: 4.sp), - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular( - 3.sp), - color: const Color( - 0xFFCE51FF), - ), - ), - // if (logic.online) - Text( - "你们有共同的圈子:${user.both_interests!.first['title']}", - style: TextStyle( - color: Colors.white, - fontSize: 16.sp), - ), - ], - )), - ], - ), - )), - Positioned( - right: 16.sp, - top: 16.sp, - child: GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.UserInfoActivity, - arguments: user.userId!.toString()); - }, - child: Container( - width: 73.sp, - height: 25.sp, - decoration: BoxDecoration( - gradient: - AppColor.mainVerLinearGradient, - borderRadius: - BorderRadius.circular(12.5.sp)), - child: Row( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Container( - margin: EdgeInsets.only(left: 5.sp), - child: Text( - '查看主页', - style: TextStyle( - color: Colors.white, - fontSize: 10.sp, - ), - ), - ), - Image( - width: 15.sp, - image: AssetImage( - getDisCoverImage("right_icon")), - // width: 44.sp, - ), - ], - ), - ), - )), - - Positioned( - left: 6.sp, - bottom: 6.sp, - child: Container( - width: Get.width - 32.sp, - padding: EdgeInsets.only(right: 0.sp), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - if (user.wxNum != null && logic.isProd) - wxStatusWidget( - user.unLockWxNum == 1, - user.wxNum!, - user.userId.toString(), - 0, - user.avatarUrl!, () { - loadSignDiscoverData( - user.userId.toString()); - }), - SizedBox( - height: 15.sp, - ), - Row( - children: [ - Text( - user.nickname ?? '', - style: TextStyle( - fontSize: 18.sp, - color: Color(0XFFF7FAFA), - fontWeight: FontWeight.bold), - ), - Container( - margin: - EdgeInsets.only(left: 5.sp), - alignment: Alignment.center, - height: 18.sp, - padding: EdgeInsets.only( - left: 6.sp, right: 6.sp), - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular( - 9.sp), - gradient: - const LinearGradient( - begin: Alignment( - 0.25, 0.5), - end: Alignment( - 0.75, 0.5), - colors: [ - Color(0xff8DFFF8), - Color(0xffB5D3FF) - ])), - child: Text( - getAgeCOntent( - user!.gender ?? 0, - user!.age ?? 0, - user!.role ?? 0, - user!.orientation ?? 0), - style: TextStyle( - color: Colors.black, - fontSize: 12.sp, - ), - ), - ), - if (user.vip! > 0) - Container( - margin: EdgeInsets.only( - left: 4.sp, - ), - child: Image.asset( - getCircleImage(user!.vip == 1 - ? 'vip' - : 'year_vip'), - width: 36.sp, - ), - ), - ], - ), - Container( - width: Get.width - 120.sp, - margin: EdgeInsets.only( - top: 15.sp, bottom: 15.sp), - child: Text( - user.signature! ?? '', - overflow: TextOverflow.ellipsis, - maxLines: - (user.signature! ?? '').length > - 15 - ? 2 - : 1, - style: TextStyle( - fontSize: 16.sp, - color: const Color(0XFFF7FAFA)), - ), - ), - Container( - width: Get.width - 110.sp, - height: 35.sp, - child: tagItem(user.interests!), - ), - ], - ), - )), - Positioned( - bottom: 5.sp, - right: 15.sp, - child: Container( - child: Column( - children: [ - GestureDetector( - onTap: () async { - showGiftPannel(user.imAccid!.toString()); - }, - child: Image.asset( - getMsgImage('gift'), - width: 50.sp, - ), - ), - SizedBox( - height: 25.sp, - ), - GestureDetector( - onTap: () { - pushChatPage( - user.userId.toString(), - user.imAccid!.toString(), - user.nickname!); - }, - child: Image.asset( - getCircleImage( - 'chat_icon', - ), - width: 50.sp, - ), - ), - SizedBox( - height: 25.sp, - ), - GestureDetector( - onTap: () { - widget.likeCallBack(); - }, - child: Image.asset( - getCircleImage( - user.is_follow! - ? 'like_icon' - : 'nor_like_icon', - ), - width: 50.sp, - ), - ), - SizedBox( - height: 20.sp, - ), - GestureDetector( - onTap: () { - _showReportDialog(context, - user.userId!.toString(), widget.index); - }, - child: Image.asset( - getCircleImage( - 'no_look_icon', - ), - width: 50.sp, - ), - ) - ], - ), - )) - ], - )); - } - - - void _showReportDialog( - BuildContext context, String userId, int currentIndex) { - showDialog( - context: context, - builder: (BuildContext context) { - return Dialog( - backgroundColor: Colors.transparent, - child: Container( - height: 277.sp, - padding: const EdgeInsets.all(1.0), - child: Stack( - children: [ - Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: const LinearGradient( - colors: [Color(0xFFDD3DF4), Color(0xFF30FFD9)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Container( - margin: EdgeInsets.all(1.sp), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: const LinearGradient( - colors: [Color(0xFF4C3E5F), Color(0xFF324140)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Container( - margin: EdgeInsets.only(top: 24.sp), - child: Column( - children: [ - Center( - child: Text( - "温馨提示", - style: - TextStyle(color: Colors.white, fontSize: 16.sp), - ), - ), - Container( - margin: EdgeInsets.only(top: 14.sp), - alignment: Alignment.center, - child: Image( - image: AssetImage(getCircleImage("no_look_icon_h")), - width: 70.sp, - height: 70.sp, - ), - ), - Container( - margin: EdgeInsets.only( - top: 12.sp, left: 14.sp, right: 14.sp), - alignment: Alignment.center, - child: Text( - "您确认对TA不感兴趣吗?确认之后在这个板块就看不见TA了。", - textAlign: TextAlign.center, - style: TextStyle( - color: const Color(0xCCF7FAFA), fontSize: 16.sp), - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - onTap: () { - Navigator.pop(context); - }, - child: Container( - margin: EdgeInsets.only(top: 24.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color(0x26FFFFFF), - Color(0x26FFFFFF), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 10.sp, - bottom: 10.sp, - left: 27.sp, - right: 27.sp), - child: const Text( - "再考虑考虑", - style: TextStyle( - color: Colors.white, - fontSize: 12, - ), - ), - ), - ), - SizedBox(width: 24.sp), - GestureDetector( - onTap: () { - Get.back(); - sendNoLookData(userId, currentIndex); - }, - child: Container( - margin: EdgeInsets.only(top: 24.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 10.sp, - bottom: 10.sp, - left: 52.sp, - right: 52.sp), - child: const Text( - "确定", - style: TextStyle( - color: Colors.white, - fontSize: 12, - ), - ), - ), - ) - ], - ) - ], - ), - ) - ], - ), - ), - ); - }, - ); - } - - void sendNoLookData(String userId, int index) async { - var data = await DioManager.instance.post(url: Api.uninterested + userId); - if (data['code'] == 200) { - showOKToast('操作成功'); - // widget.list.removeAt(index); - widget.deleteCallBack(); - // setState(() {}); - } - } - - - loadSignDiscoverData(String userId) async { - try { - var result = await DioManager.instance - .get(url: Api.getFindPageUserByUserId, params: { - 'userId': userId, - 'lat': '0', - 'lng': '0', - }); - - int initIndex = 0; - widget.list.forEach((element) { - if (element['id'].toString() == userId) { - initIndex = widget.list.indexOf(element); - } - }); - - widget.list[initIndex] = result['data']; - setState(() {}); - } catch (e) {} - } - - - tagItem(List item) { - return Container( - width: Get.width, - margin: EdgeInsets.only(top: 5.sp, bottom: 5.sp), - // color: Colors.red, - // height: 45.sp, - child: ListView.builder( - scrollDirection: Axis.horizontal, - itemCount: item.length, - itemBuilder: (context, index) { - return tagWidget(item[index]['title'], item[index]['id']); - }), - ); - } - - tagWidget(String tagName, int id) { - return GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.Signal_circle_list, arguments: id); - }, - child: Container( - margin: EdgeInsets.only(right: 6.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17.0), - gradient: const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - ), - color: const Color(0xFF392D53), - ), - child: Container( - margin: EdgeInsets.all(0.2.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17.0), - color: const Color(0xFF392D53), - ), - child: Padding( - padding: EdgeInsets.only( - top: 2.sp, - bottom: 2.sp, - left: 10.sp, - right: 10.sp, - ), - child: Center( - child: Text( - tagName, - style: const TextStyle( - fontSize: 11.0, - color: Colors.white, - ), - ), - ), - ), - ), - ), - ); - } - -} diff --git a/circle_app/lib/app/circle/widgets/info_list_view.dart b/circle_app/lib/app/circle/widgets/info_list_view.dart deleted file mode 100644 index 10454ea..0000000 --- a/circle_app/lib/app/circle/widgets/info_list_view.dart +++ /dev/null @@ -1,1652 +0,0 @@ - -import 'dart:async'; - -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:circle_app/app/circle/logic.dart'; -import 'package:circle_app/app/circle/state.dart'; -import 'package:circle_app/app/circle/widgets/list_logic.dart'; -import 'package:circle_app/app/circle/widgets/video_item.dart'; -import 'package:circle_app/app/circle/logic.dart'; -import 'package:circle_app/app/select_circle/logic.dart'; -import 'package:circle_app/common/Widgets/base_tip_widget.dart'; -import 'package:circle_app/common/Widgets/circle_share.dart'; -import 'package:circle_app/common/Widgets/text_more.dart'; -import 'package:circle_app/main.dart'; -import 'package:circle_app/network/dio_manager.dart'; -import 'package:circle_app/router/app_routers.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:get/get_core/src/get_main.dart'; -import 'package:shared_preferences/shared_preferences.dart'; - -import '../../../common/Widgets/tag_widget.dart'; -import '../../../util/SharedPreferencesHelper.dart'; -import '../../../util/eventBus.dart'; -import '../../circle_list/logic.dart'; - -class InfoListView extends StatefulWidget { - // Get.lazyPut(() => ListLogic()); - - var logic; - Circle bean; - int index; - // Function updateBeanCall; - - InfoListView(this.index, this.bean, this.logic,{super.key}); - - - - @override - State createState() => InfoListViewState(); -} -typedef void MyListViewback(State result); -class InfoListViewState extends State with AutomaticKeepAliveClientMixin { - @override - bool get wantKeepAlive => true; - final ScrollController scrollController = ScrollController(); - - - ListLogic? listsLg; - - int callOutPage = 1; - - bool isLoad = true; - bool callOutMore = true; - var circleId = ''; - List lists = []; - - - - @override - void dispose() { - // TODO: implement dispose - if(null!=callRefreshCicle){ - EventBusManager.cancelSubscription(callRefreshCicle!); - } - if(null!=scroToTop){ - EventBusManager.cancelSubscription(scroToTop!); - - } - - if (cicleInfoRefresh != null) { - cicleInfoRefresh!.cancel(); - } - scrollController.dispose(); - super.dispose(); - - - } - - StreamSubscription? callRefreshCicle =null; - StreamSubscription? cicleInfoRefresh =null; - StreamSubscription? scroToTop =null; - - @override - void initState() { - // TODO: implement initState - super.initState(); - scrollController.addListener(() { - try { - if (scrollController.position.pixels == - scrollController.position.maxScrollExtent) { - loadMore(); - } - } catch (_) {} - }); - circleId = widget.bean.id.toString(); - - // if (Get.currentRoute == AppRoutes.Home || Get.currentRoute == AppRoutes.MyCircle) { - loadCallOutListData(); - // } - - - - - callRefreshCicle = EventBusManager.on().listen((event) { - if(widget.bean.id.toString() == event.circleId){ - callOutPage = 1; - loadCallOutListData(); - } - }); - - cicleInfoRefresh = EventBusManager.on().listen((event) { - if(widget.bean.id.toString() == event.circleId){ - refreshCircleData(); - } - }); - - - // - // scroToTop = EventBusManager.on().listen((event) { - // if (widget.logic.state.index == widget.index) { - // scrollController.animateTo( - // 0.0, - // duration: Duration(milliseconds: 300), - // curve: Curves.easeInOut, - // ); - // } - // - // }); - - // widget.back(widget.createState()); - } - - - loadCircleInfo() async{ - var data = await DioManager.instance.get( - url: "/up-service/interest/$circleId",); - if (data["code"] == 200) { - widget.bean = Circle.fromJson(data['data']); - if (mounted) { - setState(() { - - }); - } - - } - } - - loadCallOutListData() async { - var data = await DioManager.instance.get( - url: "/up-service/interest/$circleId/callouts", - params: {"page": callOutPage, "page_size": "20"}); - if (data["code"] == 200) { - List dataList = data["data"]["lists"] ?? []; - if (callOutPage == 1) { - if (lists.isNotEmpty) { - lists.clear(); - } - } - if (dataList.isNotEmpty) { - callOutMore = true; - for (var element in dataList) { - lists.add(Lists.fromJson(element)); - } - callOutPage++; - } - callOutMore = dataList.length == 20; - if (mounted) { - setState(() {}); - } - } else { - showOKToast(data["msg"]); - } - } - - - - setCircleId(String id) { - circleId = id; - loadCallOutListData(); - } - - void refreshData() { - callOutPage = 1; - callOutMore = true; - loadCallOutListData(); - } - - void loadMore() { - if (callOutMore == false) return; - loadCallOutListData(); - } - - void pushOtherPeopleHomePage(String userId) { - Get.toNamed(AppRoutes.UserInfoActivity, arguments: userId); - - // if (bean.isQueen) { - // showJoinCiclePiker(cicleId); - // } else { - //跳转消息页面 - // Get.bottomSheet(Open_vip_tipPage(), - // isScrollControlled: true, - // enableDrag: false, - // ); - // } - } - - void pushHomePage(Lists bean, String cicleId) async { - SharedPreferencesHelper.getInstance().then((sharedPreferences) { - int userId = sharedPreferences.getInt(SharedPreferencesHelper.USERID); - if (bean.user!.id == userId) { - Get.toNamed(AppRoutes.UserInfoActivity); - } else { - Get.toNamed(AppRoutes.UserInfoActivity, - arguments: bean.user!.id!.toString()); - } - }); - - - - - - // if (bean.isQueen) { - // showJoinCiclePiker(cicleId); - // } else { - //跳转消息页面 - // Get.bottomSheet(Open_vip_tipPage(), - // isScrollControlled: true, - // enableDrag: false, - // ); - // } - } - - void pushMsgPage(Lists bean, String cicleId) async { - if (widget.bean.is_limit&&widget.bean.amount > 0) { - await refreshCircleData(); - } - - if (widget.bean.is_limit&&widget.bean.amount>0) { - showJoinCiclePiker(cicleId,widget.bean.amount.toString(),widget.bean.oldAmount.toString(),2,(payResult){ - widget.bean.is_limit = false; - if (Get.isRegistered()) { - var logic = Get.find(); - for (var element in logic.circle.lists) { - if (element.id == widget.bean.id) { - element.is_limit = false; - element.isJoin = true; - } - } - logic.update(); - } - Get.back(); - },widget.bean.ios_item); - return; - } - - var sp = await SharedPreferencesHelper.getInstance(); - String myUserId = sp.getMyUserId(); - if (bean.user!.id.toString() == myUserId) { - showOKToast('无法与自己私聊'); - return; - } - // if () - - var data = await DioManager.instance.get( - url: "/up-service/callout/${bean.id}/chat",); - if (data["code"] == 200) { - pushChatPage(data['data']['account_id'].toString().split("_").last,data['data']['account_id'], bean.user!.nickname!); - - await Future.delayed(Duration(seconds: 1)); - - - SharedPreferences sharedPreferences =await SharedPreferences.getInstance(); - // SharedPreferencesHelper.getInstance().then((sharedPreferences) { - int userId = sharedPreferences.getInt(SharedPreferencesHelper.USERID)??0; - String avatar = sharedPreferences.getString(SharedPreferencesHelper.AVATAR)??""; - String name = sharedPreferences.getString(SharedPreferencesHelper.NAME)??""; - - bool isContain = false; - for (var info in bean.chat!.users!) { - if (info.id == userId) { - isContain = true; - } - } - if (!isContain) { - bean.chat!.users!.add(Users(avatar: avatar,id: userId,nickname: name)); - bean.chat!.count = bean.chat!.count! + 1; - widget.logic.update(); - } - - } - } - - @override - Widget build(BuildContext context) { - if (widget.bean.image.isEmpty) { - loadCircleInfo(); - } - List urlList = widget.bean.lastJoinUsers; - List widgets = []; - int i = 0; - // print(urlList); - if(null!=urlList){ - urlList.forEach((element) { - if(widgets.length>2){ - return; - } - widgets.add(Positioned( - left: 15.sp * i, - child: circleWidget(element.avatar! ?? "https://qiniuyun.leyuan666.com/quanzi/avatar/default.png",element.id.toString()), - )); - i++; - }); - } - - - return ClipRRect( - borderRadius: BorderRadius.circular(10.sp), - child: Container( - width: Get.width, - // margin: - - child: Stack( - children: [ - ClipRRect( - borderRadius: BorderRadius.circular(10.sp), - child: SizedBox( - width: Get.width, - height: Get.height, - child: Image.asset( - getCircleImage('circle_bg'), - fit: BoxFit.cover, - ), - )), - Container( - height: Get.height, - width: Get.width, - margin: EdgeInsets.only(top: 72.sp), - child: RefreshIndicator( - onRefresh: () async { - refreshData(); - refreshCircleData(); - }, - child: - // lists.isEmpty - // ? !callOutMore - // ? noResultWidget() - // : loaddingWidget(true) - // : - ListView.builder( - physics: const AlwaysScrollableScrollPhysics(), - addAutomaticKeepAlives:false, - addRepaintBoundaries:false, - scrollDirection: Axis.vertical, - controller: scrollController, - itemCount: lists.length + 2, - itemBuilder: (context, index) { - if (index == 0) { - return Container( - padding: EdgeInsets.only( - left: 12.sp, right: 12.sp), - // height:urlList.length==0?47.sp: 118.sp, - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.fill, - image: AssetImage( - getCircleImage('circle_desc')))), - child: Container( - margin: EdgeInsets.only(top: 10.sp,bottom: 10.sp), - child: Column( - children: [ - Container( - margin: EdgeInsets.only(bottom: 7.sp), - width: Get.width, - // height: 50.sp, - child: HideText(text: widget.bean.intro,maxWidth: Get.currentRoute == AppRoutes.Home ? Get.width - 90.sp : Get.width - 60.sp,additionText: '查看更多',maxLines: 3,style: TextStyle(color: Colors.white, fontSize: 17.sp),additionStyle: TextStyle(color: const Color(0xFFFF4DF6), fontSize: 17.sp),onTap: () { - _showTextContentDialog( - context, widget.bean.intro,widget.bean.title); - }, - )), - - GestureDetector( - behavior:HitTestBehavior.opaque, - onTap: (){ - // showToast("点个鸡毛,星哥还没做"); - // Get.toNamed(AppRoutes.FriendsActivity,arguments: '3'); - }, - child:urlList.length==0?Container(): Container( - height: 30.sp, - child: Row( - children: [ - SizedBox( - height: 30.sp, - width: 30.0.sp + - 15.sp * - (widgets.length - - 1.sp), - child: Stack( - alignment: Alignment.center, - children: widgets, - ), - ), - SizedBox( - width: 4.sp, - ), - Text( - '${convertToTenThousand(widget.bean.joinTotal)}圈友加入', - style: TextStyle( - color: Colors.white, - fontSize: 12.sp), - ), - SizedBox( - width: 8.sp, - ), - // GestureDetector( - // onTap: () { - // Get.bottomSheet( - // CircleShare('','',widget.bean), isScrollControlled: true, - // enableDrag: false - // ); - // }, - // child: Container( - // height: 30.sp, - // alignment: Alignment.center, - // child: Image.asset( - // getCircleImage('play'), - // width: 20.sp, - // ), - // ), - // ) - ], - ), - ), - ), - ], - ), - ), - ); - } else if (lists.length + 1 > index) { - Lists list = lists[index - 1]; - if (list.isQueen!) { - return vipDynamicItem(list); - } else { - return normalDynamicItem(list); - } - } else { - return Container( - margin: EdgeInsets.only( - top: callOutMore ? 0 : 10.sp), - child: loaddingWidget(callOutMore)); - } - }), - ), - ), - ClipRRect( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(10.sp), - topRight: Radius.circular(10.sp)), - child: Container( - padding: EdgeInsets.only(left: 12.sp, right: 12.sp), - height: 72.sp, - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.fill, - image: - AssetImage(getCircleImage('top_circle_bg')))), - child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - onTap: () { - if (widget.bean.isJoin) { - _showOutCircleDialog(Get.context!, widget.logic, widget.bean); - } - }, - child: Container( - width: 42.sp, - height: 42.sp, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8.0), - gradient: const LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [ - Color(0xFF71F3F2), - Color(0xFFF558FF), - ], - stops: [0.0365, 0.9427], - ), - ), - padding: EdgeInsets.all(1.sp), - child: widget.bean.image.isNotEmpty ? ClipRRect( - borderRadius: BorderRadius.circular(8.0), - child: CachedNetworkImage( - imageUrl:widget.bean.image, - width: 40.sp, - height: 40.sp, - fit:BoxFit.cover - ) , - ) : Container(), - ), - ), - Expanded( - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: (){ - scrollController.animateTo( - 0.0, // Scroll to the top - duration: Duration(milliseconds: 300), - curve: Curves.easeInOut, - ); - }, - child: Container( - padding: EdgeInsets.only(left: 8.sp, top: 12.sp), - // alignment: Alignment., - height: 72.sp, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - widget.bean.title, - style: TextStyle( - color: Colors.white, - fontSize: 18.sp, - fontWeight: FontWeight.w600), - ), - SizedBox( - height: 4.sp, - ), - Text( - '${convertToTenThousand(widget.bean.viewTotal)}人看过', - textAlign: TextAlign.left, - style: TextStyle( - color: const Color(0xff03FEFB), - fontSize: 12.sp, - ), - ), - ], - ), - ), - )), - GestureDetector(//加入圈子 - onTap: () async { - if (widget.bean.isJoin) { - Get.bottomSheet( - CircleShare('','',widget.bean), isScrollControlled: true, - enableDrag: false - ); - } else { - await widget.logic.outCircle( - widget.bean.id.toString(), - widget.bean.isJoin); - widget.logic.update(); - } - }, - child: Stack( - alignment: Alignment.center, - children: [ - Opacity( - opacity: 0.5, - - child: Image.asset( - getCircleImage('add'), - width: 60.sp, - ), - ), - Text( - !widget.bean.isJoin ? '申请加入' : '分享有奖', - style: TextStyle( - color: Colors.white, fontSize: 12.sp), - ) - ], - )) - ], - ), - )), - Positioned( - top: 70.sp, - child: Image.asset( - getCircleImage('circle_line'), - width: Get.width, - )), - if (Get.currentRoute == AppRoutes.Home) - Positioned( - bottom: 36.sp, - right: 10.sp, - child: GestureDetector( - onTap: () async { - List numbers = []; - numbers.add(MyConfigData( - widget.bean.id.toString(), - widget.bean.title, - false)); - var data = await Get.toNamed( - AppRoutes.Call_out, - arguments: {'numbers': numbers} - ); - }, - child: Image.asset( - getCircleImage('send_msg'), - width: 70.sp, - ))) - ], - ))); - } - - void _showTextContentDialog(BuildContext context, String msg,String title) { - showDialog( - context: context, - builder: (BuildContext context) { - return Dialog( - backgroundColor: Colors.transparent, - child: Container( - height: 300.sp, - padding: const EdgeInsets.all(1.0), - child: Stack( - children: [ - - Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: const LinearGradient( - colors: [Color(0xFFDD3DF4), Color(0xFF30FFD9)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Container( - margin: EdgeInsets.all(1.sp), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: const LinearGradient( - colors: [Color(0xFF4C3E5F), Color(0xFF324140)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Positioned( - top: 15, - left: 0, - right: 0, - child: Center(child: Text(title, style: TextStyle( - color: const Color(0xFFF7FAFA), fontSize: 16.sp)),)), - Container( - margin: EdgeInsets.only(top: 24.sp,bottom: 24.sp), - child: Container( - margin: EdgeInsets.only( - top: 12.sp, left: 14.sp, right: 14.sp), - alignment: Alignment.center, - child: SingleChildScrollView(child: Text( - msg, - textAlign: TextAlign.left, - style: TextStyle( - color: const Color(0xCCF7FAFA), fontSize: 16.sp), - ),), - ), - ), - Positioned( - top:8.sp, - right: 10.sp, - child: GestureDetector( - onTap: () { - Get.back(); - }, - child: Icon( - Icons.close,color: Colors.white, - size: 20.sp, - ), - )), - ], - ), - ), - ); - }, - ); - } - - ///至尊喊话 - vipDynamicItem(Lists lists) { - Widget descText = widget.logic.openCallOutIdList.contains(lists.id) ? Text( - lists.content!, - style: TextStyle(color: Colors.white, fontSize: 14.sp), - ) : HideText(text: lists.content!,maxWidth: Get.currentRoute == AppRoutes.Home ? Get.width - 90.sp : Get.width - 20.sp,additionText: '查看更多',maxLines: 5,style: TextStyle(color: Colors.white, fontSize: 14.sp),additionStyle: TextStyle(color: const Color(0xFFFF4DF6), fontSize: 14.sp),onTap: () { - widget.logic.openCallOutIdList.add(lists.id); - setState(() { - - }); - }, - ); - - // List urlList = bean.lastJoinUsers; - List widgets = []; - int index = 0; - for (var element in lists.chat!.users!) { - widgets.add(Positioned( - left: 12.sp * index, - child: circleWidget(element.avatar!,element.id.toString(), width: 24), - )); - index++; - } - if (widgets.isNotEmpty) { - widgets.add(Positioned( - left: 12.sp * lists.chat!.users!.length, - child: Image.asset( - getCircleImage('more'), - width: 24.sp, - ))); - } - - double picHeight = 0.0; - - - if (lists.album != null) { - if (lists.album!.isNotEmpty) { - Album info = lists.album!.first; - - if (info.type == 1) { - double picWidth = (Get.width - (widget.logic.runtimeType == LikeLogic ? 100.sp : 60.sp))/3 + 45; - if (lists.album!.length > 3) { - picHeight = picWidth * 2; - } else { - picHeight = picWidth; - } - } else { - picHeight = 200.sp; - } - } - } - - // double widgetHeight = 130.sp + contentHeight(lists.content!) + picHeight; - - return Container( - margin: EdgeInsets.only(top: 10.sp), - width: Get.width, - // height: widgetHeight, - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.fill, - image: AssetImage( - getCircleImage('pic_bg'), - ))), - child: Stack(children: [ - Positioned( - left: 0, - top: 2.sp, - height: 18.sp, - child: Image.asset(getCircleImage('vip_say')), - ), - Positioned( - right: 2.sp, - top: 2.sp, - - child: Stack( - alignment: Alignment.center, - children: [ - Container( - // margin: EdgeInsets.only(top: 5.sp,right: 5.sp), - padding: EdgeInsets.only(left: 15.sp,right: 15.sp), - alignment: Alignment.center, - height: 28.sp, - decoration: BoxDecoration( - color: Color.fromRGBO(52, 41, 67, 1), - borderRadius: BorderRadius.only(topLeft: Radius.circular(0),bottomRight: Radius.circular(0),topRight: Radius.circular(12.sp),bottomLeft: Radius.circular(12.sp) ) - ), - child:Text( - - (lists.user!.city ?? '外星').length > 4 ? (lists.user!.city ?? '外星').substring(0,4) + '...' :(lists.user!.city ?? '外星'), - style: TextStyle(color: Colors.white, fontSize: 15.sp), - ), - ) - ], - ), - ), - Container( - // height: widgetHeight, - width: Get.width, - padding: EdgeInsets.only(top: 12.sp, left: 12.sp, right: 12.sp), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 72.sp, - child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - onTap: ()async { - var sp = await SharedPreferencesHelper.getInstance(); - String myUserId = sp.getMyUserId(); - - if(lists.user?.id!.toString() == myUserId){ - Get.toNamed(AppRoutes.UserInfoActivity); - return; - } - if (widget.bean.is_limit&&widget.bean.amount > 0) { - await refreshCircleData(); - } - if (widget.bean.is_limit&&widget.bean.amount>0) { - showJoinCiclePiker(widget.bean.id.toString(),widget.bean.amount.toString(),widget.bean.oldAmount.toString(),1,(payResult){ - widget.bean.is_limit = false; - if (Get.isRegistered()) { - var logic = Get.find(); - for (var element in logic.circle.lists) { - if (element.id == widget.bean.id) { - element.is_limit = false; - element.isJoin = true; - } - } - logic.update(); - } - Get.back(); - },widget.bean.ios_item); - return; - } - pushHomePage(lists, lists.id.toString()); - }, - child: Stack( - alignment: Alignment.center, - children: [ - Image.asset( - getCircleImage('avatar_bg'), - width: 42.sp, - ), - ClipOval( - child: CachedNetworkImage( - imageUrl:lists.user!.avatar_thumb!, - width: 40.sp, - height: 40.sp, - fit: BoxFit.cover, - ), - ) - ], - )), - Expanded( - child: Container( - padding: EdgeInsets.only(left: 8.sp, top: 12.sp), - alignment: Alignment.centerLeft, - height: 72.sp, - child: Column( - children: [ - Row( - children: [ - Text( - lists.user!.nickname!, - style: TextStyle( - color: Colors.white, - fontSize: 18.sp, - fontWeight: FontWeight.w600), - ), - SizedBox( - width: 8.sp, - ), - UserTagWidget(lists.user!.mark!), - ], - ), - SizedBox( - height: 4.sp, - ), - Row( - children: [ - Container( - alignment: Alignment.center, - height: 18.sp, - padding: - EdgeInsets.only(left: 6.sp, right: 6.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(9.sp), - gradient: const LinearGradient( - begin: Alignment(0.25, 0.5), - end: Alignment(0.75, 0.5), - colors: [ - Color(0xff8DFFF8), - Color(0xffB5D3FF) - ])), - child: Text( - getAgeCOntent(lists.user!.gender??0, lists.user!.age??0, - lists.user!.role??0, lists.user!.orientation??0), - // '${genderList[lists.user!.gender!]}.${lists.user!.age}.${roleList[lists.user!.role!]}.${orientationList[lists.user!.orientation!]}', - style: TextStyle( - color: Colors.black, - fontSize: 12.sp, - ), - ), - ) - ], - ), - ], - ), - )), - ], - ), - ), - Container( - alignment: Alignment.topLeft, - // margin: EdgeInsets.only(top: 4.sp), - child: descText, - ), - Container( - height: picHeight, - margin: EdgeInsets.only(top: 5.sp), - child: picHeight == 200.sp - ? ClipRRect( - borderRadius: BorderRadius.circular(6.sp), - child: VideoItemWidget(lists.album![0].url!)) - : GridView.builder( - itemCount: lists.album!.length, - physics: const NeverScrollableScrollPhysics(), - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 3, //横轴三个子widget - crossAxisSpacing: 8.sp, - mainAxisSpacing: 8.sp, - childAspectRatio: 0.7//宽高比为1时,子widget - ), - itemBuilder: (contentxt, currentIndex) { - Album album = lists.album![currentIndex]; - return GestureDetector( - onTap: () { - var imgList = []; - for (var element in lists.album!) { - imgList.add(element.url!); - } - Get.toNamed(AppRoutes.Swiper, arguments: { - 'imaglist': imgList, - 'index': currentIndex - }); - }, - child: ClipRRect( - borderRadius: BorderRadius.circular(6.sp), - child: CachedNetworkImage( - imageUrl: album.url!, - errorWidget: (context, url, error) => - const Icon(Icons.error), - fit: BoxFit.cover, - ), - ), - ); - }), - ), - Container( - height: 30.sp, - padding: EdgeInsets.only(left: 5.sp, right: 10.sp), - margin: EdgeInsets.only(top: picHeight > 0 ? 5.sp : 5.sp,bottom: 10.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(15.sp), - color: Color(0x33000000) - ), - child: Row( - children: [ - widgets.isNotEmpty - ? SizedBox( - width: 24 + 12.sp * widgets.length - 8.sp, - height: 24.sp, - child: Stack(children: widgets), - ) - : Container(), - SizedBox( - width: 4.sp, - ), - widgets.isNotEmpty - ? Expanded( - child: Text( - '${lists.chat!.count!}位圈友已私聊', - style: TextStyle( - color: Colors.white.withOpacity(0.75), fontSize: 14.sp), - )) - : Expanded( - child: Text( - '赶紧成为第一位私聊ta的圈友吧', - style: TextStyle( - color: Colors.white.withOpacity(0.75), fontSize: 14.sp), - )), - GestureDetector( - onTap: () { - pushMsgPage(lists, widget.bean.id.toString(),); - }, - child: Image.asset( - getCircleImage('chat'), - width: 60.sp, - ), - ) - ], - ), - ) - ], - ), - ) - ])); - } - - ///普通图文喊话 - normalDynamicItem(Lists lists) { - Widget descText = widget.logic.openCallOutIdList.contains(lists.id) ? Text( - lists.content!, - style: TextStyle(color: Colors.white, fontSize: 14.sp), - ) : HideText(text: lists.content!,maxWidth: Get.currentRoute == AppRoutes.Home ? Get.width - 90.sp : Get.width - 20.sp,additionText: '查看更多',maxLines: 5,style: TextStyle(color: Colors.white, fontSize: 14.sp),additionStyle: TextStyle(color: const Color(0xFFFF4DF6), fontSize: 14.sp),onTap: () { - widget.logic.openCallOutIdList.add(lists.id); - setState(() { - - }); - }, - ); - - double picHeight = 0.0; - double picWidth = (Get.width - (widget.logic.runtimeType == LikeLogic ? 100.sp : 60.sp))/3 + 45; - if (lists.album != null) { - if (lists.album!.isNotEmpty) { - Album info = lists.album!.first; - - if (info.type == 1) { - if (lists.album!.length > 3) { - picHeight = picWidth * 2; - } else { - picHeight = picWidth; - } - } else { - picHeight = 200.sp; - } - } - } - - List widgets = []; - int index = 0; - lists.chat!.users!.forEach((element) { - widgets.add(Positioned( - left: 12.sp * index, - child: circleWidget(element.avatar!,element.id.toString(), width: 24), - )); - index++; - }); - if (widgets.isNotEmpty) { - widgets.add(Positioned( - left: 12.sp * lists.chat!.users!.length, - child: Image.asset( - getCircleImage('more'), - width: 24.sp, - ))); - } - return Container( - margin: EdgeInsets.only(top: 10.sp), - width: Get.width, - // height: 120.sp + contentHeight(lists.content!) + picHeight, - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.fill, - image: AssetImage( - getCircleImage('normal_bg'), - ))), - child: Stack( - children: [ - Positioned( - right: 2.sp, - top: 2.sp, - child: Stack( - alignment: Alignment.center, - children: [ - // Image.asset( - // getCircleImage('location'), - // height: 30.sp, - // ), - Container( - // margin: EdgeInsets.only(top: 5.sp,right: 5.sp), - padding: EdgeInsets.only(left: 15.sp,right: 15.sp), - alignment: Alignment.center, - height: 28.sp, - decoration: BoxDecoration( - color: Color.fromRGBO(52, 41, 67, 1), - borderRadius: BorderRadius.only(topLeft: Radius.circular(0),bottomRight: Radius.circular(0),topRight: Radius.circular(12.sp),bottomLeft: Radius.circular(12.sp) ) - ), - child: Text( - (lists.user!.city ?? '外星').length > 4 ? (lists.user!.city ?? '外星').substring(0,4) + '...' :(lists.user!.city ?? '外星'), - style: TextStyle(color: Colors.white, fontSize: 15.sp), - ), - ) - ], - ), - // height: 18.sp, - ), - Container( - width: Get.width, - - padding: EdgeInsets.only(left: 12.sp, right: 12.sp), - child: Column( - children: [ - SizedBox( - height: 72.sp, - child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - onTap: ()async { - var sp = await SharedPreferencesHelper.getInstance(); - String myUserId = sp.getMyUserId(); - if(lists.user?.id!.toString() == myUserId){ - Get.toNamed(AppRoutes.UserInfoActivity); - return; - } - if (widget.bean.is_limit&&widget.bean.amount > 0) { - await refreshCircleData(); - } - - if (widget.bean.is_limit&&widget.bean.amount > 0) { - showJoinCiclePiker(widget.bean.id.toString(),widget.bean.amount.toString(),widget.bean.oldAmount.toString(),1,(payResult){ - widget.bean.is_limit = false; - if (Get.isRegistered()) { - var logic = Get.find(); - for (var element in logic.circle.lists) { - if (element.id == widget.bean.id) { - element.is_limit = false; - element.isJoin = true; - } - } - logic.update(); - } - Get.back(); - },widget.bean.ios_item); - return; - } - pushHomePage(lists, lists.id.toString()); - }, - child: Stack( - alignment: Alignment.center, - children: [ - Image.asset( - getCircleImage('avatar_bg'), - width: 42.sp, - ), - ClipOval( - child: CachedNetworkImage( - imageUrl:lists.user!.avatar_thumb!, - width: 40.sp, - height: 40.sp, - fit: BoxFit.cover, - // - // , - ), - ) - ], - )), - Expanded( - child: Container( - padding: EdgeInsets.only(left: 8.sp, top: 12.sp), - alignment: Alignment.centerLeft, - height: 72.sp, - child: Column( - children: [ - Row( - children: [ - Text( - lists.user!.nickname!, - style: TextStyle( - color: Colors.white, - fontSize: 18.sp, - fontWeight: FontWeight.w600), - ), - SizedBox( - width: 8.sp, - ), - UserTagWidget(lists.user!.mark!), - ], - ), - SizedBox( - height: 4.sp, - ), - Row( - children: [ - Container( - alignment: Alignment.center, - height: 18.sp, - padding: EdgeInsets.only( - left: 6.sp, right: 6.sp), - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(9.sp), - gradient: const LinearGradient( - begin: Alignment(0.25, 0.5), - end: Alignment(0.75, 0.5), - colors: [ - Color(0xff8DFFF8), - Color(0xffB5D3FF) - ])), - child: Text( - getAgeCOntent(lists.user!.gender??0, lists.user!.age??0, - lists.user!.role??0, lists.user!.orientation??0), - style: TextStyle( - color: Colors.black, - fontSize: 12.sp, - ), - ), - ) - ], - ), - ], - ), - )), - ], - ), - ), - Container( - alignment: Alignment.topLeft, - // margin: EdgeInsets.only(top: 4.sp), - child: descText, - ), - picHeight > 0 - ? Container( - height: picHeight, - alignment: Alignment.centerLeft, - margin: EdgeInsets.only(top: 5.sp), - child: picHeight == 200.sp - ? ClipRRect( - borderRadius: BorderRadius.circular(6.sp), - child: VideoItemWidget(lists.album![0].url!)) - : GridView.builder( - itemCount: lists.album!.length, - physics: const NeverScrollableScrollPhysics(), - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 3, //横轴三个子widget - crossAxisSpacing: 8.sp, - mainAxisSpacing: 8.sp, - childAspectRatio:0.7 //宽高比为1时,子widget - ), - itemBuilder: (contentxt, currentIndex) { - Album album = lists.album![currentIndex]; - return GestureDetector( - onTap: () { - var imgList = []; - for (var element in lists.album!) { - imgList.add(element.url!); - } - Get.toNamed(AppRoutes.Swiper, - arguments: { - 'imaglist': imgList, - 'index': currentIndex - }); - }, - child: ClipRRect( - borderRadius: - BorderRadius.circular(6.sp), - child: CachedNetworkImage( - imageUrl: album.url!, - // placeholder: (context, url) => - // SizedBox( - // width: 30.sp, - // height: 30.sp, - // child: CircularProgressIndicator( - // color: Color(0xFF07FAFB), - // strokeWidth: 2.sp, - // ), - // ), - errorWidget: (context, url, error) => - const Icon(Icons.error), - fit: BoxFit.cover, - ), - ), - ); - })) - : Container(), - Container( - height: 30.sp, - padding: EdgeInsets.only(left: 5.sp, right: 10.sp,), - margin: EdgeInsets.only(top: picHeight > 0 ? 5.sp : 10.sp,bottom: 10.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(15.sp), - color: Color(0x33000000)), - child: Row( - children: [ - widgets.isNotEmpty - ? SizedBox( - width: 24 + 12.sp * widgets.length - 8.sp, - height: 24.sp, - child: Stack(children: widgets), - ) - : Container(), - SizedBox( - width: 4.sp, - ), - widgets.isNotEmpty - ? Expanded( - child: Text( - '${lists.chat!.count!}位圈友已私聊', - style: TextStyle( - color: Colors.white.withOpacity(0.75), fontSize: 14.sp), - )) - : Expanded( - child: Text( - '赶紧成为第一位私聊ta的圈友吧', - style: TextStyle( - color: Colors.white.withOpacity(0.75), fontSize: 14.sp), - )), - GestureDetector( - onTap: () async{ - pushMsgPage(lists, widget.bean.id.toString()); - - // }); - }, - child: Image.asset( - getCircleImage('chat'), - width: 60.sp, - )) - ], - ), - ), - - ], - ), - ), - // Positioned( - // bottom: 0, - // child: Container( - // width: Get.width - 26.sp, - // child: circleInfoItem(), - // )) - ], - )); - } - - circleInfoItem() { - return ClipRRect( - borderRadius: BorderRadius.circular( - 10.sp), - child: Container( - padding: EdgeInsets.only(left: 12.sp, right: 12.sp), - height: 72.sp, - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.fill, - image: - AssetImage(getCircleImage('top_circle_bg')))), - child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - width: 42.sp, - height: 42.sp, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8.0), - gradient: const LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [ - Color(0xFF71F3F2), - Color(0xFFF558FF), - ], - stops: [0.0365, 0.9427], - ), - ), - padding: EdgeInsets.all(1.sp), - child: ClipRRect( - borderRadius: BorderRadius.circular(8.0), - child: CachedNetworkImage( - imageUrl:widget.bean.image, - width: 40.sp, - height: 40.sp, - - fit:BoxFit.cover - ), - ), - ), - Expanded( - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: (){ - scrollController.animateTo( - 0.0, // Scroll to the top - duration: Duration(milliseconds: 300), - curve: Curves.easeInOut, - ); - }, - child: Container( - padding: EdgeInsets.only(left: 8.sp, top: 12.sp), - // alignment: Alignment., - height: 72.sp, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - widget.bean.title, - style: TextStyle( - color: Colors.white, - fontSize: 18.sp, - fontWeight: FontWeight.w600), - ), - SizedBox( - height: 4.sp, - ), - Text( - '${convertToTenThousand(widget.bean.viewTotal)}人看过', - textAlign: TextAlign.left, - style: TextStyle( - color: const Color(0xff03FEFB), - fontSize: 12.sp, - ), - ), - ], - ), - ), - )), - GestureDetector(//加入圈子 - onTap: () async { - if (widget.bean.isJoin) { - Get.bottomSheet( - CircleShare('','',widget.bean), isScrollControlled: true, - enableDrag: false - ); - } else { - await widget.logic.outCircle( - widget.bean.id.toString(), - widget.bean.isJoin); - widget.logic.update(); - } - }, - child: Stack( - alignment: Alignment.center, - children: [ - Opacity( - opacity: 0.5, - child: Image.asset( - getCircleImage('add'), - width: 60.sp, - ), - ), - Text( - !widget.bean.isJoin ? '申请加入' : '分享有奖', - style: TextStyle( - color: Colors.white, fontSize: 12.sp), - ) - ], - )) - ], - ), - )); - } - - circleWidget(String url, String userId,{double width = 24}) { - return GestureDetector( - onTap: () async { - if (widget.bean.is_limit&&widget.bean.amount > 0) { - await refreshCircleData(); - } - if (widget.bean.is_limit&&widget.bean.amount>0) { - showJoinCiclePiker(widget.bean.id.toString(),widget.bean.amount.toString(),widget.bean.oldAmount.toString(),1,(payResult){ - widget.bean.is_limit = false; - if (Get.isRegistered()) { - var logic = Get.find(); - for (var element in logic.circle.lists) { - if (element.id == widget.bean.id) { - element.is_limit = false; - element.isJoin = true; - } - } - logic.update(); - } - Get.back(); - },widget.bean.ios_item); - return; - } - Get.toNamed(AppRoutes.UserInfoActivity, arguments: userId); - }, - child: Stack( - alignment: Alignment.center, - children: [ - Image.asset( - getCircleImage('avatar_bg'), - width: width.sp, - ), - ClipOval( - child: CachedNetworkImage( - imageUrl:url??"https://qiniuyun.leyuan666.com/quanzi/avatar/default.png", - width: (width - 1).sp, - height: (width - 1).sp, - fit: BoxFit.cover, - ), - ) - ], - )); - } - - void _showOutCircleDialog( - BuildContext context, var controller, Circle bean) { - showDialog( - context: context, - builder: (BuildContext context) { - return Dialog( - backgroundColor: Colors.transparent, - child: Container( - height: 160.sp, - padding: const EdgeInsets.all(1.0), - child: Stack( - children: [ - Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: const LinearGradient( - colors: [Color(0xFFDD3DF4), Color(0xFF30FFD9)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Container( - margin: EdgeInsets.all(1.sp), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: const LinearGradient( - colors: [Color(0xFF4C3E5F), Color(0xFF324140)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Container( - margin: EdgeInsets.only(top: 24.sp), - child: Column( - children: [ - Center( - child: Text( - "提示", - style: - TextStyle(color: Colors.white, fontSize: 16.sp), - ), - ), - Container( - margin: EdgeInsets.only( - top: 12.sp, left: 14.sp, right: 14.sp), - alignment: Alignment.center, - child: Text( - "是否确认退出该圈子。", - textAlign: TextAlign.center, - style: TextStyle( - color: const Color(0xCCF7FAFA), fontSize: 16.sp), - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - onTap: () { - Navigator.pop(context); - }, - child: Container( - margin: EdgeInsets.only(top: 30.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color(0x26FFFFFF), - Color(0x26FFFFFF), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 10.sp, - bottom: 10.sp, - left: 52.sp, - right: 52.sp), - child: Text( - "否", - style: TextStyle( - color: Colors.white, - fontSize: 12.sp, - ), - ), - ), - ), - SizedBox(width: 24.sp), - GestureDetector( - onTap: () async { - Navigator.pop(context); - await widget.logic - .outCircle(bean.id.toString(), bean.isJoin); - // widget.logic.update(); - }, - child: Container( - margin: EdgeInsets.only(top: 24.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 10.sp, - bottom: 10.sp, - left: 52.sp, - right: 52.sp), - child: Text( - "是", - style: TextStyle( - color: Colors.white, - fontSize: 12.sp, - ), - ), - ), - ) - ], - ) - ], - ), - ) - ], - ), - ), - ); - }, - ); - } - - double contentHeight(String content) { - return calculateTextHeight( - content, 17.sp, FontWeight.w300, Get.currentRoute == AppRoutes.Home ? Get.width - 90.sp : Get.width - 64.sp, 100); - } - - refreshCircleData() async { - // var routePath = Get.currentRoute; - // if (routePath == AppRoutes.Signal_circle_list) return; - - var data = await DioManager.instance - .get(url: 'up-service/interest/${widget.bean.id}'); - if (data['code'] == 200) { - widget.bean = Circle.fromJson(data['data']); - // widget.logic.updateCircleInfo(widget.bean); - // setState(() { - // - // }); - // final logic = Get.put(CircleLogic()); - // logic.update(); - - }else if(data['code'] == 404){ - - var logic = Get.put(CircleLogic()); - logic.circle.lists.removeAt(logic.state.index); - logic.update(); - } - } -} diff --git a/circle_app/lib/app/circle/widgets/like_view.dart b/circle_app/lib/app/circle/widgets/like_view.dart deleted file mode 100644 index 771bdb8..0000000 --- a/circle_app/lib/app/circle/widgets/like_view.dart +++ /dev/null @@ -1,1734 +0,0 @@ -import 'dart:async'; -import 'dart:convert'; - -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:circle_app/app/circle/logic.dart'; -import 'package:circle_app/app/circle/state.dart'; -import 'package:circle_app/app/circle/widgets/video_item.dart'; -import 'package:circle_app/app/home/logic.dart'; -import 'package:circle_app/common/Widgets/circle_share.dart'; -import 'package:circle_app/common/Widgets/text_more.dart'; -import 'package:circle_app/main.dart'; -import 'package:circle_app/network/dio_manager.dart'; -import 'package:circle_app/router/app_routers.dart'; -import 'package:circle_app/util/SharedPreferencesHelper.dart'; -import 'package:circle_app/util/eventBus.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:gradient_borders/box_borders/gradient_box_border.dart'; -import 'package:pull_to_refresh/pull_to_refresh.dart'; -import 'package:shared_preferences/shared_preferences.dart'; - -import '../../../common/Widgets/base_tip_widget.dart'; -import '../../../common/Widgets/tag_widget.dart'; -import '../../../common/colors/app_color.dart'; -import '../../../network/api.dart'; -import '../../circle_list/logic.dart'; -import '../../msg/recommend_circle_friend_item.dart'; - -class LikeView extends StatefulWidget { - LikeView({super.key, required this.changeCallback}); - - @override - _LikeViewState createState() => _LikeViewState(); - - Function changeCallback; -} - -class _LikeViewState extends State - with AutomaticKeepAliveClientMixin { - @override - bool get wantKeepAlive => true; - final ScrollController scrollController = ScrollController(); - - final ScrollController moreScrollController = ScrollController(); - final RefreshController refreshController = RefreshController(); - CircleLogic logic = Get.find(); - - // ListLogic? listsLg; - - int callOutPage = 1; - int recomandPage = 1; - - bool isLoad = true; - bool likeMore = true; - bool recomandMore = true; - var circleId = ''; - List lists = []; - List recomanddlists = []; - List peopleList = []; - - @override - void dispose() { - // TODO: implement dispose - - // if (null != scroToTop) { - // EventBusManager.cancelSubscription(scroToTop!); - // } - EventBusManager.cancelSubscription(likeRefreshSub!); - moreScrollController.dispose(); - scrollController.dispose(); - super.dispose(); - } - - StreamSubscription? callRefreshCicle = null; - StreamSubscription? scroToTop = null; - StreamSubscription? likeRefreshSub = null; - - @override - void initState() { - // TODO: implement initState - super.initState(); - loadActiveUsersData(); - loadLikeListData(); - loadRecomdistData(); - - // scroToTop = EventBusManager.on().listen((event) { - // scrollController.animateTo( - // 0.0, - // duration: Duration(milliseconds: 300), - // curve: Curves.easeInOut, - // ); - // }); - likeRefreshSub = EventBusManager.on().listen((event) { - refreshData(); - }); - moreScrollController.addListener(() { - if (moreScrollController.position.maxScrollExtent == moreScrollController.offset) { - Get.toNamed(AppRoutes.FriendsActivity,arguments: 1); - } - }); - } - - loadActiveUsersData() async { - // if (likeMore) { - var data = await DioManager.instance.get( - url: Api.activeUsers); - if (data["code"] == 200) { - peopleList = data['data']; - setState(() { - - }); - } - } - - loadLikeListData() async { - // if (likeMore) { - var data = await DioManager.instance.get( - url: "/up-service/follow/callouts", - params: {"page": callOutPage, "page_size": 10}); - if (data["code"] == 200) { - List dataList = data["data"]["lists"] ?? []; - if (callOutPage == 1) { - lists.clear(); - } - - if (dataList.isNotEmpty) { - likeMore = true; - for (var element in dataList) { - lists.add(Lists.fromJson(element)); - } - callOutPage++; - } - likeMore = dataList.length == 10; - - if (callOutPage == 1) { - refreshController.resetNoData(); - } else {} - - if (mounted) { - setState(() {}); - } - } else { - showOKToast(data["msg"]); - } - } - - loadRecomdistData() async { - var data = await DioManager.instance.get( - url: "/up-service/recommend/callouts", - params: {"page": recomandPage, "page_size": "20"}); - if (data["code"] == 200) { - List dataList = data["data"]["lists"] ?? []; - if (recomandPage == 1) { - if (recomanddlists.isNotEmpty) { - recomanddlists.clear(); - } - } - if (dataList.isNotEmpty) { - recomandMore = true; - List info = []; - for (var element in dataList) { - Lists infos = Lists.fromJson(element); - - bool isContain = false; - recomanddlists.forEach((listInfo) { - if (listInfo.id == infos.id) { - isContain = true; - } - }); - if (!isContain) { - info.add(infos); - } - } - if (info.isNotEmpty) { - recomanddlists.addAll(info); - } - recomandPage++; - } - recomandMore = dataList.length == 20; - - if (recomandPage == 2 || recomandPage == 1) { - refreshController.refreshCompleted(); - refreshController.loadComplete(); - } else { - if (recomandMore) { - refreshController.loadComplete(); - } else { - refreshController.loadNoData(); - } - } - if (mounted) { - setState(() {}); - } - } else { - showOKToast(data["msg"]); - } - } - - setCircleId(String id) { - circleId = id; - loadLikeListData(); - loadRecomdistData(); - } - - void refreshData() { - callOutPage = 1; - recomandPage = 1; - likeMore = true; - recomandMore = true; - refreshController.resetNoData(); - loadActiveUsersData(); - loadLikeListData(); - loadRecomdistData(); - } - - void loadMore() { - if (recomandMore == false) return; - loadRecomdistData(); - } - - void pushOtherPeopleHomePage(String userId) { - Get.toNamed(AppRoutes.UserInfoActivity, arguments: userId); - } - - void pushHomePage(var bean, String cicleId) async { - // SharedPreferencesHelper.getInstance().then((sharedPreferences) { - // int userId = sharedPreferences.getInt(SharedPreferencesHelper.USERID); - // if (bean.user!.id == userId) { - // Get.toNamed(AppRoutes.UserInfoActivity); - // } else { - Get.toNamed(AppRoutes.UserInfoActivity, - arguments: bean.user!.id!.toString()); - // } - // }); - - // if (bean.isQueen) { - // showJoinCiclePiker(cicleId); - // } else { - //跳转消息页面 - // Get.bottomSheet(Open_vip_tipPage(), - // isScrollControlled: true, - // enableDrag: false, - // ); - // } - } - - void pushMsgPage(var bean, String cicleId) async { - // if (bean.is_limit&&bean.amount>0) { - // showJoinCiclePiker(cicleId,bean.amount.toString(),bean.oldAmount.toString(),2,(payResult){ - // bean.is_limit = false; - // if (Get.isRegistered()) { - // var logic = Get.find(); - // for (var element in logic.circle.lists) { - // if (element.id == bean.id) { - // element.is_limit = false; - // element.isJoin = true; - // } - // } - // logic.update(); - // } - // Get.back(); - // },bean.ios_item); - // return; - // } - - var sp = await SharedPreferencesHelper.getInstance(); - String myUserId = sp.getMyUserId(); - if (bean.user!.id.toString() == myUserId) { - showOKToast('无法与自己私聊'); - return; - } - // if () - - var data = await DioManager.instance.get( - url: "/up-service/callout/${bean.id}/chat", - ); - if (data["code"] == 200) { - pushChatPage(data['data']['account_id'] - .toString() - .split("_") - .last, - data['data']['account_id'], bean.user!.nickname!); - - await Future.delayed(Duration(seconds: 1)); - SharedPreferences sharedPreferences = - await SharedPreferences.getInstance(); - // SharedPreferencesHelper.getInstance().then((sharedPreferences) { - int userId = - sharedPreferences.getInt(SharedPreferencesHelper.USERID) ?? 0; - String avatar = - sharedPreferences.getString(SharedPreferencesHelper.AVATAR) ?? ""; - String name = - sharedPreferences.getString(SharedPreferencesHelper.NAME) ?? ""; - - bool isContain = false; - for (var info in bean.chat!.users!) { - if (info.id == userId) { - isContain = true; - } - } - if (!isContain) { - bean.chat!.users! - .add(Users(avatar: avatar, id: userId, nickname: name)); - bean.chat!.count = bean.chat!.count + 1; - setState(() {}); - } - } - } - - @override - Widget build(BuildContext context) { - List urlList = []; - List widgets = []; - int i = 0; - // print(urlList); - if (null != urlList) { - urlList.forEach((element) { - if (widgets.length > 2) { - return; - } - widgets.add(Positioned( - left: 15.sp * i, - child: circleWidget( - element.avatar! ?? - "https://qiniuyun.leyuan666.com/quanzi/avatar/default.png", - element.id.toString()), - )); - i++; - }); - } - - return Stack( - fit: StackFit.expand, - children: [ - ClipRRect( - borderRadius: BorderRadius.circular(10.sp), - child: SizedBox( - width: Get.width, - height: Get.height, - child: Image.asset( - getCircleImage('circle_bg'), - fit: BoxFit.cover, - ), - )), - ClipRRect( - borderRadius: BorderRadius.circular(10.sp), - child: Container( - width: Get.width, - // padding: EdgeInsets.only(left: 10.sp, right: 10.sp), - // margin: - // EdgeInsets.only(left: widget.index > 0 ? 4.sp : 0, right: 4.sp), - child: SmartRefresher( - controller: refreshController, - onRefresh: refreshData, - onLoading: loadMore, - enablePullUp: recomandMore, - child: ListView.builder( - physics: const AlwaysScrollableScrollPhysics(), - addAutomaticKeepAlives: false, - addRepaintBoundaries: false, - scrollDirection: Axis.vertical, - controller: scrollController, - itemCount: lists.length + recomanddlists.length + 1, - itemBuilder: (context, index) { - if (lists.length - 1 >= index) { - var list = lists[index]; - if (lists.length - 1 == index) { - if (likeMore) { - if (list.isQueen!) { - return Column( - children: [ - - vipDynamicItem(list), - GestureDetector( - onTap: () { - loadLikeListData(); - }, - child: Container( - height: 22.sp, - padding: EdgeInsets.only( - left: 5.sp, right: 5.sp), - margin: EdgeInsets.only(top: 10.sp), - decoration: BoxDecoration( - color: AppColor.bgColor, - borderRadius: - BorderRadius.circular(5.sp)), - child: Text( - ' 展开更早发布的喊话 ↓ ', - style: TextStyle( - color: Colors.white, - fontSize: 15.sp), - ), - ), - ) - ], - ); - } else { - return Column( - children: [ - - normalDynamicItem(list), - GestureDetector( - onTap: () { - loadLikeListData(); - }, - child: Container( - height: 26.sp, - // alignment: Alignment.center, - padding: EdgeInsets.only( - left: 5.sp, right: 5.sp), - margin: EdgeInsets.only(top: 10.sp), - decoration: BoxDecoration( - border: GradientBoxBorder( - gradient: - AppColor.mainVerLinearGradient, - width: 1.sp, - ), - borderRadius: - BorderRadius.circular(5.sp)), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.center, - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Text( - ' 展开更早发布的喊话 ↓ ', - style: TextStyle( - color: Colors.white, - fontSize: 15.sp), - ), - ], - ), - ), - ) - ], - ); - } - } - } - if (list.isQueen!) { - return Column( - children: [ - if (index == 0 && peopleList.length > 2) - morePeoleListWidget(), - vipDynamicItem(list) - ], - ); - } else { - return Column( - children: [ - if (index == 0 && peopleList.isNotEmpty) - morePeoleListWidget(),normalDynamicItem(list)]); - } - } else if (lists.length == index && - recomanddlists.isNotEmpty) { - return tipItem(); - } else if (index - lists.length < recomanddlists.length) { - var list = recomanddlists[index - lists.length]; - if (list.isQueen!) { - return vipDynamicItem(list); - } else { - return normalDynamicItem(list); - } - } else { - return Container( - margin: - EdgeInsets.only(top: recomandMore ? 0 : 10.sp), - child: recomandMore - ? loaddingWidget(recomandMore) - : GestureDetector( - onTap: () { - widget.changeCallback(); - }, - child: Container( - margin: EdgeInsets.only(bottom: 10.sp), - child: Stack( - alignment: Alignment.center, - children: [ - Image.asset( - getLoginImage('start_bg'), - width: 180.sp, - ), - Text( - '查看更多圈子', - style: TextStyle( - color: Colors.white, - fontSize: 18.sp), - ) - ], - ), - ), - )); - } - }), - ), - )), - if (Get.currentRoute == AppRoutes.Home) - Positioned( - bottom: 36.sp, - right: 10.sp, - child: GestureDetector( - onTap: () { - Get.toNamed( - AppRoutes.Call_out, - ); - }, - child: Image.asset( - getCircleImage('send_msg'), - width: 70.sp, - ))) - ], - ); - } - - morePeoleListWidget() { - return Container( - width: Get.width, - height: 75.sp, - margin: EdgeInsets.only(top: 10.sp,bottom: 10.sp), - child: ListView.builder( - controller: moreScrollController, - scrollDirection: Axis.horizontal, - itemBuilder: (contenxt, index) { - if (index == peopleList.length) { - return MoreItem(); - } - return peopleWidget(peopleList[index]); - }, - itemCount: peopleList.length < 10 ? peopleList.length + 1 : 10, - ), - ); - } - - Widget MoreItem() { - return GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.FriendsActivity,arguments: 1); - }, - child: Container( - // width: 68.sp, - margin: EdgeInsets.only(left: 12.sp), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Stack( - children: [ - Center( - child: ClipOval( - child: Container( - color: Colors.black, - width: 50.sp, - height: 50.sp, - ), - ), - ), - Center( - child: ClipOval( - child: Image.asset( - getHomeImage("im_more"), - width: 50.sp, - // height: 48.sp, - ), - ), - ), - ], - ), - SizedBox(height: 4.0.sp), - Center( - child: Text( - "查看更多", - overflow: TextOverflow.ellipsis, - maxLines: 1, - style: TextStyle( - fontSize: 12.0.sp, - color: Colors.white, // Replace with desired text color - ), - ), - ), - ], - ), - ), - ); - } - - peopleWidget(Map info) { - return GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.UserInfoActivity,arguments: info['id'].toString()); - }, - child: Stack( - - children: [ - Container( - margin: EdgeInsets.only(left: 12.sp), - child: Column( - children: [ - Stack( - alignment: Alignment.center, - children: [ - Container( - height: 52.sp, - width: 52.sp, - decoration: BoxDecoration( - gradient: AppColor.mainVerLinearGradient, - borderRadius: BorderRadius.circular(26.sp) - ), - ), - ClipOval( - child: Image.network( - info['avatar_thumb'], - fit: BoxFit.cover, - width: 50.sp, - height: 50.sp, - ), - ), - if ((info['onlineFlag'] ?? '').toString().isNotEmpty) - Positioned(bottom: 0,child: Container( - height: 20.sp, - padding: EdgeInsets.only(left: 4.sp,right: 4.sp), - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(10.sp), - color: AppColor.bgColor, - border: GradientBoxBorder( - gradient: - AppColor.mainVerLinearGradient, - width: 1.sp, - ), - ), - alignment: Alignment.center, - child: Text( - info['onlineFlag'], - style: TextStyle( - color: - const Color.fromRGBO(247, 250, 250, 1.0), - fontSize: 10.sp, - ), - ))) - ], - - ), - SizedBox( - height: 4.sp, - ), - Text( - info['nickname'] ?? '', - style: TextStyle(color: Colors.white, fontSize: 12.sp), - ), - ], - ), - ), - - ], - ), - ); - } - - ///至尊喊话 - vipDynamicItem(Lists lists) { - Text descText = Text( - lists.content!, - style: TextStyle(color: Colors.white, fontSize: 17.sp), - maxLines: 2, - ); - - // List urlList = bean.lastJoinUsers; - List widgets = []; - int index = 0; - for (var element in lists.chat!.users!) { - widgets.add(Positioned( - left: 12.sp * index, - child: GestureDetector( - onTap: () { - // pushOtherPeopleHomePage(element.id.toString()); - }, - child: - circleWidget(element.avatar!, element.id.toString(), width: 24), - ), - )); - index++; - } - if (widgets.isNotEmpty) { - widgets.add(Positioned( - left: 12.sp * lists.chat!.users!.length, - child: Image.asset( - getCircleImage('more'), - width: 24.sp, - ))); - } - - double picHeight = 0.0; - - if (lists.album != null) { - if (lists.album!.isNotEmpty) { - Album info = lists.album!.first; - - if (info.type == 1) { - double picWidth = (Get.width - 100.sp) / 3 + 40; - if (lists.album!.length > 3) { - picHeight = picWidth * 2; - } else { - picHeight = picWidth; - } - } else { - picHeight = 140.sp; - } - } - } - - // double widgetHeight = - // 130.sp + contentHeight(lists.content!) + picHeight + 76.sp; - - return GestureDetector( - onTap: () async { - var sp = await SharedPreferencesHelper.getInstance(); - String myUserId = sp.getMyUserId(); - - if (lists.user?.id!.toString() == myUserId) { - Get.toNamed(AppRoutes.UserInfoActivity); - return; - } - pushHomePage(lists, lists.id.toString()); - }, - child: Container( - margin: EdgeInsets.only(bottom: 10.sp), - width: Get.width, - // height: widgetHeight, - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.fill, - image: AssetImage( - getCircleImage('pic_bg'), - ))), - child: Stack(children: [ - Positioned( - left: 0, - top: 2.sp, - height: 18.sp, - child: Image.asset(getCircleImage('vip_say')), - ), - Positioned( - right: 2.sp, - top: 2.sp, - child: Stack( - alignment: Alignment.center, - children: [ - Container( - // margin: EdgeInsets.only(top: 5.sp,right: 5.sp), - padding: EdgeInsets.only(left: 15.sp, right: 15.sp), - alignment: Alignment.center, - height: 28.sp, - decoration: BoxDecoration( - color: Color.fromRGBO(52, 41, 67, 1), - borderRadius: BorderRadius.only( - topLeft: Radius.circular(0), - bottomRight: Radius.circular(0), - topRight: Radius.circular(12.sp), - bottomLeft: Radius.circular(12.sp))), - child: Text( - (lists.user!.city ?? '外星').length > 4 - ? (lists.user!.city ?? '外星').substring(0, 4) + - '...' - : (lists.user!.city ?? '外星'), - style: TextStyle(color: Colors.white, fontSize: 15.sp), - )) - ], - ), - ), - Container( - // height: widgetHeight, - width: Get.width, - padding: EdgeInsets.only(top: 12.sp, left: 12.sp, right: 12.sp), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 72.sp, - child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Stack( - alignment: Alignment.center, - children: [ - Image.asset( - getCircleImage('avatar_bg'), - width: 42.sp, - ), - ClipOval( - child: CachedNetworkImage( - imageUrl: lists.user!.avatar_thumb!, - width: 40.sp, - height: 40.sp, - fit: BoxFit.cover, - ), - ) - ], - ), - Expanded( - child: Container( - padding: EdgeInsets.only(left: 8.sp, top: 12.sp), - alignment: Alignment.centerLeft, - height: 72.sp, - child: Column( - children: [ - Row( - children: [ - Text( - lists.user!.nickname!, - style: TextStyle( - color: Colors.white, - fontSize: 18.sp, - fontWeight: FontWeight.w600), - ), - SizedBox( - width: 8.sp, - ), - UserTagWidget(lists.user!.mark!), - // lists.user?.vip != null && - // lists.user!.vip == 0 - // ? Container() - // : Image.asset( - // getCircleImage(lists.user!.vip == 1 - // ? 'vip' - // : 'year_vip'), - // width: 36.sp, - // ) - ], - ), - SizedBox( - height: 4.sp, - ), - Row( - children: [ - Container( - alignment: Alignment.center, - height: 18.sp, - padding: EdgeInsets.only( - left: 6.sp, right: 6.sp), - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(9.sp), - gradient: const LinearGradient( - begin: Alignment(0.25, 0.5), - end: Alignment(0.75, 0.5), - colors: [ - Color(0xff8DFFF8), - Color(0xffB5D3FF) - ])), - child: Text( - getAgeCOntent( - lists.user!.gender ?? 0, - lists.user!.age ?? 0, - lists.user!.role ?? 0, - lists.user!.orientation ?? 0), - // '${genderList[lists.user!.gender!]}.${lists.user!.age}.${roleList[lists.user!.role!]}.${orientationList[lists.user!.orientation!]}', - style: TextStyle( - color: Colors.black, - fontSize: 12.sp, - ), - ), - ) - ], - ), - ], - ), - )), - ], - ), - ), - Container( - alignment: Alignment.topLeft, - // margin: EdgeInsets.only(top: 4.sp), - child: descText, - ), - Container( - height: picHeight, - - // color: Colors.red, - margin: EdgeInsets.only(top: 5.sp,), - child: picHeight == 140.sp - ? ClipRRect( - borderRadius: BorderRadius.circular(6.sp), - child: VideoItemWidget(lists.album![0].url!)) - : GridView.builder( - itemCount: lists.album!.length, - physics: const NeverScrollableScrollPhysics(), - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 3, //横轴三个子widget - crossAxisSpacing: 8.sp, - mainAxisSpacing: 8.sp, - childAspectRatio: 0.7 //宽高比为1时,子widget - ), - itemBuilder: (contentxt, currentIndex) { - Album album = lists.album![currentIndex]; - return GestureDetector( - onTap: () { - var imgList = []; - for (var element in lists.album!) { - imgList.add(element.url!); - } - Get.toNamed(AppRoutes.Swiper, arguments: { - 'imaglist': imgList, - 'index': currentIndex, - 'userId': lists.user!.id.toString() - }); - }, - child: ClipRRect( - borderRadius: BorderRadius.circular(6.sp), - child: CachedNetworkImage( - imageUrl: album.url!, - errorWidget: (context, url, error) => - const Icon(Icons.error), - fit: BoxFit.cover, - ), - ), - ); - }), - ), - Container( - height: 30.sp, - padding: EdgeInsets.only(left: 5.sp, right: 10.sp), - margin: EdgeInsets.only(top: picHeight == 0 ? 15.sp : 5.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(15.sp), - color: Color(0x33000000)), - child: Row( - children: [ - widgets.isNotEmpty - ? SizedBox( - width: 24 + 12.sp * widgets.length - 8.sp, - height: 24.sp, - child: Stack(children: widgets), - ) - : Container(), - SizedBox( - width: 4.sp, - ), - widgets.isNotEmpty - ? Expanded( - child: Text( - '${lists.chat!.count!}位圈友已私聊', - style: TextStyle( - color: Colors.white.withOpacity(0.75), - fontSize: 14.sp), - )) - : Expanded( - child: Text( - '赶紧成为第一位私聊ta的圈友吧', - style: TextStyle( - color: Colors.white.withOpacity(0.75), - fontSize: 14.sp), - )), - GestureDetector( - onTap: () { - pushMsgPage( - lists, - lists.interest!['id'].toString(), - ); - // pushHomePage( - // lists, widget.bean.id.toString()); - }, - child: Image.asset( - getCircleImage('chat'), - width: 60.sp, - ), - ) - ], - ), - ), - Container( - - margin: EdgeInsets.only(bottom: 10.sp,top: 5.sp), - child: circleInfoItem(lists.interest, lists, index), - ) - ], - ), - ), - - ])), - ); - } - - ///普通图文喊话 - normalDynamicItem(Lists lists) { - Text descText = Text( - lists.content!, - style: TextStyle(color: Colors.white, fontSize: 17.sp), - // maxLines: 2, - ); - - double picHeight = 0.0; - if (lists.album != null) { - if (lists.album!.isNotEmpty) { - Album info = lists.album!.first; - - if (info.type == 1) { - double picWidth = (Get.width - 100.sp) / 3 + 40; - if (lists.album!.length > 3) { - picHeight = picWidth * 2; - } else { - picHeight = picWidth; - } - } else { - picHeight = 140.sp; - } - } - } - - List widgets = []; - int index = 0; - lists.chat!.users!.forEach((element) { - widgets.add(Positioned( - left: 12.sp * index, - child: GestureDetector( - onTap: () {}, - child: - circleWidget(element.avatar!, element.id.toString(), width: 24), - ), - )); - index++; - }); - if (widgets.isNotEmpty) { - widgets.add(Positioned( - left: 12.sp * lists.chat!.users!.length, - child: Image.asset( - getCircleImage('more'), - width: 24.sp, - ))); - } - return GestureDetector( - onTap: () async { - var sp = await SharedPreferencesHelper.getInstance(); - String myUserId = sp.getMyUserId(); - if (lists.user?.id!.toString() == myUserId) { - Get.toNamed(AppRoutes.UserInfoActivity); - return; - } - pushHomePage(lists, lists.id.toString()); - }, - child: Container( - margin: EdgeInsets.only(bottom: 10.sp), - width: Get.width, - // height: 120.sp + contentHeight(lists.content!) + picHeight + 76.sp, - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.fill, - image: AssetImage( - getCircleImage('normal_bg'), - ))), - child: Stack( - children: [ - Positioned( - right: 2.sp, - top: 2.sp, - child: Stack( - alignment: Alignment.center, - children: [ - Container( - // margin: EdgeInsets.only(top: 5.sp,right: 5.sp), - padding: EdgeInsets.only(left: 15.sp, right: 15.sp), - alignment: Alignment.center, - height: 28.sp, - decoration: BoxDecoration( - color: Color.fromRGBO(52, 41, 67, 1), - borderRadius: BorderRadius.only( - topLeft: Radius.circular(0), - bottomRight: Radius.circular(0), - topRight: Radius.circular(12.sp), - bottomLeft: Radius.circular(12.sp))), - child: Text( - (lists.user!.city ?? '外星').length > 4 - ? (lists.user!.city ?? '外星').substring(0, 4) + - '...' - : (lists.user!.city ?? '外星'), - style: - TextStyle(color: Colors.white, fontSize: 15.sp), - )) - ], - ), - // height: 18.sp, - ), - Container( - width: Get.width, - padding: EdgeInsets.only(left: 12.sp, right: 12.sp), - child: Column( - children: [ - SizedBox( - height: 72.sp, - child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Stack( - alignment: Alignment.center, - children: [ - Image.asset( - getCircleImage('avatar_bg'), - width: 42.sp, - ), - ClipOval( - child: CachedNetworkImage( - imageUrl: lists.user!.avatar_thumb!, - width: 40.sp, - height: 40.sp, - fit: BoxFit.cover, - ), - ) - ], - ), - Expanded( - child: Container( - padding: EdgeInsets.only( - left: 8.sp, top: 12.sp), - alignment: Alignment.centerLeft, - height: 72.sp, - child: Column( - children: [ - Row( - children: [ - Text( - lists.user!.nickname!, - style: TextStyle( - color: Colors.white, - fontSize: 18.sp, - fontWeight: FontWeight.w600), - ), - SizedBox( - width: 8.sp, - ), - UserTagWidget(lists.user!.mark!), - ], - ), - SizedBox( - height: 4.sp, - ), - Row( - children: [ - Container( - alignment: Alignment.center, - height: 18.sp, - padding: EdgeInsets.only( - left: 6.sp, right: 6.sp), - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(9.sp), - gradient: const LinearGradient( - begin: Alignment(0.25, 0.5), - end: Alignment(0.75, 0.5), - colors: [ - Color(0xff8DFFF8), - Color(0xffB5D3FF) - ])), - child: Text( - getAgeCOntent( - lists.user!.gender ?? 0, - lists.user!.age ?? 0, - lists.user!.role ?? 0, - lists.user!.orientation ?? 0), - style: TextStyle( - color: Colors.black, - fontSize: 12.sp, - ), - ), - ) - ], - ), - ], - ), - )), - ], - ), - ), - Container( - alignment: Alignment.topLeft, - // margin: EdgeInsets.only(top: 4.sp), - child: descText, - ), - picHeight > 0 - ? Container( - // color: Colors.red, - height: picHeight, - alignment: Alignment.centerLeft, - margin: EdgeInsets.only(top: 5.sp), - child: picHeight == 140.sp - ? ClipRRect( - borderRadius: BorderRadius.circular(6.sp), - child: - VideoItemWidget(lists.album![0].url!)) - : GridView.builder( - itemCount: lists.album!.length, - physics: - const NeverScrollableScrollPhysics(), - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 3, //横轴三个子widget - crossAxisSpacing: 8.sp, - mainAxisSpacing: 8.sp, - childAspectRatio: - 0.7 //宽高比为1时,子widget - ), - itemBuilder: (contentxt, currentIndex) { - Album album = lists.album![currentIndex]; - if (album.type == 2) { - return ClipRRect( - borderRadius: - BorderRadius.circular(6.sp), - child: VideoItemWidget(album.url!)); - } - return GestureDetector( - onTap: () { - var imgList = []; - for (var element in lists.album!) { - imgList.add(element.url!); - } - Get.toNamed(AppRoutes.Swiper, - arguments: { - 'imaglist': imgList, - 'index': currentIndex, - 'userId': - lists.user!.id.toString() - }); - }, - child: ClipRRect( - borderRadius: - BorderRadius.circular(6.sp), - child: CachedNetworkImage( - imageUrl: album.url!, - // placeholder: (context, url) => - // SizedBox( - // width: 30.sp, - // height: 30.sp, - // child: CircularProgressIndicator( - // color: Color(0xFF07FAFB), - // strokeWidth: 2.sp, - // ), - // ), - errorWidget: - (context, url, error) => - const Icon(Icons.error), - fit: BoxFit.cover, - ), - ), - ); - })) - : Container(), - Container( - height: 30.sp, - padding: EdgeInsets.only( - left: 5.sp, - right: 10.sp, - ), - margin: - EdgeInsets.only(top: picHeight == 0 ? 15.sp : 5.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(15.sp), - color: Color(0x33000000)), - child: Row( - children: [ - widgets.isNotEmpty - ? SizedBox( - width: 24 + 12.sp * widgets.length - 8.sp, - height: 24.sp, - child: Stack(children: widgets), - ) - : Container(), - SizedBox( - width: 4.sp, - ), - widgets.isNotEmpty - ? Expanded( - child: Text( - '${lists.chat!.count!}位圈友已私聊', - style: TextStyle( - color: Colors.white.withOpacity(0.75), - fontSize: 14.sp), - )) - : Expanded( - child: Text( - '赶紧成为第一位私聊ta的圈友吧', - style: TextStyle( - color: Colors.white.withOpacity(0.75), - fontSize: 14.sp), - )), - GestureDetector( - onTap: () async { - pushMsgPage( - lists, lists.interest!['id'].toString()); - - // }); - }, - child: Image.asset( - getCircleImage('chat'), - width: 60.sp, - )) - ], - ), - ), - Container( - - margin: EdgeInsets.only(bottom: 10.sp,top: 5.sp), - child: circleInfoItem(lists.interest, lists, index), - ) - ], - ), - ), - ], - )), - ); - } - - tipItem() { - bool showTitle = lists.isEmpty; - return GetBuilder(builder: (logic) { - return Container( - margin: EdgeInsets.only(top: showTitle ? 10.sp : 0, bottom: 10.sp), - // height: 30.sp, - child: Column( - children: [ - if (showTitle) - logic.recommendCircleFriendData.isNotEmpty - ? Container( - // color: Colors.red, - child: RecommendCircleFriendItem( - false,0, - recommendCircleFriendData: logic.recommendCircleFriendData, - getDataCallBack: () { - logic.loadRecommendCircleFriendData(); - }), - ) - : Container(), - if (showTitle) - Container( - margin: EdgeInsets.only(bottom: 8.sp), - child: Image.asset( - getBaseImage('no_result'), - width: 200.sp, - ), - ), - if (showTitle) - Text( - '还没有您喜欢的圈友发布喊话哦~', - style: TextStyle(color: Colors.white, fontSize: 16.sp), - ), - Container( - margin: EdgeInsets.only(top: 20.sp), - padding: EdgeInsets.only(left: 30.sp, right: 30.sp), - child: Row( - children: [ - Expanded( - child: Container( - height: 2.sp, - color: Colors.white.withOpacity(0.5), - )), - Container( - margin: EdgeInsets.only(left: 8.sp, right: 8.sp), - height: 2.sp, - width: 2.sp, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(1.sp)), - ), - ShaderMask( - shaderCallback: (Rect bounds) { - return const LinearGradient( - begin: Alignment.centerRight, - end: Alignment.centerLeft, - colors: [Color(0xff71F3F2), Color(0xffF657FF)], - ).createShader(Offset.zero & bounds.size); - }, - child: Text( - '喊话推荐', - style: TextStyle(color: Colors.white, fontSize: 17.sp), - ), - ), - Container( - margin: EdgeInsets.only(left: 8.sp, right: 8.sp), - height: 2.sp, - width: 2.sp, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(1.sp)), - ), - Expanded( - child: Container( - height: 2.sp, - color: Colors.white.withOpacity(0.5), - )), - ], - ), - ) - ], - ), - ); - }); - } - - circleInfoItem(var bean, Lists list, int index) { - return GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.Signal_circle_list, - arguments: bean['id'].toString()); - }, - child: ClipRRect( - borderRadius: BorderRadius.circular(12.sp), - child: Container( - padding: EdgeInsets.only(left: 12.sp, right: 12.sp), - height: 72.sp, - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.fill, - image: AssetImage(getCircleImage('top_circle_bg')))), - child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - width: 42.sp, - height: 42.sp, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8.0), - gradient: const LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [ - Color(0xFF71F3F2), - Color(0xFFF558FF), - ], - stops: [0.0365, 0.9427], - ), - ), - padding: EdgeInsets.all(1.sp), - child: ClipRRect( - borderRadius: BorderRadius.circular(8.0), - child: CachedNetworkImage( - imageUrl: bean['image'], - width: 40.sp, - height: 40.sp, - fit: BoxFit.cover), - ), - ), - Expanded( - child: Container( - padding: EdgeInsets.only( - left: 8.sp, - top: 12.sp, - ), - // alignment: Alignment., - height: 72.sp, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - bean['title'], - style: TextStyle( - color: Colors.white, - fontSize: 18.sp, - fontWeight: FontWeight.w600), - ), - SizedBox( - height: 4.sp, - ), - Text( - // "view_total" -> 21 - '${convertToTenThousand(bean['view_total'])}人看过', - textAlign: TextAlign.left, - style: TextStyle( - color: const Color(0xff03FEFB), - fontSize: 12.sp, - ), - ), - ], - ), - )), - Container( - margin: EdgeInsets.only(right: 8.sp), - child: GestureDetector( - //加入圈子 - onTap: () async { - CircleLogic cLogic = Get.find(); - if (bean['is_join']) { - var data = await DioManager.instance.get( - url: "/up-service/interest/${bean['id']}", - ); - if (data["code"] == 200) { - Circle info = Circle.fromJson(data['data']); - Get.bottomSheet(CircleShare('', '', info), - isScrollControlled: true, enableDrag: false); - } - } else { - await cLogic.outCircle( - bean['id'].toString(), bean['is_join']); - bean['is_join'] = !bean['is_join']; - if (recomanddlists.isNotEmpty) { - recomanddlists.forEach((element) { - if (element.interest!['id'].toString() == - bean['id'].toString()) { - element.interest!['is_join'] = true; - element.interest = element.interest!; - } - }); - } - - if (lists.isNotEmpty) { - lists.forEach((element) { - if (element.interest!['id'].toString() == - bean['id'].toString()) { - element.interest!['is_join'] = true; - element.interest = element.interest!; - } - }); - } - if (Get.isRegistered()) { - LikeLogic likeLogic = Get.find(); - likeLogic.loadMyCircleData(); - } - setState(() {}); - } - }, - child: Stack( - alignment: Alignment.center, - children: [ - Opacity( - opacity: 0.5, - child: Image.asset( - getCircleImage('add'), - width: 60.sp, - ), - ), - Text( - !bean['is_join'] ? '申请加入' : '分享有奖', - style: - TextStyle(color: Colors.white, fontSize: 12.sp), - ) - ], - )), - ) - ], - ), - )), - ); - } - - circleWidget(String url, String userId, {double width = 24}) { - return GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.UserInfoActivity, arguments: userId); - }, - child: Stack( - alignment: Alignment.center, - children: [ - Image.asset( - getCircleImage('avatar_bg'), - width: width.sp, - ), - ClipOval( - child: CachedNetworkImage( - imageUrl: url ?? - "https://qiniuyun.leyuan666.com/quanzi/avatar/default.png", - width: (width - 1).sp, - height: (width - 1).sp, - fit: BoxFit.cover, - ), - ) - ], - )); - } - - void _showOutCircleDialog(BuildContext context, var controller, var bean) { - showDialog( - context: context, - builder: (BuildContext context) { - return Dialog( - backgroundColor: Colors.transparent, - child: Container( - height: 160.sp, - padding: const EdgeInsets.all(1.0), - child: Stack( - children: [ - Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: const LinearGradient( - colors: [Color(0xFFDD3DF4), Color(0xFF30FFD9)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Container( - margin: EdgeInsets.all(1.sp), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: const LinearGradient( - colors: [Color(0xFF4C3E5F), Color(0xFF324140)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Container( - margin: EdgeInsets.only(top: 24.sp), - child: Column( - children: [ - Center( - child: Text( - "提示", - style: - TextStyle(color: Colors.white, fontSize: 16.sp), - ), - ), - Container( - margin: EdgeInsets.only( - top: 12.sp, left: 14.sp, right: 14.sp), - alignment: Alignment.center, - child: Text( - "是否确认退出该圈子。", - textAlign: TextAlign.center, - style: TextStyle( - color: const Color(0xCCF7FAFA), fontSize: 16.sp), - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - onTap: () { - Navigator.pop(context); - }, - child: Container( - margin: EdgeInsets.only(top: 30.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color(0x26FFFFFF), - Color(0x26FFFFFF), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 10.sp, - bottom: 10.sp, - left: 52.sp, - right: 52.sp), - child: Text( - "否", - style: TextStyle( - color: Colors.white, - fontSize: 12.sp, - ), - ), - ), - ), - SizedBox(width: 24.sp), - GestureDetector( - onTap: () async { - Navigator.pop(context); - await controller.outCircle( - bean['id'].toString(), bean['is_join']); - }, - child: Container( - margin: EdgeInsets.only(top: 24.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 10.sp, - bottom: 10.sp, - left: 52.sp, - right: 52.sp), - child: Text( - "是", - style: TextStyle( - color: Colors.white, - fontSize: 12.sp, - ), - ), - ), - ) - ], - ) - ], - ), - ) - ], - ), - ), - ); - }, - ); - } - - double contentHeight(String content) { - return calculateTextHeight( - content, 17.sp, FontWeight.w300, Get.width - 100.sp, 100); - } - - void refreshCircleData() async { - var routePath = Get.currentRoute; - if (routePath == AppRoutes.Signal_circle_list) return; - - // var data = await DioManager.instance - // .get(url: 'up-service/interest/${widget.bean.id}'); - // if (data['code'] == 200) { - // widget.bean = Circle.fromJson(data['data']); - // widget.logic.updateCircleInfo(widget.bean); - // setState(() { - // - // }); - // // final logic = Get.put(CircleLogic()); - // // logic.update(); - // - // }else if(data['code'] == 404){ - // var logic = Get.put(CircleLogic()); - // logic.circle.lists.removeAt(logic.state.index); - // logic.update(); - // } - } -} diff --git a/circle_app/lib/app/circle/widgets/list_logic.dart b/circle_app/lib/app/circle/widgets/list_logic.dart deleted file mode 100644 index b56c88a..0000000 --- a/circle_app/lib/app/circle/widgets/list_logic.dart +++ /dev/null @@ -1,137 +0,0 @@ -import 'package:circle_app/app/circle/state.dart'; -import 'package:circle_app/common/Widgets/base_tip_widget.dart'; -import 'package:circle_app/common/Widgets/open_vip_tip/view.dart'; -import 'package:circle_app/network/dio_manager.dart'; -import 'package:circle_app/router/app_routers.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; - -import '../../../util/SharedPreferencesHelper.dart'; - -class ListLogic extends GetxController { - int callOutPage = 1; - - bool isLoad = true; - bool callOutMore = true; - var circleId = ''; - List lists = []; - final ScrollController scrollController = ScrollController(); - - loadCallOutListData() async { - var data = await DioManager.instance.get( - url: "/up-service/interest/$circleId/callouts", - params: {"page": callOutPage, "page_size": "20"}); - if (data["code"] == 200) { - List dataList = data["data"]["lists"] ?? []; - if (callOutPage == 1) { - if (lists.isNotEmpty) { - lists.clear(); - } - } - if (dataList.isNotEmpty) { - callOutMore = true; - for (var element in dataList) { - lists.add(Lists.fromJson(element)); - } - callOutPage++; - } - callOutMore = dataList.length == 20; - update(); - } else { - showOKToast(data["msg"]); - } - } - - setCircleId(String id) { - circleId = id; - loadCallOutListData(); - } - - void refreshData() { - callOutPage = 1; - callOutMore = true; - loadCallOutListData(); - - - } - - void loadMore() { - if (callOutMore == false) return; - loadCallOutListData(); - } - - - void pushOtherPeopleHomePage(String userId) { - Get.toNamed(AppRoutes.UserInfoActivity, arguments: userId); - - - // if (bean.isQueen) { - // showJoinCiclePiker(cicleId); - // } else { - //跳转消息页面 - // Get.bottomSheet(Open_vip_tipPage(), - // isScrollControlled: true, - // enableDrag: false, - // ); - // } - } - - void pushHomePage(Lists bean,String cicleId) async { - SharedPreferencesHelper.getInstance().then((sharedPreferences) { - int userId = sharedPreferences.getInt(SharedPreferencesHelper.USERID); - if(bean.user!.id==userId){ - Get.toNamed(AppRoutes.UserInfoActivity); - }else{ - Get.toNamed(AppRoutes.UserInfoActivity, arguments: bean.user!.id!.toString()); - } - }); - - - - - - // if (bean.isQueen) { - // showJoinCiclePiker(cicleId); - // } else { - //跳转消息页面 - // Get.bottomSheet(Open_vip_tipPage(), - // isScrollControlled: true, - // enableDrag: false, - // ); - // } - } - - void pushMsgPage(Lists bean,String cicleId) async { - - } - - @override - void onInit() { - // TODO: implement onInit - super.onInit(); - scrollController.addListener(() { - try { - if (scrollController.position.pixels == scrollController.position.maxScrollExtent) { - loadMore(); - } - } catch (e) { - - } - - }); - } - - @override - void onReady() { - // TODO: implement onReady - super.onReady(); - - } - @override - void onClose() { - // TODO: implement onClose - super.onClose(); - scrollController.dispose(); - } -} \ No newline at end of file diff --git a/circle_app/lib/app/circle/widgets/new_people.dart b/circle_app/lib/app/circle/widgets/new_people.dart deleted file mode 100644 index 789a41a..0000000 --- a/circle_app/lib/app/circle/widgets/new_people.dart +++ /dev/null @@ -1,413 +0,0 @@ -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:circle_app/app/circle/logic.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:gradient_borders/gradient_borders.dart'; -import 'package:pull_to_refresh/pull_to_refresh.dart'; - -import '../../../common/Widgets/tag_widget.dart'; -import '../../../common/colors/app_color.dart'; -import '../../../router/app_routers.dart'; -import '../../../util/eventBus.dart'; -import '../../../util/util.dart'; -import '../../userinfo/logic.dart'; -import '../view.dart'; -import 'dart:ui' as ui show PlaceholderAlignment; -class NewPeople extends StatefulWidget { - - @override - _NewPeopleState createState() => new _NewPeopleState(); - -} - -class _NewPeopleState extends State { - // TODO: add state variables and methods - - CircleLogic logic = Get.find(); - var sub; - ScrollController _scrollController = ScrollController(); - - double maxOff = 0; - @override - bool get wantKeepAlive => true; - @override - void initState() { - // TODO: implement initState - super.initState(); - logic.getNewPeopleListData(); - sub = EventBusManager.on().listen((event) { - // if (widget.logic.myVip > 0) { - _scrollController.animateTo(0, - duration: const Duration(milliseconds: 300), curve: Curves.easeInOut); - }); - - } - - @override - void dispose() { - // TODO: implement dispose - super.dispose(); - _scrollController.dispose(); - - sub.cancel(); - } - - - @override - Widget build(BuildContext context) { - // TODO: add widget build method - return GetBuilder(builder: (logic) { - return logic.newPeopleList.isNotEmpty ? SmartRefresher( - controller: logic.peopleRefreshController, - footer: DiyLoadFooter(noDataText: '只展示最近几天加入我们的圈友哦~',), - onRefresh: logic.onRefresh, - onLoading: logic.onLoading, - enablePullUp: true, - child:ListView.builder( - controller: _scrollController, - padding: EdgeInsets.only(left:10.sp,right: 10.sp), - itemCount:logic.newPeopleList.length, - itemBuilder: (context, index) { - return NewPeopleItem(info:logic.newPeopleList[index], index:index); - }, - ), - ) - : logic.isLoadFail ? noResultWidget(tip: '', callBack: () { - logic.isLoadFail = false; - logic.update(); - logic.onLoading(); - }) : loaddingWidget(logic.isNewPeopleMore,tip: '过段时间再来欢迎新人吧~'); - }); - } -} - - -class NewPeopleItem extends StatefulWidget { - Map info; - int index; - NewPeopleItem({super.key,required this.index,required this.info}); - - @override - State createState() => _NewPeopleItemState(); -} - -class _NewPeopleItemState extends State { - - CircleLogic logic = Get.find(); - @override - Widget build(BuildContext context) { - return ListItem(VicinityItemBean.fromJson(widget.info),widget.index); - } - - - Widget ListItem(VicinityItemBean item, int index) { - return GestureDetector( - onTap: () { - showOKToast('点击“👏欢迎”,对方回复您后就可以在消息列表进行聊天互动啦~'); - // Get.toNamed(AppRoutes.UserInfoActivity, arguments: item.id.toString()); - }, - child: Container( - margin: EdgeInsets.only(top: 10.sp), - // padding: EdgeInsets.only( left: 8.sp, right: 8.sp), - width: Get.width, - // height: 210.sp + (item.images.isNotEmpty ? 98.sp : 0), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10.sp), - border: Border.all( - color: AppColor.mainColor.withOpacity(0.2), - width: 1.sp, - ), - ), - child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - margin: EdgeInsets.only(right: 2.sp), - child: Row( - children: [ - Container( - margin: EdgeInsets.only(top: 6.sp, left: 8.sp), - width: 41.sp, - height: 41.sp, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(20.5.sp), - gradient: const LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [ - Color(0xFF71F3F2), - Color(0xFFF558FF), - ], - stops: [0.0365, 0.9427], - ), - ), - padding: EdgeInsets.all(2.sp), - child: ClipRRect( - borderRadius: BorderRadius.circular(30.sp), - child: Image.network(item.avatarThumb, - width: 40.sp, height: 40.sp, fit: BoxFit.cover), - ), - ), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.only(top: 6.sp, left: 4.sp), - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Text( - item.nickname.length > 5 ? item.nickname.substring(0,5) + '..' : item.nickname, - style: TextStyle( - fontWeight: FontWeight.bold, - color: const Color.fromRGBO(247, 250, 250, 1.0), - fontSize: 15.sp, - ), - ), - SizedBox(width: 2.sp), - if (item.gender != null) - Container( - margin: EdgeInsets.only( left: 4.sp), - child: _buildInfoRow(item)), - Expanded(child: Container()), - InkWell( - onTap: () { - logic.snedHelloData(item.id,index); - }, - child: Container( - padding: EdgeInsets.only(left: 2.sp,right: 2.sp), - margin: EdgeInsets.only(right: 4.sp), - height: 26.sp, - // decoration: BoxDecoration( - // borderRadius: BorderRadius.circular(13.sp), - // border: GradientBoxBorder( - // gradient: AppColor.mainVerLinearGradient, - // width: 1.sp, - // ), - // ), - child: Row( - children: [ - Image.asset( - getCircleImage('hello_icon'), - width: 24.sp, - ), - SizedBox(width: 2.sp,), - Text( - '欢迎', - style: TextStyle( - color: Colors.white, fontSize: 14.sp), - ) - ], - ), - ), - ), - - ], - ), - ), - Container( - margin: EdgeInsets.only(left: 4.sp,top: 4.sp), - child: Text( - item.joinFlag ?? '', - style: TextStyle( - color: - AppColor.mainColor, - fontSize: 14.sp, - ), - ), - ), - - ], - ), - ) - ], - ), - ), - Container( - // color: Colors.red, - // height: 55.sp, // 设置固定高度 - // constraints: BoxConstraints(maxHeight: 55.sp), - width: Get.width, - margin: EdgeInsets.symmetric(horizontal: 8.0,vertical: 10.sp), - child: Align( - alignment: Alignment.centerLeft, // 文本左对齐,垂直居中 - child: RichText( - overflow: TextOverflow.ellipsis, - maxLines: 2, - text: TextSpan( - children: [ - WidgetSpan( - alignment: ui.PlaceholderAlignment.middle, - // alignment: Rect.fromCenter(center: center, width: width, height: height), - child: Container( - margin: EdgeInsets.only(right: 2.sp,), - padding: EdgeInsets.only(left: 4.sp,right: 4.sp), - height: 20.sp, - width: item.city!.length > 4 ? 70.sp : item.city!.contains('km') ? item.city!.length * 13.sp : item.city!.length * 20.sp, - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(22), - color: AppColor.cityBgColor, - ), - child: Text( - item.city!, - style: TextStyle( - color: Colors.white, - fontSize: 11.sp, - fontWeight: FontWeight.w600), - ), - ), - ), - TextSpan( - text: item.signature!, - // overflow: TextOverflow.ellipsis, - style: TextStyle( - color: Colors.white, - fontSize: 18.sp,)), - ], - ), - ) - - // Text( - // item.signature ?? '暂时还没有签名哦~', - // maxLines: 2, - // style: - // TextStyle(color: Colors.white, fontSize: 18.sp), - // overflow: TextOverflow.ellipsis, - // ), - ), - ), - if (item.interests.isNotEmpty) - Container( - margin: EdgeInsets.only(left: 8.sp, right: 3.sp, bottom: 5.sp,top: 5.sp), - child: _buildInterestsListView(item.interests)), - if (item.images.isNotEmpty) - Container( - height: 120.sp, - margin: EdgeInsets.only( - top: 6.sp, left: 10.sp, right: 10.sp, bottom: 10.sp), - child: SingleChildScrollView( - scrollDirection: Axis.horizontal, - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - for (int i = 0; i < item.images.length; i++) - GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.Swiper, arguments: { - 'imaglist': item.images, - 'index': i - }); - }, - child: ListAlbumItem(item.images[i], i)), - ], - ), - ), - ), - ]), - ), - ); - } - - Widget ListAlbumItem(String item, int index) { - return Container( - margin: EdgeInsets.symmetric(horizontal: 2.sp), - child: ClipRRect( - borderRadius: BorderRadius.circular(8.sp), - child: CachedNetworkImage( - width: (Get.width - 45.sp - 8.sp) /3, - height: 120.sp, - fit: BoxFit.cover, - imageUrl: item + "?imageView2/1/w/176/h/176/q/75", - ), - ), - ); - } - - Widget _buildInfoRow(var item) { - String ageMsg = - getAgeCOntent(item!.gender, item!.age, item!.role, item!.orientation); - return Row( - children: [ - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color.fromRGBO(141, 255, 248, 1.0), - Color.fromRGBO(181, 211, 255, 1.0), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 2.sp, - bottom: 2.sp, - left: 10.sp, - right: 10.sp, - ), - child: Text( - ageMsg, - style: const TextStyle( - color: Colors.black, - fontSize: 10, - ), - ), - ), - const SizedBox(width: 6), - ], - ); - } - - Widget _buildInterestsListView(List interests) { - return Align( - alignment: Alignment.centerLeft, - child: SingleChildScrollView( - scrollDirection: Axis.horizontal, - child: Row( - children: [ - for (int index = 0; index < interests.length; index++) - GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.Signal_circle_list, - arguments: interests[index].id); - }, - child: Container( - margin: EdgeInsets.only(right: 11.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17.0), - border: GradientBoxBorder( - gradient: - AppColor.mainVerLinearGradient, - width: 0.5.sp, - ), - color: const Color(0xFF392D53), - ), - child: Padding( - padding: EdgeInsets.only( - top: 2.sp, - bottom: 2.sp, - left: 15.sp, - right: 15.sp, - ), - child: Center( - child: Text( - interests[index].title, - style: const TextStyle( - fontSize: 13.0, - color: Colors.white, - ), - ), - ), - ), - ), - ), - ], - ), - ), - ); - } -} - diff --git a/circle_app/lib/app/circle/widgets/play_video_view.dart b/circle_app/lib/app/circle/widgets/play_video_view.dart deleted file mode 100644 index 3c81e26..0000000 --- a/circle_app/lib/app/circle/widgets/play_video_view.dart +++ /dev/null @@ -1,113 +0,0 @@ -import 'package:circle_app/util/util.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:video_player/video_player.dart'; - -class PlayVideoView extends StatefulWidget { - String url; - PlayVideoView(this.url, {Key? key}) : super(key: key); - @override - State createState() => _PlayVideoViewState(); -} - -class _PlayVideoViewState extends State { - VideoPlayerController? videoPlayerController; - - @override - void initState() { - super.initState(); - videoPlayerController = VideoPlayerController.network(widget.url) - ..initialize().then((_) { - videoPlayerController!.play(); - // Ensure the first frame is shown after the video is initialized, even before the play button has been pressed. - setState(() {}); - }); - - videoPlayerController?.addListener(() async { - // value.position == value.duration - if (videoPlayerController?.value.position == - videoPlayerController?.value.duration) { - // videoPlayerController?.pause(); - await videoPlayerController?.seekTo(Duration.zero); - setState(() {}); - } - }); - } - - @override - void dispose() { - // TODO: implement dispose - super.dispose(); - videoPlayerController?.dispose(); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - backgroundColor: Colors.black, - body: Stack( - children: [ - Container( - width: Get.width, - height: Get.height, - child: GestureDetector( - onTap: () { - if (videoPlayerController!.value.isPlaying) { - videoPlayerController!.pause(); - } else { - videoPlayerController!.play(); - } - setState(() {}); - }, - child: Stack( - alignment: Alignment.center, - children: [ - AspectRatio( - aspectRatio: videoPlayerController!.value.aspectRatio, - child: VideoPlayer(videoPlayerController!)), - Center( - child: videoPlayerController!.value.isPlaying - ? Container() - : Image( - image: AssetImage(getMineImage("icon_play")), - width: 60.sp, - height: 60.sp, - ), - ), - ], - ), - ), - ), - Positioned( - bottom: 0, - child: SafeArea( - child: SizedBox( - width: Get.width, - height: 10.sp, - child: VideoProgressIndicator(videoPlayerController!, - allowScrubbing: true, - colors: const VideoProgressColors( - playedColor: Colors.white, - bufferedColor: Colors.white54, - backgroundColor: Colors.black)), - ), - )), - Positioned( - left: 15.sp, - top: 44.sp, - child: GestureDetector( - onTap: () { - Get.back(); - }, - child: Image.asset( - 'assets/images/navigator/back.png', - width: 36.sp, - height: 36.sp, - )), - ) - ], - ), - ); - } -} diff --git a/circle_app/lib/app/circle/widgets/vicinity.dart b/circle_app/lib/app/circle/widgets/vicinity.dart deleted file mode 100644 index bd8d959..0000000 --- a/circle_app/lib/app/circle/widgets/vicinity.dart +++ /dev/null @@ -1,588 +0,0 @@ -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:circle_app/app/circle/logic.dart'; -import 'package:circle_app/app/circle/view.dart'; -import 'package:circle_app/app/circle/widgets/info_list_view.dart'; -import 'package:circle_app/app/userinfo/logic.dart'; -import 'package:circle_app/router/app_routers.dart'; -import 'package:circle_app/util/eventBus.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:flutter_swiper/flutter_swiper.dart'; -import 'package:get/get.dart'; -import 'package:get/get_core/src/get_main.dart'; -import 'package:gradient_borders/box_borders/gradient_box_border.dart'; -import 'package:pull_to_refresh/pull_to_refresh.dart'; - -import '../../../common/Widgets/tag_widget.dart'; -import 'package:flutter_bmflocation/flutter_bmflocation.dart'; - -import '../../../common/colors/app_color.dart'; -import 'dart:ui' as ui show PlaceholderAlignment; - -class Vicinity extends StatefulWidget { - CircleLogic logic; - // TODO: add state variables, methods and constructor params - Vicinity(this.logic); - - @override - State createState() => _VicinityState(); -} - -class _VicinityState extends State with AutomaticKeepAliveClientMixin { - - var sub; - ScrollController _scrollController = ScrollController(); - - double maxOff = 0; - @override - bool get wantKeepAlive => true; - @override - void initState() { - // TODO: implement initState - super.initState(); - widget.logic.getNearByList(); - sub = EventBusManager.on().listen((event) { - try { - _scrollController.animateTo(0, - duration: const Duration(milliseconds: 300), curve: Curves.easeInOut); - } catch (e) { - - } - }); - } - - @override - void dispose() { - // TODO: implement dispose - super.dispose(); - _scrollController.dispose(); - - sub.cancel(); - } - - @override - Widget build(BuildContext context) { - // TODO: add widget build method - - return widget.logic.vicinityList.isNotEmpty ? Stack( - fit: StackFit.expand, - children: [ - SmartRefresher( - controller: widget.logic.refreshController, - onRefresh: _onRefresh, - onLoading: _onLoading, - enablePullUp: true, - child: ListView.builder( - controller: _scrollController, - padding: EdgeInsets.all(10.sp), - itemCount:widget.logic.vicinityList.length + 1, - itemBuilder: (context, index) { - if (index == 0) { - return bannerView(widget.logic); - } else { - return ListItem(widget.logic.vicinityList[index - 1], index - 1); - } - }, - ), - ), - // if (widget.logic.myVip == 0) - // Positioned( - // bottom: 0, - // child: showVipView()) - // Positioned(top: 10.sp,left: 10.sp,child: GestureDetector( - // onTap: () { - // Get.toNamed(AppRoutes.WorldCallOut); - // }, - // child: Image.asset( - // getMsgImage('hu_icon'), - // width: 30.sp, - // ), - // ),) - ], - ) : widget.logic.isNearLoad ? loaddingWidget(true) : noResultWidget(tip: '',callBack: () { - widget.logic.isNearLoad = true; - widget.logic.update(); - _onLoading(); - }); - } - - Widget bannerView(CircleLogic controller) { - return SizedBox( - height: 160.sp, - // margin: EdgeInsets.symmetric(horizontal: 16.sp), - child: Swiper( - autoplay: widget.logic.bannerList.length > 1, - controller: widget.logic.swiperController, - autoplayDelay: 6000, - loop: widget.logic.bannerList.length > 1 ? true : false, - // index:logic.index, - itemBuilder: (BuildContext context, int index) { - return GestureDetector( - onTap: () async { - // print(logic.bannerList[index].param); - navigateToCustomRoute(widget.logic.bannerList[index]); - }, - child: SizedBox( - width: Get.width, - child: ClipRRect( - borderRadius: BorderRadius.circular(15.sp), - child: CachedNetworkImage( - imageUrl: widget.logic.bannerList[index].picUrl, - fit: BoxFit.fill, - width: Get.width, - ), - )), - ); - }, - itemCount: widget.logic.bannerList.length, - pagination: SwiperPagination( - margin: EdgeInsets.all(5.0.sp), // 设置外边距 - alignment: Alignment.bottomCenter, - builder: DotSwiperPaginationBuilder( - color: Color(0x00FFFFFF), // 小圆点的颜色 - activeColor: widget.logic.bannerList.length == 1 - ? Color(0x00FFFFFF) - : Color(0x00FFFFFF), // 当前索引小圆点的颜色 - ), - ), -// control: new SwiperControl(), //左右的那个箭头,在某模拟器中会出现蓝线 - ), - ); - } - - Widget circleList(CircleLogic controller) { - return Swiper( - itemBuilder: (BuildContext context, int index) { - var bean = widget.logic.circle.lists[index]; - // final GlobalKey infoListViewKey = GlobalKey(); - return InfoListView(index, bean, widget.logic); - }, - onIndexChanged: (index) { - controller.state.index = index; - if (index == widget.logic.circle.lists.length - 1) { - widget.logic.loadMore(); - } - print(index.toString()); - }, - index: controller.state.index, - itemCount: widget.logic.circle.lists.length, - viewportFraction: 0.93, - // scale: 0.9, - loop: false, - // key: UniqueKey(), - // pagination: new SwiperPagination(),//如果不填则不显示指示点 - // control: new SwiperControl(),//如果不填则不显示左右按钮 - ); - } - - Widget showVipView() { - return Container( - width: Get.width, - height: 200.sp, - // margin: EdgeInsets.only(top: 10.sp), - - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10.sp), - color: Colors.black.withOpacity(0.87), - ), - margin: EdgeInsets.only(left: 15.sp,right: 15.sp), - padding: EdgeInsets.symmetric(vertical: 15.sp, horizontal: 20.sp), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Center( - child: Text( - "VIP特权", - style: TextStyle(color: Colors.white, fontSize: 16.sp), - ), - ), - Container( - padding: EdgeInsets.only(top: 18.sp), - child: Text( - "开通VIP后,才能查看更多附近的圈友,也可以根据您的喜好、属性、角色、取向等筛选出想要认识的人,还可以获得其他十几种会员特权,拥有更多不一样的体验", - style: TextStyle(color: Colors.white, fontSize: 14.sp), - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - GestureDetector( - onTap: () { - Get.back(); - }, - child: Container( - // height: 40.sp, - // width: 120.sp, - margin: EdgeInsets.only(top: 14.sp), - alignment: Alignment.center, - padding: EdgeInsets.symmetric( - vertical: 10.sp, - horizontal: 30.sp, - ), - decoration: BoxDecoration( - color: Colors.grey.withOpacity(0.7), - borderRadius: BorderRadius.circular(20), - ), - child: Text( - '再考虑考虑', - style: TextStyle( - color: Colors.white.withOpacity(0.6), - fontSize: 12, - fontWeight: FontWeight.w500), - )), - ), - GestureDetector( - onTap: () async { - Get.back(); - widget.logic.showRechargeDialog(); - }, - child: Center( - child: Container( - margin: EdgeInsets.only(top: 14.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.symmetric( - vertical: 10.sp, - horizontal: 30.sp, - ), - child: const Text( - "前往开通VIP", - style: TextStyle( - color: Colors.white, - fontSize: 12, - ), - ), - ), - )), - ], - ) - ], - )); - } - - Widget ListItem(VicinityItemBean item, int index) { - return GestureDetector( - onTap: () { - if (index < widget.logic.chargeFreeNum) { - Get.toNamed(AppRoutes.UserInfoActivity, arguments: item.id.toString()); - } else { - if (widget.logic.chargeType == 1) { - if (widget.logic - .myVip > 0) { - Get.toNamed(AppRoutes.UserInfoActivity, arguments: item.id.toString()); - } else { - Get.bottomSheet(Scaffold(backgroundColor: Colors.transparent,body: Center( - child: showVipView(), - ),),isScrollControlled: true,backgroundColor: Colors.transparent,barrierColor: Colors.black.withOpacity(0.6)); - } - } else { - Get.toNamed(AppRoutes.UserInfoActivity, arguments: item.id.toString()); - } - } - - - }, - child: Container( - margin: EdgeInsets.only(top: 10.sp), - // padding: EdgeInsets.only( left: 8.sp, right: 8.sp), - width: Get.width, - // height: 210.sp, - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(10.sp), - border: GradientBoxBorder( - gradient: - item.vip == 2 ? AppColor.mainVerLinearGradient : AppColor.clearVerLinearGradient, - width: 1.sp, - ), - ), - // decoration: BoxDecoration( - // image: DecorationImage( - // fit: BoxFit.fill, - // image: AssetImage( - // getCircleImage('pic_bg'), - // ))), - child: Stack( - children: [ - Container( - margin: EdgeInsets.only(top: 1.sp, left: 1.sp, right: 1.sp), - child: ClipRRect( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(10.sp), - topRight: Radius.circular(10.sp), - ), - child: Stack( - children: [ - Image( - image: AssetImage(getCircleImage("icon_list_null")), - width: Get.width, - fit: BoxFit.fill, - height: 92.sp, - ), - Container( - height: 92.sp, - width: Get.width, - color: Colors.black.withOpacity(0.25), - ) - ], - ) - ), - ), - Column(children: [ - Container( - margin: EdgeInsets.only(right: 2.sp), - child: Row( - children: [ - Container( - margin: EdgeInsets.only(top: 6.sp, left: 8.sp), - width: 88.sp, - height: 88.sp, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8.0), - gradient: const LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [ - Color(0xFF71F3F2), - Color(0xFFF558FF), - ], - stops: [0.0365, 0.9427], - ), - ), - padding: EdgeInsets.all(0.2.sp), - child: ClipRRect( - borderRadius: BorderRadius.circular(8.0), - child: Image.network(item.avatarThumb, - width: 88.sp, height: 88.sp, fit: BoxFit.cover), - ), - ), - Expanded( - child: SingleChildScrollView( - scrollDirection: Axis.horizontal, - child: Container( - margin: EdgeInsets.only(top: 6.sp), - child: Row( - children: [ - for (int i = 0; i < item.images.length; i++) - GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.Swiper, - arguments: { - 'imaglist': item.images, - 'index': i, - // 'userId': item.id.toString() - }); - }, - child: ListAlbumItem(item.images[i], i)), - ], - ), - ), - ), - ), - ], - ), - ), - Container( - margin: EdgeInsets.only(top: 6.sp, left: 9.sp), - child: Row( - children: [ - Text( - item.nickname.length > 5 ? item.nickname.substring(0,5) + '..' : item.nickname, - style: TextStyle( - fontWeight: FontWeight.bold, - color: const Color.fromRGBO(247, 250, 250, 1.0), - fontSize: 16.sp, - ), - ), - SizedBox(width: 8.sp), - _buildInfoRow(item), - const Spacer(), - Container( - margin: EdgeInsets.only(right: 8.sp), - child: Text( - item.onlineFlag.toString(), - style: TextStyle( - color: const Color.fromRGBO(247, 250, 250, 1.0), - fontSize: 12.sp, - ), - )), - ], - ), - ), - Container( - // height: 55.sp, // 设置固定高度 - width: Get.width, - margin: EdgeInsets.symmetric(vertical: 12.0.sp,horizontal: 9.sp), - child: Align( - alignment: Alignment.centerLeft, // 文本左对齐,垂直居中 - child: RichText( - overflow: TextOverflow.ellipsis, - maxLines: 2, - text: TextSpan( - children: [ - WidgetSpan( - alignment: ui.PlaceholderAlignment.middle, - // alignment: Rect.fromCenter(center: center, width: width, height: height), - child: Container( - margin: EdgeInsets.only(right: 2.sp,), - padding: EdgeInsets.only(left: 4.sp,right: 4.sp), - height: 20.sp, - width: item.city!.length > 4 ? 70.sp : item.city!.contains('km') ? item.city!.length * 13.sp : item.city!.length * 20.sp, - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(22), - color: AppColor.cityBgColor, - ), - child: Text( - item.city!, - style: TextStyle( - color: Colors.white, - fontSize: 11.sp, - fontWeight: FontWeight.w600), - ), - ), - ), - TextSpan( - text: item.signature!, - // overflow: TextOverflow.ellipsis, - style: TextStyle( - color: Colors.white, - fontSize: 18.sp,)), - ], - ), - ) - ), - ), - Container( - margin: EdgeInsets.only(left: 8.sp, right: 3.sp,bottom: 5.sp), - child: _buildInterestsListView(item.interests)) - ]), - ], - )), - ); - } - - Widget ListAlbumItem(String item, int index) { - return Container( - margin: EdgeInsets.symmetric(horizontal: 2.sp), - child: CachedNetworkImage( - width: 88.sp, - height: 88.sp, - fit: BoxFit.cover, - imageUrl: item + "?imageView2/1/w/176/h/176/q/75", - ), - ); - } - - Widget _buildInfoRow(VicinityItemBean item) { - String ageMsg = - getAgeCOntent(item!.gender, item!.age, item!.role, item!.orientation); - return Row( - children: [ - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color.fromRGBO(141, 255, 248, 1.0), - Color.fromRGBO(181, 211, 255, 1.0), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 2.sp, - bottom: 2.sp, - left: 10.sp, - right: 10.sp, - ), - child: Text( - ageMsg, - style: const TextStyle( - color: Colors.black, - fontSize: 10, - ), - ), - ), - const SizedBox(width: 6), - UserTagWidget(item.mark!), - ], - ); - } - - Widget _buildInterestsListView(List interests) { - return Align( - alignment: Alignment.centerLeft, - child: SingleChildScrollView( - scrollDirection: Axis.horizontal, - child: Row( - children: [ - for (int index = 0; index < interests.length; index++) - GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.Signal_circle_list, - arguments: interests[index].id); - }, - child: Container( - margin: EdgeInsets.only(right: 11.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17.0), - border: GradientBoxBorder( - gradient: - AppColor.mainVerLinearGradient, - width: 0.5.sp, - ), - color: const Color(0xFF392D53), - ), - child: Padding( - padding: EdgeInsets.only( - top: 2.sp, - bottom: 2.sp, - left: 15.sp, - right: 15.sp, - ), - child: Center( - child: Text( - interests[index].title, - style: const TextStyle( - fontSize: 13.0, - color: Colors.white, - ), - ), - ), - ), - ), - ), - ], - ), - ), - ); - } - - void _onRefresh() async { - widget.logic.vicinityPage = 1; - widget.logic.offset = 0; - widget.logic.refreshController.resetNoData(); - widget.logic.flush = 1; - widget.logic.getNearByList(); - } - - void _onLoading() async { - if (widget.logic.vicinityPage == 2 && maxOff == 0) { - maxOff = _scrollController.offset - 170.sp; - } - widget.logic.getNearByList(); - } - -} diff --git a/circle_app/lib/app/circle/widgets/video_item.dart b/circle_app/lib/app/circle/widgets/video_item.dart deleted file mode 100644 index b5e7d6b..0000000 --- a/circle_app/lib/app/circle/widgets/video_item.dart +++ /dev/null @@ -1,41 +0,0 @@ -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:circle_app/app/circle/widgets/play_video_view.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; - -class VideoItemWidget extends StatefulWidget { - String url; - VideoItemWidget(this.url,{Key? key}) : super(key: key); - @override - State createState() => _VideoItemWidgetState(); -} - -class _VideoItemWidgetState extends State { - - @override - Widget build(BuildContext context) { - return Row( - children: [ - GestureDetector( - onTap: () { - Get.to(PlayVideoView(widget.url)); - }, - child: Stack( - alignment: Alignment.center, - children: [ - ClipRRect(borderRadius: BorderRadius.circular(6.sp),child: CachedNetworkImage(imageUrl:'${widget.url}?vframe/jpg/offset/1',height: 200.sp,fit: BoxFit.cover,)), - Image( - image: AssetImage(getMineImage("icon_play")), - width: 30.sp, - height: 30.sp, - ), - ], - ), - - ), - ], - ); - } -} diff --git a/circle_app/lib/app/circle_list/binding.dart b/circle_app/lib/app/circle_list/binding.dart deleted file mode 100644 index db3098d..0000000 --- a/circle_app/lib/app/circle_list/binding.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:get/get.dart'; - -import 'logic.dart'; - -class LikeBinding extends Bindings { - @override - void dependencies() { - Get.lazyPut(() => LikeLogic()); - } -} diff --git a/circle_app/lib/app/circle_list/logic.dart b/circle_app/lib/app/circle_list/logic.dart deleted file mode 100644 index b03a20d..0000000 --- a/circle_app/lib/app/circle_list/logic.dart +++ /dev/null @@ -1,246 +0,0 @@ -import 'package:circle_app/app/circle/logic.dart'; -import 'package:circle_app/app/home/logic.dart'; -import 'package:circle_app/app/invite/logic.dart'; -import 'package:circle_app/network/api.dart'; -import 'package:circle_app/network/dio_manager.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; - -import '../minefragment/logic.dart'; - -class LikeLogic extends GetxController { - int currentIndex = -1; - - int page = 1; - int myPage = 1; - - int total = 0; - TabController? tabController; - InterestsBean circle = InterestsBean(lists: []); - InterestsBean mycircle = InterestsBean(lists: []); - - ScrollController leftCtr = ScrollController(); - ScrollController rightCtr = ScrollController(); - ScrollController myCircleCtr = ScrollController(); - - bool isMore = true; - bool isMyMore = true; - bool isLoad = true; - - List hasNewList = []; - List categoriesList = []; - List openCallOutIdList = []; - - bool isNewPeople = false; - - bool isLoadNewData = false; - - bool isLoadFial = false; - - Data? homeData; - @override - void onInit() async { - // TODO: implement onInit - super.onInit(); - await loadMyInfo(); - rightCtr.addListener(() { - if (rightCtr.position.pixels == - rightCtr.position.maxScrollExtent) { - loadMore(); - } - }); - loadInviteData(); - loadCircleListData(); - loadMyCircleData(); - loadCircleTypeData(); - } - - loadMyInfo() async { - isLoadFial = false; - var data = await DioManager.instance.get(url: Api.getUserMine); - var bean = BaseResponse.fromJson( - data, (data) => MineResponseBean.fromJson(data)); - if (bean.isSuccess()) { - currentIndex = bean.data.isNewUser ? -1 : -2; - isNewPeople = currentIndex == -1; - if (!isLoadNewData && tabController == null) { - isLoadNewData = true; - update(); - } - } else if (bean.code == 404) { - isLoadFial = true; - showOKToast('网络不流畅哦,请检查网络情况'); - update(); - } - } - - loadData() { - loadInviteData(); - loadCircleListData(); - loadMyCircleData(); - loadCircleTypeData(); - } - - loadInviteData() async { - - var data = await DioManager.instance.get(url: Api.inviteMainPage); - if (data['code'] == 200) { - Autogenerated result = Autogenerated.fromJson(data); - - homeData = result.data; - - } - } - - loadCircleListData() async { - var data = await DioManager.instance.get( - url: Api.getCircleInterests, params: {"page": page, 'page_size': 20}); - var bean = BaseResponse.fromJson( - data, (data) => InterestsBean.fromJson(data)); - if (bean.data is InterestsBean && bean.isSuccess()) { - if (page == 1) { - circle = bean.data!; - } else { - circle.lists.addAll(bean.data!.lists); - } - - isLoad = false; - if (bean.data!.lists.length < 20) { - isMore = false; - } - update(); - } - } - - loadMyCircleData() async { - var data = await DioManager.instance - .get(url: Api.getMyCircleAll); - - // var bean = BaseResponse.fromJson( - // data, (data) => InterestsBean.fromJson(data)); - - if (data['code'] == 200) { - List circleList = data['data']; - if (circleList.isNotEmpty) { - List infoList = []; - circleList.forEach((element) { - var info = Circle.fromJson(element); - infoList.add(info); - }); - mycircle.lists = infoList; - if (currentIndex >= mycircle.lists.length - 1) { - currentIndex = mycircle.lists.length -1; - } - - loadCalloutsNew(); - } else { - mycircle.lists = []; - currentIndex = isNewPeople ? -1 : -2; - } - } - - update(); - } - - loadMore() { - if (isMore) { - page = page + 1; - loadCircleListData(); - } - } - - - - void relaodData() { - page = 1; - isMore = true; - loadCircleListData(); - } - - loadMyMore() { - if (isMyMore) { - myPage = myPage + 1; - loadMyCircleData(); - } - } - - - void relaodCircleTypeData() { - loadCircleTypeData(); - } - - void relaodMyData() { - myPage = 1; - loadMyCircleData(); - } - - outCircle(String interest_id, bool isStatus) async { - var data = await DioManager.instance.post( - url: "${Api.outCrrcle}$interest_id/join", - params: {"status": isStatus ? "0" : "1"}); - var bean = BaseResponse.fromJson(data, (data) => data); - if (bean.code == 200) { - circle.lists.forEach((element) { - if (element.id.toString() == interest_id.toString()) { - element.isJoin = !isStatus; - } - }); - - - relaodMyData(); - } - showOKToast(bean.msg); - } - - setTopCircle(String interest_id,bool isStatus) async { - var data = await DioManager.instance.post( - url: Api.circleTop, - params: {"interestId": interest_id,'isTop' :isStatus ? 1 : 0}); - var bean = BaseResponse.fromJson(data, (data) => data); - if (bean.code == 200) { - relaodMyData(); - } - showOKToast(bean.msg); - } - - - loadCalloutsNew() async { - List idList = []; - mycircle.lists.forEach((element) { - idList.add(element.id.toString()); - }); - var data = await DioManager.instance.post( - url:Api.calloutsNew, - params: {"interestIds":idList}); - - if (data['code'] == 200) { - hasNewList.clear(); - List infoList = data['data']; - bool isHasNew = false; - if (infoList.isNotEmpty) { - infoList.forEach((element) { - // "hasNew" -> false - hasNewList.add(element['hasNew']); - if (element['hasNew']) { - isHasNew = true; - } - }); - } - HomeLogic logic = Get.find(); - logic.showcirlceUnred.value = isHasNew; - // logic.update(); - // update(); - } - } - - loadCircleTypeData() async { - var data = await DioManager.instance.get( - url:Api.categoriesList,); - if (data['code'] == 200) { - categoriesList = data['data']; - update(); - } - } -} diff --git a/circle_app/lib/app/circle_list/view.dart b/circle_app/lib/app/circle_list/view.dart deleted file mode 100644 index 98d17b5..0000000 --- a/circle_app/lib/app/circle_list/view.dart +++ /dev/null @@ -1,1451 +0,0 @@ -import 'dart:math'; - -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:circle_app/app/circle/logic.dart'; -import 'package:circle_app/app/circle/widgets/info_list_view.dart'; -import 'package:circle_app/app/circle/widgets/like_view.dart'; -import 'package:circle_app/app/circle_list/widgets/circle_type_item.dart'; -import 'package:circle_app/app/circle_list/widgets/right_circle_iten.dart'; -import 'package:circle_app/app/select_circle/logic.dart'; -import 'package:circle_app/common/Widgets/circle_share.dart'; -import 'package:circle_app/common/Widgets/text_more.dart'; -import 'package:circle_app/main.dart'; -import 'package:circle_app/network/dio_manager.dart'; -import 'package:circle_app/router/app_routers.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; - -import 'logic.dart'; - -class CircleListPage extends StatefulWidget { - CircleListPage({Key? key}) : super(key: key); - - @override - State createState() => _CircleListPageState(); -} - -class _CircleListPageState extends State - with - RouteAware, - SingleTickerProviderStateMixin, - AutomaticKeepAliveClientMixin { - final ctr = Get.lazyPut(() => LikeLogic()); - - final logic = Get.find(); - - List tipList = [ - '总有一个小众圈子适合你', - '每一种情趣都值得被尊重', - '再小的圈子也有同好共鸣', - '无数独特小圈等你来体验', - '小众圈子的快乐家园', - '只为懂得人做小众圈子', - '加入圈子,享受生活', - '求同存异,相互尊重', - '让小圈交友变得简单', - '多元人格交友不等待', - '青年亚文化交友基地', - '可以不理解但请别伤害', - '1%真实玩家的小世界', - '少数人的亚文化社区', - '一起探索圈内新鲜事', - '私密的小众同好聚集地' - ]; - - @override - void initState() { - // TODO: implement initState - super.initState(); - } - - @override - void didChangeDependencies() { - // TODO: implement didChangeDependencies - super.didChangeDependencies(); - - /// 路由订阅 - routeObserver.subscribe(this, ModalRoute.of(context) as PageRoute); - } - - @override - void dispose() { - routeObserver.unsubscribe(this); - super.dispose(); - } - - void didPopNext() { - print('didPopNext'); - logic.loadMyCircleData(); - } - - ///当前页面进入时触发 - void didPush() { - print('didPopNext'); - } - - void didPop() { - print('didPop'); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - backgroundColor: Colors.transparent, - body: SafeArea( - child: GetBuilder(builder: (logic) { - if (logic.currentIndex > logic.mycircle.lists.length - 1 && - logic.currentIndex > 0) { - logic.currentIndex = logic.mycircle.lists.length - 1; - logic.update(); - } - - if (logic.isLoadNewData && logic.tabController == null) { - logic.tabController = TabController( - length: 2, - vsync: this, - initialIndex: logic.isNewPeople ? Random().nextInt(2) : 0); - logic.update(); - } - - return logic.isLoadFial ? noResultWidget(tip:'',callBack: () { - logic.isLoadFial = false; - logic.isLoad = true; - logic.update(); - logic.loadMyInfo(); - logic.loadData(); - }) : logic.isLoad - ? loaddingWidget(true) - : Container( - width: Get.width, - height: Get.height, - child: Row( - children: [ - Container( - width: 65.sp, - child: Column( - children: [ - leftItem('', logic.currentIndex == -1, false, -1), - leftItem('', logic.currentIndex == -2, false, -2), - Container( - alignment: Alignment.center, - height: 20, - child: Container( - width: 33.sp, - height: 1.sp, - color: Color(0x4DFFFFFF), - )), - Expanded( - child: MediaQuery.removePadding( - removeTop: true, - context: context, - child: ListView.builder( - controller: logic.myCircleCtr, - itemBuilder: (context, index) { - return leftItem( - logic.mycircle.lists[index].title, - logic.currentIndex == index, - logic.hasNewList.length > index - ? logic.hasNewList[index] - : false, - index); - }, - itemCount: logic.mycircle.lists.length, - ))) - ], - )), - Expanded( - child: Container( - child: logic.currentIndex == -1 - ? circleRecommandWidget() - : logic.currentIndex == -2 - ? LikeView( - changeCallback: () { - logic.currentIndex = -1; - logic.update(); - }, - ) - : RightCircleIten( logic.currentIndex, - logic.mycircle - .lists[logic.currentIndex], - logic,key: ValueKey( - '${logic.mycircle.lists[logic.currentIndex].id.toString() + logic.currentIndex.toString()}'),))) - - // InfoListView( - - - // ))) - ], - ), - ); - }), - ), - ); - } - - circleRecommandWidget() { - if (logic.tabController == null) { - return Container(); - } - return Column( - children: [ - Row( - children: [ - Container( - height: 30.sp, - child: TabBar( - isScrollable: true, - controller: logic.tabController, - labelPadding: EdgeInsets.symmetric(horizontal: 12.0.sp), - indicator: UnderlineTabIndicator( - borderSide: BorderSide( - color: const Color(0xFF00FFF4), - ), - ), - indicatorColor: const Color(0xFF00FFF4), - indicatorWeight: 2.sp, - labelColor: const Color(0xFF00FFF4), - unselectedLabelColor: const Color(0xB3FFFFFF), - indicatorSize: TabBarIndicatorSize.label, - indicatorPadding: EdgeInsets.only(left: 12.sp, right: 12.sp), - tabs: [ - Tab( - child: Text( - '推荐', - style: TextStyle( - fontSize: 18.sp, - ), - ), - ), - Tab( - child: Text( - '总览', - style: TextStyle( - fontSize: 18.sp, - ), - ), - ), - ], - labelStyle: TextStyle( - color: const Color(0xFF00FFF4), - fontSize: 18.sp, - shadows: [ - Shadow( - color: const Color(0xFFF657FF).withOpacity(0.5), - offset: Offset(0, -2), // 阴影偏移 - blurRadius: 3, // 阴影模糊半径 - // spreadRadius: 0 - ), - ], - ), - unselectedLabelStyle: TextStyle( - // color: const Color(0xB3FFFFFF), - fontSize: 18.sp, - shadows: [ - Shadow( - // color: const Color(0xFFF657FF), - offset: const Offset(0, -1), - blurRadius: 3.0.sp, - ), - ], - ), - onTap: (index) {}, - ), - ), - Expanded( - child: Container( - margin: EdgeInsets.only(right: 10.sp), - alignment: AlignmentDirectional.centerEnd, - child: Text( - '🧑‍🤝‍🧑' + tipList[Random().nextInt(tipList.length)], - style: TextStyle(color: Colors.white, fontSize: 14.sp), - ), - )) - ], - ), - if (logic.tabController != null) - Expanded( - child: Container( - margin: EdgeInsets.only(top: 5.sp), - child: TabBarView( - controller: logic.tabController, - children: [ - CircleRecommandWidget( - logic: logic, - ), - AllCircleType( - logic: logic, - ) - ], - ), - ), - ) - ], - ); - } - - allCircleWidget() { - if (logic.categoriesList.isNotEmpty) { - List wisgets = []; - logic.categoriesList.forEach((element) { - wisgets.add(CircleTypeItem(element['title'], element['id'].toString())); - }); - - return Stack( - fit: StackFit.expand, - children: [ - SingleChildScrollView( - child: Container( - padding: EdgeInsets.only(left: 5.sp), - child: Column( - children: wisgets, - ))), - Positioned( - bottom: 36.sp, - right: 10.sp, - child: GestureDetector( - onTap: () async { - var data = await Get.toNamed( - AppRoutes.Call_out, - ); - }, - child: Image.asset( - getCircleImage('send_msg'), - width: 70.sp, - ))) - ], - ); - } - return Container(); - } - - circleInfoListView() { - return Stack( - fit: StackFit.expand, - children: [ - ClipRRect( - borderRadius: BorderRadius.circular(10.sp), - child: SizedBox( - width: Get.width, - height: Get.height, - child: Image.asset( - getCircleImage('circle_bg'), - fit: BoxFit.cover, - ), - )), - RefreshIndicator( - onRefresh: () async { - logic.relaodData(); - }, - child: ListView.builder( - controller: logic.rightCtr, - itemBuilder: (context, index) { - if (index == logic.circle.lists.length) { - return loaddingWidget(logic.isMore, tip: '更多特色圈子正在赶来的路上~'); - } - return circleInfoItem(logic.circle.lists[index], index); - }, - itemCount: logic.circle.lists.length + 1, - )), - Positioned( - bottom: 36.sp, - right: 10.sp, - child: GestureDetector( - onTap: () async { - var data = await Get.toNamed( - AppRoutes.Call_out, - ); - }, - child: Image.asset( - getCircleImage('send_msg'), - width: 70.sp, - ))) - ], - ); - } - - goDetailPage(Circle bean, int index) async { - // if (!bean.isJoin) { - // await logic.outCircle( - // bean.id.toString(), - // bean.isJoin); - // } - - var result = - await Get.toNamed(AppRoutes.Signal_circle_list, arguments: bean.id); - var data = await DioManager.instance.get( - url: "/up-service/interest/${bean.id}", - ); - if (data["code"] == 200) { - var bean = Circle.fromJson(data['data']); - logic.circle.lists[index] = bean; - if (mounted) { - setState(() {}); - } - } - } - - goAndJoinDetailPage(Circle bean, int index) async { - if (!bean.isJoin) { - await logic.outCircle(bean.id.toString(), bean.isJoin); - } - - var result = - await Get.toNamed(AppRoutes.Signal_circle_list, arguments: bean.id); - var data = await DioManager.instance.get( - url: "/up-service/interest/${bean.id}", - ); - if (data["code"] == 200) { - var bean = Circle.fromJson(data['data']); - logic.circle.lists[index] = bean; - if (mounted) { - setState(() {}); - } - } - } - - circleInfoItem(Circle bean, int index) { - List urlList = bean.lastJoinUsers; - List widgets = []; - int i = 0; - // print(urlList); - if (null != urlList) { - urlList.forEach((element) { - if (widgets.length > 2) { - return; - } - widgets.add(Positioned( - left: 15.sp * i, - child: circleWidget( - element.avatar! ?? - "https://qiniuyun.leyuan666.com/quanzi/avatar/default.png", - element.id.toString()), - )); - i++; - }); - } - return GestureDetector( - onTap: () async { - goDetailPage(bean, index); - }, - child: Container( - margin: EdgeInsets.only(bottom: 10.sp), - child: Column( - children: [ - ClipRRect( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(10.sp), - topRight: Radius.circular(10.sp)), - child: Container( - padding: EdgeInsets.only(left: 12.sp, right: 12.sp), - height: 72.sp, - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.fill, - image: AssetImage(getCircleImage('top_circle_bg')))), - child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - width: 42.sp, - height: 42.sp, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8.0), - gradient: const LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [ - Color(0xFF71F3F2), - Color(0xFFF558FF), - ], - stops: [0.0365, 0.9427], - ), - ), - padding: EdgeInsets.all(1.sp), - child: ClipRRect( - borderRadius: BorderRadius.circular(8.0), - child: CachedNetworkImage( - imageUrl: bean.image, - width: 40.sp, - height: 40.sp, - fit: BoxFit.cover), - ), - ), - Expanded( - child: Container( - padding: EdgeInsets.only(left: 8.sp, top: 12.sp), - // alignment: Alignment., - height: 72.sp, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - bean.title, - style: TextStyle( - color: Colors.white, - fontSize: 18.sp, - fontWeight: FontWeight.w600), - ), - SizedBox( - height: 4.sp, - ), - Text( - '${convertToTenThousand(bean.viewTotal)}人看过', - textAlign: TextAlign.left, - style: TextStyle( - color: const Color(0xff03FEFB), - fontSize: 12.sp, - ), - ), - ], - ), - )), - GestureDetector( - //加入圈子 - onTap: () async { - if (bean.isJoin) { - Get.bottomSheet(CircleShare('', '', bean), - isScrollControlled: true, enableDrag: false); - } else { - goAndJoinDetailPage(bean, index); - } - }, - child: Stack( - alignment: Alignment.center, - children: [ - Opacity( - opacity: 0.5, - child: Image.asset( - getCircleImage('add'), - width: 60.sp, - ), - ), - Text( - !bean.isJoin ? '申请加入' : '分享有奖', - style: TextStyle( - color: Colors.white, fontSize: 12.sp), - ) - ], - )) - ], - ), - )), - Container( - padding: EdgeInsets.only(left: 12.sp, right: 12.sp), - // height:urlList.length==0?47.sp: 118.sp, - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.fill, - image: AssetImage(getCircleImage('circle_desc')))), - child: Container( - margin: EdgeInsets.only(top: 10.sp, bottom: 10.sp), - child: Column( - children: [ - Container( - margin: EdgeInsets.only(bottom: 7.sp), - width: Get.width - 80.sp, - // height: 50.sp, - child: HideText( - text: bean.intro, - maxWidth: Get.width - 89.sp, - additionText: '查看更多', - maxLines: 3, - style: - TextStyle(color: Colors.white, fontSize: 17.sp), - additionStyle: TextStyle( - color: const Color(0xFFFF4DF6), fontSize: 17.sp), - onTap: () { - goDetailPage(bean, index); - }, - )), - urlList.length == 0 - ? Container() - : Row( - children: [ - SizedBox( - height: 30.sp, - width: - 30.0.sp + 14.sp * (widgets.length - 1.sp), - child: Stack( - alignment: Alignment.center, - children: widgets, - ), - ), - SizedBox( - width: 4.sp, - ), - Text( - '${convertToTenThousand(bean.joinTotal)}圈友加入', - style: TextStyle( - color: Colors.white, fontSize: 12.sp), - ), - SizedBox( - width: 4.sp, - ), - // GestureDetector( - // onTap: () { - // // Get.bottomSheet( - // // CircleShare(logic.homeData!.inviteCode!,logic.homeData!.link!,bean), isScrollControlled: true, - // // enableDrag: false - // // ); - // }, - // behavior: HitTestBehavior.opaque, - // child: Container( - // height: 30.sp, - // alignment: Alignment.center, - // child: Image.asset( - // getCircleImage('play'), - // width: 20.sp, - // ), - // ), - // ) - ], - ), - ], - ), - ), - ), - ], - ), - ), - ); - } - - circleWidget(String url, String userId, {double width = 24}) { - return GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.UserInfoActivity, arguments: userId); - }, - child: Stack( - alignment: Alignment.center, - children: [ - Image.asset( - getCircleImage('avatar_bg'), - width: width.sp, - ), - ClipOval( - child: CachedNetworkImage( - imageUrl: url ?? - "https://qiniuyun.leyuan666.com/quanzi/avatar/default.png", - width: (width - 1).sp, - height: (width - 1).sp, - fit: BoxFit.cover, - ), - ) - ], - )); - } - - leftItem(String text, bool isSelcted, bool isUnread, int index) { - return GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () async { - logic.currentIndex = index; - - if (index >= 0) { - logic.hasNewList[index] = false; - logic.update(); - Future.delayed(Duration(seconds: 1), () { - logic.loadCalloutsNew(); - }); - } else { - logic.update(); - } - }, - onLongPress: () { - if (index >= 0) { - int count = 0; - for (int i = 0; i < logic.mycircle.lists.length; i++) { - if (logic.mycircle.lists[i].is_top) { - count++; - } - if (count == 5 || i > 5) { - break; - } - } - - if (count == 5 && !logic.mycircle.lists[index].is_top) { - showOKToast('最多置顶5个,可长按已置顶圈子取消置顶哦~'); - } else { - _showSetTopCircleDialog( - Get.context!, logic, logic.mycircle.lists[index]); - } - } - }, - child: Container( - width: 65.sp, - height: 65.sp, - // color: isSelcted ? Colors.white.withOpacity(0.3) : Colors.transparent, - child: Stack( - alignment: Alignment.center, - children: [ - if (isSelcted) - OverflowBox( - minWidth: 0.0, - maxWidth: double.infinity, - minHeight: 0.0, - maxHeight: double.infinity, - child: Image.asset(getCircleImage('circle_selected_bg'),width: 65.sp,), - ), - - if (text.isEmpty && index == -1) - topCicleStatusItem( - isSelcted, - Image.asset( - getCircleImage('circile_all_icon'), - width: 55.sp, - )), - if (text.isEmpty && index == -2) - topCicleStatusItem( - isSelcted, - Image.asset( - getCircleImage('like_icon'), - width: 32.sp, - )), - if (text.isNotEmpty) - cicleStatusItem( - isSelcted, - Container( - // margin: EdgeInsets.all(6.sp), - // padding: EdgeInsets.only(left: 4.sp), - alignment: Alignment.center, - // padding: EdgeInsets.all(6.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(7.sp), - gradient: LinearGradient( - colors: [Color(0xFF3F6967), Color(0xFF5C3769)])), - child: Text( - text, - maxLines: 2, - style: TextStyle( - color: Colors.white, - fontSize: 13.sp, - overflow: TextOverflow.ellipsis, - fontWeight: FontWeight.w600), - textAlign: TextAlign.center, - ), - )), - if (isUnread) - Positioned( - right: 6.sp, - top: 6.sp, - child: Container( - width: 15.sp, - height: 15.sp, - decoration: BoxDecoration( - shape: BoxShape.circle, - gradient: LinearGradient( - colors: [Color(0xFFC343F9), Color(0xFFFB34B2)]), - border: - Border.all(color: Color(0xFF170730), width: 1.sp)), - )) - ], - ), - ), - ); - } - - cicleStatusItem(bool isSelected, Widget widget) { - return Container( - width: 48.sp, - height: 48.sp, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(7.0), - gradient: LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: isSelected - ? [ - Color(0xFF71F3F2), - Color(0xFFF558FF), - ] - : [ - Colors.transparent, - Colors.transparent, - ], - stops: [0.0365, 0.9427], - ), - ), - child: ClipRRect( - borderRadius: BorderRadius.circular(7.0), - child: Container( - padding: EdgeInsets.all(isSelected ? 1.sp : 0.sp), - color: Color(0x14022AFF), - child: widget, - )), - ); - } - - topCicleStatusItem(bool isSelected, Widget widget) { - return Container( - alignment: Alignment.center, - width: 48.sp, - height: 48.sp, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(7.0), - gradient: LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: isSelected - ? [ - Color(0xFF71F3F2), - Color(0xFFF558FF), - ] - : [ - Colors.transparent, - Colors.transparent, - ], - stops: [0.0365, 0.9427], - ), - ), - child: Container( - width: 47.sp, - height: 47.sp, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(7.sp), - gradient: LinearGradient( - colors: [Color(0xFF3F6967), Color(0xFF5C3769)])), - // padding: EdgeInsets.all(isSelected ? 1.sp : 0), - child: ClipRRect( - borderRadius: BorderRadius.circular(7.0), - child: Container( - margin: EdgeInsets.all(isSelected ? 1.sp : 0.sp), - color: Color(0x14022AFF), - child: Stack( - alignment: Alignment.center, - children: [ - widget, - ], - ), - ))), - ); - } - - void _showTextContentDialog(BuildContext context, String msg, String title) { - showDialog( - context: context, - builder: (BuildContext context) { - return Dialog( - backgroundColor: Colors.transparent, - child: Container( - height: 300.sp, - padding: const EdgeInsets.all(1.0), - child: Stack( - children: [ - Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: const LinearGradient( - colors: [Color(0xFFDD3DF4), Color(0xFF30FFD9)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Container( - margin: EdgeInsets.all(1.sp), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: const LinearGradient( - colors: [Color(0xFF4C3E5F), Color(0xFF324140)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Positioned( - top: 15, - left: 0, - right: 0, - child: Center( - child: Text(title, - style: TextStyle( - color: const Color(0xFFF7FAFA), fontSize: 16.sp)), - )), - Container( - margin: EdgeInsets.only(top: 24.sp, bottom: 24.sp), - child: Container( - margin: - EdgeInsets.only(top: 12.sp, left: 14.sp, right: 14.sp), - alignment: Alignment.center, - child: SingleChildScrollView( - child: Text( - msg, - textAlign: TextAlign.center, - style: TextStyle( - color: const Color(0xCCF7FAFA), fontSize: 16.sp), - ), - ), - ), - ), - Positioned( - top: 8.sp, - right: 10.sp, - child: GestureDetector( - onTap: () { - Get.back(); - }, - child: Icon( - Icons.close, - color: Colors.white, - size: 20.sp, - ), - )), - ], - ), - ), - ); - }, - ); - } - - void _showSetTopCircleDialog(BuildContext context, var controller, var bean) { - showDialog( - context: context, - builder: (BuildContext context) { - return Dialog( - backgroundColor: Colors.transparent, - child: Container( - height: 160.sp, - padding: EdgeInsets.all(1.0), - child: Stack( - children: [ - Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: LinearGradient( - colors: [Color(0xFFDD3DF4), Color(0xFF30FFD9)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Container( - margin: EdgeInsets.all(1.sp), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: LinearGradient( - colors: [Color(0xFF4C3E5F), Color(0xFF324140)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Container( - margin: EdgeInsets.only(top: 24.sp), - child: Column( - children: [ - Center( - child: Text( - "提示", - style: - TextStyle(color: Colors.white, fontSize: 16.sp), - ), - ), - Container( - margin: EdgeInsets.only( - top: 12.sp, left: 14.sp, right: 14.sp), - alignment: Alignment.center, - child: Text( - bean.is_top ? "是否取消置顶该圈子。" : "是否置顶该圈子。", - textAlign: TextAlign.center, - style: TextStyle( - color: Color(0xCCF7FAFA), fontSize: 16.sp), - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - onTap: () { - Navigator.pop(context); - }, - child: Container( - margin: EdgeInsets.only(top: 30.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: LinearGradient( - colors: [ - Color(0x26FFFFFF), - Color(0x26FFFFFF), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 10.sp, - bottom: 10.sp, - left: 52.sp, - right: 52.sp), - child: Text( - "否", - style: TextStyle( - color: Colors.white, - fontSize: 12, - ), - ), - ), - ), - SizedBox(width: 24.sp), - GestureDetector( - onTap: () { - Navigator.pop(context); - logic.setTopCircle( - bean.id.toString(), !bean.is_top); - }, - child: Container( - margin: EdgeInsets.only(top: 24.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 10.sp, - bottom: 10.sp, - left: 52.sp, - right: 52.sp), - child: Text( - "是", - style: TextStyle( - color: Colors.white, - fontSize: 12, - ), - ), - ), - ) - ], - ) - ], - ), - ) - ], - ), - ), - ); - }, - ); - } - - @override - // TODO: implement wantKeepAlive - bool get wantKeepAlive => true; -} - -class CircleRecommandWidget extends StatefulWidget { - LikeLogic logic; - CircleRecommandWidget({super.key, required this.logic}); - - @override - State createState() => _CircleRecommandWidgetState(); -} - -class _CircleRecommandWidgetState extends State - with AutomaticKeepAliveClientMixin { - late LikeLogic logic; - @override - void initState() { - // TODO: implement initState - super.initState(); - logic = widget.logic; - } - - @override - Widget build(BuildContext context) { - return Stack( - fit: StackFit.expand, - children: [ - ClipRRect( - borderRadius: BorderRadius.circular(10.sp), - child: SizedBox( - width: Get.width, - height: Get.height, - child: Image.asset( - getCircleImage('circle_bg'), - fit: BoxFit.cover, - ), - )), - RefreshIndicator( - onRefresh: () async { - logic.relaodData(); - }, - child: ListView.builder( - controller: logic.rightCtr, - itemBuilder: (context, index) { - if (index == logic.circle.lists.length) { - return loaddingWidget(logic.isMore, tip: '更多特色圈子正在赶来的路上~'); - } - return circleInfoItem(logic.circle.lists[index], index); - }, - itemCount: logic.circle.lists.length + 1, - )), - Positioned( - bottom: 36.sp, - right: 10.sp, - child: GestureDetector( - onTap: () async { - var data = await Get.toNamed( - AppRoutes.Call_out, - ); - }, - child: Image.asset( - getCircleImage('send_msg'), - width: 70.sp, - ))) - ], - ); - } - - circleInfoItem(Circle bean, int index) { - List urlList = bean.lastJoinUsers; - List widgets = []; - int i = 0; - // print(urlList); - if (null != urlList) { - urlList.forEach((element) { - if (widgets.length > 2) { - return; - } - widgets.add(Positioned( - left: 15.sp * i, - child: circleWidget( - element.avatar! ?? - "https://qiniuyun.leyuan666.com/quanzi/avatar/default.png", - element.id.toString()), - )); - i++; - }); - } - return GestureDetector( - onTap: () async { - goDetailPage(bean, index); - }, - child: Container( - margin: EdgeInsets.only(bottom: 10.sp), - child: Column( - children: [ - ClipRRect( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(10.sp), - topRight: Radius.circular(10.sp)), - child: Container( - padding: EdgeInsets.only(left: 12.sp, right: 12.sp), - height: 72.sp, - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.fill, - image: AssetImage(getCircleImage('top_circle_bg')))), - child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - width: 42.sp, - height: 42.sp, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8.0), - gradient: const LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [ - Color(0xFF71F3F2), - Color(0xFFF558FF), - ], - stops: [0.0365, 0.9427], - ), - ), - padding: EdgeInsets.all(1.sp), - child: ClipRRect( - borderRadius: BorderRadius.circular(8.0), - child: CachedNetworkImage( - imageUrl: bean.image, - width: 40.sp, - height: 40.sp, - fit: BoxFit.cover), - ), - ), - Expanded( - child: Container( - padding: EdgeInsets.only(left: 8.sp, top: 12.sp), - // alignment: Alignment., - height: 72.sp, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - bean.title, - style: TextStyle( - color: Colors.white, - fontSize: 18.sp, - fontWeight: FontWeight.w600), - ), - SizedBox( - height: 4.sp, - ), - Text( - '${convertToTenThousand(bean.viewTotal)}人看过', - textAlign: TextAlign.left, - style: TextStyle( - color: const Color(0xff03FEFB), - fontSize: 12.sp, - ), - ), - ], - ), - )), - GestureDetector( - //加入圈子 - onTap: () async { - if (bean.isJoin) { - Get.bottomSheet(CircleShare('', '', bean), - isScrollControlled: true, enableDrag: false); - } else { - goAndJoinDetailPage(bean, index); - } - }, - child: Stack( - alignment: Alignment.center, - children: [ - Opacity( - opacity: 0.5, - child: Image.asset( - getCircleImage('add'), - width: 60.sp, - ), - ), - Text( - !bean.isJoin ? '申请加入' : '分享有奖', - style: TextStyle( - color: Colors.white, fontSize: 12.sp), - ) - ], - )) - ], - ), - )), - Container( - padding: EdgeInsets.only(left: 12.sp, right: 12.sp), - // height:urlList.length==0?47.sp: 118.sp, - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.fill, - image: AssetImage(getCircleImage('circle_desc')))), - child: Container( - margin: EdgeInsets.only(top: 10.sp, bottom: 10.sp), - child: Column( - children: [ - Container( - margin: EdgeInsets.only(bottom: 7.sp), - width: Get.width - 80.sp, - // height: 50.sp, - child: HideText( - text: bean.intro, - maxWidth: Get.width - 89.sp, - additionText: '查看更多', - maxLines: 3, - style: - TextStyle(color: Colors.white, fontSize: 17.sp), - additionStyle: TextStyle( - color: const Color(0xFFFF4DF6), fontSize: 17.sp), - onTap: () { - goDetailPage(bean, index); - }, - )), - urlList.length == 0 - ? Container() - : Row( - children: [ - SizedBox( - height: 30.sp, - width: - 30.0.sp + 14.sp * (widgets.length - 1.sp), - child: Stack( - alignment: Alignment.center, - children: widgets, - ), - ), - SizedBox( - width: 4.sp, - ), - Text( - '${convertToTenThousand(bean.joinTotal)}圈友加入', - style: TextStyle( - color: Colors.white, fontSize: 12.sp), - ), - SizedBox( - width: 4.sp, - ), - // GestureDetector( - // onTap: () { - // // Get.bottomSheet( - // // CircleShare(logic.homeData!.inviteCode!,logic.homeData!.link!,bean), isScrollControlled: true, - // // enableDrag: false - // // ); - // }, - // behavior: HitTestBehavior.opaque, - // child: Container( - // height: 30.sp, - // alignment: Alignment.center, - // child: Image.asset( - // getCircleImage('play'), - // width: 20.sp, - // ), - // ), - // ) - ], - ), - ], - ), - ), - ), - ], - ), - ), - ); - } - - circleWidget(String url, String userId, {double width = 24}) { - return GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.UserInfoActivity, arguments: userId); - }, - child: Stack( - alignment: Alignment.center, - children: [ - Image.asset( - getCircleImage('avatar_bg'), - width: width.sp, - ), - ClipOval( - child: CachedNetworkImage( - imageUrl: url ?? - "https://qiniuyun.leyuan666.com/quanzi/avatar/default.png", - width: (width - 1).sp, - height: (width - 1).sp, - fit: BoxFit.cover, - ), - ) - ], - )); - } - - goDetailPage(Circle bean, int index) async { - // if (!bean.isJoin) { - // await logic.outCircle( - // bean.id.toString(), - // bean.isJoin); - // } - - var result = - await Get.toNamed(AppRoutes.Signal_circle_list, arguments: bean.id); - var data = await DioManager.instance.get( - url: "/up-service/interest/${bean.id}", - ); - if (data["code"] == 200) { - var bean = Circle.fromJson(data['data']); - logic.circle.lists[index] = bean; - if (mounted) { - setState(() {}); - } - } - } - - goAndJoinDetailPage(Circle bean, int index) async { - if (!bean.isJoin) { - await logic.outCircle(bean.id.toString(), bean.isJoin); - } - - var result = - await Get.toNamed(AppRoutes.Signal_circle_list, arguments: bean.id); - var data = await DioManager.instance.get( - url: "/up-service/interest/${bean.id}", - ); - if (data["code"] == 200) { - var bean = Circle.fromJson(data['data']); - logic.circle.lists[index] = bean; - if (mounted) { - setState(() {}); - } - } - } - - @override - // TODO: implement wantKeepAlive - bool get wantKeepAlive => true; -} - -class AllCircleType extends StatefulWidget { - LikeLogic logic; - AllCircleType({super.key, required this.logic}); - - @override - State createState() => _AllCircleTypeState(); -} - -class _AllCircleTypeState extends State - with AutomaticKeepAliveClientMixin { - late LikeLogic logic; - - @override - void initState() { - // TODO: implement initState - super.initState(); - logic = widget.logic; - } - - @override - Widget build(BuildContext context) { - if (logic.categoriesList.isNotEmpty) { - List wisgets = []; - logic.categoriesList.forEach((element) { - wisgets.add(CircleTypeItem(element['title'], element['id'].toString())); - }); - - return Stack( - fit: StackFit.expand, - children: [ - RefreshIndicator( - onRefresh: () async { - logic.relaodData(); - }, - child: SingleChildScrollView( - child: Container( - padding: EdgeInsets.only(left: 5.sp), - child: Column( - children: wisgets, - )))), - Positioned( - bottom: 36.sp, - right: 10.sp, - child: GestureDetector( - onTap: () async { - var data = await Get.toNamed( - AppRoutes.Call_out, - ); - }, - child: Image.asset( - getCircleImage('send_msg'), - width: 70.sp, - ))) - ], - ); - } - return Container(); - } - - @override - // TODO: implement wantKeepAlive - bool get wantKeepAlive => true; -} diff --git a/circle_app/lib/app/circle_list/widgets/circie_info_edit.dart b/circle_app/lib/app/circle_list/widgets/circie_info_edit.dart deleted file mode 100644 index 8e24ed1..0000000 --- a/circle_app/lib/app/circle_list/widgets/circie_info_edit.dart +++ /dev/null @@ -1,193 +0,0 @@ -import 'package:circle_app/common/colors/app_color.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; - -import '../../../util/util.dart'; - -class CircieInfoEdit extends StatefulWidget { - @override - _CircieInfoEditState createState() => new _CircieInfoEditState(); -} - -class _CircieInfoEditState extends State { - // TODO: add state variables and methods - - TextEditingController nameController = TextEditingController(); - TextEditingController descController = TextEditingController(); - - @override - Widget build(BuildContext context) { - // TODO: add widget build method - return Scaffold( - backgroundColor: Colors.transparent, - body: Column( - children: [ - Expanded(child: Container()), - Container( - height: 592.sp, - width: Get.width, - decoration: BoxDecoration( - color: Color(0xFF423055), - borderRadius: BorderRadius.only( - topLeft: Radius.circular(16.sp), - topRight: Radius.circular(16.sp))), - child: Column( - children: [ - Container( - margin: EdgeInsets.only(top: 8.sp), - width: 30.sp, - height: 3.sp, - decoration: BoxDecoration( - color: Color(0x33FFFFFF), - borderRadius: BorderRadius.circular(1.5.sp)), - ), - //圈子信息 - Container( - height: 130.sp, - margin: - EdgeInsets.only(left: 10.sp, right: 10.sp, top: 14.sp), - decoration: BoxDecoration( - color: Color(0x1AFFFFFF), - borderRadius: BorderRadius.circular(10.sp)), - child: Column( - children: [ - Row( - children: [ - Text( - '更换圈子封面', - style: - TextStyle(color: Colors.white, fontSize: 14.sp), - ), - Expanded( - child: Text( - '点击上传', - style: - TextStyle(color: Colors.white, fontSize: 14.sp), - )), - Image( - image: AssetImage(getHomeImage("icon_in")), - width: 24.sp, - height: 24.sp, - ), - ], - ), - Container( - height: 1.sp, - decoration: BoxDecoration( - gradient: AppColor.mainVerLinearGradient), - ), - Container( - width: 200.sp, - child: TextField( - onChanged: (msg) {}, - controller: nameController, - maxLength: 6, - style: - TextStyle(color: Colors.white, fontSize: 16.sp), - decoration: InputDecoration( - hintText: '请输入圈子名称', - hintStyle: TextStyle( - color: Colors.white70, fontSize: 16.sp), - border: InputBorder.none, - counterText: '', - contentPadding: EdgeInsets.only(left: 16.sp)), - ), - ), - Container( - margin: EdgeInsets.only(left: 10.sp, right: 10.sp), - height: 1.sp, - decoration: BoxDecoration( - gradient: AppColor.mainHorLinearGradient), - ), - Container( - width: 200.sp, - child: TextField( - onChanged: (msg) {}, - controller: nameController, - maxLength: 100, - style: - TextStyle(color: Colors.white, fontSize: 16.sp), - decoration: InputDecoration( - hintText: '请输入圈子描述', - hintStyle: TextStyle( - color: Colors.white70, fontSize: 16.sp), - border: InputBorder.none, - counterText: '', - contentPadding: EdgeInsets.only(left: 16.sp)), - ), - ), - Container( - margin: EdgeInsets.only(left: 10.sp, right: 10.sp), - height: 1.sp, - decoration: BoxDecoration( - gradient: AppColor.mainHorLinearGradient), - ), - ], - ), - ), - //圈子活动 - Container( - child: Row( - children: [ - Text( - '每日任务0/5', - style: TextStyle( - color: Colors.white, - fontSize: 16.sp, - fontWeight: FontWeight.bold), - ), - Expanded(child: Container()), - Image.asset( - getMineImage('bi_icon1'), - width: 20.sp, - ), - Text( - '300', - style: TextStyle(color: Colors.white, fontSize: 16.sp), - ) - ], - ), - ), - Container( - height: 58.sp, - margin: - EdgeInsets.only(left: 10.sp, right: 10.sp, top: 14.sp), - decoration: BoxDecoration( - color: Color(0x1AFFFFFF), - borderRadius: BorderRadius.circular(10.sp)), - child: Row( - children: [ - Expanded( - child: Container( - child: Column( - children: [ - Text( - '发布今日第一条喊话', - style: TextStyle( - color: Colors.white, fontSize: 14.sp), - ), - Text( - '高质量的喊话更容易吸引图友加入', - style: TextStyle( - color: Color(0x99FFFFFF), fontSize: 12.sp), - ), - ], - ), - ), - ), - Image( - image: AssetImage(getHomeImage("icon_in")), - width: 24.sp, - height: 24.sp, - ), - ], - )) - ], - ), - ) - ], - ), - ); - } -} diff --git a/circle_app/lib/app/circle_list/widgets/circle_type_item.dart b/circle_app/lib/app/circle_list/widgets/circle_type_item.dart deleted file mode 100644 index 5251ea1..0000000 --- a/circle_app/lib/app/circle_list/widgets/circle_type_item.dart +++ /dev/null @@ -1,179 +0,0 @@ -import 'package:circle_app/common/colors/app_color.dart'; -import 'package:circle_app/network/api.dart'; -import 'package:circle_app/network/dio_manager.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; - -import '../../../router/app_routers.dart'; -import '../../../util/util.dart'; - -class CircleTypeItem extends StatefulWidget { - String title; - String id; - - CircleTypeItem(this.title, this.id); - - @override - _CircleTypeItemState createState() => new _CircleTypeItemState(); -} - -class _CircleTypeItemState extends State { - // TODO: add state variables and methods - - ScrollController scrollController = ScrollController(); - int page = 1; - - bool isMore = true; - - List dataList = []; - - @override - void initState() { - // TODO: implement initState - super.initState(); - scrollController.addListener(() { - if (scrollController.offset == - scrollController.position.maxScrollExtent) { - if (isMore) { - loadData(); - } - } - }); - loadData(); - } - @override - void dispose() { - // TODO: implement dispose - super.dispose(); - scrollController.dispose(); - } - - @override - Widget build(BuildContext context) { - // TODO: add widget build method - return Container( - // color: Colors.red, - margin: EdgeInsets.only( - bottom: 10.sp, - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - widget.title, - style: TextStyle( - color: Colors.white, - fontSize: 16.sp, - fontWeight: FontWeight.bold), - ), - SizedBox(height: 4.sp,), - Container( - // color: Colors.red, - height: 145.sp, - width: Get.width, - child: ListView.builder( - itemBuilder: (BuildContext context, int index) { - return GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.Signal_circle_list, arguments: dataList[index]['id']); - // Get.toName(''); - }, - child: Container( - height: 145.sp, - width: 110.sp, - margin: EdgeInsets.only(right: 8.sp), - child: Stack( - alignment: Alignment.center, - fit: StackFit.expand, - children: [ - ClipRRect( - borderRadius: BorderRadius.circular(8.sp), - child: Image.network( - dataList[index]['image'], - fit: BoxFit.cover, - height: 145.sp, - width: 110.sp, - )), - Column( - // mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded(child: Container()), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - margin: EdgeInsets.only(top: 15.sp), - height: 24.sp, - alignment: Alignment.center, - padding: - EdgeInsets.only(left: 10.sp, right: 10.sp), - decoration: BoxDecoration( - color: AppColor.bgColor.withOpacity(0.65), - borderRadius: BorderRadius.circular(3.sp)), - child: Text( - dataList[index]['title'], - style: TextStyle( - color: Colors.white, fontSize: 13.sp), - ), - ), - ], - ), - Expanded(child: Container()), - // "view_total" -> 1024 - Container( - height: 22.sp, - alignment: Alignment.center, - decoration: BoxDecoration( - color: Colors.black.withOpacity(0.5), - - ), - child: Text( - '${convertToTenThousand(dataList[index]['view_total'])}人看过', - style: TextStyle( - color: Colors.white, fontSize: 12.sp), - ), - ) - ], - ) - ], - ), - ), - ); - }, - itemCount: dataList.length, - controller: scrollController, - scrollDirection: Axis.horizontal, - ), - ), - SizedBox(height: 6.sp,), - ], - ), - ); - } - - void loadData() async { - var result = await DioManager.instance.get( - url: Api.categoryInterests, - params: {'page': page, 'page_size': 20, 'category': widget.id}); - if (result['code'] == 200) { - List temp = result['data']['lists'] ?? []; - if (temp.isNotEmpty) { - isMore = temp.length == 20; - if (isMore) { - page++; - } - - dataList.addAll(temp); - } else { - isMore = false; - } - setState(() {}); - - if (page > 1) { - scrollController.jumpTo(scrollController.offset + 20); - } - } - } -} diff --git a/circle_app/lib/app/circle_list/widgets/create_circle.dart b/circle_app/lib/app/circle_list/widgets/create_circle.dart deleted file mode 100644 index 87e09ac..0000000 --- a/circle_app/lib/app/circle_list/widgets/create_circle.dart +++ /dev/null @@ -1,148 +0,0 @@ -import 'package:circle_app/common/colors/app_color.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:gradient_borders/gradient_borders.dart'; - -class CreateCircle extends StatefulWidget { - @override - _CreateCircleState createState() => new _CreateCircleState(); -} - -class _CreateCircleState extends State { - // TODO: add state variables and methods - String circleAvatartUrl = ''; - TextEditingController nameController = TextEditingController(); - TextEditingController descController = TextEditingController(); - - @override - Widget build(BuildContext context) { - // TODO: add widget build method - return Container( - alignment: Alignment.center, - child: Container( - decoration: BoxDecoration( - border: GradientBoxBorder( - gradient: AppColor.mainVerLinearGradient, - width: 1.sp, - ), - borderRadius: BorderRadius.circular(8.sp), - gradient: const LinearGradient( - colors: [ - Color(0xFF4C3E5F), - Color(0xFF324140), - ], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - )), - child: Column( - children: [ - Container( - margin: EdgeInsets.only(top: 18.sp), - child: Text( - '创建圈子', - style: TextStyle( - color: Color(0xFFF7FAFA), - fontSize: 16.sp, - fontWeight: FontWeight.bold), - ), - ), - GestureDetector( - onTap: () {}, - child: Image.asset( - getCircleImage('add'), - width: 106.sp, - ), - ), - Container( - width: 200.sp, - child: TextField( - onChanged: (msg) {}, - controller: nameController, - maxLength: 6, - style: TextStyle(color: Colors.white, fontSize: 16.sp), - decoration: InputDecoration( - hintText: '请输入圈子名称', - hintStyle: - TextStyle(color: Colors.white70, fontSize: 16.sp), - border: InputBorder.none, - counterText: '', - contentPadding: EdgeInsets.only(left: 16.sp)), - ), - ), - Container( - margin: EdgeInsets.only(left: 10.sp, right: 10.sp), - height: 1.sp, - decoration: - BoxDecoration(gradient: AppColor.mainHorLinearGradient), - ), - Container( - width: 200.sp, - child: TextField( - onChanged: (msg) {}, - controller: nameController, - maxLength: 100, - style: TextStyle(color: Colors.white, fontSize: 16.sp), - decoration: InputDecoration( - hintText: '请输入圈子描述', - hintStyle: - TextStyle(color: Colors.white70, fontSize: 16.sp), - border: InputBorder.none, - counterText: '', - contentPadding: EdgeInsets.only(left: 16.sp)), - ), - ), - Container( - margin: EdgeInsets.only(left: 10.sp, right: 10.sp), - height: 1.sp, - decoration: - BoxDecoration(gradient: AppColor.mainHorLinearGradient), - ), - Container( - margin: EdgeInsets.only(top: 14.sp, left: 10.sp), - child: Text( - '温馨提示', - style: TextStyle(color: AppColor.mainColor, fontSize: 12.sp), - ), - ), - Container( - margin: EdgeInsets.only(top: 4.sp, left: 10.sp), - child: Text( - '1、圈子名称不超过6个字,描述不超过100字;;', - style: TextStyle(color: Colors.white, fontSize: 12.sp), - ), - ), - Container( - margin: EdgeInsets.only(top: 4.sp, left: 10.sp), - child: Text( - '2、名称和描述不要包含特殊字符或违规词汇,通过人工审核后才会发布;', - style: TextStyle(color: Colors.white, fontSize: 12.sp), - ), - ), - Container( - margin: EdgeInsets.only(top: 4.sp, left: 10.sp), - child: Text( - '3、优质园子和圈主有机会获得丰厚奖励哦~', - style: TextStyle(color: Colors.white, fontSize: 12.sp), - ), - ), - - Container( - alignment: Alignment.center, - child: Container( - width: 190.sp, - height: 42.sp, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(21.sp), - gradient: AppColor.mainHorLinearGradient - ), - alignment: Alignment.center, - child: Text('立即创建',style: TextStyle(color: Colors.white,fontSize: 16.sp,fontWeight: FontWeight.bold),), - ), - ) - ], - ), - ), - ); - } -} diff --git a/circle_app/lib/app/circle_list/widgets/hug_tip.dart b/circle_app/lib/app/circle_list/widgets/hug_tip.dart deleted file mode 100644 index f800b7c..0000000 --- a/circle_app/lib/app/circle_list/widgets/hug_tip.dart +++ /dev/null @@ -1,149 +0,0 @@ -import 'package:circle_app/common/Widgets/base_tip_widget.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:circle_app/app/home/logic.dart'; -import 'package:circle_app/common/colors/app_color.dart'; -import 'package:circle_app/components/func_widget.dart'; -import 'package:circle_app/network/api.dart'; -import 'package:circle_app/network/dio_manager.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:gradient_borders/box_borders/gradient_box_border.dart'; - - -class HugTip extends StatefulWidget { - String circleId; - Function call; - List rewardConfigs; - HugTip(this.circleId,this.rewardConfigs,this.call); - @override - _HugTipState createState() => _HugTipState(); - -} - -class _HugTipState extends State { - // TODO: add state variables and methods - - - int index = 1; - - sendHugCount() async { - // [parameters setValue:self.hugCount forKey:@"hugCount"]; - // [parameters setValue:self.objId forKey:@"objId"]; - // [parameters setValue:@"2" forKey:@"objType"]; - - var result = await DioManager.instance.post(url: Api.rewardAgent,params: {'amount':widget.rewardConfigs[index],'interestAgentId':widget.circleId}); - if (result['code'] == 200) { - showOKToast('打赏成功'); - widget.call(); - Get.back(); - } else { - showOKToast(result['msg']); - if (result['code'] == 31201) { - showRechargeScreenDialog(); - } - - } - } - - @override - Widget build(BuildContext context) { - // TODO: add widget build method - return Scaffold( - backgroundColor: Colors.transparent, - body: Container( - width: Get.width, - alignment: Alignment.center, - child: Container( - width: Get.width, - margin: EdgeInsets.only(left: 20.sp,right: 20.sp), - height: 248.sp, - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage(getMineImage('im_neglect')), - fit: BoxFit.fill - ) - ), - child: Column( - children: [ - Container( - // width: 120.sp, - padding: EdgeInsets.only(left: 17.sp, right: 17.sp,top: 30.sp,bottom: 20.sp), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - typeItem(index == 0, widget.rewardConfigs[0],0,), - typeItem(index == 1, widget.rewardConfigs[1],1), - typeItem(index == 2, widget.rewardConfigs[2],2), - ], - )), - GestureDetector( - onTap: () { - sendHugCount(); - }, - child: Container( - width: 232.sp, - height: 42.sp, - decoration: BoxDecoration( - gradient: AppColor.mainVerLinearGradient, - borderRadius: BorderRadius.circular(21.sp) - ), - alignment: Alignment.center, - child: Text('打赏小票',style: TextStyle(color: Colors.white,fontSize: 16.sp,fontWeight: FontWeight.w500),), - ), - ), - SizedBox(height: 15.sp,), - GestureDetector( - onTap: () { - Get.back(); - }, - child: Container( - child: Text('无情拒绝',style: TextStyle(color: Color(0xFFB7BECC),fontSize: 14.sp),), - ), - ) - ], - ), - ), - ), - ); - } - - typeItem(bool isSelected, int i,int currentIndex) { - return GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - if (!isSelected) { - index = currentIndex; - setState(() { - - }); - } - }, - child: Container( - width: 88.sp, - height: 100.sp, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10.sp), - border: GradientBoxBorder( - gradient: - isSelected ? AppColor.mainVerLinearGradient : AppColor.clearLinearGradient, - width:1.sp, - ), - ), - child: Column( - children: [ - SizedBox(height: 8.sp,), - Image.asset(getMineImage('bi_icon${currentIndex+2}'),width: 48.sp,), - SizedBox(height: 8.sp,), - Text( - '$i小票', - style: TextStyle( - color: Color(0xFFB7BECC), - fontSize: 12.sp), - ), - ], - ), - ), - ); - } -} diff --git a/circle_app/lib/app/circle_list/widgets/right_circle_iten.dart b/circle_app/lib/app/circle_list/widgets/right_circle_iten.dart deleted file mode 100644 index 7ea30e9..0000000 --- a/circle_app/lib/app/circle_list/widgets/right_circle_iten.dart +++ /dev/null @@ -1,2495 +0,0 @@ -import 'package:circle_app/app/circle_list/widgets/hug_tip.dart'; -import 'package:circle_app/common/colors/app_color.dart'; -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; -import 'dart:async'; - -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:circle_app/app/circle/logic.dart'; -import 'package:circle_app/app/circle/state.dart'; -import 'package:circle_app/app/circle/widgets/list_logic.dart'; -import 'package:circle_app/app/circle/widgets/video_item.dart'; -import 'package:circle_app/app/circle/logic.dart'; -import 'package:circle_app/app/select_circle/logic.dart'; -import 'package:circle_app/common/Widgets/base_tip_widget.dart'; -import 'package:circle_app/common/Widgets/circle_share.dart'; -import 'package:circle_app/common/Widgets/text_more.dart'; -import 'package:circle_app/main.dart'; -import 'package:circle_app/network/dio_manager.dart'; -import 'package:circle_app/router/app_routers.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:get/get_core/src/get_main.dart'; -import 'package:gradient_borders/box_borders/gradient_box_border.dart'; -import 'package:pull_to_refresh/pull_to_refresh.dart'; -import 'package:shared_preferences/shared_preferences.dart'; -import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; - -import '../../../common/Widgets/tag_widget.dart'; -import '../../../network/api.dart'; -import '../../../util/SharedPreferencesHelper.dart'; -import '../../../util/eventBus.dart'; -import '../../circle_list/logic.dart'; -import '../../userinfo/view.dart'; - -class RightCircleIten extends StatefulWidget { - var logic; - Circle bean; - int index; - - // Function updateBeanCall; - - RightCircleIten(this.index, this.bean, this.logic, {super.key}); - @override - _RightCircleItenState createState() => new _RightCircleItenState(); -} - -class _RightCircleItenState extends State - with AutomaticKeepAliveClientMixin, SingleTickerProviderStateMixin { - @override - bool get wantKeepAlive => true; - final ScrollController scrollController = ScrollController(); - final RefreshController refreshController = RefreshController(); - late TabController _tabController; - ListLogic? listsLg; - - int callOutPage = 1; - int currentIndex = 0; - int count = 0; - bool isLoad = true; - bool callOutMore = true; - var circleId = ''; - List lists = []; - - bool isSetState = false; - - var sub; - - Map interestAgentMap = {}; - - // TODO: add state variables and methods - - @override - void dispose() { - // TODO: implement dispose - super.dispose(); - sub.cancel(); - } - - @override - void initState() { - super.initState(); - sub = EventBusManager.on().listen((event) { - // if (isSetState) { - isSetState = false; - setState(() {}); - // } - }); - - circleId = widget.bean.id.toString(); - - _tabController = TabController(length: 2, vsync: this, initialIndex: 0); - _tabController.addListener(_handleTabChange); - - scrollController.addListener(() { - if (scrollController.position.pixels == - scrollController.position.maxScrollExtent) { - print('2222'); - isSetState = true; - EventBusManager.fire(RightScrollViewIsEnd(true)); - setState(() {}); - } else { - EventBusManager.fire(RightScrollViewIsEnd(false)); - if (isSetState) { - isSetState = false; - setState(() {}); - } - } - }); - loadInterestAgent(); - } - - - loadInterestAgent() async { - var data = await DioManager.instance.get( - url: "${Api.interestAgent}$circleId", - ); - if (data["code"] == 200) { - if (data['data'] != null) { - interestAgentMap = data['data']; - } - - if (mounted) { - setState(() {}); - } - } - } - - loadCircleInfo() async { - var data = await DioManager.instance.get( - url: "/up-service/interest/$circleId", - ); - if (data["code"] == 200) { - widget.bean = Circle.fromJson(data['data']); - if (mounted) { - setState(() {}); - } - } - } - - refreshCircleData() async { - var data = await DioManager.instance - .get(url: 'up-service/interest/${widget.bean.id}'); - if (data['code'] == 200) { - widget.bean = Circle.fromJson(data['data']); - } else if (data['code'] == 404) { - var logic = Get.put(CircleLogic()); - showOKToast('网络不流畅哦,请检查网络情况'); - logic.circle.lists.removeAt(logic.state.index); - logic.update(); - } - } - - void _handleTabChange() { - if (scrollController.position.pixels == - scrollController.position.maxScrollExtent) { - print('2222'); - isSetState = true; - EventBusManager.fire(RightScrollViewIsEnd(true)); - setState(() {}); - } - } - - circleWidget(String url, String userId, {double width = 24}) { - return GestureDetector( - onTap: () async { - if (widget.bean.is_limit && widget.bean.amount > 0) { - await refreshCircleData(); - } - if (widget.bean.is_limit && widget.bean.amount > 0) { - showJoinCiclePiker( - widget.bean.id.toString(), - widget.bean.amount.toString(), - widget.bean.oldAmount.toString(), - 1, (payResult) { - widget.bean.is_limit = false; - if (Get.isRegistered()) { - var logic = Get.find(); - for (var element in logic.circle.lists) { - if (element.id == widget.bean.id) { - element.is_limit = false; - element.isJoin = true; - } - } - logic.update(); - } - Get.back(); - }, widget.bean.ios_item); - return; - } - Get.toNamed(AppRoutes.UserInfoActivity, arguments: userId); - }, - child: Stack( - alignment: Alignment.center, - children: [ - Image.asset( - getCircleImage('avatar_bg'), - width: width.sp, - ), - ClipOval( - child: CachedNetworkImage( - imageUrl: url ?? - "https://qiniuyun.leyuan666.com/quanzi/avatar/default.png", - width: (width - 1).sp, - height: (width - 1).sp, - fit: BoxFit.cover, - ), - ) - ], - )); - } - - circleTiitleWidget(List urlList, List widgets) { - return Column( - children: [ - Container( - padding: EdgeInsets.only(left: 12.sp, right: 12.sp), - // height:urlList.length==0?47.sp: 118.sp, - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.fill, - image: AssetImage(getCircleImage('circle_desc')))), - child: Container( - margin: EdgeInsets.only(top: 10.sp, bottom: 10.sp), - child: Column( - children: [ - Container( - margin: EdgeInsets.only(bottom: 7.sp), - width: Get.width, - // height: 50.sp, - child: HideText( - text: widget.bean.intro, - maxWidth: Get.currentRoute == AppRoutes.Home - ? Get.width - 90.sp - : Get.width - 60.sp, - additionText: '查看更多', - maxLines: 3, - style: TextStyle(color: Colors.white, fontSize: 17.sp), - additionStyle: TextStyle( - color: const Color(0xFFFF4DF6), fontSize: 17.sp), - onTap: () { - showTextContentDialog( - context, widget.bean.intro, widget.bean.title); - }, - )), - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () {}, - child: urlList.length == 0 - ? Container() - : Container( - height: 30.sp, - child: Row( - children: [ - SizedBox( - height: 30.sp, - width: - 30.0.sp + 15.sp * (widgets.length - 1.sp), - child: Stack( - alignment: Alignment.center, - children: widgets, - ), - ), - SizedBox( - width: 4.sp, - ), - Text( - '${convertToTenThousand(widget.bean.joinTotal)}圈友加入', - style: TextStyle( - color: Colors.white, fontSize: 12.sp), - ), - SizedBox( - width: 8.sp, - ), - // GestureDetector( - // onTap: () { - // Get.bottomSheet( - // CircleShare('','',widget.bean), isScrollControlled: true, - // enableDrag: false - // ); - // }, - // child: Container( - // height: 30.sp, - // alignment: Alignment.center, - // child: Image.asset( - // getCircleImage('play'), - // width: 20.sp, - // ), - // ), - // ) - ], - ), - ), - ), - ], - ), - ), - ), - if (interestAgentMap.isNotEmpty) - Container( - margin: EdgeInsets.only(top: 5.sp), - decoration: BoxDecoration( - color: AppColor.bgColor, - borderRadius: BorderRadius.circular(8.sp)), - height: 40.sp, - padding: EdgeInsets.only(left: 8.sp, right: 8.sp), - child: Row( - children: [ - Text( - '今日圈子代理人:', - style: TextStyle(color: Colors.white, fontSize: 13.sp), - ), - GestureDetector( - onTap: () { - if (interestAgentMap.isNotEmpty) { - Get.toNamed(AppRoutes.UserInfoActivity,arguments: interestAgentMap['user']['id'].toString()); - } - - }, - child: Text( - interestAgentMap.isNotEmpty ? interestAgentMap['user']['nickname'] : '', - style: TextStyle(color: AppColor.mainColor, fontSize: 13.sp), - ), - ), - SizedBox( - width: 4.sp, - ), - Image.asset( - getMineImage('bi_icon1'), - width: 20.sp, - ), - Text( - '${convertToTenThousand(interestAgentMap.isNotEmpty ? interestAgentMap['rewardCoin'] : 0)}', - style: TextStyle(color: Colors.white, fontSize: 13.sp), - ), - Expanded(child: Container()), - Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - GestureDetector( - onTap: () { - showSendMoneyDialog(interestAgentMap['id'].toString()); - // Get.toNamed(AppRoutes.Invite); - }, - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17.0), - gradient: const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - ), - color: const Color(0xFF392D53), - ), - child: Container( - margin: EdgeInsets.all(0.6.sp), - padding: EdgeInsets.only( - left: 6.sp, right: 6.sp, top: 4.sp, bottom: 4.sp), - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17.0), - color: const Color(0xFF392D53), - ), - child: Row( - children: [ - Image.asset( - getMsgImage('gift'), - width: 14.sp, - ), - SizedBox( - width: 2.sp, - ), - Text( - "打赏", - style: TextStyle( - fontSize: 12.sp, - color: Colors.white, - ), - ), - ], - ), - ), - ), - ), - ], - ) - ], - ), - ), - - ], - ); - } - - void showTextContentDialog(BuildContext context, String msg, String title) { - showDialog( - context: context, - builder: (BuildContext context) { - return Dialog( - backgroundColor: Colors.transparent, - child: Container( - height: 300.sp, - padding: const EdgeInsets.all(1.0), - child: Stack( - children: [ - Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: const LinearGradient( - colors: [Color(0xFFDD3DF4), Color(0xFF30FFD9)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Container( - margin: EdgeInsets.all(1.sp), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: const LinearGradient( - colors: [Color(0xFF4C3E5F), Color(0xFF324140)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Positioned( - top: 15, - left: 0, - right: 0, - child: Center( - child: Text(title, - style: TextStyle( - color: const Color(0xFFF7FAFA), fontSize: 16.sp)), - )), - Container( - margin: EdgeInsets.only(top: 24.sp, bottom: 24.sp), - child: Container( - margin: - EdgeInsets.only(top: 12.sp, left: 14.sp, right: 14.sp), - alignment: Alignment.center, - child: SingleChildScrollView( - child: Text( - msg, - textAlign: TextAlign.left, - style: TextStyle( - color: const Color(0xCCF7FAFA), fontSize: 16.sp), - ), - ), - ), - ), - Positioned( - top: 8.sp, - right: 10.sp, - child: GestureDetector( - onTap: () { - Get.back(); - }, - child: Icon( - Icons.close, - color: Colors.white, - size: 20.sp, - ), - )), - ], - ), - ), - ); - }, - ); - } - - double contentHeight(String content) { - return calculateTextHeight( - content, 17.sp, FontWeight.w300, Get.currentRoute == AppRoutes.Home ? Get.width - 90.sp : Get.width - 64.sp, 3); - } - - - @override - Widget build(BuildContext context) { - if (widget.bean.image.isEmpty) { - loadCircleInfo(); - } - List urlList = widget.bean.lastJoinUsers; - List widgets = []; - int i = 0; - // print(urlList); - if (null != urlList) { - urlList.forEach((element) { - if (widgets.length > 2) { - return; - } - widgets.add(Positioned( - left: 15.sp * i, - child: circleWidget( - element.avatar! ?? - "https://qiniuyun.leyuan666.com/quanzi/avatar/default.png", - element.id.toString()), - )); - i++; - }); - } - - - double textHeight = contentHeight(widget.bean.intro); - - - return ClipRRect( - borderRadius: BorderRadius.circular(10.sp), - child: Container( - width: Get.width, - child: Stack( - children: [ - ClipRRect( - borderRadius: BorderRadius.circular(10.sp), - child: SizedBox( - width: Get.width, - height: Get.height, - child: Image.asset( - getCircleImage('circle_bg'), - fit: BoxFit.cover, - ), - )), - Container( - height: Get.height, - width: Get.width, - margin: EdgeInsets.only(top: 72.sp), - child: NotificationListener( - onNotification: (notification) { - if (notification is OverscrollNotification && notification.overscroll < -15) { - // 下拉刷新时禁用NestedScrollView的滚动 - if (!refreshController.isLoading && scrollController.offset == 0) { - count++; - print(notification); - if (count > 0 && count == 2 ) { - - refreshController.requestRefresh(); - - } - return true; - } - } - return true; - }, - child: SmartRefresher( - controller: refreshController, - onRefresh: () { - EventBusManager.fire(RightRefreshContrller(_tabController.index)); - Future.delayed(Duration(milliseconds: 200), () { - refreshController.refreshCompleted(); - count = 0; - }); - // refreshController.refreshToIdle(); - }, - enablePullDown:true, - enablePullUp: false, - - child: NestedScrollView( - // physics: ClampingScrollPhysics(), - controller: scrollController, - headerSliverBuilder: (context, isScrolled) { - print('isScrolled' + isScrolled.toString()); - return [ - SliverAppBar( - stretch: false, - elevation: 0, - primary: true, - pinned: false, - floating: true, - forceElevated: true, - toolbarHeight: 0, - foregroundColor: Colors.transparent, - backgroundColor: Colors.transparent, - expandedHeight: 58.sp + textHeight + (interestAgentMap.isNotEmpty ? 45.sp : 0), - flexibleSpace: FlexibleSpaceBar( - expandedTitleScale: 1.0, - centerTitle: true, - titlePadding: EdgeInsets.zero, - title: circleTiitleWidget( - urlList, - widgets, - ), - ), - ) - ]; - }, - body: Column( - children: [ - Container( - height: 35.sp, - // color: Colors.red, - padding: EdgeInsets.only(right: 5.sp), - child: Row( - children: [ - TabBar( - isScrollable: true, - controller: _tabController, - labelPadding: EdgeInsets.symmetric(horizontal: 5.0.sp), - indicator: UnderlineTabIndicator( - borderSide: BorderSide( - color: const Color(0xFF00FFF4), - ), - ), - indicatorColor: const Color(0xFF00FFF4), - indicatorWeight: 2.sp, - labelColor: const Color(0xFF00FFF4), - unselectedLabelColor: const Color(0xB3FFFFFF), - indicatorSize: TabBarIndicatorSize.label, - indicatorPadding: - EdgeInsets.only(left: 12.sp, right: 12.sp, bottom: 8.sp), - tabs: [ - Tab( - child: Text( - '推荐', - style: TextStyle( - fontSize: 18.sp, - ), - ), - ), - Tab( - child: Text( - '最新', - style: TextStyle( - fontSize: 18.sp, - ), - ), - ), - ], - labelStyle: TextStyle( - color: const Color(0xFF00FFF4), - fontSize: 18.sp, - shadows: [ - Shadow( - color: const Color(0xFFF657FF).withOpacity(0.5), - offset: Offset(0, -2), // 阴影偏移 - blurRadius: 3, // 阴影模糊半径 - // spreadRadius: 0 - ), - ], - ), - unselectedLabelStyle: TextStyle( - // color: const Color(0xB3FFFFFF), - fontSize: 18.sp, - shadows: [ - Shadow( - // color: const Color(0xFFF657FF), - offset: const Offset(0, -1), - blurRadius: 3.0.sp, - ), - ], - ), - onTap: (index) { - }, - ), - Expanded(child: Container()), - GestureDetector( - onTap: () { - sendApplyToAgentData(); - // Get.toNamed(AppRoutes.Invite); - }, - child: Container( - height: 24.sp, - - margin: EdgeInsets.all(0.6.sp), - padding: EdgeInsets.only( - left: 6.sp, right: 6.sp,), - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17.0), - color: const Color(0xFF392D53), - border: GradientBoxBorder( - gradient: - AppColor.mainVerLinearGradient, - width: 1.sp, - ), - ), - child: Row( - children: [ - Text( - "🙋申请代理", - style: TextStyle( - fontSize: 12.sp, - color: Colors.white, - ), - ), - ], - ), - ), - ), - ], - ), - ), - Expanded( - child: TabBarView( - controller: _tabController, - children: [ - RightCircleListWidget(widget.index, widget.bean, widget.logic,0,scrollController,interestAgentMap), - RightCircleListWidget(widget.index, widget.bean, widget.logic,1,scrollController,interestAgentMap), - ], - ), - ), - ], - ) - ), - ), - ), - ), - ClipRRect( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(10.sp), - topRight: Radius.circular(10.sp)), - child: Container( - padding: EdgeInsets.only(left: 12.sp, right: 12.sp), - height: 72.sp, - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.fill, - image: - AssetImage(getCircleImage('top_circle_bg')))), - child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - onTap: () { - if (widget.bean.isJoin) { - _showOutCircleDialog( - Get.context!, widget.logic, widget.bean); - } - }, - child: Container( - width: 42.sp, - height: 42.sp, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8.0), - gradient: const LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [ - Color(0xFF71F3F2), - Color(0xFFF558FF), - ], - stops: [0.0365, 0.9427], - ), - ), - padding: EdgeInsets.all(1.sp), - child: widget.bean.image.isNotEmpty - ? ClipRRect( - borderRadius: BorderRadius.circular(8.0), - child: CachedNetworkImage( - imageUrl: widget.bean.image, - width: 40.sp, - height: 40.sp, - fit: BoxFit.cover), - ) - : Container(), - ), - ), - Expanded( - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - scrollController.animateTo( - 0.0, // Scroll to the top - duration: Duration(milliseconds: 300), - curve: Curves.easeInOut, - ); - }, - child: Container( - padding: EdgeInsets.only(left: 8.sp, top: 12.sp), - // alignment: Alignment., - height: 72.sp, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - widget.bean.title, - style: TextStyle( - color: Colors.white, - fontSize: 18.sp, - fontWeight: FontWeight.w600), - ), - SizedBox( - height: 4.sp, - ), - Text( - '${convertToTenThousand(widget.bean.viewTotal)}人看过', - textAlign: TextAlign.left, - style: TextStyle( - color: const Color(0xff03FEFB), - fontSize: 12.sp, - ), - ), - ], - ), - ), - )), - GestureDetector( - //加入圈子 - onTap: () async { - if (widget.bean.isJoin) { - Get.bottomSheet( - CircleShare('', '', widget.bean), - isScrollControlled: true, - enableDrag: false); - } else { - await widget.logic.outCircle( - widget.bean.id.toString(), - widget.bean.isJoin); - widget.logic.update(); - } - }, - child: Stack( - alignment: Alignment.center, - children: [ - Opacity( - opacity: 0.5, - child: Image.asset( - getCircleImage('add'), - width: 60.sp, - ), - ), - Text( - !widget.bean.isJoin ? '申请加入' : '分享有奖', - style: TextStyle( - color: Colors.white, fontSize: 12.sp), - ) - ], - )) - ], - ), - )), - Positioned( - top: 70.sp, - child: Image.asset( - getCircleImage('circle_line'), - width: Get.width, - )), - if (Get.currentRoute == AppRoutes.Home) - Positioned( - bottom: 36.sp, - right: 10.sp, - child: GestureDetector( - onTap: () async { - List numbers = []; - numbers.add(MyConfigData(widget.bean.id.toString(), - widget.bean.title, false)); - var data = await Get.toNamed(AppRoutes.Call_out, - arguments: {'numbers': numbers}); - }, - child: Image.asset( - getCircleImage('send_msg'), - width: 70.sp, - ))) - ], - ))); - } - - void _showOutCircleDialog(BuildContext context, var controller, Circle bean) { - showDialog( - context: context, - builder: (BuildContext context) { - return Dialog( - backgroundColor: Colors.transparent, - child: Container( - height: 160.sp, - padding: const EdgeInsets.all(1.0), - child: Stack( - children: [ - Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: const LinearGradient( - colors: [Color(0xFFDD3DF4), Color(0xFF30FFD9)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Container( - margin: EdgeInsets.all(1.sp), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: const LinearGradient( - colors: [Color(0xFF4C3E5F), Color(0xFF324140)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Container( - margin: EdgeInsets.only(top: 24.sp), - child: Column( - children: [ - Center( - child: Text( - "提示", - style: - TextStyle(color: Colors.white, fontSize: 16.sp), - ), - ), - Container( - margin: EdgeInsets.only( - top: 12.sp, left: 14.sp, right: 14.sp), - alignment: Alignment.center, - child: Text( - "是否确认退出该圈子。", - textAlign: TextAlign.center, - style: TextStyle( - color: const Color(0xCCF7FAFA), fontSize: 16.sp), - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - onTap: () { - Navigator.pop(context); - }, - child: Container( - margin: EdgeInsets.only(top: 30.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color(0x26FFFFFF), - Color(0x26FFFFFF), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 10.sp, - bottom: 10.sp, - left: 52.sp, - right: 52.sp), - child: Text( - "否", - style: TextStyle( - color: Colors.white, - fontSize: 12.sp, - ), - ), - ), - ), - SizedBox(width: 24.sp), - GestureDetector( - onTap: () async { - Navigator.pop(context); - await widget.logic - .outCircle(bean.id.toString(), bean.isJoin); - // widget.logic.update(); - }, - child: Container( - margin: EdgeInsets.only(top: 24.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 10.sp, - bottom: 10.sp, - left: 52.sp, - right: 52.sp), - child: Text( - "是", - style: TextStyle( - color: Colors.white, - fontSize: 12.sp, - ), - ), - ), - ) - ], - ) - ], - ), - ) - ], - ), - ), - ); - }, - ); - } - - void sendApplyToAgentData() async { - var data = await DioManager.instance - .post(url: Api.applyToAgent + '$circleId'); - if (data['code'] == 200) { - - var con; - if(kDebugMode){ - con = V2TimConversation( - conversationID: "c2c_qpqz_dev_10_102", userID: "qpqz_dev_10_102", showName: "测试乐园客服", type: 1); - }else{ - con = V2TimConversation( - conversationID: "c2c_qpqz_prod_10_102", userID: "qpqz_prod_10_102", showName: "乐园客服", type: 1); - } - Get.toNamed(AppRoutes.Chat, arguments: con); - } else if (data['code'] == 32104) { - showReportDialog(Get.context!,data['msg']); - } - } - - void showReportDialog(BuildContext context,String msg) { - showDialog( - context: context, - builder: (BuildContext context) { - return Dialog( - backgroundColor: Colors.transparent, - child: Container( - height: 200.sp, - padding: const EdgeInsets.all(1.0), - child: Stack( - children: [ - Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - color: AppColor.bgColor, - borderRadius: BorderRadius.circular(12.0.sp), - // gradient: const LinearGradient( - // colors: [Color(0xFFDD3DF4), Color(0xFF30FFD9)], - // begin: Alignment.topCenter, - // end: Alignment.bottomCenter, - // ), - ), - ), - // Container( - // margin: EdgeInsets.all(1.sp), - // child: Image.asset(getMineImage("im_neglect"),fit: BoxFit.fill,), - // ), - Container( - margin: EdgeInsets.only(top: 12.sp), - child: Column( - children: [ - Center( - child: Text( - "申请代理提示", - style: - TextStyle(color: Colors.white, fontSize: 16.sp), - ), - ), - Container( - margin: EdgeInsets.only( - top: 12.sp, left: 14.sp, right: 14.sp), - alignment: Alignment.center, - child: Text( - msg, - textAlign: TextAlign.left, - style: TextStyle( - color: const Color(0xCCF7FAFA), fontSize: 16.sp), - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - - GestureDetector( - onTap: () { - Get.back(); - Get.toNamed(AppRoutes.Invite); - }, - child: Container( - margin: EdgeInsets.only(top: 16.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color(0x26FFFFFF), - Color(0x26FFFFFF), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 10.sp, - bottom: 10.sp, - left: 52.sp, - right: 52.sp), - child: const Text( - "前往邀请", - style: TextStyle( - color: Colors.white, - fontSize: 12, - ), - ), - ), - ) - ], - ) - ], - ), - ) - ], - ), - ), - ); - }, - ); - } - - void showSendMoneyDialog(String userId) { - if (interestAgentMap.isNotEmpty) { - Get.bottomSheet(HugTip(userId, interestAgentMap['rewardConfigs'], () { - loadInterestAgent(); - }),isScrollControlled: true); - } - } -} - -class RightCircleListWidget extends StatefulWidget { - var logic; - Circle bean; - int index; - int type; - ScrollController scrollController; - Map interestAgentMap; - // Function updateBeanCall; - - RightCircleListWidget(this.index, this.bean, this.logic,this.type,this.scrollController,this.interestAgentMap, {super.key}); - - @override - State createState() => _RightCircleListWidgetState(); -} - -class _RightCircleListWidgetState extends State - with AutomaticKeepAliveClientMixin { - @override - bool get wantKeepAlive => true; - final ScrollController scrollController = ScrollController(); - - final ScrollController GridScrollController = ScrollController(); - final RefreshController refreshController = RefreshController(); - ListLogic? listsLg; - - int callOutPage = 1; - - bool isLoad = true; - bool callOutMore = true; - var circleId = ''; - List lists = []; - Map interestAgentMap = {}; - - bool isEnd = false; - var sub; - var sub1; - - @override - void dispose() { - // TODO: implement dispose - - sub.cancel(); - sub1.camcel(); - callRefreshCicle?.cancel(); - scrollController.dispose(); - super.dispose(); - } - - StreamSubscription? callRefreshCicle = null; - StreamSubscription? cicleInfoRefresh = null; - StreamSubscription? scroToTop = null; - - @override - void initState() { - // TODO: implement initState - super.initState(); - // if (widget.scrollController.offset == widget.scrollController.position.maxScrollExtent) { - // isEnd = true; - // } - sub = EventBusManager.on().listen((event) { - if (event.isEnd) { - isEnd = true; - setState(() {}); - } else { - isEnd = false; - scrollController.jumpTo(0); - setState(() {}); - } - }); - sub1 = EventBusManager.on().listen((event) { - if (event.index == widget.type) { - callOutPage = 1; - loadCallOutListData(); - } - }); - - - scrollController.addListener(() { - if (scrollController.offset <= 0) { - EventBusManager.fire(RightScrollViewScrollTop()); - EventBusManager.fire(RightScrollViewIsEnd(false)); - - isEnd = false; - setState(() {}); - } - }); - GridScrollController.addListener(() { - GridScrollController.jumpTo(0.0); - }); - interestAgentMap = widget.interestAgentMap; - circleId = widget.bean.id.toString(); - // if (Get.currentRoute == AppRoutes.Home || Get.currentRoute == AppRoutes.MyCircle) { - loadCallOutListData(); - // } - - callRefreshCicle = EventBusManager.on().listen((event) { - if (widget.bean.id.toString() == event.circleId && widget.type == 1) { - callOutPage = 1; - loadCallOutListData(); - } - }); - - } - - - loadCircleInfo() async { - var data = await DioManager.instance.get( - url: "/up-service/interest/$circleId", - ); - if (data["code"] == 200) { - - widget.bean = Circle.fromJson(data['data']); - if (mounted) { - setState(() {}); - } - } - } - - loadCallOutListData() async { - var data = await DioManager.instance.get( - url: widget.type ==0 ? '/up-service/interest/$circleId/pushCallouts' : "/up-service/interest/$circleId/newCallouts", - params: {"page": callOutPage, "page_size": "20"}); - if (data["code"] == 200) { - List dataList = data["data"]["lists"] ?? []; - if (callOutPage == 1) { - if (lists.isNotEmpty) { - lists.clear(); - refreshController.resetNoData(); - // refreshController.refreshCompleted(); - } - } - if (dataList.isNotEmpty) { - callOutMore = true; - for (var element in dataList) { - lists.add(Lists.fromJson(element)); - } - callOutPage++; - refreshController.loadComplete(); - } - callOutMore = dataList.length == 20; - if (!callOutMore) { - refreshController.loadNoData(); - } - if (mounted) { - setState(() {}); - } - } else { - showOKToast(data["msg"]); - } - } - - setCircleId(String id) { - circleId = id; - loadCallOutListData(); - } - - void refreshData() { - callOutPage = 1; - callOutMore = true; - loadCallOutListData(); - } - - void loadMore() { - if (callOutMore == false) return; - loadCallOutListData(); - } - - void pushOtherPeopleHomePage(String userId) { - Get.toNamed(AppRoutes.UserInfoActivity, arguments: userId); - - // if (bean.isQueen) { - // showJoinCiclePiker(cicleId); - // } else { - //跳转消息页面 - // Get.bottomSheet(Open_vip_tipPage(), - // isScrollControlled: true, - // enableDrag: false, - // ); - // } - } - - void pushHomePage(Lists bean, String cicleId) async { - SharedPreferencesHelper.getInstance().then((sharedPreferences) { - int userId = sharedPreferences.getInt(SharedPreferencesHelper.USERID); - if (bean.user!.id == userId) { - Get.toNamed(AppRoutes.UserInfoActivity); - } else { - Get.toNamed(AppRoutes.UserInfoActivity, - arguments: bean.user!.id!.toString()); - } - }); - - // if (bean.isQueen) { - // showJoinCiclePiker(cicleId); - // } else { - //跳转消息页面 - // Get.bottomSheet(Open_vip_tipPage(), - // isScrollControlled: true, - // enableDrag: false, - // ); - // } - } - - void pushMsgPage(Lists bean, String cicleId) async { - if (widget.bean.is_limit && widget.bean.amount > 0) { - await refreshCircleData(); - } - - if (widget.bean.is_limit && widget.bean.amount > 0) { - showJoinCiclePiker(cicleId, widget.bean.amount.toString(), - widget.bean.oldAmount.toString(), 2, (payResult) { - widget.bean.is_limit = false; - if (Get.isRegistered()) { - var logic = Get.find(); - for (var element in logic.circle.lists) { - if (element.id == widget.bean.id) { - element.is_limit = false; - element.isJoin = true; - } - } - logic.update(); - } - Get.back(); - }, widget.bean.ios_item); - return; - } - - var sp = await SharedPreferencesHelper.getInstance(); - String myUserId = sp.getMyUserId(); - if (bean.user!.id.toString() == myUserId) { - showOKToast('无法与自己私聊'); - return; - } - // if () - - var data = await DioManager.instance.get( - url: "/up-service/callout/${bean.id}/chat", - ); - if (data["code"] == 200) { - pushChatPage(data['data']['account_id'].toString().split("_").last, - data['data']['account_id'], bean.user!.nickname!); - - await Future.delayed(Duration(seconds: 1)); - - SharedPreferences sharedPreferences = - await SharedPreferences.getInstance(); - // SharedPreferencesHelper.getInstance().then((sharedPreferences) { - int userId = - sharedPreferences.getInt(SharedPreferencesHelper.USERID) ?? 0; - String avatar = - sharedPreferences.getString(SharedPreferencesHelper.AVATAR) ?? ""; - String name = - sharedPreferences.getString(SharedPreferencesHelper.NAME) ?? ""; - - bool isContain = false; - for (var info in bean.chat!.users!) { - if (info.id == userId) { - isContain = true; - } - } - if (!isContain) { - bean.chat!.users! - .add(Users(avatar: avatar, id: userId, nickname: name)); - bean.chat!.count = bean.chat!.count! + 1; - widget.logic.update(); - } - } - } - - @override - Widget build(BuildContext context) { - if (widget.bean.image.isEmpty) { - loadCircleInfo(); - } - List urlList = widget.bean.lastJoinUsers; - List widgets = []; - int i = 0; - // print(urlList); - if (null != urlList) { - urlList.forEach((element) { - if (widgets.length > 2) { - return; - } - widgets.add(Positioned( - left: 15.sp * i, - child: circleWidget( - element.avatar! ?? - "https://qiniuyun.leyuan666.com/quanzi/avatar/default.png", - element.id.toString()), - )); - i++; - }); - } - - return !callOutMore && lists.isEmpty ? noResultWidget() : SmartRefresher( - controller: refreshController, - // onRefresh: refreshData, - enablePullDown:false, - onLoading: loadMore, - enablePullUp: true, - - child:ListView.builder( - physics: isEnd - ? BouncingScrollPhysics() - : NeverScrollableScrollPhysics(), - addAutomaticKeepAlives: false, - addRepaintBoundaries: false, - scrollDirection: Axis.vertical, - controller: scrollController, - itemCount: lists.length, - itemBuilder: (context, index) { - - Lists list = lists[index]; - if (list.isQueen!) { - return vipDynamicItem(list); - } else { - return normalDynamicItem(list); - } - }), - ); - } - - ///至尊喊话 - vipDynamicItem(Lists lists) { - Widget descText = widget.logic.openCallOutIdList.contains(lists.id) - ? Text( - lists.content!, - style: TextStyle(color: Colors.white, fontSize: 14.sp), - ) - : HideText( - text: lists.content!, - maxWidth: Get.currentRoute == AppRoutes.Home - ? Get.width - 90.sp - : Get.width - 20.sp, - additionText: '查看更多', - maxLines: 5, - style: TextStyle(color: Colors.white, fontSize: 14.sp), - additionStyle: - TextStyle(color: const Color(0xFFFF4DF6), fontSize: 14.sp), - onTap: () { - widget.logic.openCallOutIdList.add(lists.id); - setState(() {}); - }, - ); - - // List urlList = bean.lastJoinUsers; - List widgets = []; - int index = 0; - for (var element in lists.chat!.users!) { - widgets.add(Positioned( - left: 12.sp * index, - child: circleWidget(element.avatar!, element.id.toString(), width: 24), - )); - index++; - } - if (widgets.isNotEmpty) { - widgets.add(Positioned( - left: 12.sp * lists.chat!.users!.length, - child: Image.asset( - getCircleImage('more'), - width: 24.sp, - ))); - } - - double picHeight = 0.0; - - if (lists.album != null) { - if (lists.album!.isNotEmpty) { - Album info = lists.album!.first; - - if (info.type == 1) { - double picWidth = (Get.width - - (widget.logic.runtimeType == LikeLogic - ? 100.sp - : 60.sp)) / - 3 + - 45; - if (lists.album!.length > 3) { - picHeight = picWidth * 2; - } else { - picHeight = picWidth; - } - } else { - picHeight = 200.sp; - } - } - } - - // double widgetHeight = 130.sp + contentHeight(lists.content!) + picHeight; - - return Container( - margin: EdgeInsets.only(bottom: 10.sp), - width: Get.width, - // height: widgetHeight, - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.fill, - image: AssetImage( - getCircleImage('pic_bg'), - ))), - child: Stack(children: [ - Positioned( - left: 0, - top: 2.sp, - height: 18.sp, - child: Image.asset(getCircleImage('vip_say')), - ), - Positioned( - right: 2.sp, - top: 2.sp, - child: Stack( - alignment: Alignment.center, - children: [ - Container( - // margin: EdgeInsets.only(top: 5.sp,right: 5.sp), - padding: EdgeInsets.only(left: 15.sp, right: 15.sp), - alignment: Alignment.center, - height: 28.sp, - decoration: BoxDecoration( - color: Color.fromRGBO(52, 41, 67, 1), - borderRadius: BorderRadius.only( - topLeft: Radius.circular(0), - bottomRight: Radius.circular(0), - topRight: Radius.circular(12.sp), - bottomLeft: Radius.circular(12.sp))), - child: Text( - (lists.user!.city ?? '外星').length > 4 - ? (lists.user!.city ?? '外星').substring(0, 4) + '...' - : (lists.user!.city ?? '外星'), - style: TextStyle(color: Colors.white, fontSize: 15.sp), - ), - ) - ], - ), - ), - Container( - // height: widgetHeight, - width: Get.width, - padding: EdgeInsets.only(top: 12.sp, left: 12.sp, right: 12.sp), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 72.sp, - child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - onTap: () async { - var sp = - await SharedPreferencesHelper.getInstance(); - String myUserId = sp.getMyUserId(); - - if (lists.user?.id!.toString() == myUserId) { - Get.toNamed(AppRoutes.UserInfoActivity); - return; - } - if (widget.bean.is_limit && - widget.bean.amount > 0) { - await refreshCircleData(); - } - if (widget.bean.is_limit && - widget.bean.amount > 0) { - showJoinCiclePiker( - widget.bean.id.toString(), - widget.bean.amount.toString(), - widget.bean.oldAmount.toString(), - 1, (payResult) { - widget.bean.is_limit = false; - if (Get.isRegistered()) { - var logic = Get.find(); - for (var element in logic.circle.lists) { - if (element.id == widget.bean.id) { - element.is_limit = false; - element.isJoin = true; - } - } - logic.update(); - } - Get.back(); - }, widget.bean.ios_item); - return; - } - pushHomePage(lists, lists.id.toString()); - }, - child: Stack( - alignment: Alignment.center, - children: [ - Image.asset( - getCircleImage('avatar_bg'), - width: 42.sp, - ), - ClipOval( - child: CachedNetworkImage( - imageUrl: lists.user!.avatar_thumb!, - width: 40.sp, - height: 40.sp, - fit: BoxFit.cover, - ), - ) - ], - )), - Expanded( - child: Container( - padding: EdgeInsets.only(left: 8.sp, top: 12.sp), - alignment: Alignment.centerLeft, - height: 72.sp, - child: Column( - children: [ - Row( - children: [ - Text( - lists.user!.nickname!, - style: TextStyle( - color: Colors.white, - fontSize: 18.sp, - fontWeight: FontWeight.w600), - ), - SizedBox( - width: 8.sp, - ), - UserTagWidget(lists.user!.mark!), - ], - ), - SizedBox( - height: 4.sp, - ), - Row( - children: [ - Container( - alignment: Alignment.center, - height: 18.sp, - padding: - EdgeInsets.only(left: 6.sp, right: 6.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(9.sp), - gradient: const LinearGradient( - begin: Alignment(0.25, 0.5), - end: Alignment(0.75, 0.5), - colors: [ - Color(0xff8DFFF8), - Color(0xffB5D3FF) - ])), - child: Text( - getAgeCOntent( - lists.user!.gender ?? 0, - lists.user!.age ?? 0, - lists.user!.role ?? 0, - lists.user!.orientation ?? 0), - // '${genderList[lists.user!.gender!]}.${lists.user!.age}.${roleList[lists.user!.role!]}.${orientationList[lists.user!.orientation!]}', - style: TextStyle( - color: Colors.black, - fontSize: 12.sp, - ), - ), - ) - ], - ), - ], - ), - )), - ], - ), - ), - Container( - alignment: Alignment.topLeft, - // margin: EdgeInsets.only(top: 4.sp), - child: descText, - ), - Listener( - child: Container( - height: picHeight, - margin: EdgeInsets.only(top: 5.sp), - child: picHeight == 200.sp - ? ClipRRect( - borderRadius: BorderRadius.circular(6.sp), - child: VideoItemWidget(lists.album![0].url!)) - : AbsorbPointer( - absorbing: !scrollController.position.maxScrollExtent.isFinite, // ListView无法滚动时,阻止GridView获取滑动事件 - child: GridView.builder( - controller: GridScrollController, - itemCount: lists.album!.length, - scrollDirection: Axis.vertical, - physics: const NeverScrollableScrollPhysics(), - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 3, //横轴三个子widget - crossAxisSpacing: 8.sp, - mainAxisSpacing: 8.sp, - childAspectRatio: 0.7 //宽高比为1时,子widget - ), - itemBuilder: (contentxt, currentIndex) { - Album album = lists.album![currentIndex]; - return GestureDetector( - onTap: () { - var imgList = []; - for (var element in lists.album!) { - imgList.add(element.url!); - } - Get.toNamed(AppRoutes.Swiper, arguments: { - 'imaglist': imgList, - 'index': currentIndex - }); - }, - child: ClipRRect( - borderRadius: BorderRadius.circular(6.sp), - child: CachedNetworkImage( - imageUrl: album.url!, - errorWidget: (context, url, error) => - const Icon(Icons.error), - fit: BoxFit.cover, - ), - ), - ); - }), - ), - ), - ), - Container( - height: 30.sp, - padding: EdgeInsets.only(left: 5.sp, right: 10.sp), - margin: EdgeInsets.only(top: picHeight > 0 ? 5.sp : 5.sp,bottom: 10.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(15.sp), - color: Color(0x33000000)), - child: Row( - children: [ - widgets.isNotEmpty - ? SizedBox( - width: 24 + 12.sp * widgets.length - 8.sp, - height: 24.sp, - child: Stack(children: widgets), - ) - : Container(), - SizedBox( - width: 4.sp, - ), - widgets.isNotEmpty - ? Expanded( - child: Text( - '${lists.chat!.count!}位圈友已私聊', - style: TextStyle( - color: Colors.white.withOpacity(0.75), - fontSize: 14.sp), - )) - : Expanded( - child: Text( - '赶紧成为第一位私聊ta的圈友吧', - style: TextStyle( - color: Colors.white.withOpacity(0.75), - fontSize: 14.sp), - )), - GestureDetector( - onTap: () { - pushMsgPage( - lists, - widget.bean.id.toString(), - ); - }, - child: Image.asset( - getCircleImage('chat'), - width: 60.sp, - ), - ) - ], - ), - ) - ], - ), - ) - ])); - } - - ///普通图文喊话 - normalDynamicItem(Lists lists) { - Widget descText = widget.logic.openCallOutIdList.contains(lists.id) - ? Text( - lists.content!, - style: TextStyle(color: Colors.white, fontSize: 14.sp), - ) - : HideText( - text: lists.content!, - maxWidth: Get.currentRoute == AppRoutes.Home - ? Get.width - 90.sp - : Get.width - 20.sp, - additionText: '查看更多', - maxLines: 5, - style: TextStyle(color: Colors.white, fontSize: 14.sp), - additionStyle: - TextStyle(color: const Color(0xFFFF4DF6), fontSize: 14.sp), - onTap: () { - widget.logic.openCallOutIdList.add(lists.id); - setState(() {}); - }, - ); - - double picHeight = 0.0; - double picWidth = - (Get.width - (widget.logic.runtimeType == LikeLogic ? 100.sp : 60.sp)) / - 3 + - 45; - if (lists.album != null) { - if (lists.album!.isNotEmpty) { - Album info = lists.album!.first; - - if (info.type == 1) { - if (lists.album!.length > 3) { - picHeight = picWidth * 2; - } else { - picHeight = picWidth; - } - } else { - picHeight = 200.sp; - } - } - } - - List widgets = []; - int index = 0; - lists.chat!.users!.forEach((element) { - widgets.add(Positioned( - left: 12.sp * index, - child: circleWidget(element.avatar!, element.id.toString(), width: 24), - )); - index++; - }); - if (widgets.isNotEmpty) { - widgets.add(Positioned( - left: 12.sp * lists.chat!.users!.length, - child: Image.asset( - getCircleImage('more'), - width: 24.sp, - ))); - } - return Container( - margin: EdgeInsets.only(bottom: 10.sp), - width: Get.width, - // height: 120.sp + contentHeight(lists.content!) + picHeight, - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.fill, - image: AssetImage( - getCircleImage('normal_bg'), - ))), - child: Stack( - children: [ - Positioned( - right: 2.sp, - top: 2.sp, - child: Stack( - alignment: Alignment.center, - children: [ - // Image.asset( - // getCircleImage('location'), - // height: 30.sp, - // ), - Container( - // margin: EdgeInsets.only(top: 5.sp,right: 5.sp), - padding: EdgeInsets.only(left: 15.sp, right: 15.sp), - alignment: Alignment.center, - height: 28.sp, - decoration: BoxDecoration( - color: Color.fromRGBO(52, 41, 67, 1), - borderRadius: BorderRadius.only( - topLeft: Radius.circular(0), - bottomRight: Radius.circular(0), - topRight: Radius.circular(12.sp), - bottomLeft: Radius.circular(12.sp))), - child: Text( - (lists.user!.city ?? '外星').length > 4 - ? (lists.user!.city ?? '外星').substring(0, 4) + '...' - : (lists.user!.city ?? '外星'), - style: TextStyle(color: Colors.white, fontSize: 15.sp), - ), - ) - ], - ), - // height: 18.sp, - ), - Container( - width: Get.width, - padding: EdgeInsets.only(left: 12.sp, right: 12.sp), - child: Column( - children: [ - SizedBox( - height: 72.sp, - child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - onTap: () async { - var sp = - await SharedPreferencesHelper.getInstance(); - String myUserId = sp.getMyUserId(); - if (lists.user?.id!.toString() == myUserId) { - Get.toNamed(AppRoutes.UserInfoActivity); - return; - } - if (widget.bean.is_limit && - widget.bean.amount > 0) { - await refreshCircleData(); - } - - if (widget.bean.is_limit && - widget.bean.amount > 0) { - showJoinCiclePiker( - widget.bean.id.toString(), - widget.bean.amount.toString(), - widget.bean.oldAmount.toString(), - 1, (payResult) { - widget.bean.is_limit = false; - if (Get.isRegistered()) { - var logic = Get.find(); - for (var element in logic.circle.lists) { - if (element.id == widget.bean.id) { - element.is_limit = false; - element.isJoin = true; - } - } - logic.update(); - } - Get.back(); - }, widget.bean.ios_item); - return; - } - pushHomePage(lists, lists.id.toString()); - }, - child: Stack( - alignment: Alignment.center, - children: [ - Image.asset( - getCircleImage('avatar_bg'), - width: 42.sp, - ), - ClipOval( - child: CachedNetworkImage( - imageUrl: lists.user!.avatar_thumb!, - width: 40.sp, - height: 40.sp, - fit: BoxFit.cover, - // - // , - ), - ) - ], - )), - Expanded( - child: Container( - padding: EdgeInsets.only(left: 8.sp, top: 12.sp), - alignment: Alignment.centerLeft, - height: 72.sp, - child: Column( - children: [ - Row( - children: [ - Text( - lists.user!.nickname!, - style: TextStyle( - color: Colors.white, - fontSize: 18.sp, - fontWeight: FontWeight.w600), - ), - SizedBox( - width: 8.sp, - ), - UserTagWidget(lists.user!.mark!), - ], - ), - SizedBox( - height: 4.sp, - ), - Row( - children: [ - Container( - alignment: Alignment.center, - height: 18.sp, - padding: EdgeInsets.only( - left: 6.sp, right: 6.sp), - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(9.sp), - gradient: const LinearGradient( - begin: Alignment(0.25, 0.5), - end: Alignment(0.75, 0.5), - colors: [ - Color(0xff8DFFF8), - Color(0xffB5D3FF) - ])), - child: Text( - getAgeCOntent( - lists.user!.gender ?? 0, - lists.user!.age ?? 0, - lists.user!.role ?? 0, - lists.user!.orientation ?? 0), - style: TextStyle( - color: Colors.black, - fontSize: 12.sp, - ), - ), - ) - ], - ), - ], - ), - )), - ], - ), - ), - Container( - alignment: Alignment.topLeft, - // margin: EdgeInsets.only(top: 4.sp), - child: descText, - ), - picHeight > 0 - ? Container( - height: picHeight, - alignment: Alignment.centerLeft, - margin: EdgeInsets.only(top: 5.sp), - child: picHeight == 200.sp - ? ClipRRect( - borderRadius: BorderRadius.circular(6.sp), - child: VideoItemWidget(lists.album![0].url!)) - : GridView.builder( - controller: GridScrollController, - itemCount: lists.album!.length, - physics: const NeverScrollableScrollPhysics(), - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 3, //横轴三个子widget - crossAxisSpacing: 8.sp, - mainAxisSpacing: 8.sp, - childAspectRatio: 0.7 //宽高比为1时,子widget - ), - itemBuilder: (contentxt, currentIndex) { - Album album = lists.album![currentIndex]; - return GestureDetector( - onTap: () { - var imgList = []; - for (var element in lists.album!) { - imgList.add(element.url!); - } - Get.toNamed(AppRoutes.Swiper, - arguments: { - 'imaglist': imgList, - 'index': currentIndex - }); - }, - child: ClipRRect( - borderRadius: - BorderRadius.circular(6.sp), - child: CachedNetworkImage( - imageUrl: album.url!, - errorWidget: (context, url, error) => - const Icon(Icons.error), - fit: BoxFit.cover, - ), - ), - ); - })) - : Container(), - Container( - height: 30.sp, - padding: EdgeInsets.only( - left: 5.sp, - right: 10.sp, - ), - margin: EdgeInsets.only( - top: picHeight > 0 ? 5.sp : 10.sp, bottom: 10.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(15.sp), - color: Color(0x33000000)), - child: Row( - children: [ - widgets.isNotEmpty - ? SizedBox( - width: 24 + 12.sp * widgets.length - 8.sp, - height: 24.sp, - child: Stack(children: widgets), - ) - : Container(), - SizedBox( - width: 4.sp, - ), - widgets.isNotEmpty - ? Expanded( - child: Text( - '${lists.chat!.count!}位圈友已私聊', - style: TextStyle( - color: Colors.white.withOpacity(0.75), - fontSize: 14.sp), - )) - : Expanded( - child: Text( - '赶紧成为第一位私聊ta的圈友吧', - style: TextStyle( - color: Colors.white.withOpacity(0.75), - fontSize: 14.sp), - )), - GestureDetector( - onTap: () async { - pushMsgPage(lists, widget.bean.id.toString()); - - // }); - }, - child: Image.asset( - getCircleImage('chat'), - width: 60.sp, - )) - ], - ), - ), - ], - ), - ), - // Positioned( - // bottom: 0, - // child: Container( - // width: Get.width - 26.sp, - // child: circleInfoItem(), - // )) - ], - )); - } - - circleInfoItem() { - return ClipRRect( - borderRadius: BorderRadius.circular(10.sp), - child: Container( - padding: EdgeInsets.only(left: 12.sp, right: 12.sp), - height: 72.sp, - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.fill, - image: AssetImage(getCircleImage('top_circle_bg')))), - child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - width: 42.sp, - height: 42.sp, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8.0), - gradient: const LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [ - Color(0xFF71F3F2), - Color(0xFFF558FF), - ], - stops: [0.0365, 0.9427], - ), - ), - padding: EdgeInsets.all(1.sp), - child: ClipRRect( - borderRadius: BorderRadius.circular(8.0), - child: CachedNetworkImage( - imageUrl: widget.bean.image, - width: 40.sp, - height: 40.sp, - fit: BoxFit.cover), - ), - ), - Expanded( - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - scrollController.animateTo( - 0.0, // Scroll to the top - duration: Duration(milliseconds: 300), - curve: Curves.easeInOut, - ); - }, - child: Container( - padding: EdgeInsets.only(left: 8.sp, top: 12.sp), - // alignment: Alignment., - height: 72.sp, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - widget.bean.title, - style: TextStyle( - color: Colors.white, - fontSize: 18.sp, - fontWeight: FontWeight.w600), - ), - SizedBox( - height: 4.sp, - ), - Text( - '${convertToTenThousand(widget.bean.viewTotal)}人看过', - textAlign: TextAlign.left, - style: TextStyle( - color: const Color(0xff03FEFB), - fontSize: 12.sp, - ), - ), - ], - ), - ), - )), - GestureDetector( - //加入圈子 - onTap: () async { - if (widget.bean.isJoin) { - Get.bottomSheet(CircleShare('', '', widget.bean), - isScrollControlled: true, enableDrag: false); - } else { - await widget.logic.outCircle( - widget.bean.id.toString(), widget.bean.isJoin); - widget.logic.update(); - } - }, - child: Stack( - alignment: Alignment.center, - children: [ - Opacity( - opacity: 0.5, - child: Image.asset( - getCircleImage('add'), - width: 60.sp, - ), - ), - Text( - !widget.bean.isJoin ? '申请加入' : '分享有奖', - style: TextStyle(color: Colors.white, fontSize: 12.sp), - ) - ], - )) - ], - ), - )); - } - - circleWidget(String url, String userId, {double width = 24}) { - return GestureDetector( - onTap: () async { - if (widget.bean.is_limit && widget.bean.amount > 0) { - await refreshCircleData(); - } - if (widget.bean.is_limit && widget.bean.amount > 0) { - showJoinCiclePiker( - widget.bean.id.toString(), - widget.bean.amount.toString(), - widget.bean.oldAmount.toString(), - 1, (payResult) { - widget.bean.is_limit = false; - if (Get.isRegistered()) { - var logic = Get.find(); - for (var element in logic.circle.lists) { - if (element.id == widget.bean.id) { - element.is_limit = false; - element.isJoin = true; - } - } - logic.update(); - } - Get.back(); - }, widget.bean.ios_item); - return; - } - Get.toNamed(AppRoutes.UserInfoActivity, arguments: userId); - }, - child: Stack( - alignment: Alignment.center, - children: [ - Image.asset( - getCircleImage('avatar_bg'), - width: width.sp, - ), - ClipOval( - child: CachedNetworkImage( - imageUrl: url ?? - "https://qiniuyun.leyuan666.com/quanzi/avatar/default.png", - width: (width - 1).sp, - height: (width - 1).sp, - fit: BoxFit.cover, - ), - ) - ], - )); - } - - void _showOutCircleDialog(BuildContext context, var controller, Circle bean) { - showDialog( - context: context, - builder: (BuildContext context) { - return Dialog( - backgroundColor: Colors.transparent, - child: Container( - height: 160.sp, - padding: const EdgeInsets.all(1.0), - child: Stack( - children: [ - Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: const LinearGradient( - colors: [Color(0xFFDD3DF4), Color(0xFF30FFD9)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Container( - margin: EdgeInsets.all(1.sp), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: const LinearGradient( - colors: [Color(0xFF4C3E5F), Color(0xFF324140)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Container( - margin: EdgeInsets.only(top: 24.sp), - child: Column( - children: [ - Center( - child: Text( - "提示", - style: - TextStyle(color: Colors.white, fontSize: 16.sp), - ), - ), - Container( - margin: EdgeInsets.only( - top: 12.sp, left: 14.sp, right: 14.sp), - alignment: Alignment.center, - child: Text( - "是否确认退出该圈子。", - textAlign: TextAlign.center, - style: TextStyle( - color: const Color(0xCCF7FAFA), fontSize: 16.sp), - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - onTap: () { - Navigator.pop(context); - }, - child: Container( - margin: EdgeInsets.only(top: 30.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color(0x26FFFFFF), - Color(0x26FFFFFF), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 10.sp, - bottom: 10.sp, - left: 52.sp, - right: 52.sp), - child: Text( - "否", - style: TextStyle( - color: Colors.white, - fontSize: 12.sp, - ), - ), - ), - ), - SizedBox(width: 24.sp), - GestureDetector( - onTap: () async { - Navigator.pop(context); - await widget.logic - .outCircle(bean.id.toString(), bean.isJoin); - // widget.logic.update(); - }, - child: Container( - margin: EdgeInsets.only(top: 24.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 10.sp, - bottom: 10.sp, - left: 52.sp, - right: 52.sp), - child: Text( - "是", - style: TextStyle( - color: Colors.white, - fontSize: 12.sp, - ), - ), - ), - ) - ], - ) - ], - ), - ) - ], - ), - ), - ); - }, - ); - } - - double contentHeight(String content) { - return calculateTextHeight( - content, - 17.sp, - FontWeight.w300, - Get.currentRoute == AppRoutes.Home - ? Get.width - 90.sp - : Get.width - 64.sp, - 100); - } - - refreshCircleData() async { - // var routePath = Get.currentRoute; - // if (routePath == AppRoutes.Signal_circle_list) return; - - var data = await DioManager.instance - .get(url: 'up-service/interest/${widget.bean.id}'); - if (data['code'] == 200) { - widget.bean = Circle.fromJson(data['data']); - // widget.logic.updateCircleInfo(widget.bean); - // setState(() { - // - // }); - // final logic = Get.put(CircleLogic()); - // logic.update(); - } else if (data['code'] == 404) { - var logic = Get.put(CircleLogic()); - showOKToast('网络不流畅哦,请检查网络情况'); - logic.circle.lists.removeAt(logic.state.index); - logic.update(); - } - } -} - -class RightScrollViewIsEnd { - bool isEnd; - RightScrollViewIsEnd(this.isEnd); -} - - -class RightScrollViewScrollTop {} - -class RightRefreshContrller { -int index; -RightRefreshContrller(this.index); -} \ No newline at end of file diff --git a/circle_app/lib/app/dialog/BaseDialog.dart b/circle_app/lib/app/dialog/BaseDialog.dart deleted file mode 100644 index 539c0bd..0000000 --- a/circle_app/lib/app/dialog/BaseDialog.dart +++ /dev/null @@ -1,170 +0,0 @@ - - -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -// import 'package:flutter_install_app/flutter_install_app.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:get/get_core/src/get_main.dart'; - -class BaseDialog extends StatefulWidget { - final bool isDismiss; - - BaseDialog({required this.isDismiss}); - - @override - BaseDialogState createState() => BaseDialogState(); -} - -double myProgress = 0; - -class BaseDialogState extends State { - bool isDownload = false; - - void incrementCounter() {} - - void setDownloadUi() { - setState(() { - isDownload = true; - }); - } - - @override - Widget build(BuildContext context) { - return WillPopScope( - onWillPop: () async { - return widget.isDismiss; - }, - child: Dialog( - backgroundColor: Colors.transparent, - child: Container( - height: 200.sp, - padding: const EdgeInsets.all(1.0), - child: Stack( - children: [ - Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: const LinearGradient( - colors: [Color(0xFFDD3DF4), Color(0xFF30FFD9)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Container( - margin: EdgeInsets.all(1.sp), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: const LinearGradient( - colors: [Color(0xFF4C3E5F), Color(0xFF324140)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Container( - margin: EdgeInsets.only(top: 24.sp), - child: Column( - children: [ - Center( - child: Text( - "提示", - style: TextStyle(color: Colors.white, fontSize: 16.sp), - ), - ), - SizedBox( - height: 85.sp, - child: ListView( - children: [ - Container( - margin: EdgeInsets.only( - top: 36.sp, left: 14.sp, right: 14.sp), - alignment: Alignment.center, - child: Text( - "您已被对方拉进黑名单,去看看其他人吧~", - textAlign: TextAlign.center, - style: TextStyle( - color: const Color(0xCCF7FAFA), - fontSize: 16.sp), - ), - ) - ], - ), - ), - isDownload - ? GestureDetector( - onTap: () async { - //incrementCounter(); - }, - child: Container( - margin: EdgeInsets.only(top: 24.sp), - child: CircularProgressIndicator( - value: myProgress, - backgroundColor: Colors.grey, - valueColor: const AlwaysStoppedAnimation( - Color(0xFF30FFD9)), - strokeWidth: 4.0.sp, - ), - ), - ) - : GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () async { - Navigator.pop(context); - Get.back(); - }, - child: Container( - width: 200.sp, - margin: EdgeInsets.only(top: 14.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 10.sp, - bottom: 10.sp, - left: 52.sp, - right: 52.sp), - child: Center( - child: Text( - "好的", - style: TextStyle( - color: Colors.white, - fontSize: 12.sp, - ), - ), - ), - ), - ) - ], - ), - ), - Positioned( - right: 8.sp, - top: 8.sp, - child: widget.isDismiss? GestureDetector( - onTap: (){ - - Navigator.pop(context); - }, - child: Icon(Icons.close,color: Colors.white,size: 24.sp,)):Container()) - ], - ), - ), - ), - ); - } - - -} - diff --git a/circle_app/lib/app/dialog/ScreenBottomSheetDialog.dart b/circle_app/lib/app/dialog/ScreenBottomSheetDialog.dart deleted file mode 100644 index 6c4f0cd..0000000 --- a/circle_app/lib/app/dialog/ScreenBottomSheetDialog.dart +++ /dev/null @@ -1,516 +0,0 @@ -import 'dart:async'; - -import 'package:circle_app/app/circle/logic.dart'; -import 'package:circle_app/router/app_routers.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_pickers/pickers.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; - -import '../../common/Widgets/open_vip_tip/view.dart'; -import '../../network/api.dart'; -import '../../network/dio_manager.dart'; -import '../../util/device.dart'; -import '../../util/eventBus.dart'; -import '../../util/util.dart'; -import '../circle/view.dart'; -import '../minefragment/logic.dart'; -import '../select_circle/logic.dart'; - -typedef void ScreenCallback(List genderList,List orientationList,List roleList); - - -class ScreenBottomSheetDialog extends StatefulWidget { - final List genderList ; - - final List orientationList ; - - final List roleList ; - final ScreenCallback callback; - - final bool isHaveCity; - - ScreenBottomSheetDialog({required this.genderList, required this.orientationList,required this.roleList, - required this.callback,required this.isHaveCity - }); - @override - _ScreenBottomSheetDialogState createState() => - _ScreenBottomSheetDialogState(); - - -} - -class _ScreenBottomSheetDialogState extends State { - late ConfigBean configBean; - - - int myVip = 0; - String city = '请切换城市'; - String locationCity = ''; - String endCity = ''; - - - - @override - void initState() { - // TODO: implement initState - super.initState(); - if (widget.orientationList.isNotEmpty && Get.currentRoute == AppRoutes.Home) { - var logic = Get.find(); - locationCity = logic.cityName; - } - initGerder(); - } - StreamSubscription? subscription = null; - void initGerder() async { - - var data = await DioManager.instance.get(url: Api.getUserMine); - var bean = BaseResponse.fromJson( - data, (data) => MineResponseBean.fromJson(data)); - if (bean.isSuccess()) { - myVip = bean.data.user.vip; - } - subscription = EventBusManager.on().listen((event) { - myVip = event.vip; - }); - } - - @override - void dispose() { - // TODO: implement dispose - if (null != subscription) { - EventBusManager.cancelSubscription(subscription!); - } - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return Container( - decoration: const BoxDecoration( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(16.0), - topRight: Radius.circular(16.0), - ), - gradient: LinearGradient( - colors: [ - Color(0xFF4A3E5D), - Color(0xFF344143), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - height: widget.orientationList.isEmpty ? 110 : widget.isHaveCity ? 270.0 : 220, - width: double.infinity, - child: Container( - margin: EdgeInsets.only(top: 10.sp), - child: Column( - children: [ - Row( - children: [ - GestureDetector( - onTap: () { - Navigator.pop(context); - }, - child: Container( - margin: EdgeInsets.only(left: 16.sp), - child: Text( - '取消', - textAlign: TextAlign.left, - style: TextStyle(color: Color(0xFFB7BECC), fontSize: 18.sp), - ), - ), - ), - const Spacer(), // Adds space to separate the text widgets - Text( - '精准筛选', - textAlign: TextAlign.center, - style: TextStyle(color: Color(0xFFFFFFFF), fontSize: 18.sp), - ), - const Spacer(), // Adds space to separate the text widgets - GestureDetector( - onTap: (){ - - widget.callback([],[],[]); - Navigator.pop(context); - }, - child: Container( - margin: EdgeInsets.only(right: 16.sp), - child: Text( - '确认', - textAlign: TextAlign.right, - style: TextStyle(color: Color(0xFFFFFFFF), fontSize: 18.sp), - ), - ), - ), - ], - ), - if (widget.isHaveCity) - cityOptionWidget(), - SizedBox( - height: 15.sp, - ), - Row( - children: [ - Container( - margin: EdgeInsets.only(left: 16.sp), - child: Text( - "角色", - style: TextStyle(color: Color(0xFFF7FAFA), fontSize: 16.sp), - ), - ), - Expanded( - child: Container( - height: 23.sp, - margin: EdgeInsets.only(left: 18.sp), - child: ListView.builder( - itemCount: widget.genderList.length, - scrollDirection: Axis.horizontal, - itemBuilder: (context, index) { - final isSelected = widget.genderList[index] - .isSelect; // Replace with your condition - - return GestureDetector( - onTap: () { - setState(() { - widget.genderList[index].isSelect = - !widget.genderList[index].isSelect; - }); - }, - child: Container( - margin: EdgeInsets.only(right: 6.0), - width: 50.0, - height: 23.0, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(18.0), - gradient: isSelected - ? const LinearGradient( - colors: [ - Color(0xFFD95EFC), - Color(0xFF30FFD9) - ], - tileMode: TileMode.repeated, - ) - : const LinearGradient( - colors: [ - Color(0xFFD95EFC), - Color(0xFF30FFD9) - ], - tileMode: TileMode.repeated, - ), - ), - child: Padding( - padding: EdgeInsets.all(0.5), - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17.0), - color:isSelected? Color(0x00000000): Color(0xFF392D53), - ), - child: Center( - child: Text( - widget.genderList[index].name, - style: TextStyle( - fontSize: 13.0, - color: Colors.white, - ), - ), - ), - ), - ), - )); - }, - ), - ), - ), - ], - ), - if (widget.roleList.isNotEmpty) - SizedBox( - height: 20.sp, - ), - if (widget.roleList.isNotEmpty) - Stack( - children: [ - Row( - children: [ - Container( - margin: EdgeInsets.only(left: 16.sp,top: 6.sp), - child: Text( - "属性", - style: TextStyle(color: Color(0xFFF7FAFA), fontSize: 16.sp), - ), - ), - Expanded( - child: Container( - height: 23.sp, - margin: EdgeInsets.only(left: 18.sp,top: 6.sp), - child: ListView.builder( - itemCount: widget.roleList.length, - scrollDirection: Axis.horizontal, - itemBuilder: (context, index) { - final isSelected = widget.roleList[index] - .isSelect; // Replace with your condition - - return GestureDetector( - onTap: () { - if(myVip<1){ - showOKToast('开通VIP才能使用该功能哦~'); - showRechargeDialog(); - return; - } - setState(() { - widget.roleList[index].isSelect = - !widget.roleList[index].isSelect; - }); - }, - child: Container( - margin: EdgeInsets.only(right: 6.0), - width: 50.0, - height: 23.0, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(18.0), - gradient: isSelected - ? const LinearGradient( - colors: [ - Color(0xFFD95EFC), - Color(0xFF30FFD9) - ], - tileMode: TileMode.repeated, - ) - : const LinearGradient( - colors: [ - Color(0xFFD95EFC), - Color(0xFF30FFD9) - ], - tileMode: TileMode.repeated, - ), - ), - child: Padding( - padding: EdgeInsets.all(0.5), - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17.0), - color:isSelected? Color(0x00000000): Color(0xFF392D53), - ), - child: Center( - child: Text( - widget.roleList[index].name, - style: TextStyle( - fontSize: 13.0, - color: Colors.white, - ), - ), - ), - ), - ), - )); - }, - ), - ), - ), - ], - ), - Positioned( - left: 36.sp, - - child: Image( - image: AssetImage(getBaseImage("icon_white_vip")), - width: 34.sp, - ), - ), - ], - ), - SizedBox( - height: 20.sp, - ), - if (widget.orientationList.isNotEmpty) - Stack( - children: [ - Row( - children: [ - Container( - margin: EdgeInsets.only(left: 16.sp,top: 6.sp), - child: Text( - "取向", - style: TextStyle(color: Color(0xFFF7FAFA), fontSize: 16.sp), - ), - ), - Expanded( - child: Container( - height: 23.sp, - margin: EdgeInsets.only(left: 18.sp,top: 6.sp), - child: ListView.builder( - itemCount: widget.orientationList.length, - scrollDirection: Axis.horizontal, - itemBuilder: (context, index) { - final isSelected = widget.orientationList[index] - .isSelect; // Replace with your condition - - return GestureDetector( - onTap: () { - if(myVip<2){ - showOKToast('开通年VIP才可以使用该功能哦~'); - showRechargeDialog(isYear: true); - return; - } - setState(() { - widget.orientationList[index].isSelect = - !widget.orientationList[index].isSelect; - }); - }, - child: Container( - margin: EdgeInsets.only(right: 6.0), - width: 50.0, - height: 23.0, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(18.0), - gradient: isSelected - ? const LinearGradient( - colors: [ - Color(0xFFD95EFC), - Color(0xFF30FFD9) - ], - tileMode: TileMode.repeated, - ) - : const LinearGradient( - colors: [ - Color(0xFFD95EFC), - Color(0xFF30FFD9) - ], - tileMode: TileMode.repeated, - ), - ), - child: Padding( - padding: EdgeInsets.all(0.5), - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17.0), - color:isSelected? Color(0x00000000): Color(0xFF392D53), - ), - child: Center( - child: Text( - widget.orientationList[index].name, - style: TextStyle( - fontSize: 13.0, - color: Colors.white, - ), - ), - ), - ), - ), - )); - }, - ), - ), - ), - ], - ), - Positioned( - left: 36.sp, - child: Image( - image: AssetImage(getBaseImage("icon_white_yearvip")), - width: 34.sp, - - ), - ), - ], - ), - // Other content here... - ], - ), - ), - ); - } - - cityOptionWidget() { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only(top: 10.sp,left: 15.sp,right: 15.sp), - child: Text( - '可以切换到你喜欢的城市,遇见更多有趣的圈友', - style: TextStyle( - color: const Color(0xFFB7BECC), - fontSize: 14.0.sp, - ), - ), - ), - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - showCityPiker(context); - }, - child: Container( - // color: Colors.red, - // margin: EdgeInsets.only(top: 10.0.sp), - padding: EdgeInsets.fromLTRB(15.sp, 6.0.sp, 5.sp, 6.0.sp), - // color: const Color(0xFFF7FAFA), - child: Row( - children: [ - Image.asset( - getCircleImage("icon_location"), // 替换为图片资源路径 - width: 20.0.sp, - height: 20.0.sp, - ), - SizedBox(width: 6.0.sp), - Text( - locationCity, - style: TextStyle( - color: const Color(0xFFB7BECC), - fontSize: 14.0.sp, - ), - ), - const Spacer(), - Row( - children: [ - Text( - city, - style: TextStyle( - color: const Color(0xFFB7BECC), - fontSize: 14.0.sp, - ), - ), - Image.asset( - getCircleImage("icon_perfect_next"), // 替换为图片资源路径 - width: 16.0.sp, - height: 16.0.sp, - ), - ], - ), - ], - ), - ), - ), - ], - ); - } - - showCityPiker(context) { - var logic = Get.find(); - Pickers.showMultiLinkPicker(context, - pickerStyle: DefaultPickerStyle.dark(), - data: logic.cityMap, - columeNum: 2, onConfirm: (List res, List position) { - print(res); - logic.cityName = res[1]; - city = logic.cityName; - setState(() { - - }); - } - ); - } - - showRechargeDialog({bool isYear = false}){ - Get.bottomSheet( - Scaffold( - backgroundColor: Colors.transparent, - body: Open_vip_tipPage(isYear), - ), - isScrollControlled: true, - enableDrag: false); - } -} diff --git a/circle_app/lib/app/dialog/UnlockCallDialog.dart b/circle_app/lib/app/dialog/UnlockCallDialog.dart deleted file mode 100644 index 4ee69a6..0000000 --- a/circle_app/lib/app/dialog/UnlockCallDialog.dart +++ /dev/null @@ -1,272 +0,0 @@ -import 'dart:io'; - -import 'package:circle_app/util/paymentUtil.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; -import 'package:get/get.dart'; -import 'package:get/get_state_manager/src/simple/get_controllers.dart'; - -import '../../common/Widgets/open_vip_tip/logic.dart'; -import '../../network/api.dart'; -import '../../network/dio_manager.dart'; -import '../../util/PaymentUtils.dart'; -import '../../util/util.dart'; - -class UnlockCallDialog extends GetxController { - RxBool isZfbPrice = true.obs; - String circleId = ""; - - void showUnlockBottomSheet(String id,String amount,String oldAmount,{String iositem= ''}) { - circleId = id; - Get.bottomSheet( - Scaffold( - backgroundColor: Colors.transparent, - body: Container( - width: Get.width, - height: Get.height, - child: Center( - child: Container( - width: 339.sp, - height: 330.sp, - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.fill, - image: AssetImage(getCircleImage('add_tip_bg')))), - child: Stack( - alignment: Alignment.center, - children: [ - Positioned( - top: 5.sp, - right: 12.sp, - child: GestureDetector( - onTap: () { - Get.back(); - }, - child: Image.asset( - getCircleImage('close'), - width: 24.sp, - ), - )), - Positioned( - top: 24.sp, - child: Text( - '解锁圈子才能发布喊话', - style: - TextStyle(color: Colors.white, fontSize: 16.sp), - )), - Positioned( - left: 17.sp, - top: 64.sp, - child: Text( - '为什么要解锁圈子?', - style: - TextStyle(color: Colors.white, fontSize: 16.sp), - )), - Positioned( - top: 98.sp, - child: Container( - width: 339.sp, - padding: EdgeInsets.only(left: 17.sp, right: 17.sp), - child: Text( - '为打造纯净的社交环境,更好地服务大家,基于以下几方面考虑:1、平台升级为全天24小时人工审核,保证用户真实,避免骗子、酒托、虚假人士等扰乱平台 ;2、杜绝未入圈用户随意骚扰或影响已入圈;3、谢绝只会白嫖的猎奇人士。', - style: TextStyle( - color: Color.fromRGBO(247, 250, 250, 0.8), - fontSize: 12.sp)), - )), - Platform.isIOS - ? Container( - height: 1, - width: 1, - ) - : Positioned( - bottom: 108.sp, - child: Container( - margin: EdgeInsets.only(top: 24.0.sp), - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - onTap: () { - isZfbPrice.value = true; - update(); - }, - child: Row( - children: [ - Obx(() => Image.asset( - isZfbPrice.value - ? getMineImage("icon_pay_select") - : getMineImage( - "icon_pay_is_no_select"), - width: 20.0.sp, - height: 20.0.sp, - )) - , - SizedBox(width: 8.0.sp), - Image.asset( - getMineImage('icon_cooperate_ali'), - width: 20.0.sp, - height: 20.0.sp, - ), - SizedBox(width: 4.0.sp), - Text( - '支付宝支付', - style: TextStyle( - color: const Color(0xFFF7FAFA), - fontSize: 14.0.sp, - ), - ), - SizedBox(width: 4.0.sp), - Image.asset( - getMineImage( - 'icon_recommend_pay_way'), - width: 32.0.sp, - height: 16.0.sp, - ), - ], - ), - ), - SizedBox(width: 24.0.sp), - GestureDetector( - onTap: () { - isZfbPrice.value = false; - update(); - }, - child: Row( - children: [ - Obx(() => Image.asset( - !isZfbPrice.value - ? getMineImage("icon_pay_select") - : getMineImage( - "icon_pay_is_no_select"), - width: 20.0.sp, - height: 20.0.sp, - )) - , - SizedBox(width: 8.0.sp), - Image.asset( - getMineImage('icon_cooperate_wx'), - width: 20.0.sp, - height: 20.0.sp, - ), - SizedBox(width: 4.0.sp), - Text( - '微信支付', - style: TextStyle( - color: const Color(0xFFF7FAFA), - fontSize: 14.0.sp, - ), - ), - ], - ), - ), - ], - ), - ), - ), - Positioned( - bottom: 18.sp, - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - if (Platform.isIOS) { - IOSPayment.instance.iosPay(iositem, circleId, 1); - } else { - startPayment(); - // unlockingPayment(numbers[0].id, (payResult) {}); - } - }, - child: Container( - width: 168.sp, - height: 42.sp, - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(21.sp), - gradient: const LinearGradient( - begin: Alignment.centerLeft, - end: Alignment.centerRight, - colors: [ - Color(0xff0AFCFF), - Color(0xffD739EA) - ])), - child: Text( - '立即解锁', - style: TextStyle( - color: Colors.white, fontSize: 16.sp), - ), - ), - )), - Positioned( - bottom: 72.sp, - child: Container( - child: Row( - children: [ - Text( - '¥${double.parse(amount).toInt()}', - style: TextStyle( - color: Color(0xffE845FF), - fontSize: 16.sp, - fontWeight: FontWeight.w600), - ), - SizedBox( - width: 2.sp, - ), - Text( - '(原价${double.parse(oldAmount).toInt()})', - style: TextStyle( - color: Colors.white70, - fontSize: 16.sp, - fontWeight: FontWeight.w400, - decoration: TextDecoration.lineThrough, - decorationColor: Colors.white70, - ), - ), - ], - ), - )) - ], - ), - ), - ), - ), - ), - isScrollControlled: true, - enableDrag: false); - } - - startPayment() async { - SmartDialog.showLoading(); - if (isZfbPrice.value) { - var data = await DioManager.instance.post( - url: Api.postAliPayOrder, - params: {"product_id": circleId, "type": 1}); - var bean = BaseResponse.fromJson( - data, (data) => PayUrlBean.fromJson(data)); - if (bean.isSuccess()) { - openAliPay(bean.data.payUrl, (isSuccess, errorMsg) { - Get.back(); - }); - } else { - showOKToast(bean.msg); - } - } else { - var data = await DioManager.instance.post( - url: Api.postWxOrder, - params: {"product_id": circleId, "type": 1}); - var bean = BaseResponse.fromJson( - data, (data) => PaymentData.fromJson(data)); - if (bean.isSuccess()) { - openWxPay(bean.data, (bool isSuccess, String? errorMessage) { - Get.back(); - }); - } else { - showOKToast(bean.msg); - } - } - SmartDialog.dismiss(); - } - - - -} \ No newline at end of file diff --git a/circle_app/lib/app/dialog/UpdateDialog.dart b/circle_app/lib/app/dialog/UpdateDialog.dart deleted file mode 100644 index d56d942..0000000 --- a/circle_app/lib/app/dialog/UpdateDialog.dart +++ /dev/null @@ -1,297 +0,0 @@ -import 'dart:io'; - -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -// import 'package:flutter_install_app/flutter_install_app.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:url_launcher/url_launcher.dart'; - -import '../../network/dio_manager.dart'; -import '../../util/util.dart'; - -class UpdateDialog extends StatefulWidget { - final bool isDismiss; - final UpdateInfo updateInfo; - - UpdateDialog({required this.isDismiss, required this.updateInfo}); - - @override - _CustomDialogState createState() => _CustomDialogState(); -} - -double myProgress = 0; - -class _CustomDialogState extends State { - bool isDownload = false; - bool isShowWeb = false; - - void incrementCounter() {} - - void setDownloadUi() { - setState(() { - isDownload = true; - }); - } - - @override - Widget build(BuildContext context) { - return WillPopScope( - onWillPop: () async { - return widget.isDismiss; - }, - child: Dialog( - backgroundColor: Colors.transparent, - child: Container( - height: 317.sp + (isShowWeb ? 40.sp : 0), - padding: const EdgeInsets.all(1.0), - child: Stack( - children: [ - Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: const LinearGradient( - colors: [Color(0xFFDD3DF4), Color(0xFF30FFD9)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Container( - margin: EdgeInsets.all(1.sp), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: const LinearGradient( - colors: [Color(0xFF4C3E5F), Color(0xFF324140)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Container( - margin: EdgeInsets.only(top: 24.sp), - child: Column( - children: [ - Center( - child: Text( - "发现新版本", - style: TextStyle(color: Colors.white, fontSize: 16.sp), - ), - ), - // Container( - // margin: EdgeInsets.only(top: 14.sp), - // alignment: Alignment.center, - // child: Image( - // image: AssetImage(getBaseImage("ic_launcher")), - // width: 70.sp, - // height: 70.sp, - // ), - // ), - SizedBox( - height: 215.sp, - child: ListView( - children: [ - Container( - margin: EdgeInsets.only( - top: 12.sp, left: 14.sp, right: 14.sp), - alignment: Alignment.center, - child: Text( - widget.updateInfo.updateInfo, - textAlign: TextAlign.left, - style: TextStyle( - color: const Color(0xCCF7FAFA), - fontSize: 16.sp), - ), - ) - ], - ), - ), - isDownload - ? GestureDetector( - onTap: () async { - //incrementCounter(); - }, - child: Column( - children: [ - Container( - margin: EdgeInsets.only(top: 10.sp), - child: CircularProgressIndicator( - value: myProgress, - backgroundColor: Colors.grey, - valueColor: - const AlwaysStoppedAnimation( - Color(0xFF30FFD9)), - strokeWidth: 4.0.sp, - ), - ), - GestureDetector( - onTap: () async { - final String appStoreUrl = widget.updateInfo - .downloadUrl; // App Store链接示例 - - if (await canLaunch(appStoreUrl)) { - await launch(appStoreUrl, - forceSafariVC: false); - } else { - throw 'Could not open App Store.'; - } - }, - child:isShowWeb? Container( - margin: EdgeInsets.only(top: 10.sp), - child: Text( - "下载太慢?试试浏览器下载吧。", - style: TextStyle( - color: Colors.blue, // 设置蓝色颜色 - decoration: - TextDecoration.underline, // 添加下划线 - ), - ), - ): Container(), - ) - ], - ), - ) - : GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () async { - if (Platform.isIOS) { - final String appStoreUrl = widget - .updateInfo.downloadUrl; // App Store链接示例 - if (await canLaunch(appStoreUrl)) { - await launch(appStoreUrl, - forceSafariVC: false); - } else { - throw 'Could not open App Store.'; - } - } else { - final String appStoreUrl = widget - .updateInfo.downloadUrl; // App Store链接示例 - - if (appStoreUrl.contains("apk")) { - updataApk(appStoreUrl); - setDownloadUi(); - Future.delayed(Duration(seconds: 10),() { - setState(() { - isShowWeb = true; - }); - }); - } else { - if (await canLaunch(appStoreUrl)) { - await launch(appStoreUrl, - forceSafariVC: false); - } else { - throw 'Could not open App Store.'; - } - } - } - - //Navigator.pop(context); - // logic.setBlock(); - }, - child: Container( - width: 200.sp, - margin: EdgeInsets.only(top: 10.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 10.sp, - bottom: 10.sp, - left: 52.sp, - right: 52.sp), - child: Center( - child: Text( - "立即更新", - style: TextStyle( - color: Colors.white, - fontSize: 12.sp, - ), - ), - ), - ), - ) - ], - ), - ), - Positioned( - right: 8.sp, - top: 8.sp, - child: widget.isDismiss - ? GestureDetector( - onTap: () { - Navigator.pop(context); - }, - child: Icon( - Icons.close, - color: Colors.white, - size: 24.sp, - )) - : Container()) - ], - ), - ), - ), - ); - } - - updataApk(String downloadUrl) async { - //SmartDialog.showLoading(); - var filePath = await getApplicationSupportDirectoryPath(); - filePath = filePath + "leyuan.apk"; - DioManager.instance.setReceiveTimeout(300); - var data = await DioManager.instance - .download(downloadUrl, filePath, (received, total) { - double progress = received / total * 100; - setState(() { - myProgress = received / total; - }); - print('Download progress: $progress%'); - }) - .then((value) => {print(value)}) - .catchError((error) { - // SmartDialog.dismiss(); - print(error); - }); - DioManager.instance.setReceiveTimeout(30); - // flutter_install_app - // await AppInstaller.installApk(filePath, actionRequired: false); - } -} - -class UpdateInfo { - final String version; //最新版本号 - final int update; //是否要更新 - final int constraint; //是否强制 - final String publishTime; - final String downloadUrl; - final String updateInfo; - - UpdateInfo({ - required this.version, - required this.update, - required this.constraint, - required this.publishTime, - required this.downloadUrl, - required this.updateInfo, - }); - - factory UpdateInfo.fromJson(Map json) { - return UpdateInfo( - version: json['version'], - update: json['update'], - constraint: json['constraint'], - publishTime: json['publish_time'], - downloadUrl: json['download_url'], - updateInfo: json['update_info'], - ); - } -} diff --git a/circle_app/lib/app/dialog/YesAgreementDialog.dart b/circle_app/lib/app/dialog/YesAgreementDialog.dart deleted file mode 100644 index 1313e70..0000000 --- a/circle_app/lib/app/dialog/YesAgreementDialog.dart +++ /dev/null @@ -1,223 +0,0 @@ -import 'dart:ffi'; -import 'dart:io'; - -import 'package:connectivity/connectivity.dart'; -import 'package:device_info/device_info.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/gestures.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_bugly/flutter_bugly.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; -import '../../main.dart'; -import '../../util/SharedPreferencesHelper.dart'; -import '../../util/device.dart'; -import '../../util/util.dart'; - -class YesAgreementDialog extends StatefulWidget { - @override - _CustomDialogState createState() => _CustomDialogState(); -} - -double myProgress = 0; - -class _CustomDialogState extends State { - bool isDownload = false; - - void incrementCounter() {} - - void setDownloadUi() { - setState(() { - isDownload = true; - }); - } - - @override - Widget build(BuildContext context) { - return WillPopScope( - onWillPop: () async { - print(getAgreemement()); - return false; - }, - child: Dialog( - backgroundColor: Colors.transparent, - child: Container( - height: 277.sp, - padding: const EdgeInsets.all(1.0), - child: Stack( - children: [ - Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: const LinearGradient( - colors: [Color(0xFFDD3DF4), Color(0xFF30FFD9)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Container( - margin: EdgeInsets.all(1.sp), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: const LinearGradient( - colors: [Color(0xFF4C3E5F), Color(0xFF324140)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - margin: EdgeInsets.only(left: 10.sp, right: 10.sp), - child: RichText( - text: TextSpan( - text: "感谢您信任并使用微乐园APP,在你使用微乐园的服务之前,请认真阅读", - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - ), - children: [ - TextSpan( - text: "《用户协议》", - style: const TextStyle( - color: Color(0xFF21BEAB), - ), - recognizer: TapGestureRecognizer() - ..onTap = () { - navigateToUserAgreement(); - }, - ), - const TextSpan( - text: "和", - style: TextStyle( - color: Colors.white, - ), - ), - TextSpan( - text: "《隐私政策》", - style: const TextStyle( - color: Color(0xFF21BEAB), - ), - recognizer: TapGestureRecognizer() - ..onTap = () { - navigateToPrivacyPolicy(); - }, - ), - TextSpan( - text: - "的全部内容,以了解用户权力义务和个人信息处理规则。微乐园仅会将您的信息用于提供服务和改善体验,我们将权力保障您的信息安全,请同意后使用,若您不同意本隐私政策,很遗憾,我们将无法为您提供完整的产品和服务。", - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - ), - ), - ], - ), - ), - ), - SizedBox(height: 10.sp), - GestureDetector( - onTap: () async { - // 点击操作 - SmartDialog.showLoading(); - var connectivityResult = - await Connectivity().checkConnectivity(); - - if (connectivityResult == ConnectivityResult.none) { - showOKToast("网络不流畅哦,请检查网络情况"); - print('没网'); - return; - } - - try { - var sp = await SharedPreferencesHelper.getInstance(); - sp.setBool(SharedPreferencesHelper.AGREEMENT, true); - } catch (e) {} - uploadBuzIDAndToken(); - SmartDialog.dismiss(); - pushLoginPage(); - FlutterBugly.init( - androidAppId: "8509314e11", - ); - }, - child: Container( - width: 240.sp, - padding: const EdgeInsets.symmetric( - vertical: 10, - horizontal: 44, - ), - decoration: BoxDecoration( - gradient: const LinearGradient( - colors: [Color(0xFFDD3DF4), Color(0xFF30FFD9)], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - borderRadius: BorderRadius.circular(30), - ), - child: Center( - child: Text( - "同意并继续使用", - style: TextStyle( - color: Colors.white, - fontSize: 16.sp, - ), - ), - ), - ), - ), - TextButton( - onPressed: () { - // 点击不同意按钮的操作 - // exit(1); - SystemNavigator.pop(); - }, - child: Text( - "不同意并退出应用", - style: TextStyle( - color: Color(0xFFB8C2CC), - fontSize: 16.sp, - ), - ), - ), - ], - ), - ], - ), - ), - ), - ); - } - - // Future uploadBuzIDAndToken() async { - // if (Platform.isAndroid) { - // initWxApi(); - // } - // - // - // final CoreServicesImpl coreInstance = TIMUIKitCore.getInstance(); - // await ChannelPush.init((msg) {}); - // - // int? businessID = await TimUiKitPushPlugin.getBuzId(PushConfig.appInfo); - // - // String token = await ChannelPush.getDeviceToken(); - // ChannelPush.uploadToken(); - // - // print("token=" + token); - // if (token != "") { - // V2TimCallback res = await coreInstance.setOfflinePushConfig( - // token: token, businessID: businessID); - // - // print("token=" + res.code.toString()); - // } - // - // - // return true; - // } -} diff --git a/circle_app/lib/app/edit_pwd/binding.dart b/circle_app/lib/app/edit_pwd/binding.dart deleted file mode 100644 index e5ca02d..0000000 --- a/circle_app/lib/app/edit_pwd/binding.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:get/get.dart'; - -import 'logic.dart'; - -class Edit_pwdBinding extends Bindings { - @override - void dependencies() { - Get.lazyPut(() => Edit_pwdLogic()); - } -} diff --git a/circle_app/lib/app/edit_pwd/logic.dart b/circle_app/lib/app/edit_pwd/logic.dart deleted file mode 100644 index 27f720f..0000000 --- a/circle_app/lib/app/edit_pwd/logic.dart +++ /dev/null @@ -1,46 +0,0 @@ -import 'package:circle_app/network/api.dart'; -import 'package:circle_app/network/dio_manager.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:get/get.dart'; - -import 'state.dart'; - -class Edit_pwdLogic extends GetxController { - final Edit_pwdState state = Edit_pwdState(); - - var passwordController = TextEditingController(); - var new_passwordController = TextEditingController(); - var config_passwordController = TextEditingController(); - - @override - void dispose() { - super.dispose(); - passwordController.dispose(); - new_passwordController.dispose(); - config_passwordController.dispose(); - } - - void setPassword() async { - if (passwordController.text.isEmpty) { - showOKToast('请输入原密码'); - } else if (new_passwordController.text.isEmpty) { - showOKToast('请输入6-12位新密码'); - } else if (config_passwordController.text.isEmpty) { - showOKToast('再次输入新密码'); - } else if (new_passwordController.text == passwordController.text) { - showOKToast('新密码不能和原密码相同哦'); - } else if (new_passwordController.text != config_passwordController.text) { - showOKToast('新密码和确认密码不一致哦'); - } else { - var result = await DioManager.instance.post(url: Api.userUpdatePassword,params: {'newPassword':new_passwordController.text,'oldPassword':passwordController.text}); - if (result['code'] == 200) { - showOKToast('密码修改成功'); - Get.back(); - } else { - showOKToast(result['msg']); - } - } - } - -} diff --git a/circle_app/lib/app/edit_pwd/state.dart b/circle_app/lib/app/edit_pwd/state.dart deleted file mode 100644 index f410a42..0000000 --- a/circle_app/lib/app/edit_pwd/state.dart +++ /dev/null @@ -1,5 +0,0 @@ -class Edit_pwdState { - Edit_pwdState() { - ///Initialize variables - } -} diff --git a/circle_app/lib/app/edit_pwd/view.dart b/circle_app/lib/app/edit_pwd/view.dart deleted file mode 100644 index 20eaa7a..0000000 --- a/circle_app/lib/app/edit_pwd/view.dart +++ /dev/null @@ -1,185 +0,0 @@ -import 'package:circle_app/common/colors/app_color.dart'; -import 'package:circle_app/components/my_app_bar.dart'; -import 'package:circle_app/router/app_routers.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; - -import 'logic.dart'; - -class Edit_pwdPage extends StatelessWidget { - Edit_pwdPage({Key? key}) : super(key: key); - - final logic = Get.find(); - final state = Get.find().state; - - @override - Widget build(BuildContext context) { - return GetBuilder(builder: (logic) { - - return Stack( - children: [ - Container( - width: Get.width, - height: Get.height, - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage(getBaseImage('home_back')), - fit: BoxFit.cover, - ), - ), - ), - Scaffold( - backgroundColor: Colors.transparent, - resizeToAvoidBottomInset: false, - appBar: const MyAppBar( - centerTitle: '修改密码', - ), - body: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - FocusManager.instance.primaryFocus?.unfocus(); - }, - child: Container( - child: Column( - children: [ - Container( - height: 40.sp, - - margin: EdgeInsets.symmetric(horizontal: 16.sp,vertical: 10.sp), - padding: EdgeInsets.symmetric(horizontal: 10.sp), - decoration: BoxDecoration( - color: Color(0xff282733), - borderRadius: BorderRadius.circular(8.sp) - ), - child: TextFormField( - controller: logic.passwordController, - // onChanged: (msg) { - // logic.isSuccess = msg.length > 5 ? true : false; - // logic.update(); - // }, - - obscureText: true, - autofocus: true, - decoration: InputDecoration( - focusedBorder: UnderlineInputBorder( - borderSide: BorderSide(color: Colors.transparent), - ), - enabledBorder: UnderlineInputBorder( - borderSide: BorderSide(color: Colors.transparent), - ), - hintText: '请输入原密码', - hintStyle: TextStyle(color: Color(0xFFB7BECC)), - counterText: '' - ), - maxLength: 12, - style: const TextStyle(color: Color(0xFFB7BECC)), - ), - ), - Container( - height: 40.sp, - margin: EdgeInsets.symmetric(horizontal: 16.sp,vertical: 10.sp), - padding: EdgeInsets.symmetric(horizontal: 10.sp), - decoration: BoxDecoration( - color: Color(0xff282733), - borderRadius: BorderRadius.circular(8.sp) - ), - child: TextFormField( - controller: logic.new_passwordController, - obscureText: true, - autofocus: true, - decoration: InputDecoration( - - focusedBorder: UnderlineInputBorder( - borderSide: BorderSide(color: Colors.transparent), - ), - enabledBorder: UnderlineInputBorder( - borderSide: BorderSide(color: Colors.transparent), - ), - hintText: '请输入6-12位新密码', - hintStyle: TextStyle(color: Color(0xFFB7BECC)), - counterText: '' - ), - maxLength: 12, - style: const TextStyle(color: Color(0xFFB7BECC)), - ), - ), - Container( - height: 40.sp, - margin: EdgeInsets.symmetric(horizontal: 16.sp,vertical: 10.sp), - padding: EdgeInsets.symmetric(horizontal: 10.sp), - decoration: BoxDecoration( - color: Color(0xff282733), - borderRadius: BorderRadius.circular(8.sp) - ), - child: TextFormField( - controller: logic.config_passwordController, - - obscureText: true, - autofocus: true, - decoration: InputDecoration( - focusedBorder: UnderlineInputBorder( - borderSide: BorderSide(color: Colors.transparent), - ), - enabledBorder: UnderlineInputBorder( - borderSide: BorderSide(color: Colors.transparent), - ), - hintText: '再次输入新密码', - hintStyle: TextStyle(color: Color(0xFFB7BECC)), - counterText: '' - ), - maxLength: 12, - style: const TextStyle(color: Color(0xFFB7BECC)), - ), - ), - - Container( - alignment: Alignment.centerLeft, - margin: EdgeInsets.only(left: 16.sp), - child: Text('温馨提示:修改后下次只能通过新密码登录',style: TextStyle(color: Colors.white.withOpacity(0.75),fontSize: 14.sp),), - ), - - GestureDetector( - onTap: () { - logic.setPassword(); - }, - child: Container( - width: double.infinity, - margin: EdgeInsets.symmetric(horizontal: 97.sp,vertical: 20.sp), - height: 48.sp, - alignment: Alignment.center, - decoration: BoxDecoration( - gradient: AppColor.mainVerLinearGradient, - borderRadius: BorderRadius.circular(24.sp), - ), - child: Text( - '确定', - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.white, - fontSize: 18.sp, - ), - ), - ), - ), - - GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.ResetPwd); - }, - child: Container( - alignment: Alignment.center, - // margin: EdgeInsets.only(top: 10.sp), - child: Text('忘记密码',style: TextStyle(color: Colors.white.withOpacity(0.7),fontSize: 15.sp),), - ), - ) - ], - ), - ), - )), - ], - ); - }); - } -} diff --git a/circle_app/lib/app/externalshare/binding.dart b/circle_app/lib/app/externalshare/binding.dart deleted file mode 100644 index b28d6f5..0000000 --- a/circle_app/lib/app/externalshare/binding.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:get/get.dart'; - -import 'logic.dart'; - -class ExternalshareBinding extends Bindings { - @override - void dependencies() { - Get.lazyPut(() => ExternalshareLogic()); - } -} diff --git a/circle_app/lib/app/externalshare/logic.dart b/circle_app/lib/app/externalshare/logic.dart deleted file mode 100644 index 8838f19..0000000 --- a/circle_app/lib/app/externalshare/logic.dart +++ /dev/null @@ -1,67 +0,0 @@ - -import 'dart:convert'; - -import 'package:circle_app/app/login/login/logic.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; -import 'package:get/get.dart'; -import 'package:image_picker/image_picker.dart'; - -import '../../common/config.dart'; -import '../../network/api.dart'; -import '../../network/dio_manager.dart'; -import '../../util/qiniu.dart'; -import 'state.dart'; - -class ExternalshareLogic extends GetxController { - final ExternalshareState state = ExternalshareState(); - - final ImagePicker _picker = ImagePicker(); - - var quToken = ''; - - @override - void onInit() async{ - super.onInit(); - var data = - await DioManager.instance.get(url: Api.getqiniuToken, params: {}); - - if(data['cpde'] == 200){ - quToken = data['data']['token']; - } - } - - updateExternalShare()async{ - if(state.imaglist==0){ - showOKToast("请上传图片"); - return ; - } - var data = await DioManager.instance.post(url:Api.offSite, params: { - 'picUrl':state.imaglist - }); - if(data["code"]==200){ - Get.back(); - } - showOKToast(data["msg"]); - - } - - Future getImageFile() async { - checkPhotosStatus(); - try { - final XFile? pickedFile = await _picker.pickImage( - source: ImageSource.gallery, - ); - if(null==pickedFile){ - return; - } - SmartDialog.showLoading(); - uploadImage(quToken,pickedFile,CONFIG.USER_ALBUM_IMAGE,(result){ - SmartDialog.dismiss(force: true); - state.imaglist.add(result); - update(); - }); - } catch (_) { - } - } -} diff --git a/circle_app/lib/app/externalshare/state.dart b/circle_app/lib/app/externalshare/state.dart deleted file mode 100644 index 00a3fb1..0000000 --- a/circle_app/lib/app/externalshare/state.dart +++ /dev/null @@ -1,6 +0,0 @@ -class ExternalshareState { - ExternalshareState() { - ///Initialize variables - } - List imaglist = []; -} diff --git a/circle_app/lib/app/externalshare/view.dart b/circle_app/lib/app/externalshare/view.dart deleted file mode 100644 index 443e677..0000000 --- a/circle_app/lib/app/externalshare/view.dart +++ /dev/null @@ -1,261 +0,0 @@ -import 'package:circle_app/common/colors/app_color.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; - -import '../../components/my_app_bar.dart'; -import '../../router/app_routers.dart'; -import '../../util/util.dart'; -import 'logic.dart'; - -class ExternalsharePage extends StatelessWidget { - ExternalsharePage({Key? key}) : super(key: key); - - final logic = Get.find(); - final state = Get.find().state; - - @override - Widget build(BuildContext context) { - // _getFormat(context); - return GetBuilder(builder: (logic) { - return Container( - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage(getBaseImage("bg")), - fit: BoxFit.cover, - ), - ), - child: Scaffold( - backgroundColor: Colors.transparent, - appBar: const MyAppBar( - centerTitle: '站外分享', - ), - body: Container( - height: Get.height, - child: Stack( - children: [ - SingleChildScrollView( - child: Padding( - padding: const EdgeInsets.all(16.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "温馨提示:站外分享除了能享受'邀请有奖'的各种奖励,还能获得下述的奖励哦~", - style: TextStyle( - color: Colors.white, - fontSize: 16, - fontWeight: FontWeight.bold, - ), - ), - SizedBox(height: 18), - Text( - "奖励说明", - style: TextStyle( - color: Colors.white, - fontSize: 16.sp, - ), - ), - SizedBox(height: 8.sp), - buildRichText( - "1. 站外平台粉丝达到1000人以上,发新动态置顶一天,可获得1000小票;"), - SizedBox(height: 8.sp), - buildRichText("2. 邀请海报发到微信朋友圈或QQ动态(删除无效),可获得100小票;"), - SizedBox(height: 8.sp), - buildRichText( - "3. 分享到圈内群聊(QQ、微信、B站、快手、抖音、微博、推特或其他平台均有效),群里有多少人点击就获得多少小票。"), - SizedBox(height: 24.sp), - - buildRichText("*上传分享截图"), - SizedBox(height: 8.sp), - buildRichText("截图时间跟发布时间需要间隔1小时以上才有效", fontSize: 14.sp), - SizedBox(height: 8.sp), - Container( - height: 380.sp, - // margin: EdgeInsets.only(left: 16.sp, right: 16.sp), - child: GridView.builder( - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 3, // 每行显示的项目数量 - crossAxisSpacing: 10.sp, - mainAxisSpacing: 10.sp, - childAspectRatio: 1.0 - ), - itemCount: logic.state.imaglist.length < 9 - ? logic.state.imaglist.length + 1 - : logic.state.imaglist.length, - // Replace with your item count - itemBuilder: (context, index) { - if (index == 0 && - logic.state.imaglist.length < 9) { - // 第一个项目,显示固定的图片 - return GestureDetector( - onTap: () { - logic.getImageFile(); - }, - child: Container( - - child: Image( - fit: BoxFit.cover, - image: AssetImage( - getMineImage("icon_img_add"),), - ), - ), - ); - } else { - // 后续项目,根据接口获取数据 - // 假设通过接口获取到的数据存储在一个名为 data 的列表中 - // var itemData = data[index - 1]; // 减去第一个固定图片的索引 - return Container( - // margin: EdgeInsets.all(5.sp), - child: Center( - child: _buildImageItem( - logic.state.imaglist.length < 9 - ? logic.state.imaglist[index - 1] - : logic.state.imaglist[index], - // Replace with your item count - logic, - logic.state.imaglist.length < 9 - ? index - 1 - : index), - ), - ); - } - }, - ), - ), - ], - )), - ), - Positioned( - bottom: 0, - left: 20.sp, - right: 20.sp, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - //TODO 海报这版不做 - // Expanded( - // child: Container( - // margin: EdgeInsets.only(bottom: 35), - // child: ElevatedButton( - // onPressed: () { - // // TODO: 添加获取邀请海报的点击事件 - // }, - // style: ElevatedButton.styleFrom( - // primary: Color(0xFF21BEAB), - // shape: RoundedRectangleBorder( - // borderRadius: BorderRadius.circular(20), // 设置圆角的大小 - // ), - // ), - // child: Text( - // "获取邀请海报", - // style: TextStyle( - // color: Colors.white, - // fontSize: 12, - // ), - // ), - // ), - // ), - // ), - // SizedBox(width: 30.sp,), - - Expanded( - child: Container( - margin: EdgeInsets.only(bottom: 35, left: 20, right: 20), - child: ElevatedButton( - onPressed: () { - logic.updateExternalShare(); - }, - style: ElevatedButton.styleFrom( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(20), // 设置圆角的大小 - ), - padding: EdgeInsets.zero, // Remove default button padding - elevation: 0, // Remove button shad - backgroundColor: Colors.transparent, - primary: null, // Remove background color - ), - child: Ink( - decoration: BoxDecoration( - gradient:AppColor.mainVerLinearGradient, - borderRadius: BorderRadius.circular(20), // 设置圆角的大小 - ), - child: Container( - padding: EdgeInsets.symmetric(horizontal: 50, vertical: 10), - child: Text( - "提交奖励申请", - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - ), - ), - ), - ), - ), - ), - ), - - ], - ), - ), - ], - ), - ), - ), - ); - }); - } - - Widget _buildImageItem(String url, ExternalshareLogic logic, int index) { - return Stack( - children: [ - ClipRRect( - borderRadius: BorderRadius.circular(0.0), - child: Container( - width: double.infinity, // 设置容器宽度为屏幕宽度 - height: double.infinity, // 设置容器高度为屏幕高度 - child: ClipRRect( - borderRadius: BorderRadius.circular(0.0), - child: GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.Swiper, arguments: { - 'imaglist': logic.state.imaglist, - 'index': index - }); - }, - child: Image.network( - fit: BoxFit.cover, - url, - ), - ), - ), - ), - ), - Positioned( - top: 0, - right: 0, - child: GestureDetector( - onTap: () { - logic.state.imaglist.removeAt(index); - logic.update(); - }, - child: Image( - image: AssetImage(getMineImage("icon_img_del")), - width: 20.sp, - height: 20.sp, - ), - )) - ], - ); - } - - Widget buildRichText(String text, {double fontSize = 16}) { - return RichText( - text: TextSpan( - text: text, - style: TextStyle(color: Colors.white, fontSize: fontSize), - ), - ); - } -} diff --git a/circle_app/lib/app/feedback/binding.dart b/circle_app/lib/app/feedback/binding.dart deleted file mode 100644 index 3b0dd60..0000000 --- a/circle_app/lib/app/feedback/binding.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:get/get.dart'; - -import 'logic.dart'; - -class FeedbackBinding extends Bindings { - @override - void dependencies() { - Get.lazyPut(() => FeedbackLogic()); - } -} diff --git a/circle_app/lib/app/feedback/logic.dart b/circle_app/lib/app/feedback/logic.dart deleted file mode 100644 index fe1a5f1..0000000 --- a/circle_app/lib/app/feedback/logic.dart +++ /dev/null @@ -1,85 +0,0 @@ - -import 'package:circle_app/util/util.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; -import 'package:get/get.dart'; -import 'package:image_picker/image_picker.dart'; -import 'package:qiniu_flutter_sdk/qiniu_flutter_sdk.dart'; - -import '../../common/config.dart'; -import '../../network/api.dart'; -import '../../network/dio_manager.dart'; -import '../../util/qiniu.dart'; -import '../call_out/logic.dart'; -import 'state.dart'; - -class FeedbackLogic extends GetxController { - final FeedbackState state = FeedbackState(); - TextEditingController textEditingController = TextEditingController(); - final ImagePicker _picker = ImagePicker(); - var storage = Storage(); - var quToken = ''; - - @override - void onInit() async{ - super.onInit(); - var data = - await DioManager.instance.get(url: Api.getqiniuToken, params: {}); - var bean = BaseResponse.fromJson( - data, (data) => QnTokenData.fromJson(data)); - if(bean.isSuccess()){ - quToken = bean.data!.token.toString(); - } - } - - Future getImageFile() async { - checkPhotosStatus(); - try { - final XFile? pickedFile = await _picker.pickImage( - source: ImageSource.gallery, - ); - if(null==pickedFile){ - return; - } - SmartDialog.showLoading(); - uploadImage(quToken,pickedFile,CONFIG.USER_INFO_AVATAR,(result){ - SmartDialog.dismiss(force: true); - state.imaglist.add(result); - update(); - }); - } catch (_) { - } - } - - - getFeedBack() async{ - - if (textEditingController.text.isEmpty && state.imaglist.isEmpty) { - showOKToast('请输入反馈内容或者提交反馈图片'); - return; - } - - List myBean = []; - if (!state.imaglist.isEmpty) { - state.imaglist.forEach((element) { - myBean.add(MyBean(type: 1, url: element).toJson()); - }); - } - - textEditingController.text; - - var data = - await DioManager.instance.post(url: Api.getFeedBack, params: { - 'album': myBean, - 'content': textEditingController.text, - 'type':1 - }); - var bean = BaseResponse.fromJson(data, (jsonData) => jsonData,); - showOKToast(bean.msg); - if(bean.isSuccess()){ - Get.back(); - } - } - - -} diff --git a/circle_app/lib/app/feedback/state.dart b/circle_app/lib/app/feedback/state.dart deleted file mode 100644 index cd5cc51..0000000 --- a/circle_app/lib/app/feedback/state.dart +++ /dev/null @@ -1,7 +0,0 @@ -class FeedbackState { - FeedbackState() { - ///Initialize variables - } - String maxMsg = "0/200"; - List imaglist = []; -} diff --git a/circle_app/lib/app/feedback/view.dart b/circle_app/lib/app/feedback/view.dart deleted file mode 100644 index 2af5b1e..0000000 --- a/circle_app/lib/app/feedback/view.dart +++ /dev/null @@ -1,221 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; - -import '../../components/my_app_bar.dart'; -import '../../router/app_routers.dart'; -import '../../util/util.dart'; -import 'logic.dart'; - -class FeedbackPage extends StatelessWidget { - FeedbackPage({Key? key}) : super(key: key); - - final logic = Get.find(); - final state = Get.find().state; - - @override - Widget build(BuildContext context) { - return GetBuilder(builder: (FeedbackLogic controller) { - return GestureDetector( - onTap: () { - FocusManager.instance.primaryFocus?.unfocus(); - }, - child: Container( - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage(getBaseImage("home_back")), - fit: BoxFit.cover, - ), - ), - child: Scaffold( - backgroundColor: Colors.transparent, - appBar: const MyAppBar( - centerTitle: '意见反馈', - ), - body: SingleChildScrollView( - child: SafeArea( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Stack( - children: [ - Container( - height: 200, - margin: const EdgeInsets.symmetric( - horizontal: 16, vertical: 20), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(13), - color: const Color( - 0xFF4C3E5F), // Use your desired background color - ), - padding: EdgeInsets.all(13.sp), - child: TextField( - maxLength: 200, - controller: controller.textEditingController, - onChanged: (msg){ - - controller.state.maxMsg = '${msg.length}/200'; - controller.update(); - - - }, - decoration: InputDecoration( - hintText: '请补充详细问题和意见,我们会认真看完的哦~', - counterText: '', - - hintStyle: TextStyle( - color: const Color(0xFFB7BECC), fontSize: 14.sp), - border: InputBorder.none, - ), - maxLines: null, - inputFormatters: [ - LengthLimitingTextInputFormatter(200), - ], - style: const TextStyle(color: Colors.white), - ), - ), - Positioned( - right: 30.sp, - bottom: 30.sp, - child: Text( - controller.state.maxMsg, - style: const TextStyle(color: Colors.white), - )) - ], - ), - Container( - height: 120.sp, - margin: EdgeInsets.only(left: 16.sp, right: 16.sp), - child: GridView.builder( - gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 3, // 每行显示的项目数量 - ), - itemCount:controller.state.imaglist.length<3 ? controller.state.imaglist.length+1: controller.state.imaglist.length, // Replace with your item count - itemBuilder: (context, index) { - - if (index == 0&&controller.state.imaglist.length<3) { - // 第一个项目,显示固定的图片 - return GestureDetector( - onTap: () { - controller.getImageFile(); - }, - child: Container( - margin: EdgeInsets.all(5.sp), - child: Image( - image: - AssetImage(getMineImage("icon_img_add")), - ), - ), - ); - } else { - // 后续项目,根据接口获取数据 - // 假设通过接口获取到的数据存储在一个名为 data 的列表中 - // var itemData = data[index - 1]; // 减去第一个固定图片的索引 - return Container( - margin: EdgeInsets.all(5.sp), - child: Center( - child: _buildImageItem(controller.state.imaglist.length<3 ? - controller.state.imaglist[index-1]: controller.state.imaglist[index], // Replace with your item count - controller,controller.state.imaglist.length<3 ? index-1:index ), - ), - ); - } - }, - ), - ), - Padding( - padding: EdgeInsets.only(left: 16.sp, top: 10.sp), - child: Text( - '最多选择3张图片', - style: - TextStyle(color: const Color(0xFFB7BECC), fontSize: 12.sp), - ), - ), - SizedBox(height: 50.sp), - GestureDetector( - onTap: () { - // showToast("完善资料"); - controller.getFeedBack(); - // Get.toNamed(AppRoutes.Complete_materialPage, arguments: "user"); - // controller.onInit(); - }, - child: Center( - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(21.sp), - gradient: const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 14.sp, bottom: 14.sp, left: 95.sp, right: 95.sp), - child: Text( - "提交", - style: TextStyle( - color: Colors.white, - fontSize: 12.sp, - ), - ), - ), - ), - ), - ], - ), - ), - )), - ), - ); - }); - } - - Widget _buildImageItem(String url, FeedbackLogic controller, int index) { - return Stack( - children: [ - ClipRRect( - borderRadius: BorderRadius.circular(0.0), - child: SizedBox( - width: double.infinity, // 设置容器宽度为屏幕宽度 - height: double.infinity, // 设置容器高度为屏幕高度 - child: ClipRRect( - borderRadius: BorderRadius.circular(0.0), - child: GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.Swiper, arguments: { - 'imaglist': controller.state.imaglist, - 'index': index - }); - }, - child: Image.network( - fit: BoxFit.cover, - url, - ), - ), - ), - ), - ), - Positioned( - top: 0, - right: 0, - child: GestureDetector( - onTap: () { - controller.state.imaglist.removeAt(index); - controller.update(); - }, - child: Image( - image: AssetImage(getMineImage("icon_img_del")), - width: 20.sp, - height: 20.sp, - ), - )) - ], - ); - } - - -} diff --git a/circle_app/lib/app/friendslist/binding.dart b/circle_app/lib/app/friendslist/binding.dart deleted file mode 100644 index c0c2d09..0000000 --- a/circle_app/lib/app/friendslist/binding.dart +++ /dev/null @@ -1,12 +0,0 @@ -import 'package:circle_app/app/likelist/logic.dart'; -import 'package:get/get.dart'; - -import 'logic.dart'; - -class FriendslistBinding extends Bindings { - @override - void dependencies() { - Get.lazyPut(() => FriendslistLogic()); - Get.lazyPut(() => LikelistLogic()); - } -} diff --git a/circle_app/lib/app/friendslist/logic.dart b/circle_app/lib/app/friendslist/logic.dart deleted file mode 100644 index f36a7eb..0000000 --- a/circle_app/lib/app/friendslist/logic.dart +++ /dev/null @@ -1,239 +0,0 @@ - -import 'dart:async'; - -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:pull_to_refresh/pull_to_refresh.dart'; - -import '../../network/api.dart'; -import '../../network/dio_manager.dart'; -import '../../util/SharedPreferencesHelper.dart'; -import '../../util/eventBus.dart'; -import '../../util/util.dart'; -import 'state.dart'; - -class FriendslistLogic extends GetxController { - final RefreshController refreshController = RefreshController(); - final RefreshController eachRefreshController = RefreshController(); - final FriendslistState state = FriendslistState(); - StreamSubscription? subscription; - int page = 1; - int isVip = 0; - bool isLoad = true; - - int eachPage = 1; - - bool isEachLoad = true; - - bool isMore = true; - bool isEachMore = true; - - List lists = []; - - List eachlists = []; - - int sameCityCount = 0; - int wantMeetCount = 0; - String tip = ''; - - @override - void onClose() { - // TODO: implement onClose - super.onClose(); - subscription?.cancel(); - } - - @override - void onInit() async { - super.onInit(); - loadTotal(Get.arguments + 1); - SharedPreferencesHelper.getInstance().then((sharedPreferences) { - isVip = sharedPreferences.getInt(SharedPreferencesHelper.VIP); - }); - subscription = EventBusManager.on().listen((event) { - isVip = event.vip; - update(); - }); - initList(); - initEachList(); - } - void dispose() { - refreshController.dispose(); - eachRefreshController.dispose(); - super.dispose(); - - } - - loadTotal(int type) async { - var data = await DioManager.instance - .get(url: Api.getFollowTotal+type.toString()); - if (data['code'] == 200) { - sameCityCount = data['data']['sameCityCount']; - wantMeetCount = data['data']['wantMeetCount']; - if (sameCityCount > 0 && wantMeetCount > 0) { - tip = '${sameCityCount}人和你同城,${wantMeetCount}人是你想认识的圈友'; - } else if (sameCityCount > 0) { - tip = '${sameCityCount}人和你同城'; - } else if (wantMeetCount > 0) { - tip = '${wantMeetCount}人是你想认识的圈友'; - } else { - tip = ''; - } - update(); - } - } - - initList() async { - var data = await DioManager.instance - .get(url: Api.followList, params: {'page': page,'page_size':10}); - var bean = BaseResponse.fromJson(data, (data) => User.fromJson(data)); - if (page == 1) { - refreshController.refreshCompleted(); - refreshController.resetNoData(); - lists.clear(); - isMore = true; - } else { - refreshController.loadComplete(); - } - if (bean.isSuccess()) { - List dataList = bean.data.lists; - if (dataList.isNotEmpty) { - lists.addAll(bean.data.lists); - if (dataList.length != 10) { - refreshController.loadNoData(); - isMore = false; - } - } else { - refreshController.loadNoData(); - isMore = false; - } - } - isLoad = false; - update(); - - } - - sendCallMyFollowData() async { - var data = await DioManager.instance - .post(url: Api.callMyFollow); - if (data['code'] == 200) { - showOKToast('召唤喜欢操作成功'); - } - } - - initEachList() async { - var data = await DioManager.instance - .get(url: Api.mutualUsers, params: {'page': eachPage,'page_size':10}); - var bean = BaseResponse.fromJson(data, (data) => User.fromJson(data)); - if (eachPage == 1) { - eachRefreshController.refreshCompleted(); - eachRefreshController.resetNoData(); - eachlists.clear(); - isEachMore = true; - } else { - eachRefreshController.loadComplete(); - } - if (bean.isSuccess()) { - List dataList = bean.data.lists; - if (dataList.isNotEmpty) { - eachlists.addAll(bean.data.lists); - if (dataList.length != 10) { - eachRefreshController.loadNoData(); - isEachMore = false; - } - } else { - isEachMore = false; - eachRefreshController.loadNoData(); - } - } - isEachLoad = false; - update(); - - } - - - setLike(int index) async { - var data = await DioManager.instance.post( - url: "${Api.setLike + lists[index].id.toString()}/follow", - params: {'status': lists[index].isLike? "0" : "1"}); - var bean = BaseResponse.fromJson( - data, - (jsonData) => jsonData, - ); - if (bean.isSuccess()) { - lists[index].isLike = !lists[index].isLike; - update(); - } - showOKToast(bean.msg); - } -} - -class User { - final List lists; - final int total; - - User({required this.lists, required this.total}); - - factory User.fromJson(Map json) { - final List userList = json['lists']; - final List users = - userList.map((user) => UserInfo.fromJson(user)).toList(); - final int total = json['total']; - return User(lists: users, total: total); - } -} - -class UserInfo { - final int id; - final String nickname; - final String avatar; - final String signature; - final String birthday; - final int age; - final int vip; - final int gender; - final int role; - final int orientation; - bool isLike = true; - final double lng; - final double lat; - final String city; - final String avatarThumb; - - UserInfo({ - required this.id, - required this.nickname, - required this.avatar, - required this.signature, - required this.birthday, - required this.age, - required this.vip, - required this.gender, - required this.role, - required this.orientation, - this.isLike = true, - required this.lng, - required this.lat, - required this.city, - required this.avatarThumb, - }); - - factory UserInfo.fromJson(Map json) { - return UserInfo( - id: json['id'], - nickname: json['nickname'], - avatar: json['avatar'], - signature: json['signature'], - birthday: json['birthday'], - age: json['age'], - vip: json['vip'], - gender: json['gender'], - role: json['role'], - orientation: json['orientation'], - lng: json['lng'], - lat: json['lat'], - city: json['city'], - avatarThumb: json['avatar_thumb'], - ); - } -} diff --git a/circle_app/lib/app/friendslist/state.dart b/circle_app/lib/app/friendslist/state.dart deleted file mode 100644 index 5c2bd6a..0000000 --- a/circle_app/lib/app/friendslist/state.dart +++ /dev/null @@ -1,5 +0,0 @@ -class FriendslistState { - FriendslistState() { - ///Initialize variables - } -} diff --git a/circle_app/lib/app/friendslist/view.dart b/circle_app/lib/app/friendslist/view.dart deleted file mode 100644 index a3c29b0..0000000 --- a/circle_app/lib/app/friendslist/view.dart +++ /dev/null @@ -1,560 +0,0 @@ -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:circle_app/app/likelist/view.dart'; -import 'package:circle_app/common/colors/app_color.dart'; -import 'package:circle_app/util/eventBus.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:pull_to_refresh/pull_to_refresh.dart'; - -import '../../common/Widgets/base_tip_widget.dart'; -import '../../components/my_app_bar.dart'; -import '../../router/app_routers.dart'; -import '../../util/util.dart'; -import '../circle/view.dart'; -import '../circle_list/logic.dart'; -import '../home/logic.dart'; -import 'logic.dart'; - -class FriendslistPage extends StatefulWidget { - FriendslistPage({Key? key}) : super(key: key); - - @override - State createState() => _FriendslistPageState(); -} - -class _FriendslistPageState extends State - with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin { - final logic = Get.find(); - - final state = Get.find().state; - - late TabController _tabController; - - @override - bool get wantKeepAlive => true; - @override - void initState() { - // TODO: implement initState - super.initState(); - _tabController = - TabController(length: 3, vsync: this, initialIndex: Get.arguments); - _tabController.addListener(() { - if (_tabController.indexIsChanging) { - logic.loadTotal(_tabController.index + 1); - } - }); - } - - @override - Widget build(BuildContext context) { - return GetBuilder(builder: (logic) { - return Container( - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage(getBaseImage("home_back")), - fit: BoxFit.cover, - ), - ), - child: Scaffold( - backgroundColor: Colors.transparent, - appBar: MyAppBar( - diyTitleWdiget: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - TabBar( - isScrollable: true, - controller: _tabController, - labelPadding: EdgeInsets.symmetric(horizontal: 8.0.sp), - indicator: UnderlineTabIndicator( - borderSide: BorderSide( - color: const Color(0xFF00FFF4), - ), - ), - indicatorColor: const Color(0xFF00FFF4), - indicatorWeight: 2.sp, - labelColor: const Color(0xFF00FFF4), - unselectedLabelColor: const Color(0xB3FFFFFF), - indicatorSize: TabBarIndicatorSize.label, - indicatorPadding: - EdgeInsets.only(left: 20.sp, right: 20.sp, bottom: 8.sp), - tabs: [ - Tab( - child: Text( - '互相喜欢', - style: TextStyle( - fontSize: 15.sp, - ), - ), - ), - Tab( - child: Text( - '我喜欢的', - style: TextStyle( - fontSize: 15.sp, - ), - ), - ), - Tab( - child: Text( - '喜欢我的', - style: TextStyle( - fontSize: 15.sp, - ), - ), - ), - ], - labelStyle: TextStyle( - color: const Color(0xFF00FFF4), - fontSize: 15.sp, - shadows: [ - Shadow( - color: const Color(0xFFF657FF).withOpacity(0.5), - offset: Offset(0, -2), // 阴影偏移 - blurRadius: 3, // 阴影模糊半径 - // spreadRadius: 0 - ), - ], - ), - unselectedLabelStyle: TextStyle( - // color: const Color(0xB3FFFFFF), - fontSize: 15.sp, - shadows: [ - Shadow( - // color: const Color(0xFFF657FF), - offset: const Offset(0, -1), - blurRadius: 3.0.sp, - ), - ], - ), - onTap: (index) {}, - ), - ], - ), - actionWdiget: GestureDetector( - onTap: () { - if (logic.isVip == 2) { - if (logic.lists.isEmpty) { - showOKToast('您还没有喜欢的人哦,可以前往感兴趣的圈子寻找喜欢的人'); - } else { - logic.sendCallMyFollowData(); - } - } else { - showOKToast('成为年会员后可以一键召唤喜欢的人哦~'); - showOepnVipDialog(); - } - }, - child: Container( - height: 20.sp, - alignment: Alignment.center, - padding: EdgeInsets.only(left: 4.sp, right: 4.sp), - decoration: BoxDecoration( - gradient: AppColor.mainVerLinearGradient, - borderRadius: BorderRadius.circular(10.sp)), - child: Text( - '召唤喜欢', - style: TextStyle(color: Colors.black, fontSize: 10.sp), - ), - ), - ), - ), - body: Column( - children: [ - if (logic.tip.isNotEmpty) - Container( - margin: EdgeInsets.only( - bottom: 5.sp, - ), - child: RichText( - text: TextSpan( - children: [ - if (logic.sameCityCount > 0) - TextSpan( - text: '${logic.sameCityCount}', - style: TextStyle( - color: AppColor.mainColor, fontSize: 14.0), - ), - if (logic.sameCityCount > 0) - TextSpan( - text: '人和你同城', - style: - TextStyle(color: Colors.white, fontSize: 14.0), - ), - if (logic.sameCityCount > 0 && logic.wantMeetCount > 0) - TextSpan( - text: ',', - style: - TextStyle(color: Colors.white, fontSize: 14.0), - ), - if (logic.wantMeetCount > 0) - TextSpan( - text: '${logic.wantMeetCount}', - style: TextStyle( - color: AppColor.mainColor, - fontSize: 14.0, - fontWeight: FontWeight.bold), - ), - if (logic.wantMeetCount > 0) - TextSpan( - text: '人是你想认识的类型', - style: - TextStyle(color: Colors.white, fontSize: 14.0), - ), - ], - ), - ), - ), - Expanded( - child: TabBarView( - children: [ - eachtherLiveWidget(), - myLiveWidget(), - LikelistPage() - ], - controller: _tabController, - ), - ), - ], - ), - ), - ); - }); - } - - Widget eachtherLiveWidget() { - return SafeArea( - child: logic.isEachLoad - ? loaddingWidget(true) - : logic.eachlists.isEmpty - ? Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - noResultWidget(), - SizedBox( - height: 10.sp, - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - GestureDetector( - onTap: () async { - HomeLogic homelogic = Get.find(); - Get.back(); - Future.delayed(Duration(milliseconds: 300), () { - homelogic.updateIndex(0); - EventBusManager.fire(ChangeIndex(1)); - }); - }, - child: Container( - padding: EdgeInsets.only(left: 15.sp, right: 15.sp), - height: 28.sp, - decoration: BoxDecoration( - gradient: AppColor.mainVerLinearGradient, - borderRadius: BorderRadius.circular(14), - ), - child: Center( - child: Text('发现更多的喜欢', - style: TextStyle( - fontSize: 14.sp, color: Colors.white)), - ), - ), - ), - ], - ), - ], - ) - : SmartRefresher( - controller: logic.eachRefreshController, - onRefresh: _onEachRefresh, - onLoading: _onEachLoading, - enablePullUp: true, - child: ListView.builder( - padding: EdgeInsets.all(10.sp), - itemCount: logic.eachlists.length, - itemBuilder: (context, index) { - return ListItem(logic.eachlists[index], index, 0); - }, - ), - ), - ); - } - - Widget myLiveWidget() { - return SafeArea( - child: logic.isLoad - ? loaddingWidget(true) - : logic.lists.isEmpty - ? Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - noResultWidget(), - SizedBox( - height: 10.sp, - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - GestureDetector( - onTap: () async { - HomeLogic homelogic = Get.find(); - Get.back(); - Future.delayed(Duration(milliseconds: 300), () { - homelogic.updateIndex(1); - LikeLogic likeLogic = Get.find(); - likeLogic.currentIndex = -2; - likeLogic.update(); - }); - }, - child: Container( - padding: EdgeInsets.only(left: 15.sp, right: 15.sp), - height: 28.sp, - decoration: BoxDecoration( - gradient: AppColor.mainVerLinearGradient, - borderRadius: BorderRadius.circular(14), - ), - child: Center( - child: Text('看看喜欢的人在哪些圈子发布喊话', - style: TextStyle( - fontSize: 14.sp, color: Colors.white)), - ), - ), - ), - ], - ), - ], - ) - : SmartRefresher( - controller: logic.refreshController, - onRefresh: _onRefresh, - onLoading: _onLoading, - enablePullUp: true, - child: ListView.builder( - padding: EdgeInsets.all(10.sp), - itemCount: logic.lists.length, - itemBuilder: (context, index) { - return ListItem(logic.lists[index], index, 1); - }, - ), - ), - ); - } - - Widget ListItem(UserInfo item, int index, int type) { - String noMoreaction = ''; - if (type == 0) { - noMoreaction = '发现更多的喜欢'; - } else if (type == 1) { - noMoreaction = '看看喜欢的人在哪些圈子发布喊话'; - } - - return Column( - children: [ - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - Get.toNamed(AppRoutes.UserInfoActivity, - arguments: item.id.toString()); - }, - child: Container( - margin: const EdgeInsets.only(bottom: 21), - child: Row( - children: [ - Stack( - children: [ - ClipOval( - child: CachedNetworkImage( - fit: BoxFit.cover, - imageUrl: item.avatarThumb, - width: 53.sp, - height: 53.sp, - ), - ), - Positioned( - right: 0, - left: 0, - bottom: 0, - child: item.vip > 0 - ? Image( - image: AssetImage(getBaseImage( - item.vip == 1 ? "vip" : 'year_vip')), - width: 44.sp, - height: 18.sp, - ) - : Container(), - ) - ], - ), - SizedBox(width: 10.sp), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Text( - item.nickname, - style: const TextStyle( - color: Colors.white70, - fontSize: 14, - fontWeight: FontWeight.bold), - ), - SizedBox(width: 4.sp), - // SizedBox(height: 8.sp), - _buildInfoRow(item), - // Placeholder image - ], - ), - SizedBox(height: 8.sp), - SizedBox( - width: 200.sp, - child: Text( - item.signature, - overflow: TextOverflow.ellipsis, // 超出部分使用省略号表示 - maxLines: 1, - style: TextStyle( - fontSize: 12.sp, color: const Color(0xFFB7BECC)), - ), - ), - ], - ), - // Pla - const Spacer(), - GestureDetector( - onTap: () { - logic.setLike(index); - }, - child: Container( - width: 75, - height: 28, - decoration: BoxDecoration( - color: const Color(0xFFFF4D7C), - borderRadius: BorderRadius.circular(14), - ), - child: Center( - child: Text(item.isLike ? "取消喜欢" : "喜欢", - style: - TextStyle(fontSize: 14.sp, color: Colors.white)), - ), - ), - ), - ], - ), - ), - ), - if (type == 0 && - !logic.isEachMore && - index == logic.eachlists.length - 1) - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - GestureDetector( - onTap: () async { - HomeLogic homelogic = Get.find(); - if (type == 0) { - Get.back(); - Future.delayed(Duration(milliseconds: 300), () { - homelogic.updateIndex(0); - EventBusManager.fire(ChangeIndex(1)); - }); - } - }, - child: Container( - padding: EdgeInsets.only(left: 15.sp, right: 15.sp), - height: 28.sp, - decoration: BoxDecoration( - gradient: AppColor.mainVerLinearGradient, - borderRadius: BorderRadius.circular(14), - ), - child: Center( - child: Text(noMoreaction, - style: TextStyle(fontSize: 14.sp, color: Colors.white)), - ), - ), - ), - ], - ), - if (type == 1 && !logic.isMore && index == logic.lists.length - 1) - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - GestureDetector( - onTap: () async { - HomeLogic homelogic = Get.find(); - Get.back(); - Future.delayed(Duration(milliseconds: 300), () { - homelogic.updateIndex(1); - LikeLogic likeLogic = Get.find(); - likeLogic.currentIndex = -2; - likeLogic.update(); - }); - }, - child: Container( - padding: EdgeInsets.only(left: 15.sp, right: 15.sp), - height: 28.sp, - decoration: BoxDecoration( - gradient: AppColor.mainVerLinearGradient, - borderRadius: BorderRadius.circular(14), - ), - child: Center( - child: Text(noMoreaction, - style: TextStyle(fontSize: 14.sp, color: Colors.white)), - ), - ), - ), - ], - ) - ], - ); - } - - Widget _buildInfoRow(UserInfo userInfoBean) { - String ageMsg = getAgeCOntent(userInfoBean.gender, userInfoBean.age, - userInfoBean.role, userInfoBean.orientation); - return Row( - children: [ - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color.fromRGBO(141, 255, 248, 1.0), - Color.fromRGBO(181, 211, 255, 1.0), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 2.sp, bottom: 2.sp, left: 10.sp, right: 10.sp), - child: Text( - ageMsg, - style: TextStyle( - color: Colors.black, - fontSize: 10.sp, - ), - ), - ), - SizedBox(width: 6.sp), - ], - ); - } - - void _onRefresh() async { - logic.page = 1; - logic.initList(); - } - - void _onLoading() async { - logic.page = logic.page + 1; - logic.initList(); - } - - void _onEachRefresh() async { - logic.eachPage = 1; - logic.initEachList(); - } - - void _onEachLoading() async { - logic.eachPage = logic.eachPage + 1; - logic.initEachList(); - } -} diff --git a/circle_app/lib/app/gift_shop/binding.dart b/circle_app/lib/app/gift_shop/binding.dart deleted file mode 100644 index 306e787..0000000 --- a/circle_app/lib/app/gift_shop/binding.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:get/get.dart'; - -import 'logic.dart'; - -class Gift_shopBinding extends Bindings { - @override - void dependencies() { - Get.lazyPut(() => Gift_shopLogic()); - } -} diff --git a/circle_app/lib/app/gift_shop/logic.dart b/circle_app/lib/app/gift_shop/logic.dart deleted file mode 100644 index b24a5b5..0000000 --- a/circle_app/lib/app/gift_shop/logic.dart +++ /dev/null @@ -1,93 +0,0 @@ -import 'package:get/get.dart'; -import 'package:circle_app/network/api.dart'; -import 'package:circle_app/network/dio_manager.dart'; -import 'package:circle_app/util/util.dart'; - -import '../../common/Widgets/base_tip_widget.dart'; -import '../../components/func_widget.dart'; -import '../../util/SharedPreferencesHelper.dart'; - -class Gift_shopLogic extends GetxController { - String userId = Get.arguments; - - List giftList = []; - - List recevigiftList = []; - - int total = 0; - String topTitle = ''; - Map toUser = {}; - - String accid = ''; - - @override - void onInit() { - // TODO: implement onInit - super.onInit(); - loadGiftListData(); - } - - loadGiftListData() async { - var result = await DioManager.instance.get(url: Api.giftList); - if (result['code'] == 200) { - giftList = result['data']; - loadData(); - } - } - - void loadData() async { - SharedPreferencesHelper sp = await SharedPreferencesHelper.getInstance(); - String myId = sp.getMyUserId(); - - var result = await DioManager.instance.get( - url: userId.toString().isNotEmpty ? Api.giftHall + userId : Api.giftHall + myId, - ); - if (result['code'] == 200) { - topTitle = result['data']['topDesc']; - toUser = result['data']['topUser'] ?? {}; - total = result['data']['receiveTotal']; - // "accid" -> "ky_dev_30629" - accid = result['data']['imId']; - // receiveGiftNum - recevigiftList = result['data']['receiveGiftNum']; - if (recevigiftList.isNotEmpty) { - var receiveList = []; - var noreceiveList = []; - giftList.forEach((element) { - bool isContain = false; - for (var info in recevigiftList) { - if (element['id'] == info['giftId']) { - isContain = true; - } - } - if (isContain) { - receiveList.add(element); - } else { - noreceiveList.add(element); - } - }); - receiveList.addAll(noreceiveList.reversed.toList()); - giftList = receiveList; - update(); - } - update(); - } - } - - void sendGiftData(String accid, String giftId, String userId, int index, - String discoverId) async { - var result = await DioManager.instance.post(url: Api.sendGift, params: { - 'accid': accid, - 'giftId': giftId, - 'num': 1, - 'toUserId': userId - }); - if (result['code'] == 200) { - showOKToast('赠送成功'); - loadData(); - } else if (result['code'] == 31201) { - showOKToast(result['msg']); - showRechargeScreenDialog(); - } - } -} diff --git a/circle_app/lib/app/gift_shop/view.dart b/circle_app/lib/app/gift_shop/view.dart deleted file mode 100644 index 2df1591..0000000 --- a/circle_app/lib/app/gift_shop/view.dart +++ /dev/null @@ -1,359 +0,0 @@ -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:circle_app/components/my_app_bar.dart'; -import 'package:circle_app/util/util.dart'; - -import '../../common/colors/app_color.dart'; -import '../../common/values/values.dart'; -import '../../components/func_widget.dart'; -import '../../router/app_routers.dart'; -import 'logic.dart'; - -class Gift_shopPage extends StatelessWidget { - Gift_shopPage({ - Key? key, - }) : super(key: key); - - final logic = Get.find(); - - @override - Widget build(BuildContext context) { - return GetBuilder(builder: (logic) { - return Scaffold( - backgroundColor: Colors.black, - appBar: MyAppBar( - centerTitle: logic.userId.isNotEmpty ? 'Ta的礼物墙' : '我的礼物墙', - actionWdiget: logic.userId.isNotEmpty - ? Container() - : GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.BillActivity,arguments: 2); - }, - child: Text( - '账单', - style: TextStyle(color: Colors.white, fontSize: 14.sp), - ), - ), - ), - body: SingleChildScrollView( - child: Column( - children: [ - //贡献之星 - topStartWidget(), - //收到的礼物 - receverGiftWidget() - ], - ), - ), - ); - }); - } - - topStartWidget() { - return Container( - width: Get.width, - height: 160.sp, - child: Stack( - alignment: Alignment.center, - children: [ - if (logic.toUser.isEmpty) - Container( - width: Get.width - 32.sp, - child: Stack( - alignment: Alignment.center, - children: [ - Image.asset( - getMineImage('gift_no_data_bg'), - width: Get.width - 32.sp, - fit: BoxFit.fill, - ), - Positioned( - left: 20.sp, - child: Image.asset( - getMineImage('gift_no_data'), - width: 48.sp, - )), - Text( - '贡献之星正在来得路上~', - style: TextStyle(color: Colors.white, fontSize: 15.sp), - ), - ], - ), - ), - if (logic.toUser.isNotEmpty) userItem(), - Positioned( - top: 0.sp, - child: Stack( - alignment: Alignment.center, - children: [ - Image.asset( - getMineImage('gift_top_star'), - width: 140.sp, - ), - Container( - margin: EdgeInsets.only(top: 10.sp), - child: Text( - logic.topTitle + '贡献之星', - style: TextStyle(color: Colors.white, fontSize: 15.sp), - ), - ) - ], - )) - ], - ), - ); - } - - userItem() { - return Container( - height: 160.sp, - child: Stack( - alignment: Alignment.center, - children: [ - ClipRRect( - borderRadius: BorderRadius.circular(6.sp), - child: Stack( - children: [ - Image.network( - logic.toUser['avatar'] ?? - 'https://qiniuyun.ikuayou.com/avatar/default/default_header.png', - width: Get.width - 32.sp, - height: 100.sp, - fit: BoxFit.cover, - ), - Container(color: Colors.black.withOpacity(0.75), width: Get.width - 32.sp, - height: 100.sp,) - ], - ) - ), - GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.UserInfoActivity,arguments: logic.toUser['id'].toString()); - }, - child: Container( - padding: EdgeInsets.only(left: 32.sp), - child: Row( - children: [ - ClipOval( - child: CachedNetworkImage( - fit: BoxFit.cover, - imageUrl: logic.toUser['avatar'] ?? - 'https://qiniuyun.ikuayou.com/avatar/default/default_header.png', - width: 45.sp, - height: 45.sp, - ), - ), - SizedBox(width: 10.sp), - Container( - margin: EdgeInsets.only(top: 55.sp), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Container( - constraints: BoxConstraints( - maxWidth: 120.sp, - ), - child: Text( - logic.toUser['nickname'], - overflow: TextOverflow.ellipsis, - maxLines: 1, - style: TextStyle( - color: logic.toUser['vip'] > 0 - ? Color(0xffDE0049) - : Colors.white, - fontSize: 16.sp, - fontWeight: FontWeight.bold), - ), - ), - SizedBox(width: 4.sp), - if (logic.toUser.isNotEmpty) - _buildInfoRow(), - ], - ), - SizedBox(height: 6.sp), - Container( - width: 250.sp, - child: Text( - '${logic.topTitle}送了${logic.toUser['giftNum']['num']}个礼物,价值${logic.toUser['giftNum']['amount']}跨豆', - style: - TextStyle(fontSize: 13.sp, color: Colors.white), - ), - ), - ], - ), - ), - ], - ), - ), - ) - ], - ), - ); - } - - Widget _buildInfoRow() { - String ageMsg = logic.toUser['genderDesc']; - - return Row( - children: [ - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color.fromRGBO(141, 255, 248, 1.0), - Color.fromRGBO(181, 211, 255, 1.0), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 2.sp, - bottom: 2.sp, - left: 10.sp, - right: 10.sp, - ), - child: Text( - ageMsg, - style: const TextStyle( - color: Colors.black, - fontSize: 10, - ), - ), - ), - const SizedBox(width: 6), - if (logic.toUser['vip'] > 0) - Image( - image: AssetImage( - getBaseImage(logic.toUser['vip'] == 1 ? "vip" : 'year_vip')), - width: 44.sp, - height: 18.sp, - ), - ], - ); - } - - receverGiftWidget() { - return Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - margin: EdgeInsets.only(left: 16.sp, bottom: 15.sp), - child: Text( - '收到的礼物 (${logic.total}个)', - style: TextStyle(color: Colors.white, fontSize: 15.sp), - ), - ), - Container( - width: Get.width, - height: 505.sp, - padding: EdgeInsets.only(left: 16.sp, right: 16.sp), - child: GridView.builder( - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 3, - crossAxisSpacing: 8.0.sp, - mainAxisSpacing: 8.0.sp, - childAspectRatio: 0.75, - ), - itemCount: logic.giftList.length, - // Replace with the actual item count - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - itemBuilder: (context, index) { - // Replace the placeholders with the actual item widgets - return giftItemWidget(logic.giftList[index], index); - }, - )) - ]); - } - - giftItemWidget(Map info, int index) { - bool isGet = false; - int num = 0; - logic.recevigiftList.forEach((element) { - if (element['giftId'] == info['id']) { - isGet = true; - num = element['num']; - } - }); - - double price = info['price']; - - return GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () {}, - child: Container( - height: 105.sp, - decoration: BoxDecoration( - color: isGet ? Color(0x8F3E3D4C) : Color(0x0f2836FF), - borderRadius: BorderRadius.circular(4.sp), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Opacity( - opacity: isGet ? 1 : 0.75, - child: Image.network( - info['icon'], - width: 60.sp, - height: 60.sp, - fit: BoxFit.cover, - ), - ), - SizedBox( - height: 5.sp, - ), - Text(num > 0 ? info['name'] + 'x' + getGiftCountValue(num).toString() : info['name'], - style: TextStyle( - color: isGet ? Colors.white : Color(0x898F99FF), - fontSize: 13.sp, - fontWeight: FontWeight.w500)), - GestureDetector( - onTap: () { - if (logic.userId.isEmpty) { - logic.sendGiftData(logic.accid, info['id'].toString(), - logic.accid.split('_').last, index, ''); - } else { - logic.sendGiftData(logic.accid, info['id'].toString(), - logic.userId, index, ''); - } - - }, - child: Container( - height: 20.sp, - width: 52.sp, - margin: EdgeInsets.only(top: 10.sp), - // padding: EdgeInsets.only(left: 5.sp,right: 5.sp), - alignment: Alignment.center, - decoration: BoxDecoration( - gradient: AppColor.mainVerLinearGradient, - borderRadius: BorderRadius.circular(10.sp)), - child: Text( - !isGet ? '点亮' : '赠送', - style: TextStyle(color: Colors.white, fontSize: 11.sp), - ), - ), - ) - ], - ), - ), - ); - } -} - - - -getGiftCountValue(int value) { - if (value >= 10000) { - double populartityValue = value / 10000; - return '${populartityValue.toStringAsFixed(1)}W'; - } if (value >= 1000) { - double populartityValue = value / 1000; - return '${populartityValue.toStringAsFixed(1)}K'; - } else { - return value; - } -} diff --git a/circle_app/lib/app/good_reviews/binding.dart b/circle_app/lib/app/good_reviews/binding.dart deleted file mode 100644 index bec7ef1..0000000 --- a/circle_app/lib/app/good_reviews/binding.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:get/get.dart'; - -import 'logic.dart'; - -class Good_reviewsBinding extends Bindings { - @override - void dependencies() { - Get.lazyPut(() => Good_reviewsLogic()); - } -} diff --git a/circle_app/lib/app/good_reviews/logic.dart b/circle_app/lib/app/good_reviews/logic.dart deleted file mode 100644 index c7b73c0..0000000 --- a/circle_app/lib/app/good_reviews/logic.dart +++ /dev/null @@ -1,79 +0,0 @@ -import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; -import 'package:get/get.dart'; -import 'package:image_picker/image_picker.dart'; -import 'package:circle_app/common/config.dart'; -import 'package:circle_app/network/api.dart'; -import 'package:circle_app/network/dio_manager.dart'; -import 'package:circle_app/util/qiniu.dart'; -import 'package:circle_app/util/util.dart'; - -class Good_reviewsLogic extends GetxController { - - List imgUrl = []; - List tipImgUrl = []; - final ImagePicker _picker = ImagePicker(); - var quToken = ''; - - @override - void onInit() { - // TODO: implement onInit - super.onInit(); - loadToken(); - loadTipImgUrl(); - } - - Future getImageFile() async { - try { - - final XFile? pickedFile = await _picker.pickImage( - source: ImageSource.gallery, - ); - if (null == pickedFile) { - return; - } - - SmartDialog.showLoading(); - uploadImage(quToken, pickedFile, CONFIG.USER_INFO_AVATAR, (result) async { - imgUrl.add(result); - update(); - SmartDialog.dismiss(); - }); - } catch (e) {} - } - - void loadTipImgUrl() async { - // var result = - // await DioManager.instance.get(url: 'Api.queryPositiveFeesBackExample', params: {}); - // if (result['code'] == 10000) { - // List list = result['list']; - // for (var element in list) { - // tipImgUrl.add(element); - // } - // update(); - // } - } - - void loadToken() async { - var qiniudata = - await DioManager.instance.get(url: Api.getqiniuToken, params: {}); - - if (qiniudata['code'] == 200) { - quToken = qiniudata['data']['token'].toString(); - } - } - - void sendGoodReview() async { - var albumList = []; - for (var url in imgUrl) { - Map info = {'type':1,'url':url}; - albumList.add(info); - } - var result = - await DioManager.instance.post(url: Api.getFeedBack, params: {'type':2,'album':albumList}); - if (result['code'] == 200) { - showOKToast('提交成功,等待审核'); - Get.back(); - print(result); - } - } -} diff --git a/circle_app/lib/app/good_reviews/view.dart b/circle_app/lib/app/good_reviews/view.dart deleted file mode 100644 index d3efa3e..0000000 --- a/circle_app/lib/app/good_reviews/view.dart +++ /dev/null @@ -1,163 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:circle_app/components/my_app_bar.dart'; -import 'package:circle_app/router/app_routers.dart'; -import 'package:circle_app/util/util.dart'; - -import 'logic.dart'; - -class Good_reviewsPage extends StatelessWidget { - Good_reviewsPage({Key? key}) : super(key: key); - - final logic = Get.find(); - - @override - Widget build(BuildContext context) { - return GetBuilder(builder: (logic) { - List widgets = []; - List tipwidgets = []; - if (logic.imgUrl.isEmpty) { - widgets.add(GestureDetector( - onTap: () { - logic.getImageFile(); - }, - child: Image.asset( - getMineImage( - 'icon_upload', - ), - width: 100.sp, - ), - )); - } else { - for (var element in logic.imgUrl) { - widgets.add(Stack( - children: [ - ClipRRect( - borderRadius: BorderRadius.circular(8.sp), - child: Image.network( - element, - width: 100.sp, - height: 100.sp, - fit: BoxFit.cover, - )), - Positioned( - top: 0, - right: 0, - child: GestureDetector( - onTap: () { - // showToast("删除"); - logic.imgUrl.remove(element); - logic.update(); - }, - child: Image( - image: AssetImage(getMineImage("icon_img_del")), - width: 20.sp, - height: 20.sp, - ), - )) - ], - )); - widgets.add(SizedBox(width: 10.sp,)); - } - - if (logic.imgUrl.length < 3) { - widgets.add(GestureDetector( - onTap: () { - logic.getImageFile(); - }, - child: Image.asset( - getMineImage( - 'icon_upload', - ), - width: 100.sp, - ), - )); - } - } - - for (var element in logic.tipImgUrl) { - tipwidgets.add( - GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.Swiper,arguments: { - 'imaglist': logic.tipImgUrl, - 'index': logic.tipImgUrl.indexOf(element) - }); - }, - child: ClipRRect( - borderRadius: BorderRadius.circular(8.sp), - child: Image.network( - element, - width: 100.sp, - height: 100.sp, - fit: BoxFit.cover, - )), - ), - ); - tipwidgets.add(SizedBox(width: 10.sp,)); - } - - return Scaffold( - backgroundColor: Colors.black, - appBar: MyAppBar( - centerTitle: '反馈截图', - actionWdiget: GestureDetector( - onTap: () { - if (logic.imgUrl.isEmpty) { - showOKToast('请上传评价截图:(至少一张)'); - } else { - logic.sendGoodReview(); - } - }, - child: Text( - '提交', - style: TextStyle(color: Colors.white, fontSize: 16.sp), - ), - ), - ), - body: Padding( - padding: EdgeInsets.only(left: 15.sp, right: 15.sp, top: 15.sp), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - '感谢您的支持,请填写评价反馈,我们将在您提交反馈之后的24小时之内核实并发放奖励。', - style: TextStyle(color: Color(0xFFF7FAFA), fontSize: 16.sp), - ), - SizedBox( - height: 12.sp, - ), - Text( - '请上传评价截图:(至少一张)', - style: TextStyle(color: Color(0xFFF7FAFA), fontSize: 16.sp), - ), - Container( - margin: EdgeInsets.only(top: 10), - height: 100.sp, - child: Row( - children: widgets, - ), - ), - // SizedBox( - // height: 20.sp, - // ), - // - // Text( - // '示例:', - // style: TextStyle(color: Color(0xFFF7FAFA), fontSize: 14.sp), - // ), - // Container( - // margin: EdgeInsets.only(top: 10), - // height: 100.sp, - // child: Row( - // children: tipwidgets, - // ), - // ) - ], - ), - ), - ); - }); - } -} diff --git a/circle_app/lib/app/help/binding.dart b/circle_app/lib/app/help/binding.dart deleted file mode 100644 index 215b641..0000000 --- a/circle_app/lib/app/help/binding.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:get/get.dart'; - -import 'logic.dart'; - -class HelpBinding extends Bindings { - @override - void dependencies() { - Get.lazyPut(() => HelpLogic()); - } -} diff --git a/circle_app/lib/app/help/logic.dart b/circle_app/lib/app/help/logic.dart deleted file mode 100644 index fa96545..0000000 --- a/circle_app/lib/app/help/logic.dart +++ /dev/null @@ -1,86 +0,0 @@ -import 'package:get/get.dart'; - -import '../../network/api.dart'; -import '../../network/dio_manager.dart'; -import 'state.dart'; - -class HelpLogic extends GetxController { - // @override - // void onInit() async{ - // // TODO: implement onInit - // super.onInit(); - // var data = - // await DioManager.instance.get(url: Api.getQuestions, params:{}); - // BaseResponse> bean = BaseResponse>.fromJson( - // data, - // (jsonData) => List.from(jsonData), - // ); - // if (bean.isSuccess()) { - // msgList.clear(); - // (bean.data as List ).forEach((element) { - // lists.add(StoryBean(question:element.question,answers:element.answers,selected: false)); - // }); - // lists.addAll(bean.data); - // } - // - // } - - List lists = []; - final HelpState state = HelpState(); - - List msgList = [ - FaqItem( - question: '·为什么我被禁言了?', - answer: '答:我们审核人员24小时巡查的,存在发布违规内容、骂人、发QQ微信、欺诈骗取财物、打广告等违规行为都会被禁言或永久封禁!', - ), - FaqItem( - question: '·可以免费领取会员吗?', - answer: '答:可以的,邀请一些圈友加入我们,就可以免费获得会员哦~', - ), - FaqItem( - question: '·如何让更多的人看到我?', - answer: '答:开通会员提升权重、多加入一些圈子、多在这些圈子里喊话、多找一些圈友聊天。', - ), - FaqItem( - question: '·怎样做才能获更多人的喜欢?', - answer: '答:完善个人资料丰富形象、多上传一些形象照、及时回复圈友发来的消息、真诚文明地聊天。', - ), - FaqItem( - question: '·发现图片或视频被人盗取了怎么办?', - answer: '答:立即举报,并向在线客户反应情况。\n画重点:核实后会对其做出处理并要求删除相关内容~', - ), - // 添加更多的问题和答案 - ]; - -} -class FaqItem { - String question; - String answer; - bool selected; - - FaqItem({ - required this.question, - required this.answer, - this.selected = false, - }); -} - -class StoryBean { - final String question; - final List answers; - bool selected = false; - - StoryBean({ - required this.question, - required this.answers, - this.selected = false, - }); - - factory StoryBean.fromJson(Map json) { - return StoryBean( - question: json['question'], - answers: List.from(json['answers']), - selected: false - ); - } -} diff --git a/circle_app/lib/app/help/state.dart b/circle_app/lib/app/help/state.dart deleted file mode 100644 index abaed48..0000000 --- a/circle_app/lib/app/help/state.dart +++ /dev/null @@ -1,5 +0,0 @@ -class HelpState { - HelpState() { - ///Initialize variables - } -} diff --git a/circle_app/lib/app/help/view.dart b/circle_app/lib/app/help/view.dart deleted file mode 100644 index b8e0fe0..0000000 --- a/circle_app/lib/app/help/view.dart +++ /dev/null @@ -1,271 +0,0 @@ -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; - -import '../../components/my_app_bar.dart'; -import '../../router/app_routers.dart'; -import '../../util/util.dart'; -import 'logic.dart'; - -class HelpPage extends StatelessWidget { - HelpPage({Key? key}) : super(key: key); - - final logic = Get.find(); - final state = Get.find().state; - bool showAnswer = false; - - @override - Widget build(BuildContext context) { - - return GetBuilder(builder: (logic) { - return Container( - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage(getBaseImage("home_back")), - fit: BoxFit.cover, - ), - ), - child: Scaffold( - backgroundColor: Colors.transparent, - appBar: MyAppBar( - centerTitle: '帮助与反馈', - actionWdiget: const Text( - "我的反馈", - style: TextStyle(color: Colors.white), - ), - onPressed: () { - Get.toNamed(AppRoutes.MyFeedBackListActivity); - //logic.onSubmit(); - }, - ), - body: SafeArea( - child: Column( - children: [ - Padding( - padding: EdgeInsets.only(top: 30.sp), - child: Center( - child: Text( - '04-10 19:51', - style: TextStyle( - color: const Color(0xFFB7BECC), - fontSize: 12.sp, - ), - ), - ), - ), - SizedBox(height: 16.sp), - Padding( - padding: EdgeInsets.only(left: 16.sp, right: 16.sp), - child: Row( - children: [ - SizedBox( - height: 300.sp, - child: Align( - alignment: Alignment.topCenter, - child: Image.asset( - getMineImage("im_feedback"), - width: 32.sp, - height: 32.sp, - ), - ), - ), - SizedBox(width: 8.sp), - Expanded( - child: Container( - height: 300, - padding: const EdgeInsets.all(16), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(4.sp), - color: const Color(0xFF2E2E3B), - ), - child: Center( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - '常见问题', - style: TextStyle( - color: const Color(0xFFB7BECC), - fontSize: 14.sp, - ), - ), - SizedBox(height: 10.sp), - Expanded( - child: ListView.builder( - itemCount: logic.msgList.length, - itemBuilder: (context, index) { - return Column( - children: [ - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - showAnswer = - !showAnswer; // 切换显示答案的状态 - for (int i = 0; - i < logic.msgList.length; - i++) { - if (index == i) { - logic.msgList[i].selected = - true; - } else { - logic.msgList[i].selected = - false; - } - } - - // logic.msgList[index].selected = true; - logic.update(); - }, - child: Container( - margin: EdgeInsets.only( - top: 10.sp, bottom: 10.sp), - child: Row( - mainAxisAlignment: - MainAxisAlignment - .spaceBetween, - children: [ - Text( - logic.msgList[index].question, - style: const TextStyle( - color: Colors.white), - ), - Image( - image: AssetImage(logic.msgList[index].selected ? - getMineImage("im_down") : - getMineImage("im_right")), - width: 10.sp, - height: 14.sp, - ), - ], - ), - ), - ), - if (logic.msgList[index] - .selected) // 只有当showAnswer为true且当前索引与选中索引匹配时才显示答案 - Container( - margin: EdgeInsets.all(6.sp), - child: Text( - textAlign: TextAlign.left, - logic.msgList[index].answer, - style: TextStyle( - color: Colors.white70, - fontSize: 12.sp), - ), - ), - ], - ); - }, - ), - ), - ], - ), - ), - ), - ), - ], - ), - ), - const Spacer(), - Padding( - padding: EdgeInsets.only(bottom: 30.sp), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - height: 35.sp, - decoration: BoxDecoration( - gradient: const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - borderRadius: BorderRadius.circular(20.sp), - ), - child: TextButton.icon( - onPressed: () { - Get.toNamed(AppRoutes.FeedbackActivity); - // Handle feedback button press - }, - icon: Image.asset( - getMineImage("im_feedback_write"), - width: 14.sp, - height: 14.sp, - ), - label: const Text( - '意见反馈', - style: TextStyle( - color: Colors.white, - fontSize: 14, - ), - ), - style: TextButton.styleFrom( - backgroundColor: Colors.transparent, // Set this to transparent to make the container's gradient visible - padding: EdgeInsets.symmetric(horizontal: 16.sp, vertical: 4.sp), - ), - ), - ), - SizedBox(width: 20.sp), - Container( - height: 35.sp, - decoration: BoxDecoration( - gradient: const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - borderRadius: BorderRadius.circular(20.sp), - ), - child: TextButton.icon( - onPressed: () async{ - var con; - if(kDebugMode){ - con = V2TimConversation( - conversationID: "c2c_qpqz_dev_10_102", userID: "qpqz_dev_10_102", showName: "测试乐园客服", type: 1); - }else{ - con = V2TimConversation( - conversationID: "c2c_qpqz_prod_10_102", userID: "qpqz_prod_10_102", showName: "乐园客服", type: 1); - } - Get.toNamed(AppRoutes.Chat, arguments: con); - // sendTextMsg('qpqz_dev_10_102',content :"你好吗? "); - - // pushChatPage(logic.userInfoBean!.id.toString(), logic.imId, - // logic.userInfoBean!.nickname); - }, - icon: Image.asset( - getMineImage("im_service"), - width: 14.sp, - height: 14.sp, - ), - label: Text( - '联系客服', - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - ), - ), - style: TextButton.styleFrom( - backgroundColor: Colors.transparent, // Set this to transparent to make the container's gradient visible - padding: EdgeInsets.symmetric(horizontal: 16.sp, vertical: 4.sp), - ), - ), - ), - - ], - ), - ), - ], - ), - ), - ), - ); - }); - } -} diff --git a/circle_app/lib/app/home/binding.dart b/circle_app/lib/app/home/binding.dart deleted file mode 100644 index c06be9d..0000000 --- a/circle_app/lib/app/home/binding.dart +++ /dev/null @@ -1,18 +0,0 @@ -import 'package:circle_app/app/circle/logic.dart'; -import 'package:circle_app/app/msg/logic.dart'; -import 'package:circle_app/app/world_call_out/logic.dart'; -import 'package:get/get.dart'; - -import '../minefragment/logic.dart'; -import 'logic.dart'; - -class HomeBinding extends Bindings { - @override - void dependencies() { - Get.lazyPut(() => HomeLogic()); - Get.lazyPut(() => CircleLogic()); - Get.lazyPut(() => World_call_outLogic()); - Get.lazyPut(() => MsgLogic()); - Get.lazyPut(() => MinefragmentLogic()); - } -} diff --git a/circle_app/lib/app/home/logic.dart b/circle_app/lib/app/home/logic.dart deleted file mode 100644 index 4a7a821..0000000 --- a/circle_app/lib/app/home/logic.dart +++ /dev/null @@ -1,555 +0,0 @@ -import 'dart:async'; -import 'dart:convert'; -import 'dart:io'; - -import 'package:circle_app/app/chat/widget/svg_dialog.dart'; -import 'package:circle_app/app/circle/logic.dart'; -import 'package:circle_app/app/minefragment/logic.dart'; -import 'package:circle_app/app/msg/logic.dart'; -import 'package:circle_app/app/world_call_out/logic.dart'; -import 'package:circle_app/app/world_call_out/view.dart'; -import 'package:circle_app/main.dart'; -import 'package:circle_app/network/api.dart'; -import 'package:circle_app/network/dio_manager.dart'; -import 'package:circle_app/router/app_routers.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:connectivity/connectivity.dart'; -import 'package:event_bus/event_bus.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_native_splash/flutter_native_splash.dart'; -import 'package:get/get.dart'; -import 'package:shared_preferences/shared_preferences.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/core/core_services.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/message/message_services.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/services_locatar.dart'; -import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; - -import '../../util/PaymentUtils.dart'; -import '../../util/SharedPreferencesHelper.dart'; -import '../../util/eventBus.dart'; -import '../../view/notice.dart'; -import '../circle/view.dart'; -import '../circle_list/logic.dart'; -import '../circle_list/view.dart'; -import '../dialog/UpdateDialog.dart'; -import '../invite/logic.dart'; -import '../minefragment/view.dart'; -import '../msg/view.dart'; -import 'state.dart'; -import 'package:intl/intl.dart'; - -class HomeLogic extends GetxController with WidgetsBindingObserver { - late TabController tabController; - var connectivitySub; - ConnectivityResult? currentResult; - User? model; - int currentIndex = 0; - int showMsgTipCount = 0; - Widget currentPage = Container(); - - final HomeState state = HomeState(); - - List tabs = []; - static final MessageService _messageService = - serviceLocator(); - final RxString unreadSIze = "0".obs; - - final RxBool showcirlceUnred = false.obs; - late V2TimSimpleMsgListener msgListener; - InterestsBean mycircle = InterestsBean(lists: []); - - StreamSubscription? sub; - - bool isUpdateVersion = false; - - bool isProd = true; - - String accountId = ''; - - String inviteCode = ''; - - var link = ''; - @override - void onClose() { - // TODO: implement onClose - super.onClose(); - connectivitySub.cancel(); - TencentImSDKPlugin.v2TIMManager.v2TIMMessageManager - .removeAdvancedMsgListener(); - WidgetsBinding.instance.removeObserver(this); - sub!.cancel(); - } - - @override - void onInit() async { - super.onInit(); - unreadSIze.value = '0'; - tabs.add(CirclePage()); - tabs.add(CircleListPage()); - tabs.add(WorldCallOutPage()); - tabs.add(MsgPage()); - tabs.add(MinefragmentPage()); - - loadEnvTypeData(); - // 设置网络变化监听 - connectListener(); - getIMData(); - - setFirstData(); - - loadMyInfoData(); - - sub = EventBusManager.on().listen((event) { - getUnreadSize(); - }); - - WidgetsBinding.instance.addObserver(this); - - addMsgListener(); - - checkVersion(); - loadMyCircleData(); - - initWxApi(); - } - - void addMsgListener() { - msgListener = V2TimSimpleMsgListener(onRecvC2CTextMessage: ( - msgID, - userInfo, - text, - ) async { - print("收到新消息" + text); - getUnreadSize(); - }, onRecvC2CCustomMessage: ( - String msgID, - V2TimUserInfo sender, - String customData, - ) { - if (sender.userID == "qpqz_dev_10_10000000000" || - sender.userID == "qpqz_prod_10_10000000000") { - if (customData.isEmpty) { - return; - } - - print("123123123123" + customData); - Map jsonData = json.decode(customData); - int event = jsonData['event']; - Map content = jsonData['content']; - switch (event) { - case 1: //关注 - String ageMsg = - "${content['genderName']}·${content['age']}·${content['roleName']}·${content['orientationName']}"; - if (content['isFollow'] == 1) { - //互关 - showFloatingButtonOverlay(Get.context!, content['nickname'], - ageMsg, content['avatarThumb'], 3, () { - pushChatPage(content['id'].toString(), content['imId'], - content['nickname']); - }); - } else { - showFloatingButtonOverlay(Get.context!, content['nickname'], - ageMsg, content['avatarThumb'], 1, () { - setLike(content['id'].toString()); - }); - } - - break; - case 2: //上线 - - String ageMsg = - "${content['genderName']}·${content['age']}·${content['roleName']}·${content['orientationName']}"; - - showFloatingButtonOverlay(Get.context!, content['nickname'], ageMsg, - content['avatarThumb'], 2, () { - pushChatPage(content['id'].toString(), content['imId'], - content['nickname']); - }); - break; - case 9: //有新人加入 - { - CircleLogic logic = Get.find(); - logic.isNewPeopleRed = true; - logic.update(); - } - break; - case 8: //有新的喊话 - { - World_call_outLogic logic = Get.find(); - logic.isNewMsg = true; - logic.update(); - } - break; - case 10: //有新访客 - { - MsgLogic logic = Get.find(); - logic.getMode(); - } - break; - } - } - }); - - TencentImSDKPlugin.v2TIMManager.v2TIMMessageManager.addAdvancedMsgListener( - listener: V2TimAdvancedMsgListener(onRecvNewMessage: (message) { - getUnreadSize(); - print(message); - if (message.elemType == MessageElemType.V2TIM_ELEM_TYPE_CUSTOM) { - if (message.customElem?.data != null) { - print(message.customElem!.data!); - Map jsonData = jsonDecode(message.customElem!.data!); - if (jsonData.containsKey('event')) { - String event = jsonData['event'].toString(); - - if (int.parse(event) == 1) { - Map content = jsonData['content']; - String ageMsg = - "${content['genderName']}·${content['age']}·${content['roleName']}·${content['orientationName']}"; - if (content['isFollow'] == 1) { - //互关 - showFloatingButtonOverlay(Get.context!, content['nickname'], - ageMsg, content['avatarThumb'], 3, () { - pushChatPage(content['id'].toString(), content['imId'], - content['nickname']); - }); - } else { - showFloatingButtonOverlay(Get.context!, content['nickname'], - ageMsg, content['avatarThumb'], 1, () { - setLike(content['id'].toString()); - }); - } - } else if (int.parse(event) == 2) { - Map content = jsonData['content']; - String ageMsg = - "${content['genderName']}·${content['age']}·${content['roleName']}·${content['orientationName']}"; - - showFloatingButtonOverlay(Get.context!, content['nickname'], - ageMsg, content['avatarThumb'], 2, () { - pushChatPage(content['id'].toString(), content['imId'], - content['nickname']); - }); - } else if (int.parse(event) == 3) {//喜欢列表刷新 - showOKToast(message.customElem!.desc!.toString()); - EventBusManager.fire(LikeRefresh()); - } else if (int.parse(event) == 5) {//有人送礼会话置顶 - // print(jsonData.toString()); - var info = jsonDecode(jsonData['content']); - TencentImSDKPlugin.v2TIMManager.v2ConversationManager - .pinConversation( - conversationID: 'c2c_' + info['fromImId'], - isPinned: info['top'] == 1); - } else if (int.parse(event) == 9) {//有新人加入 - CircleLogic logic = Get.find(); - logic.isNewPeopleRed = true; - logic.update(); - } else if (int.parse(event) == 8) {//有新的喊话 - World_call_outLogic logic = Get.find(); - logic.isNewMsg = true; - logic.update(); - } else if (int.parse(event) == 10) {//有新访客 - MsgLogic logic = Get.find(); - logic.getMode(); - } - } else if (jsonData.containsKey('type')) { - int type = jsonData['type']; - if (type == 1) { - String giftUrl = jsonData['gifUrl']; - if (giftUrl.isNotEmpty) { - Get.bottomSheet(SvgDialog(url: giftUrl), - isScrollControlled: true, - enableDrag: false, - isDismissible: false); - } - } - } - } - } - })); - - _messageService.addSimpleMsgListener(listener: msgListener); - } - - @override - void didChangeAppLifecycleState(AppLifecycleState state) { - switch (state) { - case AppLifecycleState.inactive: - break; - - case AppLifecycleState.resumed: //从后台切换前台,界面可见 - break; - - case AppLifecycleState.paused: // 界面不可见,后台 - addBadge(); - break; - - case AppLifecycleState.detached: // APP结束时调用 - break; - } - } - - Future checkVersion() async { - var data = await DioManager.instance.get(url: Api.APP_VERSION); - var bean = BaseResponse.fromJson( - data, (data) => UpdateInfo.fromJson(data)); - if (bean.isSuccess() && bean.data.update == 1) { - showReportDialog(Get.context!, bean.data.constraint == 0, bean.data); - } - } - - setLike(String userId) async { - var data = await DioManager.instance - .post(url: "${Api.setLike + userId}/follow", params: {'status': "1"}); - var bean = BaseResponse.fromJson( - data, - (jsonData) => jsonData, - ); - if (bean.isSuccess()) { - update(); - } - showOKToast(bean.msg); - } - - getUnreadSize() async { - if (coreInstance.isLoginSuccess) { - try { - V2TimValueCallback getTotalUnreadMessageCountRes = - await TencentImSDKPlugin.v2TIMManager - .getConversationManager() - .getTotalUnreadMessageCount(); - print("未读数量desc=" + - getTotalUnreadMessageCountRes.desc.toString() + - "code=" + - getTotalUnreadMessageCountRes.code.toString() + - "data=" + - getTotalUnreadMessageCountRes.data.toString()); - - if (getTotalUnreadMessageCountRes.code == 0) { - if (getTotalUnreadMessageCountRes.data.toString() != - unreadSIze.value) { - unreadSIze.value = getTotalUnreadMessageCountRes.data.toString(); - } - } - } catch (e) {} - } - } - - @override - Future setOfflinePushStatus( - {required AppStatus status, int? totalCount}) { - if (status == AppStatus.foreground) { - // 当应用status为前台时,上报doForeground() - return TencentImSDKPlugin.v2TIMManager - .getOfflinePushManager() - .doForeground(); - } else { - // 当应用status为后台时,上报doBackground(),并带上未读数 - return TencentImSDKPlugin.v2TIMManager - .getOfflinePushManager() - .doBackground(unreadCount: totalCount ?? 0); - } - } - - @override - void onReady() async { - // TODO: implement onReady - super.onReady(); - - FlutterNativeSplash.remove(); - final logic = Get.find(); - logic.loadCirclePeopleData(); - } - - addBadge() { - if (Platform.isAndroid) { - setOfflinePushStatus(status: AppStatus.foreground); - } - } - - void showReportDialog( - BuildContext context, bool isDismiss, UpdateInfo updateInfo) { - showDialog( - context: context, - barrierDismissible: isDismiss, - builder: (BuildContext context) { - return UpdateDialog( - isDismiss: isDismiss, - updateInfo: updateInfo, - ); - }); - } - - void getIMData() async { - // _coreInstance.; - if (!coreInstance.isLoginSuccess) { - var data = await DioManager.instance.get(url: Api.getIMInfo); - if (data['code'] == 200) { - loginIM( - data['data']['account_id'].toString(), data['data']['user_sig']); - accountId = data['data']['account_id'].toString(); - } else { - getIMData(); - } - } - } - - String getInfo() { - return getBaseImage('image'); - } - - updateIndex(int index) { - tabController.animateTo(index, - duration: Duration(milliseconds: 0), curve: Curves.ease); - currentIndex = index; - getUnreadSize(); - if (index == 0) { - final logic = Get.put(CircleLogic()); - logic.loadCirclePeopleData(); - } else if (index == 4) { - final logic = Get.put(MinefragmentLogic()); - logic.getMode(); - } else if (index == 3) { - final logic = Get.find(); - EventBusManager.fire(MsgRecommendCardRefresh()); - logic.loadChatData(); - logic.getVisitorMsgData(); - } - update(); - } - - void setFirstData() async { - SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); - sharedPreferences.setString(SharedPreferencesHelper.firstLogin, '1'); - } - - loadMyCircleData() async { - var data = await DioManager.instance.get(url: Api.getMyCircleAll); - - // var bean = BaseResponse.fromJson( - // data, (data) => InterestsBean.fromJson(data)); - - if (data['code'] == 200) { - List circleList = data['data']; - if (circleList.isNotEmpty) { - List infoList = []; - circleList.forEach((element) { - var info = Circle.fromJson(element); - infoList.add(info); - }); - mycircle.lists = infoList; - if (currentIndex >= mycircle.lists.length - 1) { - currentIndex = mycircle.lists.length - 1; - } - - loadCalloutsNew(); - } - } - } - - loadCalloutsNew() async { - List idList = []; - mycircle.lists.forEach((element) { - idList.add(element.id.toString()); - }); - var data = await DioManager.instance - .post(url: Api.calloutsNew, params: {"interestIds": idList}); - - if (data['code'] == 200) { - List infoList = data['data']; - bool isHasNew = false; - if (infoList.isNotEmpty) { - infoList.forEach((element) { - if (element['hasNew']) { - isHasNew = true; - } - }); - } - showcirlceUnred.value = isHasNew; - } - } - - /// 设置网络切换监听 - connectListener() { - connectivitySub = Connectivity() - .onConnectivityChanged - .listen((ConnectivityResult result) { - if (result == ConnectivityResult.none) { - if (currentIndex == 0) { - var logic = Get.put(CircleLogic()); - logic.loadData(); - } else if (currentIndex == 1) { - var logic = Get.put(LikeLogic()); - logic.loadData(); - } else if (currentIndex == 3) { - final logic = Get.find(); - logic.loadData(); - } else if (currentIndex == 4) { - var logic = Get.put(MinefragmentLogic()); - logic.loadData(); - } - } - }); - } - - void loadEnvTypeData() async { - var data = await DioManager.instance.get(url: Api.getAppEnv); - if (data['code'] == 200) { - isProd = data['data'] == 0; - update(); - } - } - - void loadMyInfoData() async { - var data = await DioManager.instance.get(url: Api.getUserMine); - var bean = BaseResponse.fromJson( - data, (data) => MineResponseBean.fromJson(data)); - if (bean.isSuccess()) { - model = bean.data.user; - var result = await DioManager.instance.get(url: Api.inviteMainPage); - if (result['code'] == 200) { - Autogenerated info = Autogenerated.fromJson(result); - inviteCode = info.data!.inviteCode!; - link = info.data!.link!; - } - bool isGreaterThan30Days = isDifferenceGreaterThan30Days( - (model!.createTime?.isNotEmpty ?? false) - ? model!.createTime! - : DateTime.now().toString()); - - if (isGreaterThan30Days) { - currentIndex = 0; - } else { - currentIndex = 1; - } - updateIndex(currentIndex); - update(); - } - } - - bool isDifferenceGreaterThan30Days(String dateString) { - // 获取当前时间 - DateTime now = DateTime.now(); - - // 使用日期格式化对象来解析给定的时间字符串 - DateFormat format = DateFormat("yyyy-MM-dd"); - DateTime date = format.parse(dateString); - - // 计算日期差异 - Duration difference = now.difference(date); - - // 检查差异是否超过30天 - if (difference.inDays.abs() > 30) { - return true; - } else { - return false; - } - } -} - -class conTop { - bool isTop; - String conId; - conTop(this.isTop, this.conId); -} - -class MsgRecommendCardRefresh {} diff --git a/circle_app/lib/app/home/state.dart b/circle_app/lib/app/home/state.dart deleted file mode 100644 index 5613985..0000000 --- a/circle_app/lib/app/home/state.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:flutter/material.dart'; - -class HomeState { - - HomeState() { - ///Initialize variables - } - - -} diff --git a/circle_app/lib/app/home/view.dart b/circle_app/lib/app/home/view.dart deleted file mode 100644 index 09a8311..0000000 --- a/circle_app/lib/app/home/view.dart +++ /dev/null @@ -1,281 +0,0 @@ -import 'package:circle_app/app/circle/view.dart'; -import 'package:circle_app/app/minefragment/view.dart'; -import 'package:circle_app/app/msg/view.dart'; -import 'package:circle_app/app/world_call_out/view.dart'; -import 'package:circle_app/common/colors/app_color.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:circle_app/view/ExitAppConfirmation.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; - -import '../../main.dart'; -import '../circle_list/view.dart'; -import 'logic.dart'; - -class HomePage extends StatefulWidget { - const HomePage({Key? key}) : super(key: key); - - @override - State createState() => _HomePageState(); -} - -class _HomePageState extends State - with - AutomaticKeepAliveClientMixin, - SingleTickerProviderStateMixin, - RouteAware { - @override - bool get wantKeepAlive => true; - - HomeLogic logic = Get.find(); - @override - void initState() { - // TODO: implement initState - super.initState(); - logic.tabController = TabController( - length: 5, - vsync: this, - initialIndex: 0, - animationDuration: Duration.zero); - } - - @override - void didChangeDependencies() { - // TODO: implement didChangeDependencies - super.didChangeDependencies(); - - /// 路由订阅 - routeObserver.subscribe(this, ModalRoute.of(context) as PageRoute); - } - - void didPopNext() { - print('didPopNext'); - logic.getUnreadSize(); - } - - ///当前页面进入时触发 - void didPush() { - print('didPopNext'); - } - - void didPop() { - print('didPop'); - } - - @override - void dispose() { - // TODO: implement dispose - super.dispose(); - routeObserver.unsubscribe(this); - } - - @override - Widget build(BuildContext context) { - return GetBuilder(builder: (HomeLogic controller) { - return ExitAppConfirmation( - child: Scaffold( - resizeToAvoidBottomInset: false, - backgroundColor: const Color.fromRGBO(15, 10, 31, 1.0), - bottomNavigationBar: Container( - height: 49.sp + MediaQuery.of(context).padding.bottom, - width: Get.width, - // color: Colors.red, - padding: EdgeInsets.only(left: 0.sp, right: 0.sp), - decoration: BoxDecoration( - color: const Color(0xFF423055), - image: DecorationImage( - fit: BoxFit.fill, - image: AssetImage( - getTabbarImage('tabbar_bg'), - ))), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - funcItem(0, 'circle', 0 == controller.currentIndex, controller), - funcItem(1, 'like', 1 == controller.currentIndex, controller), - funcItem(2, 'world', 2 == controller.currentIndex, controller), - funcItem(3, 'msg', 3 == controller.currentIndex, controller), - funcItem(4, 'mine', 4 == controller.currentIndex, controller), - ], - ), - ), - body: Stack( - fit: StackFit.expand, - children: [ - Container( - width: MediaQuery.of(context).size.width, - // height: - // Get.height - 49.sp + MediaQuery.of(context).padding.bottom, - decoration: const BoxDecoration(image: bgWidget), - ), - TabBarView( - physics: const NeverScrollableScrollPhysics(), - controller: logic.tabController, - children: [ - const CirclePage(), - CircleListPage(), - WorldCallOutPage(), - MsgPage(), - MinefragmentPage() - ], - ) - ], - ), - ), - ); - }); - } - - centerItem(int index, String image, bool isSelected, HomeLogic controller) { - return SizedBox( - width: 50.sp, - height: 50.sp, - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - if (!isSelected) { - logic.tabController.animateTo(index, - duration: Duration(milliseconds: 0), curve: Curves.ease); - controller.updateIndex(index); - } - }, - child: OverflowBox( - minWidth: 0.0, - maxWidth: double.infinity, - minHeight: 0.0, - maxHeight: double.infinity, - child: Container( - width: 60.sp, - height: 60.sp, - margin: EdgeInsets.only(bottom: 4.sp), - decoration: BoxDecoration( - gradient: LinearGradient( - colors: [ - Color(0xFF460358), - Color(0xFF400350), - ], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - borderRadius: BorderRadius.circular(30.sp) - ), - child: Center( - child: Image.asset( - isSelected - ? getTabbarImage('${image}_selected') - : getTabbarImage('${image}_normal'), - width: 50.sp, - height: 50.sp, - fit: BoxFit.fill, - excludeFromSemantics: true, - gaplessPlayback: true, - ))), - ), - )); - } - - funcItem(int index, String image, bool isSelected, HomeLogic controller) { - return SizedBox( - width: 60.sp, - height: 50.sp, - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - if (!isSelected) { - - controller.updateIndex(index); - } - }, - child: Stack(alignment: Alignment.center, children: [ - if (index == 2) - Transform( - transform: Matrix4.translationValues(0, -8.sp, 0.0), - child: Container( - height: 55.sp, - width: 55.sp, - alignment: Alignment.center, - decoration: BoxDecoration( - color:Color(0xFF48025A), - borderRadius: BorderRadius.circular(44.sp) - ), - child: Center( - child: Image.asset( - isSelected - ? getTabbarImage('${image}_selected') - : getTabbarImage('${image}_normal'), - width: 50.sp, - height:50.sp, - fit: BoxFit.fill, - excludeFromSemantics: true, - gaplessPlayback: true, - )), - )), - if (index != 2) - Container( - margin: EdgeInsets.only(top: 0.sp), - child: Center( - child: Image.asset( - isSelected - ? getTabbarImage('${image}_selected') - : getTabbarImage('${image}_normal'), - width: 38.sp, - height: 38.sp, - fit: BoxFit.fill, - excludeFromSemantics: true, - gaplessPlayback: true, - ))), - // if (logic.showcirlceUnred.value && index == 1) - Obx(() => Visibility( - visible: index == 1 && controller.showcirlceUnred.value, - child: Positioned( - // right: 4.sp, - top: 10.sp, - child: Container( - width: 14.sp, - height: 14.sp, - margin: EdgeInsets.only(left: 24.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(7.sp), - gradient: LinearGradient( - colors: controller.showcirlceUnred.value - ? [Color(0xFFC343F9), Color(0xFFFB34B2)] - : [Color(0xFFC343F9), Color(0xFFFB34B2)]), - border: - Border.all(color: Color(0xFF170730), width: 1.sp))), - ))), - // Obx(() => null) - Obx(() => Visibility( - visible: index == 3 && controller.unreadSIze != "0", - child: Positioned( - // right: 4.sp, - top: 6.sp, - child: Container( - margin: EdgeInsets.only( - left: int.parse(controller.unreadSIze.value) > 99 - ? 30.sp - : 20.sp), - height: 18.sp, - padding: EdgeInsets.only(left: 5.sp, right: 5.sp), - alignment: Alignment.center, - decoration: BoxDecoration( - color: Colors.red, - borderRadius: BorderRadius.circular(10.sp)), - child: Text( - int.parse(controller.unreadSIze.value) > 99 - ? '99+' - : controller.unreadSIze.value, - // The number in the red dot - style: TextStyle( - color: Colors.white, - fontSize: 12.0.sp, // Font size of the text - ), - ), - ), - ))) - ]), - ), - ); - } -} diff --git a/circle_app/lib/app/invent_record/binding.dart b/circle_app/lib/app/invent_record/binding.dart deleted file mode 100644 index c12b9f8..0000000 --- a/circle_app/lib/app/invent_record/binding.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:get/get.dart'; - -import 'logic.dart'; - -class Invent_recordBinding extends Bindings { - @override - void dependencies() { - Get.lazyPut(() => Invent_recordLogic()); - } -} diff --git a/circle_app/lib/app/invent_record/logic.dart b/circle_app/lib/app/invent_record/logic.dart deleted file mode 100644 index 507c3b3..0000000 --- a/circle_app/lib/app/invent_record/logic.dart +++ /dev/null @@ -1,57 +0,0 @@ -import 'package:flutter/cupertino.dart'; -import 'package:get/get.dart'; -import 'package:circle_app/network/api.dart'; -import 'package:circle_app/network/dio_manager.dart'; - -import 'state.dart'; - -class Invent_recordLogic extends GetxController { - final Invent_recordState state = Invent_recordState(); - bool isLoad = true; - bool isMore = true; - int index = 1; - - - List data = []; - ScrollController scrollController = ScrollController(); - - @override - void onInit() { - // TODO: implement onInit - super.onInit(); - scrollController.addListener(() { - if (scrollController.position.pixels == - scrollController.position.maxScrollExtent) { - if (isMore) { - loadData(); - } - - } - }); - loadData(); - } - - void loadData() async { - var result = await DioManager.instance.post(url:Get.arguments == 0 ? Api.inviteRecord : Api.inviteRankRecord,params: {'page':index,'pageSize':20}); - isLoad = false; - if (result['code'] == 200) { - if (result['data'] != null) { - List dataList = result['data']; - - isMore = dataList.length >= 20; - - if (index == 1) { - data = result['data']; - } else { - data.addAll(result['data']); - } - - index = index + 1; - } else { - isMore = false; - } - } - update(); - } - -} diff --git a/circle_app/lib/app/invent_record/state.dart b/circle_app/lib/app/invent_record/state.dart deleted file mode 100644 index 050476e..0000000 --- a/circle_app/lib/app/invent_record/state.dart +++ /dev/null @@ -1,5 +0,0 @@ -class Invent_recordState { - Invent_recordState() { - ///Initialize variables - } -} diff --git a/circle_app/lib/app/invent_record/view.dart b/circle_app/lib/app/invent_record/view.dart deleted file mode 100644 index 5066b3e..0000000 --- a/circle_app/lib/app/invent_record/view.dart +++ /dev/null @@ -1,320 +0,0 @@ -import 'package:circle_app/common/colors/app_color.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; - -import '../../components/my_app_bar.dart'; -import '../../router/app_routers.dart'; -import '../../util/util.dart'; -import 'logic.dart'; - -class Invent_recordPage extends StatelessWidget { - Invent_recordPage({Key? key}) : super(key: key); - - final logic = Get.find(); - final state = Get.find().state; - - @override - Widget build(BuildContext context) { - return Scaffold( - backgroundColor: Colors.black, - appBar: MyAppBar( - centerTitle: Get.arguments == 0 ? '邀请记录及返利' : '推荐大使邀请榜', - ), - body: GetBuilder(builder: (logic) { - return Container( - decoration: BoxDecoration( - color: Color(0x99282733), - border: Border.all(color: Color(0x0AFFFFFF), width: 1.sp), - borderRadius: BorderRadius.circular(4.sp)), - margin: EdgeInsets.only(left: 15.sp, right: 15.sp, bottom: 10.sp), - child: logic.isLoad - ? loaddingWidget(true) - : logic.data.isEmpty - ? noResultWidget() - : ListView.builder( - itemBuilder: (BuildContext context, int index) { - if (Get.arguments == 0) { - if (index == 0) { - return titileWidget(); - } else if (index == logic.data!.length + 1) { - return loaddingWidget(logic.isMore); - } - var data = logic.data[index - 1]; - return rowWidget( - data['nickName'], - data['inviteTime'], - '${data['sysProfit']}票', - '${data['rebate'] > 0 ? data['rebate'] : 0}票(${data['rebateRate']}%)', - data['userId'].toString()); - } else { - if (index == 0) { - return allTitileWidget(); - } else if (index == logic.data!.length + 1) { - return loaddingWidget(logic.isMore); - } - var data = logic.data[index - 1]; - return allRowWidget( - data['nickname'], - data['inviteCount'].toString(), - data['vipDays'].toString() + '天', - '${data['directProfit'] > 0 ? data['directProfit'] : 0}票', - '${data['rebate'] > 0 ? data['rebate'] : 0}票', - data['userId'].toString()); - } - }, - itemCount: logic.data!.length + 2, - controller: logic.scrollController, - ), - ); - }), - ); - } - - allTitileWidget() { - return Container( - height: 41.sp, - child: Column( - children: [ - Expanded( - child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Expanded( - child: infoText('推广大使'), - flex: 1, - ), - Container( - width: 1, - color: Color(0x0AFFFFFF), - ), - Expanded( - child: infoText('邀请人数'), - flex: 1, - ), - Container( - width: 1, - color: Color(0x0AFFFFFF), - ), - Expanded( - child: infoText('获会员时长'), - flex: 1, - ), - Container( - width: 1, - color: Color(0x0AFFFFFF), - ), - Expanded( - child: infoText('直接获利'), - flex: 1, - ), - Container( - width: 1, - color: Color(0x0AFFFFFF), - ), - Expanded( - child: infoText('间接返利'), - flex: 1, - ), - ], - ), - ), - Container( - height: 1, - color: Color(0x0AFFFFFF), - ), - ], - ), - ); - } - - allRowWidget( - String str1, - String str2, - String str3, - String str4, - String str5, - String userId, - ) { - return Container( - height: 41.sp, - // margin: EdgeInsets.only(top: 10.sp, bottom: 10.sp), - child: Column( - children: [ - Expanded( - child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Expanded( - child: GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.UserInfoActivity, - arguments: userId); - }, - child: infoText(str1, AppColor.mainColor)), - flex: 1, - ), - Container( - width: 1, - color: Color(0x0AFFFFFF), - ), - Expanded( - child: infoText(str2, Colors.white), - flex: 1, - ), - Container( - width: 1, - color: Color(0x0AFFFFFF), - ), - Expanded( - child: infoText(str3, Colors.white), - flex: 1, - ), - Container( - width: 1, - color: Color(0x0AFFFFFF), - ), - Expanded( - child: infoText(str4, Colors.white), - flex: 1, - ), - Container( - width: 1, - color: Color(0x0AFFFFFF), - ), - Expanded( - child: infoText(str5, Colors.white), - flex: 1, - ), - ], - ), - ), - Container( - height: 1, - color: Color(0x0AFFFFFF), - ), - ], - ), - ); - } - - infoText(String info, [Color color = const Color(0xFFF7FAFA)]) { - return Center( - child: Text( - info ?? '', - style: TextStyle(color: color, fontSize: 12.sp), - overflow: TextOverflow.ellipsis, - ), - ); - } - - titileWidget() { - return Container( - height: 41.sp, - child: Column( - children: [ - Expanded( - child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Expanded( - child: infoText('圈友'), - flex: 1, - ), - Container( - width: 1, - color: Color(0x0AFFFFFF), - ), - Expanded( - child: infoText('填码时间'), - flex: 1, - ), - Container( - width: 1, - color: Color(0x0AFFFFFF), - ), - Expanded( - child: infoText('平台返利'), - flex: 1, - ), - Container( - width: 1, - color: Color(0x0AFFFFFF), - ), - Expanded( - child: infoText('平台为你返利'), - flex: 1, - ), - ], - ), - ), - Container( - height: 1, - color: Color(0x0AFFFFFF), - ), - ], - ), - ); - } - - rowWidget( - String str1, - String str2, - String str3, - String str4, - String userId, - ) { - return Container( - height: 41.sp, - // margin: EdgeInsets.only(top: 10.sp, bottom: 10.sp), - child: Column( - children: [ - Expanded( - child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Expanded( - child: GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.UserInfoActivity, - arguments: userId); - }, - child: infoText(str1, AppColor.mainColor)), - flex: 1, - ), - Container( - width: 1, - color: Color(0x0AFFFFFF), - ), - Expanded( - child: infoText(str2, Colors.white), - flex: 1, - ), - Container( - width: 1, - color: Color(0x0AFFFFFF), - ), - Expanded( - child: infoText(str3, Colors.white), - flex: 1, - ), - Container( - width: 1, - color: Color(0x0AFFFFFF), - ), - Expanded( - child: infoText(str4, Colors.white), - flex: 1, - ), - ], - ), - ), - Container( - height: 1, - color: Color(0x0AFFFFFF), - ), - ], - ), - ); - } -} diff --git a/circle_app/lib/app/invite/binding.dart b/circle_app/lib/app/invite/binding.dart deleted file mode 100644 index 9c37d2e..0000000 --- a/circle_app/lib/app/invite/binding.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:get/get.dart'; - -import 'logic.dart'; - -class InviteBinding extends Bindings { - @override - void dependencies() { - Get.lazyPut(() => InviteLogic()); - } -} diff --git a/circle_app/lib/app/invite/logic.dart b/circle_app/lib/app/invite/logic.dart deleted file mode 100644 index af1f526..0000000 --- a/circle_app/lib/app/invite/logic.dart +++ /dev/null @@ -1,253 +0,0 @@ -import 'package:circle_app/network/api.dart'; -import 'package:circle_app/network/dio_manager.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:get/get.dart'; - -import 'state.dart'; - -class InviteLogic extends GetxController { - final InviteState state = InviteState(); - bool isLoad = true; - - ScrollController scrollController = ScrollController(); - - ScrollController contentScrollController = ScrollController(); - - TextEditingController codeEditingController = TextEditingController(); - - Data? homeData; - List inveiteData = []; - - List allInveiteData = []; - - List sysData = []; - String directProfit = ''; - String rebate = ''; - int selectedIndex = 0; - - int myPage = 1; - int otherPage = 1; - - bool isContentScroll = false; - - @override - void dispose() { - // TODO: implement dispose - scrollController.dispose(); - contentScrollController.dispose(); - super.dispose(); - } - - @override - void onInit() { - // TODO: implement onInit - super.onInit(); - scrollController.addListener(() { - if (scrollController.position.pixels == - scrollController.position.maxScrollExtent) { - if (!isContentScroll) { - isContentScroll = true; - update(); - } - } else { - if (isContentScroll) { - isContentScroll = false; - update(); - } - - } - }); - - contentScrollController.addListener(() { - if (contentScrollController.offset <= - 0) { - if (isContentScroll) { - isContentScroll = false; - update(); - } - } - }); - - loadData(); - loadMyInviteData(); - loadAllInviteData(); - } - - loadMyInviteData() async { - var resultData = await DioManager.instance.post(url: Api.inviteRecord,params: {'page':myPage,'pageSize':10}); - if (resultData['code'] == 200) { - inveiteData = resultData['data']; - update(); - } - } - - loadAllInviteData() async { - var resultData = await DioManager.instance.post(url: Api.inviteRankRecord,); - if (resultData['code'] == 200) { - allInveiteData = resultData['data']; - update(); - } - } - - void loadData() async { - var resultData = await DioManager.instance.get(url: Api.inviteTotal); - if (resultData['code'] == 200) { - rebate = resultData['data']['rebate'].toString(); - directProfit = resultData['data']['directProfit'].toString(); - } - - var data = await DioManager.instance.get(url: Api.inviteMainPage); - if (data['code'] == 200) { - Autogenerated result = Autogenerated.fromJson(data); - homeData = result.data; - } - - var recorddata = await DioManager.instance.get(url: Api.inviteSysRecord); - if (recorddata['code'] == 200) { - sysData = recorddata['data']; - isLoad = false; - update(); - - } - - } - - addCode(String code) async { - - - var recorddata = await DioManager.instance.post(url: Api.inviteFillIn,params: {'invite_code':code}); - if (recorddata['code'] == 200) { - showOKToast('填写成功'); - } else { - showOKToast(recorddata['msg']); - } - } -} - - -class Autogenerated { - int? code; - Data? data; - String? msg; - - Autogenerated({this.code, this.data, this.msg}); - - Autogenerated.fromJson(Map json) { - code = json['code']; - data = json['data'] != null ? new Data.fromJson(json['data']) : null; - msg = json['msg']; - } - - Map toJson() { - final Map data = new Map(); - data['code'] = this.code; - if (this.data != null) { - data['data'] = this.data!.toJson(); - } - data['msg'] = this.msg; - return data; - } -} - -class Superior { - int? id; - String? avatar; - String? nickname; - Superior( - {this.id,this.avatar,this.nickname} - ); - Superior.fromJson(Map json) { - id = json['id'] ?? 0; - avatar = json['avatar'] ?? ''; - nickname = json['nickname'] ?? ''; - } -} - -class Data { - int? achieveCount; - int? achieveRewardDay; - int? diffAwardCount; - List? inviteAwardConf; - Superior? superior; - int? inviteAwardCount; - String? inviteCode; - String? link; - int? inviteCount; - - Data( - {this.achieveCount, - this.achieveRewardDay, - this.diffAwardCount, - this.inviteAwardConf, - this.inviteAwardCount, - this.inviteCode, - this.superior, - this.link, - this.inviteCount}); - - Data.fromJson(Map json) { - achieveCount = json['achieve_count']; - achieveRewardDay = json['achieve_reward_day']; - diffAwardCount = json['diff_award_count']; - if (json['invite_award_conf'] != null) { - inviteAwardConf = []; - json['invite_award_conf'].forEach((v) { - inviteAwardConf!.add(new InviteAwardConf.fromJson(v)); - }); - } - inviteAwardCount = json['invite_award_count']; - inviteCode = json['invite_code']; - superior = json['superior'] != null ? Superior.fromJson(json['superior']) : null; - link = json['site_link']; - inviteCount = json['invite_count']; - } - - Map toJson() { - final Map data = new Map(); - data['achieve_count'] = this.achieveCount; - data['achieve_reward_day'] = this.achieveRewardDay; - data['diff_award_count'] = this.diffAwardCount; - if (this.inviteAwardConf != null) { - data['invite_award_conf'] = - this.inviteAwardConf!.map((v) => v.toJson()).toList(); - } - data['invite_award_count'] = this.inviteAwardCount; - data['invite_code'] = this.inviteCode; - data['invite_count'] = this.inviteCount; - return data; - } -} - -class InviteAwardConf { - int? achieveId; - int? inviteCount; - int? isAchieved; - double? rebateRate; - int? rewardDay; - - InviteAwardConf( - {this.achieveId, - this.inviteCount, - this.isAchieved, - this.rebateRate, - this.rewardDay}); - - InviteAwardConf.fromJson(Map json) { - achieveId = json['achieve_id']; - inviteCount = json['invite_count']; - isAchieved = json['is_achieved']; - rebateRate = json['rebate_rate']; - rewardDay = json['reward_day']; - } - - Map toJson() { - final Map data = new Map(); - data['achieve_id'] = this.achieveId; - data['invite_count'] = this.inviteCount; - data['is_achieved'] = this.isAchieved; - data['rebate_rate'] = this.rebateRate; - data['reward_day'] = this.rewardDay; - return data; - } -} diff --git a/circle_app/lib/app/invite/share.dart b/circle_app/lib/app/invite/share.dart deleted file mode 100644 index daf79d0..0000000 --- a/circle_app/lib/app/invite/share.dart +++ /dev/null @@ -1,481 +0,0 @@ -import 'dart:io'; - -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:circle_app/app/minefragment/logic.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/rendering.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; -import 'package:get/get.dart'; -import 'package:get/get_core/src/get_main.dart'; -import 'package:image_gallery_saver/image_gallery_saver.dart'; -import 'dart:ui' as ui; -import 'package:fluwx/fluwx.dart' as fluwx; -import 'package:path_provider/path_provider.dart'; -import 'package:qr_flutter/qr_flutter.dart'; - -class Share extends StatefulWidget { - String code; - String link; - Share(this.code, this.link); - - @override - State createState() => _ShareState(); -} - -class _ShareState extends State { - GlobalKey _globalKey = GlobalKey(); - - MinefragmentLogic logic = Get.find(); - - @override - Widget build(BuildContext context) { - // TODO: add widget build method - return Scaffold( - backgroundColor: Colors.transparent, - body: Container( - child: Column( - children: [ - Expanded(child: Container()), - Container( - width: Get.width - 40.sp, - // height: Get.height - Get.bottomBarHeight - 164.sp - 10.sp, - child:SingleChildScrollView( - child: RepaintBoundary( - key: _globalKey, - child: Container( - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage(getCircleImage("open_vip_bg")), - fit: BoxFit.fill, - ), - ), - child: Column( - children: [ - Container( - width: Get.width, - height: 65.sp, - margin: EdgeInsets.only(left: 15.sp, top: 20.sp,right: 15.sp), - child: Row( - children: [ - Center( - child: Stack( - alignment: Alignment.center, - children: [ - Container( - width: 47.sp, - height: 47.sp, - decoration: const BoxDecoration( - shape: BoxShape.circle, - gradient: LinearGradient( - colors: [ - Color(0xFFDD3DF4), - Color(0xFF30FFD9) - ], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - SizedBox( - width: 46.sp, - height: 46.sp, - child: _buildAvatar1(logic), - ) - ], - ), - ), - Expanded( - child: Container( - padding: EdgeInsets.only(left: 10.sp), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - _buildNameRow(logic), - SizedBox(height: 10.sp), - _buildInfoRow(logic), - ], - ), - ), - ), - Image.asset( - getBaseImage("ic_launcher"), - width: 65.sp, - height: 65.sp, - ) - ], - ), - ), - // Expanded( - // child: - Container( - padding: EdgeInsets.only(left: 10.sp,right: 10.sp), - // color: Colors.red, - // height: 310.sp, - child: Column( - children: [ - SizedBox( - height: 5.sp, - ), - Container( - padding: EdgeInsets.only(left: 15.sp,right: 15.sp), - child: Image.asset( - getMineImage('share_title'), - ), - ), - SizedBox( - height: 10.sp, - ), - Image.asset( - getMineImage('share_content_bg'), - // height: 260.sp, - fit:BoxFit.fitWidth - ), - ], - ), - ), - Container( - // height: 90.sp, - // color: Color(0xFF334141), - alignment: Alignment.center, - // color: Colors.yellow, - // width: Get.width-40.sp, - margin: EdgeInsets.only(bottom: 15.sp,top: 10.sp), - padding: EdgeInsets.only(left: 15.sp, right: 15.sp), - child: Row( - - children: [ - Expanded( - child: Container( - // color: Colors.red, - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Container( - // color: Colors.blue, - child: Row( - children: [ - Text( - '专属邀请码', - style: TextStyle( - color: Colors.white, - fontSize: 18.sp), - ), - SizedBox( - width: 8.sp, - ), - Container( - alignment: Alignment.center, - padding: EdgeInsets.only( - left: 10.sp, right: 10.sp), - height: 25.sp, - decoration: BoxDecoration( - // color: Color(0xFFDC5BFD), - gradient: - const LinearGradient( - colors: [ - Color(0xFF0DF5F7), - Color(0xFFD263FB) - ], - begin: - Alignment.centerLeft, - end: - Alignment.centerRight, - ), - borderRadius: - BorderRadius.circular( - 12.5.sp)), - child: Text( - widget.code, - style: TextStyle( - color: Colors.black, - fontSize: 12.sp), - ), - ) - ], - ), - ), - Container( - margin: EdgeInsets.only(top: 10.sp), - width: Get.width - 200.sp, - child: Text( - '扫码或长按识别下载APP,认识更多小众圈子里的人,给生活带来更多乐趣~', - style: TextStyle( - color: Colors.white, - fontSize: 15.sp)), - ) - ], - ), - ), - ), - // Image.asset(getBaseImage("ic_launcher"),width: 80.sp,height: 80.sp,) - Stack( - alignment: Alignment.center, - children: [ - Container( - color: Colors.white, - width: 90.sp, - height: 90.sp, - ), - QrImageView( - data: widget.link, - padding: EdgeInsets.zero, - version: QrVersions.auto, - size: 80.sp, - gapless: false, - // backgroundColor: Colors.black, - ) - ], - ) - ], - ), - ) - ], - ), - )) - ), - ), - SafeArea( - top: false, - child: Container( - height: 164.sp, - width: Get.width, - color: Color(0xFF292247), - child: Column( - children: [ - Expanded( - child: Container( - padding: EdgeInsets.only( - top: 15.sp, left: 15.sp, right: 15.sp), - alignment: Alignment.center, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - shareAction('wx', '微信', () { - shareWxData(1); - }), - shareAction('wxq', '朋友圈', () { - shareWxData(2); - }), - shareAction('save', '复制邀请链接', () { - copyInviteText(logic.name); - }), - shareAction('hb', '保存邀请海报', () { - _saveLocalImage(); - }), - ], - ), - )), - Container( - height: 1.sp, - color: Color(0x33FFFFFF), - ), - GestureDetector( - onTap: () { - Get.back(); - }, - child: Container( - height: 67.sp, - alignment: Alignment.center, - child: Text( - '取消', - style: TextStyle( - color: Colors.white, fontSize: 14.sp), - ), - ), - ) - ], - ), - )) - ], - ), - ), - ); - } - - Widget _buildAvatar1(MinefragmentLogic logic) { - return ClipOval( - child: GestureDetector( - onTap: () { - if (logic.userInfoBean != null) { - var imgList = []; - imgList.add(logic.userInfoBean!.avatar); - // Get.toNamed(AppRoutes.Swiper,arguments:imgList); - // Get.toNamed(AppRoutes.Swiper, arguments: { - // 'imaglist': imgList, - // 'index': 0 - // }); - } - }, - child: logic.userInfoBean == null - ? SizedBox( - width: 63.sp, - height: 63.sp, - ) - : CachedNetworkImage( - fit: BoxFit.cover, - placeholder: null, - imageUrl: logic.avatar, - width: 63.sp, - height: 63.sp, - ), - ), - ); - } - - Widget _buildNameRow(MinefragmentLogic logic) { - return Container( - margin: EdgeInsets.only(top: 6.sp), - child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - logic.name, - style: TextStyle( - color: const Color.fromRGBO(247, 250, 250, 1.0), - fontSize: 16.sp, - ), - ), - SizedBox( - width: 4.sp, - ), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color.fromRGBO(141, 255, 248, 1.0), - Color.fromRGBO(181, 211, 255, 1.0), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 2.sp, bottom: 2.sp, left: 10.sp, right: 10.sp), - child: Text( - logic.ageMsg, - style: TextStyle( - color: Colors.black, - fontSize: 10.sp, - ), - ), - ), - ], - ), - ); - } - - Widget _buildInfoRow(MinefragmentLogic logic) { - return Row( - children: [ - Text('邀请您加入', - style: TextStyle( - color: Colors.white, - fontSize: 12.sp, - )), - Text('【微乐园APP】', - style: TextStyle( - color: Color(0xFF0DF5F7), - fontSize: 12.sp, - )), - ], - ); - } - - shareAction(String img, String name, GestureTapCallback onTap) { - return GestureDetector( - onTap: onTap, - child: Container( - child: Column( - children: [ - Image.asset( - getMineImage(img), - width: 40.sp, - ), - SizedBox( - height: 10.sp, - ), - Text( - name, - style: TextStyle(color: Colors.white, fontSize: 12.sp), - ) - ], - ), - ), - ); - } - - _saveLocalImage() async { - RenderRepaintBoundary boundary = - _globalKey.currentContext!.findRenderObject() as RenderRepaintBoundary; - ui.Image image = await boundary.toImage(pixelRatio: ui.window.devicePixelRatio); - ByteData? byteData = - await (image.toByteData(format: ui.ImageByteFormat.png)); - if (byteData != null) { - final result = - await ImageGallerySaver.saveImage(byteData.buffer.asUint8List()); - print(result); - // isSuccess - if (result['isSuccess']) { - showOKToast('保存成功'); - } else { - showOKToast('保存失败,请检查相册权限是否开启'); - } - } - } - - copyInviteText( - String username, - ) { - Clipboard.setData(ClipboardData( - text: '【${username}】邀请你加入“微乐园”,邀请码为${widget.code},点击进入${widget.link}' - '这是一款专为各种特色小众圈子爱好者打造的交友平台,资质齐全,安全正规。' - '在这里,能看到很多没听说过的圈子,也能发现很多为数不多的真实情怀,还能见证小众亚文化在生活方式上的新体验。真实、安全、私密、走心,我和很多圈友都在玩哦~')); - showOKToast('您已成功复制分享链接,前往对应平台粘贴发送即可~'); - } - /** - * 分享图片到微信, - * file=本地路径 - * url=网络地址 - * asset=内置在app的资源图片 - * scene=分享场景,1好友会话,2朋友圈,3收藏 - */ - void shareWxData(int scene) async { - - SmartDialog.showLoading(msg:'正在生成分享图片...'); - RenderRepaintBoundary boundary = - _globalKey.currentContext!.findRenderObject() as RenderRepaintBoundary; - ui.Image image = await boundary.toImage(pixelRatio: ui.window.devicePixelRatio); - ByteData? byteData = - await (image.toByteData(format: ui.ImageByteFormat.png)); - String filePath = ''; - if (byteData != null) { - Uint8List pngBytes = byteData!.buffer.asUint8List(); - Directory directory = await getApplicationDocumentsDirectory(); - filePath = '${directory.path}/widget_image.png'; - File imageFile = File(filePath); - imageFile.writeAsBytesSync(pngBytes); - } - SmartDialog.dismiss(); - fluwx.WeChatScene wxScene = fluwx.WeChatScene.SESSION; - if (scene == 2) { - wxScene = fluwx.WeChatScene.TIMELINE; - } - fluwx.WeChatShareImageModel? model; - - if (filePath.isNotEmpty) { - model = fluwx.WeChatShareImageModel(fluwx.WeChatImage.file(File(filePath)), - title: '', description: '', scene: wxScene); - } - if (model != null) { - fluwx.shareToWeChat(model!); - } - - } -} diff --git a/circle_app/lib/app/invite/state.dart b/circle_app/lib/app/invite/state.dart deleted file mode 100644 index fb5b659..0000000 --- a/circle_app/lib/app/invite/state.dart +++ /dev/null @@ -1,5 +0,0 @@ -class InviteState { - InviteState() { - ///Initialize variables - } -} diff --git a/circle_app/lib/app/invite/view.dart b/circle_app/lib/app/invite/view.dart deleted file mode 100644 index 38a80c3..0000000 --- a/circle_app/lib/app/invite/view.dart +++ /dev/null @@ -1,1181 +0,0 @@ -import 'package:circle_app/app/invite/share.dart'; -import 'package:circle_app/app/swiper/view.dart'; -import 'package:circle_app/common/Widgets/rich_text.dart'; -import 'package:circle_app/common/colors/app_color.dart'; -import 'package:circle_app/components/my_app_bar.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:flutter_swiper/flutter_swiper.dart'; -import 'package:get/get.dart'; -import 'package:gradient_borders/box_borders/gradient_box_border.dart'; -import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; - -import '../../router/app_routers.dart'; -import 'logic.dart'; - -class InvitePage extends StatelessWidget { - InvitePage({Key? key}) : super(key: key); - - final logic = Get.find(); - final state = Get.find().state; - - - - - @override - Widget build(BuildContext context) { - return Container( - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage(getBaseImage("home_back")), - fit: BoxFit.cover, - ), - ), - child: Scaffold( - backgroundColor: Colors.transparent, - appBar: MyAppBar( - centerTitle: "邀请赚钱", - actionWdiget: Container( - alignment: Alignment.center, - height: 22.sp, - width: 62.sp, - child: Image.asset( - getMineImage('invite_right_icon'), - width: 62.sp, - fit: BoxFit.fill, - ), - ), - onPressed: () { - navigateToInviteStrategy(); - }, - ), - body: GetBuilder(builder: (logic) { - List peopleCountList = []; - List dayCountList = []; - List allSpan = []; - if (logic.isLoad == false) { - logic.homeData!.inviteAwardConf!.forEach((element) { - peopleCountList.add(peopleCountWidget( - '${element!.inviteCount! ?? '0'}', - (element!.inviteCount! ?? 0) <= - logic.homeData!.inviteCount!)); - - if ((element.rewardDay! ?? 0) > 365) { - dayCountList.add( - timeWidget('${(element.rewardDay! / 365).toInt()}年')); - } else { - dayCountList.add(timeWidget('${element.rewardDay!}天')); - } - // timeWidget( - // '+30天', - // ), - }); - - allSpan.addAll(getTextSpanList( - 'Tip:您已成功邀请', Color(0xFF0DF5F7), 13.sp, - searchContent: 'Tip:')); - allSpan.addAll(getTextSpanList( - ' ${logic.homeData!.inviteCount! ?? 0} 位圈友,', - Color(0xFFDC5BFD), - 13.sp, - searchContent: '${logic.homeData!.inviteCount! ?? 0}')); - allSpan.addAll(getTextSpanList( - '免费获得会员 ${logic.homeData!.achieveRewardDay! ?? '0'} 天,', - Color(0xFFDC5BFD), - 13.sp, - searchContent: - '${logic.homeData!.achieveRewardDay! ?? '0'} ')); - int maxCount = - logic.homeData!.inviteAwardConf!.last.inviteCount ?? 0; - if (logic.homeData!.inviteCount! >= maxCount) { - allSpan.addAll(getTextSpanList( - ' 再邀请可领取更多奖励~', Color(0xFFDC5BFD), 13.sp, - searchContent: '')); - } else { - allSpan.addAll(getTextSpanList( - ' 再邀请 ${logic.homeData!.diffAwardCount} 位圈友可领取更多奖励~', - Color(0xFFDC5BFD), - 13.sp, - searchContent: '${logic.homeData!.diffAwardCount}')); - } - } - - return logic.isLoad - ? loaddingWidget(true) - : Stack( - fit: StackFit.expand, - children: [ - SingleChildScrollView( - controller: logic.scrollController, - child: Column(children: [ - Container( - // height: 83.sp, - margin: EdgeInsets.only( - left: 20.sp, right: 20.sp, top: 0.sp), - decoration: BoxDecoration( - color: Color(0xFF4C3E5F).withOpacity(0.25), - border: GradientBoxBorder( - gradient: AppColor.mainVerLinearGradient, - width: 1.sp, - ), - borderRadius: BorderRadius.circular(10.sp)), - child: Column( - children: [ - Container( - padding: EdgeInsets.only( - left: 14.sp, right: 14.sp, top: 10.sp), - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Text( - '专属邀请码', - style: TextStyle( - color: Colors.white, - fontSize: 16.sp, - fontWeight: FontWeight.w500), - ), - if (logic.homeData!.superior == null) - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - showCodePicker(logic); - }, - child: Container( - alignment: Alignment.center, - width: 84.sp, - child: Image.asset( - getMineImage('add_code_icon')), - ), - ), - if (logic.homeData!.superior != null) - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - Get.toNamed(AppRoutes.UserInfoActivity,arguments: logic.homeData!.superior!.id!.toString()); - }, - child: Container( - alignment: Alignment.center, - child: Row( - children: [ - Text('邀请人:',style: TextStyle(color: Colors.white,fontSize: 14.sp),), - Text( - '${logic.homeData!.superior!.nickname!}', - style: TextStyle( - color: AppColor.mainColor, - fontSize: 14.sp), - ), - ], - ), - ), - ), - ], - ), - ), - Container( - margin: EdgeInsets.only(top: 0.sp), - child: Row( - children: [ - SizedBox( - width: 14.sp, - ), - Text( - logic.homeData!.inviteCode! ?? '', - style: TextStyle( - fontSize: 30.sp, - fontWeight: FontWeight.w600, - color: Color(0xffF657FF)), - ), - SizedBox( - width: 4.sp, - ), - GestureDetector( - onTap: () { - Clipboard.setData(ClipboardData( - text: logic.homeData! - .inviteCode! ?? - '')); - showOKToast('复制成功'); - }, - child: Text( - '复制', - style: TextStyle( - color: Color(0xff0DF5F7), - fontSize: 14.sp), - )), - Expanded(child: Container()) - ], - ), - ), - ], - ), - ), - Container( - height: 40.sp, - margin: EdgeInsets.only( - left: 20.sp, right: 20.sp, top: 10.sp), - decoration: BoxDecoration( - color: Color(0xFF4C3E5F).withOpacity(0.25), - border: GradientBoxBorder( - gradient: AppColor.mainVerLinearGradient, - width: 1.sp, - ), - borderRadius: BorderRadius.circular(10.sp), - ), - child: Swiper( - physics: NeverScrollableScrollPhysics(), - autoplay: true, - // controller: 5, - index: 0, - itemBuilder: (BuildContext context, int index) { - Map data = logic.sysData[index]; - return Container( - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - data['inviter_name'], - style: TextStyle( - color: Color(0xff0DF5F7), - fontSize: 16.sp, - fontWeight: FontWeight.w500), - ), - Container( - margin: EdgeInsets.only( - left: 5.sp, right: 5.sp), - child: Text( - '邀请', - style: TextStyle( - color: Colors.white, - fontSize: 16.sp, - fontWeight: FontWeight.w500), - )), - Text( - data['invitee_name'] ?? '', - style: TextStyle( - color: Color(0xff0DF5F7), - fontSize: 16.sp, - fontWeight: FontWeight.w500), - ), - Container( - margin: EdgeInsets.only(left: 5.sp), - child: Text( - '加入微乐园', - style: TextStyle( - color: Colors.white, - fontSize: 16.sp, - fontWeight: FontWeight.w500), - )), - ], - ), - ); - }, - itemCount: logic.sysData.length, - ), - ), - Container( - height: 220.sp, - width: Get.width - 30.sp, - margin: EdgeInsets.only(top: 10.sp), - padding: EdgeInsets.only( - top: 10.sp, - bottom: 10.sp, - left: 10.sp, - right: 10.sp), - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage( - getMineImage("invite_count_bg")), - fit: BoxFit.fill, - ), - ), - child: Column( - children: [ - Container( - margin: EdgeInsets.only( - top: 15.sp, left: 35.sp, right: 35.sp), - alignment: Alignment.center, - child: Image.asset( - getMineImage('invite_title'), - height: 22.sp, - ), - ), - Container( - margin: EdgeInsets.only(top: 15.sp), - alignment: Alignment.center, - child: Image.asset( - getMineImage('invite_line'), - height: 1.2.sp, - ), - ), - Container( - height: 70.sp, - margin: EdgeInsets.only( - left: 15.sp, right: 15.sp), - child: Row( - children: [ - Text( - '邀请人数', - style: TextStyle( - color: Color(0xFF0DF5F7), - fontSize: 14.sp, - fontWeight: FontWeight.w500), - ), - Expanded( - child: Stack( - // fit: StackFit.expand, - alignment: Alignment.center, - children: [ - Container( - margin: EdgeInsets.only( - left: 61.sp, right: 46.sp), - height: 2.sp, - color: Color(0xFF0DF5F7), - ), - Container( - margin: EdgeInsets.only( - left: 15.sp), - child: Row( - mainAxisAlignment: - MainAxisAlignment - .spaceBetween, - children: peopleCountList, - ), - ) - ], - )) - ], - )), - Container( - height: 20.sp, - margin: EdgeInsets.only( - left: 15.sp, right: 15.sp), - child: Row( - children: [ - Text( - '会员时长', - style: TextStyle( - color: Color(0xFF0DF5F7), - fontSize: 14.sp, - fontWeight: FontWeight.w500), - ), - Expanded( - child: Stack( - // fit: StackFit.expand, - alignment: Alignment.center, - children: [ - Container( - margin: EdgeInsets.only( - left: 25.sp, right: 15.sp), - child: Row( - mainAxisAlignment: - MainAxisAlignment - .spaceBetween, - children: dayCountList), - ) - ], - )), - ], - )), - Expanded(child: Container()), - Container( - margin: EdgeInsets.only( - left: 15.sp, - right: 15.sp, - bottom: 10.sp), - child: RichText( - text: TextSpan(children: allSpan))) - ], - )), - Container( - margin: EdgeInsets.only( - top: 15.sp, - left: 15.sp, - right: 15.sp, - bottom: MediaQuery.of(context).padding.bottom + 10.sp + 50.sp), - height: 565.sp, - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage( - getMineImage("invite_count_bg")), - fit: BoxFit.fill)), - child: Column( - children: [ - Container( - margin: EdgeInsets.only(top: 45.sp), - // height: 40.sp, - child: Row( - children: [ - Expanded( - child: Container( - child: Column( - children: [ - Container( - child: Text( - '${logic.homeData!.inviteCount! ?? 0}人', - style: TextStyle( - color: AppColor.mainColor, - fontSize: 14.sp), - ), - ), - Container( - margin: - EdgeInsets.only(top: 10.sp), - child: Text( - '已成功邀请', - style: TextStyle( - color: Color(0xFFF7FAFA), - fontSize: 12.sp), - ), - ), - ], - ), - ), - ), - Container( - width: 1, - height: 47.sp, - color: Color(0x3AF0F1F4), - ), - Expanded( - child: Container( - child: Column( - children: [ - Container( - child: Text( - '${logic.homeData!.achieveRewardDay! ?? 0}天', - style: TextStyle( - color: AppColor.mainColor, - fontSize: 14.sp), - ), - ), - Container( - margin: - EdgeInsets.only(top: 10.sp), - child: Text( - '获得会员时长', - style: TextStyle( - color: Color(0xFFF7FAFA), - fontSize: 12.sp), - ), - ), - ], - ), - ), - ), - Container( - width: 1, - height: 47.sp, - color: Color(0x3AF0F1F4), - ), - Expanded( - child: Container( - child: Column( - children: [ - Container( - child: Text( - '${logic.directProfit! ?? 0}票', - style: TextStyle( - color: AppColor.mainColor, - fontSize: 14.sp), - ), - ), - Container( - margin: - EdgeInsets.only(top: 10.sp), - child: Text( - '直接获利', - style: TextStyle( - color: Color(0xFFF7FAFA), - fontSize: 12.sp), - ), - ), - ], - ), - ), - ), - Container( - width: 1, - height: 47.sp, - color: Color(0x3AF0F1F4), - ), - Expanded( - child: Container( - child: Column( - children: [ - Container( - child: Text( - '${logic.rebate! ?? 0}票', - style: TextStyle( - color: AppColor.mainColor, - fontSize: 14.sp), - ), - ), - Container( - margin: - EdgeInsets.only(top: 10.sp), - child: Text( - '间接返利', - style: TextStyle( - color: Color(0xFFF7FAFA), - fontSize: 12.sp), - ), - ), - ], - ), - ), - ), - ], - ), - ), - buildSegment(), - // Container( - // margin: EdgeInsets.only(top: 21.sp), - // child: Image.asset(getMineImage('icon_yaoqingjilujifenhong'))), - Expanded( - child: Container( - margin: EdgeInsets.only( - top: 15.sp, left: 20.sp, right: 20.sp,bottom: logic.selectedIndex == 1 ? 15.sp : 0.sp), - // height: 135.sp, - decoration: BoxDecoration( - color: Color(0x99363542), - borderRadius: - BorderRadiusDirectional.circular( - 4.sp), - border: Border.all( - color: Color(0x99363542), - width: 1.sp)), - child: logic.selectedIndex == 0 && - logic.inveiteData.isEmpty - ? noResultWidget() - : logic.selectedIndex == 1 && - logic.allInveiteData.isEmpty - ? noResultWidget() - : MediaQuery.removePadding( - removeTop:true, - context:context, - child:ListView.builder( - controller: logic.contentScrollController, - physics: logic.isContentScroll ? BouncingScrollPhysics() : NeverScrollableScrollPhysics(), - itemBuilder: - (BuildContext context, - int index) { - if (logic.selectedIndex == 0) { - if (index == 0) { - return myTitileWidget(); - } - var data = logic - .inveiteData[index - 1]; - return myRowWidget( - data['nickName'], - data['inviteTime'], - '${data['sysProfit']}票', - '${data['rebate'] > 0 ? data['rebate'] : 0}票(${data['rebateRate']}%)', - data['userId'] - .toString()); - } - - if (index == 0) { - return titileWidget(); - } else if (logic.allInveiteData - .length + - 1 == - index) { - return Container( - margin: EdgeInsets.only( - top: 4.sp, - left: 5.sp, - right: 5.sp), - child: Text( - '温馨提示:仅展示前${logic.allInveiteData.length}名,上榜的推广大使还能获得微乐园APP官方定制的精美礼品一份哦~', - style: TextStyle( - color: Colors.white - .withOpacity( - 0.75), - fontSize: 13.sp), - ), - ); - } - var data = logic - .allInveiteData[index - 1]; - return rowWidget( - data['nickname'], - data['inviteCount'] - .toString(), - data['vipDaysStr'].toString() + - '天', - '${data['directProfitStr']}票', - '${data['rebateStr']}票', - data['userId'].toString()); - }, - itemCount: logic.selectedIndex == - 0 - ? logic.inveiteData!.length + - 1 - : logic.allInveiteData - .length + - 2 - ), - ))), - if (logic.selectedIndex == 0) - GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.Invite_Record, - arguments: 0); - }, - child: Container( - margin: EdgeInsets.only( - top: 5.sp,bottom: 15.sp), - child: Text( - '查看更多邀请记录>', - style: TextStyle( - color: AppColor.mainColor - .withOpacity(0.75), - fontSize: 12.sp, - fontWeight: FontWeight.w500), - ), - ), - ) - ], - ), - ), - ])), - Positioned( - bottom: 10.sp, - left: 30.sp, - child: SafeArea( - child: GestureDetector( - onTap: () { - shopSharePiker( - logic.homeData!.inviteCode! ?? '', - (logic.homeData!.link! ?? '') + - '#code=${logic.homeData!.inviteCode! ?? ''}'); - }, - child: Container( - width: 150.sp, - height: 42.sp, - margin: EdgeInsets.only(top: 35.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(21.sp), - gradient: const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - )), - alignment: Alignment.center, - child: Text( - '邀请圈友赚钱', - style: TextStyle( - color: Colors.black, - fontSize: 16, - fontWeight: FontWeight.w600), - ), - ), - ), - ), - ), - Positioned( - bottom: 10.sp, - right: 30.sp, - child: SafeArea( - child: GestureDetector( - onTap: () { - var con; - if (kDebugMode) { - con = V2TimConversation( - conversationID: "c2c_qpqz_dev_10_102", - userID: "qpqz_dev_10_102", - showName: "测试乐园客服", - type: 1); - } else { - con = V2TimConversation( - conversationID: "c2c_qpqz_prod_10_102", - userID: "qpqz_prod_10_102", - showName: "乐园客服", - type: 1); - } - Get.toNamed(AppRoutes.Chat, arguments: con); - }, - child: Container( - width: 150.sp, - height: 42.sp, - margin: EdgeInsets.only(top: 35.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(21.sp), - gradient: const LinearGradient( - colors: [ - Color(0xFFDC5BFD), - Color(0xFFDC5BFD), - ], - )), - alignment: Alignment.center, - child: Text( - '联系客服结算', - style: TextStyle( - color: Colors.black, - fontSize: 16, - fontWeight: FontWeight.w600), - ), - ), - ), - ), - ), - ], - ); - }))); - } - - titileWidget() { - return Container( - height: 41.sp, - child: Column( - children: [ - Expanded( - child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Expanded( - child: infoText('推广大使'), - flex: 1, - ), - Container( - width: 1, - color: Color(0x0AFFFFFF), - ), - Expanded( - child: infoText('邀请人数'), - flex: 1, - ), - Container( - width: 1, - color: Color(0x0AFFFFFF), - ), - Expanded( - child: infoText('获会员'), - flex: 1, - ), - Container( - width: 1, - color: Color(0x0AFFFFFF), - ), - Expanded( - child: infoText('直接获利'), - flex: 1, - ), - Container( - width: 1, - color: Color(0x0AFFFFFF), - ), - Expanded( - child: infoText('间接返利'), - flex: 1, - ), - ], - ), - ), - Container( - height: 1, - color: Color(0x0AFFFFFF), - ), - ], - ), - ); - } - - myTitileWidget() { - return Container( - height: 41.sp, - child: Column( - children: [ - Expanded( - child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Expanded( - child: infoText('圈友'), - flex: 1, - ), - Container( - width: 1, - color: Color(0x0AFFFFFF), - ), - Expanded( - child: infoText('邀请时间'), - flex: 1, - ), - Container( - width: 1, - color: Color(0x0AFFFFFF), - ), - Expanded( - child: infoText('平台所得'), - flex: 1, - ), - Container( - width: 1, - color: Color(0x0AFFFFFF), - ), - Expanded( - child: infoText('平台为您返利'), - flex: 1, - ), - ], - ), - ), - Container( - height: 1, - color: Color(0x0AFFFFFF), - ), - ], - ), - ); - } - - infoText(String info, [Color color = const Color(0xFFF7FAFA)]) { - return Center( - child: Text( - info, - style: TextStyle(color: color, fontSize: 12.sp), - overflow: TextOverflow.ellipsis, - ), - ); - } - - myRowWidget( - String str1, - String str2, - String str3, - String str4, - String userId, - ) { - return Container( - height: 41.sp, - // margin: EdgeInsets.only(top: 10.sp, bottom: 10.sp), - child: Column( - children: [ - Expanded( - child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Expanded( - child: GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.UserInfoActivity, - arguments: userId); - }, - child: infoText(str1, AppColor.mainColor)), - flex: 1, - ), - Container( - width: 1, - color: Color(0x0AFFFFFF), - ), - Expanded( - child: infoText(str2, Colors.white), - flex: 1, - ), - Container( - width: 1, - color: Color(0x0AFFFFFF), - ), - Expanded( - child: infoText(str3, Colors.white), - flex: 1, - ), - Container( - width: 1, - color: Color(0x0AFFFFFF), - ), - Expanded( - child: infoText(str4, Colors.white), - flex: 1, - ), - ], - ), - ), - Container( - height: 1, - color: Color(0x0AFFFFFF), - ), - ], - ), - ); - } - - rowWidget( - String str1, - String str2, - String str3, - String str4, - String str5, - String userId, - ) { - return Container( - height: 41.sp, - // margin: EdgeInsets.only(top: 10.sp, bottom: 10.sp), - child: Column( - children: [ - Expanded( - child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Expanded( - flex: 1, - child: GestureDetector( - onTap: () { - if (userId == '0') return; - - Get.toNamed(AppRoutes.UserInfoActivity, - arguments: userId); - }, - child: infoText(str1, AppColor.mainColor)), - ), - Container( - width: 1, - color: Color(0x0AFFFFFF), - ), - Expanded( - child: infoText(str2, Colors.white), - flex: 1, - ), - Container( - width: 1, - color: Color(0x0AFFFFFF), - ), - Expanded( - child: infoText(str3, Colors.white), - flex: 1, - ), - Container( - width: 1, - color: Color(0x0AFFFFFF), - ), - Expanded( - child: infoText(str4, Colors.white), - flex: 1, - ), - Container( - width: 1, - color: Color(0x0AFFFFFF), - ), - Expanded( - child: infoText(str5, Colors.white), - flex: 1, - ), - ], - ), - ), - Container( - height: 1, - color: Color(0x0AFFFFFF), - ), - ], - ), - ); - } - - buildSegment() { - return Container( - margin: EdgeInsets.only(top: 15.sp), - decoration: BoxDecoration(borderRadius: BorderRadius.circular(20.sp)), - child: CupertinoSegmentedControl( - //子标签 - children: { - 0: Container( - margin: EdgeInsets.only(left: 10.sp, right: 10.sp), - child: Text( - "邀请记录及返利", - style: TextStyle( - color: logic.selectedIndex == 0 - ? Colors.black - : AppColor.mainColor, - fontSize: 14.sp, - ), - ), - ), - 1: Container( - margin: EdgeInsets.only(left: 10.sp, right: 10.sp), - child: Text( - "推广大使邀请榜", - style: TextStyle( - color: logic.selectedIndex == 1 - ? Colors.black - : AppColor.mainColor, - fontSize: 14.sp), - ), - ) - }, - //当前选中的索引 - groupValue: logic.selectedIndex, - //点击回调 - onValueChanged: (int index) { - print("当前选中 $index"); - - logic.selectedIndex = index; - logic.update(); - }, - //选中的背景颜色 - selectedColor: AppColor.mainColor, - //未选中的背景颜色 - unselectedColor: Colors.transparent, - - //边框颜色 - borderColor: AppColor.mainColor, - //按下的颜色 - // pressedColor: Colors.white, - ), - ); - } - - peopleCountWidget(String count, bool isCheck) { - return Container( - width: 46.sp, - height: 46.sp, - alignment: Alignment.center, - decoration: BoxDecoration( - color: isCheck ? Color(0xFF0DF5F7) : Color(0xFF504261), - shape: BoxShape.circle), - child: Text( - '$count人', - style: TextStyle( - color: isCheck ? Color(0xFF000000) : Colors.white, fontSize: 12.sp), - ), - ); - } - - timeWidget(String time) { - return Text( - time, - style: TextStyle(color: Colors.white, fontSize: 14.sp), - ); - } - - void shopSharePiker(String code, String link) { - Get.bottomSheet(Share(code, link), - isScrollControlled: true, enableDrag: false); - } -} - -void showCodePicker(InviteLogic logic) { - Get.bottomSheet( - GestureDetector( - onTap: () { - FocusManager.instance.primaryFocus?.unfocus(); - }, - child: Scaffold( - backgroundColor: Colors.transparent, - resizeToAvoidBottomInset: false, - body: Center( - child: Container( - height: 240.sp, - decoration: BoxDecoration( - color: Color(0xFF292247), - borderRadius: BorderRadius.circular(6.sp)), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.only(top: 20.sp, left: 20.sp), - child: Text( - '请输入邀请您加入APP的圈友的邀请码', - style: TextStyle(color: Colors.white, fontSize: 14.sp), - ), - ), - Container( - margin: EdgeInsets.only(left: 20, right: 20.sp, top: 30.sp), - decoration: BoxDecoration( - color: Color(0x1AFFFFFF), - borderRadius: BorderRadius.circular(6.sp)), - alignment: Alignment.center, - child: TextField( - controller: logic.codeEditingController, - maxLength: 8, - textAlign: TextAlign.center, - style: TextStyle(color: Colors.white, fontSize: 16.sp), - decoration: InputDecoration( - hintText: '请输入邀请码', - hintStyle: - TextStyle(color: Colors.white70, fontSize: 16.sp), - border: InputBorder.none, - counterText: '', - contentPadding: EdgeInsets.only(left: 16.sp)), - ), - ), - Container( - margin: EdgeInsets.only(top: 15.sp), - alignment: Alignment.center, - child: Text( - '为防止作弊,进入APP后请在1小时填写TA的邀请码', - style: TextStyle(color: Colors.white, fontSize: 12.sp), - ), - ), - Expanded(child: Container()), - Container( - margin: EdgeInsets.only( - left: 40.sp, right: 40.sp, bottom: 20.sp), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - onTap: () { - Get.back(); - }, - child: Container( - alignment: Alignment.center, - width: 114.sp, - height: 38.sp, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(19.sp), - color: Color(0x1AFFFFFF)), - child: const Text( - '放弃对接', - style: - TextStyle(color: Colors.white, fontSize: 16), - ), - ), - ), - GestureDetector( - onTap: () { - if (logic.codeEditingController.text.isEmpty) { - showOKToast('请输入邀请码'); - return; - } - Get.back(); - logic.addCode(logic.codeEditingController.text); - }, - child: Container( - alignment: Alignment.center, - width: 114.sp, - height: 38.sp, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(19.sp), - gradient: const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - )), - child: const Text( - '确认对接', - style: - TextStyle(color: Colors.black, fontSize: 16), - ), - ), - ) - ], - ), - ) - ], - ), - ), - ), - ), - ), - isScrollControlled: true, - enableDrag: false); -} diff --git a/circle_app/lib/app/likelist/binding.dart b/circle_app/lib/app/likelist/binding.dart deleted file mode 100644 index e03ad9c..0000000 --- a/circle_app/lib/app/likelist/binding.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:get/get.dart'; - -import 'logic.dart'; - -class LikelistBinding extends Bindings { - @override - void dependencies() { - Get.lazyPut(() => LikelistLogic()); - } -} diff --git a/circle_app/lib/app/likelist/logic.dart b/circle_app/lib/app/likelist/logic.dart deleted file mode 100644 index 4320482..0000000 --- a/circle_app/lib/app/likelist/logic.dart +++ /dev/null @@ -1,187 +0,0 @@ -import 'package:circle_app/app/minefragment/logic.dart'; -import 'package:get/get.dart'; -import 'package:pull_to_refresh/pull_to_refresh.dart'; - -import '../../network/api.dart'; -import '../../network/dio_manager.dart'; -import '../../util/eventBus.dart'; -import '../../util/util.dart'; -import 'state.dart'; - -class LikelistLogic extends GetxController { - void dispose() { - refreshController.dispose(); - super.dispose(); - } - - final RefreshController refreshController = RefreshController(); - final LikelistState state = LikelistState(); - - int page = 1; - int isVip = 0; - bool isLoad = true; - bool isMore = true; - List lists = []; - @override - void onInit() async { - super.onInit(); - // var mineLogic = Get.find(); - // isVip = mineLogic.isVip.value; - await loadMyInfo(); - initList(); - - } - - loadMyInfo() async { - var data = await DioManager.instance.get(url: Api.getUserMine); - var bean = BaseResponse.fromJson( - data, (data) => MineResponseBean.fromJson(data)); - if (bean.isSuccess()) { - isVip = bean.data.user.vip; - update(); - } - } - - initList() async { - - var data = await DioManager.instance - .get(url: Api.fansList, params: {'page': page,'page_size':10}); - var bean = BaseResponse.fromJson( - data, (data) => UserList.fromJson(data)); - if (page == 1) { - refreshController.refreshCompleted(); - refreshController.resetNoData(); - lists.clear(); - isMore = true; - } else { - refreshController.loadComplete(); - } - if (bean.isSuccess()) { - List dataList = bean.data.lists; - - if (dataList.isNotEmpty) { - lists.addAll(bean.data.lists); - if (dataList.length != 10) { - refreshController.loadNoData(); - isMore = false; - } - } else { - refreshController.loadNoData(); - isMore = false; - } - - } - isLoad = false; - update(); - - } - - setLike(int index) async { - var data = await DioManager.instance.post( - url: "${Api.setLike + lists[index].user.id.toString()}/follow", - params: {'status': lists[index].isLike ? "0" : "1"}); - var bean = BaseResponse.fromJson( - data, - (jsonData) => jsonData, - ); - if (bean.isSuccess()) { - lists[index].isLike = !lists[index].isLike; - update(); - } - showOKToast(bean.msg); - } -} - -class User { - final int id; - final String nickname; - final String avatar; - final String signature; - final String birthday; - final int age; - final int vip; - final int gender; - final int role; - final int orientation; - final double lng; - final double lat; - final String city; - final String imId; - final String avatarThumb; - - User({ - required this.id, - required this.nickname, - required this.avatar, - required this.signature, - required this.birthday, - required this.age, - required this.vip, - required this.gender, - required this.role, - required this.orientation, - required this.lng, - required this.imId, - required this.lat, - required this.city, - required this.avatarThumb, - }); - - factory User.fromJson(Map json) { - return User( - id: json['id'], - nickname: json['nickname'], - avatar: json['avatar'], - signature: json['signature'], - birthday: json['birthday'], - age: json['age'], - imId: json['imId'] ?? '', - vip: json['vip'], - gender: json['gender'], - role: json['role'], - orientation: json['orientation'], - lng: json['lng'], - lat: json['lat'], - city: json['city'], - avatarThumb: json['avatar_thumb'], - ); - } -} - -class UserListItem { - final User user; - bool isLike; - - UserListItem({ - required this.user, - required this.isLike, - }); - - factory UserListItem.fromJson(Map json) { - return UserListItem( - user: User.fromJson(json['user']), - isLike: json['isLike'], - ); - } -} - -class UserList { - final List lists; - - UserList({ - required this.lists, - }); - - factory UserList.fromJson(Map json) { - List userItems = []; - if (json['lists'] != null) { - for (var item in json['lists']) { - userItems.add(UserListItem.fromJson(item)); - } - } - - return UserList( - lists: userItems, - ); - } -} diff --git a/circle_app/lib/app/likelist/state.dart b/circle_app/lib/app/likelist/state.dart deleted file mode 100644 index b4e92d4..0000000 --- a/circle_app/lib/app/likelist/state.dart +++ /dev/null @@ -1,5 +0,0 @@ -class LikelistState { - LikelistState() { - ///Initialize variables - } -} diff --git a/circle_app/lib/app/likelist/view.dart b/circle_app/lib/app/likelist/view.dart deleted file mode 100644 index 4ae0857..0000000 --- a/circle_app/lib/app/likelist/view.dart +++ /dev/null @@ -1,513 +0,0 @@ -import 'dart:ui'; - -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:circle_app/app/minefragment/logic.dart'; -import 'package:circle_app/common/Widgets/base_tip_widget.dart'; -import 'package:circle_app/common/Widgets/open_vip_tip/view.dart'; -import 'package:circle_app/common/colors/app_color.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:pull_to_refresh/pull_to_refresh.dart'; - -import '../../components/my_app_bar.dart'; -import '../../main.dart'; -import '../../router/app_routers.dart'; -import '../../util/util.dart'; -import 'logic.dart'; - -class LikelistPage extends StatefulWidget { - LikelistPage({Key? key}) : super(key: key); - - @override - State createState() => _LikelistPageState(); -} - -class _LikelistPageState extends State with RouteAware { - final logic = Get.find(); - - final state = Get.find().state; - - @override - void didChangeDependencies() { - // TODO: implement didChangeDependencies - super.didChangeDependencies(); - - /// 路由订阅 - routeObserver.subscribe(this, ModalRoute.of(context) as PageRoute); - } - - @override - void didPopNext() { - // TODO: implement didPopNext - super.didPopNext(); - logic.loadMyInfo(); - } - - @override - Widget build(BuildContext context) { - return GetBuilder(builder: (logic) { - return Scaffold( - backgroundColor: Colors.transparent, - body: SafeArea( - child: logic.isLoad - ? loaddingWidget(true) - : logic.lists.isEmpty - ? Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - noResultWidget(), - SizedBox( - height: 10.sp, - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - GestureDetector( - onTap: () async { - actionFunc(); - }, - child: Container( - padding: - EdgeInsets.only(left: 15.sp, right: 15.sp), - height: 28.sp, - decoration: BoxDecoration( - gradient: AppColor.mainVerLinearGradient, - borderRadius: BorderRadius.circular(14), - ), - child: Center( - child: Text('10倍曝光吸引更多喜欢你的圈友', - style: TextStyle( - fontSize: 14.sp, - color: Colors.white)), - ), - ), - ), - ], - ) - ], - ) - : Stack( - children: [ - SmartRefresher( - controller: logic.refreshController, - onRefresh: _onRefresh, - onLoading: _onLoading, - enablePullUp: true, - child: ListView.builder( - padding: EdgeInsets.all(10.sp), - itemCount: logic.lists.length, - itemBuilder: (context, index) { - return ListItem(logic.lists[index], index); - }, - ), - ), - showGd() - ], - ), - ), - ); - }); - } - - Widget showGd() { - double interval = 50; - List urlList = []; - - if (logic.lists.length > 3) { - for (int i = 3; i < logic.lists.length; i++) { - if (urlList.length < 3) { - print(logic.lists[i].user.avatar); - urlList.add(logic.lists[i].user.avatar); - } else { - break; - } - } - } - - List widgets = []; - - switch (urlList.length) { - case 0: - widgets.add(Positioned( - left: (Get.width / 2) - 40, - child: circleWidget(""), - )); - break; - case 1: - for (int i = 0; i < urlList.length; i++) { - var element = urlList[i]; -// double xOffset = interval * i + xOffsetBase; - double let = (Get.width / 2) - 60; - if (element == '') { - element = - 'https://i0.wp.com/picjumbo.com/wp-content/uploads/romantic-tropical-beach-with-villa-and-palms-during-beautiful-sunset-free-photo.jpg?w=600&quality=80'; - } - - widgets.add(Positioned( - left: let, - child: circleWidget(element), - )); - } - - widgets.add(Positioned( - left: (Get.width / 2) - 20, - child: circleWidget(""), - )); - break; - case 2: - double xOffsetBase = - (Get.width + interval * urlList.length - 60.0 * urlList.length) * - 0.25; - - for (int i = 0; i < urlList.length; i++) { - var element = urlList[i]; -// double xOffset = interval * i + xOffsetBase; - double let = ((Get.width / 2) - ((40 * urlList.length)) + (i * 40)); - if (element == '') { - element = - 'https://i0.wp.com/picjumbo.com/wp-content/uploads/romantic-tropical-beach-with-villa-and-palms-during-beautiful-sunset-free-photo.jpg?w=600&quality=80'; - } - widgets.add(Positioned( - left: let, - child: circleWidget(element), - )); - } - - double xOffset = interval * urlList.length + xOffsetBase; - widgets.add(Positioned( - left: xOffset, - child: circleWidget(""), - )); - break; - case 3: - // double xOffsetBase = (Get.width + interval * urlList.length - 60.0 * urlList.length) * 0.25; - - for (int i = 0; i < urlList.length; i++) { - switch (i) { - case 0: - if (urlList[i] == '') { - urlList[i] = - 'https://i0.wp.com/picjumbo.com/wp-content/uploads/romantic-tropical-beach-with-villa-and-palms-during-beautiful-sunset-free-photo.jpg?w=600&quality=80'; - } - widgets.add(Positioned( - left: (Get.width / 2) - 100, - child: circleWidget(urlList[i]), - )); - break; - case 1: - if (urlList[i] == '') { - urlList[i] = - 'https://i0.wp.com/picjumbo.com/wp-content/uploads/romantic-tropical-beach-with-villa-and-palms-during-beautiful-sunset-free-photo.jpg?w=600&quality=80'; - } - widgets.add(Positioned( - left: (Get.width / 2) - 60, - child: circleWidget(urlList[i]), - )); - break; - case 2: - if (urlList[i] == '') { - urlList[i] = - 'https://i0.wp.com/picjumbo.com/wp-content/uploads/romantic-tropical-beach-with-villa-and-palms-during-beautiful-sunset-free-photo.jpg?w=600&quality=80'; - } - widgets.add(Positioned( - left: (Get.width / 2) - 20, - child: circleWidget(urlList[i]), - )); - break; - } - } - widgets.add(Positioned( - left: (Get.width / 2) + 20, - child: circleWidget(""), - )); - - break; - } - - return logic.isVip > 0 - ? Container() - : Positioned( - bottom: 150, - child: Container( - width: Get.width, - child: Column( - children: [ - SizedBox( - height: 140.sp, - width: Get.width, - child: Stack( - alignment: Alignment.centerLeft, - children: widgets, - ), - ), - Container( - margin: EdgeInsets.only(bottom: 40.sp), - child: Text( - "TA们也喜欢你哦 \n" - "成为会员查看所有圈友信息", - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.white, - fontSize: 15.sp, - ), - ), - ), - GestureDetector( - onTap: () { - showRechargeDialog(); - }, - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: AppColor.mainVerLinearGradient, - ), - padding: EdgeInsets.symmetric( - vertical: 10.sp, - horizontal: 55.sp, - ), - child: Text( - "开通会员查看更多喜欢我的圈友", - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - ), - ), - ), - ), - ], - ), - ), - ); - } - - circleWidget(String url, {double width = 80}) { - return GestureDetector( - onTap: () { - // openvi(); - }, - child: Stack( - alignment: Alignment.center, - children: [ - Image.asset( - getCircleImage('more'), - width: width.sp, - height: width.sp, - ), - url != null && url.contains("http") - ? ClipOval( - child: CachedNetworkImage( - imageUrl: url, - width: (width - 1).sp, - height: (width - 1).sp, - fit: BoxFit.cover, - ), - ) - : Text( - url, - style: TextStyle(color: Color(0xffF756FF), fontSize: 12.sp), - ) - ], - )); - } - - Widget ListItem(UserListItem item, int index) { - return Column( - children: [ - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - if (logic.isVip > 0 || index < 3) { - Get.toNamed(AppRoutes.UserInfoActivity, - arguments: item.user.id.toString()); - } - }, - child: ImageFiltered( - imageFilter: ImageFilter.blur( - sigmaX: (logic.isVip > 0 || index < 3) ? 0 : 5, - sigmaY: (logic.isVip > 0 || index < 3) ? 0 : 5, - ), - child: Container( - margin: EdgeInsets.only(bottom: 21.sp), - child: Row( - children: [ - Stack( - children: [ - ClipOval( - child: CachedNetworkImage( - fit: BoxFit.cover, - imageUrl: item.user.avatarThumb, - width: 53.sp, - height: 53.sp, - ), - ), - Positioned( - right: 0.sp, - left: 0.sp, - bottom: 0.sp, - child: item.user.vip != 0 - ? Image( - image: AssetImage(getBaseImage( - item.user.vip == 1 ? "vip" : 'year_vip')), - width: 44.sp, - height: 18.sp, - ) - : Container(), - ) - ], - ), - SizedBox(width: 10.sp), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Text( - item.user.nickname, - style: const TextStyle( - color: Colors.white70, - fontSize: 14, - fontWeight: FontWeight.bold), - ), - SizedBox(width: 4.sp), - // SizedBox(height: 8.sp), - _buildInfoRow(item), - // Placeholder image - ], - ), - SizedBox(height: 8.sp), - SizedBox( - width: 200.sp, - child: Text( - item.user.signature, - overflow: TextOverflow.ellipsis, // 超出部分使用省略号表示 - maxLines: 1, - style: TextStyle( - fontSize: 12.sp, color: const Color(0xFFB7BECC)), - ), - ), - ], - ), - // Pla - const Spacer(), - GestureDetector( - onTap: () { - logic.setLike(index); - }, - child: Container( - width: 75.sp, - height: 28.sp, - decoration: BoxDecoration( - color: const Color(0xFFFF4D7C), - borderRadius: BorderRadius.circular(14), - ), - child: Center( - child: Text(item.isLike ? "互相喜欢" : "喜欢", - style: TextStyle( - fontSize: 14.sp, color: Colors.white)), - ), - ), - ), - ], - ), - ), - ), - ), - if (!logic.isMore && index == logic.lists.length - 1) - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - GestureDetector( - onTap: () async { - actionFunc(); - }, - child: Container( - padding: EdgeInsets.only(left: 15.sp, right: 15.sp), - height: 28.sp, - decoration: BoxDecoration( - gradient: AppColor.mainVerLinearGradient, - borderRadius: BorderRadius.circular(14), - ), - child: Center( - child: Text('10倍曝光吸引更多喜欢你的圈友', - style: TextStyle(fontSize: 14.sp, color: Colors.white)), - ), - ), - ), - ], - ) - ], - ); - } - - actionFunc() async { - if (logic.isVip == 2) { - showOKToast('已为你增加10倍曝光啦'); - } else { - showOKToast('开通年VIP可以增加10倍曝光哦~'); - await showOepnVipDialog(); - logic.loadMyInfo(); - } - } - - Widget _buildInfoRow(UserListItem userInfoBean) { - String ageMsg = getAgeCOntent( - userInfoBean.user.gender, - userInfoBean.user.age, - userInfoBean.user.role, - userInfoBean.user.orientation); - return Row( - children: [ - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17.sp), - gradient: const LinearGradient( - colors: [ - Color.fromRGBO(141, 255, 248, 1.0), - Color.fromRGBO(181, 211, 255, 1.0), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 2.sp, bottom: 2.sp, left: 10.sp, right: 10.sp), - child: Text( - ageMsg, - style: TextStyle( - color: Colors.black, - fontSize: 10.sp, - ), - ), - ), - SizedBox(width: 6.sp), - ], - ); - } - - void _onRefresh() async { - logic.page = 1; - logic.initList(); - } - - void _onLoading() async { - logic.page = logic.page + 1; - logic.initList(); - } - - showRechargeDialog() async { - MinefragmentLogic ctr = Get.find(); - Get.bottomSheet( - Scaffold( - backgroundColor: Colors.transparent, - body: Open_vip_tipPage(false), - ), - isScrollControlled: true, - enableDrag: false) - .then((value) { - ctr.getMode(); - logic.isVip = ctr.isVip.value; - logic.update(); - }); - } -} diff --git a/circle_app/lib/app/login/complete_material/binding.dart b/circle_app/lib/app/login/complete_material/binding.dart deleted file mode 100644 index c99b6f9..0000000 --- a/circle_app/lib/app/login/complete_material/binding.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:get/get.dart'; - -import 'logic.dart'; - -class Complete_materialBinding extends Bindings { - @override - void dependencies() { - Get.lazyPut(() => Complete_materialLogic()); - } -} diff --git a/circle_app/lib/app/login/complete_material/logic.dart b/circle_app/lib/app/login/complete_material/logic.dart deleted file mode 100644 index e95a4b1..0000000 --- a/circle_app/lib/app/login/complete_material/logic.dart +++ /dev/null @@ -1,542 +0,0 @@ - -import 'dart:convert'; - -import 'package:app_settings/app_settings.dart'; -import 'package:circle_app/network/dio_manager.dart'; -import 'package:circle_app/router/app_routers.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_native_splash/flutter_native_splash.dart'; -import 'package:flutter_pickers/time_picker/model/pduration.dart'; -import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; -import 'package:get/get.dart'; -import 'package:image_picker/image_picker.dart'; -import 'package:permission_handler/permission_handler.dart'; - -import '../../../common/Widgets/base_tip_widget.dart'; -import '../../../common/config.dart'; -import '../../../network/api.dart'; -import '../../../util/qiniu.dart'; -import '../../circle/logic.dart'; -import '../../minefragment/logic.dart'; -import '../../select_circle/logic.dart'; -import '../../userinfo/logic.dart'; -import 'state.dart'; - -class Complete_materialLogic extends GetxController { - var contactType = 2; - - @override - void onReady() { - // TODO: implement onReady - // FlutterNativeSplash.remove(); - super.onReady(); - - - } - final Complete_materialState state = Complete_materialState(); - final ImagePicker _picker = ImagePicker(); - var type = Get.arguments ?? ""; - - FocusNode focusNickNode = FocusNode(); - - FocusNode focusNode = FocusNode(); - - var quToken = ''; - var headUrl = ''; - - int unLockWxNum = 0; - - Map wxStatusInfo = {}; - - late ConfigBean configBean; - List numbers = []; - - List genderList = []; - - List orientationList = []; - - List roleList = []; - - UserBean? userInfoBean = null; - - List provinceList = []; - - List genderTagList = [];//你想认识 - - List watchGenderList = []; - Map cityMap = {}; - - @override - void onInit() async { - FlutterNativeSplash.remove(); - await loadCofigData(); - getCityList(); - if(type!=''){ - loadWXEditStatus(); - var data = await DioManager.instance.get(url: Api.getUserInfo); - var bean = BaseResponse.fromJson( - data, (data) => ResponseBean.fromJson(data)); - if(bean.isSuccess()){ - unLockWxNum = bean.data.unLockWxNum; - - userInfoBean = bean.data.user; - state.wxEditingController.text = userInfoBean!.wx_num ; - state.nickName = userInfoBean!.nickname; - state.sex = getGenderContent(userInfoBean!.gender); - state.genderId = userInfoBean!.gender.toString(); - state.age = userInfoBean!.age.toString(); - state.brithday = userInfoBean!.birthday.toString(); - state.role = getRoleContent(userInfoBean!.role); - state.roleId = userInfoBean!.role.toString(); - state.orientation = getOrientationContent(userInfoBean!.orientation); - if (userInfoBean!.orientations.isNotEmpty) { - watchGenderList.forEach((element) { - if (userInfoBean!.orientations!.contains(element.id)) { - element.isSelect = true; - } - }); - - } - state.orientationId = userInfoBean!.orientation.toString(); - state.textEditingController.text = userInfoBean!.nickname; - state.city = userInfoBean!.city ?? ''; - state.descEditingController.text = userInfoBean!.signature; - headUrl = userInfoBean!.avatar; - userInfoBean!.interests.forEach((element) { - numbers.add(MyConfigData(element.id.toString(),element.title,false)); - }); - update(); - // state.nickName = userInfoBean!.nickname; - }else{ - showOKToast(bean.msg); - } - - } else { - watchGenderList[1].isSelect = true; - update(); - } - - - - } - - loadWXEditStatus() async { - var data = - await DioManager.instance.get(url: Api.checkWxNumState,); - if (data['code'] == 200) { - // code 200 直接跳填微信,不提示,4000 不让填写,32100 弹返回的提示 - // - // BAN_ACTION(4000, "用户当前操作被禁止"), - // - // NOTICE_UPDATE_WXNUM(32100, "填写/更新微信需要消耗{}小票哦"); - - } else { - wxStatusInfo['${data['code']}'] = data['msg']; - } - } - - loadCofigData() async { - var data = - await DioManager.instance.get(url: Api.getqiniuToken, params: {}); - var bean = BaseResponse.fromJson( - data, (data) => QnTokenData.fromJson(data)); - if(bean.isSuccess()){ - quToken = bean.data!.token.toString(); - } - - - var data1 = - await DioManager.instance.get(url: Api.getCircleList, params: {}); - var bean1 = BaseResponse.fromJson( - data1, (data1) => ConfigBean.fromJson(data1)); - configBean = bean1.data!; - - configBean.genderMap.forEach((key, value) { - genderList.add(value); - SysTag tag = SysTag(id: int.parse(key), tagName: value); - watchGenderList.add(tag); - }); - - configBean.orientationMap.forEach((key, value) { - orientationList.add(value); - }); - configBean.roleMap.forEach((key, value) { - roleList.add(value); - }); - } - - getCityList() async { - try { - String jsonString = await rootBundle.loadString('assets/province.json'); - List jsonData = json.decode(jsonString); - provinceList = - jsonData.map((dynamic item) => Province.fromJson(item)).toList(); - cityMap.clear(); - for (int i = 0; i < provinceList.length; i++) { - Map areaMap = {}; - for (int c = 0; c < provinceList[i].city.length; c++) { - String cityName = provinceList[i].city[c].name; - List cityAreaList = []; - provinceList[i].city[c].area.forEach((element) { - cityAreaList.add(element); - }); - areaMap[cityName] = cityAreaList; - } - cityMap[provinceList[i].name] = areaMap; - } - } catch (e) { - print('Error loading JSON file: $e'); - } - } - - Future getImageFile() async { - - - checkPhotosStatus(); - try { - final XFile? pickedFile = await _picker.pickImage( - source: ImageSource.gallery, - ); - if(null==pickedFile){ - return; - } - SmartDialog.showLoading(msg: '上传中'); - uploadImage(quToken,pickedFile!,CONFIG.USER_INFO_AVATAR,(result){ - SmartDialog.dismiss(force: true); - headUrl = result; - update(); - }); - - } catch (e) { - SmartDialog.dismiss(); - print(e); - - PlatformException? exception = e as PlatformException?; - // invalid_image - if(exception!.code == 'invalid_image') { - showOKToast('不支持的图片格式,请另外选择图片'); - } - } - } - - - checkInfo() async { - FocusManager.instance.primaryFocus?.unfocus(); - if (headUrl == '') { - showOKToast('请上传头像'); - return; - } - if (state.textEditingController.text.isEmpty) { - showOKToast('请输入您的昵称'); - focusNickNode.requestFocus(); - return; - } else if(state.textEditingController.text.length<2){ - showOKToast('昵称不能低于两个字'); - return; - } else if(state.textEditingController.text.length>6){ - showOKToast('昵称最多输入6个字'); - return; - } - // else if (state.sex.isEmpty) { - // showOKToast('请选择您的角色'); - // return; - // } else if (state.age.isEmpty) { - // showOKToast('请选择您的年龄'); - // return; - // } else if (state.city.isEmpty) { - // showOKToast('请选择您的常住城市'); - // return; - // } - else if (state.role.isEmpty) { - showOKToast('请选择您的属性'); - - return; - } else if (state.orientation.isEmpty) { - showOKToast('请选择您的取向'); - return; - } else if (numbers.isEmpty) { - showOKToast('请选择您的兴趣圈子'); - return; - } else if (state.descEditingController.text.isEmpty) { - showOKToast('请输入您的交友宣言'); - focusNode.requestFocus(); - return; - } else if (state.descEditingController.text.length < 5) { - showOKToast('您的交友宣言太短'); - focusNode.requestFocus(); - return; - } else if (state.descEditingController.text.length > 40) { - showOKToast('您的交友宣言超出40个字啦'); - focusNode.requestFocus(); - return; - } - - genderTagList.clear(); - List tagIds = []; - watchGenderList.forEach((element) { - if(element.isSelect){ - tagIds.add(element.id); - genderTagList.add(element.id); - } - }); - if(genderTagList.isEmpty){ - // showOKToast("请点击选择你想认识的人"); - // return; - } - - // LatLng location = await getLocation(); - List interestsList = []; - numbers.forEach((element) { - interestsList.add(element.id); - }); - if (state.brithday.isEmpty) { - var date = PDuration.now(); - PDuration p = - PDuration(year: date.year! - 20, month: date.month, day: date.day); - - String month = p.month! < 10 ? '0${p.month!}' : p.month!.toString(); - String day = p.day! < 10 ? '0${p.day!}' : p.day!.toString(); - var time = '${p.year}-$month-$day'; - state.brithday = time; - } - - - if (state.wxEditingController.text.isNotEmpty) { - bool isPass = false; - if (state.wxEditingController.text.length == 11) { - RegExp exp = RegExp( - r'^((13[0-9])|(14[0-9])|(15[0-9])|(16[0-9])|(17[0-9])|(18[0-9])|(19[0-9]))\d{8}$'); - isPass = exp.hasMatch(state.wxEditingController.text); - } - - if (state.wxEditingController.text.isNotEmpty && !isPass) { - RegExp wxReg = RegExp(r'^[-_a-zA-Z][-_a-zA-Z0-9]{5,19}$'); - if (!wxReg.hasMatch(state.wxEditingController.text)) { - showOKToast('请输入正确的微信号'); - return; - } - } - - if (wxStatusInfo.containsKey('4000')) { - showOKToast(wxStatusInfo['40000']); - return; - } - - var result = await DioManager().post(url: Api.updateWxNum,params: {'type':2,'wxNum':state.wxEditingController.text}); - if (result['code'] == 31201) { - // showToast. - showOKToast(result['msg']); - showRechargeScreenDialog(); - return; - } else if (result['code'] == 200) { - if (wxStatusInfo.containsKey('32100')) { - showOKToast(wxStatusInfo['32100']); - } - } - print(result); - } - - var data = await DioManager.instance.put(url: Api.UpdataUserInfo, params: { - 'avatar_url': headUrl, - 'birthday': state.brithday, - 'gender': state.genderId.isNotEmpty ? state.genderId : '2', //性别 - 'role': state.roleId, //Int 角色 - 'interests': interestsList, //兴趣 - 'orientation': state.orientationId, //Int 爱好 - 'city':state.city.isNotEmpty ? state.city : '上海市', - 'orientations':genderTagList.isEmpty ? [2] : genderTagList, - // 'lat': location.latitude, - // 'lng': location.longitude, - 'nickname': state.textEditingController.text.trim(), - 'signature': state.descEditingController.text.trim(), - }); - var bean = BaseResponse.fromJson(data, (data) => data); - if (bean.code == 200) { - Get.offAllNamed(AppRoutes.Home); - }else{ - showOKToast(bean.msg); - } - } - - editInfo() async { - FocusManager.instance.primaryFocus?.unfocus(); - if (state.textEditingController.text.isEmpty) { - showOKToast('请输入您的昵称'); - focusNickNode.requestFocus(); - return; - } else if(state.textEditingController.text.length>6){ - showOKToast('昵称最多输入6个字'); - focusNickNode.requestFocus(); - return; - }else if (state.sex.isEmpty) { - showOKToast('请选择您的属性'); - return; - } else if (state.age.isEmpty) { - showOKToast('请选择您的年龄'); - return; - } else if (state.city.isEmpty) { - showOKToast('请选择您的常住城市'); - return; - } else if (state.role.isEmpty) { - showOKToast('请选择您的属性'); - return; - } else if (state.sex.isEmpty) { - showOKToast('请选择您的角色'); - return; - } else if (state.orientation.isEmpty) { - showOKToast('请选择您的取向'); - return; - } else if (numbers.isEmpty) { - showOKToast('请选择您的兴趣圈子'); - // return; - } else if (state.descEditingController.text.isEmpty) { - showOKToast('请输入您的交友宣言'); - focusNode.requestFocus(); - return; - } else if (state.descEditingController.text.length < 5) { - showOKToast('您的交友宣言太短'); - focusNode.requestFocus(); - return; - } - if (headUrl == '') { - showOKToast('请上传头像'); - return; - } - genderTagList.clear(); - List tagIds = []; - watchGenderList.forEach((element) { - if(element.isSelect){ - tagIds.add(element.id); - genderTagList.add(element.id); - } - }); - if(genderTagList.isEmpty){ - showOKToast("请点击选择你想认识的人"); - return; - } - - if (state.wxEditingController.text.isNotEmpty && userInfoBean!.wx_num != state.wxEditingController.text) { - bool isPass = false; - if (state.wxEditingController.text.length == 11) { - RegExp exp = RegExp( - r'^((13[0-9])|(14[0-9])|(15[0-9])|(16[0-9])|(17[0-9])|(18[0-9])|(19[0-9]))\d{8}$'); - isPass = exp.hasMatch(state.wxEditingController.text); - } - - if (state.wxEditingController.text.isNotEmpty && !isPass) { - RegExp wxReg = RegExp(r'^[-_a-zA-Z][-_a-zA-Z0-9]{5,19}$'); - if (!wxReg.hasMatch(state.wxEditingController.text)) { - showOKToast('请输入正确的微信号'); - return; - } - } - - if (wxStatusInfo.containsKey('4000')) { - showOKToast(wxStatusInfo['40000']); - return; - } - - var result = await DioManager().post(url: Api.updateWxNum,params: {'type':2,'wxNum':state.wxEditingController.text}); - if (result['code'] == 31201) { - // showToast. - showOKToast(result['msg']); - showRechargeScreenDialog(); - return; - } else if (result['code'] == 200) { - if (wxStatusInfo.containsKey('32100')) { - showOKToast(wxStatusInfo['32100']); - } - } - print(result); - } - //TODO 强制获取经纬度 - // LatLng location = await getLocation(); - List interestsList = []; - numbers.forEach((element) { - interestsList.add(element.id); - }); - - - var data = await DioManager.instance.put(url: Api.UpdataUserInfo, params: { - 'avatar_url': headUrl, - 'birthday': state.brithday, - 'gender': state.genderId, //性别 - 'role': state.roleId, //Int 角色 - 'interests': interestsList, //兴趣 - 'orientation': state.orientationId, //Int 爱好 - 'orientations':genderTagList, - 'city':state.city, - // 'lat': location.latitude, - // 'lng': location.longitude, - 'nickname': state.textEditingController.text, - 'signature': state.descEditingController.text, - }); - var bean = BaseResponse.fromJson(data, (data) => data); - if (bean.code == 200) { - showOKToast('操作成功'); - var mineFragment = Get.find(); - mineFragment.avatar = headUrl; - mineFragment.name = state.textEditingController.text; - mineFragment.gender = int.parse(state.genderId); - mineFragment.role = int.parse(state.roleId); - mineFragment.age = int.parse(state.age); - mineFragment.orientation = int.parse(state.orientationId); - mineFragment.update(); - Get.back(); - - - - }else{ - showOKToast(bean.msg); - } - } - - pushHome() { - Get.toNamed(AppRoutes.Home); - } - - //时间戳转年龄 - String getAge(PDuration brt) { - int age = 0; - DateTime dateTime = DateTime.now(); - - int yearNow = dateTime.year; //当前年份 - int monthNow = dateTime.month; //当前月份 - int dayOfMonthNow = dateTime.day; //当前日期 - - int yearBirth = brt.year!; - int monthBirth = brt.month!; - int dayOfMonthBirth = brt.day!; - age = yearNow - yearBirth; //计算整岁数 - if (monthNow <= monthBirth) { - if (monthNow == monthBirth) { - if (dayOfMonthNow < dayOfMonthBirth) age--; //当前日期在生日之前,年龄减一 - } else { - age--; //当前月份在生日之前,年龄减一 - } - } - return age.toString(); - } -} - -class SysTag { - final int id; - final String tagName; - - bool isSelect = false; - - SysTag({ - required this.id, - required this.tagName, - this.isSelect = false, - }); - - factory SysTag.fromJson(Map json) { - return SysTag( - id: json['id'], - tagName: json['tagName'], - ); - } -} \ No newline at end of file diff --git a/circle_app/lib/app/login/complete_material/state.dart b/circle_app/lib/app/login/complete_material/state.dart deleted file mode 100644 index 3147deb..0000000 --- a/circle_app/lib/app/login/complete_material/state.dart +++ /dev/null @@ -1,25 +0,0 @@ -import 'package:flutter/cupertino.dart'; - -class Complete_materialState { - TextEditingController textEditingController = TextEditingController(); - TextEditingController wxEditingController = TextEditingController(); - TextEditingController descEditingController = TextEditingController(); - String nickName = ''; - String sex = ''; - String genderId = ''; - String age = ''; - String brithday = ''; - String role = ''; - String city = ''; - - String roleId = ''; - String orientation = ''; - String orientationId = ''; - - List interest = []; - - Complete_materialState() { - - ///Initialize variables - } -} diff --git a/circle_app/lib/app/login/complete_material/view.dart b/circle_app/lib/app/login/complete_material/view.dart deleted file mode 100644 index cd9d7a6..0000000 --- a/circle_app/lib/app/login/complete_material/view.dart +++ /dev/null @@ -1,787 +0,0 @@ -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:circle_app/common/colors/app_color.dart'; -import 'package:circle_app/components/my_app_bar.dart'; -import 'package:circle_app/router/app_routers.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_pickers/pickers.dart'; -import 'package:flutter_pickers/style/default_style.dart'; -import 'package:flutter_pickers/time_picker/model/date_mode.dart'; -import 'package:flutter_pickers/time_picker/model/pduration.dart'; -import 'package:flutter_pickers/time_picker/model/suffix.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; - -import 'logic.dart'; - -class Complete_materialPage extends StatefulWidget { - Complete_materialPage({Key? key}) : super(key: key); - - @override - State createState() => _Complete_materialPageState(); -} - -class _Complete_materialPageState extends State { - // final logic = Get.put(Complete_materialLogic()); - - bool isShowWx = Get.arguments == 'user'; - - Complete_materialLogic logic = Get.find(); - - @override - Widget build(BuildContext context) { - return GetBuilder(builder: (Complete_materialLogic controller) { - return Stack( - children: [ - SizedBox( - width: MediaQuery.of(context).size.width, - height: MediaQuery.of(context).size.height, - child: Image.asset( - getBaseImage('bg'), - fit: BoxFit.fill, - ), - ), - Scaffold( - // resizeToAvoidBottomInset: false, - appBar: MyAppBar( - centerTitle: '完善您的个人形象', - isBack: true, - isDiyBack: true, - actionWdiget: GestureDetector( - onTap: () { - if (controller.type == "user") { - // Navigator.pop(context); - controller.editInfo(); - } else { - controller.checkInfo(); - } - }, - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(14.sp), - gradient: AppColor.mainVerLinearGradient - ), - width: 60.sp, - height: 28.sp, - alignment: Alignment.center, - child: Text('完成',style: TextStyle(color: Colors.white,fontSize: 15.sp),), - ), - ), - backPressed: () async { - final isBack = await Navigator.maybePop(context); - if (isBack) { - } else { - Get.offNamed(AppRoutes.Login); - } - }), - - backgroundColor: Colors.transparent, - body: GestureDetector( - onTap: () { - FocusManager.instance.primaryFocus?.unfocus(); - }, - child: Stack( - alignment: Alignment.center, - children: [ - SingleChildScrollView( - child: Container( - width: MediaQuery.of(context).size.width, - color: Colors.transparent, - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SizedBox( - height: 20.sp, - ), - GestureDetector( - onTap: () { - controller.getImageFile(); - }, - child: controller.headUrl == '' - ? Image.asset( - getLoginImage('add'), - width: 86.sp, - height: 86.sp, - ) - : ClipOval( - child: Container( - decoration: BoxDecoration( - gradient: AppColor.mainVerLinearGradient - ), - child: CachedNetworkImage( - fit: BoxFit.cover, - imageUrl: controller.headUrl, - width: 86.sp, - height: 86.sp, - ), - ), - ), - ), - SizedBox( - height: 15.sp, - ), - Text( - '数据表明95%的人对真实的头像更感兴趣', - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.w500, - fontSize: 16.sp), - ), - funcWidget( - '昵称', - TextField( - focusNode: logic.focusNickNode, - controller: controller.state.textEditingController, - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.w500, - fontSize: 14.sp), - decoration: InputDecoration( - hintText: '请输入昵称', - hintStyle: TextStyle( - color: Colors.white, - fontWeight: FontWeight.w500, - fontSize: 14.sp), - border: InputBorder.none, - ), - ), - () {}, - img: 'edit'), - // if (isShowWx) - wxFuncWidget('联系方式', - TextField( - controller: controller.state.wxEditingController, - maxLength: 19, - textAlign: TextAlign.right, - inputFormatters: [ - FilteringTextInputFormatter.deny( - RegExp("[^-_a-zA-Z0-9]")), - ], - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.w500, - fontSize: 14.sp), - decoration: InputDecoration( - counterText: '', - hintText: '请输入联系信息', - hintStyle: TextStyle( - color: Colors.white, - fontWeight: FontWeight.w500, - fontSize: 14.sp), - border: InputBorder.none, - ), - ),), - - funcWidget( - '角色', - Text( - controller.state.sex, - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - fontWeight: FontWeight.w500), - ), () { - showOKToast('为了确保角色的真实性,选错了需联系客服更正'); - showSexPiker(context, controller); - }), - funcWidget( - '你想认识', - Container( - child: Row( - children: controller.watchGenderList.isNotEmpty - ? [sexTagWdiget(controller)] - : [], - ), - ), () async { - - },img: ''), - funcWidget( - '年龄', - Text( - controller.state.age, - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - fontWeight: FontWeight.w500), - ), () { - showAgePiker( - context, - controller, - ); - }), - funcWidget( - '常住城市', - Text( - controller.state.city, - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - fontWeight: FontWeight.w500), - ), () { - showCityPiker(context, controller); - }), - funcWidget( - '属性', - Text( - controller.state.role, - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - fontWeight: FontWeight.w500), - ), () { - showRolePiker(context, controller); - }), - funcWidget( - '取向', - Text( - controller.state.orientation, - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - fontWeight: FontWeight.w500), - ), () { - showOrientationPiker(context, controller); - }), - funcWidget( - '兴趣圈子', - Container( - child: Row( - children: controller.numbers.isNotEmpty - ? [interestWdiget('JK圈', controller)] - : [], - ), - ), () async { - var data = await Get.toNamed( - AppRoutes.SelectCircleActivity, - arguments: { - "interestMap": controller.configBean.interestMap, - 'selectCircle': controller.numbers, - "isRodio": false - }); - if (data != null) { - controller.numbers = data; - controller.update(); - } - }), - Container( - margin: EdgeInsets.only( - top: 24.sp, - bottom: 18.sp, - left: 28.sp, - right: 28.sp), - height: 116.sp, - width: Get.width - 50.sp, - child: Stack( - children: [ - Image.asset( - getLoginImage('desc_bg'), - width: Get.width - 50.sp, - fit: BoxFit.fill, - ), - Container( - margin: - EdgeInsets.only(left: 15.sp, top: 15.sp,right: 10.sp), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - '交友宣言', - style: TextStyle( - color: Colors.white, fontSize: 14.sp), - ), - TextField( - maxLines: 3, - controller: controller - .state.descEditingController, - focusNode: logic.focusNode, - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.w500, - fontSize: 14.sp), - decoration: InputDecoration( - hintText: '认真写一段交友宣言可以让您的个人形象更完善哦~', - // icon: Text('交友宣言:',style: TextStyle(color: Colors.white,fontSize: 14.sp,fontWeight: FontWeight.w500),), - // labelText: '交友宣言:认真写一段交友宣言可以让您的个人形象更完善哦~', - labelStyle: TextStyle( - color: Colors.white, - fontWeight: FontWeight.w600, - fontSize: 14.sp), - hintStyle: TextStyle( - color: Colors.white.withOpacity(0.5), - fontWeight: FontWeight.w500, - fontSize: 14.sp), - border: InputBorder.none, - contentPadding: - EdgeInsets.only(top: 4.sp,left:0.sp,right: 10.sp)), - inputFormatters: [ - LengthLimitingTextInputFormatter(40) - ], - ) - ], - )), - ], - ), - ), - SafeArea( - child: Container( - alignment: Alignment.center, - width: 133.sp, - height: 56.sp, - - ), - ) - ], - ), - ), - ), - // Positioned( - // bottom: 0 , - // child: SafeArea( - // - // child: GestureDetector( - // onTap: () { - // if (controller.type == "user") { - // // Navigator.pop(context); - // controller.editInfo(); - // } else { - // controller.checkInfo(); - // } - // - // // controller.checkInfo(); - // }, - // child: Container( - // alignment: Alignment.center, - // width: 133.sp, - // height: 56.sp, - // decoration: BoxDecoration( - // image: DecorationImage( - // fit: BoxFit.fill, - // image: AssetImage(getLoginImage('start_bg'))), - // ), - // child: Text( - // controller.type == "user" ? "完成" : '开启小圈之旅', - // style: TextStyle( - // color: const Color(0xff00FFF4), - // fontSize: 16.sp, - // fontWeight: FontWeight.w600), - // ), - // ), - // ), - // )) - ], - ), - ), - ) - ], - ); - }); - } - - - Widget wxFuncWidget( - String leftStr, Widget tipWidget, - {String img = 'down_arr'}) { - return Container( - width: Get.width, - padding: EdgeInsets.only(left: 20.sp, right: 20.sp), - height: 54.sp, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded( - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text(leftStr, - style: TextStyle( - color: Colors.white, - fontSize: 16.sp, - fontWeight: FontWeight.w500, - shadows: [ - Shadow( - color: const Color(0xffF657FF), - blurRadius: 4.0.sp) - ])), - Expanded( - child: Padding( - padding: EdgeInsets.only(left: 20.sp), - child: tipWidget, - )), - GestureDetector( - onTap: () { - showTipPop(); - }, - child: Row( - children: [ - Container( - margin: EdgeInsets.only( - left: 4.sp, right: 4.sp), - child: Icon( - Icons.change_circle, - color: AppColor.mainColor, - size: 30.sp, - )), - Image.asset( - getMineImage(logic.contactType == 1 - ? 'phone_icon' - : logic.contactType == 3 - ? 'qq' - : 'wx'), - width: 24.sp, - height: 24.sp, - ), - ], - ), - ), - - ], - ), - ), - lineWidget(), - ], - ), - ); - } - - Widget funcWidget( - String leftStr, Widget tipWidget, GestureTapCallback callback, - {String img = 'down_arr'}) { - return Container( - width: Get.width, - padding: EdgeInsets.only(left: 20.sp, right: 20.sp), - height: 54.sp, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded( - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: callback, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text(leftStr, - style: TextStyle( - color: Colors.white, - fontSize: 16.sp, - fontWeight: FontWeight.w500, - shadows: [ - Shadow( - color: const Color(0xffF657FF), - blurRadius: 4.0.sp) - ])), - Expanded( - child: Padding( - padding: EdgeInsets.only(left: 20.sp), - child: tipWidget, - )), - if (img.isNotEmpty) - Image.asset( - getLoginImage(img), - width: img == 'down_arr' ? 24.sp : 18.sp, - ) - ], - ), - ), - ), - lineWidget(), - ], - ), - ); - } - - lineWidget() { - return Container( - height: 1.sp, - width: Get.width - 28 * 2.sp, - decoration: const BoxDecoration( - gradient: - SweepGradient(colors: [Color(0xff03FEFB), Color(0xffE735F4)])), - ); - } - - interestWdiget(String interest, Complete_materialLogic controller) { - return Container( - height: 59.sp, - width: Get.width - 140.sp, - child: ListView.builder( - itemCount: controller.numbers.length, - scrollDirection: Axis.horizontal, - padding: EdgeInsets.symmetric(vertical: 18.sp), - itemBuilder: (context, index) { - return Container( - margin: EdgeInsets.only(right: 11.sp), // 替换为实际的 item 间距 - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17.0), // 设置圆角半径 - gradient: const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - ), - color: const Color(0xFF392D53), - ), - child: Container( - margin: EdgeInsets.all(0.5.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17.0), - // shape: BoxShape.circle, - color: const Color(0xFF392D53), - ), - child: Padding( - padding: EdgeInsets.only( - left: 15.sp, right: 15.sp), - child: Center( - child: Text( - controller.numbers[index].name, - style: TextStyle( - fontSize: 11.sp, - color: Colors.white, - ), - ), - ), - ), - ), - ), // 替换为实际的列表项小部件 - ); - }, - ), - ); - } - - - sexTagWdiget(Complete_materialLogic controller) { - return Container( - height: 59.sp, - width: Get.width - 130.sp, - child: ListView.builder( - itemCount: controller.watchGenderList.length, - scrollDirection: Axis.horizontal, - padding: EdgeInsets.symmetric(vertical: 14.sp), - itemBuilder: (context, index) { - return GestureDetector( - onTap: () { - controller.watchGenderList[index].isSelect = !controller.watchGenderList[index].isSelect; - controller.update(); - }, - child: Container( - margin: EdgeInsets.only(right: 6.sp), // 替换为实际的 item 间距 - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(14.0), // 设置圆角半径 - gradient: const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - ), - color: const Color(0xFF392D53), - ), - child: Container( - margin: EdgeInsets.all(0.5.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17.0), - // shape: BoxShape.circle, - color: controller.watchGenderList[index].isSelect ? Colors.transparent : const Color(0xFF392D53), - ), - child: Padding( - padding: EdgeInsets.only( - left: 5.sp, right: 5.sp), - child: Center( - child: Text( - controller.watchGenderList[index].tagName, - style: TextStyle( - fontSize: 14.sp, - color: Colors.white, - ), - ), - ), - ), - ), - ), // 替换为实际的列表项小部件 - ), - ); - }, - ), - ); - } - - showSexPiker(context, Complete_materialLogic controller) { - FocusManager.instance.primaryFocus?.unfocus(); - // MTF(男跨女)、FTM(女跨男)、CD(变装者)、酷儿(非二元) - List genderList = [ - '男', - '女', - 'MTF(男跨女)', - 'FTM(女跨男)', - 'CD(变装者)', - '酷儿(非二元)' - ]; - - - String sex = ''; - genderList.forEach((element) { - if (element.contains(controller.state.sex) && sex.isEmpty) { - sex = element; - } - }); - - - Pickers.showSinglePicker(context, - pickerStyle: DefaultPickerStyle.dark(), - data: genderList, - selectData: controller.state.sex.isNotEmpty - ? sex - : 'FTM(女跨男)', onConfirm: (p, position) { - - if (p.toString().contains('(')) { - p = p.toString().split('(').first; - } - controller.state.sex = p; - controller.state.genderId = - controller.configBean.genderMap.keys.toList()[position]; - controller.update(); - }); - } - - showAgePiker(context, Complete_materialLogic controller) { - FocusManager.instance.primaryFocus?.unfocus(); - var date = PDuration.now(); - PDuration currentDur = - PDuration(year: date.year! - 18, month: date.month, day: date.day); - if (controller.state.brithday.isNotEmpty) {} - Pickers.showDatePicker( - context, - pickerStyle: DefaultPickerStyle.dark(), - // context, - // 模式,详见下方 - mode: DateMode.YMD, - // 后缀 默认Suffix.normal(),为空的话Suffix() - suffix: Suffix(years: ' 年', month: ' 月', days: ' 日'), - // 样式 详见下方样式 - // pickerStyle: pickerStyle, - // 默认选中 - selectDate: currentDur, - maxDate: - PDuration(year: date.year! - 18, month: date.month, day: date.day), - minDate: - PDuration(year: date.year! - 100, month: date.month, day: date.day), - onConfirm: (p) { - String month = p.month! < 10 ? '0${p.month!}' : p.month!.toString(); - String day = p.day! < 10 ? '0${p.day!}' : p.day!.toString(); - var time = '${p.year}-$month-$day'; - controller.state.age = controller.getAge(p); - controller.state.brithday = time; - controller.update(); - }, - // onChanged: (p) => print(p), - ); - } - - showCityPiker(context, Complete_materialLogic controller) { - Pickers.showMultiLinkPicker(context, - pickerStyle: DefaultPickerStyle.dark(), data: controller.cityMap, columeNum: 2, - onConfirm: (List res, List position){ - print(res); - print(controller.cityMap[res[0]][res[1]][0]); - // controller.state.city = controller.cityMap[res[0]][res[1]][0]; - controller.state.city = res[1]; - controller.update(); - } - - ); - } - - showRolePiker(context, Complete_materialLogic controller) { - FocusManager.instance.primaryFocus?.unfocus(); - - String typeStr = '主动、被动、征服、臣服、都可以'; - List typeLit = typeStr.split('、'); - List optionLit = []; - controller.roleList.forEach((element) { - optionLit.add(element + '(${typeLit[controller.roleList.indexOf(element)]})'); - }); - - int index = 2; - if (controller.state.role.isNotEmpty) { - index = controller.roleList.indexOf(controller.state.role); - } - - Pickers.showSinglePicker(context, - pickerStyle: DefaultPickerStyle.dark(), - data: optionLit, - // controller.roleList, - selectData: optionLit[index], onConfirm: (p, position) { - controller.state.role = p.toString().split('(').first; - controller.state.roleId = - controller.configBean.roleMap.keys.toList()[position]; - controller.update(); - }); - } - - // - showOrientationPiker(context, Complete_materialLogic controller) { - FocusManager.instance.primaryFocus?.unfocus(); - Pickers.showSinglePicker(context, - pickerStyle: DefaultPickerStyle.dark(), - data: controller.orientationList, - selectData: controller.state.orientation.isNotEmpty - ? controller.state.orientation - : '双性恋', onConfirm: (p, position) { - controller.state.orientation = p; - controller.state.orientationId = - controller.configBean.orientationMap.keys.toList()[position]; - controller.update(); - }); - } - - showTipPop() { - Get.bottomSheet( - CupertinoActionSheet( - title: Text( - '联系方式', - style: TextStyle(fontSize: 22), - ), //标题 - //提示内容 - actions: [ - //操作按钮集合 - CupertinoActionSheetAction( - onPressed: () { - Get.back(); - logic.contactType = 1; - logic.update(); - }, - child: Text('手机号'), - ), - CupertinoActionSheetAction( - onPressed: () { - Get.back(); - logic.contactType = 3; - logic.update(); - }, - child: Text('QQ'), - ), - CupertinoActionSheetAction( - onPressed: () { - Get.back(); - logic.contactType = 2; - logic.update(); - }, - child: Text('微信'), - ), - ], - cancelButton: CupertinoActionSheetAction( - //取消按钮 - onPressed: () { - Get.back(); - }, - child: Text('取消'), - ), - ), - isScrollControlled: true); - } - -} diff --git a/circle_app/lib/app/login/login/logic.dart b/circle_app/lib/app/login/login/logic.dart deleted file mode 100644 index 656add8..0000000 --- a/circle_app/lib/app/login/login/logic.dart +++ /dev/null @@ -1,304 +0,0 @@ -import 'dart:async'; - -import 'package:circle_app/app/minefragment/logic.dart'; -import 'package:circle_app/network/dio_manager.dart'; -import 'package:circle_app/router/app_routers.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/foundation.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_native_splash/flutter_native_splash.dart'; -import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; -import 'package:get/get.dart'; -import 'package:shared_preferences/shared_preferences.dart'; - -import '../../../network/api.dart'; -import '../../../util/SharedPreferencesHelper.dart'; -import 'state.dart'; - -class LoginLogic extends GetxController { - bool check = false; - - // 0短信 1密码 - int loginType = 0; - bool isGetCode = false; - - String clipboardStr = ''; - bool isShowPwd = false; - @override - void onReady() { - // TODO: implement onReady - super.onReady(); - FlutterNativeSplash.remove(); - - - } - - @override - void onInit() async { - // TODO: implement onInit - super.onInit(); - SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); - String loginPhone = - await sharedPreferences.getString(SharedPreferencesHelper.LOGINPHONE) ?? - ""; - String pwd = - await sharedPreferences.getString(SharedPreferencesHelper.PWD) ?? - ""; - print(loginPhone); - phoneEditingController.text = loginPhone; - if (GetUtils.isPhoneNumber(loginPhone) && loginPhone.length == 11) { - isPhone = true; - - } - - - if (sharedPreferences!.containsKey(SharedPreferencesHelper.firstLogin)) { - loginType = 1; - pwdEditingController.text = pwd; - } - - update(); - } - - bool isPhone = false; - final LoginState state = LoginState(); - TextEditingController phoneEditingController = TextEditingController(); - TextEditingController codeEditingController = TextEditingController(); - TextEditingController pwdEditingController = TextEditingController(); - - bool sendCodeBtn = false; //判断发送短信按钮是否点击过标志 - int seconds = 60; - Timer? t; - - //倒计时 - starDownTimer() { - if (sendCodeBtn == false && seconds == 60) { - sendCodeBtn = true; - isPhone = true; - getCode(); - } - } - - /// 从剪贴板读取信息 - readClipboardData() async { - var dataText = await Clipboard.getData(Clipboard.kTextPlain); - if (dataText != null) { - if ((dataText!.text! ?? '').isNotEmpty) { - String codeStr = dataText!.text!; - if (codeStr.startsWith('https://leyuan666.com/#code=')) { - String code = codeStr.split('#code=').last; - clipboardStr = code; - } - } - } - } - - Future getCode() async { - SmartDialog.showLoading(msg: '正在发送中'); - var data = await DioManager.instance.post( - url: Api.sendCode, params: {"phone": phoneEditingController.text}); - var bean = BaseResponse.fromJson(data, (data) => Data.fromJson(data)); - - SmartDialog.dismiss(); - if (bean.code == 200) { - showOKToast('验证码已发送,稍后可前往短信查看'); - if (bean.data!.code != null) { - codeEditingController.text = bean.data!.code.toString(); - update(); - } - - t = Timer.periodic(const Duration(milliseconds: 1000), (timer) { - seconds--; - if (seconds == 0) { - t?.cancel(); //清除 - sendCodeBtn = false; - seconds = 60; - } - update(); - }); - } else { - sendCodeBtn = false; - showOKToast(bean.msg); - } - } - - @override - void dispose() { - super.dispose(); - t?.cancel(); - } - - void login() async { - if (phoneEditingController.text.length != 11) { - showOKToast('请输入正确的手机号'); - return; - } - if (codeEditingController.text == '' && loginType == 0) { - showOKToast('请输入验证码'); - return; - } - - if (pwdEditingController.text == '' && loginType == 1) { - showOKToast('请输入密码'); - return; - } - - if (!check) { - showOKToast('请勾选同意用户协议和隐私协议'); - return; - } - SmartDialog.showLoading(msg: '正在登录中...'); - - Map params = {}; - - if (loginType == 0) { - if (clipboardStr.isEmpty) { - await readClipboardData(); - } - - - params = { - "phone": phoneEditingController.text, - "code": codeEditingController.text - }; - if (clipboardStr.isNotEmpty) { - params['inviteCode'] = clipboardStr; - } - } else { - params = { - "phone": phoneEditingController.text, - "password": pwdEditingController.text - }; - } - - var data = await DioManager.instance.post(url: loginType == 0 ? Api.login : Api.new_login, params: params); - SmartDialog.dismiss(); - var bean = BaseResponse.fromJson( - data, (data) => LoginData.fromJson(data)); - if (bean.code == 200) { - SharedPreferencesHelper.getInstance().then((sharedPreferences) { - sharedPreferences.setString( - SharedPreferencesHelper.LOGINPHONE, phoneEditingController.text); - sharedPreferences.setString(SharedPreferencesHelper.AUTHORIZATION, - bean.data!.Authorization.toString()); - }); - - if (loginType == 0) { - var data = await DioManager.instance.get(url: Api.getUserMine); - if (data['code'] == 200) { - var bean = BaseResponse.fromJson( - data, (data) => MineResponseBean.fromJson(data)); - if (bean.isSuccess()) { - if (!bean.data.has_pwd) { - Get.toNamed(AppRoutes.SetPasswordActivity); - return; - } - } - } - } else { - if (loginType == 1) { - SharedPreferencesHelper.getInstance().then((sharedPreferences) { - sharedPreferences.setString( - SharedPreferencesHelper.PWD, pwdEditingController.text); - }); - } - var data = - await DioManager.instance.put(url: Api.refreshToken, params: {}); - var bean = BaseResponse.fromJson( - data, (data) => LoginData.fromJson(data)); - if (bean.code == 200) { - SharedPreferencesHelper.getInstance().then((sharedPreferences) { - sharedPreferences.setString(SharedPreferencesHelper.AUTHORIZATION, - bean.data!.Authorization.toString()); - }); - Get.offNamed(AppRoutes.Home); - return; - } else if (bean.code == 30002) { - SharedPreferencesHelper.getInstance().then((sharedPreferences) { - sharedPreferences.setString(SharedPreferencesHelper.AUTHORIZATION, - bean.data!.Authorization.toString()); - Get.offNamed(AppRoutes.Complete_materialPage); - }); - - return; - } - } - - - Get.offNamed(AppRoutes.Home); - return; - } else if (bean.code == 30002) { - SharedPreferencesHelper.getInstance().then((sharedPreferences) { - sharedPreferences.setString( - SharedPreferencesHelper.LOGINPHONE, phoneEditingController.text); - sharedPreferences.setString(SharedPreferencesHelper.AUTHORIZATION, - bean.data!.Authorization.toString()); - }); - - Get.offNamed(AppRoutes.Complete_materialPage); - return; - } else { - showOKToast(bean.msg.toString()); - } - - // try { - // var response = await dio.post('user-service/login/smscode', data: { - // "phone": phoneEditingController.text, - // "code": codeEditingController.text - // }); - // Map jsonData = jsonDecode(response.data.toString()); - // int code = jsonData['code']; - // String msg = jsonData['msg']; - // - // String authorization = jsonData['data']['Authorization']; - // prefs.setString('Authorization', authorization); - // - // if (code == 200) { - // Get.toNamed(AppRoutes.Home); - // return; - // } else if (code == 30002) { - // Get.toNamed(AppRoutes.Complete_materialPage); - // return; - // } - // showToast(msg); - // } catch (e) { - // if (e is DioException) { - // print('DioException: ${e.message}'); - // print('DioException Error: ${e.error}'); - // print('DioException Response: ${e.response}'); - // } else { - // print('Exception: $e'); - // } - // } - - // Get.toNamed(AppRoutes.Complete_materialPage); - // if (!GetUtils.isPhoneNumber(phoneEditingController.text)) { - // showToast('请输入正确的手机号'); - // } - } -} - -class Data { - String? code; - - Data({this.code}); - - factory Data.fromJson(Map json) { - return Data( - code: json['code'], - ); - } -} - -class LoginData { - String? Authorization; - - LoginData({this.Authorization}); - - factory LoginData.fromJson(Map json) { - return LoginData( - Authorization: json['Authorization'] as String?, - ); - } -} diff --git a/circle_app/lib/app/login/login/state.dart b/circle_app/lib/app/login/login/state.dart deleted file mode 100644 index 6325be6..0000000 --- a/circle_app/lib/app/login/login/state.dart +++ /dev/null @@ -1,5 +0,0 @@ -class LoginState { - LoginState() { - ///Initialize variables - } -} diff --git a/circle_app/lib/app/login/login/view.dart b/circle_app/lib/app/login/login/view.dart deleted file mode 100644 index 00cb266..0000000 --- a/circle_app/lib/app/login/login/view.dart +++ /dev/null @@ -1,447 +0,0 @@ -import 'package:circle_app/common/colors/app_color.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:gradient_borders/box_borders/gradient_box_border.dart'; - -import 'logic.dart'; - -const loginBgWidget = Image( - image: AssetImage('assets/images/base/bg.png'), - fit: BoxFit.fill, -); - -class LoginPage extends StatelessWidget { - LoginPage({Key? key}) : super(key: key); - - final logic = Get.put(LoginLogic()); - final state = Get.find().state; - - @override - Widget build(BuildContext context) { - return Stack( - fit: StackFit.expand, - children: [ - loginBgWidget, - GestureDetector( - onTap: () { - FocusManager.instance.primaryFocus?.unfocus(); - }, - child: Scaffold( - resizeToAvoidBottomInset: false, - backgroundColor: Colors.transparent, - body: GetBuilder(builder: (logic) { - return Stack( - alignment: Alignment.center, - children: [ - Positioned( - left: 0, - right: 0, - top: 180.sp, - child: Image.asset( - getBaseImage("ic_launcher"), - width: 120.sp, - height: 120.sp, - )), - Container( - width: Get.width, - height: Get.height, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - // margin: EdgeInsets.only( - // top: MediaQuery.of(context).padding.top + 100.sp), - child: Stack( - alignment: Alignment.center, - children: [ - Positioned( - // bottom: 0, - - child: Container( - width: 280.sp, - height: 60.sp, - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(30.sp), - border: GradientBoxBorder( - gradient: - AppColor.mainVerLinearGradient, - width: 1.sp, - ), - ))), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - ' +86', - style: TextStyle( - color: Colors.white, fontSize: 16.sp), - ), - Stack( - children: [ - Container( - width: 200.sp, - child: TextField( - onChanged: (msg) { - if (GetUtils.isPhoneNumber(msg) && - msg.length == 11) { - logic.isPhone = true; - } else { - logic.isPhone = false; - } - logic.update(); - }, - controller: - logic.phoneEditingController, - keyboardType: TextInputType.phone, - inputFormatters: [ - FilteringTextInputFormatter - .digitsOnly, - FilteringTextInputFormatter.deny( - RegExp('[^0-9]')), - ], - maxLength: 11, - style: TextStyle( - color: Colors.white, - fontSize: 16.sp), - decoration: InputDecoration( - hintText: '请输入手机号', - hintStyle: TextStyle( - color: Colors.white70, - fontSize: 16.sp), - border: InputBorder.none, - counterText: '', - contentPadding: EdgeInsets.only( - left: 16.sp)), - ), - ), - ], - ) - ], - ), - ], - ), - ), - if (logic.loginType == 0) - Container( - margin: EdgeInsets.only(top: 25.sp), - child: Stack( - alignment: Alignment.center, - children: [ - Positioned( - // bottom: 0, - - child: Container( - width: 280.sp, - height: 60.sp, - decoration: BoxDecoration( - // color: Colors.white60, - borderRadius: - BorderRadius.circular(30.sp), - border: GradientBoxBorder( - gradient: AppColor - .mainVerLinearGradient, - width: 1.sp, - ), - ))), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - '验证码', - style: TextStyle( - color: Colors.white, - fontSize: 16.sp), - ), - Stack( - alignment: Alignment.center, - children: [ - SizedBox( - width: 200.sp, - child: TextField( - controller: - logic.codeEditingController, - keyboardType: TextInputType.phone, - maxLength: 8, - style: TextStyle( - color: Colors.white, - fontSize: 16.sp), - decoration: InputDecoration( - hintText: '请输入验证码', - hintStyle: TextStyle( - color: Colors.white70, - fontSize: 16.sp), - border: InputBorder.none, - counterText: '', - contentPadding: - EdgeInsets.only( - left: 16.sp)), - ), - ), - Positioned( - right: 0, - child: GestureDetector( - onTap: () { - if (logic.isPhone) { - logic.starDownTimer(); - } - }, - child: Container( - alignment: Alignment.center, - width: 76.sp, - height: 29.sp, - decoration: BoxDecoration( - color: logic.isPhone - ? logic.sendCodeBtn - ? Colors.white30 - : const Color( - 0xff0AFCFF) - : Colors.white30, - borderRadius: - BorderRadius.circular( - 29.sp / 2)), - child: Text( - logic.sendCodeBtn - ? '${logic.seconds}s' - : '获取验证码', - style: TextStyle( - color: logic.isPhone - ? logic.sendCodeBtn - ? Colors.white - : Colors.black - : Colors.white, - fontSize: 12.sp), - ), - ), - )), - ], - ) - ], - ), - ], - ), - ), - if (logic.loginType == 1) - Container( - margin: EdgeInsets.only(top: 25.sp), - child: Stack( - alignment: Alignment.center, - children: [ - Positioned( - // bottom: 0, - - child: Container( - width: 280.sp, - height: 60.sp, - decoration: BoxDecoration( - // color: Colors.white60, - borderRadius: - BorderRadius.circular(30.sp), - border: GradientBoxBorder( - gradient: AppColor - .mainVerLinearGradient, - width: 1.sp, - ), - ))), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - '密码', - style: TextStyle( - color: Colors.white, - fontSize: 16.sp), - ), - Stack( - alignment: Alignment.center, - children: [ - SizedBox( - width: 200.sp, - child: TextField( - controller: - logic.pwdEditingController, - maxLength: 12, - obscureText: !logic.isShowPwd, - style: TextStyle( - color: Colors.white, - fontSize: 16.sp), - decoration: InputDecoration( - hintText: '请输入密码', - hintStyle: TextStyle( - color: Colors.white70, - fontSize: 16.sp), - border: InputBorder.none, - counterText: '', - contentPadding: - EdgeInsets.only( - left: 16.sp)), - ), - ), - Positioned( - right: 0, - child: GestureDetector( - behavior: - HitTestBehavior.opaque, - onTap: () { - logic.isShowPwd = - !logic.isShowPwd; - logic.update(); - }, - child: Container( - width: 30.sp, - height: 20.sp, - alignment: - Alignment.centerRight, - child: Image.asset( - getMineImage( - !logic.isShowPwd - ? 'no_show_icon' - : 'show_icon'), - width: 20.sp, - )))) - ], - ) - ], - ), - ], - ), - ), - GestureDetector( - onTap: () { - logic.loginType = logic.loginType == 0 ? 1 : 0; - logic.update(); - }, - child: Container( - width: 280.sp, - margin: EdgeInsets.only(top: 15.sp, right: 0.sp), - alignment: Alignment.centerRight, - child: Text( - logic.loginType == 1 ? '验证码登录' : '密码登录', - style: TextStyle( - color: Colors.white, fontSize: 14.sp), - ), - ), - ), - ], - ), - ), - Positioned( - bottom: 182.sp, - child: GestureDetector( - onTap: () { - logic.login(); - }, - child: Container( - width: 200.sp, - height: 50.sp, - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(25.sp), - gradient: const LinearGradient( - begin: Alignment.centerLeft, - end: Alignment.centerRight, - colors: [ - Color(0xff0AFCFF), - Color(0xffD739EA) - ])), - child: Text( - '登录', - style: TextStyle( - color: Colors.white, - fontSize: 16.sp, - fontWeight: FontWeight.w500), - ), - ), - ), - ), - Positioned( - bottom: 17.sp + MediaQuery.of(context).padding.bottom, - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - logic.check = !logic.check; - logic.update(); - }, - child: Container( - child: Row( - children: [ - !logic.check - ? Container( - width: 18.sp, - height: 18.sp, - decoration: BoxDecoration( - border: Border.all( - color: Colors.white70, - width: 1.sp), - borderRadius: - BorderRadius.circular(10)), - ) - : Icon( - Icons.check_circle_rounded, - size: 19.sp, - color: Color(0xff00FFF4), - ), - SizedBox( - width: 4.sp, - ), - Text( - '同意', - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - fontWeight: FontWeight.w600), - ), - SizedBox( - width: 2.sp, - ), - GestureDetector( - onTap: () { - navigateToUserAgreement(); - }, - child: Text( - '《用户协议》', - style: TextStyle( - color: Color(0xff00FFF4), - fontSize: 14.sp, - fontWeight: FontWeight.w400, - ), - ), - ), - Text( - '和', - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - fontWeight: FontWeight.w600), - ), - SizedBox( - width: 2.sp, - ), - GestureDetector( - onTap: () { - navigateToPrivacyPolicy(); - }, - child: Text( - '《隐私协议》', - style: TextStyle( - color: Color(0xff00FFF4), - fontSize: 14.sp, - fontWeight: FontWeight.w400, - ), - ), - ), - ], - ), - ), - )) - ], - ); - })), - ), - ], - ); - } -} diff --git a/circle_app/lib/app/minefragment/binding.dart b/circle_app/lib/app/minefragment/binding.dart deleted file mode 100644 index ff37c98..0000000 --- a/circle_app/lib/app/minefragment/binding.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:get/get.dart'; - -import 'logic.dart'; - -class MinefragmentBinding extends Bindings { - @override - void dependencies() { - Get.lazyPut(() => MinefragmentLogic()); - } -} diff --git a/circle_app/lib/app/minefragment/logic.dart b/circle_app/lib/app/minefragment/logic.dart deleted file mode 100644 index 6e47a0a..0000000 --- a/circle_app/lib/app/minefragment/logic.dart +++ /dev/null @@ -1,259 +0,0 @@ - -import 'package:get/get.dart'; - -import '../../network/api.dart'; -import '../../network/dio_manager.dart'; -import '../../util/SharedPreferencesHelper.dart'; -import '../../util/eventBus.dart'; -import '../../util/util.dart'; -import '../dialog/UpdateDialog.dart'; -import 'state.dart'; -import 'package:shared_preferences/shared_preferences.dart'; - -class MinefragmentLogic extends GetxController { - final MinefragmentState state = MinefragmentState(); - User? userInfoBean; - bool isProxy = false; - String ageMsg = ""; - var isVip = 0.obs; - var likeCount = 0; - var like_me_count = 0; - var recent_visit_count = 0; - - num like_me_count_new = 0; - num recent_visit_count_new = 0; - String avatar = ""; - String name = ""; - int gender = -1; - int role = -1; - int age = -1; - int orientation = -1; - - bool has_pwd = false; - bool isUpdateVersion = false; - bool isShwGoodReview = false; - String enterHomeInfoMsg = "进入主页"; - String joinedCircle = ""; - String vipMsg = "十几种专属特权等你领取"; - - @override - void onInit() async { - super.onInit(); - SharedPreferencesHelper sp = await SharedPreferencesHelper.getInstance(); - if (sp.getString(SharedPreferencesHelper.LOGINPHONE) == '18800000100') { - isProxy = true; - } else { - isProxy = false; - } - - getMode(); - checkVersion(); - checkShowPositiveFeedBack(); - EventBusManager.on().listen((event) { - isVip.value = event.vip; - // update(); - }); - } - - loadData() { - getMode(); - checkVersion(); - checkShowPositiveFeedBack(); - } - - Future checkVersion() async { - var data = await DioManager.instance.get(url: Api.APP_VERSION); - var bean = BaseResponse.fromJson( - data, (data) => UpdateInfo.fromJson(data)); - if (bean.isSuccess()) { - isUpdateVersion = bean.data.update == 1; - update(); - } - } - - getVisitorMsgData() async { - var data = - await DioManager.instance.get(url: Api.getVisitorMsg,); - if (data['code'] == 200) { - recent_visit_count_new = data['data']['unreadCount'] ?? 0; - } - update(); - } - - getMode() async { - var data = await DioManager.instance.get(url: Api.getUserMine); - var bean = BaseResponse.fromJson( - data, (data) => MineResponseBean.fromJson(data)); - if (bean.isSuccess()) { - likeCount = bean.data.likeCount ?? 0; - like_me_count = bean.data.likeMeCount ?? 0; - recent_visit_count = bean.data.recentVisitCount ?? 0; - joinedCircle = "${"加入了${bean.data.joininterestcount}"}个圈子"; - enterHomeInfoMsg = bean.data.mainGuideText; - - - has_pwd = bean.data.has_pwd; - SharedPreferences sharedPreferences = - await SharedPreferences.getInstance(); - if(bean.data.user.vip>0){ - vipMsg = "会员时长剩余${bean.data.vipExpireDays}天"; - } else if (bean.data.last_vip_expire_date != '') { - vipMsg = "会员已于${bean.data.last_vip_expire_date.toString().split(' ').first}到期"; - } - - int likeMeCount = sharedPreferences.getInt(SharedPreferencesHelper.LIKEMECOUNT)??0; - // int recentVisitCount = sharedPreferences.getInt(SharedPreferencesHelper.RECENTVISITCOUNT)??0; - sharedPreferences.setString(SharedPreferencesHelper.PHOTO, bean.data.phone); - like_me_count_new = like_me_count - likeMeCount; - print("***************"); - print("$likeMeCount-$like_me_count=$like_me_count_new"); - - - // like_me_count_new = recentVisitCount.toInt() - bean.data.likeMeCount.toInt(); - - userInfoBean = bean.data.user; - - if (userInfoBean != null) { - avatar = userInfoBean!.avatarThumb; - sharedPreferences.setString(SharedPreferencesHelper.AVATAR, avatar ?? ''); - name = userInfoBean!.nickname; - sharedPreferences.setString(SharedPreferencesHelper.NAME, name ?? ''); - gender = userInfoBean!.gender; - role = userInfoBean!.role; - age = userInfoBean!.age; - orientation = userInfoBean!.orientation; - isVip.value = userInfoBean!.vip; - - SharedPreferencesHelper.getInstance().then((sharedPreferences) { - sharedPreferences.setInt(SharedPreferencesHelper.VIP, isVip.value); - sharedPreferences.setInt( - SharedPreferencesHelper.USERID, userInfoBean!.id); - }); - - ageMsg = getAgeCOntent(gender, age, role, orientation); - } - getVisitorMsgData(); - update(); - } else { - showOKToast(bean.msg); - } - } - - void checkShowPositiveFeedBack() async { - var data = await DioManager.instance.get(url: Api.showPositiveFeedBack); - isShwGoodReview = data['data']; - update(); - } - - -} - -class User { - int id; - bool has_pwd; - String nickname; - String avatar; - String signature; - String birthday; - int age; - int vip; - int gender; - int mark; - int role; - int orientation; - double lng; - double lat; - String city; - String avatarThumb; - String? createTime; - User({ - required this.id, - required this.has_pwd, - required this.nickname, - required this.avatar, - required this.mark, - required this.signature, - required this.birthday, - required this.age, - required this.vip, - required this.gender, - required this.role, - required this.orientation, - required this.lng, - required this.lat, - required this.city, - required this.avatarThumb, - this.createTime, - }); - - factory User.fromJson(Map json) { - return User( - id: json['id'], - mark: json['mark'] ?? 0, - has_pwd: json['has_pwd'] ?? false, - createTime: json['createTime'] ?? '', - nickname: json['nickname'], - avatar: json['avatar'], - signature: json['signature'], - birthday: json['birthday'], - age: json['age'], - vip: json['vip'], - gender: json['gender'], - role: json['role'], - orientation: json['orientation'], - lng: json['lng'], - lat: json['lat'], - city: json['city'], - avatarThumb: json['avatar_thumb'], - ); - } -} - -class MineResponseBean { - User user; - int likeCount; - int likeMeCount; - int recentVisitCount; - String? vipExpireDate; - // "createTime" -> "2023-10-09T09:07:20.000+00:00" - String? last_vip_expire_date; - int? vipExpireDays; - bool? has_pwd; - bool isNewUser; - String phone; - int? joininterestcount; - String mainGuideText; - - MineResponseBean( - {required this.user, - required this.likeCount, - required this.likeMeCount, - required this.recentVisitCount, - this.vipExpireDate, - required this.isNewUser, - required this.last_vip_expire_date, - this.vipExpireDays, - required this.phone, - required this.has_pwd, - required this.joininterestcount, - required this.mainGuideText}); - - factory MineResponseBean.fromJson(Map json) { - return MineResponseBean( - user: User.fromJson(json['user']), - likeCount: json['like_count'], - last_vip_expire_date: json['last_vip_expire_date'] ?? '', - has_pwd: json['has_pwd'], - isNewUser : json['isNewUser'] ?? false, - phone: json['phone'], - likeMeCount: json['like_me_count'], - recentVisitCount: json['recent_visit_count'], - vipExpireDate: json['vip_expire_date'], - vipExpireDays: json['vip_expire_days'], - joininterestcount: json['join_interest_count'], - mainGuideText:json['main_guide_text'], - - - ); - } -} diff --git a/circle_app/lib/app/minefragment/state.dart b/circle_app/lib/app/minefragment/state.dart deleted file mode 100644 index 4e00a0f..0000000 --- a/circle_app/lib/app/minefragment/state.dart +++ /dev/null @@ -1,26 +0,0 @@ -import 'package:dio/dio.dart'; - - -class MinefragmentState { - var hearUrl = "http://pics5.baidu.com/feed/622762d0f703918f751ba5e950ce8d915beec4c1.jpeg?token=ed435fd18c71cf7ca7a011acb70460f7"; - MinefragmentState() { - request(); - ///Initialize variables - } - Future request() async { - // print("111111"); - // try{ - // var response = await dio.put('user-service/register/user/info', data: {}); - // print(response.data.toString()); - // }catch(e){ - // if (e is DioException) { - // print('DioException: ${e.message}'); - // print('DioException Error: ${e.error}'); - // print('DioException Response: ${e.response}'); - // } else { - // print('Exception: $e'); - // } - // } - - } -} diff --git a/circle_app/lib/app/minefragment/view.dart b/circle_app/lib/app/minefragment/view.dart deleted file mode 100644 index 2280d61..0000000 --- a/circle_app/lib/app/minefragment/view.dart +++ /dev/null @@ -1,955 +0,0 @@ - -import 'dart:io'; - -import 'package:cached_network_image/cached_network_image.dart'; - -import 'package:circle_app/app/circle/view.dart'; - -import 'package:circle_app/app/msg/view.dart'; -import 'package:circle_app/router/app_routers.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_cache_manager/flutter_cache_manager.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:url_launcher/url_launcher.dart'; - -import '../../common/Widgets/open_vip_tip/view.dart'; -import '../../common/Widgets/tag_widget.dart'; -import '../../common/colors/app_color.dart'; -import '../../main.dart'; -import '../../util/SharedPreferencesHelper.dart'; -import '../../util/util.dart'; -import '../msg/logic.dart'; -import 'logic.dart'; - -const vipIcon = 'assets/images/home/icon_vip_more.png'; - -const MyImageWidget = Image( - image: AssetImage(vipIcon), - fit: BoxFit.fill, -); - -const vipIcon1 = 'assets/images/home/icon_one_vip.png'; - -const MyImageWidget1 = Image( - image: AssetImage(vipIcon1), - fit: BoxFit.fill, -); - -class MinefragmentPage extends StatefulWidget { - MinefragmentPage({Key? key}) : super(key: key); - - @override - State createState() => _MinefragmentPageState(); -} - -class _MinefragmentPageState extends State with RouteAware { - - - final mineLogic = Get.find(); - - final state = Get - .find() - .state; - - @override - void dispose() { - // TODO: implement dispose - super.dispose(); - routeObserver.unsubscribe(this); - } - - @override - void didChangeDependencies() { - // TODO: implement didChangeDependencies - super.didChangeDependencies(); - - /// 路由订阅 - routeObserver.subscribe(this, ModalRoute.of(context) as PageRoute); - } - - - void didPopNext() { - print('didPopNext'); - mineLogic.checkVersion(); - mineLogic.checkShowPositiveFeedBack(); - } - - ///当前页面进入时触发 - void didPush() { - print('didPopNext'); - - } - void didPop() { - print('didPop'); - } - - - @override - Widget build(BuildContext context) { - double statusBarHeight = MediaQuery - .of(context) - .padding - .top; - - return GetBuilder( - builder: (logic) { - return Scaffold( - - backgroundColor: Colors.transparent, - body: Padding( - padding: EdgeInsets.only( - top: 20.0 + statusBarHeight.sp, - left: 11.sp, - right: 11.sp,), - child: SingleChildScrollView( - child: Column( - children: [ - _buildAvatarRow(logic), - _friendsRow(logic), - GestureDetector( - onTapDown: (detail) { - if (detail.localPosition.dy > 100.0) { - showOKToast('相关特权需要在对应功能使用哦~'); - if (logic.isVip.value == 0) { - showRechargeDialog(logic); - } - } else { - showRechargeDialog(logic); - } - - }, - child: Stack(children: [ - logic.isProxy ? MyImageWidget1 : MyImageWidget, - Positioned( - top:24.sp, - child: Container( - width: Get.width, - padding: EdgeInsets.only(left: 18.sp,right: 40.sp), - height: 50.sp, - child: Row( - children: [ - if (!logic.isProxy) - Image.asset(getHomeImage('mine_vip_icon'),width: 46.sp,), - - SizedBox(width: !logic.isProxy ? 5.sp : 60.sp,), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text("会员-微乐园贵宾",style: TextStyle(color: const Color(0xFFFFFFFF),fontSize: 16.sp),), - SizedBox(height: 4.sp,), - Text(logic.vipMsg,style: TextStyle(color: const Color(0x99FFFFFF),fontSize: 13.sp),), - ], - ), - ), - if (!logic.isProxy) - Image.asset(getHomeImage(logic.vipMsg.contains('十几种') ? 'open_vip' : 'pay_vip'),height: 28.sp,), - ], - ), - )), - - ],), - ), - myAssetsItem(), - _circleLiveView(logic), - Container(height: 20.sp,) - ], - ), - ), - ), - ); - }); - } - - myAssetsItem() { - return GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - Get.toNamed(AppRoutes.MyAssets); - }, - child: Container( - margin: EdgeInsets.only(top: 10.sp,), - padding: EdgeInsets.only( - left: 12.sp, - right: 12.sp, - bottom: 10.sp, - top: 10.sp), - // height: 80.sp, - decoration: BoxDecoration( - color: Colors.white.withOpacity(0.05), - borderRadius: BorderRadius.circular(13.sp)), - child: Row( - children: [ - Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - '我的资产', - style: TextStyle( - color: AppColor.mainColor, - fontSize: 18.sp, - ), - ), - SizedBox( - height: 8.sp, - ), - Text( - '您的圈内资产和收入都在这里哦', - style: TextStyle( - color: Colors.white, - fontSize: 15.sp, - ), - ), - ], - ), - ), - Expanded(child: Container()), - Container( - height: 26.sp, - padding: - EdgeInsets.only(left: 10.sp, right: 10.sp), - alignment: Alignment.center, - decoration: BoxDecoration( - gradient: AppColor.mainVerLinearGradient, - borderRadius: BorderRadius.circular(13.sp)), - child: Text( - '前往查看', - style: TextStyle( - color: Colors.white, fontSize: 16.sp), - ), - ), - ], - )), - ); - } - - Widget _circleLiveView(MinefragmentLogic logic) { - - - return Column( - children: [_circleItemView(logic),_invienItemView(),_shareItemView(),_editGoodReviewItemView(), _helpItemView(),_setUpItemView()], - ); - } - - Widget _setUpItemView() { - return GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - Get.toNamed(AppRoutes.SetUpActivity); - // controller.state.hearUrl - }, - child: Container( - // color: Colors.red, - margin: EdgeInsets.only(top: 18.sp), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - Image( - image: AssetImage(getHomeImage("mine_setup")), - width: 24.sp, - height: 24.sp, - ), - SizedBox(width: 10.sp), - const Text( - "设置", - style: TextStyle(color: Colors.white), - ), - ], - ), - Row( - children: [ - mineLogic.isUpdateVersion - ? Container( - width: 10.sp, - height: 10.sp, - margin: EdgeInsets.only(right: 4.sp), - decoration: const BoxDecoration( - color: Colors.red, - shape: BoxShape.circle), - ) - : Container(), - if (mineLogic.isUpdateVersion) - Text('有新版本啦',style: TextStyle(color: Colors.white60),), - Image( - image: AssetImage(getHomeImage("icon_in")), - width: 24.sp, - height: 24.sp, - ), - - ], - ) - ], - ), - ), - ); - } - - Widget _helpItemView() { - return GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - Get.toNamed(AppRoutes.HelpActivity); - // controller.state.hearUrl - }, - child: Container( - margin: EdgeInsets.only(top: 18.sp), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - Image( - image: AssetImage(getHomeImage("mine_help")), - width: 24.sp, - height: 24.sp, - ), - SizedBox(width: 10.sp), - const Text( - "帮助与反馈", - style: TextStyle(color: Colors.white), - ), - - ], - ), - Row( - children: [ - const Text( - "乐园客服在线等您哦", - style: TextStyle(color: Colors.white60), - ), - Image( - image: AssetImage(getHomeImage("icon_in")), - width: 24.sp, - height: 24.sp, - ), - ], - ) - - ], - ), - ), - ); - } - - Widget _invienItemView() { - return GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - Get.toNamed(AppRoutes.Invite); - // controller.state.hearUrl - }, - child: Container( - margin: EdgeInsets.only(top: 18.sp), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - Image( - image: AssetImage(getMineImage("invite_icon")), - width: 24.sp, - height: 24.sp, - ), - SizedBox(width: 10.sp), - const Text( - "邀请赚钱", - style: TextStyle(color: Colors.white), - ), - - ], - ), - Row( - children: [ - Container( - width: 10.sp, - height: 10.sp, - margin: EdgeInsets.only(right: 4.sp), - decoration: const BoxDecoration( - color: Colors.red, - shape: BoxShape.circle), - ), - const Text( - "免费领取会员", - style: TextStyle(color: Colors.white60), - ), - Image( - image: AssetImage(getHomeImage("icon_in")), - width: 24.sp, - height: 24.sp, - ), - ], - ) - - ], - ), - ), - ); - } - - Widget _editGoodReviewItemView() { - - return (mineLogic.isShwGoodReview ?? false) ? GestureDetector( - behavior: HitTestBehavior.opaque, - - onTap: () { - showTipPop(); - }, - child: Container( - margin: EdgeInsets.only(top: 18.sp), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - Image( - image: AssetImage(getMineImage("edit_good_review")), - width: 24.sp, - height: 24.sp, - ), - SizedBox(width: 10.sp), - - const Text( - "给个5星好评", - style: TextStyle(color: Colors.white), - ), - - ], - ), - Row( - children: [ - Container( - width: 10.sp, - height: 10.sp, - margin: EdgeInsets.only(right: 4.sp), - decoration: const BoxDecoration( - color: Colors.red, - shape: BoxShape.circle), - ), - const Text( - "免费领3天会员", - style: TextStyle(color: Colors.white60), - ), - Image( - image: AssetImage(getHomeImage("icon_in")), - width: 24.sp, - height: 24.sp, - ), - ], - ) - - ], - ), - ), - ) : Container(); - } - - Widget _shareItemView() { - return GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - Get.toNamed(AppRoutes.ExternalsharePage); - // controller.state.hearUrl - }, - child: Container( - margin: EdgeInsets.only(top: 18.sp), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - Image( - image: AssetImage(getMineImage("share")), - width: 24.sp, - height: 24.sp, - ), - SizedBox(width: 10.sp), - const Text( - "站外分享", - style: TextStyle(color: Colors.white), - ), - - ], - ), - Row( - children: [ - Text( - '免费领小票', - style: const TextStyle(color: Colors.white60), - ), - Image( - image: AssetImage(getHomeImage("icon_in")), - width: 24.sp, - height: 24.sp, - ), - ], - ) - - ], - ), - ), - ); - } - - Widget _myAssetItemView() { - return GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - Get.toNamed(AppRoutes.MyAssets); - }, - child: Container( - margin: EdgeInsets.only(top: 18.sp), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - Image( - image: AssetImage(getMineImage("wallet")), - width: 24.sp, - height: 24.sp, - ), - SizedBox(width: 10.sp), - const Text( - "我的资产", - style: TextStyle(color: Colors.white), - ), - ], - ), - Row( - children: [ - - Image( - image: AssetImage(getHomeImage("icon_in")), - width: 24.sp, - height: 24.sp, - ), - ], - ) - ], - ), - ), - ); - } - - Widget _circleItemView(MinefragmentLogic logic) { - return GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - Get.toNamed(AppRoutes.MyCircle,arguments: ''); - }, - child: Container( - margin: EdgeInsets.only(top: 18.sp), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - Image( - image: AssetImage(getHomeImage("mine_circle")), - width: 24.sp, - height: 24.sp, - ), - SizedBox(width: 10.sp), - const Text( - "我的圈子", - style: TextStyle(color: Colors.white), - ), - ], - ), - Row( - children: [ - Text( - logic.joinedCircle, - style: const TextStyle(color: Colors.white60), - ), - Image( - image: AssetImage(getHomeImage("icon_in")), - width: 24.sp, - height: 24.sp, - ), - ], - ) - ], - ), - ), - ); - } - - Widget _friendsRow(MinefragmentLogic logic) { - return Center( - child: Container( - width: Get.width, - height: 85.sp, - margin: EdgeInsets.only(left: 30.sp, right: 30.sp), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - Get.toNamed(AppRoutes.FriendsActivity,arguments: 1); - }, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - logic.likeCount.toString(), - style: TextStyle( - color: Colors.white, - fontSize: 16.sp, - ), - ), - SizedBox(height: 4.sp), - Text( - "我喜欢的", - style: TextStyle( - shadows: const [ - Shadow( - color: Color(0x99FF00F8), - offset: Offset(2, 2), - blurRadius: 3, - ), - ], - color: const Color.fromARGB(255, 247, 250, 250), - fontSize: 16.sp, - ), - ), - ], - ), - ), - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: ()async { - logic.like_me_count_new = 0; - logic.update(); - SharedPreferencesHelper.getInstance().then((sharedPreferences) { - sharedPreferences.setInt(SharedPreferencesHelper.LIKEMECOUNT, logic.like_me_count); - }); - Get.toNamed(AppRoutes.FriendsActivity,arguments: 2); - }, - child: Stack( - children: [ - Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Row( - children: [ - Text( - logic.like_me_count.toString(), - style: TextStyle( - color: Colors.white, - fontSize: 16.sp, - ), - ), - ], - ), - SizedBox( - height: 4.sp, - width: 80.sp, - ), - Text( - "喜欢我的", - style: TextStyle( - shadows: const [ - Shadow( - color: Color(0x99FF00F8), - offset: Offset(2, 2), - blurRadius: 3, - ), - ], - color: const Color.fromARGB(255, 247, 250, 250), - fontSize: 16.sp, - ), - ), - ], - ), - Positioned( - right: 0.sp, - top: 6.sp, - child: Text( - logic.like_me_count_new>0 ? "+${logic.like_me_count_new}":"", - style: const TextStyle(color: Color.fromRGBO(0, 255, 210, 1.0)), - ), - ) - ], - ), - ), - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () async{ - logic.recent_visit_count_new = 0; - SharedPreferencesHelper.getInstance().then((sharedPreferences) { - sharedPreferences.setInt(SharedPreferencesHelper.RECENTVISITCOUNT, logic.recent_visit_count); - }); - MsgLogic msgLogic = Get.find(); - msgLogic.updateVisitCount(); - - Get.toNamed(AppRoutes.VisitorListActivity); - }, - child: Stack( - children: [ - Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Row( - children: [ - Text( - logic.recent_visit_count.toString(), - style: TextStyle( - color: Colors.white, - fontSize: 16.sp, - ), - ), - ], - ), - SizedBox( - height: 4.sp, - width: 80.sp, - ), - Text( - "最近来访", - style: TextStyle( - shadows: const [ - Shadow( - color: Color(0x99FF00F8), - offset: Offset(2, 2), - blurRadius: 3, - ), - ], - color: const Color.fromARGB(255, 247, 250, 250), - fontSize: 16.sp, - ), - ), - ], - ), - Positioned( - right: 0.sp, - top: 6.sp, - child: Text( - logic.recent_visit_count_new>0 ? "+${logic.recent_visit_count_new}":"", - style: const TextStyle(color: Color.fromRGBO(0, 255, 210, 1.0)), - ), - ) - ], - ), - ), - ], - ), - ), - ); - } - - Widget _buildAvatarRow(MinefragmentLogic logic) { - return GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () async{ - await Get.toNamed(AppRoutes.UserInfoActivity); - logic.onInit(); - }, - child: SizedBox( - width: Get.width, - height: 65.sp, - child: Row( - children: [ - Center( - child: Stack( - alignment: Alignment.center, - children: [ - Container( - width: 68.sp, - height: 68.sp, - decoration: const BoxDecoration( - shape: BoxShape.circle, - gradient: LinearGradient( - colors: [Color(0xFFDD3DF4), Color(0xFF30FFD9)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - SizedBox( - width: 63.sp, - height: 63.sp, - child: _buildAvatar1(logic), - ) - ], - ), - ), - Expanded( - child: Container( - padding: EdgeInsets.only(left: 10.sp), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - _buildNameRow(logic), - SizedBox(height: 10.sp), - _buildInfoRow(logic), - ], - ), - ), - ), - ], - ), - ), - ); - } - - Widget _buildAvatar1(MinefragmentLogic logic) { - - - return ClipOval( - child: GestureDetector( - onTap: () { - if(logic.userInfoBean!=null){ - var imgList = []; - imgList.add(logic.userInfoBean!.avatar); - // Get.toNamed(AppRoutes.Swiper,arguments:imgList); - Get.toNamed(AppRoutes.Swiper, arguments: { - 'imaglist': imgList, - 'index': 0 - }); - } - - }, - child:logic.userInfoBean==null ? SizedBox( - width: 63.sp, - height: 63.sp, - ): CachedNetworkImage( - fit: BoxFit.cover, - placeholder: null, - imageUrl: logic.avatar, - width: 63.sp, - height: 63.sp, - ), - ), - - ); - } - - Widget _buildNameRow(MinefragmentLogic logic) { - return Container( - margin: EdgeInsets.only(top: 6.sp), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - logic.name, - style: TextStyle( - color: const Color.fromRGBO(247, 250, 250, 1.0), - fontSize: 16.sp, - ), - ), - Row( - children: [ - Text( - logic.enterHomeInfoMsg, - style: TextStyle( - color: const Color.fromRGBO(247, 250, 250, 1.0), - fontSize: 16.sp, - ), - ), - Image( - image: AssetImage(getHomeImage("icon_in")), - width: 44.sp, - height: 18.sp, - ), - ], - ), - ], - ), - ); - } - - Widget _buildInfoRow(MinefragmentLogic logic) { - return Row( - children: [ - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color.fromRGBO(141, 255, 248, 1.0), - Color.fromRGBO(181, 211, 255, 1.0), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only(top: 2.sp, bottom: 2.sp, left: 10.sp, right: 10.sp), - child: Text( - logic.ageMsg, - style: TextStyle( - color: Colors.black, - fontSize: 10.sp, - ), - ), - ), - SizedBox(width: 6.sp), - UserTagWidget(logic.userInfoBean?.mark ?? 0), - - - // logic.isVip>0 ? - // Image( - // image: AssetImage(getBaseImage("vip")), - // width: 44.sp, - // height: 18.sp, - // ):Container(), - ], - ); - } - - showRechargeDialog(MinefragmentLogic ctr) async { - Get.bottomSheet( - Scaffold( - backgroundColor: Colors.transparent, - body: Open_vip_tipPage(false), - ), - isScrollControlled: true, - enableDrag: false).then((value) { - ctr.getMode(); - }); - - - } - - showTipPop() { - Get.bottomSheet( - CupertinoActionSheet( - // 标题 - //提示内容 - actions: [ - //操作按钮集合 - CupertinoActionSheetAction( - onPressed: () async { - Get.back(); - // - await launch('https://apps.apple.com/cn/app/%E5%BE%AE%E4%B9%90%E5%9B%AD-%E4%BA%9A%E6%96%87%E5%8C%96%E5%A4%9A%E5%85%83%E4%BA%A4%E5%8F%8B%E5%9F%BA%E5%9C%B0/id6459449499', forceSafariVC: false); - }, - child: Text('立即评价'), - ), - CupertinoActionSheetAction( - onPressed: () { - - Get.back(); - Get.toNamed(AppRoutes.Good_Reviews); - - }, - child: Text('反馈截图'), - ), - ], - cancelButton: CupertinoActionSheetAction( - //取消按钮 - onPressed: () { - Get.back(); - }, - child: Text('取消'), - ), - ), - isScrollControlled: true); - } -} diff --git a/circle_app/lib/app/msg/TIMUIKitConversation/tim_ui_kit_conversation_total_unread.dart b/circle_app/lib/app/msg/TIMUIKitConversation/tim_ui_kit_conversation_total_unread.dart deleted file mode 100644 index 7b3abe2..0000000 --- a/circle_app/lib/app/msg/TIMUIKitConversation/tim_ui_kit_conversation_total_unread.dart +++ /dev/null @@ -1,52 +0,0 @@ -// ignore_for_file: camel_case_types - -import 'package:flutter/cupertino.dart'; -import 'package:provider/provider.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_statelesswidget.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_conversation_view_model.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/services_locatar.dart'; -import 'package:tencent_cloud_chat_uikit/ui/widgets/unread_message.dart'; - -typedef unreadCountBuilder = Widget Function(int unreadCount); - -class TIMUIKitConversationTotalUnread extends TIMUIKitStatelessWidget { - final TUIConversationViewModel model = - serviceLocator(); - final int? unreadCount; - final unreadCountBuilder? builder; - final double? width; - final double? height; - - TIMUIKitConversationTotalUnread( - {this.width = 22.0, - this.height = 22.0, - this.unreadCount, - this.builder, - Key? key}) - : super(key: key); - - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - return MultiProvider( - providers: [ - ChangeNotifierProvider.value(value: model), - ], - child: Consumer( - builder: (context, value, child) { - if (value.totalUnReadCount == 0) { - return Container(); - } - - if (builder != null) { - return builder!(value.totalUnReadCount); - } - return UnreadMessage( - unreadCount: unreadCount ?? value.totalUnReadCount, - width: width, - height: height); - }, - ), - ); - } -} diff --git a/circle_app/lib/app/msg/TIMUIKitConversation/tim_uikit_conversation.dart b/circle_app/lib/app/msg/TIMUIKitConversation/tim_uikit_conversation.dart deleted file mode 100644 index 0ad46bd..0000000 --- a/circle_app/lib/app/msg/TIMUIKitConversation/tim_uikit_conversation.dart +++ /dev/null @@ -1,1339 +0,0 @@ -import 'dart:convert'; -import 'dart:math'; - -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:circle_app/common/colors/app_color.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:flutter_slidable_for_tencent_im/flutter_slidable.dart'; -import 'package:get/get.dart'; -import 'package:gradient_borders/gradient_borders.dart'; -import 'package:provider/provider.dart'; -import 'package:scroll_to_index/scroll_to_index.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_state.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_statelesswidget.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/life_cycle/conversation_life_cycle.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_conversation_view_model.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/core/tim_uikit_wide_modal_operation_key.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/services_locatar.dart'; -import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; -import 'package:tencent_cloud_chat_uikit/ui/controller/tim_uikit_conversation_controller.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/platform.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/screen_utils.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitConversation/tim_uikit_conversation_item.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart'; -import 'package:tencent_cloud_chat_uikit/ui/widgets/wide_popup.dart'; - -import '../../../network/api.dart'; -import '../../../network/dio_manager.dart'; -import '../../../router/app_routers.dart'; -import '../../../util/eventBus.dart'; -import '../../../util/util.dart'; -import '../../circle/widgets/discover.dart'; -import '../logic.dart'; -import '../recommend_circle_friend_item.dart'; -import 'tim_uikit_conversation_item.dart'; - -typedef TIMConversationItemBuilder = Widget Function( - V2TimConversation conversationItem, - [V2TimUserStatus? onlineStatus]); - -typedef ConversationItemSlideBuilder = List -Function(V2TimConversation conversationItem); - -typedef ConversationItemSecondaryMenuBuilder = Widget Function( - V2TimConversation conversationItem, VoidCallback onClose); - -class TIMConversation extends StatefulWidget { - /// the callback after clicking conversation item - final ValueChanged? onTapItem; - - /// conversation controller - final TIMUIKitConversationController? controller; - - final AutoScrollController? autoScrollController; - - final ScrollController? scrollController; - - /// the builder for conversation item - final TIMConversationItemBuilder? itemBuilder; - - /// the builder for Slidable item for each conversation item, shows on narrow screens. - final ConversationItemSlideBuilder? itemSlideBuilder; - - /// the widget of secondary tap menu for each conversation item, shows on wide screens. - final ConversationItemSecondaryMenuBuilder? itemSecondaryMenuBuilder; - - /// the widget shows when no conversation exists - final Widget Function()? emptyBuilder; - - /// the filter for conversation - final bool Function(V2TimConversation? conversation)? conversationCollector; - - /// the builder for the second line in each conservation item, - /// usually shows the summary of the last message - final LastMessageBuilder? lastMessageBuilder; - - /// The life cycle hooks for `TIMUIKitConversation` - final ConversationLifeCycle? lifeCycle; - - /// Control if shows the online status for each user on its avatar. - final bool isShowOnlineStatus; - - /// Control if shows the identifier that the conversation has a draft text, inputted in previous. - /// Also, you have better specifying the `draftText` field for `TIMUIKitChat`, from the `draftText` in `V2TimConversation`, - /// to meet the identifier shows here. - final bool isShowDraft; - - const TIMConversation({Key? key, - this.lifeCycle, - this.onTapItem, - this.controller, - this.autoScrollController, - this.itemSecondaryMenuBuilder, - this.scrollController, - this.itemBuilder, - this.isShowDraft = true, - this.itemSlideBuilder, - this.conversationCollector, - this.emptyBuilder, - this.lastMessageBuilder, - this.isShowOnlineStatus = true}) - : super(key: key); - - @override - State createState() { - return _TIMConversationState(); - } -} - -class ConversationItemSlidePanel extends TIMUIKitStatelessWidget { - ConversationItemSlidePanel({ - Key? key, - this.flex = 1, - this.backgroundColor = Colors.white, - this.foregroundColor, - this.autoClose = true, - required this.onPressed, - this.icon, - this.spacing = 4, - this.label, - }) - : assert(flex > 0), - assert(icon != null || label != null), - super(key: key); - - /// {@macro slidable.actions.flex} - final int flex; - - /// {@macro slidable.actions.backgroundColor} - final Color backgroundColor; - - /// {@macro slidable.actions.foregroundColor} - final Color? foregroundColor; - - /// {@macro slidable.actions.autoClose} - final bool autoClose; - - /// {@macro slidable.actions.onPressed} - final SlidableActionCallback? onPressed; - - /// An icon to display above the [label]. - final IconData? icon; - - /// The space between [icon] and [label] if both set. - /// - /// Defaults to 4. - final double spacing; - - /// A label to display below the [icon]. - final String? label; - - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - return SlidableAction( - onPressed: onPressed, - flex: flex, - backgroundColor: backgroundColor, - foregroundColor: foregroundColor, - autoClose: autoClose, - label: label, - spacing: spacing, - ); - } -} - -class _TIMConversationState extends TIMUIKitState { - MsgLogic logic = Get.find(); - final TUIConversationViewModel model = - serviceLocator(); - late TIMUIKitConversationController _timuiKitConversationController; - final TUIThemeViewModel themeViewModel = serviceLocator(); - - // final TUIFriendShipViewModel friendShipViewModel = - // serviceLocator(); - bool hasMore = true; - var sub; - - List chatImIdList = []; - Map recommendCircleFriendData = {}; - - @override - void initState() { - super.initState(); - - loadRecommendCircleFriendData(); - final controller = getController(); - widget.scrollController!.addListener(() { - try { - if (widget.scrollController!.position.pixels == - widget.scrollController!.position.maxScrollExtent && - hasMore) { - _timuiKitConversationController.loadData(); - } - } catch (_) {} - }); - _timuiKitConversationController = controller; - _timuiKitConversationController.model = model; - } - - scrollToTop() { - widget.autoScrollController!.animateTo( - 0, // Scroll to the top - duration: Duration(milliseconds: 300), - curve: Curves.easeInOut, - ); - } - - TIMUIKitConversationController getController() { - return widget.controller ?? TIMUIKitConversationController(); - } - - void onTapConvItem(V2TimConversation conversation) { - if (widget.onTapItem != null) { - widget.onTapItem!(conversation); - } - model.setSelectedConversation(conversation); - } - - _clearHistory(V2TimConversation conversationItem) async { - await _timuiKitConversationController.clearHistoryMessage( - conversation: conversationItem); - await Future.delayed(Duration(seconds: 1)); - EventBusManager.fire(RefreshUnread()); - } - - _pinConversation(V2TimConversation conversation) { - _timuiKitConversationController.pinConversation( - conversationID: conversation.conversationID, - isPinned: !conversation.isPinned!); - } - - _deleteConversation(V2TimConversation conversation) async { - await _timuiKitConversationController.deleteConversation( - conversationID: conversation.conversationID); - await Future.delayed(Duration(seconds: 1)); - EventBusManager.fire(RefreshUnread()); - } - - List getFilteredConversation() { - List filteredConversationList = model.conversationList - .where( - (element) => (element?.groupID != null || element?.userID != null)) - .toList(); - - // 过滤指定的 userID qpqz_prod_10_10000000000 - String devtTargetUserID = "qpqz_dev_10_10000000000"; - String prodTargetUserID = "qpqz_prod_10_10000000000"; - filteredConversationList = filteredConversationList - .where((conversation) => - conversation?.userID != devtTargetUserID && - conversation?.userID != prodTargetUserID) - .toList(); - - if (widget.conversationCollector != null) { - filteredConversationList = filteredConversationList - .where(widget.conversationCollector!) - .toList(); - } - return filteredConversationList; - } - - _onScrollToConversation(String conversationID) { - final msgList = getFilteredConversation(); - bool isFound = false; - int targetIndex = 1; - for (int i = msgList.length - 1; i >= 0; i--) { - final currentConversation = msgList[i]; - if (currentConversation?.conversationID == conversationID) { - isFound = true; - targetIndex = i; - break; - } - } - - if (isFound) { - widget.autoScrollController!.scrollToIndex( - targetIndex, - preferPosition: AutoScrollPosition.begin, - ); - } - } - - Widget _defaultSecondaryMenu(V2TimConversation conversationItem, - VoidCallback onClose) { - return TUIKitColumnMenu(data: [ - if (!PlatformUtils().isWeb) - ColumnMenuItem( - label: TIM_t("清除消息"), - icon: const Icon(Icons.clear_all, size: 16), - onClick: () { - onClose(); - _clearHistory(conversationItem); - }), - ColumnMenuItem( - label: conversationItem.isPinned! ? TIM_t("取消置顶") : TIM_t("置顶"), - icon: Icon( - conversationItem.isPinned! - ? Icons.vertical_align_bottom - : Icons.vertical_align_top, - size: 16), - onClick: () { - onClose(); - _pinConversation(conversationItem); - }), - ColumnMenuItem( - label: TIM_t("删除会话"), - icon: const Icon(Icons.delete_outline, size: 16), - onClick: () { - onClose(); - _deleteConversation(conversationItem); - }), - ]); - } - - List _defaultSlideBuilder( - V2TimConversation conversationItem,) { - final theme = themeViewModel.theme; - return [ - if (!PlatformUtils().isWeb) - ConversationItemSlidePanel( - onPressed: (context) { - _clearHistory(conversationItem); - }, - backgroundColor: theme.conversationItemSliderClearBgColor ?? - CommonColor.primaryColor, - foregroundColor: theme.conversationItemSliderTextColor, - label: TIM_t("清除聊天"), - spacing: 0, - autoClose: true, - ), - ConversationItemSlidePanel( - onPressed: (context) { - _pinConversation(conversationItem); - }, - backgroundColor: - theme.conversationItemSliderPinBgColor ?? CommonColor.infoColor, - foregroundColor: theme.conversationItemSliderTextColor, - label: conversationItem.isPinned! ? TIM_t("取消置顶") : TIM_t("置顶"), - ), - ConversationItemSlidePanel( - onPressed: (context) { - _deleteConversation(conversationItem); - }, - backgroundColor: - theme.conversationItemSliderDeleteBgColor ?? Colors.red, - foregroundColor: theme.conversationItemSliderTextColor, - label: TIM_t("删除"), - ) - ]; - } - - Widget _getSecondaryMenu(V2TimConversation conversation, - VoidCallback onClose) { - if (widget.itemSecondaryMenuBuilder != null) { - return widget.itemSecondaryMenuBuilder!(conversation, onClose); - } - return _defaultSecondaryMenu(conversation, onClose); - } - - ConversationItemSlideBuilder _getSlideBuilder() { - return widget.itemSlideBuilder ?? _defaultSlideBuilder; - } - - Future> getUserListInfo( - List userIdList) async { - V2TimValueCallback getLoginUserRes = - await TencentImSDKPlugin.v2TIMManager.getLoginUser(); - if (getLoginUserRes.code == 0) { - //获取成功 - if (getLoginUserRes.data != null) { - userIdList.insert( - 0, getLoginUserRes.data!); // getLoginUserRes.data为查询到的登录用户的UserID - } - } - if (userIdList.length > 100) { - List list = []; - double count = userIdList.length / 100; - int size = count.toInt(); - - - if (count > size) { - for (int i = 0; i <= size; i++) { - List dataList = await getUserListData( - userIdList.sublist( - i + i * 100, i == size ? userIdList.length : (i + 1) * 100)); - list.addAll(dataList); - } - } else { - for (int i = 0; i < size; i++) { - List dataList = await getUserListData( - userIdList.sublist(i + i * 100, (i + 1) * 100)); - list.addAll(dataList); - } - } - return list; - } else { - //获取用户资料 - V2TimValueCallback> getUsersInfoRes = - await TencentImSDKPlugin.v2TIMManager - .getUsersInfo(userIDList: userIdList); //需要查询的用户id列表 - if (getUsersInfoRes.code == 0) { - // 查询成功 - getUsersInfoRes.data?.forEach((element) { - element.allowType; //用户的好友验证方式 0:允许所有人加我好友 1:不允许所有人加我好友 2:加我好友需我确认 - element.birthday; //用户生日 - element.customInfo; //用户的自定义状态 - element.faceUrl; //用户头像 url - element.gender; //用户的性别 1:男 2:女 - element.level; //用户的等级 - element.nickName; //用户昵称 - element.role; //用户的角色 - element.selfSignature; //用户的签名 - element.userID; //用户 ID - }); - return getUsersInfoRes.data ?? []; - } - } - - return []; - } - - getUserListData(List userIdList) async { - //获取用户资料 - V2TimValueCallback> getUsersInfoRes = - await TencentImSDKPlugin.v2TIMManager - .getUsersInfo(userIDList: userIdList); //需要查询的用户id列表 - if (getUsersInfoRes.code == 0) { - // 查询成功 - getUsersInfoRes.data?.forEach((element) { - element.allowType; //用户的好友验证方式 0:允许所有人加我好友 1:不允许所有人加我好友 2:加我好友需我确认 - element.birthday; //用户生日 - element.customInfo; //用户的自定义状态 - element.faceUrl; //用户头像 url - element.gender; //用户的性别 1:男 2:女 - element.level; //用户的等级 - element.nickName; //用户昵称 - element.role; //用户的角色 - element.selfSignature; //用户的签名 - element.userID; //用户 ID - }); - return getUsersInfoRes.data ?? []; - } - return []; - } - - @override - void dispose() { - super.dispose(); - } - - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - final theme = value.theme; - final isDesktopScreen = - TUIKitScreenUtils.getFormFactor(context) == DeviceType.Desktop; - return MultiProvider( - providers: [ - ChangeNotifierProvider.value(value: model), - // ChangeNotifierProvider.value(value: friendShipViewModel) - ], - builder: (BuildContext context, Widget? w) { - final _model = Provider.of(context); - hasMore = _model.haveMoreData; - // _model.lifeCycle = widget.lifeCycle; - - List filteredConversationList = - getFilteredConversation(); - - if (TencentUtils.checkString(_model.scrollToConversation) != null) { - _onScrollToConversation(_model.scrollToConversation!); - _model.clearScrollToConversation(); - } - - List userIdList = []; - - filteredConversationList.forEach((element) { - userIdList.add(element!.userID!); - }); - - Widget conversationList() { - return filteredConversationList.isNotEmpty - ? FutureBuilder>( - future: getUserListInfo(userIdList), - builder: (BuildContext context, - AsyncSnapshot> snapshot) { - return ListView.builder( - controller: widget.scrollController!, - // shrinkWrap: true, - itemCount: recommendCircleFriendData.isNotEmpty && - filteredConversationList.length < 15 - ? filteredConversationList.length + 1 - : filteredConversationList.length, - itemBuilder: (context, index) { - if (index == filteredConversationList.length) { - return recommendCircleFriendData.isNotEmpty - ? RecommendCircleFriendItem(true,15.sp, - recommendCircleFriendData: recommendCircleFriendData, - getDataCallBack: () { - loadRecommendCircleFriendData(); - }) - : Container(); - } - - final conversationItem = - filteredConversationList[index]; - - // final V2TimUserStatus? onlineStatus = - // _friendShipViewModel.userStatusList.firstWhere( - // (item) => - // item.userID == conversationItem?.userID, - // orElse: () => - // V2TimUserStatus(statusType: 0)); - - // if (widget.itemBuilder != null) { - // return widget.itemBuilder!( - // conversationItem!, onlineStatus); - // } - - final slideChildren = - _getSlideBuilder()(conversationItem!); - - final isCurrent = conversationItem.conversationID == - model.selectedConversation?.conversationID; - - final isPined = conversationItem.isPinned ?? false; - - V2TimUserFullInfo? userFullInfo; - bool isOfficial = false; - bool isSameCity = false; - int mark = 0; - if (snapshot.connectionState == - ConnectionState.done) { - if ((snapshot.data ?? []).isNotEmpty) { - snapshot.data!.forEach((element) { - if (element.userID == - conversationItem.userID) { - userFullInfo = element; - } - }); - //自己的信息 - V2TimUserFullInfo myuserFullInfo = snapshot - .data! - .where((element) => - element.userID! == - model.selfInfoViewModel.loginInfo! - .userID!) - .toList() - .first; - - - if (userFullInfo!.customInfo! - .containsKey('Label')) { - if (userFullInfo!.customInfo!['Label'] - .toString() - .isNotEmpty) { - Map otherInfo = jsonDecode(userFullInfo! - .customInfo!['Label'] - .toString()); - Map myInfo = jsonDecode(myuserFullInfo! - .customInfo!['Label'] - .toString()); - - if (otherInfo.containsKey('mark')) { - mark = otherInfo['mark'] ?? 0; - } - if (myInfo != null) { - if (myInfo.containsKey('city')) { - if (myInfo['city'].toString().contains( - otherInfo['city'].toString())) { - isSameCity = true; - } - } - } - } - } - - if (userFullInfo != null) { - List userIdList = - userFullInfo!.userID!.split('_'); - if (userIdList.length >= 4) { - if (int.parse(userIdList[2]) == 10) { - isOfficial = true; - } else { - isOfficial = false; - } - } - } - } - } - - Widget conversationLineItem() { - return Material( - color: Colors.transparent, - child: InkWell( - child: TIMConversationItem( - mark: mark, - isSameCity: isSameCity, - isOfficial: isOfficial, - isCurrent: isCurrent, - userInfo: userFullInfo, - isShowDraft: widget.isShowDraft, - lastMessageBuilder: - widget.lastMessageBuilder, - faceUrl: conversationItem.faceUrl ?? "", - nickName: conversationItem.showName ?? "", - isDisturb: conversationItem.recvOpt != 0, - lastMsg: conversationItem.lastMessage, - isPined: isPined, - groupAtInfoList: - conversationItem.groupAtInfoList ?? - [], - unreadCount: - conversationItem.unreadCount ?? 0, - draftText: conversationItem.draftText, - onlineStatus: (widget - .isShowOnlineStatus && - conversationItem.userID != null && - conversationItem - .userID!.isNotEmpty) - ? null - : null, - draftTimestamp: - conversationItem.draftTimestamp, - convType: conversationItem.type), - onTap: () => onTapConvItem(conversationItem), - ), - ); - } - - return index == 0 ? Column( - children: [ - GetBuilder(builder: ( - logic) { - return GestureDetector( - onTap: () { - - Get.toNamed(AppRoutes.VisitorListActivity)!.then((value) => logic.getVisitorMsgData()); - }, - child: Container( - decoration: BoxDecoration( - gradient: LinearGradient( - colors: [ - const Color(0x0F4B3E5E), - const Color(0xaF334141) - ])), - padding: const EdgeInsets.only( - top: 6, bottom: 6, left: 16, right: 16), - child: Row( - children: [ - ClipOval(child: Image.network( - 'https://qiniuyun.ikuayou.com/dW5kZWZpbmVkLzE3MTU3ODAxNjM1MDNf5LyB5Lia5b6u5L-h5oiq5Zu-XzNkMzI0MjJkLTJmYWUtNGRmZC04MDQxLTUyZGE2NzBlNzVjMQ==', - width: 40.sp, - height: 40.sp, - fit: BoxFit.cover,)), - SizedBox(width: 10,), - Expanded(child: Column( - crossAxisAlignment: CrossAxisAlignment - .start, - children: [ - Row( - children: [ - Text('最近来访', style: TextStyle( - color: Colors.white, - fontSize: 16.sp),), - SizedBox(width: 4.sp,), - Text( - logic.recent_visit_count_new > 0 - ? "+${logic - .recent_visit_count_new}" - : "", - style: const TextStyle( - color: Color.fromRGBO( - 0, 255, 210, 1.0)), - ), - ], - ), - SizedBox(height: 6,), - Text(logic.tip, style: TextStyle( - color: Colors.white.withOpacity( - 0.5), fontSize: 14.sp),), - ], - )) - ], - ), - ), - ); - }), - TUIKitScreenUtils.getDeviceWidget( - desktopWidget: AutoScrollTag( - key: - ValueKey(conversationItem.conversationID), - controller: widget.autoScrollController!, - index: index, - child: GestureDetector( - onSecondaryTapDown: (details) { - TUIKitWidePopup.showPopupWindow( - operationKey: - TUIKitWideModalOperationKey - .conversationSecondaryMenu, - isDarkBackground: false, - borderRadius: const BorderRadius.all( - Radius.circular(4)), - context: context, - offset: Offset( - min( - details.globalPosition.dx, - MediaQuery - .of(context) - .size - .width - - 80), - min( - details.globalPosition.dy, - MediaQuery - .of(context) - .size - .height - - 130)), - child: (onClose) => - _getSecondaryMenu( - conversationItem, onClose)); - }, - child: conversationLineItem(), - ), - ), - defaultWidget: AutoScrollTag( - key: - ValueKey(conversationItem.conversationID), - controller: widget.autoScrollController!, - index: index, - child: Slidable( - groupTag: 'conversation-list', - child: conversationLineItem(), - endActionPane: ActionPane( - extentRatio: slideChildren.length > 2 - ? 0.77 - : 0.5, - motion: const DrawerMotion(), - children: slideChildren)), - )) - ], - ) : TUIKitScreenUtils.getDeviceWidget( - desktopWidget: AutoScrollTag( - key: - ValueKey(conversationItem.conversationID), - controller: widget.autoScrollController!, - index: index, - child: GestureDetector( - onSecondaryTapDown: (details) { - TUIKitWidePopup.showPopupWindow( - operationKey: - TUIKitWideModalOperationKey - .conversationSecondaryMenu, - isDarkBackground: false, - borderRadius: const BorderRadius.all( - Radius.circular(4)), - context: context, - offset: Offset( - min( - details.globalPosition.dx, - MediaQuery - .of(context) - .size - .width - - 80), - min( - details.globalPosition.dy, - MediaQuery - .of(context) - .size - .height - - 130)), - child: (onClose) => - _getSecondaryMenu( - conversationItem, onClose)); - }, - child: conversationLineItem(), - ), - ), - defaultWidget: AutoScrollTag( - key: - ValueKey(conversationItem.conversationID), - controller: widget.autoScrollController!, - index: index, - child: Slidable( - groupTag: 'conversation-list', - child: conversationLineItem(), - endActionPane: ActionPane( - extentRatio: slideChildren.length > 2 - ? 0.77 - : 0.5, - motion: const DrawerMotion(), - children: slideChildren)), - )); - }); - }) - : (widget.emptyBuilder != null - ? widget.emptyBuilder!() - : recommendCircleFriendData.isNotEmpty - ? recommendCircleFriendWidget() - : Container()); - } - - // EasyRefresh( - // header: CustomizeBallPulseHeader(color: theme.primaryColor), - // onRefresh: () async { - // model.refresh(); - // }, - // child: - return TUIKitScreenUtils.getDeviceWidget( - defaultWidget: SlidableAutoCloseBehavior( - child: conversationList(), - ), - desktopWidget: Scrollbar( - controller: widget.autoScrollController!, - child: conversationList())); - }); - } - - recommendCircleFriendWidget() { - try { - var info = {}; - - var user = Users.fromJson(recommendCircleFriendData['user']); - - // 对方喜欢了你100 - // ·你们有共同喜欢的圈友90 - // ·你喜欢的圈友也喜欢TA80 - // ·你们都在深圳留下过足迹70 - // ·你们有2个共同的圈子:圈子名称、圈子名称60 - // ·我刚来到这里哦55 - // ·可能是你想认识的人50 - // ·很多圈友都喜欢TA40 - // ·TA是乐园优秀圈主哦~30 - - - info = checkCardReturnData(recommendCircleFriendData); - - List circleList = recommendCircleFriendData['interests']; - - return Container( - padding: EdgeInsets.only(left: 15.sp, right: 15.sp), - child: Column(children: [ - Container( - margin: EdgeInsets.only(top: 20.sp), - child: Row( - children: [ - Expanded( - child: Container( - height: 2.sp, - color: Colors.white.withOpacity(0.5), - )), - Container( - width: 4.sp, - height: 4.sp, - margin: EdgeInsets.only(left: 15.sp, right: 15.sp), - decoration: BoxDecoration( - shape: BoxShape.circle, - color: Colors.white.withOpacity(0.5)), - ), - Expanded( - child: Container( - height: 2.sp, - color: Colors.white.withOpacity(0.5), - )), - ], - ), - ), - Container( - margin: EdgeInsets.only(top: 16.sp), - child: Row( - children: [ - Image.asset( - getMsgImage('heart_icon'), - width: 18.sp, - ), - SizedBox( - width: 4.sp, - ), - ShaderMask( - shaderCallback: (Rect bounds) { - return const LinearGradient( - begin: Alignment(0.0, -1.0), - end: Alignment.bottomCenter, - colors: [Color(0xff71F3F2), Color(0xffF657FF)], - ).createShader(Offset.zero & bounds.size); - }, - child: Text( - '圈友推荐', - style: TextStyle( - fontSize: 18.sp, - fontWeight: FontWeight.w600, - color: Colors.white, - shadows: [ - Shadow( - color: Color(0xffF657FF), offset: Offset( - 0.0, -1)) - ]), - ), - ), - SizedBox( - width: 4.sp, - ), - Image.asset( - getMsgImage('heart_icon'), - width: 18.sp, - ), - Expanded(child: Container()), - InkWell( - onTap: () { - loadRecommendCircleFriendData(); - }, - child: Container( - child: Row( - children: [ - Icon( - Icons.refresh_sharp, - size: 18.sp, - color: AppColor.mainColor, - ), - SizedBox( - width: 4.sp, - ), - Text( - '换一位', - style: TextStyle( - color: AppColor.mainColor, fontSize: 15.sp), - ) - ], - ), - ), - ) - ], - ), - ), - Container( - margin: EdgeInsets.only(top: 16.sp), - width: Get.width, - // constraints: BoxConstraints(maxHeight: 230.sp), - decoration: BoxDecoration( - // gradient: LinearGradient( - // colors: [Color(0xFF4C3E5F), Color(0xFF324140)]), - // borderRadius: BorderRadius.circular(8.sp), - // border: GradientBoxBorder( - // gradient: AppColor.mainVerLinearGradient, - // width: 0.sp, - // ), - ), - padding: EdgeInsets.only(left: 12.sp, right: 12.sp, top: 10.sp), - child: Column( - children: [ - GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.UserInfoActivity, - arguments: user.userId.toString()); - }, - child: Container( - child: Row( - children: [ - ClipOval( - child: Image.network( - recommendCircleFriendData['user']['avatar'], - width: 50.sp, - height: 50.sp, - fit: BoxFit.cover, - ), - ), - SizedBox( - width: 6.sp, - ), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Text( - user.nickname ?? '', - style: TextStyle( - fontSize: 16.sp, - color: Color(0XFFF7FAFA), - fontWeight: FontWeight.bold), - ), - SizedBox(width: 8.sp,), - Row( - mainAxisAlignment: MainAxisAlignment - .start, - children: [ - ShaderMask( - shaderCallback: (Rect bounds) { - return const LinearGradient( - begin: Alignment.centerRight, - end: Alignment.centerLeft, - colors: [ - Color(0xff71F3F2), - Color(0xffF657FF) - ], - ).createShader( - Offset.zero & bounds.size); - }, - child: Text( - '匹配度' + - (recommendCircleFriendData['recommend_score'] - .toString() ?? '') + '%', - style: TextStyle( - fontSize: 14.sp, - fontWeight: FontWeight.w600, - color: Colors.white), - ), - ), - ], - ) - ], - ), - SizedBox(height: 4.sp,), - Row( - children: [ - Container( - alignment: Alignment.center, - height: 18.sp, - padding: - EdgeInsets.only( - left: 6.sp, right: 6.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular( - 9.sp), - gradient: const LinearGradient( - begin: Alignment(0.25, 0.5), - end: Alignment(0.75, 0.5), - colors: [ - Color(0xff8DFFF8), - Color(0xffB5D3FF) - ])), - child: Text( - getAgeCOntent( - user!.gender ?? 0, - user!.age ?? 0, - user!.role ?? 0, - user!.orientation ?? 0), - style: TextStyle( - color: Colors.black, - fontSize: 12.sp, - ), - ), - ), - if (user.vip! > 0) - Container( - margin: EdgeInsets.only( - left: 4.sp, - ), - child: Image.asset( - getCircleImage( - user.vip == 1 - ? 'vip' - : 'year_vip'), - width: 36.sp, - ), - ), - ], - ), - ], - )), - GestureDetector( - onTap: () async { - if (!chatImIdList.contains( - user.userId.toString())) { - await createCustomMsg(user.userId.toString(), - recommendCircleFriendData['user']['imId']); - } - - pushChatPage(user.userId.toString(), - recommendCircleFriendData['user']['imId'], - user.nickname!); - }, - child: Container( - height: 25.sp, - padding: EdgeInsets.only(left: 6.sp, right: 6.sp), - decoration: BoxDecoration( - gradient: AppColor.mainVerLinearGradient, - borderRadius: BorderRadius.circular(12.5.sp)), - alignment: Alignment.center, - child: Text( - '聊一聊', - style: - TextStyle(color: Colors.white, fontSize: 15.sp), - ), - ), - ) - ], - ), - ), - ), - if (info.containsKey('desc')) - Container( - margin: EdgeInsets.only(top: 10.sp, right: 16.sp), - child: Row( - children: [ - Container( - margin: EdgeInsets.only(right: 5.sp), - width: 3, - height: 3, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(1.5), - color: Color(0xFF00FFF4)), - ), - Expanded( - child: Container( - child: Text( - info['desc'], - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - fontWeight: FontWeight.w500, - ), - overflow: TextOverflow.ellipsis, - maxLines: 1, - ), - ), - ) - ], - ), - ), - if (info.containsKey('city')) - info['city'] - .toString() - .isNotEmpty - ? Container( - margin: EdgeInsets.only(top: 10.sp), - child: Row( - children: [ - Container( - margin: EdgeInsets.only(right: 5.sp), - width: 3.sp, - height: 3.sp, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(1.5.sp), - color: Color(0xFF00FFF4)), - ), - Expanded(child: Text( - info['city'], - overflow: TextOverflow.ellipsis, - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - fontWeight: FontWeight.w500), - )) - ], - ), - ) - : Container(), - if (info.containsKey('both_interests')) - Container( - margin: EdgeInsets.only(top: 10.sp, right: 16.sp), - child: Row( - children: [ - Container( - margin: EdgeInsets.only(right: 5.sp), - width: 3, - height: 3, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(1.5), - color: Color(0xFF00FFF4)), - ), - Expanded( - child: Container( - child: Text( - info['both_interests'], - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - fontWeight: FontWeight.w500, - ), - overflow: TextOverflow.ellipsis, - maxLines: 1, - ), - ), - ) - ], - ), - ), - - Container( - margin: EdgeInsets.only(top: 10.sp, bottom: 10.sp), - alignment: Alignment.centerLeft, - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.only(right: 5.sp, top: 10.sp), - width: 3, - height: 3, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(1.5), - color: Color(0xFF00FFF4)), - ), - Expanded( - child: Text( - '交友宣言:' + - recommendCircleFriendData['user']['signature'], - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - fontWeight: FontWeight.w500), - maxLines: 2, - overflow: TextOverflow.ellipsis, - )), - ])), - Image.asset( - getCircleImage('line'), - width: Get.width, - fit: BoxFit.fill, - ), - - if (circleList.isNotEmpty) - Container( - height: 72.sp, - margin: EdgeInsets.only(top: 10.sp, bottom: 10.sp), - width: Get.width, - child: ListView.builder(itemBuilder: (context, index) { - return circleInfoItem(circleList[index], index); - }, - itemCount: circleList.length, - scrollDirection: Axis.horizontal,), - ) - ], - ), - ), - ])); - } catch (e) { - loadRecommendCircleFriendData(); - return Container(); - } - } - - circleInfoItem(var bean, int index) { - return GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.Signal_circle_list, - arguments: bean['id'].toString()); - }, - child: Container( - margin: EdgeInsets.only(right: 10.sp), - padding: EdgeInsets.only(left: 12.sp, right: 5.sp), - height: 72.sp, - width: 145.sp, - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(8.sp), - border: GradientBoxBorder( - gradient: - AppColor.mainVerLinearGradient, - width: 1.sp, - ), - ), - child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - width: 42.sp, - height: 42.sp, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8.0), - gradient: const LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [ - Color(0xFF71F3F2), - Color(0xFFF558FF), - ], - stops: [0.0365, 0.9427], - ), - ), - padding: EdgeInsets.all(1.sp), - child: ClipRRect( - borderRadius: BorderRadius.circular(8.0), - child: CachedNetworkImage( - imageUrl: bean['image'], - width: 40.sp, - height: 40.sp, - fit: BoxFit.cover), - ), - ), - Expanded( - child: Container( - padding: EdgeInsets.only(left: 8.sp,), - // alignment: Alignment., - height: 72.sp, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - bean['title'], - style: TextStyle( - color: Colors.white, - fontSize: 12.sp, - fontWeight: FontWeight.w600), - ), - SizedBox( - height: 4.sp, - ), - Text( - // "view_total" -> 21 - '${convertToTenThousand(bean['viewTotal'])}人看过', - textAlign: TextAlign.left, - style: TextStyle( - color: const Color(0xff03FEFB), - fontSize: 12.sp, - ), - ), - ], - ), - )), - ], - ), - ), - ); - } - - void loadRecommendCircleFriendData() async { - var data = await DioManager.instance.get( - url: Api.chatRecommendFriend, - ); - - if (data['code'] == 200) { - List dataList = data['data']; - if (dataList.isNotEmpty) { - recommendCircleFriendData = data['data'][0]; - setState(() {}); - } - } else { - if ((data['code'] == 21201 || data['code'] == 21202) && - recommendCircleFriendData.isNotEmpty) { - showOKToast(data['msg']); - showVipDialog(); - } - } - } -} diff --git a/circle_app/lib/app/msg/TIMUIKitConversation/tim_uikit_conversation_draft_text.dart b/circle_app/lib/app/msg/TIMUIKitConversation/tim_uikit_conversation_draft_text.dart deleted file mode 100644 index ff1dc94..0000000 --- a/circle_app/lib/app/msg/TIMUIKitConversation/tim_uikit_conversation_draft_text.dart +++ /dev/null @@ -1,46 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_statelesswidget.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart'; - -import 'package:tencent_im_base/tencent_im_base.dart'; - -class TIMUIKitDraftText extends TIMUIKitStatelessWidget { - final BuildContext context; - final String draftText; - final double fontSize; - - TIMUIKitDraftText({ - Key? key, - this.fontSize = 14.0, - required this.context, - required this.draftText, - }) : super(key: key); - - String _getDraftShowText() { - final draftShowText = TIM_t("草稿"); - - return '[$draftShowText] '; - } - - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - final TUITheme theme = value.theme; - return Row(children: [ - Text(_getDraftShowText(), - style: TextStyle( - color: theme.conversationItemDraftTextColor, - )), - Expanded( - child: Text( - draftText, - softWrap: true, - overflow: TextOverflow.ellipsis, - maxLines: 1, - style: TextStyle( - height: 1.5, - color: theme.conversationItemLastMessageTextColor, - fontSize: fontSize), - )), - ]); - } -} diff --git a/circle_app/lib/app/msg/TIMUIKitConversation/tim_uikit_conversation_item.dart b/circle_app/lib/app/msg/TIMUIKitConversation/tim_uikit_conversation_item.dart deleted file mode 100644 index 53df925..0000000 --- a/circle_app/lib/app/msg/TIMUIKitConversation/tim_uikit_conversation_item.dart +++ /dev/null @@ -1,286 +0,0 @@ -// ignore_for_file: empty_catches - -import 'dart:convert'; - -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:circle_app/app/msg/TIMUIKitConversation/tim_uikit_conversation_last_msg.dart'; -import 'package:circle_app/common/Widgets/tag_widget.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:tencent_cloud_chat_uikit/ui/utils/screen_utils.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitConversation/tim_uikit_conversation_item.dart'; -import 'package:tencent_im_base/tencent_im_base.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_statelesswidget.dart'; - -import 'package:tencent_cloud_chat_uikit/ui/utils/time_ago.dart'; - -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitConversation/tim_uikit_conversation_draft_text.dart'; -import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitConversation/tim_uikit_conversation_last_msg.dart'; -import 'package:tencent_cloud_chat_uikit/ui/widgets/avatar.dart'; -import 'package:tencent_cloud_chat_uikit/ui/widgets/unread_message.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart'; - -class TIMConversationItem extends TIMUIKitStatelessWidget { - final String faceUrl; - final String nickName; - final V2TimMessage? lastMsg; - final int unreadCount; - final int mark; - final bool isPined; - final List groupAtInfoList; - final String? draftText; - final int? draftTimestamp; - final bool isDisturb; - final LastMessageBuilder? lastMessageBuilder; - final V2TimUserStatus? onlineStatus; - final int? convType; - final bool isCurrent; - final bool isOfficial; - final bool isSameCity; - final V2TimUserFullInfo? userInfo; - - /// Control if shows the identifier that the conversation has a draft text, inputted in previous. - /// Also, you'd better specifying the `draftText` field for `TIMUIKitChat`, from the `draftText` in `V2TimConversation`, - /// to meet the identifier shows here. - final bool isShowDraft; - - TIMConversationItem({ - Key? key, - required this.isShowDraft, - required this.faceUrl, - required this.mark, - required this.isSameCity, - required this.nickName, - required this.lastMsg, - required this.userInfo, - this.onlineStatus, - required this.isPined, - this.isCurrent = false, - required this.isOfficial, - required this.unreadCount, - required this.groupAtInfoList, - required this.isDisturb, - this.draftText, - this.draftTimestamp, - this.lastMessageBuilder, - this.convType, - }) : super(key: key); - - Widget _getShowMsgWidget(BuildContext context) { - final isDesktopScreen = - TUIKitScreenUtils.getFormFactor(context) == DeviceType.Desktop; - if (isShowDraft && draftText != null && draftText != "") { - return TIMUIKitDraftText( - context: context, - draftText: draftText ?? "", - fontSize: isDesktopScreen ? 12 : 14, - ); - } else if (lastMsg != null) { - if (lastMessageBuilder != null && - lastMessageBuilder!(lastMsg, groupAtInfoList) != null) { - return lastMessageBuilder!(lastMsg, groupAtInfoList)!; - } - return Row( - - children: [ - isSameCity - ? const Text('[同城]', - style: TextStyle( - color: Color(0xFF04FDFB), - fontSize: 14 - )) - : Container(), - Expanded( - child: Container( - alignment: Alignment.centerLeft, - padding: EdgeInsets.only(top: 3.sp), - child: TIMLastMsg( - fontSize: isDesktopScreen ? 12 : 14, - groupAtInfoList: groupAtInfoList, - lastMsg: lastMsg, - context: context, - ), - )) - ]); - return TIMLastMsg( - fontSize: isDesktopScreen ? 12 : 14, - groupAtInfoList: groupAtInfoList, - lastMsg: lastMsg, - context: context, - ); - } - - return Container( - height: 0, - ); - } - - bool isHaveSecondLine() { - return (isShowDraft && draftText != null && draftText != "") || - (lastMsg != null); - } - - Widget _getTimeStringForChatWidget(BuildContext context, TUITheme theme) { - try { - if (lastMsg != null) { - return Text(TimeAgo().getTimeForMessage(lastMsg!.timestamp as int), - style: TextStyle( - fontSize: 11, - color: theme.conversationItemTitmeTextColor, - )); - } - } catch (err) {} - - return Container(); - } - - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - int vipType = 0; - if (userInfo != null) { - if (userInfo!.customInfo!.containsKey('Vip')) { - if (userInfo!.customInfo!['Vip'] != null) { - String infoStr = userInfo!.customInfo!['Vip']!; - if (infoStr.isNotEmpty) { - Map infoMap = jsonDecode(infoStr); - if (infoMap.containsKey('type')) { - vipType = infoMap['type']; - } - } - } - } - } - final TUITheme theme = value.theme; - final isDesktopScreen = - TUIKitScreenUtils.getFormFactor(context) == DeviceType.Desktop; - return Container( - padding: const EdgeInsets.only(top: 6, bottom: 6, left: 16, right: 16), - decoration: BoxDecoration( - // color: Colors.transparent, - // gl.startPoint = CGPointMake(0.48, 0.48); - // gl.endPoint = CGPointMake(0.52, 0.52); - // Alignment(0.52, 0.52) - gradient: LinearGradient( - colors: isPined - ? [const Color(0x0F4B3E5E), const Color(0xaF334141)] - : [Colors.transparent, Colors.transparent])), - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - // color: Colors.red, - padding: const EdgeInsets.only(top: 0, bottom: 2, right: 0), - child: SizedBox( - width: isDesktopScreen ? 40 : 44, - height: isDesktopScreen ? 40 : 44, - child: Stack( - fit: StackFit.expand, - clipBehavior: Clip.none, - children: [ - ClipOval( - child: CachedNetworkImage( - imageUrl: faceUrl==""?"https://qiniuyun.leyuan666.com/quanzi/avatar/default.png":faceUrl, - fit: BoxFit.cover, - width: isDesktopScreen ? 40 : 44, - height: isDesktopScreen ? 40 : 44, - )), - if (unreadCount != 0) - Positioned( - top: isDisturb ? -2.5 : -4.5, - right: isDisturb ? -2.5 : -4.5, - child: UnconstrainedBox( - child: UnreadMessage( - width: isDisturb ? 10 : 18, - height: isDisturb ? 10 : 18, - unreadCount: isDisturb ? 0 : unreadCount), - ), - ), - if (userInfo != null) - (userInfo!.role ?? 0) > 0 && !(userInfo!.userID ?? '').contains('qz_prod_11_') - ? Positioned( - bottom: 0, - right: 0, - child: Image.asset( - getMsgImage(getGenderContent(userInfo!.role!)), - height: 13.sp, - ) - ) : Container() - ], - ), - ), - ), - Expanded( - child: Container( - height: 60, - margin: EdgeInsets.only(left: isDesktopScreen ? 10 : 12), - // padding: const EdgeInsets.only(top: 0, bottom: 0), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Row( - children: [ - Text( - nickName, - softWrap: true, - textAlign: TextAlign.left, - overflow: TextOverflow.ellipsis, - maxLines: 1, - style: TextStyle( - height: 1, - color: Color(0xFFF7FAFA), - fontSize: 18.sp, - fontWeight: FontWeight.w400, - ), - ), - if (isOfficial) Container( - margin: EdgeInsets.only(left: 5.sp,bottom: 5.sp), - height: 18.sp, - width: 32.sp, - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(9.sp), - gradient: LinearGradient( - colors: [Color(0xFF08FAFB),Color(0xFFE243FE)] - ) - ), - child: Text('官方',style: TextStyle(color: Color(0xFFF7FAFA),fontSize: 11.sp,fontWeight: FontWeight.w600),),), - // if (vipType > 0) - Container( - margin: EdgeInsets.only(left: 5.sp,bottom: isOfficial ? 5.sp : 0.sp), - child: UserTagWidget(mark)), - - Expanded( - child:Container()), - _getTimeStringForChatWidget(context, theme), - ], - ), - if (isHaveSecondLine()) - const SizedBox( - height: 6, - ), - Row( - children: [ - Expanded(child: _getShowMsgWidget(context)), - if (isDisturb) - SizedBox( - width: 18, - height: 18, - child: Icon( - Icons.notifications_off, - color: theme.conversationItemNoNotificationIconColor, - size: isDesktopScreen ? 14 : 16.0, - ), - ) - ], - ), - ], - ), - )) - ], - ), - ); - } - - -} diff --git a/circle_app/lib/app/msg/TIMUIKitConversation/tim_uikit_conversation_last_msg.dart b/circle_app/lib/app/msg/TIMUIKitConversation/tim_uikit_conversation_last_msg.dart deleted file mode 100644 index 85019fa..0000000 --- a/circle_app/lib/app/msg/TIMUIKitConversation/tim_uikit_conversation_last_msg.dart +++ /dev/null @@ -1,157 +0,0 @@ -// ignore_for_file: unrelated_type_equality_checks - -import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_state.dart'; - -import 'package:tencent_cloud_chat_uikit/ui/utils/message.dart'; - -import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart'; -import 'package:tencent_im_base/tencent_im_base.dart'; - -class TIMLastMsg extends StatefulWidget { - final V2TimMessage? lastMsg; - final List groupAtInfoList; - final BuildContext context; - final double fontSize; - - const TIMLastMsg( - {Key? key, - this.lastMsg, - required this.groupAtInfoList, - required this.context, - this.fontSize = 14.0}) - : super(key: key); - - @override - State createState() => _TIMLastMsgState(); -} - -class _TIMLastMsgState extends TIMUIKitState { - String groupTipsAbstractText = ""; - - @override - void initState() { - super.initState(); - _getMsgElem(); - } - - @override - void didUpdateWidget(covariant TIMLastMsg oldWidget) { - super.didUpdateWidget(oldWidget); - if ((oldWidget.lastMsg?.msgID != widget.lastMsg?.msgID) || - (oldWidget.lastMsg?.id != widget.lastMsg?.id)) { - _getMsgElem(); - } - } - - void _getMsgElem() async { - final isRevokedMessage = widget.lastMsg!.status == 6; - if (isRevokedMessage) { - final isSelf = widget.lastMsg!.isSelf ?? true; - final option1 = isSelf - ? TIM_t("您") - : widget.lastMsg!.nickName ?? widget.lastMsg?.sender; - if (mounted) { - setState(() { - groupTipsAbstractText = TIM_t_para( - "{{option1}}撤回了一条消息", "$option1撤回了一条消息")(option1: option1); - }); - } - } else { - final newText = await _getLastMsgShowText(widget.lastMsg, widget.context); - if (mounted) { - setState(() { - groupTipsAbstractText = newText; - }); - } - } - } - - Future _getLastMsgShowText( - V2TimMessage? message, BuildContext context) async { - final msgType = message!.elemType; - switch (msgType) { - case MessageElemType.V2TIM_ELEM_TYPE_CUSTOM: - { - if (message.customElem?.desc?.isNotEmpty ?? false) { - return message.customElem!.desc!; - } - } - return "[自定义]"; - case MessageElemType.V2TIM_ELEM_TYPE_SOUND: - return "[语音]"; - case MessageElemType.V2TIM_ELEM_TYPE_TEXT: - return (widget.lastMsg?.textElem?.text)?.trim() ?? ""; - case MessageElemType.V2TIM_ELEM_TYPE_FACE: - return "[表情]"; - case MessageElemType.V2TIM_ELEM_TYPE_FILE: - final option1 = widget.lastMsg!.fileElem!.fileName; - return TIM_t_para("[文件] {{option1}}", "[文件] $option1")( - option1: option1); - case MessageElemType.V2TIM_ELEM_TYPE_GROUP_TIPS: - return await MessageUtils.groupTipsMessageAbstract( - widget.lastMsg!.groupTipsElem!, []); - case MessageElemType.V2TIM_ELEM_TYPE_IMAGE: - return "[图片]"; - case MessageElemType.V2TIM_ELEM_TYPE_VIDEO: - return "[视频]"; - case MessageElemType.V2TIM_ELEM_TYPE_LOCATION: - return "[位置]"; - case MessageElemType.V2TIM_ELEM_TYPE_MERGER: - return "[聊天记录]"; - default: - return "未知消息"; - } - } - - Icon? _getIconByMsgStatus(BuildContext context) { - final msgStatus = widget.lastMsg!.status; - final theme = Provider.of(context).theme; - if (msgStatus == MessageStatus.V2TIM_MSG_STATUS_SEND_FAIL) { - return Icon(Icons.error, color: theme.cautionColor, size: 16); - } - if (msgStatus == MessageStatus.V2TIM_MSG_STATUS_SENDING) { - return Icon(Icons.arrow_back, color: theme.weakTextColor, size: 16); - } - return null; - } - - String _getAtMessage() { - String msg = ""; - for (var item in widget.groupAtInfoList) { - if (item!.atType == 1) { - msg = TIM_t("[有人@我] "); - } else { - msg = TIM_t("[@所有人] "); - } - } - return msg; - } - - @override - Widget tuiBuild(BuildContext context, TUIKitBuildValue value) { - final TUITheme theme = value.theme; - final icon = _getIconByMsgStatus(context); - return Row(children: [ - if (icon != null) - Container( - margin: const EdgeInsets.only(right: 2), - child: icon, - ), - if (widget.groupAtInfoList.isNotEmpty) - Text(_getAtMessage(), - style: TextStyle( - color: theme.cautionColor, fontSize: widget.fontSize)), - Expanded( - child: Text( - groupTipsAbstractText, - softWrap: true, - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: TextStyle( - height: 1, color: theme.weakTextColor, fontSize: widget.fontSize), - )), - ]); - } -} diff --git a/circle_app/lib/app/msg/binding.dart b/circle_app/lib/app/msg/binding.dart deleted file mode 100644 index 1f69b4a..0000000 --- a/circle_app/lib/app/msg/binding.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:get/get.dart'; - -import 'logic.dart'; - -class MsgBinding extends Bindings { - @override - void dependencies() { - Get.lazyPut(() => MsgLogic()); - } -} diff --git a/circle_app/lib/app/msg/logic.dart b/circle_app/lib/app/msg/logic.dart deleted file mode 100644 index 68467e9..0000000 --- a/circle_app/lib/app/msg/logic.dart +++ /dev/null @@ -1,237 +0,0 @@ -import 'package:circle_app/app/likelist/logic.dart'; -import 'package:circle_app/network/api.dart'; -import 'package:circle_app/network/dio_manager.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:pull_to_refresh/pull_to_refresh.dart'; -import 'package:shared_preferences/shared_preferences.dart'; -import '../../common/Widgets/base_tip_widget.dart'; -import '../../util/SharedPreferencesHelper.dart'; -import '../circle/logic.dart'; -import '../minefragment/logic.dart'; -import 'state.dart'; - -class MsgLogic extends GetxController { - final MsgState state = MsgState(); - List lists = []; - - ScrollController listScrollController = ScrollController(); - List chatList = []; - - int total = 0; - - bool isStart = false; - String tip = ''; - - int recent_visit_count_new = 0; - - @override - void onInit() { - // TODO: implement onInit - super.onInit(); - loadMyInfoData(); - loadChatData(); - loadLikeData(); - loadStatusData(); - getMode(); - } - - loadData() { - loadMyInfoData(); - loadChatData(); - loadLikeData(); - loadStatusData(); - } - - loadLikeData() async { - var data = - await DioManager.instance.get(url: Api.fansList, params: { - 'page':1, - 'page_size':3 - - }); - var bean = BaseResponse.fromJson(data, (data) => UserList.fromJson(data)); - if (bean.isSuccess()) { - lists.addAll(bean.data.lists); - } - update(); - } - - getMode() async { - var data = await DioManager.instance.get(url: Api.getUserMine); - var bean = BaseResponse.fromJson( - data, (data) => MineResponseBean.fromJson(data)); - if (bean.isSuccess()) { - int recent_visit_count = bean.data.recentVisitCount ?? 0; - SharedPreferences sharedPreferences = - await SharedPreferences.getInstance(); - int recentVisitCount = sharedPreferences.getInt(SharedPreferencesHelper.RECENTVISITCOUNT)??0; - - recent_visit_count_new = recent_visit_count - recentVisitCount; - getVisitorMsgData(); - - } - } - - updateVisitCount() async { - if (recent_visit_count_new > 0) { - SharedPreferences sharedPreferences = - await SharedPreferences.getInstance(); - sharedPreferences.setInt(SharedPreferencesHelper.RECENTVISITCOUNT, recent_visit_count_new); - } - - getMode(); - update(); - } - - void loadChatData() async { - var data = - await DioManager.instance.post(url: Api.recommendQuickChatUser, params: { - 'page':1, - 'pageSize':8 - }); - if (data['code'] == 200) { - total = data['data']['total']; - chatList = data['data']['lists']; - } else if (data['code'] == 404) { - showOKToast('网络不流畅哦,请检查网络情况'); - } - - // vicinityList = bean.data.lists; - update(); - } - - - getVisitorMsgData() async { - var data = - await DioManager.instance.get(url: Api.getVisitorMsg,); - if (data['code'] == 200) { - tip = data['data']['lastMsg']; - recent_visit_count_new = data['data']['unreadCount'] ?? 0; - } - update(); - } - - Future queryQuickStart() async { - var data = - await DioManager.getInstance().get(url: Api.queryQuickStart); - if (data["code"] == 200) { - if (data["data"] == 2 || data["data"] == 0) { - var data = await DioManager.getInstance() - .get(url: Api.startQuick); - if (data["code"] == 200) { - showOKToast("已冲到第一"); - isStart = true; - loadChatData(); - return true; - } else if (data["code"] == 31201) { - showRechargeScreenDialog(); - } - } else if (data["data"] == 1) { - - showOKToast("速聊开启中"); - return false; - } - } - return false; - } - - stopQueryQuick()async{ - var data = - await DioManager.getInstance().get(url: Api.stopQuick); - if (data["code"] == 200) { - showOKToast('操作成功'); - isStart = false; - loadChatData(); - } - - } - - Future callOrhers() async { - var data = await DioManager.getInstance().post(url: Api.callOthers); - - if (data["code"] == 200) { - showOKToast("已成功召唤三十人,请耐心等待TA的回复哈~"); - return true; - } else if (data["code"] == 31201) { - showRechargeScreenDialog(); - } else{ - showOKToast(data["msg"]); - } - return false; - } - - - showTipPop() { - Get.bottomSheet( - CupertinoActionSheet( - title: Text( - '上速聊推荐可以让更多人看到你', - style: TextStyle(fontSize: 22.sp), - ), //标题 - //提示内容 - actions: [ - //操作按钮集合 - CupertinoActionSheetAction( - onPressed: () { - Get.back(); - queryQuickStart(); - }, - child: const Text('冲到第一'), - ), - CupertinoActionSheetAction( - onPressed: () { - callOrhers(); - Get.back(); - - }, - child: const Text('一键呼唤三十位您想认识的人'), - ), - CupertinoActionSheetAction( - onPressed: () { - Get.back(); - stopQueryQuick(); - }, - child: const Text('不显示在速聊列表'), - ), - ], - cancelButton: CupertinoActionSheetAction( - //取消按钮 - onPressed: () { - Get.back(); - }, - child: const Text('取消'), - ), - ), - isScrollControlled: true); - } - - void loadStatusData() async { - var data = - await DioManager.getInstance().get(url: Api.queryQuickStart); - if (data["code"] == 200) { - if (data["data"] == 0 || data["data"] == 2) { - isStart = false; - } else { - isStart = true; - } - } - update(); - } - - void loadMyInfoData() async { - var data = await DioManager.instance.get(url: Api.getUserMine); - var bean = BaseResponse.fromJson( - data, (data) => MineResponseBean.fromJson(data)); - if (bean.isSuccess()) { - var userInfoBean = bean.data.user; - SharedPreferencesHelper.getInstance().then((sharedPreferences) { - sharedPreferences.setInt(SharedPreferencesHelper.VIP, userInfoBean.vip); - sharedPreferences.setInt( - SharedPreferencesHelper.USERID, userInfoBean!.id); - }); - } - } -} diff --git a/circle_app/lib/app/msg/recommend_circle_friend_item.dart b/circle_app/lib/app/msg/recommend_circle_friend_item.dart deleted file mode 100644 index 560bf16..0000000 --- a/circle_app/lib/app/msg/recommend_circle_friend_item.dart +++ /dev/null @@ -1,587 +0,0 @@ -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:gradient_borders/box_borders/gradient_box_border.dart'; -import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; - -import '../../common/colors/app_color.dart'; -import '../../router/app_routers.dart'; -import '../../util/util.dart'; -import '../circle/widgets/discover.dart'; - -class RecommendCircleFriendItem extends StatefulWidget { - RecommendCircleFriendItem(this.isShowTopLine,this.padding,{super.key,required this.recommendCircleFriendData,required this.getDataCallBack,}); - var recommendCircleFriendData; - Function getDataCallBack; - bool isShowTopLine; - double padding; - @override - _RecommendCircleFriendItemState createState() => - _RecommendCircleFriendItemState(); -} - -class _RecommendCircleFriendItemState extends State { - // TODO: add state variables and methods - var recommendCircleFriendData; - - @override - Widget build(BuildContext context) { - recommendCircleFriendData = widget.recommendCircleFriendData; - // TODO: add widget build method - ErrorWidget.builder = (FlutterErrorDetails errorDetails) => Container(); - - return recommendCircleFriendData == null ? Container() : recommendCircleFriendWidget(); - } - - - recommendCircleFriendWidget() { - try { - var info = {}; - - var user = Users.fromJson(recommendCircleFriendData['user']); - - // 对方喜欢了你100 - // ·你们有共同喜欢的圈友90 - // ·你喜欢的圈友也喜欢TA80 - // ·你们都在深圳留下过足迹70 - // ·你们有2个共同的圈子:圈子名称、圈子名称60 - // ·我刚来到这里哦55 - // ·可能是你想认识的人50 - // ·很多圈友都喜欢TA40 - // ·TA是乐园优秀圈主哦~30 - - info = checkCardReturnData(recommendCircleFriendData); - - List circleList = recommendCircleFriendData['interests'] ?? []; - - return Container( - padding: EdgeInsets.only(left: widget.padding, right: widget.padding), - child: Column(children: [ - if (widget.isShowTopLine) - Container( - margin: EdgeInsets.only(top: 20.sp), - child: Row( - children: [ - Expanded( - child: Container( - height: 2.sp, - color: Colors.white.withOpacity(0.5), - )), - Container( - width: 4.sp, - height: 4.sp, - margin: EdgeInsets.only(left: 15.sp, right: 15.sp), - decoration: BoxDecoration( - shape: BoxShape.circle, - color: Colors.white.withOpacity(0.5)), - ), - Expanded( - child: Container( - height: 2.sp, - color: Colors.white.withOpacity(0.5), - )), - ], - ), - ), - Container( - margin: EdgeInsets.only(top: widget.isShowTopLine ? 16.sp : 0), - child: Row( - children: [ - Image.asset( - getMsgImage('heart_icon'), - width: 18.sp, - ), - SizedBox( - width: 4.sp, - ), - ShaderMask( - shaderCallback: (Rect bounds) { - return const LinearGradient( - begin: Alignment(0.0, -1.0), - end: Alignment.bottomCenter, - colors: [Color(0xff71F3F2), Color(0xffF657FF)], - ).createShader(Offset.zero & bounds.size); - }, - child: Text( - '圈友推荐', - style: TextStyle( - fontSize: 18.sp, - fontWeight: FontWeight.w600, - color: Colors.white, - shadows: [ - Shadow( - color: Color(0xffF657FF), - offset: Offset(0.0, -1)) - ]), - ), - ), - SizedBox( - width: 4.sp, - ), - Image.asset( - getMsgImage('heart_icon'), - width: 18.sp, - ), - Expanded(child: Container()), - InkWell( - onTap: () { - widget.getDataCallBack(); - }, - child: Container( - child: Row( - children: [ - Icon( - Icons.refresh_sharp, - size: 18.sp, - color: AppColor.mainColor, - ), - SizedBox( - width: 4.sp, - ), - Text( - '换一位', - style: TextStyle( - color: AppColor.mainColor, fontSize: 15.sp), - ) - ], - ), - ), - ) - ], - ), - ), - Container( - margin: EdgeInsets.only(top: 16.sp), - width: Get.width, - // constraints: BoxConstraints(maxHeight: 230.sp), - decoration: BoxDecoration( - gradient: LinearGradient( - colors: [Color(0xFF4C3E5F), Color(0xFF324140)]), - borderRadius: BorderRadius.circular(8.sp), - // border: GradientBoxBorder( - // gradient: AppColor.mainVerLinearGradient, - // width: 0.sp, - // ), - ), - padding: EdgeInsets.only(left: 12.sp, right: 12.sp, top: 10.sp), - child: Column( - children: [ - GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.UserInfoActivity, - arguments: user.userId.toString()); - }, - child: Container( - child: Row( - children: [ - ClipOval( - child: Image.network( - recommendCircleFriendData['user']['avatar'], - width: 50.sp, - height: 50.sp, - fit: BoxFit.cover, - ), - ), - SizedBox( - width: 6.sp, - ), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Text( - user.nickname ?? '', - style: TextStyle( - fontSize: 16.sp, - color: Color(0XFFF7FAFA), - fontWeight: FontWeight.bold), - ), - SizedBox( - width: 8.sp, - ), - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - ShaderMask( - shaderCallback: (Rect bounds) { - return const LinearGradient( - begin: Alignment.centerRight, - end: Alignment.centerLeft, - colors: [ - Color(0xff71F3F2), - Color(0xffF657FF) - ], - ).createShader( - Offset.zero & bounds.size); - }, - child: Text( - '匹配度' + - (recommendCircleFriendData[ - 'recommend_score'] - .toString() ?? - '') + - '%', - style: TextStyle( - fontSize: 14.sp, - fontWeight: FontWeight.w600, - color: Colors.white), - ), - ), - ], - ) - ], - ), - SizedBox( - height: 4.sp, - ), - Row( - children: [ - Container( - alignment: Alignment.center, - height: 18.sp, - padding: EdgeInsets.only( - left: 6.sp, right: 6.sp), - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(9.sp), - gradient: const LinearGradient( - begin: Alignment(0.25, 0.5), - end: Alignment(0.75, 0.5), - colors: [ - Color(0xff8DFFF8), - Color(0xffB5D3FF) - ])), - child: Text( - getAgeCOntent( - user!.gender ?? 0, - user!.age ?? 0, - user!.role ?? 0, - user!.orientation ?? 0), - style: TextStyle( - color: Colors.black, - fontSize: 12.sp, - ), - ), - ), - if (user.vip! > 0) - Container( - margin: EdgeInsets.only( - left: 4.sp, - ), - child: Image.asset( - getCircleImage( - user.vip == 1 ? 'vip' : 'year_vip'), - width: 36.sp, - ), - ), - ], - ), - ], - )), - GestureDetector( - onTap: () async { - V2TimValueCallback - getConversationtRes = await TencentImSDKPlugin - .v2TIMManager - .getConversationManager() - .getConversation( - conversationID: - 'c2c-${recommendCircleFriendData['user']['imId']}'); //会话唯一 ID,如果是 C2C 单聊,组成方式为 c2c_userID,如果是群聊,组成方式为 group_groupID - if (getConversationtRes.code == 0) { - if (getConversationtRes.data?.lastMessage == null) { - await createCustomMsg(user.userId.toString(), - recommendCircleFriendData['user']['imId']); - } - } else { - await createCustomMsg(user.userId.toString(), - recommendCircleFriendData['user']['imId']); - } - // if (!chatImIdList.contains(user.userId.toString())) { - // await createCustomMsg(user.userId.toString(), recommendCircleFriendData['user']['imId']); - // } - - pushChatPage( - user.userId.toString(), - recommendCircleFriendData['user']['imId'], - user.nickname!); - }, - child: Container( - height: 25.sp, - padding: EdgeInsets.only(left: 6.sp, right: 6.sp), - decoration: BoxDecoration( - gradient: AppColor.mainVerLinearGradient, - borderRadius: BorderRadius.circular(12.5.sp)), - alignment: Alignment.center, - child: Text( - '聊一聊', - style: TextStyle( - color: Colors.white, fontSize: 15.sp), - ), - ), - ) - ], - ), - ), - ), - if (info.containsKey('desc')) - Container( - margin: EdgeInsets.only(top: 10.sp, right: 16.sp), - child: Row( - children: [ - Container( - margin: EdgeInsets.only(right: 5.sp), - width: 3, - height: 3, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(1.5), - color: Color(0xFF00FFF4)), - ), - Expanded( - child: Container( - child: Text( - info['desc'], - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - fontWeight: FontWeight.w500, - ), - overflow: TextOverflow.ellipsis, - maxLines: 1, - ), - ), - ) - ], - ), - ), - if (info.containsKey('city')) - info['city'].toString().isNotEmpty - ? Container( - margin: EdgeInsets.only(top: 10.sp), - child: Row( - children: [ - Container( - margin: EdgeInsets.only(right: 5.sp), - width: 3.sp, - height: 3.sp, - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(1.5.sp), - color: Color(0xFF00FFF4)), - ), - Expanded( - child: Text( - info['city'], - overflow: TextOverflow.ellipsis, - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - fontWeight: FontWeight.w500), - )) - ], - ), - ) - : Container(), - if (info.containsKey('both_interests')) - Container( - margin: EdgeInsets.only(top: 10.sp, right: 16.sp), - child: Row( - children: [ - Container( - margin: EdgeInsets.only(right: 5.sp), - width: 3, - height: 3, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(1.5), - color: Color(0xFF00FFF4)), - ), - Expanded( - child: Container( - child: Text( - info['both_interests'], - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - fontWeight: FontWeight.w500, - ), - overflow: TextOverflow.ellipsis, - maxLines: 1, - ), - ), - ) - ], - ), - ), - Container( - margin: EdgeInsets.only(top: 10.sp, bottom: 10.sp), - alignment: Alignment.centerLeft, - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.only(right: 5.sp, top: 10.sp), - width: 3, - height: 3, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(1.5), - color: Color(0xFF00FFF4)), - ), - Expanded( - child: Text( - '交友宣言:' + - recommendCircleFriendData['user'] - ['signature'], - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - fontWeight: FontWeight.w500), - maxLines: 2, - overflow: TextOverflow.ellipsis, - )), - ])), - Image.asset( - getCircleImage('line'), - width: Get.width, - fit: BoxFit.fill, - ), - if (circleList.isNotEmpty) - Container( - height: 72.sp, - margin: EdgeInsets.only(top: 10.sp, bottom: 10.sp), - width: Get.width, - child: ListView.builder( - itemBuilder: (context, index) { - return CircleInfoItem( - bean: circleList[index], index: index); - }, - itemCount: circleList.length, - scrollDirection: Axis.horizontal, - ), - ) - ], - ), - ), - ])); - } catch (e) { - // widget.getDataCallBack(); - return Container(); - } - } -} - -class CircleInfoItem extends StatefulWidget { - var bean; - int index; - - CircleInfoItem({super.key, required this.bean, required this.index}); - @override - _CircleInfoItemState createState() => _CircleInfoItemState(); -} - -class _CircleInfoItemState extends State { - // TODO: add state variables and methods - - var bean; - int index = 0; - - @override - void initState() { - // TODO: implement initState - super.initState(); - bean = widget.bean; - index = widget.index; - } - - @override - Widget build(BuildContext context) { - // TODO: add widget build method - return circleInfoItem(); - } - - circleInfoItem() { - return GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.Signal_circle_list, - arguments: bean['id'].toString()); - }, - child: Container( - margin: EdgeInsets.only(right: 10.sp), - padding: EdgeInsets.only(left: 12.sp, right: 5.sp), - height: 72.sp, - width: 145.sp, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8.sp), - border: GradientBoxBorder( - gradient: AppColor.mainVerLinearGradient, - width: 1.sp, - ), - ), - child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - width: 42.sp, - height: 42.sp, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8.0), - gradient: const LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [ - Color(0xFF71F3F2), - Color(0xFFF558FF), - ], - stops: [0.0365, 0.9427], - ), - ), - padding: EdgeInsets.all(1.sp), - child: ClipRRect( - borderRadius: BorderRadius.circular(8.0), - child: CachedNetworkImage( - imageUrl: bean['image'], - width: 40.sp, - height: 40.sp, - fit: BoxFit.cover), - ), - ), - Expanded( - child: Container( - padding: EdgeInsets.only( - left: 8.sp, - ), - // alignment: Alignment., - height: 72.sp, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - bean['title'], - style: TextStyle( - color: Colors.white, - fontSize: 12.sp, - fontWeight: FontWeight.w600), - ), - SizedBox( - height: 4.sp, - ), - Text( - // "view_total" -> 21 - '${convertToTenThousand(bean['viewTotal'])}人看过', - textAlign: TextAlign.left, - style: TextStyle( - color: const Color(0xff03FEFB), - fontSize: 12.sp, - ), - ), - ], - ), - )), - ], - ), - ), - ); - } -} diff --git a/circle_app/lib/app/msg/series/binding.dart b/circle_app/lib/app/msg/series/binding.dart deleted file mode 100644 index 4c1036b..0000000 --- a/circle_app/lib/app/msg/series/binding.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:get/get.dart'; - -import 'logic.dart'; - -class SeriesBinding extends Bindings { - @override - void dependencies() { - Get.lazyPut(() => SeriesLogic()); - } -} diff --git a/circle_app/lib/app/msg/series/logic.dart b/circle_app/lib/app/msg/series/logic.dart deleted file mode 100644 index 427dd59..0000000 --- a/circle_app/lib/app/msg/series/logic.dart +++ /dev/null @@ -1,45 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:circle_app/network/api.dart'; -import 'package:circle_app/network/dio_manager.dart'; -import 'package:pull_to_refresh/pull_to_refresh.dart'; - -class SeriesLogic extends GetxController { - ScrollController scrollController = ScrollController(); - final RefreshController refreshController = RefreshController(); - List listData = []; - bool isMore = true; - int page = 1; - - @override - void onInit() { - // TODO: implement onInit - super.onInit(); - loadData(); - } - - void loadData() async { - var data = await DioManager.instance.post( - url: Api.getActivityDetail+Get.arguments['id'].toString(),params: {'page':page,'pageSize':20}); - - if (data['code'] == 200) { - List list = data['data']; - if (list.isNotEmpty) { - listData.addAll(list); - isMore = false; - refreshController.loadComplete(); - } else { - isMore = false; - refreshController.loadNoData(); - } - update(); - } - } - - void loadMore() { - page = page + 1; - loadData(); - } - - -} diff --git a/circle_app/lib/app/msg/series/view.dart b/circle_app/lib/app/msg/series/view.dart deleted file mode 100644 index 5a86e9d..0000000 --- a/circle_app/lib/app/msg/series/view.dart +++ /dev/null @@ -1,54 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:pull_to_refresh/pull_to_refresh.dart'; - -import '../../../components/my_app_bar.dart'; -import '../../../util/util.dart'; -import '../sys_notify_list/platform_item.dart'; -import 'logic.dart'; - -class SeriesPage extends StatelessWidget { - SeriesPage({Key? key}) : super(key: key); - - final logic = Get.find(); - - @override - Widget build(BuildContext context) { - return Container( - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage(getBaseImage("bg")), - fit: BoxFit.cover, - ), - ), - child: GetBuilder(builder: (logic) { - return Scaffold( - backgroundColor: Colors.transparent, - appBar: MyAppBar( - centerTitle: Get.arguments['title'], - ), - body: logic.listData.isEmpty && logic.isMore - ? loaddingWidget(true) - : SmartRefresher( - controller: logic.refreshController, - enablePullUp: true, - enablePullDown: false, - onLoading: () { - logic.loadMore(); - }, - child: ListView.builder( - controller: logic.scrollController, - itemBuilder: (context, index) { - if (index == logic.listData.length) { - return loaddingWidget(logic.isMore); - } - return PlatformWdiget(list: logic.listData[index]); - }, - itemCount: logic.listData.isNotEmpty - ? logic.listData.length + 1 - : 0, - ))); - })); - } -} diff --git a/circle_app/lib/app/msg/state.dart b/circle_app/lib/app/msg/state.dart deleted file mode 100644 index 6bdc55b..0000000 --- a/circle_app/lib/app/msg/state.dart +++ /dev/null @@ -1,6 +0,0 @@ -class MsgState { - String msg = ''; - MsgState() { - ///Initialize variables - } -} diff --git a/circle_app/lib/app/msg/sys_notify_list/binding.dart b/circle_app/lib/app/msg/sys_notify_list/binding.dart deleted file mode 100644 index 9e38c69..0000000 --- a/circle_app/lib/app/msg/sys_notify_list/binding.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:get/get.dart'; - -import 'logic.dart'; - -class Sys_notify_listBinding extends Bindings { - @override - void dependencies() { - Get.lazyPut(() => Sys_notify_listLogic()); - } -} diff --git a/circle_app/lib/app/msg/sys_notify_list/logic.dart b/circle_app/lib/app/msg/sys_notify_list/logic.dart deleted file mode 100644 index ad90439..0000000 --- a/circle_app/lib/app/msg/sys_notify_list/logic.dart +++ /dev/null @@ -1,264 +0,0 @@ -import 'package:circle_app/network/api.dart'; -import 'package:circle_app/network/dio_manager.dart'; -import 'package:get/get.dart'; -import 'package:pull_to_refresh/pull_to_refresh.dart'; -import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; - -class Sys_notify_listLogic extends GetxController { - @override - void dispose() { - refreshController.dispose(); - super.dispose(); - - } - - final RefreshController refreshController = RefreshController(); - V2TimConversation? con; - int page = 1; - - int next = 0; - - int isVip = 0; - bool isLoad = true; - bool isMore = true; - List lists = []; - - List serieslists = []; - - List normallists = []; - - List msgLists = []; - - @override - void onInit() async { - super.onInit(); - makeRead(); - con = Get.arguments; - if (con!.showName! == '互动通知') { - // 拉取单聊历史消息 - loadMsgList(); - } else if (con!.showName! == '活动驿站') { - loadActivityList(); - } else { - initList(); - } - } - - - loadActivityList() async { - if (serieslists.isEmpty) { - var seriesData = - await DioManager.instance.get(url: Api.getSeriesActivity,); - if (seriesData['code'] == 200) { - if (seriesData['data'] != null) { - serieslists = seriesData['data']; - } - } - } - - var normalData = - await DioManager.instance.post(url: Api.getNormalActivity,params: {'page':1, 'pageSize':20}); - - if (normalData['code'] == 200) { - if (normalData['data'] != null) { - List list = normalData['data']; - if (list.isNotEmpty) { - normallists.addAll(list); - refreshController.loadComplete(); - } else { - refreshController.loadNoData(); - } - } - } else { - refreshController.loadNoData(); - } - isLoad = false; - update(); - } - - loadMsgList() async { - String msgId = ''; - if (msgLists.isNotEmpty) { - msgId = msgLists.last.msgID!; - } - var result = await TencentImSDKPlugin.v2TIMManager.getMessageManager().getC2CHistoryMessageList( - userID: con!.userID!, - count: 10, - lastMsgID: msgId.isNotEmpty ? msgId : null, - ); - if (result.code == 0) { - if (result.data!.isNotEmpty) { - if (msgLists.isNotEmpty) { - msgLists.addAll(result.data!); - } else { - msgLists = result.data!; - } - refreshController.loadComplete(); - } else { - isMore = false; - refreshController.loadNoData(); - } - isLoad = false; - update(); - } - } - - initList() async { - - // /** - // * 系统 - // */ - // SYSTEM(1, 100), - // /** - // * 活动驿站 - // */ - // ACTIVITY(2, 101), - // /** - // * 会员中心 - // */ - // VIP(3, 102), - // /** - // * 资产中心 - // */ - // WALLET(4, 103), - // /** - // * 乐园圈子 - // */ - // GROUP(5, 104); - - - Map typeMap = { - '官方通知':1, - '活动驿站':2, - '会员中心':3, - '资产中心':4, - '乐园圈子':5, - - }; - - int type = typeMap.containsKey(con!.showName! ?? '') ? typeMap[con!.showName!] : 1; - - var data = - await DioManager.instance.get(url: Api.getNotices+ '/${type}', params: { - 'last_id':next,'size':'10', - }); - - if (data['code'] == 200) { - List bean = data['data']['lists']; - if (bean.length > 0) { - bean.forEach((element) { - lists.add(Lists.fromJson(element)); - }); - } - if (bean.length < 10) { - isMore = false; - } - } - if (next == 0) { - - if(lists.isNotEmpty) { - next = lists.last.id!; - } - refreshController.refreshCompleted(); - } else { - refreshController.loadComplete(); - if (isMore) { - next = lists.last.id!; - } - - } - isLoad = false; - update(); - - } - - void onRefresh() async { - page = 0; - next = 0; - lists.clear(); - update(); - initList(); - } - - void onLoading() { - if (isMore) { - initList(); - } else { - refreshController.loadNoData(); - } - // page = page + 1; - - } - - void onLoadingMsgList() { - if (isMore) { - loadMsgList(); - } else { - refreshController.loadNoData(); - } - // page = page + 1; - - } - - void makeRead() async { - V2TimConversation con = Get.arguments; - V2TimCallback markC2CMessageAsReadRes = await TencentImSDKPlugin - .v2TIMManager - .getMessageManager() - .markC2CMessageAsRead(userID: con.userID!); // 需要设置消息已读的用户id - if (markC2CMessageAsReadRes.code == 0) { - // 标记成功 - } - } - - void loadMore() { - page = page + 1; - loadActivityList(); - } - -} - -class Lists { - String? content; - String? createTime; - int? id; - String? image; - String? note; - String? scene; - int? status; - String? title; - - Lists( - {this.content, - this.createTime, - this.id, - this.image, - this.note, - this.scene, - this.status, - this.title}); - - Lists.fromJson(Map json) { - content = json['content']; - createTime = json['createTime']; - id = json['id'] ?? 0; - image = json['image']; - note = json['note']; - scene = json['scene']; - status = json['status']; - title = json['title']; - } - - Map toJson() { - final Map data = new Map(); - data['content'] = this.content; - data['createTime'] = this.createTime; - data['id'] = this.id; - data['image'] = this.image; - data['note'] = this.note; - data['scene'] = this.scene; - data['status'] = this.status; - data['title'] = this.title; - return data; - } -} diff --git a/circle_app/lib/app/msg/sys_notify_list/platform_item.dart b/circle_app/lib/app/msg/sys_notify_list/platform_item.dart deleted file mode 100644 index 68523ec..0000000 --- a/circle_app/lib/app/msg/sys_notify_list/platform_item.dart +++ /dev/null @@ -1,84 +0,0 @@ -import 'dart:convert'; - -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; - -import '../../../router/app_routers.dart'; -import '../../../util/util.dart'; - -class PlatformWdiget extends StatelessWidget { - var list; - PlatformWdiget({Key? key,required this.list}) : super(key: key); - - @override - Widget build(BuildContext context) { - // TODO: implement build - return GestureDetector( - onTap: () { - if (list['scene'] == 'url') { - Map bean = json.decode(list['note']); - String url = bean['url']; - - Get.toNamed(AppRoutes.WebViewActivity, - arguments: {'title': "", "url": url}); - } else { - if (list['note'] == null) { - // Map bean = json.decode(data.note!); - pushPage(list['scene'], ''); - } else { - Map bean = json.decode(list['note']); - pushPage(list['note'], bean['param']); - } - } - }, - child: Container( - margin: EdgeInsets.only(top: 15.sp, left: 5.sp, right: 5.sp), - // padding: EdgeInsets.only(), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10.sp), color: Color(0xFF292836)), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if (list['picUrl'] != null) - ClipRRect( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(10.sp), - topRight: Radius.circular(10.sp)), - child: Image.network( - list['picUrl'], - width: Get.width, - fit: BoxFit.fill, - height: 114.sp, - )), - if (list['name'] != null) - Padding( - padding: EdgeInsets.only(left: 15.sp, right: 17.sp, top: 8.sp), - child: Text( - list['name'], - style: TextStyle(color: Colors.white, fontSize: 14.sp), - ), - ), - if (list['description'] != null) - Padding( - padding: EdgeInsets.only( - left: 15.sp, right: 15.sp, top: 8.sp,), - child: Text( - list['description'], - style: TextStyle(color: Color(0xFFB7BECC), fontSize: 12.sp), - ), - ), - Padding( - padding: EdgeInsets.only( - left: 15.sp, right: 15.sp, top: 10.sp, bottom: 10.sp), - child: Text( - '活动时间: ${list['startTime'].split('T').first}至${list['endTime'].split('T').first}', - style: TextStyle(color: Color(0xFFB7BECC), fontSize: 12.sp), - )) - ], - ), - ), - ); - } - -} \ No newline at end of file diff --git a/circle_app/lib/app/msg/sys_notify_list/view.dart b/circle_app/lib/app/msg/sys_notify_list/view.dart deleted file mode 100644 index d14c376..0000000 --- a/circle_app/lib/app/msg/sys_notify_list/view.dart +++ /dev/null @@ -1,571 +0,0 @@ -import 'dart:convert'; - -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:circle_app/app/msg/series/view.dart'; -import 'package:circle_app/app/msg/sys_notify_list/platform_item.dart'; -import 'package:circle_app/common/Widgets/base_tip_widget.dart'; -import 'package:circle_app/components/my_app_bar.dart'; -import 'package:circle_app/router/app_routers.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:pull_to_refresh/pull_to_refresh.dart'; -import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; - -import 'logic.dart'; - -class Sys_notify_listPage extends StatelessWidget { - Sys_notify_listPage({Key? key}) : super(key: key); - - final logic = Get.find(); - - Widget build(BuildContext context) { - return GetBuilder(builder: (logic) { - return Container( - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage(getBaseImage("home_back")), - fit: BoxFit.cover, - ), - ), - child: Scaffold( - backgroundColor: Colors.transparent, - appBar: MyAppBar( - centerTitle: logic.con != null ? logic.con!.showName! ?? '' : '', - actionWdiget: logic.con != null - ? logic.con!.showName == '活动驿站' - ? InkWell( - onTap: () { - var con; - if (kDebugMode) { - con = V2TimConversation( - conversationID: "c2c_qpqz_dev_10_102", - userID: "qpqz_dev_10_102", - showName: "测试乐园客服", - type: 1); - } else { - con = V2TimConversation( - conversationID: "c2c_qpqz_prod_10_102", - userID: "qpqz_prod_10_102", - showName: "乐园客服", - type: 1); - } - Get.toNamed(AppRoutes.Chat, arguments: con); - }, - child: Text( - '联系客服', - style: - TextStyle(color: Colors.white, fontSize: 15.sp), - )) - : Container() - : Container(), - ), - body: Container( - width: Get.width, - height: Get.height, - child: Column( - children: [ - Expanded( - child: logic.isLoad - ? loaddingWidget(true) - : logic.lists.isEmpty && - logic.msgLists.isEmpty && - logic.serieslists.isEmpty && - logic.normallists.isNotEmpty - ? noResultWidget() - : logic.msgLists.isNotEmpty || - logic.serieslists.isNotEmpty || - logic.normallists.isNotEmpty - ? SmartRefresher( - controller: logic.refreshController, - enablePullUp: true, - enablePullDown: false, - onLoading: () { - if (logic.con!.showName == '活动驿站') { - logic.loadMore(); - } else { - logic.onLoadingMsgList(); - } - }, - child: ListView.builder( - padding: EdgeInsets.only(left:10.sp,right: 10.sp), - itemCount: logic.con!.showName == '活动驿站' - ? logic.serieslists.length + - (logic.normallists.isNotEmpty - ? 1 - : 0) - : logic.msgLists.length, - itemBuilder: (context, index) { - if (logic.con!.showName == '活动驿站') { - if (index == 0 && - logic.serieslists.isNotEmpty) { - return activeHorItem(); - } else { - if (logic.serieslists.isNotEmpty) { - return PlatformWdiget( - list: logic - .normallists[index - 1]); - } - } - return PlatformWdiget( - list: - logic.normallists[index - 1]); - } - return msgItem(logic.msgLists![index]); - }, - ), - ) - : SmartRefresher( - controller: logic.refreshController, - enablePullUp: true, - onRefresh: logic.onRefresh, - onLoading: () { - logic.onLoading(); - }, - child: ListView.builder( - padding: EdgeInsets.only(left:10.sp,right: 10.sp), - itemCount: logic.lists.length, - itemBuilder: (context, index) { - return ListItem(logic.lists[index]); - }, - ), - ), - ), - if (logic.con!.showName != '官方通知' && - logic.con!.showName != '系统通知' && - logic.con!.showName != '活动驿站' && - logic.con!.showName != '互动通知') - Container( - height: 40.sp, - color: Color(0xFF090B14), - child: Row( - children: [ - Expanded( - child: GestureDetector( - onTap: () { - if (logic.con!.showName == '会员中心') { - showOepnVipDialog(); - } else if (logic.con!.showName == '资产中心') { - Get.toNamed(AppRoutes.MyAssets); - } else { - Get.toNamed(AppRoutes.MyCircle); - } - }, - behavior: HitTestBehavior.opaque, - child: Container( - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - margin: EdgeInsets.only(right: 4.sp), - child: Image.network( - logic.con!.faceUrl!, - width: 20.sp, - ), - ), - Text( - logic.con!.showName == '会员中心' - ? '会员中心' - : logic.con!.showName == '资产中心' - ? '我的资产' - : '我的圈子', - style: TextStyle( - color: Colors.white, fontSize: 15.sp), - ) - ], - ), - ), - )), - Container( - height: 20.sp, - width: 0.5.sp, - color: Colors.white.withOpacity(0.5), - ), - Expanded( - child: GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.HelpActivity); - }, - behavior: HitTestBehavior.opaque, - child: Container( - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset( - getHomeImage("mine_help"), - width: 20.sp, - ), - Text( - '帮助与反馈', - style: TextStyle( - color: Colors.white, - fontSize: 15.sp), - ) - ], - ), - ))), - ], - ), - ), - Container( - height: MediaQuery.of(context).padding.bottom, - color: Color(0xFF090B14), - ) - ], - ), - ), - ), - ); - }); - } - - activeHorItem() { - return Container( - padding: EdgeInsets.only(left: 0.sp), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - '系列活动', - style: TextStyle(color: Colors.white, fontSize: 16.sp), - ), - SizedBox(height: 10.sp), - Container( - width: Get.width, - height: 165.sp, - child: ListView.builder( - itemBuilder: (context, index) { - return Container( - height: 165.sp, - width: 160.sp, - child: GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.SeriesPage, arguments: { - 'id': logic.serieslists[index]['id'].toString(), - 'title': logic.serieslists[index]['name'] - }); - }, - child: seriesWidget(logic.serieslists[index]), - ), - ); - }, - itemCount: logic.serieslists.length, - scrollDirection: Axis.horizontal, - ), - ), - SizedBox(height: 10.sp), - Text( - '平台活动', - style: TextStyle(color: Colors.white, fontSize: 16.sp), - ), - SizedBox(height: 10.sp), - ], - ), - ); - } - - seriesWidget(var list) { - return Container( - margin: EdgeInsets.only(right: 15.sp), - // padding: EdgeInsets.only(), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10.sp), color: Color(0xFF292836)), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if (list['picUrl'] != null) - ClipRRect( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(10.sp), - topRight: Radius.circular(10.sp)), - child: Image.network( - list['picUrl'], - width: Get.width, - fit: BoxFit.cover, - height: 100.sp, - )), - if (list['name'] != null) - Padding( - padding: EdgeInsets.only(left: 15.sp, right: 17.sp, top: 8.sp), - child: Text( - list['name'], - style: TextStyle(color: Colors.white, fontSize: 14.sp), - ), - ), - if (list['description'] != null) - Padding( - padding: EdgeInsets.only( - left: 15.sp, right: 5.sp, top: 8.sp, bottom: 10.sp), - child: Text( - list['description'], - style: TextStyle(color: Color(0xFFB7BECC), fontSize: 12.sp), - ), - ), - ], - ), - ); - } - - msgItem(V2TimMessage data) { - Map info = jsonDecode(data.customElem!.data!); - if (info['ta'] != null) { - return GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - if (info.containsKey('scene')) { - if (info['scene'] != null) { - String param = info['param']; - pushPage(info['scene'], param, - name: info['ta']['nickname'] ?? ''); - } else { - Get.toNamed(AppRoutes.UserInfoActivity, - arguments: info['ta']['id'].toString()); - } - } else { - Get.toNamed(AppRoutes.UserInfoActivity, - arguments: info['ta']['id'].toString()); - } - }, - child: Container( - margin: EdgeInsets.only(bottom: 10.sp), - // padding: EdgeInsets.only(left: 15.sp, right: 15.sp), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - ClipOval( - child: Image.network( - info['ta']['avatarUrl'] != null - ? info['ta']['avatarUrl'].toString().isNotEmpty - ? info['ta']['avatarUrl'] - : 'http://qiniuyun.ikuayou.com/avatar/default/default_header.png' - : 'http://qiniuyun.ikuayou.com/avatar/default/default_header.png', - width: 50.sp, - height: 50.sp, - fit: BoxFit.cover, - ), - ), - Padding( - padding: EdgeInsets.only(left: 8.sp), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Text( - info['ta']['nickname'] ?? '', - style: const TextStyle( - color: Colors.white70, - fontSize: 14, - fontWeight: FontWeight.bold), - ), - // SizedBox( - // width: 4.sp, - // ), - // Image.asset( - // getMineImage(sexList[info['ta']['gender'] ?? 1]), - // width: 24.sp, - // ), - ], - ), - SizedBox( - height: 2.sp, - ), - Container( - width: Get.width - 100.sp, - child: Text( - info['msg'], - style: - TextStyle(color: Colors.white54, fontSize: 14.sp), - ), - ), - SizedBox( - height: 4.sp, - ), - Text( - info['noticeTime'], - style: TextStyle( - color: Colors.white54, - fontSize: 12.sp, - ), - ), - ], - ), - ), - ], - ), - ), - ); - // "description" -> "您的喊话已通过审核,可前往【全球喊话】页面查看,多发布优质喊话并积极参与互动会有更多人给您响应哦~" - } else if (info.containsKey('description')) { - return Container( - margin: EdgeInsets.only(top: 15.sp, left: 15.sp, right: 15.sp), - // padding: EdgeInsets.only(), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10.sp), - color: Color(0xFF292836)), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if (info.containsKey('coverUrl')) - ClipRRect( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(10.sp), - topRight: Radius.circular(10.sp)), - child: Image.network( - info['coverUrl'], - width: Get.width, - fit: BoxFit.cover, - height: 114.sp, - )), - if (info.containsKey('title')) - Padding( - padding: EdgeInsets.only(left: 15.sp, right: 17.sp, top: 8.sp), - child: Text( - info['title'], - style: TextStyle(color: Colors.white, fontSize: 14.sp), - ), - ), - Padding( - padding: EdgeInsets.only( - left: 15.sp, right: 15.sp, top: 8.sp, bottom: 10.sp), - child: Text( - info['description'], - style: TextStyle(color: Colors.white, fontSize: 14.sp), - ), - ), - ], - ), - ); - } - } - - ListItem(Lists data) { - V2TimConversation con = Get.arguments; - List widgets = []; - if (data.image != null) { - widgets.add(Image.network( - data.image!, - width: 0.712 * Get.width, - height: 114.sp, - fit: BoxFit.fill, - )); - } - if (data.title?.isNotEmpty ?? false) { - widgets.add( - Container( - margin: EdgeInsets.only(top: 8.sp, left: 16.sp, right: 16.sp), - child: Text( - data.title!, - style: TextStyle( - color: Color(0xFFF7FAFA), - fontSize: 14.sp, - fontWeight: FontWeight.w500), - ), - ), - ); - } - - if (data.content?.isNotEmpty ?? false) { - widgets.add(Container( - margin: EdgeInsets.only( - top: 10.sp, left: 16.sp, right: 16.sp, bottom: 10.sp), - child: Text( - data.content!, - style: TextStyle( - color: Color(0xFFF7FAFA), - fontSize: 14.sp, - fontWeight: FontWeight.w500), - ), - )); - } - - widgets.add(GestureDetector( - onTap: () async { - if (data.scene == 'url') { - Map bean = json.decode(data.note!); - String url = bean['url']; - - Get.toNamed(AppRoutes.WebViewActivity, - arguments: {'title': "", "url": url}); - } else { - if (data.note == null) { - // Map bean = json.decode(data.note!); - pushPage(data.scene!, ''); - } else { - Map bean = json.decode(data.note!); - pushPage(data.scene!, bean['param']); - } - } - }, - child: Container( - margin: EdgeInsets.only(bottom: 8.sp, left: 16.sp), - child: Text('点击查看>', - style: TextStyle( - color: Color(0xFF00FFF4), - fontSize: 12.sp, - fontWeight: FontWeight.w500)), - ), - )); - - return Container( - child: Column( - children: [ - Container( - margin: EdgeInsets.only(bottom: 10.sp), - width: Get.width, - alignment: Alignment.center, - child: Text( - data.createTime ?? '', - style: TextStyle( - color: Color(0xFFB7BECC), - fontSize: 12.sp, - fontWeight: FontWeight.w500), - ), - ), - GestureDetector( - onTap: () async { - if (data.scene == 'url') { - Map bean = json.decode(data.note!); - String url = bean['url']; - - Get.toNamed(AppRoutes.WebViewActivity, - arguments: {'title': "", "url": url}); - } else { - if (data.note == null) { - // Map bean = json.decode(data.note!); - pushPage(data.scene!, ''); - } else { - Map bean = json.decode(data.note!); - pushPage(data.scene!, bean['param']); - } - } - }, - child: Row( - children: [ - CachedNetworkImage( - imageUrl: con.faceUrl!, - width: 34.sp, - ), - Column( - children: [ - Container( - width: 0.712 * Get.width, - margin: EdgeInsets.only(left: 10.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10.sp), - color: Color(0xFF292836)), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: widgets), - ) - ], - ) - ], - )), - ], - ), - ); - } -} diff --git a/circle_app/lib/app/msg/view.dart b/circle_app/lib/app/msg/view.dart deleted file mode 100644 index 226841e..0000000 --- a/circle_app/lib/app/msg/view.dart +++ /dev/null @@ -1,480 +0,0 @@ -import 'dart:math'; - -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:circle_app/app/circle/logic.dart'; -import 'package:circle_app/app/circle/view.dart'; -import 'package:circle_app/common/Widgets/open_vip_tip/view.dart'; -import 'package:circle_app/common/colors/app_color.dart'; -import 'package:circle_app/main.dart'; -import 'package:circle_app/network/api.dart'; -import 'package:circle_app/network/dio_manager.dart'; -import 'package:circle_app/router/app_routers.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; - -import 'TIMUIKitConversation/tim_uikit_conversation.dart'; -import 'logic.dart'; -const msgBgWidget = DecorationImage( - fit: BoxFit.fill, - image: AssetImage('assets/images/base/home_back.png')); -class MsgPage extends StatefulWidget { - MsgPage({Key? key}) : super(key: key); - - @override - State createState() => _MsgPageState(); -} - -class _MsgPageState extends State with AutomaticKeepAliveClientMixin { - // final ctr = Get.put(MsgLogic()); - final ctr = Get.find(); - var logic = Get.find(); - void getPipeiData() async { - var data = await DioManager.instance - .get(url: Api.getMatch); - if(data['code'] == 200) { - //发送消息 - bool isSuccess = await createCustomMsg(data['data']['account_id'].toString().split('_').last,data['data']['account_id']); - if (!isSuccess) { - await sendTextMsg(data['data']['account_id']); - } else { - logic.listScrollController.animateTo(0, duration: Duration(milliseconds: 200), curve: Curves.easeInOut); - } - } else if(data['code'] == 21201){ - showOKToast(data['msg']); - showRechargeDialog(); - }else{ - showOKToast(data['msg']); - } - } - - showRechargeDialog(){ - Get.bottomSheet( - Scaffold( - backgroundColor: Colors.transparent, - body: Open_vip_tipPage(true), - ), - isScrollControlled: true, - enableDrag: false); - - } - - @override - Widget build(BuildContext context) { - return Scaffold( - resizeToAvoidBottomInset: false, - backgroundColor: Colors.transparent, - body: SafeArea( - child: GetBuilder(builder: (MsgLogic controller) { - return Column( - children: [ - navigatorItem(controller), - tipWidget(), - reconmandWidget(), - // Text(controller.state.msg), - Expanded(child: TIMConversation( - autoScrollController: logic.scrollController, - scrollController: logic.listScrollController, - onTapItem: (selectedConv) async { - String type = selectedConv.userID!.split('_')[2]; - if (int.parse(type) == 11) { - Get.toNamed(AppRoutes.Sys_notify_list, arguments: selectedConv); - return; - } - Get.toNamed(AppRoutes.Chat, arguments: selectedConv); - }, - )) - ], - ); - }), - ), - ); - } - - circleWidget(String url, String userId,{double width = 30}) { - return Stack( - alignment: Alignment.center, - children: [ - Image.asset( - getCircleImage('avatar_bg'), - width: width.sp, - ), - ClipOval( - child: CachedNetworkImage( - imageUrl:url??"https://qiniuyun.leyuan666.com/quanzi/avatar/default.png", - width: (width - 1).sp, - height: (width - 1).sp, - fit: BoxFit.cover, - ), - ) - ], - ); - } - - navigatorItem(MsgLogic ctr) { - var logic = Get.find(); - - List widgets = []; - int i = 0; - // print(urlList); - if(ctr.lists!.isNotEmpty){ - ctr.lists.forEach((element) { - if(widgets.length>2){ - return; - } - widgets.add(Positioned( - left: 15.sp * i, - child: circleWidget(element.user.avatar! ?? "https://qiniuyun.leyuan666.com/quanzi/avatar/default.png",element.user.id.toString()), - )); - i++; - }); - } - - String count = '0'; - if (logic != null) { - count = (logic.statistics.value.likeMeCount ?? 0).toString(); - } - - if (int.parse(count) > 0) { - widgets.add(Positioned( - left: 15.sp * i, - child: Stack( - alignment: Alignment.center, - children: [ - Image.asset( - getCircleImage('avatar_bg'), - width: 30.sp, - height: 30.sp, - ), - Container( - alignment: Alignment.center, - width: 28.sp, - height: 28.sp, - child: Text( - int.parse(count) > 99 - ? '99+' - : count, - style: TextStyle( - color: Colors.white, - fontSize: int.parse(count) > 99 ? 10.sp : 12.sp), - ), - ), - ], - ), - )); - } - - return Container( - width: Get.width, - padding: EdgeInsets.only(left: 18.sp, right: 18.sp), - height: 44.sp, - child: Stack( - alignment: Alignment.center, - children: [ - Positioned( - left: 0, - child: GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.FriendsActivity,arguments: 2); - }, - child:ctr.lists.isNotEmpty - ? SizedBox( - height: 30.sp, - width: 30.0.sp + - 15.sp * - (widgets.length), - child: Stack( - children: widgets, - ), - ) - : Container(),)), - GestureDetector( - onTap: () { - logic.listScrollController.animateTo( - 0.0, - duration: Duration(milliseconds: 300), - curve: Curves.easeInOut, - ); - }, - child: Text( - '消息', - style: TextStyle( - fontSize: 18.sp, - fontWeight: FontWeight.w600, - color: AppColor.mainColor, - ), - ), - ), - Positioned( - right: 0, - child: GestureDetector( - onTap: () { - getPipeiData(); - }, - child: Image.asset( - getMsgImage('msg_pipei'), - width: 85.sp, - ), - )), - ], - ), - ); - } - - tipWidget() { - return Container( - margin: EdgeInsets.only(top: 18.sp, bottom: 15.sp), - padding: EdgeInsets.only(left: 16.sp, right: 12.sp), - width: Get.width, - height: 20.sp, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - '最近想要聊天的圈友', - style: TextStyle( - color: Colors.white, - fontSize: 16.sp, - fontWeight: FontWeight.w500), - ), - GestureDetector( - onTap: () async{ - Get.toNamed(AppRoutes.Quick); - }, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - ShaderMask( - shaderCallback: (Rect bounds) { - return const LinearGradient( - begin: Alignment.centerRight, - end: Alignment.centerLeft, - colors: [Color(0xff71F3F2), Color(0xffF657FF)], - ).createShader(Offset.zero & bounds.size); - }, - child: Text( - '${ctr.total}人在线等您聊', - style: TextStyle( - fontSize: 16.sp, - fontWeight: FontWeight.w600, - color: Colors.white), - ), - ), - Image.asset( - getMsgImage('msg_arr'), - width: 24.sp, - ) - ], - ), - ) - ], - ), - ); - } - - reconmandWidget() { - return Container( - padding: EdgeInsets.only(left: 16.sp, right: 18.sp), - width: Get.width, - height: 80.sp, - child: Row( - children: [ - GestureDetector( - onTap: () { - ctr.showTipPop(); - }, - child: Column( - children: [ - Image.asset( - getMsgImage('msg_first'), - width: 50.sp, - ), - SizedBox( - height: 4.sp, - ), - Text( - ctr.isStart ? '关闭速聊' : '冲到第一', - style: TextStyle(color: Colors.white, fontSize: 12.sp), - ), - ], - ), - ), - Expanded( - child: ListView.builder( - scrollDirection: Axis.horizontal, - itemBuilder: (contenxt, index) { - if (index == ctr.chatList.length) { - return MoreItem(); - } - return peopleWidget(ctr.chatList[index]); - }, - itemCount: ctr.chatList.length + 1, - )) - ], - ), - ); - } - - Widget MoreItem() { - return GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.Quick); - }, - child: Container( - // width: 68.sp, - margin: EdgeInsets.only(left: 12.sp), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Stack( - children: [ - Center( - child: ClipOval( - child: Container( - color: Colors.black, - width: 50.sp, - height: 50.sp, - ), - ), - ), - Center( - child: ClipOval( - child: Image.asset( - getHomeImage("im_more"), - width: 50.sp, - // height: 48.sp, - ), - ), - ), - ], - ), - SizedBox(height: 4.0.sp), - Center( - child: Text( - "查看更多", - overflow: TextOverflow.ellipsis, - maxLines: 1, - style: TextStyle( - fontSize: 12.0.sp, - color: Colors.white, // Replace with desired text color - ), - ), - ), - ], - ), - ), - ); - } - - - topWidget() { - return GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - ctr.showTipPop(); - }, - child: Container( - margin: EdgeInsets.only(left: 18.sp), - child: Column( - children: [ - Image.asset( - getMsgImage('msg_first'), - width: 50.sp, - ), - SizedBox( - height: 4.sp, - ), - Text( - '抢占第一', - style: TextStyle(color: Colors.white, fontSize: 12.sp), - ), - ], - ), - ), - ); - } - - peopleWidget(Map info) { - return GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.UserInfoActivity,arguments: info['id'].toString()); - }, - child: Stack( - - children: [ - Container( - margin: EdgeInsets.only(left: 12.sp), - child: Column( - children: [ - Stack( - alignment: Alignment.center, - children: [ - Container( - height: 52.sp, - width: 52.sp, - decoration: BoxDecoration( - gradient: AppColor.mainVerLinearGradient, - borderRadius: BorderRadius.circular(26.sp) - ), - ), - ClipOval( - child: Image.network( - info['avatar_thumb'], - fit: BoxFit.cover, - width: 50.sp, - height: 50.sp, - ), - ), - ], - ), - SizedBox( - height: 4.sp, - ), - Text( - info['nickname'] ?? '', - style: TextStyle(color: Colors.white, fontSize: 12.sp), - ), - ], - ), - ), - (info['gender'] ?? 0) > 0 - ? Positioned( - bottom: 28.sp, - right: 0.sp, - child: Image.asset( - getMsgImage(getGenderContent(info['gender'])), - height: 15.sp, - ) - ) : Container() - ], - ), - ); - } - - msgWdiget(context) { - var logic = Get.find(); - return TIMConversation( - autoScrollController: logic.scrollController, - scrollController: logic.listScrollController, - onTapItem: (selectedConv) async{ - String type = selectedConv.userID!.split('_')[2]; - if (int.parse(type) == 11) { - Get.toNamed(AppRoutes.Sys_notify_list, arguments: selectedConv); - return; - } - Get.toNamed(AppRoutes.Chat, arguments: selectedConv); - - }, - ); - } - - Widget msgItem(conv, status) { - return Container(); - } - - @override - // TODO: implement wantKeepAlive - bool get wantKeepAlive => true; -} diff --git a/circle_app/lib/app/my_assets/binding.dart b/circle_app/lib/app/my_assets/binding.dart deleted file mode 100644 index f76cc3b..0000000 --- a/circle_app/lib/app/my_assets/binding.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:get/get.dart'; - -import 'logic.dart'; - -class My_assetsBinding extends Bindings { - @override - void dependencies() { - Get.lazyPut(() => My_assetsLogic()); - } -} diff --git a/circle_app/lib/app/my_assets/logic.dart b/circle_app/lib/app/my_assets/logic.dart deleted file mode 100644 index 35e20fb..0000000 --- a/circle_app/lib/app/my_assets/logic.dart +++ /dev/null @@ -1,127 +0,0 @@ -import 'package:circle_app/util/eventBus.dart'; -import 'package:get/get.dart'; - -import '../../network/api.dart'; -import '../../network/dio_manager.dart'; - -class My_assetsLogic extends GetxController { - - AssetsDataData? myAssest; - var sub; - @override - void onInit() { - // TODO: implement onInit - super.onInit(); - sub = EventBusManager.on().listen((event) { - loadMyAssest(); - }); - loadMyAssest(); - } - - @override - void onClose() { - // TODO: implement onClose - super.onClose(); - sub.cancel(); - } - - void loadMyAssest() async { - var data = await DioManager.getInstance().get(url: Api.userAsset); - if (data['code'] == 200) { - myAssest = AssetsDataData.fromJson(data['data']); - update(); - } - } -} - - -/// -/// Code generated by jsonToDartModel https://ashamp.github.io/jsonToDartModel/ -/// -class AssetsDataData { -/* -{ - "balance": 0, - "incomeBalance": 0, - "totalExpenseBalance": 0, - "totalIncomeBalance": 0, - "totalRechargeBalance": 0, - "totalWithDrawBalance": 0 -} -*/ - - int? balance; - int? incomeBalance; - int? totalExpenseBalance; - int? totalIncomeBalance; - int? totalRechargeBalance; - int? totalWithDrawBalance; - - AssetsDataData({ - this.balance, - this.incomeBalance, - this.totalExpenseBalance, - this.totalIncomeBalance, - this.totalRechargeBalance, - this.totalWithDrawBalance, - }); - AssetsDataData.fromJson(Map json) { - balance = json['balance']?.toInt(); - incomeBalance = json['incomeBalance']?.toInt(); - totalExpenseBalance = json['totalExpenseBalance']?.toInt(); - totalIncomeBalance = json['totalIncomeBalance']?.toInt(); - totalRechargeBalance = json['totalRechargeBalance']?.toInt(); - totalWithDrawBalance = json['totalWithDrawBalance']?.toInt(); - } - Map toJson() { - final data = {}; - data['balance'] = balance; - data['incomeBalance'] = incomeBalance; - data['totalExpenseBalance'] = totalExpenseBalance; - data['totalIncomeBalance'] = totalIncomeBalance; - data['totalRechargeBalance'] = totalRechargeBalance; - data['totalWithDrawBalance'] = totalWithDrawBalance; - return data; - } -} - -class AssetsData { -/* -{ - "code": 0, - "data": { - "balance": 0, - "incomeBalance": 0, - "totalExpenseBalance": 0, - "totalIncomeBalance": 0, - "totalRechargeBalance": 0, - "totalWithDrawBalance": 0 - }, - "msg": "" -} -*/ - - int? code; - AssetsDataData? data; - String? msg; - - AssetsData({ - this.code, - this.data, - this.msg, - }); - AssetsData.fromJson(Map json) { - code = json['code']?.toInt(); - data = (json['data'] != null) ? AssetsDataData.fromJson(json['data']) : null; - msg = json['msg']?.toString(); - } - Map toJson() { - final data = {}; - data['code'] = code; - if (data != null) { - data['data'] = this.data!.toJson(); - } - data['msg'] = msg; - return data; - } -} diff --git a/circle_app/lib/app/my_assets/view.dart b/circle_app/lib/app/my_assets/view.dart deleted file mode 100644 index 41f4c34..0000000 --- a/circle_app/lib/app/my_assets/view.dart +++ /dev/null @@ -1,358 +0,0 @@ -import 'dart:io'; - -import 'package:circle_app/common/colors/app_color.dart'; -import 'package:circle_app/components/my_app_bar.dart'; -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; - -import '../../common/Widgets/RechargeScreenDialog.dart'; -import '../../router/app_routers.dart'; -import '../../util/util.dart'; -import 'logic.dart'; - -class My_assetsPage extends StatelessWidget { - My_assetsPage({Key? key}) : super(key: key); - - final logic = Get.find(); - - @override - Widget build(BuildContext context) { - return Container( - width: MediaQuery - .of(context) - .size - .width, - height: MediaQuery - .of(context) - .size - .height, - decoration: BoxDecoration( - color: Color(0xFF423055), - image: DecorationImage( - fit: BoxFit.fill, - image: AssetImage(getBaseImage('home_back')))), - child: Scaffold( - backgroundColor: Colors.transparent, - appBar: MyAppBar( - centerTitle: '我的资产', - actionWdiget: GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.BillActivity); - }, - child: Text('账单', - style: TextStyle(color: Color(0xFF00FFF4), fontSize: 14.sp),), - ), - onPressed: () { - Get.toNamed(AppRoutes.BillActivity); - }, - ), - body: GetBuilder(builder: (logic) { - return logic.myAssest != null ? SingleChildScrollView( - child: Column( - children: [ - Container( - padding: EdgeInsets.only(left: 15.sp, right: 15.sp), - child:Stack( - children: [ - Image.asset( - getMineImage("im_ky_bc"), - // Replace with the path to the image asset - fit: BoxFit.cover, - ), - Positioned( - // left: 0, - // right: 0, - left: Get.width / 2 - 17, - top: 25, - bottom: 85, - // Replace this with the desired position of your line - child: Container( - width: 0.3, - color: Color( - 0x4DFFFFFF), // Replace this with the color of your line - ), - ), - Column( - children: [ - Container( - // height: 100.sp, - margin: EdgeInsets.only(top: 19.sp), - child: Row( - children: [ - Expanded( - flex: 1, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - "总资产余额", - style: TextStyle( - color: Colors.white, - fontSize: 13.sp), - ), - SizedBox(width: 4.sp,), - GestureDetector( - onTap: () { - showOKToast( - '总资产包括您充值的小票,收入小票等所有可使用的小票。'); - }, - child: Image.asset( - getMineImage('wen'), width: 18.sp,) - ), - ], - ), - ), - Expanded( - flex: 1, - child: Container( - padding: EdgeInsets.only(left: 10.sp,right: 10.sp), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - margin: EdgeInsets.only(right: 15.sp), - child: Text( - "收入余额", - style: TextStyle( - color: Colors.white, - fontSize: 13.sp), - ), - ), - // if (Platform.isAndroid) - // SizedBox(width: 30.sp,), - // Expanded(child: Container()), - // if (Platform.isAndroid) - GestureDetector( - onTap: () { - var con; - if(kDebugMode){ - con = V2TimConversation( - conversationID: "c2c_qpqz_dev_10_102", userID: "qpqz_dev_10_102", showName: "测试乐园客服", type: 1); - }else{ - con = V2TimConversation( - conversationID: "c2c_qpqz_prod_10_102", userID: "qpqz_prod_10_102", showName: "乐园客服", type: 1); - } - Get.toNamed(AppRoutes.Chat, arguments: con); - }, - child: Container( - height: 20.sp, - padding: EdgeInsets.only(left: 6.sp,right: 6.sp), - alignment: Alignment.center, - decoration: BoxDecoration( - gradient: AppColor - .mainVerLinearGradient, - borderRadius: BorderRadius - .circular(10.sp) - ), - child: Text('联系客服', - style: TextStyle( - color: Colors.white, - fontSize: 14.sp),), - ), - ) - ], - ), - ), - ), - ], - ), - ), - Container( - margin: EdgeInsets.only(top: 16.sp), - child: Row( - children: [ - Expanded( - flex: 1, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - "${logic.myAssest!.balance!}小票", - style: TextStyle( - color: Colors.white, - fontSize: 18.sp), - ), - ], - ), - ), - Expanded( - flex: 1, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - "${(logic.myAssest!.incomeBalance! * 0.01).toStringAsFixed(2)}元", - style: TextStyle( - color: Colors.white, - fontSize: 18.sp), - ), - ], - ), - ), - ], - ), - ), - Container( - margin: EdgeInsets.only( - top: 24.sp, left: 16.sp, right: 16.sp), - width: Get.width, - height: 1.sp, - color: Color(0x4DFFFFFF), - ), - Container( - margin: EdgeInsets.only(top: 16.sp), - child: Row( - children: [ - Expanded( - flex: 1, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - "总收入", - style: TextStyle( - color: Colors.white, - fontSize: 14.sp), - ), - Text( - "${(logic.myAssest!.totalIncomeBalance! * 0.01).toStringAsFixed(2)}元", - style: TextStyle( - color: Colors.white, - fontSize: 14.sp), - ), - ], - ), - ), - Container( - height: 15.sp, - width: 1.sp, - color:Color(0x4DFFFFFF), - ), - Expanded( - flex: 1, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - "总充值/奖励", - style: TextStyle( - color: Colors.white, - fontSize: 14.sp), - ), - Text("${logic.myAssest!.totalRechargeBalance!}小票", - style: TextStyle( - color: Colors.white, - fontSize: 14.sp), - ), - ], - ), - ), - Container( - height: 15.sp, - width: 1.sp, - color:Color(0x4DFFFFFF), - ), - - Expanded( - flex: 1, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - "总支出", - style: TextStyle( - color: Colors.white, - fontSize: 14.sp), - ), - Text("${logic.myAssest!.totalExpenseBalance!}小票", - style: TextStyle( - color: Colors.white, - fontSize: 14.sp), - ), - ], - ), - ), - ], - ), - ), - ], - ), - ], - )), - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - navigateStartGetMoeny(); - }, - child: Container( - margin: EdgeInsets.only(top: 10.sp,left: 15.sp,right: 15.sp), - padding: EdgeInsets.only( - left: 12.sp, - right: 12.sp, - bottom: 10.sp, - top: 10.sp), - // height: 80.sp, - decoration: BoxDecoration( - color: Color(0x1AFFFFFF), - borderRadius: BorderRadius.circular(13.sp)), - child: Row( - children: [ - Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - '微乐园赚钱攻略', - style: TextStyle( - color: AppColor.mainColor, - fontSize: 18.sp, - ), - ), - SizedBox( - height: 8.sp, - ), - Text( - '几种赚钱方式助你躺赚', - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - ), - ), - ], - ), - ), - Expanded(child: Container()), - Container( - height: 26.sp, - padding: - EdgeInsets.only(left: 10.sp, right: 10.sp), - alignment: Alignment.center, - decoration: BoxDecoration( - gradient: AppColor.mainVerLinearGradient, - borderRadius: BorderRadius.circular(13.sp)), - child: Text( - '开始赚钱', - style: TextStyle( - color: Colors.white, fontSize: 16.sp), - ), - ), - ], - )), - ), - Container( - margin: EdgeInsets.only(top: 10.sp), - height: 401.sp, - width: Get.width, - child: RechargeScreenDialog(isShowBalance: false,), - ) - ], - ), - - ) : loaddingWidget(true); - }), - )); - } -} diff --git a/circle_app/lib/app/my_circle/binding.dart b/circle_app/lib/app/my_circle/binding.dart deleted file mode 100644 index 97127dd..0000000 --- a/circle_app/lib/app/my_circle/binding.dart +++ /dev/null @@ -1,9 +0,0 @@ -import 'package:circle_app/app/my_circle/logic.dart'; -import 'package:get/get.dart'; - -class My_circleBinding extends Bindings { - @override - void dependencies() { - Get.lazyPut(() => MyCircleLogic()); - } -} diff --git a/circle_app/lib/app/my_circle/logic.dart b/circle_app/lib/app/my_circle/logic.dart deleted file mode 100644 index d847396..0000000 --- a/circle_app/lib/app/my_circle/logic.dart +++ /dev/null @@ -1,103 +0,0 @@ -import 'package:circle_app/app/circle/logic.dart'; -import 'package:circle_app/app/circle/state.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:get/get.dart'; - -import '../../network/api.dart'; -import '../../network/dio_manager.dart'; - -class MyCircleLogic extends GetxController { - PageController pageController = - PageController(initialPage: 1, viewportFraction: 0.8); - InterestsBean circle = InterestsBean(lists: []); - ScrollController scrollController = ScrollController(); - final CircleState state = CircleState(); - int page = 1; - - bool isMore = true; - - @override - void onClose() { - // TODO: implement onClose - super.onClose(); - scrollController.dispose(); - } - - @override - void onInit() async { - super.onInit(); - await loadData(); - scrollController.addListener(() { - if (scrollController.position.pixels == - scrollController.position.maxScrollExtent) { - loadMore(); - } - }); - } - - - - Future loadData() async { - var data = await DioManager.instance - .get(url: Api.getMyCircleInterests, params: {"page": page,'page_size':20}); - - var bean = BaseResponse.fromJson( - data, (data) => InterestsBean.fromJson(data)); - - circle = bean.data!; - if (circle.lists.length < 20) { - isMore = false; - } - update(); - } - - loadMore() async { - page = page+1; - var data = await DioManager.instance - .get(url: Api.getMyCircleInterests, params: {"page": page,'page_size':20}); - var bean = BaseResponse.fromJson( - data, (data) => InterestsBean.fromJson(data)); - - - - circle.lists.addAll(bean.data!.lists); - - if (circle.lists.length < 20 * page) { - isMore = false; - } - update(); - } - - outCircle(String interest_id, bool isStatus) async { - var data = await DioManager.instance.post( - url: Api.outCrrcle + interest_id + "/join", - params: {"status": isStatus ? "0" : "1"}); - var bean = BaseResponse.fromJson(data, (data) => data); - if (bean.code == 200) { - circle.lists.forEach((element) { - if (element.id.toString() == interest_id.toString()) { - element.isJoin = !isStatus; - } - }); - } - showOKToast(bean.msg); - } - - Circle getCircleIndex() { - return circle.lists[state.index]; - } - - - updateCircleInfo(Circle circleInfo) { - for(int i = 0; i < circle.lists.length; i++) { - Circle temp = circle.lists[i]; - if (temp.id == circleInfo.id) { - circle.lists[i] = circleInfo; - break; - } - } - update(); - } - -} diff --git a/circle_app/lib/app/my_circle/view.dart b/circle_app/lib/app/my_circle/view.dart deleted file mode 100644 index 07b9996..0000000 --- a/circle_app/lib/app/my_circle/view.dart +++ /dev/null @@ -1,513 +0,0 @@ -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:circle_app/app/circle/logic.dart'; -import 'package:circle_app/app/circle/widgets/info_list_view.dart'; -import 'package:circle_app/app/my_circle/logic.dart'; -import 'package:circle_app/app/select_circle/logic.dart'; -import 'package:circle_app/common/Widgets/circle_share.dart'; -import 'package:circle_app/common/Widgets/text_more.dart'; -import 'package:circle_app/components/my_app_bar.dart'; -import 'package:circle_app/router/app_routers.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:flutter_swiper/flutter_swiper.dart'; -import 'package:get/get.dart'; - -import '../../util/eventBus.dart'; - -class My_circlePage extends StatefulWidget { - My_circlePage({Key? key}) : super(key: key); - @override - _My_circlePageState createState() => _My_circlePageState(); -} - -class _My_circlePageState extends State - with AutomaticKeepAliveClientMixin { - @override - bool get wantKeepAlive => true; - - // 是否需要缓存 - final logic = Get.put(MyCircleLogic()); - - final state = Get.find().state; - - var getContext; - - @override - Widget build(BuildContext context) { - getContext = context; - return Container( - width: MediaQuery.of(context).size.width, - height: MediaQuery.of(context).size.height, - decoration: BoxDecoration( - color: Color(0xFF423055), - image: DecorationImage( - fit: BoxFit.fill, - image: AssetImage(getBaseImage('home_back')))), - child: Scaffold( - backgroundColor: Colors.transparent, - body: SafeArea( - child: GetBuilder(builder: (MyCircleLogic controller) { - return Stack( - children: [ - Container( - width: MediaQuery.of(context).size.width, - height: MediaQuery.of(context).size.height, - child: Container( - child: Column(children: [ - backNavigatorItem(), - // Text(controller.state.msg), - //组件使用 - Expanded( - child: logic.circle.lists.isEmpty - ? !logic.isMore - ? noResultWidget() - : loaddingWidget(logic.isMore) - : ListView.builder( - controller: logic.scrollController, - itemBuilder: (context, index) { - if (index == logic.circle.lists.length) { - return loaddingWidget(logic.isMore); - } - - var bean = logic.circle.lists[index]; - return GestureDetector( - behavior: HitTestBehavior.translucent, - onTap: () { - - Get.toNamed(AppRoutes.Signal_circle_list, arguments: bean.id); - - }, - child: circleInfoItemWidget( - logic.circle.lists[index])); - }, - itemCount: logic.circle.lists.length + 1, - )) - // Swiper( - // itemBuilder: (BuildContext context, int index) { - // var bean = logic.circle.lists[index]; - // // final GlobalKey infoListViewKey = GlobalKey(); - // // MyinfoListViewKey = infoListViewKey; - // return InfoListView( - // index, - // bean, - // controller - // ); - // }, - // index: controller.state.index, - // itemCount: logic.circle.lists.length, - // viewportFraction: 0.93, - // // scale: 0.9, - // loop: false, - // onIndexChanged: (index) { - // controller.state.index = index; - // if (index == logic.circle.lists.length - 1 && controller.isMore) { - // - // logic.loadMore(); - // } - // - // }, - // // pagination: new SwiperPagination(),//如果不填则不显示指示点 - // // control: new SwiperControl(),//如果不填则不显示左右按钮 - // ) - ]), - ), - ), - ], - ); - }), - ), - )); - } - - var MyinfoListViewKey; - - circleInfoItemWidget(Circle bean) { - List urlList = bean.lastJoinUsers; - List widgets = []; - int i = 0; - // print(urlList); - if (null != urlList) { - urlList.forEach((element) { - if (widgets.length > 2) { - return; - } - widgets.add(Positioned( - left: 15.sp * i, - child: circleWidget( - element.avatar! ?? - "https://qiniuyun.leyuan666.com/quanzi/avatar/default.png", - ), - )); - i++; - }); - } - return Container( - margin: EdgeInsets.only(bottom: 10.sp, left: 10.sp, right: 10.sp), - child: Column( - children: [ - ClipRRect( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(10.sp), - topRight: Radius.circular(10.sp)), - child: Container( - padding: EdgeInsets.only(left: 12.sp, right: 12.sp), - height: 72.sp, - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.fill, - image: AssetImage(getCircleImage('top_circle_bg')))), - child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - width: 42.sp, - height: 42.sp, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8.0), - gradient: const LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [ - Color(0xFF71F3F2), - Color(0xFFF558FF), - ], - stops: [0.0365, 0.9427], - ), - ), - padding: EdgeInsets.all(1.sp), - child: ClipRRect( - borderRadius: BorderRadius.circular(8.0), - child: CachedNetworkImage( - imageUrl: bean.image, - width: 40.sp, - height: 40.sp, - fit: BoxFit.cover), - ), - ), - Expanded( - child: Container( - padding: EdgeInsets.only(left: 8.sp, top: 12.sp), - // alignment: Alignment., - height: 72.sp, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - bean.title, - style: TextStyle( - color: Colors.white, - fontSize: 18.sp, - fontWeight: FontWeight.w600), - ), - SizedBox( - height: 4.sp, - ), - Text( - '${convertToTenThousand(bean.viewTotal)}人看过', - textAlign: TextAlign.left, - style: TextStyle( - color: const Color(0xff03FEFB), - fontSize: 12.sp, - ), - ), - ], - ), - )), - GestureDetector( - //加入圈子 - onTap: () async { - if (bean.isJoin) { - Get.bottomSheet( - CircleShare('','',bean), isScrollControlled: true, - enableDrag: false - ); - } else { - await logic.outCircle( - bean.id.toString(), bean.isJoin); - } - }, - child: Stack( - alignment: Alignment.center, - children: [ - Opacity( - opacity: 0.5, - child: Image.asset( - getCircleImage('add'), - width: 60.sp, - ), - ), - Text( - !bean.isJoin ? '申请加入' : '分享有奖', - style: TextStyle( - color: Colors.white, fontSize: 12.sp), - ) - ], - )) - ], - ), - )), - Container( - padding: EdgeInsets.only(left: 12.sp, right: 12.sp), - // height:urlList.length==0?47.sp: 118.sp, - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.fill, - image: AssetImage(getCircleImage('circle_desc')))), - child: Container( - margin: EdgeInsets.only(top: 10.sp, bottom: 10.sp), - child: Column( - children: [ - Container( - margin: EdgeInsets.only(bottom: 7.sp), - width: Get.width - 20.sp, - // height: 50.sp, - child: HideText( - text: bean.intro, - maxWidth: Get.width - 50.sp, - additionText: '查看更多', - maxLines: 3, - style: - TextStyle(color: Colors.white, fontSize: 17.sp), - additionStyle: TextStyle( - color: const Color(0xFFFF4DF6), fontSize: 17.sp), - onTap: () { - _showTextContentDialog( - Get.context!, - bean.intro, - ); - }, - )), - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - // showToast("点个鸡毛,星哥还没做"); - // Get.toNamed(AppRoutes.FriendsActivity,arguments: '3'); - }, - child: urlList.length == 0 - ? Container() - : Row( - children: [ - SizedBox( - height: 30.sp, - width: - 30.0.sp + 15.sp * (widgets.length - 1), - child: Stack( - alignment: Alignment.center, - children: widgets, - ), - ), - SizedBox( - width: 4.sp, - ), - Text( - '${convertToTenThousand(bean.joinTotal)}圈友加入', - style: TextStyle( - color: Colors.white, fontSize: 12.sp), - ), - SizedBox( - width: 4.sp, - ), - // GestureDetector( - // onTap: () { - // // Get.bottomSheet( - // // CircleShare(logic.homeData!.inviteCode!,logic.homeData!.link!,bean), isScrollControlled: true, - // // enableDrag: false - // // ); - // }, - // behavior: HitTestBehavior.opaque, - // child: Container( - // height: 30.sp, - // alignment: Alignment.center, - // child: Image.asset( - // getCircleImage('play'), - // width: 20.sp, - // ), - // ), - // ) - ], - ), - ), - ], - ), - ), - ), - ], - ), - ); - } - - backNavigatorItem() { - return MyAppBar( - centerTitle: '我的圈子', - onCenterTitlePressed: () { - EventBusManager.fire(ScrollToTop()); - }, - actionWdiget: Image.asset( - getCircleImage('callout_icon'), - width: 75.sp, - ), - onPressed: () async { - List numbers = []; - numbers.add(MyConfigData(logic.getCircleIndex().id.toString(), - logic.getCircleIndex().title!, false)); - var data = await Get.toNamed(AppRoutes.Call_out, - arguments: {'numbers': numbers}); - // MyinfoListViewKey.currentState?.loadCallOutListData(); - // logic.refresh(); - // logic.update(); - }, - ); - } - - navigatorItem() { - List urlList = [ - 'https://p3-passport.byteimg.com/img/user-avatar/eb429d4dbb3c246f580a6f7894f2b246~100x100.awebp', - 'https://p3-passport.byteimg.com/img/user-avatar/eb429d4dbb3c246f580a6f7894f2b246~100x100.awebp', - 'https://p3-passport.byteimg.com/img/user-avatar/eb429d4dbb3c246f580a6f7894f2b246~100x100.awebp' - ]; - List widgets = []; - int index = 0; - urlList.forEach((element) { - widgets.add(Positioned( - left: 15.sp * index, - child: circleWidget(element), - )); - index++; - }); - return Container( - width: Get.width, - padding: EdgeInsets.only(left: 18.sp, right: 18.sp), - height: 44.sp, - child: Stack( - alignment: Alignment.center, - children: [ - Positioned( - left: 0, - child: Container( - width: 30.sp * widgets.length, - height: 44.sp, - child: Stack( - alignment: Alignment.centerLeft, - children: widgets, - ), - )), - ShaderMask( - shaderCallback: (Rect bounds) { - return const LinearGradient( - begin: Alignment(0.0, -1.0), - end: Alignment.bottomCenter, - colors: [Color(0xff71F3F2), Color(0xffF657FF)], - ).createShader(Offset.zero & bounds.size); - }, - child: Text( - '发现', - style: TextStyle( - fontSize: 18.sp, - fontWeight: FontWeight.w600, - color: Colors.white, - shadows: [ - Shadow(color: Color(0xffF657FF), offset: Offset(0.0, -1)) - ]), - ), - ), - Positioned( - right: 0, - child: GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.MyCircle, - arguments: '', preventDuplicates: false); - }, - child: Image.asset( - getCircleImage('my_circle'), - width: 64.sp, - ), - )), - ], - ), - ); - } - - circleWidget(String url, {double width = 30}) { - return GestureDetector( - child: Stack( - alignment: Alignment.center, - children: [ - Image.asset( - getCircleImage('avatar_bg'), - width: width.sp, - ), - ClipOval( - child: Image.network( - url, - width: (width - 1).sp, - height: (width - 1).sp, - fit: BoxFit.fill, - ), - ) - ], - )); - } - - void _showTextContentDialog(BuildContext context, String msg) { - showDialog( - context: context, - builder: (BuildContext context) { - return Dialog( - backgroundColor: Colors.transparent, - child: Container( - height: 300.sp, - padding: EdgeInsets.all(1.0), - child: Stack( - children: [ - Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: LinearGradient( - colors: [Color(0xFFDD3DF4), Color(0xFF30FFD9)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Container( - margin: EdgeInsets.all(1.sp), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: LinearGradient( - colors: [Color(0xFF4C3E5F), Color(0xFF324140)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Container( - margin: EdgeInsets.only(top: 24.sp), - child: Column( - children: [ - Container( - margin: EdgeInsets.only( - top: 12.sp, left: 14.sp, right: 14.sp), - alignment: Alignment.topLeft, - child: Text( - msg, - textAlign: TextAlign.left, - style: TextStyle( - color: Color(0xCCF7FAFA), fontSize: 16.sp), - ), - ), - ], - ), - ) - ], - ), - ), - ); - }, - ); - } - - -} diff --git a/circle_app/lib/app/myfeedbacklist/binding.dart b/circle_app/lib/app/myfeedbacklist/binding.dart deleted file mode 100644 index 1d946b0..0000000 --- a/circle_app/lib/app/myfeedbacklist/binding.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:get/get.dart'; - -import 'logic.dart'; - -class MyfeedbacklistBinding extends Bindings { - @override - void dependencies() { - Get.lazyPut(() => MyfeedbacklistLogic()); - } -} diff --git a/circle_app/lib/app/myfeedbacklist/logic.dart b/circle_app/lib/app/myfeedbacklist/logic.dart deleted file mode 100644 index e7cc83a..0000000 --- a/circle_app/lib/app/myfeedbacklist/logic.dart +++ /dev/null @@ -1,110 +0,0 @@ -import 'package:get/get.dart'; -import 'package:pull_to_refresh/pull_to_refresh.dart'; - -import '../../network/api.dart'; -import '../../network/dio_manager.dart'; -import 'state.dart'; - -class MyfeedbacklistLogic extends GetxController { -@override - void onInit() { - // TODO: implement onInit - super.onInit(); - initList(); - } - final MyfeedbacklistState state = MyfeedbacklistState(); - - List lists = []; - final RefreshController refreshController = RefreshController(); - bool isLoad = true; - int page = 1; - initList() async{ - if(page==1){ - lists.clear(); - } - var data = - await DioManager.instance.get(url: Api.getFeedBackList, params: { - 'page': page, - 'page_size':20 - }); - var bean = BaseResponse.fromJson( - data, (data) => PostList.fromJson(data)); - if (bean.isSuccess()) { - lists.addAll(bean.data.lists); - } - isLoad = false; - update(); - if (page == 1) { - refreshController.refreshCompleted(); - } else { - refreshController.loadComplete(); - } - - } -} - - - -class Post { - int id; - String content; - List album; - dynamic reply; - String createTime; - int auditState; - - Post({ - required this.id, - required this.content, - required this.album, - required this.reply, - required this.createTime, - required this.auditState, - }); - - factory Post.fromJson(Map json) { - return Post( - id: json['id'], - content: json['content'], - album: List.from(json['album'].map((album) => Album.fromJson(album))), - reply: json['reply'], - createTime: json['create_time'], - auditState: json['audit_state'], - ); - } -} - -class Album { - int type; - String url; - - Album({ - required this.type, - required this.url, - }); - - factory Album.fromJson(Map json) { - return Album( - type: json['type'], - url: json['url'], - ); - } -} - -class PostList { - List lists; - int total; - - PostList({ - required this.lists, - required this.total, - }); - - factory PostList.fromJson(Map json) { - return PostList( - lists: List.from(json['lists'].map((post) => Post.fromJson(post))), - total: json['total'], - ); - } -} - diff --git a/circle_app/lib/app/myfeedbacklist/state.dart b/circle_app/lib/app/myfeedbacklist/state.dart deleted file mode 100644 index 5bbd9a3..0000000 --- a/circle_app/lib/app/myfeedbacklist/state.dart +++ /dev/null @@ -1,5 +0,0 @@ -class MyfeedbacklistState { - MyfeedbacklistState() { - ///Initialize variables - } -} diff --git a/circle_app/lib/app/myfeedbacklist/view.dart b/circle_app/lib/app/myfeedbacklist/view.dart deleted file mode 100644 index e63aea4..0000000 --- a/circle_app/lib/app/myfeedbacklist/view.dart +++ /dev/null @@ -1,160 +0,0 @@ - -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:pull_to_refresh/pull_to_refresh.dart'; - -import '../../components/my_app_bar.dart'; -import '../../util/util.dart'; -import 'logic.dart'; - -class MyfeedbacklistPage extends StatelessWidget { - MyfeedbacklistPage({Key? key}) : super(key: key); - - final logic = Get.find(); - final state = Get.find().state; - - @override - Widget build(BuildContext context) { - return GetBuilder(builder: (logic) { - return Container( - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage(getBaseImage("home_back")), - fit: BoxFit.cover, - ), - ), - child: Scaffold( - backgroundColor: Colors.transparent, - appBar: const MyAppBar(centerTitle: '我的反馈',), - body: SafeArea( - child: logic.isLoad ? loaddingWidget(true) : logic.lists.isEmpty ? noResultWidget() : SmartRefresher( - controller: logic.refreshController, - onRefresh: _onRefresh, - onLoading: _onLoading, - child: ListView.builder( - - itemCount: logic.lists.length, - itemBuilder: (context, index) { - return ListTile( - title: ListItem(logic.lists[index]), - ); - }, - ), - ), - ),), - ); - }); - } - Widget ListItem(Post item) { - return Column(children: [ - Text(item.createTime , style: TextStyle( - color: Colors.white, - fontSize: 14.0.sp, - ),), - Container( - margin: EdgeInsets.only(bottom: 12.0.sp,top: 12.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8.0.sp), - color: const Color(0xff282733), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - - Container( - padding: - EdgeInsets.symmetric(vertical: 16.0.sp, horizontal: 16.0.sp), - decoration: BoxDecoration( - color: const Color(0xff282733), - borderRadius: BorderRadius.only( - topLeft: Radius.circular(8.0.sp), - topRight: Radius.circular(8.0.sp), - ), - ), - child: Text( - item.content, - style: TextStyle( - color: Colors.white, - fontSize: 14.0.sp, - ), - ), - ), - SizedBox( - height: 120.sp, - child: GridView.builder( - scrollDirection: Axis.vertical, - physics: const NeverScrollableScrollPhysics(), - gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 3, // 每行显示的项目数量 - ), - itemCount:item.album.length, // Replace with your item count - itemBuilder: (context, index) { - - // 后续项目,根据接口获取数据 - // 假设通过接口获取到的数据存储在一个名为 data 的列表中 - // var itemData = data[index - 1]; // 减去第一个固定图片的索引 - return Container( - margin: EdgeInsets.all(5.sp), - child: Center( - child: _buildImageItem( item.album[index].url,// Replace with your item count - logic,index), - ), - ); - - }, - ), - ), - Container( - margin: EdgeInsets.only(left: 16.sp,right: 16.sp,bottom: 16.sp), - child: Text( - item.reply!=null?"反馈回复:"+item.reply:"待回复", - style: TextStyle( - color: Colors.grey, - fontSize: 12.0.sp, - ), - ), - ), - ], - ), - ) - ],); - } - - - - Widget _buildImageItem(String url, MyfeedbacklistLogic controller, int index) { - return ClipRRect( - borderRadius: BorderRadius.circular(0.0), - child: SizedBox( - width: double.infinity, // 设置容器宽度为屏幕宽度 - height: double.infinity, // 设置容器高度为屏幕高度 - child: ClipRRect( - borderRadius: BorderRadius.circular(0.0), - child: GestureDetector( - onTap: () { - // Get.toNamed(AppRoutes.Swiper, arguments: { - // 'imaglist': controller.lists.album, - // 'index': index - // }); - }, - child: Image.network( - fit: BoxFit.cover, - url, - ), - ), - ), - ), - ); - } - - void _onRefresh() async { - logic.page = 1; - logic.initList(); - } - - void _onLoading() async { - logic.page = logic.page + 1; - logic.initList(); - } -} diff --git a/circle_app/lib/app/offaccount/binding.dart b/circle_app/lib/app/offaccount/binding.dart deleted file mode 100644 index a26fffb..0000000 --- a/circle_app/lib/app/offaccount/binding.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:get/get.dart'; - -import 'logic.dart'; - -class OffaccountBinding extends Bindings { - @override - void dependencies() { - Get.lazyPut(() => OffaccountLogic()); - } -} diff --git a/circle_app/lib/app/offaccount/logic.dart b/circle_app/lib/app/offaccount/logic.dart deleted file mode 100644 index 8e0c1b0..0000000 --- a/circle_app/lib/app/offaccount/logic.dart +++ /dev/null @@ -1,42 +0,0 @@ -import 'package:circle_app/util/util.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:get/get.dart'; - -import '../../network/api.dart'; -import '../../network/dio_manager.dart'; -import 'state.dart'; - -class OffaccountLogic extends GetxController { - final OffaccountState state = OffaccountState(); - - - - offaccount() async { - if(state.photoController.text==''){ - showOKToast("请输入手机号"); - return; - } - if(state.photoController.text.length<11){ - showOKToast("请输入正确手机号"); - return; - } - if(state.offReasonMsg=="请选择" && state.editingController.text.isEmpty){ - showOKToast("请选择注销原因"); - return; - } - if(state.offReasonMsg=="其他"){ - showOKToast("请输入注销原因描述"); - return; - } - var data = await DioManager.instance.post(url: Api.offAccount, params: { - "phone": state.photoController.text.toString(), - "reason": state.editingController.text.isNotEmpty ? state.editingController.text : state.offReasonMsg.toString() - }); - var bean = BaseResponse.fromJson(data, (jsonData) => jsonData,); - if(bean.isSuccess()){ - pushLoginPage(); - }else{ - showOKToast(bean.msg); - } - } -} diff --git a/circle_app/lib/app/offaccount/state.dart b/circle_app/lib/app/offaccount/state.dart deleted file mode 100644 index 16ff776..0000000 --- a/circle_app/lib/app/offaccount/state.dart +++ /dev/null @@ -1,12 +0,0 @@ -import 'package:flutter/cupertino.dart'; - -class OffaccountState { - OffaccountState() { - ///Initialize variables - } - - String offReasonMsg = "请选择"; - TextEditingController photoController = TextEditingController(); - TextEditingController editingController = TextEditingController(); - -} diff --git a/circle_app/lib/app/offaccount/view.dart b/circle_app/lib/app/offaccount/view.dart deleted file mode 100644 index 87af129..0000000 --- a/circle_app/lib/app/offaccount/view.dart +++ /dev/null @@ -1,372 +0,0 @@ -import 'dart:async'; - -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; - -import '../../components/my_app_bar.dart'; -import '../../util/util.dart'; -import 'logic.dart'; - -class OffaccountPage extends StatefulWidget { - OffaccountPage({Key? key}) : super(key: key); - - @override - _OffaccountState createState() => _OffaccountState(); -} - -class _OffaccountState extends State { - int countdown = 10; // 初始倒计时时间 - bool isButtonDisabled = false; // 按钮是否禁用 - late Timer timer; - - @override - void initState() { - super.initState(); - startCountdown(); - } - - @override - void dispose() { - timer.cancel(); - super.dispose(); - } - - void startCountdown() { - timer = Timer.periodic(const Duration(seconds: 1), (Timer t) { - setState(() { - if (countdown > 0) { - countdown--; - } else { - timer.cancel(); - } - }); - }); - } - - void handleLogout(OffaccountLogic logic) { - if(countdown > 0 ){ - - }else{ - logic.offaccount(); - // showToast(logic.state.photoController.text.toString()+""); - } - - // 执行注销操作 - } - - @override - Widget build(BuildContext context) { - return GetBuilder(builder: (logic) { - - return Container( - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage(getBaseImage("home_back")), - fit: BoxFit.cover, - ), - ), - child: Scaffold( - backgroundColor: Colors.transparent, - appBar: const MyAppBar(centerTitle: '注销账号'), - body: Scaffold( - backgroundColor: Colors.transparent, - body: SingleChildScrollView( - child: Container( - padding: EdgeInsets.all(16.sp), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - // 注销提示信息 - Text( - "注销后,你的账号将", - style: TextStyle( - color: Colors.white, - fontSize: 16.sp, - ), - ), - SizedBox(height: 8.sp), - Text( - "1、您将无法继续登录使用app;", - style: TextStyle( - color: Color(0xFFB7BECC), - fontSize: 13.sp, - ), - ), - Text( - "2、您的各种资产、收入和道具将全部清零;", - style: TextStyle( - color: Color(0xFFB7BECC), - fontSize: 13.sp, - ), - ), - Text( - "3、您的VIP资格将被取消;", - style: TextStyle( - color: Color(0xFFB7BECC), - fontSize: 13.sp, - ), - ), - Text( - "4、您获得的所有特权都会失效;", - style: TextStyle( - color: Color(0xFFB7BECC), - fontSize: 13.sp, - ), - ), - Text( - "5、注销后将有一段时间不能继续注册。", - style: TextStyle( - color: Color(0xFFB7BECC), - fontSize: 13.sp, - ), - ), - SizedBox(height: 10.sp), - - // 输入手机号或邮箱 - Text( - "请输入绑定的手机号", - style: TextStyle( - color: const Color(0xFF898F99), - fontSize: 10.sp, - ), - ), - SizedBox(height: 10.sp), - TextFormField( - controller: logic.state.photoController, - keyboardType: TextInputType.phone, - inputFormatters: [ - FilteringTextInputFormatter.digitsOnly, - FilteringTextInputFormatter.deny(RegExp('[^0-9]')), - ], - decoration: InputDecoration( - hintText: "请输入手机号", - hintStyle: TextStyle( - color: Colors.white, - fontSize: 14.sp, - ), - filled: true, - fillColor: const Color(0xFF000000), - border: OutlineInputBorder( - borderRadius: BorderRadius.circular(4), - borderSide: BorderSide.none, - ), - contentPadding: EdgeInsets.symmetric(horizontal: 16.sp), - ), - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - ), - // enabled: countdown == 0, // 当倒计时结束后才可编辑 - ), - SizedBox(height: 16.sp), - - // 选择注销原因 - Text( - "注销原因", - style: TextStyle( - color: const Color(0xFF898F99), - fontSize: 10.sp, - ), - ), - SizedBox(height: 10.sp), - Container( - width: double.infinity, - height: 40.sp, - margin: EdgeInsets.only(top: 10.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(4.sp), - color: Color(0xFF000000), - ), - child: TextFormField( - controller: logic.state.editingController, - // enabled: false, - maxLength: 100, - decoration: InputDecoration( - hintText: '请输入注销原因描述', - hintStyle: TextStyle( - color: Color(0xFFF7FAFA), - fontSize: 14.sp, - ), - counterText: '', - border: InputBorder.none, - contentPadding: EdgeInsets.only(left: 16.sp,bottom: 5.sp), - ), - style: TextStyle( - color: Color(0xFFF7FAFA), - fontSize: 14.sp, - ), - ), - ), - SizedBox(height: 10.sp), - - GestureDetector(onTap: () { - showBottomSheetDialog(context,logic); - }, - child: Container( - width: double.infinity, - height: 40.sp, - margin: EdgeInsets.only(top: 10.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(4.sp), - color: const Color(0xFF000000), - ), - child: Row( - children: [ - Expanded( - child: TextFormField( - enabled: false, - decoration: InputDecoration( - hintText: logic.state.offReasonMsg, - hintStyle: TextStyle( - color: const Color(0xFFF7FAFA), - fontSize: 14.sp, - ), - border: InputBorder.none, - contentPadding: EdgeInsets.only(left: 16.sp), - ), - style: TextStyle( - color: const Color(0xFFF7FAFA), - fontSize: 14.sp, - ), - ), - ), - Image.asset( - getHomeImage("icon_in"), - width: 14.sp, - height: 14.sp, - ), - ], - ), - ),) - , - SizedBox(height: 42.sp), - - // 注销按钮 - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - - }, child: Align( - alignment: Alignment.bottomCenter, - child: SizedBox( - width: 160.sp, - child: ElevatedButton( - onPressed: (){ - handleLogout(logic); - }, - style: ButtonStyle( - backgroundColor: MaterialStateProperty.all( - countdown > 0 ? Colors.grey : const Color(0xFF21BEAB), - ), - shape: MaterialStateProperty.all( - RoundedRectangleBorder( - borderRadius: BorderRadius.circular(17.sp), - ), - ), - ), - child: Text( - countdown > 0 ? "注销($countdown s)" : "注销", - ), - ), - ), - ),) - , - ], - ), - ), - ), - ), - ), - ); - }); - } - - - void showBottomSheetDialog(BuildContext context,OffaccountLogic logic) { - showModalBottomSheet( - context: context, - // backgroundColor: Colors.transparent, - - builder: (BuildContext context) { - return Container( - decoration: BoxDecoration( - color: Colors.black, - - // borderRadius: BorderRadius.only( - // topLeft: Radius.circular(20.sp), - // topRight: Radius.circular(20.sp), - // ), - ), - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - buildOptionItem("换平台玩了", context, logic), - buildDivider(), - buildOptionItem("功能体验差", context, logic), - buildDivider(), - buildOptionItem("消息通知比较频繁", context, logic), - buildDivider(), - buildOptionItem("找不到合适的人", context, logic), - buildDivider(), - buildOptionItem("回复消息的人少", context, logic), - buildDivider(), - buildOptionItem("收费有点高", context, logic), - buildDivider(), - buildOptionItem("收费的地方有点多", context, logic), - buildDivider(), - buildOptionItem("其他原因", context, logic), - ], - ), - ); - }, - ); - } - - Widget buildOptionItem(String title, BuildContext context,OffaccountLogic logic) { - return GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - // 处理选项点击事件 - Navigator.pop(context); - logic.state.offReasonMsg = title; - logic.update(); - // 执行相应操作 - // switch (title) { - // case "体验太差": - // - // // 执行体验操作 - // break; - // case "换平台了": - // // 执行换平台操作 - // break; - // case "担心隐私泄露": - // // 执行泄露隐私操作 - // break; - // } - }, - child: Container( - width: Get.width, - alignment: Alignment.center, - padding: EdgeInsets.symmetric(vertical: 16.sp), - child: Text( - title, - style: TextStyle( - fontSize: 16.sp, - color: Colors.white, - ), - ), - ), - ); - } - - Widget buildDivider() { - return Container( - height: 0.5.sp, - color: const Color(0xff2E2E3B), - margin: EdgeInsets.symmetric(horizontal: 16.sp), - ); - } - -} \ No newline at end of file diff --git a/circle_app/lib/app/photoinfo/binding.dart b/circle_app/lib/app/photoinfo/binding.dart deleted file mode 100644 index 97222be..0000000 --- a/circle_app/lib/app/photoinfo/binding.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:get/get.dart'; - -import 'logic.dart'; - -class PhotoinfoBinding extends Bindings { - @override - void dependencies() { - Get.lazyPut(() => PhotoinfoLogic()); - } -} diff --git a/circle_app/lib/app/photoinfo/logic.dart b/circle_app/lib/app/photoinfo/logic.dart deleted file mode 100644 index 33b9970..0000000 --- a/circle_app/lib/app/photoinfo/logic.dart +++ /dev/null @@ -1,99 +0,0 @@ -import 'dart:async'; - -import 'package:circle_app/util/util.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/foundation.dart'; -import 'package:get/get.dart'; - -import '../../network/api.dart'; -import '../../network/dio_manager.dart'; -import '../account/logic.dart'; -import '../login/login/logic.dart'; -import 'state.dart'; - -class PhotoinfoLogic extends GetxController { - final PhotoinfoState state = PhotoinfoState(); - - TextEditingController photoController = TextEditingController(); - // TextEditingController passwordController = TextEditingController(); - TextEditingController newPhotoController = TextEditingController(); - TextEditingController codeController = TextEditingController(); - - int countdownSeconds = 60; - bool isCountingDown = false; - Timer? timer ; - - - - @override - void onClose() { - timer?.cancel(); - super.onClose(); - } - - - - // @override - // void dispose() { - // timer?.cancel(); - // super.dispose(); - // } - - - - bindingPhoto()async{ - var data = await DioManager.instance.put(url: Api.bindingPhoto, params: { - "old_phone": photoController.text.toString(), - "new_phone": newPhotoController.text.toString(), - "code": codeController.text.toString(), - }); - // var activity = Get.find(); - // activity.isVip - var bean = BaseResponse.fromJson(data, (jsonData) => jsonData,); - showOKToast(bean.msg); - if(bean.isSuccess()){ - final accountLogic = Get.find(); - accountLogic.photo = newPhotoController.text.toString(); - accountLogic.update(); - Get.back(); - - } - } - - - void startCountdown() { - isCountingDown = true; - countdownSeconds = 60; - - timer = Timer.periodic(Duration(seconds: 1), (timer) { - if (countdownSeconds > 0) { - countdownSeconds--; - update(); - print(countdownSeconds.toString()); - } else { - isCountingDown = false; - timer?.cancel(); - } - }); - } - - Future getCode() async { - if(!GetUtils.isPhoneNumber(newPhotoController.text)){ - showOKToast("新手机号输入有误"); - return; - } - var data = await DioManager.instance.post(url: Api.sendCode, params: {"phone": newPhotoController.text}); - var bean = BaseResponse.fromJson(data, (data) => Data.fromJson(data)); - showOKToast(bean.msg); - if(kDebugMode){ - if(bean.code==200){ - codeController.text = bean.data!.code.toString(); - startCountdown(); - update(); - } - } - } - - - -} diff --git a/circle_app/lib/app/photoinfo/state.dart b/circle_app/lib/app/photoinfo/state.dart deleted file mode 100644 index 5726ea1..0000000 --- a/circle_app/lib/app/photoinfo/state.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:flutter/cupertino.dart'; - -class PhotoinfoState { - - PhotoinfoState() { - ///Initialize variables - } - - -} diff --git a/circle_app/lib/app/photoinfo/view.dart b/circle_app/lib/app/photoinfo/view.dart deleted file mode 100644 index 933caf4..0000000 --- a/circle_app/lib/app/photoinfo/view.dart +++ /dev/null @@ -1,367 +0,0 @@ - - -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; - -import '../../components/my_app_bar.dart'; -import '../../util/util.dart'; -import 'logic.dart'; - -class PhotoinfoPage extends StatelessWidget { - PhotoinfoPage({Key? key}) : super(key: key); - - // - // final logic = Get.lazyPut(() => PhotoinfoLogic()); - // @override - // void dispose() { - // _timer?.cancel(); - // super.dispose(); - // } - - - - - @override - Widget build(BuildContext context) { - return GetBuilder(builder: (logic) { - return Container( - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage(getBaseImage("home_back")), - fit: BoxFit.cover, - ), - ), - child: Scaffold( - backgroundColor: Colors.transparent, - appBar: const MyAppBar( - centerTitle: '换绑手机号', - ), - body: Scaffold( - backgroundColor: Colors.transparent, - body: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.only( - left: 16.0.sp, - top: 16.0.sp, - right: 16.0.sp, - ), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(4.0.sp), - color: const Color(0xff282733), - ), - height: 40.0.sp, - child: Row( - // mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - alignment: Alignment.centerLeft, - padding: - EdgeInsets.only(left: 16.0.sp, right: 10.sp,top: 4.sp), - child: Text( - "+86", - style: TextStyle( - color: Colors.white, - fontSize: 14.0.sp, - ), - )), - Expanded( - child: Container( - height: 32.sp, - alignment: Alignment.center, - child: TextField( - controller: logic.photoController, - textAlignVertical: TextAlignVertical.center, - inputFormatters: [ - FilteringTextInputFormatter.digitsOnly, - FilteringTextInputFormatter.deny( - RegExp('[^0-9]')), - ], - maxLines: 1, - maxLength: 11, - keyboardType: TextInputType.phone, - decoration: InputDecoration( - hintText: "请输入已绑定手机号", - counterText:"", - hintStyle: TextStyle( - color: Colors.grey.shade300, - fontSize: 14.0.sp, - ), - border: InputBorder.none, - ), - style: TextStyle( - color: Colors.white, - fontSize: 14.0.sp, - height: 1.0.sp, - ), - ), - ), - ) - ], - ), - ), - // Container( - // margin: EdgeInsets.fromLTRB(16.0, 20.0, 16.0, 0.0), - // decoration: BoxDecoration( - // borderRadius: BorderRadius.circular(4.0), - // color: Color(0xff282733), - // ), - // height: 40.0, - // child: Row( - // children: [ - // Container( - // alignment: Alignment.centerLeft, - // padding: EdgeInsets.only(left: 10.0.sp, right: 10.sp), - // child: Image( - // image: AssetImage(getMineImage("im_lock")), - // width: 24.sp, - // height: 24.sp, - // ), - // ), - // Expanded( - // child: Container( - // height: 32.sp, - // alignment: Alignment.center, - // child: TextField( - // controller: _passwordController, - // textAlignVertical: TextAlignVertical.center, - // obscureText: true, // 设置为true以隐藏用户输入的内容 - // - // decoration: InputDecoration( - // hintText: "请输入密码", - // hintStyle: TextStyle( - // color: Colors.grey.shade300, - // fontSize: 14.0, - // ), - // border: InputBorder.none, - // ), - // style: TextStyle( - // color: Colors.white, - // fontSize: 14.0, - // height: 1.0, - // ), - // ), - // ), - // ) - // ], - // ), - // ), - Container( - margin: - EdgeInsets.fromLTRB(16.0.sp, 20.0.sp, 16.0.sp, 0.0.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(4.0.sp), - color: const Color(0xff282733), - ), - height: 40.0.sp, - child: Row( - children: [ - Padding( - padding: - EdgeInsets.only(left: 16.0.sp, right: 10.sp,top: 4.sp), - child: Center( - child: Text( - "+86", - style: TextStyle( - color: Colors.white, - fontSize: 14.0.sp, - ), - ), - )), - Expanded( - child: Container( - height: 32.sp, - alignment: Alignment.center, - child: TextField( - controller: logic.newPhotoController, - textAlignVertical: TextAlignVertical.center, - keyboardType: TextInputType.phone, - inputFormatters: [ - FilteringTextInputFormatter.digitsOnly, - FilteringTextInputFormatter.deny( - RegExp('[^0-9]')), - ], - maxLines: 1, - maxLength: 11, - decoration: InputDecoration( - hintText: "请输入新手机号", - counterText: '', - hintStyle: TextStyle( - color: Colors.grey.shade300, - - fontSize: 14.0.sp, - ), - border: InputBorder.none, - ), - style: TextStyle( - color: Colors.white, - fontSize: 14.0.sp, - height: 1.0.sp, - ), - ), - ), - ) - ], - ), - ), - Row( - children: [ - Expanded( - flex: 4, - child: Container( - margin: EdgeInsets.fromLTRB( - 16.0.sp, 20.0.sp, 8.0.sp, 0.0.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(4.0.sp), - color: const Color(0xff282733), - ), - height: 40.0.sp, - child: Row( - children: [ - Container( - alignment: Alignment.centerLeft, - padding: EdgeInsets.only( - left: 10.0.sp, right: 10.sp), - child: Image( - image: AssetImage(getMineImage("im_shield")), - width: 24.sp, - height: 24.sp, - ), - ), - Expanded( - child: Container( - height: 32.sp, - alignment: Alignment.center, - child: TextField( - controller: logic.codeController, - textAlignVertical: TextAlignVertical.center, - decoration: InputDecoration( - hintText: "请输入验证码", - hintStyle: TextStyle( - color: Colors.grey.shade300, - fontSize: 14.0.sp, - ), - border: InputBorder.none, - ), - style: TextStyle( - color: Colors.white, - fontSize: 14.0.sp, - height: 1.0.sp, - ), - ), - ), - ) - ], - ), - ), - ), - Expanded( - flex: 2, - child: GestureDetector( - onTap: () { - if (!logic.isCountingDown) { - logic.getCode(); - //logic.startCountdown(); - } - }, - child: Container( - margin: EdgeInsets.fromLTRB( - 8.0.sp, 20.0.sp, 16.0.sp, 0.0.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(4.0.sp), - color: const Color(0xff282733), - ), - height: 40.0.sp, - child: Center( - child: Text( - logic.isCountingDown - ? logic.countdownSeconds.toString()+"s" - : '获取验证码', - style: TextStyle( - color: logic.isCountingDown - ? Colors.grey.shade400 - : Colors.white, - fontSize: 14.0.sp, - ), - ), - ), - ), - ), - ), - ], - ), - Padding( - padding: - EdgeInsets.fromLTRB(20.0.sp, 20.0.sp, 20.0.sp, 0.0.sp), - child: Text( - "温馨提示:换绑成功后,将退出软件使用新手机号重新登录,旧手机号无法登录此账号,但可以重新注册。", - style: TextStyle( - color: Colors.grey.shade400, - fontSize: 12.0.sp, - ), - ), - ), - GestureDetector( - onTap: () { - String photo = logic.photoController.text; - // String password = logic.state.passwordController.text; - String newphoto = logic.newPhotoController.text; - String code = logic.codeController.text; - if (photo == "" || photo.length < 11) { - showOKToast("已绑定的手机号输入有误"); - return; - } - // if(password==""){ - // showToast("请输入密码"); - // return ; - // } - if (newphoto == "" || newphoto.length < 11) { - showOKToast("新手机号输入有误"); - return; - } - if (code == "") { - showOKToast("请输入验证码"); - return; - } - logic.bindingPhoto(); - // Perform action on button press - }, - child: Container( - margin: EdgeInsets.fromLTRB( - 72.0.sp, 40.0.sp, 72.0.sp, 0.0.sp), - height: 42.0.sp, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - child: Center( - child: Text( - "确定", - style: TextStyle( - color: Colors.white, - fontSize: 16.0.sp, - ), - ), - ), - ), - ), - ], - ), - ), - ), - ), - ); - }); - } -} diff --git a/circle_app/lib/app/privacy/binding.dart b/circle_app/lib/app/privacy/binding.dart deleted file mode 100644 index 71062ce..0000000 --- a/circle_app/lib/app/privacy/binding.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:get/get.dart'; - -import 'logic.dart'; - -class PrivacyBinding extends Bindings { - @override - void dependencies() { - Get.lazyPut(() => PrivacyLogic()); - } -} diff --git a/circle_app/lib/app/quick/binding.dart b/circle_app/lib/app/quick/binding.dart deleted file mode 100644 index 16a3806..0000000 --- a/circle_app/lib/app/quick/binding.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:get/get.dart'; - -import 'logic.dart'; - -class QuickBinding extends Bindings { - @override - void dependencies() { - Get.lazyPut(() => QuickLogic()); - } -} diff --git a/circle_app/lib/app/quick/logic.dart b/circle_app/lib/app/quick/logic.dart deleted file mode 100644 index 2a591d5..0000000 --- a/circle_app/lib/app/quick/logic.dart +++ /dev/null @@ -1,127 +0,0 @@ -import 'package:circle_app/common/Widgets/base_tip_widget.dart'; -import 'package:circle_app/util/SharedPreferencesHelper.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:pull_to_refresh/pull_to_refresh.dart'; - -import '../../network/api.dart'; -import '../../network/dio_manager.dart'; -import '../circle/logic.dart'; -import '../dialog/ScreenBottomSheetDialog.dart'; -import '../select_circle/logic.dart'; - -class QuickLogic extends GetxController { - - final RefreshController refreshController = RefreshController(); - - List genderList = []; - List lists = []; - int page = 1; - int isVip = 0; - bool isLoad = true; - bool isMore = true; - ScrollController scrollController = ScrollController(); - @override - void onInit() async { - // TODO: implement onInit - super.onInit(); - - initGerder(); - initList(); - } - - - - void initGerder() async { - var data1 = - await DioManager.instance.get(url: Api.getCircleList, params: {}); - var bean1 = BaseResponse.fromJson( - data1, (data1) => ConfigBean.fromJson(data1)); - - if (bean1.isSuccess()) { - ConfigBean configBean = bean1.data!; - - configBean.genderMap.forEach((key, value) { - genderList.add(MyConfigData(key, value, false)); - }); - } - } - - initList() async { - - List wantMeet = []; - genderList.forEach((element) { - if (element.isSelect) { - wantMeet.add(element.id); - } - }); - var data = - await DioManager.instance.post(url: Api.queryQuickChatUserV2, params: { - 'page':page, - 'pageSize':20, - 'wantMeet':wantMeet - }); - if (data['code'] == 200) { - - List list = data['data']['lists']; - if (list.isNotEmpty) { - isLoad = false; - if (page == 1) { - refreshController.refreshCompleted(); - refreshController.loadComplete(); - lists = list; - } else { - - list.forEach((element) { - var info = VicinityItemBean.fromJson(element); - bool isContain = false; - lists.forEach((element1) { - var info1 = VicinityItemBean.fromJson(element1); - if (info.id == info1.id) { - isContain = true; - } - }); - if (!isContain) { - lists.add(element); - } - }); - // lists.addAll(list); - refreshController.loadComplete(); - } - } else { - refreshController.loadNoData(); - isMore = false; - } - } else if (data['code'] == 21201) { - showOepnVipDialog(); - } - update(); - } - - void _onRefresh() async { - page = 1; - initList(); - } - - - void showBottomSheet(BuildContext context) { - showModalBottomSheet( - context: context, - backgroundColor: Colors.transparent, - builder: (BuildContext context) { - return ScreenBottomSheetDialog( - genderList: genderList, - orientationList: [], - roleList:[], - isHaveCity: false, - callback: (genderList, orientationList, roleList) { - _onRefresh(); - }, - ); // Use your custom widget here - }, - ); - } - - -} diff --git a/circle_app/lib/app/quick/view.dart b/circle_app/lib/app/quick/view.dart deleted file mode 100644 index a38ace6..0000000 --- a/circle_app/lib/app/quick/view.dart +++ /dev/null @@ -1,501 +0,0 @@ -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:circle_app/app/msg/logic.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:gradient_borders/box_borders/gradient_box_border.dart'; -import 'package:pull_to_refresh/pull_to_refresh.dart'; - -import '../../common/Widgets/tag_widget.dart'; -import '../../common/colors/app_color.dart'; -import '../../components/my_app_bar.dart'; -import '../../router/app_routers.dart'; -import '../../util/util.dart'; -import '../circle/logic.dart'; -import '../userinfo/logic.dart'; -import 'logic.dart'; -import 'dart:ui' as ui show PlaceholderAlignment; - -class QuickPage extends StatelessWidget { - QuickPage({Key? key}) : super(key: key); - - final logic = Get.find(); - final ctr = Get.find(); - - @override - Widget build(BuildContext context) { - return GetBuilder(builder: (logic) { - return Container( - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage(getBaseImage("bg")), - fit: BoxFit.cover, - ), - ), - child: Scaffold( - backgroundColor: Colors.transparent, - appBar: MyAppBar( - centerTitle: "速聊召唤", - onCenterTitlePressed: () { - ctr.scrollController.animateTo(0, - duration: Duration(milliseconds: 300), - curve: Curves.easeInOut); - }, - actionWdiget: GestureDetector( - onTap: () { - logic.showBottomSheet(context); - }, - child: Image.asset( - getCircleImage('icon_screen'), - width: 30.sp, - ), - ), - ), - body: SafeArea( - child: logic.isLoad - ? loaddingWidget(true) - : logic.lists.isEmpty - ? noResultWidget() - : Stack( - fit: StackFit.expand, - children: [ - SmartRefresher( - controller: logic.refreshController, - onRefresh: _onRefresh, - onLoading: _onLoading, - enablePullUp: true, - child: ListView.builder( - controller: ctr.scrollController, - // padding: EdgeInsets.all(10.sp), - itemCount: ctr.lists.length, - itemBuilder: (context, index) { - var info = - VicinityItemBean.fromJson(ctr.lists[index]); - - return ListItem(info, index); - // return itemWidget(index,logic.lists[index]); - }, - ), - ), - Positioned( - bottom: 60.sp, - right: 0.sp, - child: GestureDetector( - onTap: () { - showTipPop(); - }, - child: Container( - height: 80.sp, - width: 80.sp, - decoration: BoxDecoration( - color: Colors.black.withOpacity(0.75), - // gradient: AppColor.newMainVerLinearGradient, - borderRadius: BorderRadius.circular(40.sp), - ), - alignment: Alignment.center, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset( - getMsgImage('hu_icon'), - width: 30.sp, - ), - Text( - "一呼百应", - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - fontWeight: FontWeight.bold), - ), - SizedBox( - height: 5.sp, - ) - ], - ), - ), - )) - ], - ), - ), - ), - ); - }); - } - - showTipPop() { - Get.bottomSheet( - CupertinoActionSheet( - title: Text( - '上速聊推荐可以让更多人看到你', - style: TextStyle(fontSize: 22.sp), - ), //标题 - //提示内容 - actions: [ - //操作按钮集合 - CupertinoActionSheetAction( - onPressed: () async { - Get.back(); - // Get.find - var result = await logic.queryQuickStart(); - if (result) { - _onRefresh(); - } - }, - child: Text('冲到第一'), - ), - CupertinoActionSheetAction( - onPressed: () { - logic.callOrhers(); - Get.back(); - }, - child: Text('一键呼唤三十位您想认识的人'), - ), - CupertinoActionSheetAction( - onPressed: () { - Get.back(); - logic.stopQueryQuick(); - }, - child: Text('不显示在速聊列表'), - ), - ], - cancelButton: CupertinoActionSheetAction( - //取消按钮 - onPressed: () { - Get.back(); - }, - child: Text('取消'), - ), - ), - isScrollControlled: true); - } - - Widget ListItem(VicinityItemBean item, int index) { - return GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.UserInfoActivity, arguments: item.id.toString()); - }, - child: Container( - margin: EdgeInsets.only(top: 10.sp), - // padding: EdgeInsets.only( left: 8.sp, right: 8.sp), - width: Get.width, - // height: 210.sp + (item.images.isNotEmpty ? 98.sp : 0), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10.sp), - border: Border.all( - color: AppColor.mainColor.withOpacity(0.2), - width: 1.sp, - ), - ), - child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - margin: EdgeInsets.only(right: 2.sp), - child: Row( - children: [ - Container( - margin: EdgeInsets.only(top: 6.sp, left: 2.sp), - child: Stack( - alignment: Alignment.topCenter, - children: [ - Container( - width: 60.sp, - height: 50.sp, - ), - Container( - // margin: EdgeInsets.only(top: 6.sp, ), - width: 41.sp, - height: 41.sp, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(20.5.sp), - gradient: const LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [ - Color(0xFF71F3F2), - Color(0xFFF558FF), - ], - stops: [0.0365, 0.9427], - ), - ), - padding: EdgeInsets.all(2.sp), - child: ClipRRect( - borderRadius: BorderRadius.circular(30.sp), - child: Image.network(item.avatarThumb, - width: 40.sp, height: 40.sp, fit: BoxFit.cover), - ), - ), - if ((item.onlineFlag ?? '').isNotEmpty) - Positioned(bottom: 0,child: Container( - height: 20.sp, - padding: EdgeInsets.only(left: 4.sp,right: 4.sp), - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(10.sp), - color: AppColor.bgColor, - border: GradientBoxBorder( - gradient: - AppColor.mainVerLinearGradient, - width: 1.sp, - ), - ), - alignment: Alignment.center, - child: Text( - item.onlineFlag ?? '', - style: TextStyle( - color: - const Color.fromRGBO(247, 250, 250, 1.0), - fontSize: 10.sp, - ), - ))) - ], - ), - ), - Expanded( - child: Column( - children: [ - Container( - margin: EdgeInsets.only(top: 6.sp, left: 2.sp), - child: Row( - children: [ - Text( - item.nickname, - style: TextStyle( - fontWeight: FontWeight.bold, - color: const Color.fromRGBO(247, 250, 250, 1.0), - fontSize: 16.sp, - ), - ), - SizedBox(width: 8.sp), - UserTagWidget(item.mark!), - Expanded(child: Container()), - - GestureDetector( - onTap: () { - if (item.imId.isNotEmpty) { - pushChatPage(item.id.toString(), item.imId, item.nickname); - } - }, - child: Container( - width: 65.sp, - height: 25.sp, - alignment: Alignment.center, - decoration: BoxDecoration( - gradient: - AppColor.mainVerLinearGradient, - borderRadius: - BorderRadius.circular(12.5.sp)), - margin: EdgeInsets.only(right: 6.sp), - child: Text( - '聊一聊', - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - ), - ), - ), - ), - ], - ), - ), - if (item.gender != null) - Container( - margin: EdgeInsets.only(top: 4.sp, left: 2.sp), - child: _buildInfoRow(item)), - - ], - ), - ) - ], - ), - ), - Container( - // color: Colors.red, - // height: 55.sp, // 设置固定高度 - // constraints: BoxConstraints(maxHeight: 55.sp), - width: Get.width, - margin: EdgeInsets.symmetric(horizontal: 8.0,vertical: 8.sp), - - child: Align( - alignment: Alignment.centerLeft, // 文本左对齐,垂直居中 - child: RichText( - overflow: TextOverflow.ellipsis, - maxLines: 2, - text: TextSpan( - children: [ - WidgetSpan( - alignment: ui.PlaceholderAlignment.middle, - // alignment: Rect.fromCenter(center: center, width: width, height: height), - child: Container( - margin: EdgeInsets.only(right: 2.sp,), - padding: EdgeInsets.only(left: 4.sp,right: 4.sp), - height: 20.sp, - width: item.city!.length > 4 ? 70.sp : item.city!.contains('km') ? item.city!.length * 13.sp : item.city!.length * 20.sp, - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(22), - color: AppColor.cityBgColor, - ), - child: Text( - item.city!, - style: TextStyle( - color: Colors.white, - fontSize: 11.sp, - fontWeight: FontWeight.w600), - ), - ), - ), - TextSpan( - text: item.signature ?? '暂时还没有签名哦~', - // overflow: TextOverflow.ellipsis, - style: TextStyle( - color: Colors.white, - fontSize: 18.sp,)), - ], - ), - ) - ), - ), - if (item.interests.isNotEmpty) - Container( - margin: EdgeInsets.only(left: 8.sp, right: 3.sp, bottom: 5.sp), - child: _buildInterestsListView(item.interests)), - if (item.images.isNotEmpty) - Container( - height: 130, - margin: EdgeInsets.only( - top: 6.sp, left: 10.sp, right: 10.sp, bottom: 10.sp), - child: SingleChildScrollView( - scrollDirection: Axis.horizontal, - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - for (int i = 0; i < item.images.length; i++) - GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.Swiper, arguments: { - 'imaglist': item.images, - 'index': i, - 'userId':item.id.toString() - }); - }, - child: ListAlbumItem(item.images[i], i)), - ], - ), - ), - ), - ]), - ), - ); - } - - Widget ListAlbumItem(String item, int index) { - return Container( - margin: EdgeInsets.symmetric(horizontal: 2.sp), - child: ClipRRect( - borderRadius: BorderRadius.circular(8.sp), - child: CachedNetworkImage( - width: 88.sp, - height: 130.sp, - fit: BoxFit.cover, - imageUrl: item + "?imageView2/1/w/176/h/176/q/75", - ), - ), - ); - } - - Widget _buildInfoRow(var item) { - String ageMsg = - getAgeCOntent(item!.gender, item!.age, item!.role, item!.orientation); - return Row( - children: [ - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color.fromRGBO(141, 255, 248, 1.0), - Color.fromRGBO(181, 211, 255, 1.0), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 2.sp, - bottom: 2.sp, - left: 10.sp, - right: 10.sp, - ), - child: Text( - ageMsg, - style: const TextStyle( - color: Colors.black, - fontSize: 10, - ), - ), - ), - const SizedBox(width: 6), - ], - ); - } - - Widget _buildInterestsListView(List interests) { - return Align( - alignment: Alignment.centerLeft, - child: SingleChildScrollView( - scrollDirection: Axis.horizontal, - child: Row( - children: [ - for (int index = 0; index < interests.length; index++) - GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.Signal_circle_list, - arguments: interests[index].id); - }, - child: Container( - margin: EdgeInsets.only(right: 11.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17.0), - border: GradientBoxBorder( - gradient: - AppColor.mainVerLinearGradient, - width: 0.5.sp, - ), - color: const Color(0xFF392D53), - ), - child: Padding( - padding: EdgeInsets.only( - top: 2.sp, - bottom: 2.sp, - left: 15.sp, - right: 15.sp, - ), - child: Center( - child: Text( - interests[index].title, - style: const TextStyle( - fontSize: 13.0, - color: Colors.white, - ), - ), - ), - ), - ), - ), - ], - ), - ), - ); - } - - void _onRefresh() async { - ctr.page = 1; - ctr.initList(); - } - - void _onLoading() async { - ctr.page = ctr.page + 1; - ctr.initList(); - } -} diff --git a/circle_app/lib/app/report/binding.dart b/circle_app/lib/app/report/binding.dart deleted file mode 100644 index 9d00222..0000000 --- a/circle_app/lib/app/report/binding.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:get/get.dart'; - -import 'logic.dart'; - -class ReportBinding extends Bindings { - @override - void dependencies() { - Get.lazyPut(() => ReportLogic()); - } -} diff --git a/circle_app/lib/app/report/logic.dart b/circle_app/lib/app/report/logic.dart deleted file mode 100644 index 6bba0f4..0000000 --- a/circle_app/lib/app/report/logic.dart +++ /dev/null @@ -1,101 +0,0 @@ -import 'package:circle_app/util/util.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; -import 'package:get/get.dart'; -import 'package:image_picker/image_picker.dart'; - -import '../../common/config.dart'; -import '../../network/api.dart'; -import '../../network/dio_manager.dart'; -import '../../util/qiniu.dart'; -import '../call_out/logic.dart'; -import 'state.dart'; - -class ReportLogic extends GetxController { - final ReportState state = ReportState(); - var userId = Get.arguments["userId"] ?? ""; - int myPosition = -1; - TextEditingController textEditingController = TextEditingController(); - List arrList = [ - MyObject("涉嫌欺诈", false), - MyObject("色情低俗", false), - MyObject("侮辱谩骂", false), - MyObject("骚扰广告", false), - MyObject("扰乱平台", false), - MyObject("散布谣言", false), - MyObject("盗图侵权", false), - MyObject("其他违规", false) - ]; - - List getItemList() { - return arrList; - } - - onSubmit()async{ - if(myPosition== -1){ - showOKToast("请选择举报类目"); - return; - } - List myBean = []; - state.imaglist.forEach((element) { - myBean.add(MyBean(type: 1, url: element).toJson()); - }); - - - var data = await DioManager.instance.post(url: Api.postReport, params: { - "user_id" : userId, - "words" : textEditingController.text, - "obj_type" :1, - "obj_id":userId, - "reason":arrList[myPosition].name, - "album" :myBean - }); - var bean = BaseResponse.fromJson(data, (data) => data); - if(bean.isSuccess()){ - Get.back(); - } - showOKToast(bean.msg); - } - - final ImagePicker _picker = ImagePicker(); - - var quToken = ''; - - @override - void onInit() async{ - super.onInit(); - var data = - await DioManager.instance.get(url: Api.getqiniuToken, params: {}); - var bean = BaseResponse.fromJson( - data, (data) => QnTokenData.fromJson(data)); - if(bean.isSuccess()){ - quToken = bean.data!.token.toString(); - } - } - - Future getImageFile() async { - checkPhotosStatus(); - try { - final XFile? pickedFile = await _picker.pickImage( - source: ImageSource.gallery, - ); - if(null==pickedFile){ - return; - } - SmartDialog.showLoading(); - uploadImage(quToken,pickedFile!,CONFIG.USER_INFO_AVATAR,(result){ - SmartDialog.dismiss(force: true); - state.imaglist.add(result); - update(); - }); - } catch (e) { - } - } -} - -class MyObject { - String name; - bool isSelect; - - MyObject(this.name, this.isSelect); -} diff --git a/circle_app/lib/app/report/state.dart b/circle_app/lib/app/report/state.dart deleted file mode 100644 index d329224..0000000 --- a/circle_app/lib/app/report/state.dart +++ /dev/null @@ -1,13 +0,0 @@ -import 'logic.dart'; - -class ReportState { - List imaglist = []; - ReportState() { - - ///Initialize variables - /// - } - - - -} \ No newline at end of file diff --git a/circle_app/lib/app/report/view.dart b/circle_app/lib/app/report/view.dart deleted file mode 100644 index 44dc29a..0000000 --- a/circle_app/lib/app/report/view.dart +++ /dev/null @@ -1,327 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; - -import '../../components/my_app_bar.dart'; -import '../../router/app_routers.dart'; -import '../../util/util.dart'; -import 'logic.dart'; - -class ReportPage extends StatelessWidget { - ReportPage({Key? key}) : super(key: key); - - final logic = Get.find(); - final state = Get.find().state; - - @override - Widget build(BuildContext context) { - return GetBuilder(builder: (ReportLogic controller) { - return GestureDetector( - onTap: () { - FocusManager.instance.primaryFocus?.unfocus(); - }, - child: Container( - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage(getBaseImage("home_back")), - fit: BoxFit.cover, - ), - ), - child: Scaffold( - backgroundColor: Colors.transparent, - appBar: MyAppBar( - centerTitle: '举报', - actionWdiget: const Text( - "提交", - style: TextStyle(color: Colors.white), - ), - onPressed: () { - logic.onSubmit(); - }, - ), - body: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only(left: 16.sp, top: 16.sp), - child: Text( - '举报类目', - style: TextStyle( - color: Colors.white, - fontSize: 16.sp, - ), - ), - ), - SizedBox( - height: 140.sp, - child: _reportAdapter(controller), - ), - Expanded( - child: Padding( - padding: const EdgeInsets.fromLTRB(16, 20, 16, 0), - child: ListView( - children: [ - Text( - '详细截图(请至少上传一张图片,帮助审核处理)', - style: TextStyle( - color: Colors.white70, - fontSize: 16.sp, - ), - ), - SizedBox(height: 20.sp), - // 添加 RecyclerView(ListView) 的内容 - // 例如: MyRecyclerViewWidget(), - SizedBox( - height: 150.sp, - child: _imageAdapter(controller)), - Text( - '补充说明', - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - ), - ), - const SizedBox(height: 30), - Container( - // margin: EdgeInsets.only(left: 10, right: 10), - height: 200.sp, - width: double.infinity, - decoration: BoxDecoration( - color: const Color(0xFF4C3E5F), - borderRadius: BorderRadius.circular(10), - ), - padding: EdgeInsets.all(16.sp), - child: Stack( - children: [ - SizedBox( - height: 200.sp, - child: TextField( - controller: controller.textEditingController, - onChanged: (value) { - controller.update(); - }, - style: TextStyle( - color: Colors.white, fontSize: 14.0.sp), - maxLines: 32, - maxLength: 200, - decoration: InputDecoration( - hintStyle: TextStyle( - color: const Color.fromRGBO( - 255, 255, 255, 0.6), - fontSize: 14.sp), - hintText: '违规补充说明,帮助审核处理,选填', - border: InputBorder.none, - - counter: const Text('')), - ), - ), - Positioned( - // right: 1.sp, - top: 150.sp, - child: Text( - '${controller.textEditingController.text.length}/200', - style: TextStyle( - color: Colors.white, fontSize: 12.sp), - )), - - - - ], - ) - - - // Stack( - // children: [ - // TextField( - // decoration: InputDecoration.collapsed( - // hintText: '违规补充说明,帮助审核处理,选填', - // border: InputBorder.none, - // hintStyle: TextStyle( - // color: Color(0xFFB7BECC), - // fontSize: 12, - // ), - // ), - // maxLength: 200, - // style: TextStyle( - // color: Color(0xFFFFFFFF), - // fontSize: 12, - // ), - // ), - // ], - // ), - ), - ], - ), - ), - ), - ], - ), - ), - ), - ); - }); - } - - Widget _reportAdapter(ReportLogic controller) { - return GridView.builder( - gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 3, - // crossAxisSpacing: 6.sp, - childAspectRatio: 3, - ), - itemCount: controller.getItemList().length, - shrinkWrap: true, - itemBuilder: (BuildContext context, int index) { - return GestureDetector( - onTap: () { - if(controller.myPosition != -1){ - controller.arrList[controller.myPosition].isSelect = false; - } - controller.myPosition = index; - controller.arrList[index].isSelect = true; - controller.update(); - }, - child: _getItemSelect(controller.arrList[index]), - ); - }, - ); - } - - Widget _imageAdapter(ReportLogic controller) { - return GridView.builder( - gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 3, // 每行显示的项目数量 - ), - itemCount: controller.state.imaglist.length<3 ? controller.state.imaglist.length+1: controller.state.imaglist.length, // Replace with your item count// 项目的总数量,包括固定图片和接口获取的项目 - itemBuilder: (BuildContext context, int index) { - if (index == 0&&controller.state.imaglist.length<3) { - // 第一个项目,显示固定的图片 - return GestureDetector( - onTap: () { - controller.getImageFile(); - }, - child: Container( - margin: EdgeInsets.all(5.sp), - child: Image( - image: AssetImage(getMineImage("icon_img_add")), - ), - ), - ); - } else { - // 后续项目,根据接口获取数据 - // 假设通过接口获取到的数据存储在一个名为 data 的列表中 - // var itemData = data[index - 1]; // 减去第一个固定图片的索引 - return Container( - margin: EdgeInsets.all(5.sp), - child: Center( - child: _buildImageItem(controller.state.imaglist.length<3 ? - controller.state.imaglist[index-1]: controller.state.imaglist[index], // Replace with your item count - controller,controller.state.imaglist.length<3 ? index-1:index ), - ), - ); - } - }, - ); - } - - Widget _getItemSelect(MyObject bean) { - if (bean.isSelect) { - return Container( - margin: - EdgeInsets.only(left: 8.sp, right: 8.sp, top: 6.sp, bottom: 6.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(20.sp), - gradient: const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: - EdgeInsets.only(top: 2.sp, bottom: 2.sp, left: 15.sp, right: 15.sp), - child: Center( - child: Text( - bean.name, - style: TextStyle( - color: Colors.white, - fontSize: 11.sp, - ), - ), - ), - ); - } else { - return Container( - margin: - EdgeInsets.only(left: 8.sp, right: 8.sp, top: 6.sp, bottom: 6.sp), - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(20.0), // 设置圆角半径 - border: Border.all( - color: const Color(0xFF392D53), - ), - color: const Color(0xFF392D53), - ), - child: Padding( - padding: EdgeInsets.only( - top: 2.sp, bottom: 2.sp, left: 15.sp, right: 15.sp), - child: Center( - child: Text( - bean.name, - style: const TextStyle( - fontSize: 11.0, - color: Colors.white, - ), - ), - ), - ), - ), - ); - } - } - - Widget _buildImageItem(String url, ReportLogic controller, int index) { - return Stack( - children: [ - ClipRRect( - borderRadius: BorderRadius.circular(0.0), - child: SizedBox( - width: double.infinity, // 设置容器宽度为屏幕宽度 - height: double.infinity, // 设置容器高度为屏幕高度 - child: ClipRRect( - borderRadius: BorderRadius.circular(0.0), - child: GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.Swiper, arguments: { - 'imaglist': controller.state.imaglist, - 'index': index - }); - }, - child: Image.network( - fit: BoxFit.cover, - url, - ), - ), - ), - ), - ), - Positioned( - top: 0, - right: 0, - child: GestureDetector( - onTap: () { - controller.state.imaglist.removeAt(index); - controller.update(); - }, - child: Image( - image: AssetImage(getMineImage("icon_img_del")), - width: 20.sp, - height: 20.sp, - ), - )) - ], - ); - } -} diff --git a/circle_app/lib/app/reset_pwd/binding.dart b/circle_app/lib/app/reset_pwd/binding.dart deleted file mode 100644 index ec89350..0000000 --- a/circle_app/lib/app/reset_pwd/binding.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:get/get.dart'; - -import 'logic.dart'; - -class Reset_pwdBinding extends Bindings { - @override - void dependencies() { - Get.lazyPut(() => Reset_pwdLogic()); - } -} diff --git a/circle_app/lib/app/reset_pwd/logic.dart b/circle_app/lib/app/reset_pwd/logic.dart deleted file mode 100644 index 119885e..0000000 --- a/circle_app/lib/app/reset_pwd/logic.dart +++ /dev/null @@ -1,94 +0,0 @@ -import 'dart:async'; - -import 'package:circle_app/network/api.dart'; -import 'package:circle_app/network/dio_manager.dart'; -import 'package:circle_app/util/SharedPreferencesHelper.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; -import 'package:get/get.dart'; - -import '../login/login/logic.dart'; -import 'state.dart'; - -class Reset_pwdLogic extends GetxController { - final Reset_pwdState state = Reset_pwdState(); - var codeController = TextEditingController(); - var new_passwordController = TextEditingController(); - var config_passwordController = TextEditingController(); - - bool sendCodeBtn = false; //判断发送短信按钮是否点击过标志 - int seconds = 60; - Timer? t; - - @override - void dispose() { - super.dispose(); - codeController.dispose(); - new_passwordController.dispose(); - config_passwordController.dispose(); - t?.cancel(); - } - - - //倒计时 - starDownTimer() async { - if (sendCodeBtn == false && seconds == 60) { - sendCodeBtn = true; - - getCode(); - } - } - - Future getCode() async { - SmartDialog.showLoading(msg: '正在发送中'); - var sp = await SharedPreferencesHelper.getInstance(); - var data = await DioManager.instance.post( - url: Api.sendCode, params: {"phone": sp.getString(SharedPreferencesHelper.LOGINPHONE)}); - var bean = BaseResponse.fromJson(data, (data) => Data.fromJson(data)); - - SmartDialog.dismiss(); - if (bean.code == 200) { - showOKToast('验证码已发送,稍后可前往短信查看'); - if (bean.data!.code != null) { - codeController.text = bean.data!.code.toString(); - update(); - } - - t = Timer.periodic(const Duration(milliseconds: 1000), (timer) { - seconds--; - if (seconds == 0) { - t?.cancel(); //清除 - sendCodeBtn = false; - seconds = 60; - } - update(); - }); - } else { - sendCodeBtn = false; - showOKToast(bean.msg); - } - } - - void setPassword() async { - if (codeController.text.isEmpty) { - showOKToast('请输入验证码'); - } else if (new_passwordController.text.isEmpty) { - showOKToast('请输入6-12位新密码'); - } else if (config_passwordController.text.isEmpty) { - showOKToast('再次输入新密码'); - } else if (new_passwordController.text != config_passwordController.text) { - showOKToast('新密码和确认密码不一致哦'); - } else { - var sp = await SharedPreferencesHelper.getInstance(); - var result = await DioManager.instance.put(url: Api.resetPassword,params: {'new_password':new_passwordController.text,'phone':sp.getString(SharedPreferencesHelper.LOGINPHONE),'verify_code':codeController.text}); - if (result['code'] == 200) { - showOKToast('密码重置成功'); - Get.back(); - Get.back(); - } else { - showOKToast(result['msg']); - } - } - } -} diff --git a/circle_app/lib/app/reset_pwd/state.dart b/circle_app/lib/app/reset_pwd/state.dart deleted file mode 100644 index 7d3d376..0000000 --- a/circle_app/lib/app/reset_pwd/state.dart +++ /dev/null @@ -1,5 +0,0 @@ -class Reset_pwdState { - Reset_pwdState() { - ///Initialize variables - } -} diff --git a/circle_app/lib/app/reset_pwd/view.dart b/circle_app/lib/app/reset_pwd/view.dart deleted file mode 100644 index 81a34ea..0000000 --- a/circle_app/lib/app/reset_pwd/view.dart +++ /dev/null @@ -1,198 +0,0 @@ -import 'package:circle_app/common/colors/app_color.dart'; -import 'package:circle_app/components/my_app_bar.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; - -import 'logic.dart'; - -class Reset_pwdPage extends StatelessWidget { - Reset_pwdPage({Key? key}) : super(key: key); - - final logic = Get.find(); - final state = Get.find().state; - - @override - Widget build(BuildContext context) { - return GetBuilder(builder: (logic) { - - return Stack( - children: [ - Container( - width: Get.width, - height: Get.height, - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage(getBaseImage('home_back')), - fit: BoxFit.cover, - ), - ), - ), - Scaffold( - backgroundColor: Colors.transparent, - resizeToAvoidBottomInset: false, - appBar: const MyAppBar( - centerTitle: '重置密码', - ), - body: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - FocusManager.instance.primaryFocus?.unfocus(); - }, - child: Container( - child: Column( - children: [ - Container( - height: 40.sp, - margin: EdgeInsets.symmetric(horizontal: 16.sp,vertical: 10.sp), - - // decoration: BoxDecoration( - // color: Color(0xff282733), - // borderRadius: BorderRadius.circular(8.sp) - // ), - child: Row( - children: [ - Expanded( - child: Container( - padding: EdgeInsets.symmetric(horizontal: 10.sp), - margin: EdgeInsets.only(right: 15.sp), - decoration: BoxDecoration( - color: Color(0xff282733), - borderRadius: BorderRadius.circular(8.sp) - ), - child: TextFormField( - controller: logic.codeController, - - decoration: const InputDecoration( - focusedBorder: UnderlineInputBorder( - borderSide: BorderSide(color: Colors.transparent), - ), - enabledBorder: UnderlineInputBorder( - borderSide: BorderSide(color: Colors.transparent), - ), - hintText: '请输入验证码', - hintStyle: TextStyle(color: Color(0xFFB7BECC)), - counterText: '' - ), - maxLength: 6, - style: const TextStyle(color: Color(0xFFB7BECC)), - ), - ), - ), - GestureDetector( - onTap: () { - logic.starDownTimer(); - }, - child: Container( - alignment: Alignment.center, - width: 76.sp, - height: 29.sp, - decoration: BoxDecoration( - color: logic.sendCodeBtn - ? Colors.white30 - : const Color( - 0xff0AFCFF), - borderRadius: - BorderRadius.circular( - 29.sp / 2)), - child: Text( - logic.sendCodeBtn - ? '${logic.seconds}s' - : '获取验证码', - style: TextStyle( - color: logic.sendCodeBtn - ? Colors.white - : Colors.black, - fontSize: 12.sp), - ), - ), - ) - ], - ), - ), - Container( - height: 40.sp, - margin: EdgeInsets.symmetric(horizontal: 16.sp,vertical: 10.sp), - padding: EdgeInsets.symmetric(horizontal: 10.sp), - decoration: BoxDecoration( - color: Color(0xff282733), - borderRadius: BorderRadius.circular(8.sp) - ), - child: TextFormField( - controller: logic.new_passwordController, - decoration: const InputDecoration( - - focusedBorder: UnderlineInputBorder( - borderSide: BorderSide(color: Colors.transparent), - ), - enabledBorder: UnderlineInputBorder( - borderSide: BorderSide(color: Colors.transparent), - ), - hintText: '请输入6-12位新密码', - hintStyle: TextStyle(color: Color(0xFFB7BECC)), - counterText: '' - ), - maxLength: 12, - style: const TextStyle(color: Color(0xFFB7BECC)), - ), - ), - Container( - height: 40.sp, - margin: EdgeInsets.symmetric(horizontal: 16.sp,vertical: 10.sp), - padding: EdgeInsets.symmetric(horizontal: 10.sp), - decoration: BoxDecoration( - color: Color(0xff282733), - borderRadius: BorderRadius.circular(8.sp) - ), - child: TextFormField( - controller: logic.config_passwordController, - decoration: const InputDecoration( - focusedBorder: UnderlineInputBorder( - borderSide: BorderSide(color: Colors.transparent), - ), - enabledBorder: UnderlineInputBorder( - borderSide: BorderSide(color: Colors.transparent), - ), - hintText: '再次输入新密码', - hintStyle: TextStyle(color: Color(0xFFB7BECC)), - counterText: '' - ), - maxLength: 12, - style: const TextStyle(color: Color(0xFFB7BECC)), - ), - ), - - - GestureDetector( - onTap: () { - logic.setPassword(); - }, - child: Container( - width: double.infinity, - margin: EdgeInsets.symmetric(horizontal: 97.sp,vertical: 10.sp), - height: 48.sp, - alignment: Alignment.center, - decoration: BoxDecoration( - gradient: AppColor.mainVerLinearGradient, - borderRadius: BorderRadius.circular(24.sp), - ), - child: Text( - '确定', - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.white, - fontSize: 18.sp, - ), - ), - ), - ), - ], - ), - ), - )), - ], - ); - }); - } -} diff --git a/circle_app/lib/app/select_circle/binding.dart b/circle_app/lib/app/select_circle/binding.dart deleted file mode 100644 index 0212c40..0000000 --- a/circle_app/lib/app/select_circle/binding.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:get/get.dart'; - -import 'logic.dart'; - -class Select_circleBinding extends Bindings { - @override - void dependencies() { - Get.lazyPut(() => Select_circleLogic()); - } -} diff --git a/circle_app/lib/app/select_circle/logic.dart b/circle_app/lib/app/select_circle/logic.dart deleted file mode 100644 index 428d07a..0000000 --- a/circle_app/lib/app/select_circle/logic.dart +++ /dev/null @@ -1,81 +0,0 @@ -import 'package:get/get.dart'; - -import '../../network/api.dart'; -import '../../network/dio_manager.dart'; -import 'state.dart'; - -class Select_circleLogic extends GetxController { - late Map interestMap = Get.arguments['interestMap']; - bool isRodio = Get.arguments['isRodio']; - List selectCircle = Get.arguments['selectCircle']; - var selectIndex = -1; - - @override - void onInit() async { - if (isRodio) { - List> entries = interestMap.entries.toList(); - - for (var entry in entries.asMap().entries) { - MyConfigData bean = - MyConfigData(entry.value.key, entry.value.value, false); - if (selectCircle.isEmpty) { - arrList.add(bean); - } else { - selectCircle.forEach((element) { - if (entry.value.key == element.id) { - bean.isSelect = true; - selectIndex = entry.key; - } - arrList.add(bean); - }); - } - } - } else { - interestMap.forEach((key, value) { - MyConfigData bean = MyConfigData(key, value, false); - selectCircle.forEach((element) { - if (key == element.id) { - bean.isSelect = true; - } - }); - arrList.add(bean); - }); - } - print(arrList.length.toString()); - update(); - } - - final Select_circleState state = Select_circleState(); - List arrList = []; - - List getItemList() { - return arrList; - } -} - -class ConfigBean { - late Map genderMap; - late Map roleMap; - late Map orientationMap; - late Map interestMap; - - ConfigBean.fromJson(Map json) { - genderMap = json['gender_map']; - roleMap = json['role_map']; - orientationMap = json['orientation_map']; - List list = json['interests']; - interestMap = {}; - list.forEach((element) { - interestMap[element['id'].toString()] = element['title']; - }); - } -} - -class MyConfigData { - String id; - - String name; - bool isSelect; - - MyConfigData(this.id, this.name, this.isSelect); -} diff --git a/circle_app/lib/app/select_circle/state.dart b/circle_app/lib/app/select_circle/state.dart deleted file mode 100644 index a3417eb..0000000 --- a/circle_app/lib/app/select_circle/state.dart +++ /dev/null @@ -1,5 +0,0 @@ -class Select_circleState { - Select_circleState() { - ///Initialize variables - } -} diff --git a/circle_app/lib/app/select_circle/view.dart b/circle_app/lib/app/select_circle/view.dart deleted file mode 100644 index 9cc9312..0000000 --- a/circle_app/lib/app/select_circle/view.dart +++ /dev/null @@ -1,124 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; - -import '../../components/my_app_bar.dart'; -import '../../util/util.dart'; -import 'logic.dart'; - -class Select_circlePage extends StatelessWidget { - Select_circlePage({Key? key}) : super(key: key); - - final logic = Get.find(); - final state = Get.find().state; - - @override - Widget build(BuildContext context) { - return GetBuilder(builder: (Select_circleLogic controller) { - return Container( - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage(getBaseImage("home_back")), - fit: BoxFit.cover, - ), - ), - child: Scaffold( - backgroundColor: Colors.transparent, - appBar: MyAppBar( - centerTitle: '选择感兴趣的圈子', - actionWdiget: Text( - "完成", - style: TextStyle(color: Colors.white), - ), - onPressed: () { - // showToast("提交"); - List numbers = []; - controller.arrList.forEach((element) { - if (element.isSelect) { - numbers.add(element); - } - }); - if (numbers.length > 0) { - Navigator.pop(context, numbers); - } else { - showOKToast("请选择兴趣圈子"); - } - }, - ), - body: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: Container( - margin: EdgeInsets.only(top: 20.sp), - child: _reportAdapter(controller), - ), - ), - ], - ), - ), - ); - }); - } - - - Widget _reportAdapter(Select_circleLogic controller) { - return GridView.builder( - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 3, - // crossAxisSpacing: 6.sp, - mainAxisSpacing: 10.sp, - childAspectRatio: 3, - ), - itemCount: controller.getItemList().length, - shrinkWrap: true, - itemBuilder: (BuildContext context, int index) { - return GestureDetector( - onTap: () { - if (controller.isRodio) { - if(controller.selectIndex != -1){ - controller.arrList[controller.selectIndex].isSelect = false; - print(controller.selectIndex); - } - controller.selectIndex = index; - controller.arrList[index].isSelect = true; - controller.update(); - } else { - controller.arrList[index].isSelect = !controller.arrList[index].isSelect; - controller.update(); - } - }, - child: _getItemSelect(controller.arrList[index]), - ); - }, - ); - } - - Widget _getItemSelect(MyConfigData bean) { - return Container( - margin: - EdgeInsets.only(left: 8.sp, right: 8.sp, top: 6.sp, bottom: 6.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(20.sp), - gradient: LinearGradient( - colors: [ - bean.isSelect? Color(0xFF06F9FA): Color(0xFF392D53), - bean.isSelect? Color(0xFFDC5BFD): Color(0xFF392D53), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - child: Center( - child: Text( - bean.name, - style: TextStyle( - color: Colors.white, - fontSize: 11.sp, - ), - ), - ), - ); - - } -} diff --git a/circle_app/lib/app/setpassword/binding.dart b/circle_app/lib/app/setpassword/binding.dart deleted file mode 100644 index c7da2c0..0000000 --- a/circle_app/lib/app/setpassword/binding.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:get/get.dart'; - -import 'logic.dart'; - -class SetpasswordBinding extends Bindings { - @override - void dependencies() { - Get.lazyPut(() => SetpasswordLogic()); - } -} diff --git a/circle_app/lib/app/setpassword/logic.dart b/circle_app/lib/app/setpassword/logic.dart deleted file mode 100644 index 25a8d76..0000000 --- a/circle_app/lib/app/setpassword/logic.dart +++ /dev/null @@ -1,30 +0,0 @@ -import 'package:flutter/cupertino.dart'; -import 'package:get/get.dart'; - -import '../../network/api.dart'; -import '../../network/dio_manager.dart'; -import '../../router/app_routers.dart'; -import '../../util/util.dart'; -import 'state.dart'; - -class SetpasswordLogic extends GetxController { - final SetpasswordState state = SetpasswordState(); - TextEditingController passwordController = TextEditingController(); - bool isSuccess = false; - - setPassword() async { - if (isSuccess) { - var data = await DioManager.instance.put( - url: Api.UpdataUserInfo, params: { - 'password': passwordController.text, - }); - var bean = BaseResponse.fromJson(data, (data) => data); - if (bean.isSuccess()) { - showOKToast('密码设置成功'); - Get.offAllNamed(AppRoutes.Home); - } else { - showOKToast(bean.msg); - } - } - } -} \ No newline at end of file diff --git a/circle_app/lib/app/setpassword/state.dart b/circle_app/lib/app/setpassword/state.dart deleted file mode 100644 index 93c3e22..0000000 --- a/circle_app/lib/app/setpassword/state.dart +++ /dev/null @@ -1,5 +0,0 @@ -class SetpasswordState { - SetpasswordState() { - ///Initialize variables - } -} diff --git a/circle_app/lib/app/setpassword/view.dart b/circle_app/lib/app/setpassword/view.dart deleted file mode 100644 index 7ea8ec8..0000000 --- a/circle_app/lib/app/setpassword/view.dart +++ /dev/null @@ -1,126 +0,0 @@ -import 'dart:math'; - -import 'package:circle_app/common/colors/app_color.dart'; -import 'package:circle_app/components/my_app_bar.dart'; -import 'package:circle_app/router/app_routers.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; - -import '../../util/util.dart'; -import 'logic.dart'; - -class SetpasswordPage extends StatelessWidget { - SetpasswordPage({Key? key}) : super(key: key); - - final logic = Get.find(); - final state = Get.find().state; - - @override - Widget build(BuildContext context) { - return GetBuilder(builder: (logic) { - return Stack( - children: [ - Container( - width: Get.width, - height: Get.height, - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage(getBaseImage('bg')), - fit: BoxFit.cover, - ), - ), - ), - Scaffold( - backgroundColor: Colors.transparent, - resizeToAvoidBottomInset: false, - appBar: const MyAppBar( - centerTitle: '设置密码', - ), - body: GestureDetector( - onTap: () { - FocusManager.instance.primaryFocus?.unfocus(); - }, - child: Container( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - height: 200.sp, - ), - Container( - margin: EdgeInsets.symmetric(horizontal: 73.sp), - child: TextFormField( - controller: logic.passwordController, - onChanged: (msg) { - logic.isSuccess = msg.length > 5 ? true : false; - logic.update(); - }, - - obscureText: true, - autofocus: true, - decoration: InputDecoration( - focusedBorder: UnderlineInputBorder( - borderSide: BorderSide(color: AppColor.mainColor), - ), - enabledBorder: UnderlineInputBorder( - borderSide: BorderSide(color: AppColor.mainColor), - ), - hintText: '请输入至少6-12位数密码', - hintStyle: TextStyle(color: Color(0xFFB7BECC)), - ), - maxLength: 12, - style: const TextStyle(color: Color(0xFFB7BECC)), - ), - ), - - Container( - margin: EdgeInsets.symmetric(horizontal: 73.sp), - child: Text( - '可输入字母或数字做密码', - style: TextStyle( - color: const Color(0xFFB7BECC), - fontSize: 14.sp, - ), - ), - ), - Spacer(), - GestureDetector( - onTap: () { - logic.setPassword(); - }, - child: Container( - width: double.infinity, - margin: EdgeInsets.symmetric(horizontal: 97.sp), - height: 48.sp, - alignment: Alignment.center, - decoration: logic.isSuccess - ? BoxDecoration( - gradient: AppColor.mainVerLinearGradient, - borderRadius: BorderRadius.circular(24.sp), - ) - : BoxDecoration( - color: Color(0x4DFFFFFF), - borderRadius: BorderRadius.circular(24.sp), - ), - child: Text( - '下一步', - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.white, - fontSize: 18.sp, - ), - ), - ), - ), - const SizedBox(height: 360), - ], - ), - ), - )), - ], - ); - }); - } -} diff --git a/circle_app/lib/app/setup/binding.dart b/circle_app/lib/app/setup/binding.dart deleted file mode 100644 index 2d9b295..0000000 --- a/circle_app/lib/app/setup/binding.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:get/get.dart'; - -import 'logic.dart'; - -class SetupBinding extends Bindings { - @override - void dependencies() { - Get.lazyPut(() => SetupLogic()); - } -} diff --git a/circle_app/lib/app/setup/logic.dart b/circle_app/lib/app/setup/logic.dart deleted file mode 100644 index 3f1a595..0000000 --- a/circle_app/lib/app/setup/logic.dart +++ /dev/null @@ -1,38 +0,0 @@ -import 'package:get/get.dart'; - -import '../../util/CacheUtil.dart'; -import 'state.dart'; - -class SetupLogic extends GetxController { - final SetupState state = SetupState(); - - String cache = ""; - - @override - void onInit() async { - super.onInit(); - - // - } - - @override - void onReady() async { - // TODO: implement onReady - super.onReady(); - getCache(); - } - - getCache() async { - cache = await CacheUtil.loadCache(); - print(cache); - update(); - } - - startCaching() async { - CacheUtil.clearCache((result) { - cache = result; - update(); - }); - - } -} diff --git a/circle_app/lib/app/setup/state.dart b/circle_app/lib/app/setup/state.dart deleted file mode 100644 index a1ffa82..0000000 --- a/circle_app/lib/app/setup/state.dart +++ /dev/null @@ -1,5 +0,0 @@ -class SetupState { - SetupState() { - ///Initialize variables - } -} diff --git a/circle_app/lib/app/setup/view.dart b/circle_app/lib/app/setup/view.dart deleted file mode 100644 index b94c2aa..0000000 --- a/circle_app/lib/app/setup/view.dart +++ /dev/null @@ -1,214 +0,0 @@ -import 'package:circle_app/app/minefragment/logic.dart'; -import 'package:circle_app/components/my_app_bar.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; - -import '../../router/app_routers.dart'; - -import 'logic.dart'; - - -class SetupPage extends StatelessWidget { - const SetupPage({Key? key}) : super(key: key); - final int heightView= 40; - - - @override - Widget build(BuildContext context) { - // _getFormat(context); - return GetBuilder(builder: (logic) { - return Container( - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage(getBaseImage("home_back")), - fit: BoxFit.cover, - ), - ), - child: Scaffold( - backgroundColor: Colors.transparent, - appBar: const MyAppBar(centerTitle: '设置',), - body: SafeArea( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: const [ - // GestureDetector( - // onTap: () { - // - // }, - // child: Image.asset( - // getNavigatorImage("back"), // 将 @mipmap/icon_back 替换为相应的图像路径 - // width: 24, // 将 @dimen/dp_24 替换为相应的值 - // height: 24, // 将 @dimen/dp_24 替换为相应的值 - // ), - // ), - // Spacer(), - // Text( - // '设置', - // style: TextStyle( - // color: Color(0xFFF7FAFA), // 将 #fff7fafa 替换为相应的颜色值 - // fontSize: 18.sp, // 将 18sp 替换为相应的值 - // ), - // ), - // Spacer(), - ], - ), - // 将 @dimen/dp_16 替换为相应的值 - SizedBox( - height: heightView.sp, - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - Get.toNamed(AppRoutes.AccountActivity); - // controller.state.hearUrl - - }, - child: _buildItemRow('账号中心', getHomeImage("icon_in")), - ), - ), - - // _buildItemRow('隐私设置', getHomeImage("icon_in")), - // SizedBox(height: 16.sp), - // _buildItemRow('聊天设置', getHomeImage("icon_in")), - // SizedBox(height: 16.sp), - - - // GestureDetector( - // behavior: HitTestBehavior.opaque, - // onTap: () { - // Get.toNamed(AppRoutes.PrivacyActivity); - // }, - // child: _buildItemRow('隐私设置', getHomeImage("icon_in")), - // ), - // SizedBox(height: 16.sp), - - - - SizedBox( - height: heightView.sp, - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - Get.toNamed(AppRoutes.BlackActivity); - }, - child: _buildItemRow('黑名单', getHomeImage("icon_in")), - ), - ), - // _buildItemRow('系统权限管理', getHomeImage("icon_in")), - // SizedBox(height: 16.sp), - SizedBox( - height: heightView.sp, - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - logic.startCaching(); - }, - child: _buildCacheItemRow('清除缓存', getHomeImage("icon_in"), context, logic), - ), - ), - SizedBox( - height: heightView.sp, - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - navigateToCodeOfConduct(); - }, - child: _buildItemRow('文明公约', getHomeImage("icon_in")), - ), - ), - - SizedBox( - height: heightView.sp, - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - Get.toNamed(AppRoutes.AboutAppActivity); - }, - child: _buildItemRow('关于微乐园', getHomeImage("icon_in")), - ), - ), - Expanded(child: Container()), - SafeArea(child: Center(child: Text('备案号:粤ICP备2023079493号-2A',style: TextStyle(color: Colors.white.withOpacity(0.5),fontSize: 12.sp),))) - ], - ), - ),), - ); - }); - } - - Widget _buildItemRow(String text, String imagePath) { - var mineLogic = Get.find(); - - return Container( - padding: EdgeInsets.symmetric(horizontal: 16.sp), - // 将 @dimen/dp_16 替换为相应的值 - child: Row( - children: [ - Text( - text, - style: TextStyle( - color: const Color(0xFFF7FAFA), // 将 #fff7fafa 替换为相应的颜色值 - fontSize: 16.sp, // 将 16sp 替换为相应的值 - ), - ), - const Spacer(), - if (mineLogic.isUpdateVersion && text == '关于微乐园') - Container( - width: 10.sp, - height: 10.sp, - margin: EdgeInsets.only(right: 4.sp), - decoration: const BoxDecoration( - color: Colors.red, - shape: BoxShape.circle), - ), - if (mineLogic.isUpdateVersion && text == '关于微乐园') - Text('有新版本啦',style: TextStyle(color: Colors.white60,fontSize: 14.sp),), - Image.asset( - imagePath, - width: 20.sp, // 将相应的值替换为图像的宽度 - height: 20.sp, // 将相应的值替换为图像的高度 - ), - ], - ), - ); - } - - Widget _buildCacheItemRow(String text, String imagePath, BuildContext context, - SetupLogic logic) { - return Container( - padding: EdgeInsets.symmetric(horizontal: 16.sp), - // 将 @dimen/dp_16 替换为相应的值 - child: Row( - children: [ - Text( - text, - style: TextStyle( - color: const Color(0xFFF7FAFA), // 将 #fff7fafa 替换为相应的颜色值 - fontSize: 16.sp, // 将 16sp 替换为相应的值 - ), - ), - const Spacer(), - // _getFormat(context), - Text( - logic.cache, // 将 'XXX' 替换为相应的缓存大小值 - style: TextStyle( - color: const Color(0xFFB7BECC), // 将 #ffb7becc 替换为相应的颜色值 - fontSize: 14.sp, // 将 14sp 替换为相应的值 - ), - ), - SizedBox(width: 8.sp), // 将 @dimen/dp_8 替换为相应的值 - Image.asset( - imagePath, - width: 20.sp, // 将相应的值替换为图像的宽度 - height: 20.sp, // 将相应的值替换为图像的高度 - ), - ], - ), - ); - } - - -} \ No newline at end of file diff --git a/circle_app/lib/app/signal_circle_list/binding.dart b/circle_app/lib/app/signal_circle_list/binding.dart deleted file mode 100644 index 951d5cc..0000000 --- a/circle_app/lib/app/signal_circle_list/binding.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:get/get.dart'; - -import 'logic.dart'; - -class Signal_circle_listBinding extends Bindings { - @override - void dependencies() { - Get.lazyPut(() => Signal_circle_listLogic()); - } -} diff --git a/circle_app/lib/app/signal_circle_list/logic.dart b/circle_app/lib/app/signal_circle_list/logic.dart deleted file mode 100644 index 67ed8e2..0000000 --- a/circle_app/lib/app/signal_circle_list/logic.dart +++ /dev/null @@ -1,44 +0,0 @@ -import 'package:circle_app/app/circle/logic.dart'; -import 'package:circle_app/network/api.dart'; -import 'package:circle_app/network/dio_manager.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:get/get.dart'; - -import 'state.dart'; - -class Signal_circle_listLogic extends GetxController { - final Signal_circle_listState state = Signal_circle_listState(); - List openCallOutIdList = []; - Circle? circle; - - @override - void onInit() { - // TODO: implement onInit - super.onInit(); - loadData(); - } - - void loadData() async { - var data = await DioManager.instance - .get(url: 'up-service/interest/${Get.arguments}'); - if (data['code'] == 200) { - circle = Circle.fromJson(data['data']); - update(); - } - } - - outCircle(String interest_id, bool isStatus) async { - var data = await DioManager.instance.post( - url: Api.outCrrcle + interest_id + "/join", - params: {"status": isStatus ? "0" : "1"}); - var bean = BaseResponse.fromJson(data, (data) => data); - if (bean.code == 200) { - - circle!.isJoin = !isStatus; - update(); - - } - showOKToast(bean.msg); - } - -} diff --git a/circle_app/lib/app/signal_circle_list/state.dart b/circle_app/lib/app/signal_circle_list/state.dart deleted file mode 100644 index 0af9e94..0000000 --- a/circle_app/lib/app/signal_circle_list/state.dart +++ /dev/null @@ -1,5 +0,0 @@ -class Signal_circle_listState { - Signal_circle_listState() { - ///Initialize variables - } -} diff --git a/circle_app/lib/app/signal_circle_list/view.dart b/circle_app/lib/app/signal_circle_list/view.dart deleted file mode 100644 index 56b966a..0000000 --- a/circle_app/lib/app/signal_circle_list/view.dart +++ /dev/null @@ -1,72 +0,0 @@ -import 'package:circle_app/app/circle/logic.dart'; -import 'package:circle_app/app/circle/widgets/info_list_view.dart'; -import 'package:circle_app/app/select_circle/logic.dart'; -import 'package:circle_app/components/my_app_bar.dart'; -import 'package:circle_app/router/app_routers.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; - -import 'logic.dart'; - -class Signal_circle_listPage extends StatelessWidget { - Signal_circle_listPage({Key? key}) : super(key: key); - - final logic = Get.find(); - final state = Get.find().state; - @override - Widget build(BuildContext context) { - return Container( - width: MediaQuery.of(context).size.width, - height: MediaQuery.of(context).size.height, - decoration: BoxDecoration( - color: const Color(0xFF423055), - image: DecorationImage( - fit: BoxFit.fill, - image: AssetImage(getBaseImage('home_back')))), - child: GetBuilder(builder: (Signal_circle_listLogic controller) { - return Scaffold( - backgroundColor: Colors.transparent, - appBar: MyAppBar( - centerTitle: logic.circle?.title ?? '', - actionWdiget: Image.asset( - getCircleImage('callout_icon'), - width: 75.sp, - ), - onPressed: () async{ - List numbers = []; - numbers.add(MyConfigData( - controller.circle!.id.toString(), - controller.circle!.title, - false)); - var data = await Get.toNamed(AppRoutes.Call_out, arguments: {'numbers': numbers}); - // MyinfoListViewKey.currentState?.loadCallOutListData(); - // logic.refresh(); - // logic.update(); - }, - ), - body: Container( - padding: EdgeInsets.only(left: 15.sp, right: 15.sp), - width: MediaQuery.of(context).size.width, - height: MediaQuery.of(context).size.height, - child: Column(children: [ - // backNavigatorItem(), - // Text(controller.state.msg), - //组件使用 - Expanded( - child: controller.circle == null - ? loaddingWidget(true) - : InfoListView(0, controller.circle!, controller)) - ]), - )); - })); - } - -// - // backNavigatorItem() { - // return MyAppBar( - // centerTitle: , - // ); - // } -} diff --git a/circle_app/lib/app/splash/binding.dart b/circle_app/lib/app/splash/binding.dart deleted file mode 100644 index f456539..0000000 --- a/circle_app/lib/app/splash/binding.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:get/get.dart'; - -import 'logic.dart'; - -class SplashBinding extends Bindings { - @override - void dependencies() { - Get.lazyPut(() => SplashLogic()); - } -} diff --git a/circle_app/lib/app/splash/logic.dart b/circle_app/lib/app/splash/logic.dart deleted file mode 100644 index a9763ca..0000000 --- a/circle_app/lib/app/splash/logic.dart +++ /dev/null @@ -1,120 +0,0 @@ -import 'dart:io'; - -import 'package:connectivity/connectivity.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_native_splash/flutter_native_splash.dart'; -import 'package:get/get.dart'; - -import '../../router/app_routers.dart'; -import '../../util/SharedPreferencesHelper.dart'; -import '../dialog/YesAgreementDialog.dart'; -import '../select_circle/logic.dart'; -import 'state.dart'; - -import '../../network/api.dart'; -import '../../network/dio_manager.dart'; -import '../../util/device.dart'; -import '../../util/util.dart'; -import '../login/login/logic.dart'; - -class SplashLogic extends GetxController { - final SplashState state = SplashState(); - - @override - void onReady() async { - // TODO: implement onReady - super.onReady(); - loadConfig(); - checkStatus(); - } - - loadConfig() async { - var data1 = - await DioManager.instance.get(url: Api.getCircleList, params: {}); - var bean1 = BaseResponse.fromJson( - data1, (data1) => ConfigBean.fromJson(data1)); - if (bean1.code == 200) { - configBean = bean1.data!; - - configBean.genderMap.forEach((key, value) { - genderList.add(value); - }); - - configBean.orientationMap.forEach((key, value) { - orientationList.add(value); - }); - configBean.roleMap.forEach((key, value) { - roleList.add(value); - }); - } - } - - checkStatus() async { - if ((await getAuthorization()).isEmpty) { - if (Platform.isIOS) { - pushLoginPage(); - return; - } - bool isAgreemement = await getAgreemement(); - if (!isAgreemement) { - showReportDialog(); - } else { - pushLoginPage(); - } - } else { - var data = - await DioManager.instance.put(url: Api.refreshToken, params: {}); - var bean = BaseResponse.fromJson( - data, (data) => LoginData.fromJson(data)); - if (bean.code == 200) { - SharedPreferencesHelper.getInstance().then((sharedPreferences) { - sharedPreferences.setString(SharedPreferencesHelper.AUTHORIZATION, - bean.data!.Authorization.toString()); - }); - Get.offNamed(AppRoutes.Home); - return; - } else if (bean.code == 30002) { - SharedPreferencesHelper.getInstance().then((sharedPreferences) { - sharedPreferences.setString(SharedPreferencesHelper.AUTHORIZATION, - bean.data!.Authorization.toString()); - Get.offNamed(AppRoutes.Complete_materialPage); - }); - - return; - } else if (bean.code == 5000 || - bean.code == 5001 || - bean.code == 5002 || - bean.code == 5003) { - pushLoginPage(); - return; - } - showOKToast(bean.msg.toString()); - if (bean.code == 500) { - await Future.delayed(Duration(seconds: 5)); - onInit(); - } else { - SharedPreferencesHelper sp = - await SharedPreferencesHelper.getInstance(); - String token = sp.getString(SharedPreferencesHelper.AUTHORIZATION); - if (token.isNotEmpty) { - Get.offNamed(AppRoutes.Home); - } else { - pushLoginPage(); - } - } - - // Get.toNamed(AppRoutes.Home); - } - } - - void showReportDialog() { - FlutterNativeSplash.remove(); - showDialog( - context: Get.context!, - barrierDismissible: false, - builder: (BuildContext context) { - return YesAgreementDialog(); - }); - } -} diff --git a/circle_app/lib/app/splash/state.dart b/circle_app/lib/app/splash/state.dart deleted file mode 100644 index 217d9f4..0000000 --- a/circle_app/lib/app/splash/state.dart +++ /dev/null @@ -1,5 +0,0 @@ -class SplashState { - SplashState() { - ///Initialize variables - } -} diff --git a/circle_app/lib/app/splash/view.dart b/circle_app/lib/app/splash/view.dart deleted file mode 100644 index 2277145..0000000 --- a/circle_app/lib/app/splash/view.dart +++ /dev/null @@ -1,103 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; - -import '../../util/util.dart'; -import 'logic.dart'; - -class SplashPage extends StatelessWidget { - SplashPage() : super(); - - - @override - Widget build(BuildContext context) { - return GetBuilder(builder: (logic) { - return Container( - decoration: const BoxDecoration( - image: DecorationImage( - image: AssetImage('assets/images/base/launch_back.webp'), - fit: BoxFit.cover, - ), - ), - child: Scaffold( - backgroundColor: Colors.transparent, - body:true? Container(): Stack( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Positioned( - top: 117.sp, - left: 37.sp, - child: Row(children: [ - Center( - child: Image.asset(getBaseImage("ic_launcher"),width: 100.sp,height: 100.sp,), - ), - Column(children: [ - Center( - child: Image.asset(getLoginImage("icon_logo_name"),width: 203.sp,), - ), - - Center( - child: Text( - '小众圈子的快乐家园', - style: TextStyle( - color: const Color(0xCCFFFFFF), - fontSize: 20.sp, - // shadows: [ - // Shadow( - // color: Color(0xFFC92BFF), - // offset: Offset(0, 1.2), - // blurRadius: 3.0, - // ), - // ], - ), - ), - ), - ],) - ],)), - - - Positioned( - bottom: 74.sp, - left: 0, - right: 0, - child: Center( - child: Text( - '总有一个小众圈子适合你', - style: TextStyle( - fontSize: 24.sp, - color: Color(0xFF02FCFB), // Set the default text color - ), - ), - ), - ), - - ],),), - ); - }); - - } - - -} - -class GradientText extends StatelessWidget { - @override - Widget build(BuildContext context) { - return ShaderMask( - shaderCallback: (Rect bounds) { - return LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [Color(0xFF0AEBED), Color(0xFFE62CFF)], - ).createShader(bounds); - }, - child: Text( - '总有一个小众圈子适合你', - style: TextStyle( - fontSize: 24, - color: Color(0xFF02FCFB), // Set the default text color - ), - ), - ); - } -} \ No newline at end of file diff --git a/circle_app/lib/app/swiper/binding.dart b/circle_app/lib/app/swiper/binding.dart deleted file mode 100644 index f6d8380..0000000 --- a/circle_app/lib/app/swiper/binding.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:get/get.dart'; - -import 'logic.dart'; - -class SwiperBinding extends Bindings { - @override - void dependencies() { - Get.lazyPut(() => SwiperLogic()); - } -} diff --git a/circle_app/lib/app/swiper/logic.dart b/circle_app/lib/app/swiper/logic.dart deleted file mode 100644 index 52f1afb..0000000 --- a/circle_app/lib/app/swiper/logic.dart +++ /dev/null @@ -1,25 +0,0 @@ -import 'package:flutter_swiper/flutter_swiper.dart'; -import 'package:get/get.dart'; - -import 'state.dart'; - -class SwiperLogic extends GetxController { - final SwiperState state = SwiperState(); - List imgList = Get.arguments['imaglist'] ; - int index = Get.arguments['index'] ; - String userId = ''; - SwiperController swiperController = SwiperController(); - @override - void onInit() { - super.onInit(); - Map arg = Get.arguments; - if (arg.containsKey('userId')) { - userId = arg['userId']; - } - } - @override - void onReady() { - super.onReady(); - // swiperController.move(index); - } -} diff --git a/circle_app/lib/app/swiper/state.dart b/circle_app/lib/app/swiper/state.dart deleted file mode 100644 index 92ac8a3..0000000 --- a/circle_app/lib/app/swiper/state.dart +++ /dev/null @@ -1,5 +0,0 @@ -class SwiperState { - SwiperState() { - ///Initialize variables - } -} diff --git a/circle_app/lib/app/swiper/view.dart b/circle_app/lib/app/swiper/view.dart deleted file mode 100644 index b426e50..0000000 --- a/circle_app/lib/app/swiper/view.dart +++ /dev/null @@ -1,427 +0,0 @@ -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:circle_app/common/colors/app_color.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/rendering.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; -import 'package:flutter_swiper/flutter_swiper.dart'; -import 'package:get/get.dart'; -import 'package:get/get_core/src/get_main.dart'; -import 'package:get/get_state_manager/src/simple/get_state.dart'; -import 'package:image_gallery_saver/image_gallery_saver.dart'; -import 'package:qr_flutter/qr_flutter.dart'; - -import '../../router/app_routers.dart'; -import '../home/logic.dart'; -import 'logic.dart'; -import 'dart:ui' as ui; - -class SwiperPage extends StatefulWidget { - const SwiperPage({Key? key}) : super(key: key); - - @override - State createState() => _SwiperPageState(); -} - -class _SwiperPageState extends State { - GlobalKey _globalKey = GlobalKey(); - - var homeLogic = Get.find(); - - @override - Widget build(BuildContext context) { - return GetBuilder(builder: (logic) { - List imgList = []; - logic.imgList.forEach((element) { - imgList.add(CachedNetworkImage( - imageUrl: element, - fit: BoxFit.cover, - height: Get.height, - width: Get.width, - )); - }); - - return Stack( - children: [ - Stack( - children: [ - // RepaintBoundary( - // key: _globalKey, child: itemWidget(logic, logic.index, true)), - itemWidget(logic, logic.index, true), - Container( - width: Get.width, - height: Get.height, - color: Colors.black, - ), - ], - ), - Scaffold( - appBar: null, - backgroundColor: Colors.black87, - body: GestureDetector( - behavior: HitTestBehavior.translucent, - onTap: (() { - //点击任意地方都能关闭页面,并且不影响你的滑动查看 - Navigator.pop(context); - }), - child: Stack( - children: [ - Container( - child: Swiper( - controller: logic.swiperController, - index: logic.index, - loop: false, - - itemBuilder: (BuildContext context, int index) { - // if (logic.index == index) { - // return RepaintBoundary( - // key: _globalKey, - // child:itemWidget(logic,index)); - // } - return itemWidget(logic, index, false); - }, - - onIndexChanged: (int index) { - logic.index = index; - logic.update(); - }, - itemCount: logic.imgList.length, - pagination: const SwiperPagination( - builder: DotSwiperPaginationBuilder( - activeColor: Color(0xFFD14CFF), - color: Colors.white)), //下面的分页小点 - )), - Positioned( - bottom: Get.bottomBarHeight, - right: 15.sp, - child: InkWell( - onTap: () { - _saveLocalImage(); - }, - child: Container( - alignment: Alignment.center, - padding: EdgeInsets.all(5.sp), - decoration: BoxDecoration( - color: Colors.black.withOpacity(0.5), - borderRadius: BorderRadius.circular(17.5.sp)), - child: Icon( - Icons.download, - color: Colors.white, - size: 25.sp, - ), - ), - )), - if (logic.userId.isNotEmpty) - Positioned( - right: 16.sp, - top: 16.sp, - child: SafeArea( - child: GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.UserInfoActivity, - arguments: logic.userId); - Get.delete(); - }, - child: Container( - width: 73.sp, - height: 25.sp, - decoration: BoxDecoration( - gradient: AppColor.mainVerLinearGradient, - borderRadius: BorderRadius.circular(12.5.sp)), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - margin: EdgeInsets.only(left: 5.sp), - child: Text( - '查看主页', - style: TextStyle( - color: Colors.white, - fontSize: 10.sp, - ), - ), - ), - Image( - width: 15.sp, - image: AssetImage( - getDisCoverImage("right_icon")), - // width: 44.sp, - ), - ], - ), - ), - ), - )), - Positioned( - left: 5.sp, - top: 10.sp + MediaQuery.of(context).padding.top, - child: IconButton( - onPressed: () { - Get.back(); - }, - padding: EdgeInsets.only(left: 15.sp), - icon: Image.asset( - 'assets/images/navigator/back.png', - width: 30.sp, - height: 30.sp, - ), - )), - ], - ), - ), - ), - ], - ); - }); - } - - itemWidget(SwiperLogic logic, int index, bool isShow) { - String link = homeLogic.link + '#code=' + homeLogic.inviteCode; - return Stack( - children: [ - Container( - color: Colors.black, - width: double.infinity, - height: Get.height, - alignment: Alignment.center, - child: SingleChildScrollView( - child: isShow - ? RepaintBoundary( - key: _globalKey, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Stack( - alignment: Alignment.center, - children: [ - Container( - child: CachedNetworkImage( - imageUrl: logic.imgList[index], - fit: BoxFit.contain, - ), - ), - if (isShow) - Positioned( - right: 10.sp, - bottom: 20.sp, - child: Container( - margin: EdgeInsets.only( - top: Get.height * 0.45), - child: Text( - '微乐园APP', - style: TextStyle( - color: Colors.white, - fontSize: 25.sp), - ), - )) - ], - ), - if (isShow) - Container( - width: Get.width, - color: Colors.black, - height: 60.sp, - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Image.asset( - getBaseImage("ic_launcher"), - width: 50.sp, - height: 50.sp, - ), - SizedBox( - width: 10.sp, - ), - Expanded( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - Container( - margin: - EdgeInsets.only(bottom: 5.sp), - width: Get.width - 150.sp, - child: Text('微乐园APP-认识更多小众圈子的人', - style: TextStyle( - color: Colors.white, - fontSize: 14.sp))), - Row( - children: [ - Container( - alignment: Alignment.center, - padding: EdgeInsets.only( - left: 10.sp, right: 10.sp), - height: 25.sp, - decoration: BoxDecoration( - // color: Color(0xFFDC5BFD), - gradient: AppColor - .mainVerLinearGradient, - borderRadius: - BorderRadius.circular( - 12.5.sp)), - child: Text( - '专属邀请码:${homeLogic.inviteCode}', - style: TextStyle( - color: Colors.white, - fontSize: 12.sp), - ), - ), - Expanded(child: Container()) - ], - ), - ], - ), - ), - Stack( - alignment: Alignment.center, - children: [ - Container( - color: Colors.white, - width: 50.sp, - height: 50.sp, - ), - QrImageView( - data: link, - padding: EdgeInsets.zero, - version: QrVersions.auto, - size: 45.sp, - gapless: false, - // backgroundColor: Colors.black, - ) - ], - ), - SizedBox( - width: 10.sp, - ), - ], - ), - ) - ], - )) - : Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - child: CachedNetworkImage( - imageUrl: logic.imgList[index], - fit: BoxFit.contain, - ), - ), - ], - ))), - ], - ); - // return Container( - // width: Get.width, - // child: Column( - // mainAxisAlignment: MainAxisAlignment.center, - // children: [ - // Stack( - // alignment: Alignment.center, - // children: [ - // - // Container( - // // color: Colors.red, - // - // child: CachedNetworkImage( - // // progressIndicatorBuilder: (context,str,progress) { - // // return Container(); - // // }, - // placeholder: (context,str) { - // print(str + '进度'); - // if (Get.arguments['index'] == index) { - // return Container( - // // color: Colors.red, - // child: CachedNetworkImage( - // imageUrl: logic.imgList[index].toString(), - // - // fit: BoxFit.cover, - // width: Get.width, - // ), - // ); - // } else { - // return Container(); - // } - // }, - // imageUrl: logic.imgList[index].toString().contains('?') ? logic.imgList[index].toString().split('?').first : logic.imgList[index].toString(), - // fit: BoxFit.cover, - // width: Get.width, - // ), - // ), - // Positioned( - // left: 10.sp, - // bottom: 20.sp, - // child: Container( - // margin: - // EdgeInsets.only(top: Get.height * 0.45), - // child: Text( - // '微乐园APP', - // style: TextStyle( - // color: Colors.white, fontSize: 25.sp), - // ), - // )) - // ], - // ) - // ], - // )); - } - - _saveLocalImage() async { - RenderRepaintBoundary boundary = - _globalKey.currentContext!.findRenderObject() as RenderRepaintBoundary; - ui.Image image = - await boundary.toImage(pixelRatio: ui.window.devicePixelRatio); - ByteData? byteData = - await (image.toByteData(format: ui.ImageByteFormat.png)); - if (byteData != null) { - SmartDialog.showLoading(msg: '正在保存...'); - final result = - await ImageGallerySaver.saveImage(byteData.buffer.asUint8List()); - print(result); - SmartDialog.dismiss(); - // isSuccess - if (result['isSuccess']) { - showOKToast('保存成功'); - } else { - showOKToast('保存失败,请检查相册权限是否开启'); - } - } - } - // Widget build(BuildContext context) { - -// return GetBuilder(builder: (logic) { -// -// return Scaffold( -// appBar: null, -// backgroundColor: Colors.black87, -// body: GestureDetector( -// behavior: HitTestBehavior.translucent, -// onTap: (() { -// //点击任意地方都能关闭页面,并且不影响你的滑动查看 -// Navigator.pop(context); -// }), -// child: Swiper( -// controller: logic.swiperController, -// index:logic.index, -// itemBuilder: (BuildContext context, int index) { -// print("img="+logic.imgList[index]); -// // return SizedBox( -// // width: double.infinity, -// // child: Image.network( -// // "${logic.imgList[index]}?imageView2/0/q/60|watermark/2/text/5b6u5LmQ5ZutQVBQ/font/5b6u6L2v6ZuF6buR/fontsize/2160/fill/I0ZGRkZGRg==/dissolve/50/gravity/SouthEast/dx/60/dy/120", fit: BoxFit.contain,) -// // ); -// }, -// itemCount: logic.imgList.length, -// pagination: SwiperPagination(), //下面的分页小点 -// // control: new SwiperControl(), //左右的那个箭头,在某模拟器中会出现蓝线 -// ), -// ), -// ); -// }); -// } -} diff --git a/circle_app/lib/app/userinfo/binding.dart b/circle_app/lib/app/userinfo/binding.dart deleted file mode 100644 index fbf0755..0000000 --- a/circle_app/lib/app/userinfo/binding.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:get/get.dart'; - -import 'logic.dart'; - -class UserinfoBinding extends Bindings { - @override - void dependencies() { - Get.lazyPut(() => UserinfoLogic()); - } -} diff --git a/circle_app/lib/app/userinfo/logic.dart b/circle_app/lib/app/userinfo/logic.dart deleted file mode 100644 index 093cfa2..0000000 --- a/circle_app/lib/app/userinfo/logic.dart +++ /dev/null @@ -1,684 +0,0 @@ -import 'dart:async'; - -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; -import 'package:get/get.dart'; -import 'package:image_picker/image_picker.dart'; -import 'package:shared_preferences/shared_preferences.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/friendShip/friendship_services.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/services_locatar.dart'; -import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; - -import '../../common/Widgets/base_tip_widget.dart'; -import '../../common/config.dart'; -import '../../network/api.dart'; -import '../../network/dio_manager.dart'; -import '../../util/SharedPreferencesHelper.dart'; -import '../../util/eventBus.dart'; -import '../../util/qiniu.dart'; -import '../../util/util.dart'; -import '../../view/notice.dart'; -import '../dialog/BaseDialog.dart'; -import 'state.dart'; - -class UserinfoLogic extends GetxController { - var userId = Get.arguments ?? ""; - final UserinfoState state = UserinfoState(); - final ImagePicker _picker = ImagePicker(); - UserBean? userInfoBean; - String imId = ''; - String ageMsg = ""; - var isVip = 0; - var onLineCity = ""; - var isLikeFoMsg = ''; - var quToken = ''; - bool isMe = false; - bool isEdit = false; - bool isUrgeStatus = false; - bool isOnline = false; - - bool isShowAlbum = true; - bool isLike = false; - bool isBlack = false; - bool isBlackBeen = false; - bool isDestroy = false; - - List giftList = []; - - List recevigiftList = []; - - List openCallOutIdList = []; - - Map toUser = {}; - - int unLockWxNum = 0; - int likeMeCount = 0; - int imageUrgeCount = 0; - - final startTime = DateTime.now(); - SharedPreferences? sharedPreferences; - @override - void onClose() { - // TODO: implement onClose - timer?.cancel(); - super.onClose(); - } - - @override - void onInit() async { - super.onInit(); - SmartDialog.showLoading(); - - sharedPreferences = await SharedPreferences.getInstance(); - int? sharedUserId = - sharedPreferences!.getInt(SharedPreferencesHelper.USERID); - - if (userId.isNotEmpty && - sharedUserId != null && - sharedUserId.toString() == userId) { - userId = ''; - } - - state.imaglist.clear(); - - if (userId.isEmpty) { - isMe =true; - update(); - fetchUserInfo(Api.getUserInfo); - fetchMyAlbum(Api.getMyAlbum); - } else { - fetchUserInfo("${Api.getUserInfoTA + userId}/home"); - fetchMyAlbum("${Api.getTaAlbum + userId}/albums"); - fetchUrgeStatus("${Api.getUrgeStatus + userId}/urge/album/status"); - fetchIsBlack("${Api.setBlock + userId}/block"); - } - SmartDialog.dismiss(); - fetchQnToken(Api.getqiniuToken); - loadGiftListData(); - } - - loadGiftListData() async { - var result = await DioManager.instance.get(url: Api.giftList); - if (result['code'] == 200) { - giftList = result['data']; - loadData(); - } - } - - void loadData() async { - SharedPreferencesHelper sp = await SharedPreferencesHelper.getInstance(); - String myId = sp.getMyUserId(); - - var result = await DioManager.instance.get( - url: userId.toString().isNotEmpty ? Api.giftHall + userId : Api.giftHall + myId, - ); - if (result['code'] == 200) { - // topTitle = result['topDesc']; - toUser = result['data']['topUser'] ?? {}; - // total = result['receiveTotal']; - // "accid" -> "ky_dev_30629" - // accid = result['accid']; - // receiveGiftNum - recevigiftList = result['data']['receiveGiftNum']; - if (recevigiftList.isNotEmpty) { - var receiveList = []; - var noreceiveList = []; - giftList.forEach((element) { - bool isContain = false; - for (var info in recevigiftList) { - if (element['id'] == info['giftId']) { - isContain = true; - } - } - if (isContain) { - receiveList.add(element); - } else { - noreceiveList.add(element); - } - }); - receiveList.addAll(noreceiveList.reversed.toList()); - giftList = receiveList; - update(); - } - update(); - } - } - - - - - - void showBlackDialog(BuildContext context) { - showDialog( - context: context, - barrierDismissible: false, - builder: (BuildContext context) { - return BaseDialog( - isDismiss: false, - ); - }); - } - - Future fetchIsBlack(String url) async { - var data = await DioManager.instance.get(url: url); - if (data['code'] == 200) { - isBlack = data["data"]["status"] == 1; - } - - } - - Future fetchUserInfo(String url) async { - var data = await DioManager.instance.get(url: url); - var bean = BaseResponse.fromJson( - data, (data) => ResponseBean.fromJson(data)); - - if (bean.isSuccess()) { - isMe = userId.isEmpty; - isLike = bean.data.isFollow; - - isLikeFoMsg = - "${bean.data.likeMeCount}位圈友感兴趣,其中${bean.data.imageUrgeCount}位已催您更新"; - likeMeCount = bean.data.likeMeCount; - imageUrgeCount = bean.data.imageUrgeCount; - userInfoBean = bean.data.user; - unLockWxNum = userInfoBean!.contact!.contains('*') ? 0 : 1; - isVip = userInfoBean?.vip ?? 0; - imId = bean.data.accountId; - print("imId="+imId); - if (isMe) { - isOnline = true; - } else { - if(!isLike){ - startCountdown(); - } - isOnline = userInfoBean!.isOnline; - isBlackBeen = bean.data.isBlock; - isDestroy = bean.data.isDestroy; - if (isBlackBeen) { - showOKToast("您已被对方拉黑"); - } - } - onLineCity = userInfoBean!.onlineFlag!; - if (userInfoBean?.currentCity != null) { - if (onLineCity.isNotEmpty) { - onLineCity = "$onLineCity·${userInfoBean!.currentCity}"; - } else { - onLineCity = userInfoBean!.currentCity! ?? ''; - } - } else { - onLineCity = "$onLineCity"; - } - ageMsg = getAgeCOntent(userInfoBean!.gender, userInfoBean!.age, - userInfoBean!.role, userInfoBean!.orientation); - } else if (bean.code == 9999) { - showBlackDialog(Get.context!); - } else { - showOKToast(bean.msg); - } - update(); - } - - int countdown = 5; - Timer? timer = null; - - startCountdown(){ - - timer = Timer.periodic(const Duration(seconds: 1), (t) async { - if (countdown > 0) { - countdown--; - } else { - bool isTip = await checkIsShowTip(); - if (isTip) { - showFloatingButtonOverlay(Get.context!,userInfoBean!.nickname ?? '',ageMsg,userInfoBean!.avatarThumb,0,(){ - setLike(); - }); - } - timer?.cancel(); // 倒计时结束,取消定时器 - } - }); - } - - - Future checkIsShowTip() async { - - var result = await DioManager.instance.get( - url: Api.popup + userId , - ); - return result['data'] ?? false; - } - - Future fetchMyAlbum(String url) async { - var myAlbumData = await DioManager.instance.get(url: url); - var myAlbumBean = BaseResponse.fromJson( - myAlbumData, (myAlbumData) => AlbumResponseBean.fromJson(myAlbumData)); - - if (myAlbumBean.isSuccess()) { - state.imaglist.addAll(myAlbumBean.data.lists); - } - update(); - } - - Future fetchUrgeStatus(String url) async { - var urgedata = await DioManager.instance.get(url: url); - var urgeBean = BaseResponse.fromJson( - urgedata, (urgedata) => UrgentStatus.fromJson(urgedata)); - isUrgeStatus = urgeBean.data?.isUrgent ?? false; - update(); - } - - Future fetchQnToken(String url) async { - var data = await DioManager.instance.get(url: url, params: {}); - var bean = BaseResponse.fromJson( - data, (data) => QnTokenData.fromJson(data)); - if (bean.isSuccess()) { - quToken = bean.data?.token.toString() ?? ''; - } - } - - urgeChange() async { - var data = await DioManager.instance - .post(url: "${Api.urgeAlbum + userId}/urge/album"); - var bean = BaseResponse.fromJson(data, (data) => data); - if (bean.isSuccess()) { - showOKToast("催更成功"); - isUrgeStatus = true; - update(); - } else { - showOKToast(bean.msg); - } - } - - delAlbumImage(int index) async { - var data = await DioManager.instance - .delete(url: Api.deleteAlbum + state.imaglist[index].id.toString()); - var bean = BaseResponse.fromJson(data, (data) => data); - if (bean.code == 200) { - state.imaglist.removeAt(index); - // Navigator.pop(Get.context!); - update(); - } - } - - setLike() async { - if (isBlack || isDestroy) { - showOKToast("喜欢失败,存在拉黑关系或者该账户已注销"); - return; - } - - var data = await DioManager.instance.post( - url: "${Api.setLike + userId}/follow", - params: {'status': isLike ? "0" : "1"}); - var bean = BaseResponse.fromJson( - data, - (jsonData) => jsonData, - ); - if (bean.isSuccess()) { - - timer?.cancel(); - isLike = !isLike; - update(); - } - showOKToast(bean.msg); - } - - setBlock(String status) async { - List parts = imId.split('_'); - if (parts[2] == "10") { - showOKToast("不可拉黑客服号哦~"); - return; - } - var data = await DioManager.instance.post( - url: "${Api.setBlock + userId}/block", params: {'status': status}); - var bean = BaseResponse.fromJson( - data, - (jsonData) => jsonData, - ); - if (bean.isSuccess()) { - final FriendshipServices _friendshipServices = - serviceLocator(); - - isBlack = status == "1"; - try { - if (isBlack) { - Navigator.pop(Get.context!); - var result = - await _friendshipServices.addToBlackList(userIDList: [imId]); - print("拉黑成功" + result.toString()); - } else { - var result = - await _friendshipServices.deleteFromBlackList(userIDList: [imId]); - print("取消拉黑成功" + result.toString()); - } - // await Future.delayed(Duration(milliseconds: 500)); - // Future.delayed(Duration(seconds: 3),() { - EventBusManager.fire(CommentBlackEvent(userId: imId, isBlack: isBlack)); - // }); - } catch (e) {} - - update(); - } else if (bean.code == 21201 || bean.code == 21202) { - showVipDialog(); - } - showOKToast(bean.msg); - } - - - void sendGiftData(String accid, String giftId, String userId, ) async { - var result = await DioManager.instance.post(url: Api.sendGift, params: { - 'accid': accid, - 'giftId': giftId, - 'num': 1, - 'toUserId': userId - }); - if (result['code'] == 200) { - showOKToast('赠送成功'); - loadData(); - } else if (result['code'] == 31201) { - showOKToast(result['msg']); - showRechargeScreenDialog(); - } - } - - Future getImageFile() async { - checkPhotosStatus(); - try { - final XFile? pickedFile = await _picker.pickImage( - source: ImageSource.gallery, - ); - if (null == pickedFile) { - return; - } - - SmartDialog.showLoading(); - uploadImage(quToken, pickedFile, CONFIG.USER_ALBUM_IMAGE, (result) async { - var data = await DioManager.instance - .post(url: Api.updataAlbum, params: {"type": 1, "url": result}); - var myAlbumBean = BaseResponse.fromJson( - data, (data) => AddAlbum.fromJson(data)); - - if (myAlbumBean.code == 200) { - SmartDialog.dismiss(); - state.imaglist.insert( - 0, - AlbumListItem( - id: myAlbumBean.data.id, - type: myAlbumBean.data.type, - url: result, - urlThumb: result)); - update(); - } - }); - } catch (_) {} - } - - void sendWhatToWx() async { - var result = await DioManager.instance.get(url: Api.noticeWxNum + userId,); - if (result['code'] == 200) { - showOKToast('已提醒对方填写'); - } else { - showOKToast(result['msg']); - } - } -} - -class UserBean { - int id; - String nickname; - String avatar; - String birthday; - String wx_num; - - int age; - String contact; - int contactType; - String signature; - int vip; - int gender; - int role; - int mark; - int orientation; - int userType; - List interests; - List orientations; - double lng; - double lat; - String? city; - String? currentCity; - bool isOnline; - int hide_wx_num; - DateTime? offlineTime; - String avatarThumb; - String onlineFlag; - UserBean({ - required this.id, - required this.nickname, - required this.avatar, - required this.wx_num, - required this.birthday, - required this.age, - required this.signature, - required this.vip, - required this.userType, - required this.gender, - required this.hide_wx_num, - required this.orientations, - required this.mark, - required this.currentCity, - required this.role, - required this.contactType, - required this.contact, - required this.orientation, - required this.interests, - required this.lng, - required this.lat, - required this.onlineFlag, - this.city, - required this.isOnline, - this.offlineTime, - required this.avatarThumb, - }); - - factory UserBean.fromJson(Map json) { - return UserBean( - id: json['id'], - userType: json['userType'] ?? 0, - currentCity: json['currentCity'] ?? '', - hide_wx_num: json['hide_wx_num'] ?? 0, - orientations: json['orientations'] ?? [], - wx_num: json['wx_num'] ?? '', - mark: json['mark'] ?? 0, - nickname: json['nickname'], - onlineFlag: json['onlineFlag'] ?? '', - avatar: json['avatar'], - birthday: json['birthday'], - contact: json['contact'] ?? '', - contactType: json['contactType'] ?? 0, - age: json['age'], - signature: json['signature'], - vip: json['vip'], - gender: json['gender'], - role: json['role'], - orientation: json['orientation'], - interests: json['interests'] == null ? [] : List.from( - json['interests'].map((x) => Interest.fromJson(x)), - ), - lng: json['lng'], - lat: json['lat'], - city: json['city'], - isOnline: json['isOnline'], - offlineTime: json['offlineTime'] != null - ? DateTime.parse(json['offlineTime']) - : null, - avatarThumb: json['avatar_thumb'], - ); - } - - - Map toJson() { - final Map data = new Map(); - data['age'] = this.age; - data['avatar'] = this.avatar; - data['avatar_thumb'] = this.avatarThumb; - data['birthday'] = this.birthday; - data['city'] = this.city; - data['contact'] = this.contact; - data['contactType'] = this.contactType; - data['currentCity'] = this.currentCity; - data['gender'] = this.gender; - data['id'] = this.id; - if (this.interests != null) { - data['interests'] = this.interests.map((v) => v.toJson()).toList(); - } - data['isOnline'] = this.isOnline; - data['lat'] = this.lat; - data['orientation'] = this.orientation; - data['lng'] = this.lng; - data['mark'] = this.mark; - data['nickname'] = this.nickname; - data['offline_time'] = this.offlineTime; - data['onlineFlag'] = this.onlineFlag; - data['role'] = this.role; - data['signature'] = this.signature; - data['userType'] = this.userType; - data['vip'] = this.vip; - return data; - } -} - -class Interest { - int id; - String title; - int viewTotal; - - Interest({ - required this.id, - required this.title, - required this.viewTotal, - }); - - factory Interest.fromJson(Map json) { - return Interest( - id: json['id'], - viewTotal: json['viewTotal'] ?? 0, - title: json['title'], - ); - } - - Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['title'] = this.title; - data['viewTotal'] = this.viewTotal; - return data; - } -} - -class ResponseBean { - UserBean user; - int likeMeCount; - int imageUrgeCount; - int unLockWxNum; - bool isFollow; - bool isBlock; - bool isDestroy; - String accountId; - - ResponseBean( - {required this.user, - required this.likeMeCount, - required this.imageUrgeCount, - required this.unLockWxNum, - required this.accountId, - required this.isBlock, - required this.isDestroy, - required this.isFollow}); - - factory ResponseBean.fromJson(Map json) { - return ResponseBean( - accountId: json['account_id'], - unLockWxNum : json['unLockWxNum'], - user: UserBean.fromJson(json['user']), - likeMeCount: json['like_me_count'], - imageUrgeCount: json['image_urge_count'], - isBlock: json['is_been_block'], - isDestroy: json['is_destroy'], - isFollow: json['is_follow'], - ); - } -} - -class AlbumResponseBean { - List lists; - int total; - - AlbumResponseBean({ - required this.lists, - required this.total, - }); - - factory AlbumResponseBean.fromJson(Map json) { - return AlbumResponseBean( - lists: List.from( - json['lists'].map((x) => AlbumListItem.fromJson(x))), - total: json['total'], - ); - } -} - -class AlbumListItem { - int id; - int type; - String url; - String urlThumb; - - AlbumListItem({ - required this.id, - required this.type, - required this.url, - required this.urlThumb, - }); - - factory AlbumListItem.fromJson(Map json) { - return AlbumListItem( - id: json['id'], - type: json['type'], - url: json['url'], - urlThumb: json['thumb'], - ); - } -} - -class AddAlbum { - int id; - int type; - String url; - - AddAlbum({ - required this.id, - required this.type, - required this.url, - }); - - factory AddAlbum.fromJson(Map json) { - return AddAlbum( - id: json['id'], - type: json['type'], - url: json['url'], - ); - } -} - -class UrgentStatus { - bool isUrgent; - - UrgentStatus({ - required this.isUrgent, - }); - - factory UrgentStatus.fromJson(Map json) { - return UrgentStatus( - isUrgent: json['is_urge'], - ); - } -} diff --git a/circle_app/lib/app/userinfo/state.dart b/circle_app/lib/app/userinfo/state.dart deleted file mode 100644 index 8524523..0000000 --- a/circle_app/lib/app/userinfo/state.dart +++ /dev/null @@ -1,9 +0,0 @@ -import 'logic.dart'; - -class UserinfoState { - UserinfoState() { - - ///Initialize variables - } - List imaglist = []; -} diff --git a/circle_app/lib/app/userinfo/view.dart b/circle_app/lib/app/userinfo/view.dart deleted file mode 100644 index 332b910..0000000 --- a/circle_app/lib/app/userinfo/view.dart +++ /dev/null @@ -1,1641 +0,0 @@ -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:circle_app/app/userinfo/widgets/home_call_out.dart'; -import 'package:circle_app/common/Widgets/base_tip_widget.dart'; -import 'package:circle_app/common/Widgets/user_share.dart'; -import 'package:circle_app/common/colors/app_color.dart'; -import 'package:circle_app/common/const.dart'; -import 'package:circle_app/main.dart'; -import 'package:circle_app/network/api.dart'; -import 'package:circle_app/view/notice.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; - -import '../../common/Widgets/tag_widget.dart'; -import '../../components/my_app_bar.dart'; -import '../../router/app_routers.dart'; -import '../../util/eventBus.dart'; -import '../../util/util.dart'; -import '../home/logic.dart'; -import '../select_circle/logic.dart'; -import 'logic.dart'; - -class UserinfoPage extends StatefulWidget { - const UserinfoPage({super.key}); - - @override - MyTabbedScreenState createState() => MyTabbedScreenState(); -} - -class MyTabbedScreenState extends State - with SingleTickerProviderStateMixin, RouteAware { - late TabController _tabController; - - ScrollController scrollController = ScrollController(); - bool isShowBlackTitle = false; - - bool isSetState = false; - var sub; - @override - void initState() { - super.initState(); - sub = EventBusManager.on().listen((event) { - if (isSetState) { - isSetState = false; - setState(() {}); - } - }); - scrollController.addListener(() { - if (scrollController.position.pixels == - scrollController.position.maxScrollExtent) { - print('2222'); - isSetState = true; - EventBusManager.fire(ScrollViewIsEnd(true)); - setState(() {}); - } else { - EventBusManager.fire(ScrollViewIsEnd(false)); - if (isSetState) { - isSetState = false; - setState(() {}); - } - } - }); - _tabController = TabController(length: 2, vsync: this); - _tabController.animation!.addListener(_handleTabChange); - } - - @override - void didChangeDependencies() { - // TODO: implement didChangeDependencies - super.didChangeDependencies(); - - /// 路由订阅 - routeObserver.subscribe(this, ModalRoute.of(context) as PageRoute); - } - - void didPopNext() { - print('didPopNext'); - if (logic.userId.isEmpty) { - logic.fetchUserInfo(Api.getUserInfo); - } - } - - ///当前页面进入时触发 - void didPush() { - print('didPopNext'); - } - - void didPop() { - print('didPop'); - } - - void _handleTabChange() { - // 在这里可以执行滑动监听后的逻辑操作 - // 比如根据当前选中的标签执行其他操作 - // int currentIndex = .toString()); - logic.isShowAlbum = _tabController.index == 0; - logic.update(); - } - - @override - void dispose() { - _tabController.dispose(); - sub.cancel(); - routeObserver.unsubscribe(this); - super.dispose(); - } - - final logic = Get.find(); - final state = Get.find().state; - - HomeLogic homeLogic = Get.find(); - - @override - Widget build(BuildContext context) { - return GetBuilder( - builder: (logic) { - return _buildPage(logic); - }, - ); - } - - Widget _buildPage(UserinfoLogic logic) { - return Container( - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage(getBaseImage("home_back")), - fit: BoxFit.cover, - ), - ), - child: Scaffold( - backgroundColor: Colors.transparent, - appBar: homeLogic.isProd - ? MyAppBar( - centerTitle: logic.userInfoBean != null - ? "${logic.userInfoBean!.nickname}" - : "个人主页", - actionWdiget: logic.isMe - ? GestureDetector( - onTap: () async { - if (logic.userInfoBean!.contact.isNotEmpty) { - showUpdateWxPicker(); - } else { - await showAddWxPicker( - logic.userInfoBean!.contact!.isNotEmpty ?? false, - isHidden: - logic.userInfoBean!.contact!.isNotEmpty ?? - false, - isWxHidden: - logic.userInfoBean!.contact.contains('*'), - ); - logic.fetchUserInfo(Api.getUserInfo); - } - }, - child: Stack( - alignment: Alignment.center, - children: [ - Container( - width: 111.sp, - height: 26.sp, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12.sp), - gradient: LinearGradient( - colors: [ - Color(0xFF30FFD9), - Color(0xFFDD3DF4) - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - ), - Container( - width: 110.sp, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(11.sp), - color: Color(0xFF240F3B)), - alignment: Alignment.center, - height: 24.sp, - child: Text( - logic.userInfoBean != null - ? logic.userInfoBean!.contact.isNotEmpty - ? '联系方式设置' - : '填联系方式赚钱' - : '填联系方式赚钱', - style: TextStyle( - color: Colors.white, fontSize: 14.sp), - ), - ) - ], - ), - ) - : logic.userInfoBean != null - ? logic.userInfoBean!.contact.isEmpty - ? GestureDetector( - onTap: () { - logic.sendWhatToWx(); - }, - child: Stack( - alignment: Alignment.center, - children: [ - Container( - width: 111.sp, - height: 26.sp, - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(12.sp), - gradient: LinearGradient( - colors: [ - Color(0xFF30FFD9), - Color(0xFFDD3DF4) - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - ), - Container( - width: 110.sp, - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(11.sp), - color: Color(0xFF240F3B)), - alignment: Alignment.center, - height: 24.sp, - child: Row( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Image.asset( - getDisCoverImage('wx'), - width: 20.sp, - ), - SizedBox( - width: 2.sp, - ), - Text( - '想要联系方式', - style: TextStyle( - color: Colors.white, - fontSize: 13.sp), - ), - ], - ), - ) - ], - ), - ) - :Container( - alignment: Alignment.centerLeft, - // width: 200.sp, - // color: Colors.red, - margin: EdgeInsets.only(left: 5.sp, bottom: 5.sp), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - userWxStatusWidget( - !logic.userInfoBean!.contact!.contains('*'), - logic.userInfoBean!.contact!, - logic.userId.toString(), - logic.userInfoBean!.contactType!, - logic.userInfoBean!.avatar!, () { - logic.fetchUserInfo( - "${Api.getUserInfoTA + logic.userId}/home"); - }), - ], - )) - : Container()) - : MyAppBar( - centerTitle: logic.userInfoBean != null - ? "${logic.userInfoBean!.nickname}" - : "个人主页", - ), - body: Stack( - // fit: StackFit.expand, - children: [ - Container( - height: Get.height, - width: Get.width, - // color: Colors.red, - child: NestedScrollView( - controller: scrollController, - headerSliverBuilder: (context, isScrolled) { - return [ - SliverAppBar( - stretch: false, - elevation: 0, - primary: true, - pinned: false, - floating: true, - forceElevated: true, - toolbarHeight: 0, - foregroundColor: Colors.transparent, - backgroundColor: Colors.transparent, - expandedHeight: 362.sp, - // bottom: PreferredSize( - // preferredSize: Size(Get.width, 40), - // child: titleTab(logic), - // ), - flexibleSpace: FlexibleSpaceBar( - expandedTitleScale: 1.0, - centerTitle: true, - titlePadding: EdgeInsets.zero, - title: buildContent(logic), - ), - ) - ]; - }, - body: contentWidget(logic), - )), - Positioned( - bottom: 27.sp, - width: Get.width, - child: _meInfoButton(logic), - ), - !logic.isShowAlbum && logic.isMe - ? Positioned( - bottom: 36.sp, - right: 10.sp, - child: GestureDetector( - onTap: () async { - List numbers = []; - - var data = await Get.toNamed(AppRoutes.Call_out, - arguments: {'numbers': numbers}); - }, - child: Image.asset( - getCircleImage('send_msg'), - width: 60.sp, - ))) - : Container() - ], - ), - ), - ); - } - - Widget _meInfoButton(UserinfoLogic controller) { - if (controller.isMe) { - return GestureDetector( - onTap: () async { - await Get.toNamed( - AppRoutes.Complete_materialPage, - arguments: "user", - ); - logic.onInit(); - }, - child: Center( - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.symmetric( - vertical: 10.sp, - horizontal: 55.sp, - ), - child: const Text( - "完善个人形象", - style: TextStyle( - color: Colors.white, - fontSize: 12, - ), - ), - ), - )); - } else { - final likeButton = GestureDetector( - onTap: () { - _showBottomSheet(context, controller); - }, - child: Image( - image: AssetImage(getMineImage("icon_like")), - width: 40.sp, - height: 40.sp, - ), - ); - - final likeText = Text( - controller.isLike ? "取消喜欢" : "喜欢", - style: TextStyle( - color: Colors.white, - fontSize: 12.sp, - ), - ); - - final chatText = Text( - "私聊", - style: TextStyle( - color: Colors.white, - fontSize: 12.sp, - ), - ); - - final gradientDecoration = BoxDecoration( - borderRadius: BorderRadius.circular(17.sp), - gradient: const LinearGradient( - colors: [ - Color(0xff06F9FA), - Color(0xffDC5BFD), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ); - - final chatButton = GestureDetector( - onTap: () { - if (logic.isBlack || logic.isDestroy || logic.isBlackBeen) { - showOKToast("私聊失败,存在拉黑关系或者该账户已注销"); - return; - } - - if (logic.userInfoBean != null) { - String msg = Get.previousRoute; - if (msg == AppRoutes.Chat) { - Get.back(); - } else { - pushChatPage(logic.userInfoBean!.id.toString(), logic.imId, - logic.userInfoBean!.nickname); - } - } - }, - child: Container( - width: 130.sp, - height: 34.sp, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17.sp), - gradient: const LinearGradient( - colors: [ - Color(0xffDC5BFD), - Color(0xff06F9FA), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - child: Center(child: chatText), - ), - ); - - return Container( - margin: EdgeInsets.only(left: 18.sp, right: 18.sp), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - likeButton, - GestureDetector( - onTap: () { - logic.setLike(); - }, - child: Container( - width: 130.sp, - height: 34.sp, - decoration: gradientDecoration, - child: Center(child: likeText), - ), - ), - chatButton, - ], - ), - ); - } - } - - Widget buildContent(UserinfoLogic controller) { - final userInfoBean = controller.userInfoBean; - final interests = userInfoBean?.interests ?? []; - - return Container( - width: Get.width, - padding: EdgeInsets.symmetric(vertical: 14.sp), - child: Column( - children: [ - Container( - height: 68.sp, - padding: EdgeInsets.symmetric(horizontal: 15.sp), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - _imagelistView(controller), - Expanded( - child: buildUserContainer(controller), - ), - ], - ), - ), - Container( - padding: EdgeInsets.symmetric( - horizontal: 15.sp, - ), - margin: EdgeInsets.only(top: 13.sp), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - Text( - userInfoBean?.nickname ?? "", - style: TextStyle( - color: Color.fromRGBO(247, 250, 250, 1.0), - fontSize: 14.sp, - ), - ), - SizedBox(width: 8.sp), - if ((controller.userInfoBean?.mark ?? 0) > 0) - UserTagWidget(controller.userInfoBean!.mark!), - ], - ), - Container( - child: Row( - children: [ - Container( - margin: EdgeInsets.only(right: 5.sp), - width: 5.sp, - height: 5.sp, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: logic.isOnline - ? const Color(0xFF00FFF4) - : const Color(0x00000000), - ), - ), - logic.isBlack || logic.isDestroy || logic.isBlackBeen - ? Container() - : Text( - controller.onLineCity, - style: TextStyle( - fontSize: 12.sp, - color: logic.isOnline - ? const Color(0xFF00FFF4) - : const Color(0xFF00FFF4), - ), - ), - ], - ), - ), - ], - ), - ), - Container( - padding: EdgeInsets.symmetric( - horizontal: 15.sp, - ), - margin: EdgeInsets.only(top: 4.sp), - child: Row( - children: [ - logic.isBlack || logic.isDestroy || logic.isBlackBeen - ? Container() - : _buildInfoRow(controller), - Expanded(child: Container()), - Text( - '常住城市:' + (controller.userInfoBean?.city ?? ''), - style: TextStyle( - fontSize: 12.sp, - color: logic.isOnline - ? const Color(0xFF00FFF4) - : const Color(0xFF00FFF4), - ), - ), - ], - ), - ), - SizedBox( - height: 78.sp, - child: logic.isBlack || logic.isDestroy || logic.isBlackBeen - ? Container() - : _buildInterestsListView(interests), - ), - // if (!logic.isMe) - // logic.userInfoBean != null - // ? logic.userInfoBean!.contact!.isNotEmpty - // ? Container( - // alignment: Alignment.centerLeft, - // // width: 200.sp, - // // color: Colors.red, - // margin: EdgeInsets.only(left: 5.sp, bottom: 5.sp), - // child: Row( - // mainAxisAlignment: MainAxisAlignment.start, - // children: [ - // wxStatusWidget( - // !logic.userInfoBean!.contact!.contains('*'), - // logic.userInfoBean!.contact!, - // logic.userId.toString(), - // logic.userInfoBean!.contactType!, - // logic.userInfoBean!.avatar!, () { - // logic.fetchUserInfo( - // "${Api.getUserInfoTA + logic.userId}/home"); - // }), - // ], - // )) - // : Container() - // : Container(), - if (logic.userInfoBean != null && logic.giftList.isNotEmpty) - GestureDetector( - onTap: () async { - var result = await Get.toNamed(AppRoutes.GiftShopPage, - arguments: logic.userId); - logic.loadGiftListData(); - }, - child: Container( - margin: EdgeInsets.only( - top: 0.sp, left: 15.sp, right: 10.sp, bottom: 0.sp), - padding: EdgeInsets.only(left: 12.sp, right: 12.sp, top: 16.sp), - height: 134.sp, - decoration: BoxDecoration( - color: Color(0x1AFFFFFF), - borderRadius: BorderRadius.circular(14.sp)), - child: Column( - children: [ - Container( - child: Row( - children: [ - Image.asset( - getMineImage('gift_shop_icon'), - width: 65.sp, - ), - Expanded(child: Container()), - Text( - logic.toUser.isNotEmpty ? '贡献之星' : '贡献之星还在路上', - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - ), - ), - if (logic.toUser.isNotEmpty) - SizedBox( - width: 6.sp, - ), - if (logic.toUser.isNotEmpty) - Text( - '${logic.toUser['nickname']}', - style: TextStyle( - color: AppColor.mainColor, - fontSize: 14.sp, - ), - ), - SizedBox( - width: 8.sp, - ), - Image.asset( - getMineImage('chevron_left'), - width: 14.sp, - ), - ], - ), - ), - Expanded( - child: Container( - margin: EdgeInsets.only(top: 10.sp), - alignment: Alignment.centerLeft, - child: ListView.builder( - scrollDirection: Axis.horizontal, - itemCount: logic.giftList.length, - itemBuilder: (BuildContext context, int giftIndex) { - var info = logic.giftList[giftIndex]; - bool isGet = false; - int num = 0; - logic.recevigiftList.forEach((element) { - if (element['giftId'] == info['id']) { - isGet = true; - num = element['num']; - } - }); - return GestureDetector( - onTap: () {}, - child: Container( - margin: EdgeInsets.only(right: 10.sp), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Stack(children: [ - Opacity( - opacity: !isGet ? 0.6 : 1, - child: Image.network( - info['icon'], - width: 50.sp, - height: 50.sp, - fit: BoxFit.cover, - ), - ), - ]), - SizedBox( - height: 6.sp, - ), - GestureDetector( - onTap: () { - logic.sendGiftData( - logic.imId, - info['id'].toString(), - logic.imId.split('_').last, - ); - }, - child: Container( - height: 20.sp, - width: 52.sp, - // padding: EdgeInsets.only(left: 5.sp,right: 5.sp), - alignment: Alignment.center, - decoration: BoxDecoration( - gradient: - AppColor.mainVerLinearGradient, - borderRadius: - BorderRadius.circular(10.sp)), - child: Text( - !isGet ? '点亮' : '赠送', - style: TextStyle( - color: Colors.white, - fontSize: 11.sp), - ), - ), - ) - ], - ), - ), - ); - }), - )) - ], - ), - ), - ), - // titleTab(controller), - ], - ), - ); - - // Expanded( - // child: PageView( - // controller: _pageController, - // onPageChanged: (index) { - // _tabController.animateTo(index); - // }, - // children: [ - // logic.isBlack || logic.isDestroy || logic.isBlackBeen - // ? Container() - // : _imageAdapter(controller), - // logic.isBlack || logic.isDestroy || logic.isBlackBeen - // ? Container() - // : HomeCallOutView(controller.userId), - // ], - // ), - // ), - } - - contentWidget(UserinfoLogic controller) { - return Column( - children: [ - titleTab(controller), - Expanded( - child: TabBarView( - controller: _tabController, - // controller: _pageController, - // onPageChanged: (index) { - // _tabController.animateTo(index); - // }, - children: [ - logic.isBlack || logic.isDestroy || logic.isBlackBeen - ? Container() - : _imageAdapter(controller), - logic.isBlack || logic.isDestroy || logic.isBlackBeen - ? Container() - : HomeCallOutView(controller.userId), - ], - ), - ), - ], - ); - } - - Widget _buildInterestsListView(List interests) { - return ListView.builder( - itemCount: interests.length, - scrollDirection: Axis.horizontal, - padding: EdgeInsets.symmetric(vertical: 15.sp, horizontal: 15.sp), - itemBuilder: (context, index) { - final interest = interests[index]; - return GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.Signal_circle_list, - arguments: interests[index].id); - }, - child: Container( - margin: EdgeInsets.only(right: 11.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8.0), - gradient: const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - ), - color: const Color(0xFF392D53), - ), - child: Container( - margin: EdgeInsets.all(0.2.sp), - padding: EdgeInsets.only(left: 5.sp, right: 0.sp, top: 5.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8.0), - color: const Color(0xFF392D53), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - // color: Colors.red, - child: Row( - children: [ - Text( - interest.title, - style: TextStyle( - fontSize: 13.sp, - color: Colors.white, - ), - ), - Container( - margin: EdgeInsets.only( - bottom: 2.sp, - ), - child: Icon( - Icons.keyboard_arrow_right, - color: Colors.white, - size: 18.sp, - ), - ) - ], - ), - ), - Text( - '${interest.viewTotal}人看过', - style: TextStyle( - fontSize: 13.sp, - color: AppColor.mainColor, - ), - ), - ], - )), - ), - ); - }, - ); - } - - Widget titleTab(UserinfoLogic controller) { - String buttonText = ""; - - if (controller.isMe) { - if (logic.isShowAlbum) { - buttonText = controller.isEdit ? "完成" : "管理"; - } else { - buttonText = "发布喊话"; - } - } else { - buttonText = controller.isUrgeStatus ? "已催更" : "催更"; - } - return Container( - alignment: Alignment.centerLeft, - padding: EdgeInsets.only(left: 0, right: 10.sp), - height: 27.sp, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - TabBar( - isScrollable: true, - controller: _tabController, - indicator: UnderlineTabIndicator( - borderSide: BorderSide( - color: const Color(0xFF00FFF4), - width: 2.sp, - ), - insets: EdgeInsets.symmetric(horizontal: 12.0.sp), - borderRadius: BorderRadius.circular(18.0), - ), - indicatorColor: const Color(0xFF00FFF4), - indicatorWeight: 2.sp, - labelColor: const Color(0xFF00FFF4), - unselectedLabelColor: const Color(0xB3FFFFFF), - indicatorSize: TabBarIndicatorSize.label, - tabs: const [ - Tab( - text: "形象照", - ), - Tab(text: "喊话"), - ], - // onTap: (index) { - // _pageController.animateToPage( - // index, // 目标页面索引 - // duration: const Duration(milliseconds: 300), // 动画时长 - // curve: Curves.ease, // 动画曲线 - // ); - // }, - ), - logic.isBlack || logic.isDestroy || logic.isBlackBeen - ? Container() - : _tabController.index == 0 - ? GestureDetector( - onTap: () { - if (!logic.isShowAlbum && controller.isMe) { - List numbers = []; - var data = Get.toNamed(AppRoutes.Call_out, - arguments: {'numbers': numbers}); - return; - } - if (controller.isMe) { - controller.isEdit = !controller.isEdit; - controller.update(); - } else { - controller.urgeChange(); - } - }, - child: Visibility( - // visible: logic.isShowAlbum, - child: Container( - margin: EdgeInsets.only(left: 10.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.symmetric( - vertical: 2.sp, - horizontal: 12.sp, - ), - child: Text( - buttonText, - style: const TextStyle( - color: Colors.white, - fontSize: 12, - ), - ), - ), - ), - ) - : Container(), - ], - ), - ); - } - - Widget _imageAdapter(UserinfoLogic controller) { - //print(controller.state.imaglist); - - // : - return Container( - // margin: EdgeInsets.only( 0.sp), - padding: EdgeInsets.symmetric(horizontal: 19.sp), - child: Stack( - children: [ - Column( - children: [ - if (controller.isMe) - Container( - margin: EdgeInsets.only(top: 18.sp, bottom: 14.sp), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - controller.likeMeCount.toString(), - style: TextStyle(color:AppColor.mainColor), - ), - Text( - '位圈友感兴趣,其中', - style: const TextStyle(color: Colors.white30), - ), - Text( - controller.imageUrgeCount.toString(), - style: TextStyle(color:AppColor.mainColor), - ), - Text( - '位已催您更新', - style: const TextStyle(color: Colors.white30), - ), - ], - ), - ), - controller.state.imaglist.isEmpty && !controller.isMe - ? Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - const SizedBox( - height: 30, - ), - Image.asset( - getBaseImage('no_result'), - width: 200, - // height: 11, - ), - const SizedBox( - height: 26, - ), - Text( - controller.isMe - ? "点击管理即可上传形象照哦~" - : "TA还没有发布过形象照,快去催TA更新吧~", - style: const TextStyle(color: Colors.white30), - ), - ]), - ) - : Expanded( - child: GridView.builder( - padding: const EdgeInsets.only(bottom: 58.0), - shrinkWrap: true, - gridDelegate: - const SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 3, - ), - itemCount: controller.isMe - // ? controller.isEdit - // ? controller.state.imaglist.length < 15 - // ? controller.state.imaglist.length - ? controller.state.imaglist.length + 1 - : controller.state.imaglist.length, - itemBuilder: (BuildContext context, int index) { - // print("123123123123"); - if (controller.isMe) { - if (index == 0) { - return GestureDetector( - onTap: () { - if (controller.state.imaglist.length >= 15) { - showOKToast("最大只可上传15张图片哦~"); - return; - } - controller.getImageFile(); - }, - child: Container( - margin: EdgeInsets.all(5.sp), - child: Image( - image: AssetImage( - getMineImage("icon_img_add")), - ), - ), - ); - } else { - return Container( - margin: EdgeInsets.all(5.sp), - child: Center( - child: _buildImageItem( - controller.state.imaglist[index - 1].url, - controller, - index - 1, - ), - ), - ); - } - } else { - return Container( - margin: EdgeInsets.all(5.sp), - child: Center( - child: _buildImageItem( - controller.state.imaglist[index].urlThumb, - controller, - index, - ), - ), - ); - } - }, - ), - ), - ], - ), - ], - ), - ); - } - - Widget _buildInfoRow(UserinfoLogic controller) { - return Row( - children: [ - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color.fromRGBO(141, 255, 248, 1.0), - Color.fromRGBO(181, 211, 255, 1.0), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 2.sp, - bottom: 2.sp, - left: 10.sp, - right: 10.sp, - ), - child: Text( - controller.ageMsg, - style: const TextStyle( - color: Colors.black, - fontSize: 10, - ), - ), - ), - const SizedBox(width: 6), - ], - ); - } - - Widget buildUserContainer(UserinfoLogic controller) { - return Container( - margin: EdgeInsets.only(left: 3.sp), - height: 58.sp, - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage(getMineImage("icon_user_content")), - fit: BoxFit.fill, - ), - ), - child: Container( - margin: EdgeInsets.only(left: 24.sp), - child: Center( - child: Text( - controller.userInfoBean != null - ? controller.userInfoBean!.signature - : "", - maxLines: 2, - style: TextStyle(color: Colors.white, fontSize: 15.sp), - overflow: TextOverflow.ellipsis, - ), - ), - ), - ); - } - - Widget _imagelistView(UserinfoLogic controller) { - return Stack( - alignment: Alignment.center, - children: [ - Container( - width: 68.sp, - height: 68.sp, - decoration: const BoxDecoration( - shape: BoxShape.circle, - gradient: LinearGradient( - colors: [Color(0xFFDD3DF4), Color(0xFF30FFD9)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - SizedBox( - width: 66.sp, - height: 66.sp, - child: _buildAvatar1(controller), - ), - ], - ); - } - - Widget _buildAvatar1(UserinfoLogic controller) { - if (controller.userInfoBean == null) { - return SizedBox( - width: 66.sp, - height: 66.sp, - ); - } else { - return ClipOval( - child: GestureDetector( - onTap: () { - var imgList = []; - imgList.add(controller.userInfoBean!.avatar); - Get.toNamed(AppRoutes.Swiper, - arguments: {'imaglist': imgList, 'index': 0}); - }, - child: CachedNetworkImage( - fit: BoxFit.cover, - placeholder: null, - imageUrl: controller.userInfoBean != null - ? controller.userInfoBean!.avatar - : "", - width: 66.sp, - height: 66.sp, - ), - ), - ); - } - } - - Widget _buildImageItem(String url, UserinfoLogic controller, int index) { - return Stack( - children: [ - SizedBox( - width: double.infinity, - height: double.infinity, - child: ClipRRect( - borderRadius: BorderRadius.circular(0.0), - child: GestureDetector( - onTap: () { - List imaglist = []; - for (var element in controller.state.imaglist) { - imaglist.add(element.url); - } - Get.toNamed(AppRoutes.Swiper, - arguments: {'imaglist': imaglist, 'index': index}); - }, - child: Image.network( - fit: BoxFit.cover, - url, - ), - ), - ), - ), - if (controller.userId == "") - Positioned( - top: 0, - right: 0, - child: GestureDetector( - onTap: () { - _showDelImgDialog(context, controller, index); - }, - child: Visibility( - visible: controller.isEdit, - child: Image( - image: AssetImage(getMineImage("icon_img_del")), - width: 20.sp, - height: 20.sp, - ), - ), - ), - ), - ], - ); - } - - void _showBottomSheet(BuildContext context, UserinfoLogic controller) { - showModalBottomSheet( - context: context, - backgroundColor: Colors.transparent, - builder: (BuildContext context) { - return Container( - decoration: const BoxDecoration( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(16.0), - topRight: Radius.circular(16.0), - ), - gradient: LinearGradient( - colors: [ - Color(0xFF4A3E5D), - Color(0xFF344143), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - height: 118.0, - width: double.infinity, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - GestureDetector( - onTap: () { - Navigator.pop(context); - if (logic.userInfoBean == null) return; - Get.bottomSheet( - UserShare( - userImgUrl: logic.userInfoBean!.avatar!, - userNIckName: '', - userInfoBean: logic.userInfoBean!), - isScrollControlled: true); - }, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image( - image: AssetImage(getMsgImage("msg_share")), - width: 40.sp, - height: 40.sp, - ), - Container( - margin: EdgeInsets.only(top: 2.sp), - child: const Text( - "分享", - style: TextStyle(color: Colors.white), - ), - ), - ], - ), - ), - GestureDetector( - onTap: () { - Navigator.pop(context); - Get.toNamed(AppRoutes.ReportActivity, - arguments: {"userId": logic.userId}); - }, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image( - image: AssetImage(getMineImage("icon_report")), - width: 40.sp, - height: 40.sp, - ), - Container( - margin: EdgeInsets.only(top: 2.sp), - child: const Text( - "举报", - style: TextStyle(color: Colors.white), - ), - ), - ], - ), - ), - GestureDetector( - onTap: () { - if (controller.isBlack) { - logic.setBlock("0"); - Navigator.pop(context); - } else { - Navigator.pop(context); - _showReportDialog(context); - } - }, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image( - image: AssetImage(getMineImage("icon_block")), - width: 40.sp, - height: 40.sp, - ), - Container( - margin: EdgeInsets.only(top: 2.sp), - child: Text( - controller.isBlack ? "取消拉黑" : "拉黑", - style: TextStyle(color: Colors.white), - ), - ), - ], - ), - ), - ], - ), - ); - }, - ); - } - - void _showDelImgDialog( - BuildContext context, UserinfoLogic controller, int index) { - showDialog( - context: context, - builder: (BuildContext context) { - return Dialog( - backgroundColor: Colors.transparent, - child: Container( - height: 160.sp, - padding: const EdgeInsets.all(1.0), - child: Stack( - children: [ - Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: const LinearGradient( - colors: [Color(0xFFDD3DF4), Color(0xFF30FFD9)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Container( - margin: EdgeInsets.all(1.sp), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: const LinearGradient( - colors: [Color(0xFF4C3E5F), Color(0xFF324140)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Container( - margin: EdgeInsets.only(top: 24.sp), - child: Column( - children: [ - Center( - child: Text( - "提示", - style: - TextStyle(color: Colors.white, fontSize: 16.sp), - ), - ), - Container( - margin: EdgeInsets.only( - top: 12.sp, left: 14.sp, right: 14.sp), - alignment: Alignment.center, - child: Text( - "是否确认删除该形象照。", - textAlign: TextAlign.center, - style: TextStyle( - color: const Color(0xCCF7FAFA), fontSize: 16.sp), - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - onTap: () { - Navigator.pop(context); - }, - child: Container( - margin: EdgeInsets.only(top: 30.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color(0x26FFFFFF), - Color(0x26FFFFFF), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 10.sp, - bottom: 10.sp, - left: 52.sp, - right: 52.sp), - child: const Text( - "否", - style: TextStyle( - color: Colors.white, - fontSize: 12, - ), - ), - ), - ), - SizedBox(width: 24.sp), - GestureDetector( - onTap: () { - Navigator.pop(context); - controller.delAlbumImage(index); - }, - child: Container( - margin: EdgeInsets.only(top: 24.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 10.sp, - bottom: 10.sp, - left: 52.sp, - right: 52.sp), - child: const Text( - "是", - style: TextStyle( - color: Colors.white, - fontSize: 12, - ), - ), - ), - ) - ], - ) - ], - ), - ) - ], - ), - ), - ); - }, - ); - } - - void _showReportDialog(BuildContext context) { - showDialog( - context: context, - builder: (BuildContext context) { - return Dialog( - backgroundColor: Colors.transparent, - child: Container( - height: 277.sp, - padding: const EdgeInsets.all(1.0), - child: Stack( - children: [ - Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: const LinearGradient( - colors: [Color(0xFFDD3DF4), Color(0xFF30FFD9)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Container( - margin: EdgeInsets.all(1.sp), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(10.0), - gradient: const LinearGradient( - colors: [Color(0xFF4C3E5F), Color(0xFF324140)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - Container( - margin: EdgeInsets.only(top: 24.sp), - child: Column( - children: [ - Center( - child: Text( - "是否拉黑", - style: - TextStyle(color: Colors.white, fontSize: 16.sp), - ), - ), - Container( - margin: EdgeInsets.only(top: 14.sp), - alignment: Alignment.center, - child: Image( - image: AssetImage(getMineImage("icon_dialog_black")), - width: 70.sp, - height: 70.sp, - ), - ), - Container( - margin: EdgeInsets.only( - top: 12.sp, left: 14.sp, right: 14.sp), - alignment: Alignment.center, - child: Text( - "拉黑后,你将屏蔽对方的任何信息若您关注了对方,将自动取消关注。", - textAlign: TextAlign.center, - style: TextStyle( - color: const Color(0xCCF7FAFA), fontSize: 16.sp), - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - onTap: () { - Navigator.pop(context); - }, - child: Container( - margin: EdgeInsets.only(top: 24.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color(0x26FFFFFF), - Color(0x26FFFFFF), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 10.sp, - bottom: 10.sp, - left: 52.sp, - right: 52.sp), - child: const Text( - "否", - style: TextStyle( - color: Colors.white, - fontSize: 12, - ), - ), - ), - ), - SizedBox(width: 24.sp), - GestureDetector( - onTap: () { - logic.setBlock("1"); - }, - child: Container( - margin: EdgeInsets.only(top: 24.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 10.sp, - bottom: 10.sp, - left: 52.sp, - right: 52.sp), - child: const Text( - "是", - style: TextStyle( - color: Colors.white, - fontSize: 12, - ), - ), - ), - ) - ], - ) - ], - ), - ) - ], - ), - ), - ); - }, - ); - } -} - -class ScrollViewIsEnd { - bool isEnd; - ScrollViewIsEnd(this.isEnd); -} - -class ScrollViewScrollTop {} diff --git a/circle_app/lib/app/userinfo/widgets/home_call_out.dart b/circle_app/lib/app/userinfo/widgets/home_call_out.dart deleted file mode 100644 index 6029093..0000000 --- a/circle_app/lib/app/userinfo/widgets/home_call_out.dart +++ /dev/null @@ -1,762 +0,0 @@ -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:circle_app/app/circle/state.dart'; -import 'package:circle_app/app/circle/widgets/video_item.dart'; -import 'package:circle_app/app/userinfo/widgets/home_call_out_logic.dart'; -import 'package:circle_app/router/app_routers.dart'; -import 'package:circle_app/util/eventBus.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:get/get_core/src/get_main.dart'; -import 'package:get/get.dart'; - -import '../../../common/Widgets/text_more.dart'; -import '../logic.dart'; -import '../view.dart'; - -class HomeCallOutView extends StatefulWidget { - // Get.lazyPut(() => ListLogic()); - - String userId; - - HomeCallOutView(this.userId, {super.key}); - - @override - State createState() => _HomeCallOutViewState(); -} - -class _HomeCallOutViewState extends State - with AutomaticKeepAliveClientMixin { - @override - bool get wantKeepAlive => true; - HomeCallOutLogic? listsLg; - - ScrollController scrollController = ScrollController(); - UserinfoLogic logic = Get.find(); - - bool isEnd = false; - var sub; - @override - void initState() { - // TODO: implement initState - super.initState(); - - sub = EventBusManager.on().listen((event) { - if (event.isEnd) { - isEnd = true; - setState(() {}); - } else { - isEnd = false; - setState(() {}); - } - }); - - scrollController.addListener(() { - scrollController.jumpTo(0); - }); - - Get.lazyPut(() => HomeCallOutLogic()); - listsLg = Get.find(); - listsLg?.loadCallOutListData(widget.userId); - - listsLg!.scrollController.addListener(() { - if (listsLg!.scrollController.offset <= 0) { - EventBusManager.fire(ScrollViewScrollTop()); - isEnd = false; - setState(() {}); - } - }); - } - - @override - void dispose() { - // TODO: implement dispose - super.dispose(); - scrollController.dispose(); - sub.cancel(); - listsLg?.onClose(); - } - - @override - Widget build(BuildContext context) { - return GetBuilder( - assignId: true, - builder: (listLogic) { - return listLogic.lists.isEmpty - ? Center( - child: Image.asset( - getBaseImage('no_result'), - width: 200, - // height: 11, - ), - ) - : Container( - width: Get.width, - // margin: EdgeInsets.only(top: isEnd ? 40.sp : 0.sp), - child: listLogic.lists.isEmpty - ? loaddingWidget(true) - : ListView.builder( - // physics: const AlwaysScrollableScrollPhysics(), - physics: isEnd - ? AlwaysScrollableScrollPhysics() - : NeverScrollableScrollPhysics(), - // shrinkWrap:true, - padding: EdgeInsets.only( - bottom: - MediaQuery.of(context).padding.bottom + 56.sp), - scrollDirection: Axis.vertical, - controller: listLogic.scrollController, - itemCount: listLogic.lists.length + 1, - itemBuilder: (context, index) { - if (listLogic.lists.length > index) { - Lists lists = listLogic.lists[index]; - if (lists.isQueen!) { - return vipDynamicItem(lists); - } else { - return normalDynamicItem(lists); - } - } else { - return Container( - margin: EdgeInsets.only( - top: listLogic.callOutMore ? 0 : 10.sp), - child: loaddingWidget(listLogic.callOutMore), - ); - } - })); - }, - ); - } - - ///至尊喊话 - vipDynamicItem(Lists lists) { - Widget descText = logic.openCallOutIdList.contains(lists.id) ? Text( - lists.content!, - style: TextStyle(color: Colors.white, fontSize: 14.sp), - ) : HideText(text: lists.content!,maxWidth: Get.currentRoute == AppRoutes.Home ? Get.width - 90.sp : Get.width - 20.sp,additionText: '查看更多',maxLines: 15,style: TextStyle(color: Colors.white, fontSize: 14.sp),additionStyle: TextStyle(color: const Color(0xFFFF4DF6), fontSize: 14.sp),onTap: () { - logic.openCallOutIdList.add(lists.id); - setState(() { - - }); - }, - ); - - double picHeight = 0.0; - - int type = 0; - if (lists.album != null) { - if (lists.album!.isNotEmpty) { - Album info = lists.album!.first!; - type = info.type!; - - if (info.type == 1) { - picHeight = 140.sp; - if (info.type == 1) { - if (lists.album!.length > 3 && lists.album!.length < 7) { - picHeight = picHeight * 2; - } else if (lists.album!.length >= 7) { - picHeight = picHeight * 3; - } - } - } else { - picHeight = 200.sp; - } - } - } - double titleHeight = textWidth(lists.interest!['title']); - // double widgetHeight = 115.sp + - // contentHeight(lists.content!) + - // (picHeight > 0 ? picHeight + 5 : 0); - - return Column( - children: [ - Container( - margin: EdgeInsets.only(top: 14.sp, bottom: 10.sp), - alignment: Alignment.centerLeft, - child: Text( - lists.create_time.toString(), - style: TextStyle(color: Colors.white, fontSize: 12.sp), - ), - ), - Container( - margin: EdgeInsets.only(top: 10.sp), - width: Get.width, - // height: widgetHeight, - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.fill, - image: AssetImage( - getCircleImage('pic_bg'), - ))), - child: Stack(children: [ - Positioned( - left: 0, - top: 2.sp, - child: Image.asset(getCircleImage('vip_say')), - height: 18.sp, - ), - Positioned( - right: 2.sp, - top: 2.sp, - child: Stack( - alignment: Alignment.center, - children: [ - Image.asset( - getCircleImage('location'), - width: titleHeight + 15.sp, - height: 20.sp, - fit: BoxFit.fitWidth, - ), - Text( - lists.interest!['title'], - style: TextStyle(color: Colors.white, fontSize: 12.sp), - ) - ], - ), - ), - Container( - // height: widgetHeight, - width: Get.width, - padding: EdgeInsets.only(top: 12.sp, left: 12.sp, right: 12.sp,bottom: 12.sp), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - height: 72.sp, - child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - child: Stack( - alignment: Alignment.center, - children: [ - Image.asset( - getCircleImage('avatar_bg'), - width: 42.sp, - ), - GestureDetector( - onTap: () { - listsLg?.pushMsgPage( - lists, lists.id.toString()); - }, - child: ClipOval( - child: Image.network( - lists.user!.avatar!, - width: 40.sp, - height: 40.sp, - fit: BoxFit.cover, - ), - ), - ) - ], - )), - Expanded( - child: Container( - padding: EdgeInsets.only(left: 8.sp, top: 12.sp), - alignment: Alignment.centerLeft, - height: 72.sp, - child: Column( - children: [ - Row( - children: [ - Text( - lists.user!.nickname!, - style: TextStyle( - color: Colors.white, - fontSize: 18.sp, - fontWeight: FontWeight.w600), - ), - SizedBox( - width: 8.sp, - ), - lists.user!.vip! == 0 - ? Container() - : Image.asset( - getCircleImage(lists.user!.vip == 1 - ? 'vip' - : 'year_vip'), - width: 36.sp, - ) - ], - ), - SizedBox( - height: 4.sp, - ), - Row( - children: [ - Container( - alignment: Alignment.center, - height: 18.sp, - padding: EdgeInsets.only( - left: 6.sp, right: 6.sp), - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(9.sp), - gradient: const LinearGradient( - begin: Alignment(0.25, 0.5), - end: Alignment(0.75, 0.5), - colors: [ - Color(0xff8DFFF8), - Color(0xffB5D3FF) - ])), - child: Text( - getAgeCOntent( - lists.user!.gender!, - lists.user!.age!, - lists.user!.role!, - lists.user!.orientation!), - - // '${genderList[lists.user!.gender!]}.${lists.user!.age}.${roleList[lists.user!.role!]}.${orientationList[lists.user!.orientation!]}', - style: TextStyle( - color: Colors.black, - fontSize: 10.sp, - ), - ), - ) - ], - ), - ], - ), - )), - ], - ), - ), - Container( - alignment: Alignment.topLeft, - // margin: EdgeInsets.only(top: 4.sp), - child: descText, - ), - Container( - height: picHeight, - margin: EdgeInsets.only(top: 5.sp), - child: picHeight == 200.sp - ? ClipRRect( - borderRadius: BorderRadius.circular(6.sp), - child: VideoItemWidget(lists.album![0]!.url!)) - : GridView.builder( - controller: scrollController, - itemCount: lists.album!.length, - physics: const NeverScrollableScrollPhysics(), - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 3, //横轴三个子widget - crossAxisSpacing: 8.sp, - mainAxisSpacing: 8.sp, - childAspectRatio: 0.8 //宽高比为1时,子widget - ), - itemBuilder: (contentxt, currentIndex) { - Album album = lists.album![currentIndex]; - return GestureDetector( - onTap: () { - var imgList = []; - for (var element in lists.album!) { - imgList.add(element.url!); - } - Get.toNamed(AppRoutes.Swiper, arguments: { - 'imaglist': imgList, - 'index': currentIndex - }); - }, - child: ClipRRect( - borderRadius: BorderRadius.circular(6.sp), - child: CachedNetworkImage( - imageUrl: album.url!, - errorWidget: (context, url, error) => - Icon(Icons.error), - fit: BoxFit.cover, - ), - ), - ); - }), - ), - if (widget.userId.isEmpty) - Container( - width: Get.width, - margin: EdgeInsets.only(top: 4.sp,bottom: 5.sp), - alignment: Alignment.centerLeft, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - "", - style: TextStyle( - color: Colors.white, fontSize: 1.sp), - ), - widget.userId.isNotEmpty - ? Container() - : GestureDetector( - onTap: () { - showTipPiker(lists.id!.toString(), - listsLg!.lists.indexOf(lists)); - }, - child: Image.asset( - getCircleImage('delete'), - width: 20.sp, - )) - ], - )) - ], - ), - ) - ])), - ], - ); - } - - ///普通图文喊话 - normalDynamicItem(Lists lists) { - Widget descText = logic.openCallOutIdList.contains(lists.id) ? Text( - lists.content!, - style: TextStyle(color: Colors.white, fontSize: 14.sp), - ) : HideText(text: lists.content!,maxWidth: Get.currentRoute == AppRoutes.Home ? Get.width - 90.sp : Get.width - 20.sp,additionText: '查看更多',maxLines: 15,style: TextStyle(color: Colors.white, fontSize: 14.sp),additionStyle: TextStyle(color: const Color(0xFFFF4DF6), fontSize: 14.sp),onTap: () { - logic.openCallOutIdList.add(lists.id); - setState(() { - - }); - }, - ); - - double picHeight = 0.0; - - int type = 0; - if (lists.album != null) { - if (lists.album!.isNotEmpty) { - Album info = lists.album!.first!; - type = info.type!; - - if (info.type == 1) { - picHeight = 140.sp; - if (info.type == 1) { - if (lists.album!.length > 3 && lists.album!.length < 7) { - picHeight = picHeight * 2; - } else if (lists.album!.length >= 7) { - picHeight = picHeight * 3; - } - } - } else { - picHeight = 200.sp; - } - } - } - - double titleHeight = textWidth(lists.interest!['title']); - - return Column( - children: [ - Container( - margin: EdgeInsets.only(top: 14.sp, bottom: 10.sp), - alignment: Alignment.centerLeft, - child: Text( - lists.create_time.toString(), - style: TextStyle(color: Colors.white, fontSize: 12.sp), - ), - ), - Container( - margin: EdgeInsets.only(top: 10.sp), - width: Get.width, - // height: picHeight > 0 - // ? 105.sp + contentHeight(lists.content!) + picHeight - // : 100.sp + contentHeight(lists.content!), - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.fill, - image: AssetImage( - getCircleImage('normal_bg'), - ))), - child: Stack( - children: [ - Positioned( - right: 2.sp, - top: 2.sp, - child: Stack( - alignment: Alignment.center, - children: [ - Image.asset( - getCircleImage('location'), - width: titleHeight + 15.sp, - height: 20.sp, - fit: BoxFit.fitWidth, - ), - Text( - lists.interest!['title'], - style: TextStyle(color: Colors.white, fontSize: 12.sp), - ) - ], - ), - // height: 18.sp, - ), - Container( - // height: 130.sp + contentHeight(lists.content!) + picHeight, - width: Get.width, - // color: Colors.blue, - padding: EdgeInsets.only(left: 12.sp, right: 12.sp), - child: Column( - children: [ - Container( - height: 72.sp, - child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - child: Stack( - alignment: Alignment.center, - children: [ - Image.asset( - getCircleImage('avatar_bg'), - width: 42.sp, - ), - GestureDetector( - onTap: () {}, - child: ClipOval( - child: Image.network( - lists.user!.avatar!, - width: 40.sp, - height: 40.sp, - fit: BoxFit.cover, - ), - )) - ], - )), - Expanded( - child: Container( - padding: EdgeInsets.only(left: 8.sp, top: 12.sp), - alignment: Alignment.centerLeft, - height: 72.sp, - child: Column( - children: [ - Row( - children: [ - Text( - lists.user!.nickname! ?? '', - style: TextStyle( - color: Colors.white, - fontSize: 18.sp, - fontWeight: FontWeight.w600), - ), - SizedBox( - width: 8.sp, - ), - lists.user!.vip! == 0 - ? Container() - : Image.asset( - getCircleImage(lists.user!.vip == 1 - ? 'vip' - : 'year_vip'), - width: 36.sp, - ) - ], - ), - SizedBox( - height: 4.sp, - ), - Row( - children: [ - Container( - alignment: Alignment.center, - height: 18.sp, - padding: EdgeInsets.only( - left: 6.sp, right: 6.sp), - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(9.sp), - gradient: const LinearGradient( - begin: Alignment(0.25, 0.5), - end: Alignment(0.75, 0.5), - colors: [ - Color(0xff8DFFF8), - Color(0xffB5D3FF) - ])), - child: Text( - getAgeCOntent( - lists.user!.gender!, - lists.user!.age!, - lists.user!.role!, - lists.user!.orientation!), - // '${genderList[lists.user!.gender!]}.${lists.user!.age}.${roleList[lists.user!.role!]}.${orientationList[lists.user!.orientation!]}', - style: TextStyle( - color: Colors.black, - fontSize: 12.sp, - ), - ), - ) - ], - ), - ], - ), - )), - ], - ), - ), - Container( - alignment: Alignment.topLeft, - // margin: EdgeInsets.only(top: 4.sp), - child: descText, - ), - SizedBox(height: picHeight > 0 ? 5.sp : 10.sp,), - picHeight > 0 - ? Container( - height: picHeight, - // alignment: Alignment.centerLeft, - margin: EdgeInsets.only(bottom: 10.sp), - child: picHeight == 200.sp - ? ClipRRect( - borderRadius: BorderRadius.circular(6.sp), - child: - VideoItemWidget(lists.album![0].url!)) - : GridView.builder( - controller: scrollController, - // shrinkWrap: true, - itemCount: lists.album!.length, - physics: - const NeverScrollableScrollPhysics(), - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 3, //横轴三个子widget - crossAxisSpacing: 8.sp, - mainAxisSpacing: 8.sp, - childAspectRatio: - 0.8 //宽高比为1时,子widget - ), - itemBuilder: (contentxt, currentIndex) { - Album album = lists.album![currentIndex]; - return GestureDetector( - onTap: () { - var imgList = []; - for (var element in lists.album!) { - imgList.add(element.url!); - } - Get.toNamed(AppRoutes.Swiper, - arguments: { - 'imaglist': imgList, - 'index': currentIndex - }); - }, - child: ClipRRect( - borderRadius: - BorderRadius.circular(6.sp), - child: CachedNetworkImage( - imageUrl: album.url!, - fit: BoxFit.cover, - ), - ), - ); - })) - : Container(), - if (widget.userId.isEmpty) - Container( - width: Get.width, - margin: EdgeInsets.only(top: 4.sp,bottom: 5.sp), - alignment: Alignment.centerLeft, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - "", - style: TextStyle( - color: Colors.white, fontSize: 12.sp), - ), - widget.userId.isNotEmpty - ? Container() - : GestureDetector( - onTap: () { - showTipPiker(lists.id!.toString(), - listsLg!.lists.indexOf(lists)); - }, - child: Image.asset( - getCircleImage('delete'), - width: 20.sp, - )) - ], - )) - ], - ), - ) - ], - ), - ), - ], - ); - } - - circleWidget(String url, {double width = 30}) { - return GestureDetector( - child: Stack( - alignment: Alignment.center, - children: [ - Image.asset( - getCircleImage('avatar_bg'), - width: width.sp, - ), - ClipOval( - child: Image.network( - url, - width: (width - 1).sp, - height: (width - 1).sp, - fit: BoxFit.fill, - ), - ) - ], - )); - } - - double contentHeight(String content) { - return calculateTextHeight( - content, 14.sp, FontWeight.w300, Get.width - 64.sp, 100); - } - - double textWidth(value) { - TextPainter painter = TextPainter( - - ///AUTO:华为手机如果不指定locale的时候,该方法算出来的文字高度是比系统计算偏小的。 - locale: WidgetsBinding.instance!.window.locale, - maxLines: 1, - textDirection: TextDirection.ltr, - textScaleFactor: 1, - //字体缩放大小 - text: TextSpan( - text: value, - style: TextStyle( - fontSize: 12.sp, - ))); - painter.layout(maxWidth: 350); - return painter.width; - } - - showTipPiker(String callOutId, int index) { - return Get.bottomSheet( - Scaffold( - backgroundColor: Colors.transparent, - body: CupertinoAlertDialog( - content: SingleChildScrollView( - child: ListBody( - children: const [ - Text("是否要删除该喊话?"), - ], - ), - ), - actions: [ - CupertinoDialogAction( - child: const Text( - "确定", - style: TextStyle(color: Colors.red), - ), - onPressed: () { - Get.back(); - listsLg?.removeData(callOutId, index); - }, - ), - CupertinoDialogAction( - child: const Text("取消"), - onPressed: () { - Get.back(); - }, - ), - ], - ), - ), - isScrollControlled: true, - enableDrag: false, - ); - } -} diff --git a/circle_app/lib/app/userinfo/widgets/home_call_out_logic.dart b/circle_app/lib/app/userinfo/widgets/home_call_out_logic.dart deleted file mode 100644 index 2ed935c..0000000 --- a/circle_app/lib/app/userinfo/widgets/home_call_out_logic.dart +++ /dev/null @@ -1,81 +0,0 @@ -import 'package:circle_app/app/circle/state.dart'; -import 'package:circle_app/common/Widgets/base_tip_widget.dart'; -import 'package:circle_app/common/Widgets/open_vip_tip/view.dart'; -import 'package:circle_app/network/dio_manager.dart'; -import 'package:circle_app/router/app_routers.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; - -class HomeCallOutLogic extends GetxController { - int callOutPage = 1; - bool isLoad = true; - bool callOutMore = true; - var _userId = ''; - List lists = []; - final ScrollController scrollController = ScrollController(); - - loadCallOutListData(String userId) async { - _userId = userId; - var data = await DioManager.instance.get( - url: "/up-service/${_userId.isEmpty ? 'my/' : 'user/' + userId}/callouts", - params: {"page": callOutPage, "page_size": "20"}); - if (data["code"] == 200) { - List dataList = data["data"]["lists"] ?? []; - if (callOutPage == 1) { - if (lists.isNotEmpty) { - lists.clear(); - } - } - if (dataList.isNotEmpty) { - callOutMore = true; - for (var element in dataList) { - lists.add(Lists.fromJson(element)); - } - callOutPage++; - } - callOutMore = dataList.length == 20; - update(); - } else { - showOKToast(data["msg"]); - } - } - - void refreshData() { - if (callOutMore == false) return; - callOutPage = 1; - callOutMore = true; - loadCallOutListData(_userId); - - } - - void loadMore() { - loadCallOutListData(_userId); - } - - void pushMsgPage(Lists bean,String cicleId) { - } - - @override - void onInit() { - // TODO: implement onInit - super.onInit(); - scrollController.addListener(() { - if (scrollController.position.pixels == scrollController.position.maxScrollExtent) { - loadMore(); - } - }); - } - - void removeData(String callOutId, int index) async { - var data = await DioManager.instance.delete( - url: "/up-service/callout/${callOutId}",); - if (data['code'] == 200) { - showOKToast('删除成功'); - lists.removeAt(index); - update(); - } else { - showOKToast('操作失败'); - } - } -} \ No newline at end of file diff --git a/circle_app/lib/app/util/device.dart b/circle_app/lib/app/util/device.dart deleted file mode 100644 index b9f78bb..0000000 --- a/circle_app/lib/app/util/device.dart +++ /dev/null @@ -1 +0,0 @@ -// TODO Implement this library. \ No newline at end of file diff --git a/circle_app/lib/app/visitorlist/binding.dart b/circle_app/lib/app/visitorlist/binding.dart deleted file mode 100644 index 3f8c914..0000000 --- a/circle_app/lib/app/visitorlist/binding.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:get/get.dart'; - -import 'logic.dart'; - -class VisitorlistBinding extends Bindings { - @override - void dependencies() { - Get.lazyPut(() => VisitorlistLogic()); - } -} diff --git a/circle_app/lib/app/visitorlist/logic.dart b/circle_app/lib/app/visitorlist/logic.dart deleted file mode 100644 index 34bc1e0..0000000 --- a/circle_app/lib/app/visitorlist/logic.dart +++ /dev/null @@ -1,240 +0,0 @@ -import 'dart:async'; - -import 'package:circle_app/util/util.dart'; -import 'package:get/get.dart'; -import 'package:oktoast/oktoast.dart'; -import 'package:pull_to_refresh/pull_to_refresh.dart'; - -import '../../common/Widgets/open_vip_tip/logic.dart'; -import '../../network/api.dart'; -import '../../network/dio_manager.dart'; -import '../../util/SharedPreferencesHelper.dart'; -import '../../util/eventBus.dart'; -import 'state.dart'; - -class VisitorlistLogic extends GetxController { - - - - final RefreshController refreshController = RefreshController(); - final VisitorlistState state = VisitorlistState(); - int page = 1; - int isVip = 0; - bool isLoad = true; - List lists = []; - List users = []; - StreamSubscription? subscription = null; - - int sameCityCount = 0; - int wantMeetCount = 0; - String tip = ''; - - bool userIsMore = true; - int userPage = 1; - - @override - void dispose() { - refreshController.dispose(); - if (null != subscription) { - EventBusManager.cancelSubscription(subscription!); - } - - super.dispose(); - } - - @override - void onInit() async { - super.onInit(); - - subscription = EventBusManager.on().listen((event) { - isVip = event.vip; - page = 1; - initList(); - }); - loadVisitorTotalData(); - refreshVipStatus(); - loadInterestedInMeUsersData(); - } - - void loadInterestedInMeUsersData() async { - var data = - await DioManager.instance.get(url: Api.interestedInMeUsers); - if (data['code'] == 200) { - List infoList = data['data']['lists']; - if (infoList.isNotEmpty) { - users = data['data']['lists']; - } - update(); - } - } - - void loadVisitorTotalData() async { - var data = - await DioManager.instance.get(url: Api.getVisitorTotal,); - if (data['code'] == 200) { - sameCityCount = data['data']['sameCityCount']; - wantMeetCount = data['data']['wantMeetCount']; - if (sameCityCount > 0 && wantMeetCount > 0) { - tip = '${sameCityCount}人和你同城,${wantMeetCount}人是你想认识的圈友'; - } else if (sameCityCount > 0) { - tip = '${sameCityCount}人和你同城'; - } else if (wantMeetCount > 0) { - tip = '${wantMeetCount}人是你想认识的圈友'; - } - update(); - } - } - - refreshVipStatus() async { - var data = await DioManager.instance.get(url: Api.getVipStatus); - var bean = - BaseResponse.fromJson(data, (data) => VipInfo.fromJson(data)); - if (bean.isSuccess()) { - SharedPreferencesHelper.getInstance().then((sharedPreferences) { - sharedPreferences.setInt( - SharedPreferencesHelper.VIP, bean.data.vipLevel); - isVip = bean.data.vipLevel; - initList(); - // update(); - }); - } - } - - initList() async { - if (page == 1) { - // lists.clear(); - } - - var data = await DioManager.instance - .get(url: Api.visitList, params: {'page': page}); - var bean = BaseResponse.fromJson( - data, (data) => UserList.fromJson(data)); - if (bean.isSuccess()) { - List list = bean.data.lists; - - if (list.isNotEmpty) { - if (page == 1) { - lists = bean.data.lists; - refreshController.resetNoData(); - refreshController.refreshCompleted(); - } else { - refreshController.loadComplete(); - lists.addAll(bean.data.lists); - } - - } else { - refreshController.loadNoData(); - } - - - } - - isLoad = false; - update(); - - } - - void sendAllLike(List idList) async { - var data = await DioManager.instance - .postBody(url: Api.allUserFollow, params: {'userIds': idList}); - if (data['code'] == 200) { - showOKToast('一键喜欢操作成功'); - users.clear(); - update(); - } - } -} - -class User { - final int id; - final String nickname; - final String avatar; - final String signature; - final String birthday; - final int age; - final int vip; - final int gender; - final int role; - final int mark; - final int orientation; - final double lng; - final double lat; - final String city; - final String avatarThumb; - - User({ - required this.id, - required this.nickname, - required this.avatar, - required this.signature, - required this.birthday, - required this.age, - required this.vip, - required this.mark, - required this.gender, - required this.role, - required this.orientation, - required this.lng, - required this.lat, - required this.city, - required this.avatarThumb, - }); - - factory User.fromJson(Map json) { - return User( - id: json['id'], - nickname: json['nickname'], - avatar: json['avatar'], - signature: json['signature'], - birthday: json['birthday'], - age: json['age'], - vip: json['vip'], - gender: json['gender'], - role: json['role'], - orientation: json['orientation'], - lng: json['lng'], - lat: json['lat'], - mark: json['mark'] ?? 0, - city: json['city'], - avatarThumb: json['avatar_thumb'], - ); - } -} - -class UserListItem { - final User user; - final String accountId; - - UserListItem({ - required this.user, - required this.accountId, - }); - - factory UserListItem.fromJson(Map json) { - return UserListItem( - user: User.fromJson(json['user']), - accountId: json['account_id'], - ); - } -} - -class UserList { - final List lists; - - UserList({ - required this.lists, - }); - - factory UserList.fromJson(Map json) { - List userItems = []; - if (json['lists'] != null) { - for (var item in json['lists']) { - userItems.add(UserListItem.fromJson(item)); - } - } - - return UserList( - lists: userItems, - ); - } -} diff --git a/circle_app/lib/app/visitorlist/state.dart b/circle_app/lib/app/visitorlist/state.dart deleted file mode 100644 index 029c16a..0000000 --- a/circle_app/lib/app/visitorlist/state.dart +++ /dev/null @@ -1,5 +0,0 @@ -class VisitorlistState { - VisitorlistState() { - ///Initialize variables - } -} diff --git a/circle_app/lib/app/visitorlist/view.dart b/circle_app/lib/app/visitorlist/view.dart deleted file mode 100644 index 5ee9b9d..0000000 --- a/circle_app/lib/app/visitorlist/view.dart +++ /dev/null @@ -1,498 +0,0 @@ -import 'dart:ui'; - -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:circle_app/app/visitorlist/widget/visitors_follow_item.dart'; -import 'package:circle_app/main.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:pull_to_refresh/pull_to_refresh.dart'; - -import '../../common/Widgets/base_tip_widget.dart'; -import '../../common/Widgets/open_vip_tip/view.dart'; -import '../../common/colors/app_color.dart'; -import '../../components/my_app_bar.dart'; -import '../../router/app_routers.dart'; -import '../../util/util.dart'; -import 'logic.dart'; - -class VisitorlistPage extends StatelessWidget { - VisitorlistPage({Key? key}) : super(key: key); - - final logic = Get.find(); - final state = Get.find().state; - - @override - Widget build(BuildContext context) { - return GetBuilder(builder: (logic) { - return Container( - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage(getBaseImage("home_back")), - fit: BoxFit.cover, - ), - ), - child: Scaffold( - backgroundColor: Colors.transparent, - appBar: MyAppBar( - centerTitle: "最近访客", - actionWdiget: GestureDetector( - onTap: () { - if (logic.isVip == 2) { - showOKToast('已为你增加10倍曝光啦'); - } else { - showOKToast('开通年会员可以增加10倍曝光哦~'); - showOepnVipDialog(); - } - }, - child: Container( - height: 24.sp, - padding: EdgeInsets.only(left: 6.sp, right: 6.sp), - decoration: BoxDecoration( - gradient: AppColor.mainVerLinearGradient, - borderRadius: BorderRadius.circular(12.sp)), - child: Row( - children: [ - Text( - '10倍曝光', - style: TextStyle(color: Colors.black, fontSize: 13.sp), - ) - ], - ), - ), - ), - ), - body: Stack( - children: [ - Container( - child: logic.isLoad - ? loaddingWidget(true) - : logic.lists.isEmpty - ? noResultWidget() - : Stack( - alignment: Alignment.topCenter, - children: [ - SmartRefresher( - controller: logic.refreshController, - onRefresh: _onRefresh, - onLoading: _onLoading, - enablePullUp: true, - child: ListView.builder( - padding: EdgeInsets.all(10.sp), - itemCount: logic.lists.length, - itemBuilder: (context, index) { - return ListItem( - logic.lists[index], index); - }, - )), - showGd() - ], - ), - ), - ], - ), - ), - ); - }); - } - - Widget showGd() { - double interval = 50; - List urlList = []; - - if (logic.lists.length > 3) { - for (int i = 3; i < logic.lists.length; i++) { - if (urlList.length < 3) { - urlList.add(logic.lists[i].user.avatarThumb); - } else { - break; - } - } - } - - List widgets = []; - - switch (urlList.length) { - case 0: - widgets.add(Positioned( - left: (Get.width / 2) - 40, - child: circleWidget(""), - )); - break; - case 1: - for (int i = 0; i < urlList.length; i++) { - var element = urlList[i]; -// double xOffset = interval * i + xOffsetBase; - double let = (Get.width / 2) - 60; - - widgets.add(Positioned( - left: let, - child: circleWidget(element), - )); - } - - widgets.add(Positioned( - left: (Get.width / 2) - 20, - child: circleWidget(""), - )); - break; - case 2: - double xOffsetBase = - (Get.width + interval * urlList.length - 60.0 * urlList.length) * - 0.25; - - for (int i = 0; i < urlList.length; i++) { - var element = urlList[i]; -// double xOffset = interval * i + xOffsetBase; - double let = ((Get.width / 2) - ((40 * urlList.length)) + (i * 40)); - - widgets.add(Positioned( - left: let, - child: circleWidget(element), - )); - } - - double xOffset = interval * urlList.length + xOffsetBase; - widgets.add(Positioned( - left: xOffset, - child: circleWidget(""), - )); - break; - case 3: - // double xOffsetBase = (Get.width + interval * urlList.length - 60.0 * urlList.length) * 0.25; - - for (int i = 0; i < urlList.length; i++) { - switch (i) { - case 0: - widgets.add(Positioned( - left: (Get.width / 2) - 100, - child: circleWidget(urlList[i]), - )); - break; - case 1: - widgets.add(Positioned( - left: (Get.width / 2) - 60, - child: circleWidget(urlList[i]), - )); - break; - case 2: - widgets.add(Positioned( - left: (Get.width / 2) - 20, - child: circleWidget(urlList[i]), - )); - break; - } - } - widgets.add(Positioned( - left: (Get.width / 2) + 20, - child: circleWidget(""), - )); - - break; - } - - return logic.isVip > 0 - ? Container() - : Positioned( - bottom: 0, - child: Container( - width: Get.width, - child: Column( - children: [ - SizedBox( - height: 70.sp, - width: Get.width, - child: Stack( - alignment: Alignment.centerLeft, - children: widgets, - ), - ), - Container( - margin: EdgeInsets.only(bottom: 10.sp, top: 10.sp), - child: Text( - "TA们也喜欢你哦 \n" - "成为会员查看所有圈友信息", - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.white, - fontSize: 15.sp, - ), - ), - ), - if (logic.tip.isNotEmpty) - Container( - margin: EdgeInsets.only(bottom: 10.sp), - child: RichText( - text: TextSpan( - children: [ - if (logic.sameCityCount > 0) - TextSpan( - text: '${logic.sameCityCount}', - style: TextStyle( - color: AppColor.mainColor, fontSize: 14.0), - ), - if (logic.sameCityCount > 0) - TextSpan( - text: '人和你同城', - style: TextStyle( - color: Colors.white, fontSize: 14.0), - ), - if (logic.sameCityCount > 0 && - logic.wantMeetCount > 0) - TextSpan( - text: ',', - style: TextStyle( - color: Colors.white, fontSize: 14.0), - ), - if (logic.wantMeetCount > 0) - TextSpan( - text: '${logic.wantMeetCount}', - style: TextStyle( - color: AppColor.mainColor, - fontSize: 14.0, - fontWeight: FontWeight.bold), - ), - if (logic.wantMeetCount > 0) - TextSpan( - text: '人是你想认识的类型', - style: TextStyle( - color: Colors.white, fontSize: 14.0), - ), - ], - ), - ), - ), - GestureDetector( - onTap: () { - showRechargeDialog(); - }, - child: Container( - height: 40.sp, - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - margin: EdgeInsets.only( - left: 50.sp, right: 50.sp, bottom: 20.sp), - child: Text( - "开通会员查看更多访客", - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - ), - ), - ), - ), - ], - ), - ), - ); - } - - Widget ListItem(UserListItem item, int index) { - return Column( - children: [ - if (index == 0 && logic.users.isNotEmpty) - VisitorsFollowItem(users: logic.users), - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - if (logic.isVip > 0 || index < 3) { - Get.toNamed(AppRoutes.UserInfoActivity, - arguments: item.user.id.toString()); - } - }, - child: ImageFiltered( - imageFilter: ImageFilter.blur( - sigmaX: (logic.isVip > 0 || index < 3) ? 0 : 5, - sigmaY: (logic.isVip > 0 || index < 3) ? 0 : 5, - ), - child: Container( - margin: const EdgeInsets.only(bottom: 21), - child: Row( - children: [ - Stack( - children: [ - ClipOval( - child: CachedNetworkImage( - fit: BoxFit.cover, - imageUrl: item.user.avatarThumb, - width: 53.sp, - height: 53.sp, - ), - ), - Positioned( - right: 0.sp, - left: 0.sp, - bottom: 0.sp, - child: item.user.vip != 0 - ? Image( - image: AssetImage(getBaseImage( - item.user.vip == 1 ? "vip" : 'year_vip')), - width: 44.sp, - height: 18.sp, - ) - : Container(), - ) - ], - ), - SizedBox(width: 10.sp), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Text( - item.user.nickname, - style: const TextStyle( - color: Colors.white70, - fontSize: 14, - fontWeight: FontWeight.bold), - ), - SizedBox(width: 4.sp), - // SizedBox(height: 8.sp), - _buildInfoRow(item), - // Placeholder image - ], - ), - SizedBox(height: 8.sp), - SizedBox( - width: 200.sp, - child: Text( - item.user.signature, - overflow: TextOverflow.ellipsis, // 超出部分使用省略号表示 - maxLines: 1, - style: TextStyle( - fontSize: 12.sp, color: const Color(0xFFB7BECC)), - ), - ), - ], - ), - // Pla - const Spacer(), - GestureDetector( - onTap: () { - if (logic.isVip > 0 || index < 3) { - Get.toNamed(AppRoutes.UserInfoActivity, - arguments: item.user.id.toString()); - // pushChatPage(item.user.id.toString(), item.accountId, - // item.user.nickname); - } - }, - child: Container( - width: 60.sp, - height: 28.sp, - decoration: BoxDecoration( - color: const Color(0xFFFF4D7C), - borderRadius: BorderRadius.circular(14.sp), - ), - child: Center( - child: Text("回访", - style: TextStyle( - fontSize: 14.sp, color: Colors.white)), - ), - ), - ), - ], - ), - ), - ), - ), - ], - ); - } - - Widget _buildInfoRow(UserListItem userInfoBean) { - String ageMsg = getAgeCOntent( - userInfoBean.user.gender, - userInfoBean.user.age, - userInfoBean.user.role, - userInfoBean.user.orientation); - return Row( - children: [ - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17.sp), - gradient: const LinearGradient( - colors: [ - Color.fromRGBO(141, 255, 248, 1.0), - Color.fromRGBO(181, 211, 255, 1.0), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 2.sp, bottom: 2.sp, left: 10.sp, right: 10.sp), - child: Text( - ageMsg, - style: TextStyle( - color: Colors.black, - fontSize: 10.sp, - ), - ), - ), - SizedBox(width: 6.sp), - ], - ); - } - - void _onRefresh() async { - logic.page = 1; - logic.initList(); - } - - void _onLoading() async { - logic.page = logic.page + 1; - logic.initList(); - } - - showRechargeDialog() async { - Get.bottomSheet( - Scaffold( - backgroundColor: Colors.transparent, - body: Open_vip_tipPage(false), - ), - isScrollControlled: true, - enableDrag: false) - .then((value) {}); - } - - circleWidget(String url, {double width = 70}) { - return GestureDetector( - onTap: () { - showRechargeDialog(); - }, - child: Stack( - alignment: Alignment.center, - children: [ - Image.asset( - getCircleImage('more'), - width: width.sp, - height: width.sp, - ), - url.contains("http") - ? ClipOval( - child: CachedNetworkImage( - imageUrl: url, - width: (width - 1).sp, - height: (width - 1).sp, - fit: BoxFit.cover, - ), - ) - : Text( - url, - style: TextStyle(color: Color(0xffF756FF), fontSize: 12.sp), - ) - ], - )); - } -} diff --git a/circle_app/lib/app/visitorlist/widget/visitors_follow_item.dart b/circle_app/lib/app/visitorlist/widget/visitors_follow_item.dart deleted file mode 100644 index 361a1bd..0000000 --- a/circle_app/lib/app/visitorlist/widget/visitors_follow_item.dart +++ /dev/null @@ -1,161 +0,0 @@ -import 'package:circle_app/common/Widgets/base_tip_widget.dart'; -import 'package:circle_app/common/colors/app_color.dart'; -import 'package:circle_app/router/app_routers.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; - -import '../../../common/Widgets/tag_widget.dart'; -import '../../../util/util.dart'; -import '../../circle/widgets/discover.dart'; -import '../logic.dart'; - -class VisitorsFollowItem extends StatefulWidget { - List users; - - VisitorsFollowItem({super.key,required this.users}); - @override - _VisitorsFollowItemState createState() => new _VisitorsFollowItemState(); - -} - -class _VisitorsFollowItemState extends State { - // TODO: add state variables and methods - @override - Widget build(BuildContext context) { - // TODO: add widget build method - return Container( - height: 240.sp, - width: Get.width, - padding: EdgeInsets.all(10.sp), - margin: EdgeInsets.only(bottom: 20.sp), - decoration: BoxDecoration( - color: AppColor.bgColor, - borderRadius: BorderRadius.circular(8.sp) - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - - Container( - margin: EdgeInsets.only(bottom: 10.sp), - child: Text('有${widget.users.length}个人反复看过你,喜欢一下吧',style: TextStyle(color: Colors.white.withOpacity(0.75),fontSize: 18.sp,fontWeight: FontWeight.bold),)), - Expanded( - child: ListView.builder(itemBuilder: (context,index) { - var user = UserListItem.fromJson(widget.users[index]).user; - return GestureDetector( - onTap: () { - VisitorlistLogic logic = Get.find(); - if (logic.isVip > 0) { - Get.toNamed(AppRoutes.UserInfoActivity,arguments: user.id.toString()); - } else { - showOKToast('开通会员可以一键喜欢哦~'); - showOepnVipDialog(); - } - }, - child: Container( - width: 120.sp, - height: 120.sp, - margin: EdgeInsets.only(right: 10.sp), - child: Stack( - fit: StackFit.expand, - children: [ - ClipRRect(borderRadius: BorderRadius.circular(8.sp),child: Image.network(user.avatar!,fit: BoxFit.cover,)), - Positioned( - bottom: 5.sp, - left: 5.sp, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - user.nickname ?? '', - style: TextStyle( - fontSize: 18.sp, - color: Color(0XFFF7FAFA), - fontWeight: FontWeight.bold), - ), - Container( - margin: EdgeInsets.only( - left: 4.sp, - ), - child: UserTagWidget(user.mark!), - ), - ], - ), - Container( - margin: - EdgeInsets.only(left: 0.sp), - alignment: Alignment.center, - height: 18.sp, - padding: EdgeInsets.only( - left: 6.sp, right: 6.sp), - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular( - 9.sp), - gradient: - const LinearGradient( - begin: Alignment( - 0.25, 0.5), - end: Alignment( - 0.75, 0.5), - colors: [ - Color(0xff8DFFF8), - Color(0xffB5D3FF) - ])), - child: Text( - getAgeCOntent( - user!.gender ?? 0, - user!.age ?? 0, - user!.role ?? 0, - user!.orientation ?? 0), - style: TextStyle( - color: Colors.black, - fontSize: 10.sp, - ), - ), - ), - - ], - )), - ], - ), - ), - ); - },itemCount: widget.users.length,scrollDirection: Axis.horizontal,), - ), - GestureDetector( - onTap: () { - VisitorlistLogic logic = Get.find(); - if (logic.isVip > 0) { - List idList = []; - widget.users.forEach((element) { - var user = UserListItem.fromJson(element).user; - idList.add(user.id.toString()); - }); - logic.sendAllLike(idList); - } else { - showOKToast('开通会员可以一键喜欢哦~'); - showOepnVipDialog(); - } - - }, - child: Container( - margin: EdgeInsets.only(left: 50.sp,right: 50.sp,top: 10.sp), - height: 40.sp, - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8.sp), - color: AppColor.mainBgColor, - ), - child: Text('一键喜欢',style: TextStyle(color: Colors.white,fontSize: 16.sp),), - ), - ) - ], - ), - ); - } -} diff --git a/circle_app/lib/app/webview/binding.dart b/circle_app/lib/app/webview/binding.dart deleted file mode 100644 index 15c758f..0000000 --- a/circle_app/lib/app/webview/binding.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:get/get.dart'; - -import 'logic.dart'; - -class WebviewBinding extends Bindings { - @override - void dependencies() { - Get.lazyPut(() => WebviewLogic()); - } -} diff --git a/circle_app/lib/app/webview/logic.dart b/circle_app/lib/app/webview/logic.dart deleted file mode 100644 index e461ae2..0000000 --- a/circle_app/lib/app/webview/logic.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:get/get.dart'; - -import 'state.dart'; - -class WebviewLogic extends GetxController { - final WebviewState state = WebviewState(); - - String title = Get.arguments['title'] ?? ''; - -} diff --git a/circle_app/lib/app/webview/state.dart b/circle_app/lib/app/webview/state.dart deleted file mode 100644 index 4cd2243..0000000 --- a/circle_app/lib/app/webview/state.dart +++ /dev/null @@ -1,5 +0,0 @@ -class WebviewState { - WebviewState() { - ///Initialize variables - } -} diff --git a/circle_app/lib/app/webview/view.dart b/circle_app/lib/app/webview/view.dart deleted file mode 100644 index 85e0689..0000000 --- a/circle_app/lib/app/webview/view.dart +++ /dev/null @@ -1,82 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; - -import 'package:webview_flutter/webview_flutter.dart'; -import '../../components/my_app_bar.dart'; -import '../../util/util.dart'; -import 'logic.dart'; - -class WebviewPage extends StatefulWidget { - @override - createState() => _WebViewContainerState(); -} - -class _WebViewContainerState extends State { -// Get.toNamed(AppRoutes.WebViewActivity,arguments: {'title':"百度","url":"https://www.baidu.com"}); - - _WebViewContainerState(); - var controller; - - final logic = Get.find(); - @override - Widget build(BuildContext context) { - final url = Get.arguments['url']; - - controller = WebViewController() - ..setJavaScriptMode(JavaScriptMode.unrestricted) - ..setBackgroundColor(logic.title.contains('赚钱') || logic.title.contains('攻略') || logic.title.contains('精选') ? Colors.transparent : Colors.white) - ..setNavigationDelegate( - NavigationDelegate( - onProgress: (int progress) { - // Update loading bar. - }, - onPageStarted: (String url) {}, - onPageFinished: (String url) async { - if(logic.title==''){ - String title = await controller.getTitle(); // 获取网页标题 - if (title.length > 8) { - title = title.substring(0, 8) + '...'; - } - logic.title = title; - logic.update(); - print('Page title: $title'); // 打印网页标题 - } - - - }, - onWebResourceError: (WebResourceError error) {}, - ), - ) - ..loadRequest(Uri.parse(url)); - return GetBuilder(builder: (logic) { - return Builder( - builder: (context) { - return Container( - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage(getBaseImage("home_back")), - fit: BoxFit.cover, - ), - ), - child: Scaffold( - backgroundColor: Colors.transparent, - appBar: MyAppBar(centerTitle: logic.title,), - body: Column( - children: [ - Expanded( - child: WebViewWidget( - controller: controller, - - ), - ), - ], - ),), - ); - } - ); - }); - } - - -} - diff --git a/circle_app/lib/app/world_call_out/logic.dart b/circle_app/lib/app/world_call_out/logic.dart deleted file mode 100644 index 683605e..0000000 --- a/circle_app/lib/app/world_call_out/logic.dart +++ /dev/null @@ -1,176 +0,0 @@ -import 'package:circle_app/app/world_call_out/world_data.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:pull_to_refresh/pull_to_refresh.dart'; - -import '../../network/api.dart'; -import '../../network/dio_manager.dart'; -import '../../util/SharedPreferencesHelper.dart'; -import '../../util/util.dart'; -import '../dialog/ScreenBottomSheetDialog.dart'; -import '../select_circle/logic.dart'; - -class World_call_outLogic extends GetxController { - ScrollController scrollController = ScrollController(); - TextEditingController inputController = TextEditingController(); - final RefreshController refreshController = RefreshController(); - FocusNode focusNode = FocusNode(); - List genderList = []; - String myUserId = ''; - bool isLoad = true; - List lists = []; - List wantMeet = []; - List openCallOutIdList = []; - int index = 1; - - int total = 0; - - bool isMore = true; - bool loadFail = false; - - bool showEmojiPanel = false; - bool showKeyboard = false; - - bool isOpenVip = false; - - bool isNewMsg = false; - - @override - void onClose() { - inputController.dispose(); - scrollController.dispose(); - super.onClose(); - } - - void onInit() async { - // TODO: implement onInit - super.onInit(); - scrollController.addListener(() { - focusNode.unfocus(); - showEmojiPanel = false; - showKeyboard = false; - update(); - }); - await loadMyUserId(); - initGerder(); - loadData(); - } - - void initGerder() async { - genderList.clear(); - var data1 = - await DioManager.instance.get(url: Api.getCircleList, params: {}); - var bean1 = BaseResponse.fromJson( - data1, (data1) => ConfigBean.fromJson(data1)); - - if (bean1.isSuccess()) { - ConfigBean configBean = bean1.data!; - - configBean.genderMap.forEach((key, value) { - genderList.add(MyConfigData(key, value, false)); - }); - } - } - - void showBottomSheet(BuildContext context) { - showModalBottomSheet( - context: context, - backgroundColor: Colors.transparent, - builder: (BuildContext context) { - return ScreenBottomSheetDialog( - genderList: genderList, - orientationList: [], - roleList: [], - isHaveCity: false, - callback: (genderList, orientationList, roleList) { - // _onRefresh(); - index = 1; - scrollController.jumpTo(0); - loadData(); - }, - ); // Use your custom widget here - }, - ); - } - - loadMore() { - if (isMore) { - loadData(); - } - } - - void loadData() async { - loadFail = false; - Map params = {'page': index, 'pageSize': 20}; - - List wantMeet = []; - genderList.forEach((element) { - if (element.isSelect) { - wantMeet.add(element.id); - } - }); - - params['genders'] = wantMeet; - - var result = - await DioManager.instance.post(url: Api.worldCallouts, params: params); - var bean1 = BaseResponse.fromJson( - result, (result) => WorldData.fromJson(result)); - - if (bean1.isSuccess()) { - List tempLists = bean1.data.lists; - total = bean1.data.total; - if (tempLists.isNotEmpty) { - isLoad = false; - if (index == 1) { - refreshController.refreshCompleted(); - lists = tempLists; - - } else { - lists.addAll(tempLists); - refreshController.loadComplete(); - // scrollController.jumpTo(scrollController.offset + 20); - } - - index++; - } else { - isMore = false; - refreshController.refreshCompleted(); - } - - update(); - } else if (bean1.code == 404) { - showOKToast('网络不流畅哦,请检查网络情况'); - loadFail = true; - update(); - } - } - - - loadMyUserId() async { - SharedPreferencesHelper sp = await SharedPreferencesHelper.getInstance(); - myUserId = sp.getMyUserId(); - } - - void sendTextMessage() {} - - outCircle(String interest_id, bool isJoin) async { - var data = await DioManager.instance.post( - url: Api.outCrrcle + interest_id + "/join", - params: {"status": isJoin ? "0" : "1"}); - var bean = BaseResponse.fromJson(data, (data) => data); - if (bean.code == 200) { - List temp = []; - lists.forEach((element) { - if (element.interest!.id.toString() == interest_id.toString()) { - element.interest!.isJoin = !isJoin; - } - temp.add(element); - }); - lists = temp; - update(); - } - showOKToast(bean.msg); - } -} diff --git a/circle_app/lib/app/world_call_out/view.dart b/circle_app/lib/app/world_call_out/view.dart deleted file mode 100644 index 16272e8..0000000 --- a/circle_app/lib/app/world_call_out/view.dart +++ /dev/null @@ -1,1009 +0,0 @@ -import 'package:circle_app/app/circle/logic.dart'; -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:circle_app/app/circle_list/logic.dart'; -import 'package:circle_app/app/world_call_out/world_data.dart'; -import 'package:circle_app/components/my_app_bar.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:gradient_borders/box_borders/gradient_box_border.dart'; -import 'package:pull_to_refresh/pull_to_refresh.dart'; - -import '../../common/Widgets/circle_share.dart'; -import '../../common/Widgets/tag_widget.dart'; -import '../../common/Widgets/text_more.dart'; -import '../../common/colors/app_color.dart'; -import '../../router/app_routers.dart'; -import '../circle/widgets/video_item.dart'; -import 'logic.dart'; - -class WorldCallOutPage extends StatefulWidget { - WorldCallOutPage({Key? key}) : super(key: key); - - @override - State createState() => _WorldCallOutPageState(); -} - -class _WorldCallOutPageState extends State - with WidgetsBindingObserver { - String zeroWidthSpace = '\ufeff'; - - int? currentCursor; - - final logic = Get.find(); - - @override - void dispose() { - /// 销毁 - super.dispose(); - WidgetsBinding.instance.removeObserver(this); - } - - @override - void initState() { - // TODO: implement initState - super.initState(); - - /// 初始化 - WidgetsBinding.instance.addObserver(this); - } - - // @override - // void didChangeMetrics() { - // super.didChangeMetrics(); - // WidgetsBinding.instance.addPostFrameCallback((_) { - // if (MediaQuery.of(context).viewInsets.bottom == 0) { - // /// 键盘收回 - // logic.showKeyboard = false; - // } else { - // /// 键盘弹出 - // logic.showKeyboard = true; - // logic.showEmojiPanel = false; - // logic.update(); - // } - // }); - // } - - @override - Widget build(BuildContext context) { - return GetBuilder(builder: (logic) { - return Scaffold( - resizeToAvoidBottomInset: false, - backgroundColor: Colors.transparent, - appBar: MyAppBar( - centerTitle: logic.total > 0 - ? '全球喊话' + '(${convertToTenThousand(logic.total)})' - : '全球喊话', - isBack: false, - isDiyBack: true, - backWdiget: Positioned( - left: 15.sp, - child: GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.Invite); - }, - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17.0), - gradient: const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - ), - color: const Color(0xFF392D53), - ), - child: Container( - margin: EdgeInsets.all(0.6.sp), - padding: EdgeInsets.only( - left: 6.sp, right: 6.sp, top: 4.sp, bottom: 4.sp), - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17.0), - color: const Color(0xFF392D53), - ), - child: Row( - children: [ - Image.asset( - getMsgImage('gift'), - width: 14.sp, - ), - SizedBox( - width: 2.sp, - ), - Text( - "邀请赚钱", - style: TextStyle( - fontSize: 12.sp, - color: Colors.white, - ), - ), - ], - ), - ), - ), - ), - ), - actionWdiget: GestureDetector( - onTap: () { - logic.showBottomSheet(context); - }, - child: Image.asset( - getCircleImage('icon_screen'), - width: 30.sp, - ), - ), - ), - body: Stack( - fit: StackFit.expand, - children: [ - GestureDetector( - onTap: () { - logic.focusNode.unfocus(); - logic.showKeyboard = false; - logic.showEmojiPanel = false; - logic.update(); - // logic.sendTextMessage(); - }, - child: - SmartRefresher( - controller: logic.refreshController, - onLoading: () { - logic.loadMore(); - }, - onRefresh: () { - logic.isNewMsg = false; - logic.index = 1; - logic.lists.clear(); - logic.update(); - logic.loadData(); - }, - enablePullUp: true, - enablePullDown: true, - child:logic.loadFail ? noResultWidget(tip: '',callBack: () { - logic.loadFail = false; - logic.isMore = true; - logic.update(); - logic.initGerder(); - logic.loadData(); - }) : logic.lists.isEmpty - ? !logic.isMore - ? noResultWidget() - : loaddingWidget(true) - : ListView.builder( - reverse: true, - shrinkWrap: true, - itemBuilder: (context, index) { - WorldLists data = logic.lists[index]; - if (data.content!.contains('赚钱')) { - print('111'); - } - if (data.showType == 2) { - return sigalItemWidget(index, data); - } - return itemWidget(index, logic.lists[index]); - }, - itemCount: logic.lists.length, - controller: logic.scrollController, - physics: const AlwaysScrollableScrollPhysics(), - )), - ), - Positioned( - bottom: 36.sp, - right: 10.sp, - child: GestureDetector( - onTap: () async { - var data = await Get.toNamed( - AppRoutes.Call_out, - ); - if (data != null) { - logic.index = 1; - logic.lists.clear(); - logic.update(); - logic.loadData(); - } - }, - child: Image.asset( - getCircleImage('send_msg'), - width: 70.sp, - ))), - - if (logic.isNewMsg) - Positioned( - bottom: 10, - left: 10.sp, - child: GestureDetector( - onTap: () { - logic.isNewMsg = false; - logic.index = 1; - logic.lists.clear(); - logic.update(); - logic.loadData(); - // logic.refreshData(); - }, - child: Container( - color: Colors.black.withOpacity(0.75), - padding: EdgeInsets.only(left: 4.sp, right: 4.sp), - height: 20.sp, - child: Text( - '有新喊话↓', - style: TextStyle( - color: AppColor.mainColor, fontSize: 14.sp), - ), - ), - )), - ], - )); - }); - } - - Widget sigalItemWidget(int index, WorldLists list) { - double picHeight = 0.0; - double picWidth = Get.width - 90.sp; - if (list.album != null) { - if (list.album!.isNotEmpty) { - Album info = list.album!.first; - picHeight = 140.sp; - if (info.type == 1) { - if (list.album!.length > 3 && list.album!.length < 7) { - picHeight = picHeight * 2; - } else if (list.album!.length >= 7) { - picHeight = picHeight * 3; - } - } else { - picHeight = 200.sp; - } - } - } - return Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - padding: EdgeInsets.only( - top: 8.sp, bottom: 8.sp, left: 10.sp, right: 10.sp), - margin: EdgeInsets.only(top: 10.sp, bottom: 10.sp), - decoration: BoxDecoration( - border: list.borderType == 2 - ? GradientBoxBorder( - gradient: AppColor.mainVerLinearGradient, - width: 1.sp, - ) - : Border.all( - color: Colors.white.withOpacity(0.1), width: 1.sp), - borderRadius: BorderRadius.circular(20.sp)), - child: GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.UserInfoActivity, - arguments: list.user!.id!.toString()); - }, - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - ClipOval( - child: CachedNetworkImage( - imageUrl: list.user!.avatar ?? '', - width: 20.sp, - height: 20.sp, - fit: BoxFit.cover, - ), - ), - SizedBox( - width: 4.sp, - ), - Text( - list.user!.nickname ?? '', - style: TextStyle(color: AppColor.mainColor, fontSize: 12.sp), - ), - Column( - children: [ - Text(list.content ?? '', - style: TextStyle( - color: Color(0xFFF7FAFA), fontSize: 12.sp)), - picOrVideoItem(picHeight, list), - ], - ), - SizedBox( - width: 4.sp, - ), - GestureDetector( - onTap: () { - pushPage( - list.jumpInfo!.scene ?? '', list.jumpInfo!.param ?? ''); - }, - child: Container( - height: 22.sp, - padding: EdgeInsets.only(left: 5.sp, right: 5.sp), - alignment: Alignment.center, - decoration: BoxDecoration( - gradient: AppColor.tagVerLinearGradient, - borderRadius: BorderRadius.circular(11.sp)), - child: Text( - list.jumpInfo!.btnText ?? '', - style: TextStyle( - color: Colors.white.withOpacity(0.75), - fontSize: 14.sp), - ), - ), - ) - ], - ), - ), - ), - ], - ); - } - - circleInfoItem(WorldLists list) { - return list.interest!.image != null - ? GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.Signal_circle_list, arguments: list.interest!.id!); - }, - child: ClipRRect( - - child: Container( - padding: EdgeInsets.only(left: 12.sp, right: 12.sp), - height: 40.sp, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10.sp), - border: Border.all(color: Colors.white.withOpacity(0.1),width: 1.sp) - // image: DecorationImage( - // fit: BoxFit.fill, - // image: AssetImage(getCircleImage('top_circle_bg'))) - ), - child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - width: 32.sp, - height: 32.sp, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8.0), - gradient: const LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [ - Color(0xFF71F3F2), - Color(0xFFF558FF), - ], - stops: [0.0365, 0.9427], - ), - ), - padding: EdgeInsets.all(1.sp), - child: ClipRRect( - borderRadius: BorderRadius.circular(8.0), - child: CachedNetworkImage( - imageUrl: list.interest!.image!, - width: 30.sp, - height: 30.sp, - fit: BoxFit.cover), - ), - ), - Expanded( - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - // scrollController.animateTo( - // 0.0, // Scroll to the top - // duration: Duration(milliseconds: 300), - // curve: Curves.easeInOut, - // ); - }, - child: Container( - padding: EdgeInsets.only(left: 8.sp, top: 2.sp), - // alignment: Alignment., - // height: 40.sp, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - list.interest!.title!, - style: TextStyle( - color: Colors.white, - fontSize: 14.sp,), - ), - SizedBox( - height: 2.sp, - ), - Text( - '${convertToTenThousand(list.interest!.viewTotal!)}人看过', - textAlign: TextAlign.left, - style: TextStyle( - color: Colors.white.withOpacity(0.5), - fontSize: 10.sp, - ), - ), - ], - ), - ), - )), - GestureDetector( - //加入圈子 - onTap: () async { - if (list.interest!.isJoin!) { - Map info = list.interest!.toJson(); - Get.bottomSheet( - CircleShare('', '', Circle.fromJson(info)), - isScrollControlled: true, - enableDrag: false); - } else { - await logic.outCircle(list.interest!.id!.toString(), - list.interest!.isJoin!); - if (Get.isRegistered()) { - LikeLogic likeLogic = Get.find(); - likeLogic.loadMyCircleData(); - } - logic.update(); - } - }, - child: Stack( - alignment: Alignment.center, - children: [ - Opacity( - opacity: 0.5, - child: Image.asset( - getCircleImage('add'), - width: 60.sp, - ), - ), - Text( - !list.interest!.isJoin! ? '申请加入' : '分享有奖', - style: - TextStyle(color: Colors.white, fontSize: 12.sp), - ) - ], - )) - ], - ), - )), - ) - : Container(); - } - - picOrVideoItem(double picHeight, WorldLists list) { - return picHeight > 0 - ? Container( - height: picHeight, - alignment: Alignment.topLeft, - margin: EdgeInsets.only(left: 10.sp, right: 10.sp,bottom: 5.sp), - child: picHeight == 200.sp - ? VideoItemWidget(list.album![0].url!) - : GridView.builder( - itemCount: list.album!.length, - physics: const NeverScrollableScrollPhysics(), - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 3, //横轴三个子widget - crossAxisSpacing: 4.sp, - mainAxisSpacing: 4.sp, - childAspectRatio: 0.7 //宽高比为1时,子widget - ), - itemBuilder: (contentxt, currentIndex) { - Album album = list.album![currentIndex]; - return GestureDetector( - onTap: () { - var imgList = []; - for (var element in list.album!) { - imgList.add(element.url!); - } - Get.toNamed(AppRoutes.Swiper, arguments: { - 'imaglist': imgList, - 'index': currentIndex - }); - }, - child: ClipRRect( - borderRadius: BorderRadius.circular(6.sp), - child: CachedNetworkImage( - imageUrl: album.url!, - errorWidget: (context, url, error) => - const Icon(Icons.error), - fit: BoxFit.cover, - ), - ), - ); - })) - : Container(); - } - - Widget itemWidget(int index, WorldLists list) { - if (list.isSystem! == 1) { - return sysItemWidget(index, list); - } - List widgets = []; - int count = 0; - - bool isSelf = logic.myUserId == list.user!.id!.toString(); - double picHeight = 0.0; - double picWidth = Get.width - 90.sp; - - if (list.album!.isNotEmpty) { - Album info = list.album!.first; - picHeight = 140.sp; - picHeight = 140.sp; - if (info.type == 1) { - if (list.album!.length > 3 && list.album!.length < 7) { - picHeight = picHeight * 2; - } else if (list.album!.length >= 7) { - picHeight = picHeight * 3; - } - } else { - picHeight = 200.sp; - } - } - - Widget descText = logic.openCallOutIdList.contains(list.id) - ? Text( - list.content!, - style: TextStyle(color: Color(0xFFF7FAFA), fontSize: 14.sp), - ) - : Container( - // color: Colors.red, - child: HideText( - text: list.content!, - maxWidth: Get.width - 90.sp, - additionText: '查看更多', - maxLines: 15, - style: TextStyle(color: Color(0xFFF7FAFA), fontSize: 14.sp), - additionStyle: - TextStyle(color: const Color(0xFFFF4DF6), fontSize: 14.sp), - onTap: () { - logic.openCallOutIdList.add(list.id!); - setState(() {}); - }, - ), - ); - - return Container( - margin: EdgeInsets.only(top: 10.sp,bottom:10.sp), - width: Get.width, - padding: EdgeInsets.only(left: 5.sp, right: 5.sp), - // height: widgetAllHeight + wordsHeight, - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if (isSelf) Expanded(child: Container()), - if (!isSelf) - GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.UserInfoActivity, - arguments: list.user!.id!.toString()); - }, - child: Container( - margin: EdgeInsets.only(left: 5.sp, right: 8.sp), - child: ClipOval( - child: CachedNetworkImage( - imageUrl: list.user?.avatar ?? '', - width: 40.sp, - height: 40.sp, - fit: BoxFit.cover, - ), - ), - ), - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - width: Get.width - 90.sp, - // alignment: !isSelf ? Alignment.centerLeft : Alignment.centerRight, - child: Row( - // mainAxisAlignment: !isSelf ? MainAxisAlignment.end : MainAxisAlignment.start, - children: [ - if (isSelf) Expanded(child: Container()), - Text( - list.user?.nickname ?? '', - style: TextStyle(color: Colors.white, fontSize: 14.sp), - ), - SizedBox( - width: 4.sp, - ), - Container( - margin: EdgeInsets.only(left: 5.sp), - alignment: Alignment.center, - height: 18.sp, - padding: EdgeInsets.only(left: 6.sp, right: 6.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(9.sp), - gradient: const LinearGradient( - begin: Alignment(0.25, 0.5), - end: Alignment(0.75, 0.5), - colors: [ - Color(0xff8DFFF8), - Color(0xffB5D3FF) - ])), - child: Text( - getAgeCOntent( - list.user!.gender ?? 0, - list.user!.age ?? 0, - list.user!.role ?? 0, - list.user!.orientation ?? 0), - style: TextStyle( - color: Colors.black, - fontSize: 12.sp, - ), - ), - ), - // Image.asset( - // getMineImage(sexList[data.userBase?.gender ?? 1]), - // width: 24.sp, - // ), - SizedBox(width: 4.sp), - UserTagWidget(list.user!.mark!) - ], - )), - Container( - width: Get.width - 90.sp, - margin: EdgeInsets.only(top: 8.sp), - decoration: BoxDecoration( - // image: DecorationImage( - // fit: BoxFit.fill, - // image: AssetImage(getCircleImage('normal_bg'))), - borderRadius: BorderRadius.circular(10.sp), - border: list!.isQueen! - ? GradientBoxBorder( - gradient: AppColor.mainVerLinearGradient, - width: 1.sp, - ) - : Border.all( - color: Colors.white.withOpacity(0.1), - width: 1.sp)), - // height: widgetAllHeight + wordsHeight, - child: Column( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Container( - decoration: BoxDecoration(), - margin: EdgeInsets.only( - top: 10.sp, bottom: 10.sp, left: 10.sp, right: 10.sp), - alignment: Alignment.centerLeft, - child: - (list!.isQueen!) ? Text.rich(TextSpan(children: [ - if (list!.isQueen!) - WidgetSpan( - child: Container( - margin: EdgeInsets.only(right: 4.sp), - child: ShaderMask( - shaderCallback: (Rect bounds) { - return const LinearGradient( - begin: Alignment(0.0, -1.0), - end: Alignment.bottomCenter, - colors: [ - Color(0xff71F3F2), - Color(0xffF657FF) - ], - ).createShader(Offset.zero & bounds.size); - }, - child: Text( - '至尊喊话', - style: TextStyle( - fontSize: 14.sp, - fontWeight: FontWeight.w600, - color: Colors.white, - shadows: [ - Shadow( - color: AppColor.mainColor, - offset: Offset(0.0, -1)) - ]), - ), - )), - ), - // WidgetSpan( - // child:descText) - TextSpan( - text: list.content!, - style: TextStyle( - color: Color(0xFFF7FAFA), fontSize: 14.sp)), - ]) - ) : descText, - ), - if (picHeight > 0) picOrVideoItem(picHeight, list), - circleInfoItem(list) - ], - ), - ) - ], - ), - if (isSelf) - GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.UserInfoActivity, - arguments: list.user!.id!.toString()); - }, - child: Container( - margin: EdgeInsets.only(right: 5.sp, left: 10.sp), - child: ClipOval( - child: CachedNetworkImage( - imageUrl: list.user?.avatar ?? '', - width: 40.sp, - height: 40.sp, - fit: BoxFit.cover, - ), - ), - ), - ), - ], - ), - ); - } - - sysItemWidget(int index, WorldLists list) { - bool isSelf = logic.myUserId == list.user!.id!.toString(); - double picHeight = 0.0; - double picWidth = Get.width - 90.sp; - - if (list.album != null) { - if (list.album!.isNotEmpty) { - Album info = list.album!.first; - picHeight = 130.sp; - if (info.type == 1) { - if (list.album!.length > 3 && list.album!.length < 7) { - picHeight = picHeight * 2; - } else if (list.album!.length >= 7) { - picHeight = picHeight * 3; - } - } else { - picHeight = 200.sp; - } - } - } - return Stack( - children: [ - GestureDetector( - onLongPress: () { - // showTipPop(index,list.user!.userId!.toString()); - }, - child: Container( - margin: EdgeInsets.only(top: 20.sp, bottom: 10.sp), - // alignment: index % 2 == 0 ? Alignment.centerRight : Alignment.centerLeft, - width: Get.width, - padding: EdgeInsets.only(left: 5.sp, right: 5.sp), - // height: widgetAllHeight + wordsHeight, - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if (isSelf) Expanded(child: Container()), - if (!isSelf) - GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.UserInfoActivity, - arguments: list.user!.id!.toString()); - }, - child: Container( - margin: EdgeInsets.only(left: 5.sp, right: 8.sp), - child: ClipOval( - child: CachedNetworkImage( - imageUrl: list.user?.avatar ?? '', - width: 40.sp, - height: 40.sp, - fit: BoxFit.cover, - ), - ), - ), - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - width: Get.width - 90.sp, - // alignment: !isSelf ? Alignment.centerLeft : Alignment.centerRight, - child: Row( - // mainAxisAlignment: !isSelf ? MainAxisAlignment.end : MainAxisAlignment.start, - children: [ - if (isSelf) Expanded(child: Container()), - Text( - list.user?.nickname ?? '', - style: TextStyle( - color: Colors.white, fontSize: 14.sp), - ), - SizedBox( - width: 4.sp, - ), - Container( - margin: EdgeInsets.only(left: 5.sp), - alignment: Alignment.center, - height: 18.sp, - padding: EdgeInsets.only(left: 6.sp, right: 6.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(9.sp), - gradient: const LinearGradient( - begin: Alignment(0.25, 0.5), - end: Alignment(0.75, 0.5), - colors: [ - Color(0xff8DFFF8), - Color(0xffB5D3FF) - ])), - child: Text( - getAgeCOntent( - list.user!.gender ?? 0, - list.user!.age ?? 0, - list.user!.role ?? 0, - list.user!.orientation ?? 0), - style: TextStyle( - color: Colors.black, - fontSize: 12.sp, - ), - ), - ), - SizedBox(width: 4.sp), - UserTagWidget(list.user!.mark!) - ], - )), - Container( - width: Get.width - 90.sp, - margin: EdgeInsets.only(top: 8.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10.sp), - image: DecorationImage( - fit: BoxFit.fill, - image: AssetImage(getCircleImage('normal_bg'))), - border: list.isQueen! - ? GradientBoxBorder( - gradient: AppColor.mainVerLinearGradient, - width: 1.sp, - ) - : Border.all( - color: Colors.white.withOpacity(0.1), - width: 1.sp)), - // height: widgetAllHeight + wordsHeight, - child: Column( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Container( - margin: EdgeInsets.only( - top: 10.sp, - bottom: 10.sp, - left: 10.sp, - right: 10.sp), - alignment: Alignment.centerLeft, - child: Text.rich(TextSpan(children: [ - if (list.isQueen!) - WidgetSpan( - child: Container( - margin: EdgeInsets.only(right: 4.sp), - child: ShaderMask( - shaderCallback: (Rect bounds) { - return const LinearGradient( - begin: Alignment(0.0, -1.0), - end: Alignment.bottomCenter, - colors: [ - Color(0xff71F3F2), - Color(0xffF657FF) - ], - ).createShader( - Offset.zero & bounds.size); - }, - child: Text( - '至尊喊话', - style: TextStyle( - fontSize: 14.sp, - fontWeight: FontWeight.w600, - color: Colors.white, - shadows: [ - Shadow( - color: Color(0xffF657FF), - offset: Offset(0.0, -1)) - ]), - ), - )), - ), - TextSpan( - text: list.content!, - style: TextStyle( - color: Color(0xFFF7FAFA), - fontSize: 14.sp)), - ])), - ), - if (picHeight > 0) picOrVideoItem(picHeight, list), - circleInfoItem(list) - ], - ), - ) - ], - ), - - if (isSelf) - GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.UserInfoActivity, - arguments: list.user!.id!.toString()); - }, - child: Container( - margin: EdgeInsets.only(right: 5.sp, left: 10.sp), - child: ClipOval( - child: CachedNetworkImage( - imageUrl: list.user?.avatar ?? '', - width: 40.sp, - height: 40.sp, - fit: BoxFit.cover, - ), - ), - ), - ), - ], - ), - ), - ), - if (!isSelf && list.jumpInfo != null) - Positioned( - right: 15.sp, - bottom: 0.sp, - child: GestureDetector( - onTap: () { - pushPage(list.jumpInfo!.scene!, list.jumpInfo!.param!); - }, - child: Container( - height: 22.sp, - padding: EdgeInsets.only(left: 5.sp, right: 5.sp), - alignment: Alignment.center, - decoration: BoxDecoration( - gradient: AppColor.mainVerLinearGradient, - borderRadius: BorderRadius.circular(5.sp)), - child: Text( - list.jumpInfo!.btnText ?? '', - style: TextStyle(color: Colors.white, fontSize: 14.sp), - ), - ), - )) - ], - ); - } - - double getBottomHeight(context) { - if (logic.showKeyboard) { - final currentKeyboardHeight = MediaQuery.of(context).viewInsets.bottom; - final height = currentKeyboardHeight; - return height; - } else if (logic.showEmojiPanel) { - return 240.0 + MediaQuery.of(context).viewInsets.bottom; - } else { - return 0; - } - } - - Widget getBottomContainer() { - - return const SizedBox(height: 0); - } - - void addStickerToText(String sticker) { - final oldText = logic.inputController.text; - if (currentCursor != null && currentCursor! > -1) { - final firstString = oldText.substring(0, currentCursor); - final secondString = oldText.substring(currentCursor!); - currentCursor = currentCursor! + sticker.length; - logic.inputController.text = "$firstString$sticker$secondString"; - } else { - logic.inputController.text = "$oldText$sticker"; - } - } - - backSpaceText() { - String originalText = logic.inputController.text; - dynamic text; - - if (originalText == zeroWidthSpace) { - } else { - text = originalText.characters.skipLast(1); - logic.inputController.text = text; - // handleSetDraftText(); - } - } - - // 和onSubmitted一样,只是保持焦点的不同 - onEmojiSubmitted() { - final text = logic.inputController.text.trim(); - - if (text.isNotEmpty) {} - logic.inputController.clear(); - - currentCursor = null; - exitEditText(); - } - - exitEditText() { - logic.showKeyboard = false; - logic.showEmojiPanel = false; - logic.focusNode.unfocus(); - } -} diff --git a/circle_app/lib/app/world_call_out/world_data.dart b/circle_app/lib/app/world_call_out/world_data.dart deleted file mode 100644 index 6b04f16..0000000 --- a/circle_app/lib/app/world_call_out/world_data.dart +++ /dev/null @@ -1,374 +0,0 @@ -class Autogenerated { - int? code; - WorldData? data; - String? msg; - - Autogenerated({this.code, this.data, this.msg}); - - Autogenerated.fromJson(Map json) { - code = json['code']; - data = json['data'] != null ? new WorldData.fromJson(json['data']) : null; - msg = json['msg']; - } - - Map toJson() { - final Map data = new Map(); - data['code'] = this.code; - if (this.data != null) { - data['data'] = this.data!.toJson(); - } - data['msg'] = this.msg; - return data; - } -} - -class WorldData { - List? lists; - int? total; - - WorldData({this.lists, this.total}); - - WorldData.fromJson(Map json) { - if (json['lists'] != null) { - lists = []; - json['lists'].forEach((v) { - lists!.add(new WorldLists.fromJson(v)); - }); - } - total = json['total']; - } - - Map toJson() { - final Map data = new Map(); - if (this.lists != null) { - data['lists'] = this.lists!.map((v) => v.toJson()).toList(); - } - data['total'] = this.total; - return data; - } -} - -class WorldLists { - List? album; - int? borderType; - Chat? chat; - String? content; - int? id; - Interest? interest; - int? isSystem; - bool? isQueen; - JumpInfo? jumpInfo; - int? showType; - User? user; - - WorldLists( - {this.album, - this.borderType, - this.chat, - this.content, - this.id, - this.interest, - this.isSystem, - this.isQueen, - this.jumpInfo, - this.showType, - this.user}); - - WorldLists.fromJson(Map json) { - if (json['album'] != null) { - album = []; - json['album'].forEach((v) { - album!.add(new Album.fromJson(v)); - }); - } - borderType = json['borderType']; - chat = json['chat'] != null ? new Chat.fromJson(json['chat']) : null; - content = json['content']; - id = json['id']; - interest = json['interest'] != null - ? new Interest.fromJson(json['interest']) - : null; - isSystem = json['isSystem']; - isQueen = json['is_queen']; - jumpInfo = json['jumpInfo'] != null - ? new JumpInfo.fromJson(json['jumpInfo']) - : null; - showType = json['showType']; - user = json['user'] != null ? new User.fromJson(json['user']) : null; - } - - Map toJson() { - final Map data = new Map(); - if (this.album != null) { - data['album'] = this.album!.map((v) => v.toJson()).toList(); - } - data['borderType'] = this.borderType; - if (this.chat != null) { - data['chat'] = this.chat!.toJson(); - } - data['content'] = this.content; - data['id'] = this.id; - if (this.interest != null) { - data['interest'] = this.interest!.toJson(); - } - data['isSystem'] = this.isSystem; - data['is_queen'] = this.isQueen; - if (this.jumpInfo != null) { - data['jumpInfo'] = this.jumpInfo!.toJson(); - } - data['showType'] = this.showType; - if (this.user != null) { - data['user'] = this.user!.toJson(); - } - return data; - } -} - -class Album { - int? type; - String? url; - - Album({this.type, this.url}); - - Album.fromJson(Map json) { - type = json['type']; - url = json['url']; - } - - Map toJson() { - final Map data = new Map(); - data['type'] = this.type; - data['url'] = this.url; - return data; - } -} - -class Chat { - int? count; - List? users; - - Chat({this.count, this.users}); - - Chat.fromJson(Map json) { - count = json['count']; - if (json['users'] != null) { - users = []; - json['users'].forEach((v) { - users!.add(new WorldUsers.fromJson(v)); - }); - } - } - - Map toJson() { - final Map data = new Map(); - data['count'] = this.count; - if (this.users != null) { - data['users'] = this.users!.map((v) => v.toJson()).toList(); - } - return data; - } -} - -class WorldUsers { - String? avatar; - String? avatarThumb; - int? id; - String? nickname; - - WorldUsers({this.avatar, this.avatarThumb, this.id, this.nickname}); - - WorldUsers.fromJson(Map json) { - avatar = json['avatar']; - avatarThumb = json['avatarThumb']; - id = json['id']; - nickname = json['nickname']; - } - - Map toJson() { - final Map data = new Map(); - data['avatar'] = this.avatar; - data['avatarThumb'] = this.avatarThumb; - data['id'] = this.id; - data['nickname'] = this.nickname; - return data; - } -} - -class Interest { - int? baseViewTotal; - int? id; - String? image; - bool? isJoin; - int? joinTotal; - String? title; - int? viewTotal; - - Interest( - {this.baseViewTotal, - this.id, - this.image, - this.isJoin, - this.joinTotal, - this.title, - this.viewTotal}); - - Interest.fromJson(Map json) { - baseViewTotal = json['baseViewTotal']; - id = json['id']; - image = json['image']; - isJoin = json['is_join']; - joinTotal = json['join_total']; - title = json['title']; - viewTotal = json['view_total']; - } - - Map toJson() { - final Map data = new Map(); - data['baseViewTotal'] = this.baseViewTotal; - data['id'] = this.id; - data['image'] = this.image; - data['is_join'] = this.isJoin; - data['join_total'] = this.joinTotal; - data['title'] = this.title; - data['view_total'] = this.viewTotal; - return data; - } -} - -class JumpInfo { - String? btnText; - String? param; - String? scene; - - JumpInfo({this.btnText, this.param, this.scene}); - - JumpInfo.fromJson(Map json) { - btnText = json['btnText']; - param = json['param']; - scene = json['scene']; - } - - Map toJson() { - final Map data = new Map(); - data['btnText'] = this.btnText; - data['param'] = this.param; - data['scene'] = this.scene; - return data; - } -} - -class User { - int? age; - String? avatar; - String? avatarThumb; - String? bgPicUrl; - String? birthday; - String? city; - String? createTime; - int? gender; - int? id; - String? imId; - int? isOnline; - int? lat; - String? latelyTime; - int? lng; - int? mark; - String? nickname; - String? offlineTime; - String? onlineFlag; - int? orientation; - List? orientations; - int? role; - String? signature; - int? userType; - int? vip; - - User( - {this.age, - this.avatar, - this.avatarThumb, - this.bgPicUrl, - this.birthday, - this.city, - this.createTime, - this.gender, - this.id, - this.imId, - this.isOnline, - this.lat, - this.latelyTime, - this.lng, - this.mark, - this.nickname, - this.offlineTime, - this.onlineFlag, - this.orientation, - this.orientations, - this.role, - this.signature, - this.userType, - this.vip}); - - User.fromJson(Map json) { - age = json['age']; - avatar = json['avatar']; - avatarThumb = json['avatar_thumb']; - bgPicUrl = json['bgPicUrl']; - birthday = json['birthday']; - city = json['city']; - createTime = json['createTime']; - gender = json['gender']; - id = json['id']; - imId = json['imId']; - isOnline = json['isOnline']; - // lat = json['lat']; - latelyTime = json['latelyTime']; - // lng = json['lng']; - mark = json['mark']; - nickname = json['nickname']; - offlineTime = json['offlineTime']; - onlineFlag = json['onlineFlag']; - orientation = json['orientation']; - // if (json['orientations'] != null) { - // orientations = []; - // json['orientations'].forEach((v) { - // orientations!.add(new Null.fromJson(v)); - // }); - // } - role = json['role']; - signature = json['signature']; - userType = json['userType']; - vip = json['vip']; - } - - Map toJson() { - final Map data = new Map(); - data['age'] = this.age; - data['avatar'] = this.avatar; - data['avatar_thumb'] = this.avatarThumb; - data['bgPicUrl'] = this.bgPicUrl; - data['birthday'] = this.birthday; - data['city'] = this.city; - data['createTime'] = this.createTime; - data['gender'] = this.gender; - data['id'] = this.id; - data['imId'] = this.imId; - data['isOnline'] = this.isOnline; - data['lat'] = this.lat; - data['latelyTime'] = this.latelyTime; - data['lng'] = this.lng; - data['mark'] = this.mark; - data['nickname'] = this.nickname; - data['offlineTime'] = this.offlineTime; - data['onlineFlag'] = this.onlineFlag; - data['orientation'] = this.orientation; - // if (this.orientations != null) { - // data['orientations'] = this.orientations!.map((v) => v.toJson()).toList(); - // } - data['role'] = this.role; - data['signature'] = this.signature; - data['userType'] = this.userType; - data['vip'] = this.vip; - return data; - } -} diff --git a/circle_app/lib/common/Widgets/RechargeScreenDialog.dart b/circle_app/lib/common/Widgets/RechargeScreenDialog.dart deleted file mode 100644 index 6be9887..0000000 --- a/circle_app/lib/common/Widgets/RechargeScreenDialog.dart +++ /dev/null @@ -1,607 +0,0 @@ -import 'dart:async'; -import 'dart:convert'; -import 'dart:io'; - -import 'package:circle_app/common/colors/app_color.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; -import 'package:get/get.dart'; -import 'package:get/get_core/src/get_main.dart'; -import 'package:circle_app/app/home/logic.dart'; -import 'package:circle_app/app/minefragment/logic.dart'; -import 'package:circle_app/main.dart'; -import 'package:circle_app/network/dio_manager.dart'; -import 'package:circle_app/util/PaymentUtils.dart'; -import 'package:circle_app/util/eventBus.dart'; -import 'package:circle_app/util/paymentUtil.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; - -import '../../network/api.dart'; -import '../../router/app_routers.dart'; -import 'open_vip_tip/logic.dart'; - -class RechargeScreenDialog extends StatefulWidget { - bool isShowBalance; - RechargeScreenDialog({super.key,required this.isShowBalance}); - - @override - _RechargeScreenDialogState createState() => _RechargeScreenDialogState(); -} - -class _RechargeScreenDialogState extends State { - - String incomeBalance = ''; - bool isZfbPrice = true; - - bool isAgree = false; - - var logic = Get.find(); - @override - void initState() { - super.initState(); - - gelectThirdItem(); - - } - - List walletRechargeSelectItemBos = []; - - - void gelectThirdItem() async { - var data = await DioManager.getInstance().get(url: Api.walletRechargeSelectItem); - if (data['code'] == 200) { - // "walletRechargeSelectItemBos" -> [_GrowableList] - List response =data['data']['priceConfs']; - - incomeBalance = data['data']['balance'].toString(); - // List walletRechargeSelectItemBos = []; - - response.forEach((element) { - AssetsDataDataPriceConfs item = AssetsDataDataPriceConfs.fromJson(element); - if (walletRechargeSelectItemBos.length == 1) { - item.isSelected = true; - } - walletRechargeSelectItemBos.add(item); - }); - setState(() {}); - } - - } - - startPayment(String itemId) async { - SmartDialog.showLoading(); - if (isZfbPrice) { - var data = await DioManager.instance.post( - url: Api.postAliPayOrder, - params: {"product_id": itemId, "type": 4}); - var bean = BaseResponse.fromJson( - data, (data) => PayUrlBean.fromJson(data)); - if (bean.isSuccess()) { - openAliPay(bean.data.payUrl, (isSuccess, errorMsg) { - if (isSuccess) { - // 处理支付成功 - showOKToast('充值成功'); - EventBusManager.fire(AssestEvent()); - } else { - // 处理支付失败,errorMessage 可能为 null - // refreshVipStatus(); - } - }); - } else { - showOKToast(data['msg']); - } - } else { - var data = await DioManager.instance.post( - url: Api.postWxOrder, - params: {"product_id": itemId, "type": 4}); - var bean = BaseResponse.fromJson( - data, (data) => PaymentData.fromJson(data)); - if (bean.isSuccess()) { - // "wxPayAo" -> [_Map] - openWxPay(bean.data, (bool isSuccess, String? errorMessage) { - if (isSuccess) { - // 处理支付成功 - showOKToast('充值成功'); - EventBusManager.fire(AssestEvent()); - } else { - // 处理支付失败,errorMessage 可能为 null - } - }); - } else { - showOKToast(bean.msg); - } - } - SmartDialog.dismiss(); - } - - - @override - Widget build(BuildContext context) { - return Scaffold( - backgroundColor:Colors.transparent, - body: Stack( - alignment: Alignment.center, - children:[ - if (widget.isShowBalance) - Container(width: Get.width,height: Get.height,), - Container( - margin: EdgeInsets.only(left: 20.sp,right: 20.sp), - padding: EdgeInsets.all(20.sp), - height: widget.isShowBalance ? 441.sp + (!Platform.isAndroid ? 0 : 15.sp) : 390.sp + (!Platform.isAndroid ? 0 : 50.sp), - decoration: BoxDecoration( - color: const Color(0xFF393949), - borderRadius: BorderRadius.circular(10.sp) - ), - child: Column( - - children: [ - if (widget.isShowBalance) - Stack( - alignment: Alignment.center, - children: [ - Container(width:Get.width,), - Text( - '小票充值', - style: TextStyle( - color: const Color(0xFFF7FAFA), fontSize: 16.0.sp), - ), - Positioned( - right: 0.sp, - child: IconButton( - icon: const Icon(Icons.close, color: Colors.white), - onPressed: () => Navigator.pop(context), - ), - ), - ], - ), - if (widget.isShowBalance) - Container( - margin: EdgeInsets.only(top: 10.0.sp), - alignment: Alignment.topLeft, - child: Text( - '小票余额:${incomeBalance}', - style: TextStyle( - color: const Color(0xFFEFD84E), fontSize: 14.0.sp), - ), - ), - if (widget.isShowBalance) - SizedBox(height: 5.0.sp), - ListView.builder( - padding: EdgeInsets.zero, - shrinkWrap: true, - physics: const NeverScrollableScrollPhysics(), - itemCount: walletRechargeSelectItemBos.length, - itemBuilder: (context, index) { - return itemView( - context, walletRechargeSelectItemBos[index], index); - }, - ), - !Platform.isAndroid ? Container( - height: 10.sp, - ): Container( - margin: EdgeInsets.only(top: 4.sp,bottom: 10.sp), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - onTap: () { - // 处理支付宝支付逻辑 - isZfbPrice = true; - setState(() { - - }); - }, - child: Row( - children: [ - Image.asset( - isZfbPrice? - getMineImage("icon_pay_select"): getMineImage("icon_pay_is_no_select"), - width: 20.0.sp, - height: 20.0.sp, - ), - SizedBox(width: 8.0.sp), - Image.asset( - getMineImage('icon_cooperate_ali'), - width: 20.0.sp, - height: 20.0.sp, - ), - SizedBox(width: 4.0.sp), - Text( - '支付宝支付', - style: TextStyle( - color: const Color(0xFFF7FAFA), - fontSize: 14.0.sp, - ), - ), - SizedBox(width: 4.0.sp), - Image.asset( - getMineImage('icon_recommend_pay_way'), - width: 32.0.sp, - height: 16.0.sp, - ), - ], - ), - ), - SizedBox(width: 24.0.sp), - GestureDetector( - onTap: () { - isZfbPrice = false; - setState(() { - - }); - }, - child: Row( - children: [ - Image.asset( - !isZfbPrice? - getMineImage("icon_pay_select"): getMineImage("icon_pay_is_no_select"), - width: 20.0.sp, - height: 20.0.sp, - ), - SizedBox(width: 8.0.sp), - Image.asset( - getMineImage('icon_cooperate_wx'), - width: 20.0.sp, - height: 20.0.sp, - ), - SizedBox(width: 4.0.sp), - Text( - '微信支付', - style: TextStyle( - color: const Color(0xFFF7FAFA), - fontSize: 14.0.sp, - ), - ), - ], - ), - ), - ], - ), - ), - GestureDetector( - onTap: () { - if (!isAgree) { - showOKToast('请先阅读并同意小票充值协议'); - return; - } - - if (Platform.isAndroid) { - String itemId = ''; - walletRechargeSelectItemBos.forEach((element) { - if (element.isSelected) { - itemId = element.id.toString(); - } - }); - startPayment(itemId); - } else { - iosPay(); - } - }, - child: Container( - height: 40.sp, - width: Get.width, - decoration: BoxDecoration( - gradient: AppColor.mainVerLinearGradient, - borderRadius: BorderRadius.circular(21.0), - ), - child: Center( - child: Text( - '立即充值', - style: TextStyle( - color: const Color(0xFFF7FAFA), - fontSize: 14.0.sp), - ), - ), - ), - ), - SizedBox(height: 10.0.sp), - - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - isAgree = !isAgree; - setState(() { - - }); - }, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset( - isAgree ? - getMineImage("icon_pay_select"): getMineImage("icon_pay_is_no_select"), - width: 14.0.sp, - height: 14.0.sp, - ), - SizedBox(width: 4.0.sp), - - Text( - '阅读并同意', - style: TextStyle( - color: const Color(0xFFB7BECC), fontSize: 10.0.sp), - ), - GestureDetector( - onTap: () { - navigateToItem(); - }, - child: Text( - '《小票充值协议》', - style: TextStyle( - color: const Color(0xFF21BEAB), - fontSize: 10.0.sp), - ), - ), - ], - ), - ), - SizedBox(height: 10.0.sp), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - '充值遇到问题?', - style: TextStyle( - color: const Color(0xFFB7BECC), fontSize: 10.0.sp), - ), - GestureDetector( - onTap: () async { - var con; - if(kDebugMode){ - con = V2TimConversation( - conversationID: "c2c_qpqz_dev_10_102", userID: "qpqz_dev_10_102", showName: "测试乐园客服", type: 1); - }else{ - con = V2TimConversation( - conversationID: "c2c_qpqz_prod_10_102", userID: "qpqz_prod_10_102", showName: "乐园客服", type: 1); - } - Get.toNamed(AppRoutes.Chat, arguments: con); - }, - child: Text( - '联系客服', - style: TextStyle( - color: const Color(0xFFEFD84E), - fontSize: 10.0.sp), - ), - ), - ], - ), - ], - ), - ), - - ] , - - ), - ); - } - - void iosPay() { - SmartDialog.showLoading(); - String itemId = ''; - String Id = ''; - walletRechargeSelectItemBos.forEach((element) { - if (element.isSelected) { - itemId = element.itemId!; - Id = element.id!.toString(); - } - }); - - IOSPayment.instance.iosPay(itemId,Id,4); - } - - Widget itemView(BuildContext context, AssetsDataDataPriceConfs item, int index) { - - - String iconIv = getMineImage('bi_icon${index+1}'); - return GestureDetector( - onTap: () { - setState(() { - walletRechargeSelectItemBos.asMap().forEach((key, value) { - value.isSelected = key == index; - }); - }); - }, - child: Container( - height: 49.sp, - margin: const EdgeInsets.only(bottom: 10), - decoration: BoxDecoration( - color: !item.isSelected - ? const Color(0xFF464556) - : const Color(0xFF464556), - borderRadius: BorderRadius.circular(6), - border: item.isSelected - ? Border.all(color: const Color(0xFF21BEAB), width: 1.sp) - : null, - ), - child: Container( - margin: EdgeInsets.only(left: 6.sp, right: 6.sp), - child: Row( - children: [ - Image.asset( - iconIv, // Replace this with the actual image path - width: 30.sp, - - ), - SizedBox(width: 8.sp), - Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "${item.coin}小票", - style: TextStyle(color: Colors.white, fontSize: 14.sp), - ), - if (item.remark!.isNotEmpty) - Text( - item.remark!, - style: TextStyle( - color: const Color(0xFFEFD84E), fontSize: 10.0.sp), - ), - ],), - Expanded(child: Container()), - // To push the next widget to the right edge - Text( - '${item.amount}元', - style: TextStyle(color: Colors.white, fontSize: 14.sp), - ), - ], - ), - ), - )); - } - - void loadBalanceData() { - - } -} -/// -/// Code generated by jsonToDartModel https://ashamp.github.io/jsonToDartModel/ -/// -class AssetsDataDataPriceConfs { -/* -{ - "amount": 0, - "coin": 0, - "id": 0, - "itemId": "", - "presentCoin": 0, - "presentWealthGrade": 0 -} -*/ - - int? amount; - int? coin; - int? id; - String? itemId; - String? remark; - bool isSelected = false; - int? presentCoin; - int? presentWealthGrade; - - AssetsDataDataPriceConfs({ - this.amount, - this.coin, - this.id, - this.itemId, - this.presentCoin, - this.presentWealthGrade, - }); - AssetsDataDataPriceConfs.fromJson(Map json) { - amount = json['amount']?.toInt(); - coin = json['coin']?.toInt(); - id = json['id']?.toInt(); - remark = json['remark'] ?? ''; - itemId = json['itemId']?.toString(); - presentCoin = json['presentCoin']?.toInt(); - presentWealthGrade = json['presentWealthGrade']?.toInt(); - } - Map toJson() { - final data = {}; - data['amount'] = amount; - data['coin'] = coin; - data['id'] = id; - data['itemId'] = itemId; - data['presentCoin'] = presentCoin; - data['presentWealthGrade'] = presentWealthGrade; - return data; - } -} - -class AssetsDataData { -/* -{ - "balance": 0, - "priceConfs": [ - { - "amount": 0, - "coin": 0, - "id": 0, - "itemId": "", - "presentCoin": 0, - "presentWealthGrade": 0 - } - ] -} -*/ - - int? balance; - List? priceConfs; - - AssetsDataData({ - this.balance, - this.priceConfs, - }); - AssetsDataData.fromJson(Map json) { - balance = json['balance']?.toInt(); - if (json['priceConfs'] != null) { - final v = json['priceConfs']; - final arr0 = []; - v.forEach((v) { - arr0.add(AssetsDataDataPriceConfs.fromJson(v)); - }); - priceConfs = arr0; - } - } - Map toJson() { - final data = {}; - data['balance'] = balance; - if (priceConfs != null) { - final v = priceConfs; - final arr0 = []; - v!.forEach((v) { - arr0.add(v!.toJson()); - }); - data['priceConfs'] = arr0; - } - return data; - } -} - -class AssetsData { -/* -{ - "code": 0, - "data": { - "balance": 0, - "priceConfs": [ - { - "amount": 0, - "coin": 0, - "id": 0, - "itemId": "", - "presentCoin": 0, - "presentWealthGrade": 0 - } - ] - }, - "msg": "" -} -*/ - - int? code; - AssetsDataData? data; - String? msg; - - AssetsData({ - this.code, - this.data, - this.msg, - }); - AssetsData.fromJson(Map json) { - code = json['code']?.toInt(); - data = (json['data'] != null) ? AssetsDataData.fromJson(json['data']) : null; - msg = json['msg']?.toString(); - } - Map toJson() { - final data = {}; - data['code'] = code; - if (data != null) { - data['data'] = this.data!.toJson(); - } - data['msg'] = msg; - return data; - } -} diff --git a/circle_app/lib/common/Widgets/add_wx_tip.dart b/circle_app/lib/common/Widgets/add_wx_tip.dart deleted file mode 100644 index b76068e..0000000 --- a/circle_app/lib/common/Widgets/add_wx_tip.dart +++ /dev/null @@ -1,216 +0,0 @@ -import 'package:circle_app/common/colors/app_color.dart'; -import 'package:circle_app/network/api.dart'; -import 'package:circle_app/network/dio_manager.dart'; -import 'package:circle_app/router/app_routers.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; -import 'package:get/get.dart'; - -class AddWxTip extends StatefulWidget { - bool isHaveWx; - bool isHidden; - bool isWxHidden; - // TODO: add state variables, methods and constructor params - AddWxTip(this.isHaveWx, this.isHidden, this.isWxHidden); - - @override - State createState() => _AddWxTipState(); -} - -class _AddWxTipState extends State { - bool isAuth = false; - String desc = ''; - String tip = ''; - String title = ''; - @override - void initState() { - // TODO: implement initState - super.initState(); - loadData(); - } - - @override - Widget build(BuildContext context) { - // TODO: add widget build method - return Scaffold( - backgroundColor: Colors.transparent, - body: Center( - child: Container( - margin: EdgeInsets.only(left: 15.sp, right: 15.sp), - height: Get.height * 0.65, - child: Column( - children: [ - Expanded( - child: Container( - width: Get.width - 30.sp, - decoration: BoxDecoration( - color: Color(0x99000000), - image: DecorationImage( - image: AssetImage(getHomeImage("wx_tip_bg")), - fit: BoxFit.fill, - ), - ), - child: Container( - color: Color(0x99000000).withOpacity(0.4), - padding: EdgeInsets.all(6.sp), - child: Column( - children: [ - Expanded( - child: Container( - child: RawScrollbar( - radius: Radius.circular(20), - // isAlwaysShown: true, - thickness: 2, - thumbColor: Colors.white, - child: SingleChildScrollView( - child: Column( - children: [ - Container( - margin: EdgeInsets.only( - top: 10.sp, bottom: 5.sp), - child: Image.asset( - getHomeImage('wx_tip_title'), - height: 18.sp, - )), - Container( - padding: EdgeInsets.only( - left: 15.sp, right: 15.sp), - child: Text( - desc, - style: TextStyle( - color: Colors.white, - fontSize: 16.sp, - fontWeight: FontWeight.w500, - height: 2.0, - ), - )), - Container( - padding: EdgeInsets.only( - left: 15.sp, right: 15.sp), - child: Text( - tip, - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.w500, - fontSize: 16.sp, - height: 2.0, - ), - )) - ], - ), - ), - ), - )), - Container( - margin: EdgeInsets.only( - top: 15.sp, - right: 15.sp, - left: 15.sp, - bottom: 15.sp), - child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Expanded(child: Container()), - GestureDetector( - onTap: () async { - if (widget.isHidden) { - var result = await DioManager() - .post(url: Api.confset, params: { - 'hideContact': widget.isWxHidden ? 0 : 1 - }); - if (result['code'] == 200) { - showOKToast('操作成功'); - } - Get.back(); - } else { - showOKToast('为了维护站内的社交环境,联系信息填写必须真实哦~'); - Get.back(); - showUpdateWxPicker(phone: '1'); - } - }, - child: Container( - alignment: Alignment.center, - height: 30.sp, - width: 100.sp, - decoration: BoxDecoration( - color: Colors.blue.withOpacity(0.9), - borderRadius: - BorderRadius.circular(4.sp)), - child: Text( - widget.isHidden - ? widget.isWxHidden - ? '取消隐藏方式' - : '隐藏联系方式' - : '手机号即微信', - style: TextStyle( - color: Colors.white, fontSize: 14.sp), - ), - ), - ), - Expanded(child: Container()), - GestureDetector( - onTap: () { - showOKToast('为了维护站内的社交环境,联系方式填写必须真实哦~'); - Get.back(); - showUpdateWxPicker(); - }, - child: Container( - height: 30.sp, - width: 100.sp, - - // padding: EdgeInsets.only(left: 6.sp, right: 6.sp), - alignment: Alignment.center, - decoration: BoxDecoration( - gradient: AppColor.mainVerLinearGradient, - borderRadius: - BorderRadius.circular(4.sp)), - child: Text( - widget.isHaveWx - ? ' 更新联系方式 ' - : ' 填写联系方式 ', - style: TextStyle( - color: Colors.white, fontSize: 14.sp), - ), - ), - ), - Expanded(child: Container()), - ], - ), - ), - ], - ), - ), - ), - ), - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - Get.back(); - }, - child: Container( - margin: EdgeInsets.only(bottom: 5.sp, top: 10.sp), - alignment: Alignment.center, - child: Image.asset( - getHomeImage('wx_close'), - width: 32.sp, - fit: BoxFit.fill, - )), - ) - ], - ), - ), - ), - ); - } - - void loadData() async { - var data1 = await DioManager.instance.get(url: Api.popWxNumStr); - - desc = data1['content'] ?? ''; - title = data1['title'] ?? ''; - tip = data1['tip'] ?? ''; - setState(() {}); - } -} diff --git a/circle_app/lib/common/Widgets/base_tip_widget.dart b/circle_app/lib/common/Widgets/base_tip_widget.dart deleted file mode 100644 index 5c4e1a1..0000000 --- a/circle_app/lib/common/Widgets/base_tip_widget.dart +++ /dev/null @@ -1,307 +0,0 @@ -import 'dart:io'; - -import 'package:circle_app/common/Widgets/add_wx_tip.dart'; -import 'package:circle_app/common/colors/app_color.dart'; -import 'package:circle_app/util/paymentUtil.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; -import 'package:get/get.dart'; - -import '../../network/api.dart'; -import '../../network/dio_manager.dart'; -import '../../util/PaymentUtils.dart'; -import 'RechargeScreenDialog.dart'; -import 'open_vip_tip/logic.dart'; -import 'open_vip_tip/view.dart'; - -bool isZfbPrice = true; - -joiinCircileTipWdiget(String cicleId, String pirce, String oldPrice, - String title, MyCallback myCallback,{String iosItem = ''}) { - return StatefulBuilder(builder: (BuildContext context, StateSetter setState) { - return Scaffold( - backgroundColor: Colors.transparent, - resizeToAvoidBottomInset: false, - body: Container( - width: Get.width, - height: Get.height, - alignment: Alignment.center, - child: Stack( - alignment: Alignment.center, - children: [ - Container( - width: 339.sp, - height: Platform.isIOS ? 380.sp :420.sp , - - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.fill, - image: AssetImage(getCircleImage('add_tip_bg'))))), - Positioned( - top: 5.sp, - right: 12.sp, - child: GestureDetector( - onTap: () { - Get.back(); - }, - child: Image.asset( - getCircleImage('close'), - width: 24.sp, - ), - )), - Positioned( - top: 24.sp, - child: Text( - title, - style: TextStyle(color: Colors.white, fontSize: 16.sp), - )), - Positioned( - left: 17.sp, - top: 64.sp, - child: Text( - '为什么要解锁圈子?', - style: TextStyle(color: Colors.white, fontSize: 16.sp), - )), - Positioned( - top: 98.sp, - child: Container( - width: 339.sp, - padding: EdgeInsets.only(left: 17.sp, right: 17.sp), - child: Text( - '为打造纯净的社交环境,更好地服务大家,基于以下几方面考虑:\n\n1、平台升级为全天24小时人工审核,保证用户真实,避免骗子、酒托、虚假人士等扰乱平台 ;\n\n2、杜绝未入圈用户随意骚扰或影响已入圈的;\n\n3、谢绝只会白嫖的猎奇人士。', - style: TextStyle( - color: const Color.fromRGBO(247, 250, 250, 0.8), - fontSize: 14.sp)), - )), - Platform.isIOS - ? Container( - height: 1, - width: 1, - ) - : Positioned( - bottom: 128.sp, - child: Container( - margin: EdgeInsets.only(top: 24.0.sp), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - onTap: () { - setState(() { - isZfbPrice = true; - }); - }, - child: Row( - children: [ - Image.asset( - isZfbPrice - ? getMineImage("icon_pay_select") - : getMineImage("icon_pay_is_no_select"), - width: 20.0.sp, - height: 20.0.sp, - ), - SizedBox(width: 8.0.sp), - Image.asset( - getMineImage('icon_cooperate_ali'), - width: 20.0.sp, - height: 20.0.sp, - ), - SizedBox(width: 4.0.sp), - Text( - '支付宝支付', - style: TextStyle( - color: const Color(0xFFF7FAFA), - fontSize: 14.0.sp, - ), - ), - SizedBox(width: 4.0.sp), - Image.asset( - getMineImage('icon_recommend_pay_way'), - width: 32.0.sp, - height: 16.0.sp, - ), - ], - ), - ), - SizedBox(width: 24.0.sp), - GestureDetector( - onTap: () { - setState(() { - isZfbPrice = false; - }); - }, - child: Row( - children: [ - Image.asset( - !isZfbPrice - ? getMineImage("icon_pay_select") - : getMineImage("icon_pay_is_no_select"), - width: 20.0.sp, - height: 20.0.sp, - ), - SizedBox(width: 8.0.sp), - Image.asset( - getMineImage('icon_cooperate_wx'), - width: 20.0.sp, - height: 20.0.sp, - ), - SizedBox(width: 4.0.sp), - Text( - '微信支付', - style: TextStyle( - color: const Color(0xFFF7FAFA), - fontSize: 14.0.sp, - ), - ), - ], - ), - ), - ], - ), - ), - ), - Positioned( - bottom: 8.sp, - child: Column( - children: [ - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - if (Platform.isIOS) { - IOSPayment.instance.iosPay(iosItem, cicleId, 1); - } else { - unlockingPayment(cicleId, myCallback); - - } - }, - child: Container( - width: 168.sp, - height: 42.sp, - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(21.sp), - gradient: const LinearGradient( - begin: Alignment.centerLeft, - end: Alignment.centerRight, - colors: [Color(0xff0AFCFF), Color(0xffD739EA)])), - child: Text( - '立即解锁', - style: TextStyle(color: Colors.white, fontSize: 16.sp), - ), - ), - ), - SizedBox(height: 10.sp,), - Text('一次解锁 · 永久有效',style: TextStyle(color: AppColor.mainColor,fontSize: 15.sp),) - ], - )), - Positioned( - bottom: 90.sp, - child: Row( - children: [ - Text( - '¥$pirce', - style: TextStyle( - color: Color(0xffE845FF), - fontSize: 16.sp, - fontWeight: FontWeight.w600), - ), - SizedBox( - width: 2.sp, - ), - Text( - '(原价$oldPrice)', - style: TextStyle( - color: Colors.white70, - fontSize: 16.sp, - fontWeight: FontWeight.w400, - decoration: TextDecoration.lineThrough, - decorationColor: Colors.white70, - ), - ), - ], - )) - ], - ), - ), - ); - }); -} - -unlockingPayment(String cicleId, MyCallback myCallback) async { - SmartDialog.showLoading(); - if (isZfbPrice) { - var data = await DioManager.instance.post( - url: Api.postAliPayOrder, params: {"product_id": cicleId, "type": 1}); - var bean = BaseResponse.fromJson( - data, (data) => PayUrlBean.fromJson(data)); - if (bean.isSuccess()) { - openAliPay(bean.data.payUrl, (isSuccess, errorMsg) { - if (isSuccess) { - myCallback(true); - } - }); - // showToast(data.toString()); - } else { - showOKToast(bean.msg); - } - } else { - var data = await DioManager.instance - .post(url: Api.postWxOrder, params: {"product_id": cicleId, "type": 1}); - var bean = BaseResponse.fromJson( - data, (data) => PaymentData.fromJson(data)); - if (bean.isSuccess()) { - openWxPay(bean.data, (bool isSuccess, String? errorMessage) { - if (isSuccess) { - myCallback(true); - } else { - // 处理支付失败,errorMessage 可能为 null - } - }); - } else { - showOKToast(bean.msg); - } - - } - SmartDialog.dismiss(); -} - -typedef void MyCallback(bool payResult); - -showJoinCiclePiker(String cicleId, String pirce, String oldPrice, int type, - MyCallback payResult,String iosItem) { - String title = ['解锁圈子才能发布喊话', '解锁圈子才能查看主页', '解锁圈子才能主动私聊'][type]; - int intP = double.parse(pirce).toInt(); - int intoldPrice = double.parse(oldPrice).toInt(); - return Get.bottomSheet( - joiinCircileTipWdiget(cicleId,intP.toString(), intoldPrice.toString(), title, payResult,iosItem: iosItem), - isScrollControlled: true, - enableDrag: false); -} - - - -Future showAddWxPicker(bool isHaveWx,{bool isHidden = false, bool isWxHidden = false}) { - return Get.bottomSheet(AddWxTip(isHaveWx,isHidden,isWxHidden),isScrollControlled: true,enableDrag: false); -} - - -Future showRechargeScreenDialog() { - return showDialog( - context: Get.context!, - builder: (BuildContext context) { - return RechargeScreenDialog(isShowBalance: true,); - }, - ); -} - -showOepnVipDialog() async { - return Get.bottomSheet( - Scaffold( - backgroundColor: Colors.transparent, - body: Open_vip_tipPage(false), - ), - isScrollControlled: true, - enableDrag: false); -} \ No newline at end of file diff --git a/circle_app/lib/common/Widgets/circle_share.dart b/circle_app/lib/common/Widgets/circle_share.dart deleted file mode 100644 index e1e8b6c..0000000 --- a/circle_app/lib/common/Widgets/circle_share.dart +++ /dev/null @@ -1,838 +0,0 @@ -import 'dart:convert'; -import 'dart:io'; - -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:circle_app/app/circle/logic.dart'; -import 'package:circle_app/app/invite/logic.dart'; -import 'package:circle_app/app/minefragment/logic.dart'; -import 'package:circle_app/common/Widgets/follow_me_dialog.dart'; -import 'package:circle_app/common/Widgets/text_more.dart'; -import 'package:circle_app/main.dart'; -import 'package:circle_app/network/api.dart'; -import 'package:circle_app/network/dio_manager.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/rendering.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; -import 'package:get/get.dart'; -import 'package:get/get_core/src/get_main.dart'; -import 'package:image_gallery_saver/image_gallery_saver.dart'; -import 'dart:ui' as ui; -import 'package:fluwx/fluwx.dart' as fluwx; -import 'package:path_provider/path_provider.dart'; -import 'package:qr_flutter/qr_flutter.dart'; -import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; - -import '../../app/likelist/logic.dart'; - - -class CircleShare extends StatefulWidget { - Circle bean; - String code; - String link; - CircleShare(this.code, this.link,this.bean); - @override - _CircleShareState createState() => new _CircleShareState(); - -} - -class _CircleShareState extends State { - // TODO: add state variables and methods - GlobalKey _globalKey = GlobalKey(); - List lists = []; - late MinefragmentLogic logic; - List conList = []; - - @override - void initState() { - // TODO: implement initState - super.initState(); - Get.lazyPut(() => MinefragmentLogic()); - logic = Get.find(); - loadFollowMeData(); - loadInviteData(); - } - - loadInviteData() async { - - var data = await DioManager.instance.get(url: Api.inviteMainPage); - if (data['code'] == 200) { - Autogenerated result = Autogenerated.fromJson(data); - - Data homeData = result.data!; - widget.code = homeData.inviteCode!; - - widget.link = homeData.link!; - setState(() { - - }); - - } - } - - @override - Widget build(BuildContext context) { - // TODO: add widget build method - return Scaffold( - backgroundColor: Colors.transparent, - body: Container( - child: Column( - children: [ - Expanded(child: Container()), - Container( - width: Get.width - 40.sp, - // height: Get.height - Get.bottomBarHeight - 164.sp - 10.sp, - child:SingleChildScrollView( - child: RepaintBoundary( - key: _globalKey, - child: Container( - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage(getCircleImage("open_vip_bg")), - fit: BoxFit.fill, - ), - ), - child: Column( - children: [ - Container( - width: Get.width, - height: 65.sp, - margin: EdgeInsets.only(left: 15.sp, top: 20.sp,right: 15.sp), - child: Row( - children: [ - Center( - child: Stack( - alignment: Alignment.center, - children: [ - Container( - width: 47.sp, - height: 47.sp, - decoration: const BoxDecoration( - shape: BoxShape.circle, - gradient: LinearGradient( - colors: [ - Color(0xFFDD3DF4), - Color(0xFF30FFD9) - ], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - ), - SizedBox( - width: 46.sp, - height: 46.sp, - child: _buildAvatar1(logic), - ) - ], - ), - ), - Expanded( - child: Container( - padding: EdgeInsets.only(left: 10.sp), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - _buildNameRow(logic), - SizedBox(height: 10.sp), - _buildInfoRow(logic), - ], - ), - ), - ), - Image.asset( - getBaseImage("ic_launcher"), - width: 65.sp, - height: 65.sp, - ) - ], - ), - ), - // Expanded( - // child: - Container( - padding: EdgeInsets.only(left: 10.sp,right: 10.sp), - // color: Colors.red, - // height: 310.sp, - child: Column( - children: [ - SizedBox( - height: 5.sp, - ), - Container( - padding: EdgeInsets.only(left: 15.sp,right: 15.sp), - child: Image.asset( - getMineImage('share_title'), - ), - ), - SizedBox( - height: 10.sp, - ), - circleInfoItem(widget.bean) - ], - ), - ), - Container( - // height: 90.sp, - // color: Color(0xFF334141), - alignment: Alignment.center, - // color: Colors.yellow, - // width: Get.width-40.sp, - margin: EdgeInsets.only(bottom: 15.sp,top: 10.sp), - padding: EdgeInsets.only(left: 15.sp, right: 15.sp), - child: Row( - - children: [ - Expanded( - child: Container( - // color: Colors.red, - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Container( - // color: Colors.blue, - child: Row( - children: [ - Text( - '专属邀请码', - style: TextStyle( - color: Colors.white, - fontSize: 18.sp), - ), - SizedBox( - width: 8.sp, - ), - Container( - alignment: Alignment.center, - padding: EdgeInsets.only( - left: 10.sp, right: 10.sp), - height: 25.sp, - decoration: BoxDecoration( - // color: Color(0xFFDC5BFD), - gradient: - const LinearGradient( - colors: [ - Color(0xFF0DF5F7), - Color(0xFFD263FB) - ], - begin: - Alignment.centerLeft, - end: - Alignment.centerRight, - ), - borderRadius: - BorderRadius.circular( - 12.5.sp)), - child: Text( - widget.code, - style: TextStyle( - color: Colors.black, - fontSize: 12.sp), - ), - ) - ], - ), - ), - Container( - margin: EdgeInsets.only(top: 10.sp), - width: Get.width - 200.sp, - child: Text( - '扫码或长按识别下载APP,认识更多小众圈子里的人,给生活带来更多乐趣~', - style: TextStyle( - color: Colors.white, - fontSize: 15.sp)), - ) - ], - ), - ), - ), - // Image.asset(getBaseImage("ic_launcher"),width: 80.sp,height: 80.sp,) - Stack( - alignment: Alignment.center, - children: [ - Container( - color: Colors.white, - width: 90.sp, - height: 90.sp, - ), - QrImageView( - data: widget.link, - padding: EdgeInsets.zero, - version: QrVersions.auto, - size: 80.sp, - gapless: false, - // backgroundColor: Colors.black, - ) - ], - ) - ], - ), - ) - ], - ), - )) - ), - ), - SizedBox(height: 10.sp,), - Container( - height: lists.isNotEmpty || conList.isNotEmpty ? 264.sp : 164.sp, - width: Get.width, - color: Color(0xFF292247), - child: Column( - children: [ - if (lists.isNotEmpty || conList.isNotEmpty) - Container( - height: 100.sp, - child: ListView.builder( - scrollDirection: Axis.horizontal, - itemBuilder: (context,index) { - if (index == 4) { - return GestureDetector( - onTap: () { - Get.bottomSheet(FollowMeDialog( bean: widget.bean,), isScrollControlled: true, - enableDrag: false); - }, - behavior: HitTestBehavior.opaque, - child: Container( - width: Get.width / 5, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset(getCircleImage('share_more'),width: 51.sp,), - SizedBox(height: 4.sp,), - Text('更多',style: TextStyle(color: Colors.white,fontSize: 14.sp),) - ], - ), - ), - ); - } - var info; - if (conList.length > index) { - info = conList[index]; - } else { - info = lists[index]; - } - return GestureDetector( - onTap: () { - sendCircleCustomMsg(info.userID ?? info.user.imId, - jsonEncode(widget.bean.toJson()), '分享[${widget.bean.title}]'); - }, - behavior: HitTestBehavior.opaque, - child: Container( - width: Get.width / 5, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - ClipOval(child: Image.network(info.faceUrl ?? info.user.avatar,width: 51.sp,height: 51.sp,fit: BoxFit.cover,),), - SizedBox(height: 4.sp,), - Text(info.nickName ?? info.user.nickname,style: TextStyle(color: Colors.white,fontSize: 14.sp),maxLines: 1,overflow: TextOverflow.ellipsis,) - ], - ), - ), - ); - },itemCount: conList.length + lists.length > 5 ? 5 : conList.isNotEmpty ? conList.length : lists.length,), - ), - Expanded( - child: Container( - padding: EdgeInsets.only( - top: 15.sp, left: 15.sp, right: 15.sp), - alignment: Alignment.center, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - shareAction('wx', '微信', () { - shareWxData(1); - }), - shareAction('wxq', '朋友圈', () { - shareWxData(2); - }), - shareAction('save', '复制邀请链接', () { - copyInviteText(logic.name); - }), - shareAction('hb', '保存邀请海报', () { - _saveLocalImage(); - }), - ], - ), - )), - Container( - height: 1.sp, - color: Color(0x33FFFFFF), - ), - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - Get.back(); - }, - child: Container( - height: 67.sp, - alignment: Alignment.center, - child: Text( - '取消', - style: TextStyle( - color: Colors.white, fontSize: 14.sp), - ), - ), - ) - ], - ), - ) - ], - ), - ), - ); - } - - Widget _buildAvatar1(MinefragmentLogic logic) { - return ClipOval( - child: GestureDetector( - onTap: () { - if (logic.userInfoBean != null) { - var imgList = []; - imgList.add(logic.userInfoBean!.avatar); - // Get.toNamed(AppRoutes.Swiper,arguments:imgList); - // Get.toNamed(AppRoutes.Swiper, arguments: { - // 'imaglist': imgList, - // 'index': 0 - // }); - } - }, - child: logic.userInfoBean == null - ? SizedBox( - width: 63.sp, - height: 63.sp, - ) - : CachedNetworkImage( - fit: BoxFit.cover, - placeholder: null, - imageUrl: logic.avatar, - width: 63.sp, - height: 63.sp, - ), - ), - ); - } - - Widget _buildNameRow(MinefragmentLogic logic) { - return Container( - margin: EdgeInsets.only(top: 6.sp), - child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - logic.name, - style: TextStyle( - color: const Color.fromRGBO(247, 250, 250, 1.0), - fontSize: 16.sp, - ), - ), - SizedBox( - width: 4.sp, - ), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color.fromRGBO(141, 255, 248, 1.0), - Color.fromRGBO(181, 211, 255, 1.0), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 2.sp, bottom: 2.sp, left: 10.sp, right: 10.sp), - child: Text( - logic.ageMsg, - style: TextStyle( - color: Colors.black, - fontSize: 10.sp, - ), - ), - ), - ], - ), - ); - } - - Widget _buildInfoRow(MinefragmentLogic logic) { - return Row( - children: [ - Text('邀请您加入', - style: TextStyle( - color: Colors.white, - fontSize: 12.sp, - )), - Text('【微乐园APP】', - style: TextStyle( - color: Color(0xFF0DF5F7), - fontSize: 12.sp, - )), - ], - ); - } - circleWidget(String url, String userId, {double width = 24}) { - return Stack( - alignment: Alignment.center, - children: [ - Image.asset( - getCircleImage('avatar_bg'), - width: width.sp, - ), - ClipOval( - child: CachedNetworkImage( - imageUrl: url ?? - "https://qiniuyun.leyuan666.com/quanzi/avatar/default.png", - width: (width - 1).sp, - height: (width - 1).sp, - fit: BoxFit.cover, - ), - ) - ], - ); - } - circleInfoItem(Circle bean) { - List urlList = bean.lastJoinUsers; - List widgets = []; - int i = 0; - // print(urlList); - if (null != urlList) { - urlList.forEach((element) { - if (widgets.length > 2) { - return; - } - widgets.add(Positioned( - left: 15.sp * i, - child: circleWidget( - element.avatar! ?? - "https://qiniuyun.leyuan666.com/quanzi/avatar/default.png", - element.id.toString()), - )); - i++; - }); - } - return Container( - margin: EdgeInsets.only(bottom: 10.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10.sp), - gradient: LinearGradient(colors: [Color(0xFF261240),Color(0xFF132C40),]) - ), - child: Column( - children: [ - ClipRRect( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(10.sp), - topRight: Radius.circular(10.sp)), - child: Container( - padding: EdgeInsets.only(left: 12.sp, right: 12.sp), - height: 72.sp, - decoration: BoxDecoration( - - gradient: LinearGradient(colors: [Color(0xFF261240),Color(0xFF132C40),]), - - ), - child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - width: 42.sp, - height: 42.sp, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8.0), - gradient: const LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [ - Color(0xFF71F3F2), - Color(0xFFF558FF), - ], - stops: [0.0365, 0.9427], - ), - ), - padding: EdgeInsets.all(1.sp), - child: ClipRRect( - borderRadius: BorderRadius.circular(8.0), - child: CachedNetworkImage( - imageUrl: bean.image, - width: 40.sp, - height: 40.sp, - fit: BoxFit.cover), - ), - ), - Expanded( - child: Container( - padding: EdgeInsets.only(left: 8.sp, top: 12.sp), - // alignment: Alignment., - height: 72.sp, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - bean.title, - style: TextStyle( - color: Colors.white, - fontSize: 18.sp, - fontWeight: FontWeight.w600), - ), - SizedBox( - height: 4.sp, - ), - Text( - '${convertToTenThousand(bean.viewTotal)}人看过', - textAlign: TextAlign.left, - style: TextStyle( - color: const Color(0xff03FEFB), - fontSize: 12.sp, - ), - ), - ], - ), - )), - - Stack( - alignment: Alignment.center, - children: [ - Image.asset( - getCircleImage('add'), - width: 77.sp, - ), - Text( - !bean.isJoin ? '申请加入' : '分享有奖', - style: TextStyle( - color: Colors.white, fontSize: 12.sp), - ) - ], - ) - ], - ), - )), - Container( - padding: EdgeInsets.only(left: 12.sp, right: 12.sp), - // height:urlList.length==0?47.sp: 118.sp, - decoration: BoxDecoration( - - ), - child: Container( - margin: EdgeInsets.only(top: 10.sp, bottom: 10.sp), - child: Column( - children: [ - Container( - margin: EdgeInsets.only(bottom: 7.sp), - width: Get.width - 80.sp, - // height: 50.sp, - child: HideText( - text: bean.intro, - maxWidth: Get.width - 84.sp, - additionText: '查看更多', - maxLines: 3, - style: TextStyle(color: Colors.white, fontSize: 14.sp), - additionStyle: TextStyle( - color: const Color(0xFFFF4DF6), fontSize: 14.sp), - onTap: () { - - }, - )), - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - // showToast("点个鸡毛,星哥还没做"); - // Get.toNamed(AppRoutes.FriendsActivity,arguments: '3'); - }, - child: urlList.length == 0 - ? Container() - : Row( - children: [ - SizedBox( - height: 30.sp, - width: - 30.0.sp + 14.sp * (widgets.length - 1.sp), - child: Stack( - alignment: Alignment.center, - children: widgets, - ), - ), - SizedBox( - width: 4.sp, - ), - Text( - '${convertToTenThousand(bean.joinTotal)}圈友加入', - style: TextStyle( - color: Colors.white, fontSize: 12.sp), - ), - SizedBox( - width: 4.sp, - ), - // GestureDetector( - // onTap: () { - // Get.bottomSheet( - // CircleShare('code','link,',bean), isScrollControlled: true, - // enableDrag: false - // ); - // }, - // behavior: HitTestBehavior.opaque, - // child: Container( - // height: 30.sp, - // alignment: Alignment.center, - // child: Image.asset( - // getCircleImage('play'), - // width: 20.sp, - // ), - // ), - // ) - ], - ), - ), - ], - ), - ), - ), - ], - ), - ); - } - - shareAction(String img, String name, GestureTapCallback onTap) { - return GestureDetector( - onTap: onTap, - child: Container( - child: Column( - children: [ - Image.asset( - getMineImage(img), - width: 40.sp, - ), - SizedBox( - height: 10.sp, - ), - Text( - name, - style: TextStyle(color: Colors.white, fontSize: 12.sp), - ) - ], - ), - ), - ); - } - - _saveLocalImage() async { - RenderRepaintBoundary boundary = - _globalKey.currentContext!.findRenderObject() as RenderRepaintBoundary; - ui.Image image = await boundary.toImage(pixelRatio: ui.window.devicePixelRatio); - ByteData? byteData = - await (image.toByteData(format: ui.ImageByteFormat.png)); - if (byteData != null) { - final result = - await ImageGallerySaver.saveImage(byteData.buffer.asUint8List()); - print(result); - // isSuccess - if (result['isSuccess']) { - showOKToast('保存成功'); - } else { - showOKToast('保存失败,请检查相册权限是否开启'); - } - } - } - - copyInviteText( - String username, - ) { - Clipboard.setData(ClipboardData( - text: '【${username}】邀请你加入“微乐园”,邀请码为${widget.code},点击进入${widget.link!} ' - '这是一款专为各种特色小众圈子爱好者打造的交友平台,资质齐全,安全正规。' - '在这里,能看到很多没听说过的圈子,也能发现很多为数不多的真实情怀,还能见证小众亚文化在生活方式上的新体验。真实、安全、私密、走心,我和很多圈友都在玩哦~')); - showOKToast('您已成功复制分享链接,前往对应平台粘贴发送即可~'); - } - /** - * 分享图片到微信, - * file=本地路径 - * url=网络地址 - * asset=内置在app的资源图片 - * scene=分享场景,1好友会话,2朋友圈,3收藏 - */ - void shareWxData(int scene) async { - - SmartDialog.showLoading(msg:'正在生成分享图片...'); - RenderRepaintBoundary boundary = - _globalKey.currentContext!.findRenderObject() as RenderRepaintBoundary; - ui.Image image = await boundary.toImage(pixelRatio: ui.window.devicePixelRatio); - ByteData? byteData = - await (image.toByteData(format: ui.ImageByteFormat.png)); - String filePath = ''; - if (byteData != null) { - Uint8List pngBytes = byteData!.buffer.asUint8List(); - Directory directory = await getApplicationDocumentsDirectory(); - filePath = '${directory.path}/widget_image.png'; - File imageFile = File(filePath); - imageFile.writeAsBytesSync(pngBytes); - } - SmartDialog.dismiss(); - fluwx.WeChatScene wxScene = fluwx.WeChatScene.SESSION; - if (scene == 2) { - wxScene = fluwx.WeChatScene.TIMELINE; - } - fluwx.WeChatShareImageModel? model; - - if (filePath.isNotEmpty) { - model = fluwx.WeChatShareImageModel(fluwx.WeChatImage.file(File(filePath)), - title: '', description: '', scene: wxScene); - } - if (model != null) { - fluwx.shareToWeChat(model!); - } - - } - - void loadFollowMeData() async { - List stataionList = []; - if (conList.isEmpty) { - stataionList = await loadConverstationListData(); - } - Map typeMap = { - '官方通知':1, - '活动驿站':2, - '会员中心':3, - '资产中心':4, - '乐园圈子':5, - '互动通知':6, - }; - - stataionList.forEach((element) { - if (!typeMap.containsKey(element.nickName ?? '')) { - conList.add(element); - } - }); - - - - if (conList.length < 5) { - var data = await DioManager.instance - .get(url: Api.fansList, params: {'page': 1,'page_size':6}); - var bean = BaseResponse.fromJson( - data, (data) => UserList.fromJson(data)); - if (bean.isSuccess()) { - bean.data.lists.forEach((element) { - bool isContain = false; - conList.forEach((user) { - if (element.user.imId == user.userID!) { - isContain = true; - - } - }); - if (!isContain) { - lists.add(element); - } - }); - } - } - - setState(() { - - }); - } -} diff --git a/circle_app/lib/common/Widgets/follow_me_dialog.dart b/circle_app/lib/common/Widgets/follow_me_dialog.dart deleted file mode 100644 index 10ed3c7..0000000 --- a/circle_app/lib/common/Widgets/follow_me_dialog.dart +++ /dev/null @@ -1,590 +0,0 @@ -import 'dart:convert'; -import 'dart:ui'; - -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:pull_to_refresh/pull_to_refresh.dart'; -import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; - -import '../../app/circle/logic.dart'; -import '../../app/likelist/logic.dart'; -import '../../app/minefragment/logic.dart'; -import '../../app/userinfo/logic.dart'; -import '../../main.dart'; -import '../../network/api.dart'; -import '../../network/dio_manager.dart'; -import '../../router/app_routers.dart'; -import '../../util/util.dart'; -import '../colors/app_color.dart'; -import 'open_vip_tip/view.dart'; - -class FollowMeDialog extends StatefulWidget { - Circle? bean; - UserBean? userInfoBean; - FollowMeDialog({super.key,required this.bean,this.userInfoBean}); - - - @override - _FollowMeDialogState createState() => new _FollowMeDialogState(); - -} - -class _FollowMeDialogState extends State { - // TODO: add state variables and methods - List lists = []; - List conList = []; - bool isMore = true; - int page = 1; - bool isVip = true; - final RefreshController refreshController = RefreshController(); - - - @override - void initState() { - // TODO: implement initState - super.initState(); - - loadMineInfo(); - loadData(); - } - - @override - Widget build(BuildContext context) { - // TODO: add widget build method - - - - return Scaffold( - backgroundColor: Colors.transparent, - body: Column( - children: [ - Container(height: Get.height * 0.33,width: Get.width,), - Expanded( - child: Container( - color: Colors.black, - child: Column( - children: [ - Container( - width: Get.width, - height: 36.sp, - child: Stack( - - alignment: Alignment.center, - children: [ - Text( - '最近聊过和喜欢我的', - style: TextStyle( - fontSize: 18.sp, - color: Colors.white - )), - Positioned( - right: 15.sp, - child: GestureDetector( - onTap: () { - Get.back(); - }, - child: Image.asset( - getCircleImage('close'), - width: 24.sp,), - )) - ], - ), - ), - Expanded(child: Stack( - - children: [ - SmartRefresher( - controller: refreshController, - // onRefresh: _onRefresh, - onLoading: _onLoading, - enablePullDown: false, - enablePullUp: true, - child: ListView.builder( - padding: EdgeInsets.zero, - itemCount: lists.length + conList.length, - itemBuilder: (context, index) { - if (conList.length > index) { - return ConListItem(conList[index], index); - } - return ListItem(lists[index - conList.length], index - conList.length); - }, - ), - - ), - showGd() - ],)) - ], - ), - ), - ) - ], - ), - ); - } - - Widget showGd() { - double interval = 50; - List urlList = []; - - if (lists.length > 3) { - for (int i = 3; i < lists.length; i++) { - if (urlList.length < 3) { - print(lists[i].user.avatar); - urlList.add(lists[i].user.avatar); - } else { - break; - } - } - } - - List widgets = []; - - switch (urlList.length) { - case 0: - widgets.add(Positioned( - left: (Get.width / 2) - 40, - child: circleWidget(""), - )); - break; - case 1: - for (int i = 0; i < urlList.length; i++) { - var element = urlList[i]; -// double xOffset = interval * i + xOffsetBase; - double let = (Get.width / 2) - 60; - if (element == '') { - element = - 'https://i0.wp.com/picjumbo.com/wp-content/uploads/romantic-tropical-beach-with-villa-and-palms-during-beautiful-sunset-free-photo.jpg?w=600&quality=80'; - } - - widgets.add(Positioned( - left: let, - child: circleWidget(element), - )); - } - - widgets.add(Positioned( - left: (Get.width / 2) - 20, - child: circleWidget(""), - )); - break; - case 2: - double xOffsetBase = - (Get.width + interval * urlList.length - 60.0 * urlList.length) * - 0.25; - - for (int i = 0; i < urlList.length; i++) { - var element = urlList[i]; -// double xOffset = interval * i + xOffsetBase; - double let = ((Get.width / 2) - ((40 * urlList.length)) + (i * 40)); - if (element == '') { - element = - 'https://i0.wp.com/picjumbo.com/wp-content/uploads/romantic-tropical-beach-with-villa-and-palms-during-beautiful-sunset-free-photo.jpg?w=600&quality=80'; - } - widgets.add(Positioned( - left: let, - child: circleWidget(element), - )); - } - - double xOffset = interval * urlList.length + xOffsetBase; - widgets.add(Positioned( - left: xOffset, - child: circleWidget(""), - )); - break; - case 3: - // double xOffsetBase = (Get.width + interval * urlList.length - 60.0 * urlList.length) * 0.25; - - for (int i = 0; i < urlList.length; i++) { - switch (i) { - case 0: - if (urlList[i] == '') { - urlList[i] = - 'https://i0.wp.com/picjumbo.com/wp-content/uploads/romantic-tropical-beach-with-villa-and-palms-during-beautiful-sunset-free-photo.jpg?w=600&quality=80'; - } - widgets.add(Positioned( - left: (Get.width / 2) - 100, - child: circleWidget(urlList[i]), - )); - break; - case 1: - if (urlList[i] == '') { - urlList[i] = - 'https://i0.wp.com/picjumbo.com/wp-content/uploads/romantic-tropical-beach-with-villa-and-palms-during-beautiful-sunset-free-photo.jpg?w=600&quality=80'; - } - widgets.add(Positioned( - left: (Get.width / 2) - 60, - child: circleWidget(urlList[i]), - )); - break; - case 2: - if (urlList[i] == '') { - urlList[i] = - 'https://i0.wp.com/picjumbo.com/wp-content/uploads/romantic-tropical-beach-with-villa-and-palms-during-beautiful-sunset-free-photo.jpg?w=600&quality=80'; - } - widgets.add(Positioned( - left: (Get.width / 2) - 20, - child: circleWidget(urlList[i]), - )); - break; - } - } - widgets.add(Positioned( - left: (Get.width / 2) + 20, - child: circleWidget(""), - )); - - break; - } - - return isVip - ? Container() - : Positioned( - bottom: 150, - child: Container( - width: Get.width, - child: Column( - children: [ - SizedBox( - height: 140.sp, - width: Get.width, - child: Stack( - alignment: Alignment.centerLeft, - children: widgets, - ), - ), - Container( - margin: EdgeInsets.only(bottom: 40.sp), - child: Text( - "TA们也喜欢你哦 \n" - "成为会员查看所有圈友信息", - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.white, - fontSize: 15.sp, - ), - ), - ), - GestureDetector( - onTap: () { - showRechargeDialog(); - }, - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: AppColor.mainVerLinearGradient, - ), - padding: EdgeInsets.symmetric( - vertical: 10.sp, - horizontal: 55.sp, - ), - child: Text( - "开通会员查看更多访客", - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - ), - ), - ), - ), - ], - ), - ), - ); - } - - circleWidget(String url, {double width = 80}) { - return GestureDetector( - onTap: () { - // openvi(); - }, - child: Stack( - alignment: Alignment.center, - children: [ - Image.asset( - getCircleImage('more'), - width: width.sp, - height: width.sp, - ), - url != null && url.contains("http") - ? ClipOval( - child: CachedNetworkImage( - imageUrl: url, - width: (width - 1).sp, - height: (width - 1).sp, - fit: BoxFit.cover, - ), - ) - : Text( - url, - style: TextStyle(color: Color(0xffF756FF), fontSize: 12.sp), - ) - ], - )); - } - - Widget ConListItem(V2TimUserFullInfo item, int index) { - return GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - // if (isVip || index < 3) { - if (widget.bean != null) { - sendCircleCustomMsg(item.userID!, jsonEncode(widget.bean!.toJson()), '分享[${widget.bean!.title}]'); - } else { - sendUserHomeCustomMsg(item.userID!, - jsonEncode(widget.userInfoBean!.toJson()), '分享用户[${widget.userInfoBean!.nickname}]的主页'); - } - - // Get.toNamed(AppRoutes.UserInfoActivity, - // arguments: item.user.id.toString()); - // } - }, - child: Container( - margin: EdgeInsets.only(bottom: 21.sp), - child: Row( - children: [ - Stack( - children: [ - ClipOval( - child: CachedNetworkImage( - fit: BoxFit.cover, - imageUrl: item.faceUrl!, - width: 40.sp, - height: 40.sp, - ), - ), - Positioned( - right: 0.sp, - // left: 0.sp, - bottom: 0.sp, - child: Image.asset( - getMsgImage(getGenderContent(item.role!)), - height: 13.sp, - ) - ) - ], - ), - SizedBox(width: 10.sp), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Text( - item.nickName!, - style: TextStyle( - color: Colors.white70, - fontSize: 16.sp, - fontWeight: FontWeight.bold), - ), - // Placeholder image - ], - ), - ], - ), - // Pla - const Spacer(), - - ], - ), - ), - ); - } - - Widget ListItem(UserListItem item, int index) { - return GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - if (widget.bean != null) { - sendCircleCustomMsg('qpqz_dev_0_'+ item.user.id.toString(), jsonEncode(widget.bean!.toJson()), '分享[${widget.bean!.title}]'); - } else { - sendUserHomeCustomMsg('qpqz_dev_0_'+ item.user.id.toString(), - jsonEncode(widget.userInfoBean!.toJson()), '分享用户[${widget.userInfoBean!.nickname}]的主页'); - } - - // if (isVip || index < 3) { - // sendCircleCustomMsg('qpqz_dev_0_'+ item.user.id.toString(), jsonEncode(widget.bean.toJson()), '分享[${widget.bean.title}]'); - // // Get.toNamed(AppRoutes.UserInfoActivity, - // // arguments: item.user.id.toString()); - // } - }, - child: ImageFiltered( - imageFilter: ImageFilter.blur( - sigmaX: (isVip || index < 3) ? 0 : 5, - sigmaY: (isVip || index < 3) ? 0 : 5, - ), - - child: Container( - margin: EdgeInsets.only(bottom: 21.sp), - child: Row( - children: [ - Stack( - children: [ - ClipOval( - child: CachedNetworkImage( - fit: BoxFit.cover, - imageUrl: item.user.avatarThumb, - width: 40.sp, - height: 40.sp, - ), - ), - Positioned( - right: 0.sp, - // left: 0.sp, - bottom: 0.sp, - child: Image.asset( - getMsgImage(getGenderContent(item.user.gender)), - height: 13.sp, - ) - ) - ], - ), - SizedBox(width: 10.sp), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Text( - item.user.nickname, - style: TextStyle( - color: Colors.white70, - fontSize: 16.sp, - fontWeight: FontWeight.bold), - ), - SizedBox(width: 4.sp), - // SizedBox(height: 8.sp), - // _buildInfoRow(item), - // Placeholder image - ], - ), - ], - ), - // Pla - const Spacer(), - - ], - ), - ), - ), - ); - } - - Widget _buildInfoRow(UserListItem userInfoBean) { - String ageMsg = getAgeCOntent( - userInfoBean.user.gender, - userInfoBean.user.age, - userInfoBean.user.role, - userInfoBean.user.orientation); - return Row( - children: [ - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17.sp), - gradient: const LinearGradient( - colors: [ - Color.fromRGBO(141, 255, 248, 1.0), - Color.fromRGBO(181, 211, 255, 1.0), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 2.sp, bottom: 2.sp, left: 10.sp, right: 10.sp), - child: Text( - ageMsg, - style: TextStyle( - color: Colors.black, - fontSize: 10.sp, - ), - ), - ), - SizedBox(width: 6.sp), - ], - ); - } - - _onLoading() { - if (isMore) { - page = page + 1; - loadData(); - } - } - - showRechargeDialog() async { - Get.bottomSheet( - Scaffold( - backgroundColor: Colors.transparent, - body: Open_vip_tipPage(false), - ), - isScrollControlled: true, - enableDrag: false).then((value) { - loadMineInfo(); - }); - } - - void loadData() async { - List stataionList = []; - if (conList.isEmpty) { - stataionList = await loadConverstationListData(); - } - Map typeMap = { - '官方通知':1, - '活动驿站':2, - '会员中心':3, - '资产中心':4, - '乐园圈子':5, - '互动通知':6, - - }; - - stataionList.forEach((element) { - if (!typeMap.containsKey(element.nickName ?? '')) { - conList.add(element); - } - }); - - - var data = await DioManager.instance - .get(url: Api.fansList, params: {'page': page,'page_size':8}); - var bean = BaseResponse.fromJson( - data, (data) => UserList.fromJson(data)); - if (bean.isSuccess()) { - List data = bean.data.lists; - if (data.isNotEmpty) { - data.forEach((element) { - bool isContain = false; - conList.forEach((user) { - if (element.user.imId == user.userID!) { - isContain = true; - - } - }); - if (!isContain) { - lists.add(element); - } - }); - refreshController.loadComplete(); - } else { - isMore = false; - refreshController.loadNoData(); - } - - } - setState(() { - - }); - } - - void loadMineInfo() async { - var data = await DioManager.instance.get(url: Api.getUserMine); - var bean = BaseResponse.fromJson( - data, (data) => MineResponseBean.fromJson(data)); - if (bean.isSuccess()) { - isVip = true; - } - } -} diff --git a/circle_app/lib/common/Widgets/genderview.dart b/circle_app/lib/common/Widgets/genderview.dart deleted file mode 100644 index 2a035d9..0000000 --- a/circle_app/lib/common/Widgets/genderview.dart +++ /dev/null @@ -1,186 +0,0 @@ -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; - - -Widget getGender(String name) { - if (name == "CD") { - return getCd(); - } else if (name == "MTF") { - return getMTF(); - } - else if(name == "Queer"){ - return getQueer(); - } - else if(name == "FTM"){ - return getFTM(); - } - else if(name == "直男"||name == "男"){ - return getZN(); - } - else if(name == "真女"||name == "女"){ - return getNV(); - }else{ - return getCd(); - } -} -Color getGenderColor(String name){ - if (name == "CD") { - return cd; - } else if (name == "MTF") { - return mtf; - } - else if(name == "Queer"){ - return queer; - } - else if(name == "FTM"){ - return ftm; - } - else if(name == "直男"||name == "男"){ - return nan; - } - else if(name == "真女"||name == "女"){ - return nv; - }else{ - return cd; - } -} - -Color cd = const Color(0xFFF7FAFA); -Color mtf = const Color(0xFFFAA5B8); -Color queer = const Color(0xFF876FE7); -Color ftm = const Color(0xFF42C6FF); -Color nan = const Color(0xFF3994FF); -Color nv = const Color(0xFFFC65ED); - -Widget getCd() { - return Container( - padding: EdgeInsets.only(left: 3.sp, right: 3.sp, top: 3.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(22), - color: const Color(0xFFF7FAFA), - - // border: Border.all( - // color: logic.wantKnowData[index].isSelect ? const Color(0xFFCE51FF) : const Color(0x1AFFFFFF), - // ), - ), - margin: EdgeInsets.only(left: 10.0.sp), - child: Text( - "CD", - style: TextStyle( - color: const Color(0xFF898F99), - fontSize: 12.0.sp, - ), - ), - ); -} - -Widget getMTF() { - return Container( - padding: EdgeInsets.only(left: 3.sp, right: 3.sp, top: 3.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(22), - color: const Color(0xFFFAA5B8), - - // border: Border.all( - // color: logic.wantKnowData[index].isSelect ? const Color(0xFFCE51FF) : const Color(0x1AFFFFFF), - // ), - ), - margin: EdgeInsets.only(left: 10.0.sp), - child: Text( - "MTF", - style: TextStyle( - color: const Color(0xFFF7FAFA), - fontSize: 12.0.sp, - ), - ), - ); -} - -Widget getQueer() { - return Container( - padding: EdgeInsets.only(left: 3.sp, right: 3.sp, top: 3.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(22), - color: const Color(0xFF876FE7), - - // border: Border.all( - // color: logic.wantKnowData[index].isSelect ? const Color(0xFFCE51FF) : const Color(0x1AFFFFFF), - // ), - ), - margin: EdgeInsets.only(left: 10.0.sp), - child: Text( - "Queer", - style: TextStyle( - color: const Color(0xFFF7FAFA), - fontSize: 12.0.sp, - ), - ), - ); -} - -Widget getFTM() { - return Container( - padding: EdgeInsets.only(left: 3.sp, right: 3.sp, top: 3.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(22), - color: const Color(0xFF42C6FF), - - // border: Border.all( - // color: logic.wantKnowData[index].isSelect ? const Color(0xFFCE51FF) : const Color(0x1AFFFFFF), - // ), - ), - margin: EdgeInsets.only(left: 10.0.sp), - child: Text( - "FTM", - style: TextStyle( - color: const Color(0xFFF7FAFA), - fontSize: 12.0.sp, - ), - ), - ); -} - -Widget getZN() { - return Container( - padding: EdgeInsets.only(left: 3.sp, right: 3.sp, top: 3.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(22), - color: const Color(0xFF3994FF), - - // border: Border.all( - // color: logic.wantKnowData[index].isSelect ? const Color(0xFFCE51FF) : const Color(0x1AFFFFFF), - // ), - ), - margin: EdgeInsets.only(left: 10.0.sp), - child: Text( - "男", - style: TextStyle( - color: const Color(0xFFF7FAFA), - fontSize: 12.0.sp, - ), - ), - ); -} - -Widget getNV() { - return Container( - padding: EdgeInsets.only(left: 3.sp, right: 3.sp, top: 3.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(22), - color: const Color(0xFFFC65ED), - - // border: Border.all( - // color: logic.wantKnowData[index].isSelect ? const Color(0xFFCE51FF) : const Color(0x1AFFFFFF), - // ), - ), - margin: EdgeInsets.only(left: 10.0.sp), - child: Text( - "女", - style: TextStyle( - color: const Color(0xFFF7FAFA), - fontSize: 12.0.sp, - ), - ), - ); -} \ No newline at end of file diff --git a/circle_app/lib/common/Widgets/open_vip_tip/logic.dart b/circle_app/lib/common/Widgets/open_vip_tip/logic.dart deleted file mode 100644 index d0d68e9..0000000 --- a/circle_app/lib/common/Widgets/open_vip_tip/logic.dart +++ /dev/null @@ -1,244 +0,0 @@ - -import 'package:circle_app/util/util.dart'; -import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; -import 'package:get/get.dart'; - -import '../../../app/minefragment/logic.dart'; -import '../../../network/api.dart'; -import '../../../network/dio_manager.dart'; -import '../../../util/PaymentUtils.dart'; -import '../../../util/SharedPreferencesHelper.dart'; -import '../../../util/eventBus.dart'; -import 'state.dart'; - -class Open_vip_tipLogic extends GetxController { - List priceBean = []; - bool isZfbPrice = true; - bool isYean = false; - - bool isShowInviteTip = false; - bool isVip = false; - - @override - void onInit() { - super.onInit(); - } - getMode() async { - var data = await DioManager.instance.get(url: Api.getUserMine); - var bean = BaseResponse.fromJson( - data, (data) => MineResponseBean.fromJson(data)); - if (bean.isSuccess()) { - if(bean.data.user.vip>0){ - isVip = true; - } else if (bean.data.last_vip_expire_date != '') { - isVip = true; - } - - }} - - loadData() async { - var data = await DioManager.instance.get(url: Api.getVipPrice, params: {}); - var vipPriceList = BaseResponse>.fromJson( - data, - (data) => - List.from(data.map((item) => PriceBean.fromJson(item))), - ); - priceBean = vipPriceList.data; - if (isYean) { - setYean(); - } - update(); - } - - isShowInvite() async { - var data = await DioManager.instance.get(url: Api.showInvite, params: {}); - isShowInviteTip = data['data'] ?? false; - update(); - } - - setYean() { - isYean = true; - if (priceBean.length > 0) { - for (var value in priceBean) { - if (value.isYearVip) { - index = priceBean.indexOf(value); - } - } - } - update(); - } - - int index = 2; - final Open_vip_tipState state = Open_vip_tipState(); - - startPayment() async { - SmartDialog.showLoading(); - if (isZfbPrice) { - var data = await DioManager.instance.post( - url: Api.postAliPayOrder, - params: {"product_id": priceBean[index].id, "type": 2}); - var bean = BaseResponse.fromJson( - data, (data) => PayUrlBean.fromJson(data)); - if (bean.isSuccess()) { - openAliPay(bean.data.payUrl, (isSuccess, errorMsg) { - if (isSuccess) { - // 处理支付成功 - refreshVipStatus(); - - } else { - // 处理支付失败,errorMessage 可能为 null - refreshVipStatus(); - } - }); - } else { - showOKToast(bean.msg); - } - } else { - var data = await DioManager.instance.post( - url: Api.postWxOrder, - params: {"product_id": priceBean[index].id, "type": 2}); - var bean = BaseResponse.fromJson( - data, (data) => PaymentData.fromJson(data)); - if (bean.isSuccess()) { - openWxPay(bean.data, (bool isSuccess, String? errorMessage) { - if (isSuccess) { - // 处理支付成功 - refreshVipStatus(); - } else { - // 处理支付失败,errorMessage 可能为 null - } - }); - } else { - showOKToast(bean.msg); - } - } - SmartDialog.dismiss(); - } - - - refreshVipStatus()async{ - var data = await DioManager.instance.get(url: Api.getVipStatus); - var bean = BaseResponse.fromJson( - data, (data) => VipInfo.fromJson(data)); - if(bean.isSuccess()){ - SharedPreferencesHelper.getInstance().then((sharedPreferences) { - sharedPreferences.setInt(SharedPreferencesHelper.VIP,bean.data.vipLevel); - EventBusManager.fire(CommentVipEvent(bean.data.vipLevel)); - Get.back(); - }); - } - - - } -} - -class PayUrlBean { - String payUrl; - - PayUrlBean({ - required this.payUrl, - }); - - factory PayUrlBean.fromJson(Map json) { - return PayUrlBean( - payUrl: json['pay_url'], - ); - } -} - -class PaymentData { - String appId; - String mchId; - String nonceStr; - String sign; - String prepayId; - String packageX; - String timestamp; - - PaymentData({ - required this.appId, - required this.mchId, - required this.nonceStr, - required this.sign, - required this.prepayId, - required this.packageX, - required this.timestamp, - }); - - factory PaymentData.fromJson(Map json) { - return PaymentData( - appId: json['appid'], - mchId: json['mchId'], - nonceStr: json['nonceStr'], - sign: json['sign'], - prepayId: json['prepayId'], - packageX: json['packageX'], - timestamp: json['timestamp'], - ); - } -} - -class PriceBean { - int id; - int firstPresentBean; - String title; - double amount; - double oldAmount; - bool isYearVip; - String iosItem; - String amountText; - - PriceBean({ - required this.id, - required this.firstPresentBean, - required this.title, - required this.amount, - required this.oldAmount, - required this.isYearVip, - required this.iosItem, - required this.amountText, - }); - - factory PriceBean.fromJson(Map json) { - return PriceBean( - id: json['id'] as int, - firstPresentBean: json['firstPresentBean'] ?? 0, - title: json['title'] as String, - amount: json['amount'] as double, - amountText :json['amount_text'] as String, - oldAmount: json['old_amount'] as double, - isYearVip: json['is_year_vip'] as bool, - iosItem: json['ios_item'] as String, - ); - } -} - -class VipInfo { - int? vipLevel; - String? expireDate; - int? expireDays; - - VipInfo({ - this.vipLevel, - this.expireDate, - this.expireDays, - }); - - factory VipInfo.fromJson(Map json) { - return VipInfo( - vipLevel: json['vip'] as int, - expireDate: json['vip_expire_date'] as String, - expireDays: json['vip_expire_days'] as int, - ); - } - - Map toJson() { - final Map data = {}; - data['vip'] = vipLevel; - data['vip_expire_date'] = expireDate; - data['vip_expire_days'] = expireDays; - return data; - } -} - - diff --git a/circle_app/lib/common/Widgets/open_vip_tip/state.dart b/circle_app/lib/common/Widgets/open_vip_tip/state.dart deleted file mode 100644 index afe545e..0000000 --- a/circle_app/lib/common/Widgets/open_vip_tip/state.dart +++ /dev/null @@ -1,5 +0,0 @@ -class Open_vip_tipState { - Open_vip_tipState() { - ///Initialize variables - } -} diff --git a/circle_app/lib/common/Widgets/open_vip_tip/view.dart b/circle_app/lib/common/Widgets/open_vip_tip/view.dart deleted file mode 100644 index d3f4c5e..0000000 --- a/circle_app/lib/common/Widgets/open_vip_tip/view.dart +++ /dev/null @@ -1,480 +0,0 @@ -import 'dart:io'; - -import 'package:circle_app/app/minefragment/logic.dart'; -import 'package:circle_app/util/paymentUtil.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:flutter_swiper/flutter_swiper.dart'; -import 'package:get/get.dart'; - -import '../../../network/api.dart'; -import '../../../network/dio_manager.dart'; -import '../../../router/app_routers.dart'; -import '../../../util/eventBus.dart'; -import '../../colors/app_color.dart'; -import 'logic.dart'; - -class Open_vip_tipPage extends StatefulWidget { - final bool isYean; - - Open_vip_tipPage(this.isYean, {Key? key}) : super(key: key); - - @override - State createState() => _Open_vip_tipPageState(); -} - -class _Open_vip_tipPageState extends State { - final logic = Get.put(Open_vip_tipLogic()); - - final state = Get.find().state; - - Map vipImgMap = { - "身份标识" : 'vip_fun_1', - "专属客服": 'vip_fun_2', - "无限畅聊": 'vip_fun_3', - "至尊喊话": 'vip_fun_4', - "图片私聊": 'vip_fun_5', - "视频私聊": 'vip_fun_6', - "看谁喜欢你": 'vip_fun_7', - "看谁看过你": 'vip_fun_8', - "缘分匹配": 'vip_fun_9', - "取向筛选": 'vip_fun_10', - "角色筛选": 'vip_fun_11', - "查看附近": 'vip_fun_12', - "排序靠前": 'vip_fun_13', - "权重提升": 'vip_fun_14', - }; - - @override - void initState() { - // TODO: implement initState - super.initState(); - logic.loadData(); - logic.getMode(); - logic.isShowInvite(); - } - - @override - Widget build(BuildContext context) { - List vipFuncList = [ - "至尊喊话", - '权重提升', - '取向筛选', - '排序靠前', - '查看附近', - '角色筛选', - "身份标识", - "专属客服", - "无限畅聊", - - "图片私聊", - "视频私聊", - "看谁喜欢你", - "看谁看过你", - "缘分匹配" - ]; - // 权重提升- - // 取向筛选- - // 排序靠前- - // 查看附近- - // 角色筛选- - - - - List vipDescList = [ - "发布的喊话在圈内凸显", - '年会员权重直接提升数倍', - '可以精准筛选符合您取向的TA', - '在各个列表的排序都可以靠前', - '可以无限查看并私聊附近圈友', - '可以精准筛选您喜欢的角色', - '会员专属,更显尊贵', - "给您更加贴心的服务", - "可以随心所欲畅聊", - "聊天可以一直使用图片", - "聊天可以一直使用视频", - "看到所有喜欢你的人", - "看到所有看过你的人", - "为您匹配更合适的人" - ]; - // for (int i = 1; i < 10; i++) { - // - // } - if(widget.isYean){ - logic.setYean(); - } - return GetBuilder(builder: (Open_vip_tipLogic controller) { - - return Scaffold( - backgroundColor: Colors.transparent, - body: SizedBox( - width: Get.width, - height: Get.height, - child: Center( - child: Container( - width: 339.sp, - height: (Platform.isAndroid ? 483.sp : 440.sp) + (logic.isShowInviteTip ? 30.sp : 0.sp), - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.fill, - image: AssetImage(getCircleImage('open_vip_bg')))), - child: Stack( - alignment: Alignment.center, - children: [ - Positioned( - top: 5.sp, - right: 12.sp, - child: GestureDetector( - onTap: () { - // EventBusManager.fire(CommentVipEvent(1)); - Get.back(); - }, - child: Image.asset( - getCircleImage('close'), - width: 24.sp, - ), - )), - Positioned( - top: 24.sp, - child: Text( - '十几种专属会员特权', - style: TextStyle(color: Colors.white, fontSize: 16.sp), - )), - Positioned( - top: 44.sp, - child: SizedBox( - width: Get.width, - height: 180.sp, - child: Swiper( - itemCount: vipFuncList.length, - itemBuilder: (BuildContext context, int index) { - return funcItem(vipFuncList[index], - vipDescList[index], index + 1); - }, - loop: true, - autoplay: true, - pagination: SwiperPagination( - builder: DotSwiperPaginationBuilder( - color: const Color(0x99FFFFFF), - size: 4.sp, - activeColor: const Color(0xFF00FFD2), - activeSize: 4.sp)), //如果不填则不显示指示点 - ), - )), - Positioned( - top: 227.sp, - child: controller.priceBean.isEmpty - ? Container() - : Container( - width: 339.sp, - padding: - EdgeInsets.only(left: 17.sp, right: 17.sp), - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - typeItem( - controller, controller.index == 0, 0,controller.priceBean[0].firstPresentBean), - typeItem( - controller, controller.index == 1, 1,controller.priceBean[1].firstPresentBean), - typeItem( - controller, controller.index == 2, 2,controller.priceBean[2].firstPresentBean), - ], - ))), - Platform.isIOS ? Container(): Positioned( - bottom: 108.sp + (logic.isShowInviteTip ? 30.sp : 0.sp), - child: Container( - margin: EdgeInsets.only(top: 24.0.sp), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - onTap: () { - // 处理支付宝支付逻辑 - controller.isZfbPrice = true; - controller.update(); - }, - child: Row( - children: [ - Image.asset( - controller.isZfbPrice? - getMineImage("icon_pay_select"): getMineImage("icon_pay_is_no_select"), - width: 20.0.sp, - height: 20.0.sp, - ), - SizedBox(width: 8.0.sp), - Image.asset( - getMineImage('icon_cooperate_ali'), - width: 20.0.sp, - height: 20.0.sp, - ), - SizedBox(width: 4.0.sp), - Text( - '支付宝支付', - style: TextStyle( - color: const Color(0xFFF7FAFA), - fontSize: 14.0.sp, - ), - ), - SizedBox(width: 4.0.sp), - Image.asset( - getMineImage('icon_recommend_pay_way'), - width: 32.0.sp, - height: 16.0.sp, - ), - ], - ), - ), - SizedBox(width: 24.0.sp), - GestureDetector( - onTap: () { - controller.isZfbPrice = false; - controller.update(); - }, - child: Row( - children: [ - Image.asset( - !controller.isZfbPrice? - getMineImage("icon_pay_select"): getMineImage("icon_pay_is_no_select"), - width: 20.0.sp, - height: 20.0.sp, - ), - SizedBox(width: 8.0.sp), - Image.asset( - getMineImage('icon_cooperate_wx'), - width: 20.0.sp, - height: 20.0.sp, - ), - SizedBox(width: 4.0.sp), - Text( - '微信支付', - style: TextStyle( - color: const Color(0xFFF7FAFA), - fontSize: 14.0.sp, - ), - ), - ], - ), - ), - ], - ), - )), - Positioned( - bottom: 48.sp + (logic.isShowInviteTip ? 30.sp : 0.sp), - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: (){ - if( Platform.isIOS){ - IOSPayment.instance.iosPay(controller.priceBean[controller.index].iosItem,controller.priceBean[controller.index].id.toString(), 2); - }else{ - controller.startPayment(); - } - }, - child: Container( - width: 168.sp, - height: 42.sp, - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(21.sp), - gradient: const LinearGradient( - begin: Alignment.centerLeft, - end: Alignment.centerRight, - colors: [ - Color(0xff0AFCFF), - Color(0xffD739EA) - ])), - child: Text( - logic.isVip ? '续费特权' : '领取特权', - style: - TextStyle(color: Colors.white, fontSize: 16.sp), - ), - ),)), - Positioned( - bottom: 17.sp + (logic.isShowInviteTip ? 30.sp : 0.sp), - child: Row( - children: [ - Text( - '点击加入即表示同意', - style: TextStyle( - color: Colors.white, - fontSize: 11.sp, - fontWeight: FontWeight.w600), - ), - SizedBox( - width: 2.sp, - ), - GestureDetector( - onTap: (){ - navigateToPartnerAgreement(); - }, - child: Text( - '《会员协议》', - style: TextStyle( - color: const Color(0xff00FFF4), - fontSize: 11.sp, - fontWeight: FontWeight.w400, - ), - ), - ), - ], - )), - if (logic.isShowInviteTip ) - Positioned( - bottom: 17.sp , - child: Row( - children: [ - Text( - '可通过邀请免费成为会员,点击进入', - style: TextStyle( - color: Colors.white, - fontSize: 11.sp, - fontWeight: FontWeight.w600), - ), - SizedBox( - width: 2.sp, - ), - GestureDetector( - onTap: (){ - Get.toNamed(AppRoutes.Invite); - }, - child: Text( - '邀请赚钱', - style: TextStyle( - color: const Color(0xff00FFF4), - fontSize: 11.sp, - fontWeight: FontWeight.w400, - ), - ), - ), - ], - )) - ], - ), - ), - ), - ), - ); - }); - } - - typeItem(Open_vip_tipLogic controller, bool isSelected, int index,int count) { - //double pricePerDay = controller.priceBean[index].amount / 30; - // String formattedPricePerDay = '${pricePerDay.toStringAsFixed(2)}元/天'; - return GestureDetector( - onTap: () { - if(!widget.isYean){ - controller.index = index; - controller.update(); - }else{ - showOKToast("只有年会员才可使用该功能哦~"); - } - - }, - child: Stack( - alignment: Alignment.center, - children: [ - isSelected - ? Image.asset( - getCircleImage('selected'), - width: 98.sp, - height: 110.sp, - fit: BoxFit.fill, - ) - : Container(), - Container( - width: isSelected ? 96.sp : 98.sp, - height: isSelected ? 108.sp : 110.sp, - decoration: BoxDecoration( - color: const Color.fromRGBO(255, 255, 255, 0.1), - borderRadius: BorderRadius.circular(10.sp), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - SizedBox(height: 0.1.sp,), - Text( - controller.priceBean[index].title, - style: TextStyle(color: Colors.white, fontSize: 14.sp), - ), - Text( - controller.priceBean[index].amountText.toString(), - style: TextStyle(color: Colors.white, fontSize: 14.sp), - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - '${controller.priceBean[index].amount.toInt()}', - style: TextStyle(color: Colors.white, fontSize: 14.sp), - ), - SizedBox( - width: 4.sp, - ), - Text( - "${controller.priceBean[index].oldAmount.toInt()}元", - style: TextStyle( - color: Colors.white70, - fontSize: 10.sp, - decoration: TextDecoration.lineThrough, - decorationColor: Colors.white70, - ), - ), - ], - ) - ], - ), - ), - // controller.priceBean[index].isYearVip ? Positioned( - // top: 0.sp, - // left: 0.sp, - // width: 44.sp, - // height: 18.sp, - // child: Image.asset(getMineImage("icon_yean_vip")), - // ) :Container(), - if (count > 0) - Positioned( - top: 0.sp,left: 0.sp, - child: Container( - height: 20.sp, - alignment: Alignment.center, - padding: EdgeInsets.only(left: 3.sp,right: 3.sp), - decoration: BoxDecoration( - color: AppColor.bgColor.withOpacity(0.6), - borderRadius: BorderRadius.circular(4.sp) - ), - child: Text('送${count}小票',style: TextStyle(color: Colors.white,fontSize: 12.sp,fontWeight: FontWeight.bold),),)) - ], - )); - } - - funcItem(String func, String funcDesc, int index) { - return Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset( - getBaseImage(vipImgMap[func]!), - width: 70.sp, - ), - SizedBox( - height: 14.sp, - ), - Text( - func, - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - fontWeight: FontWeight.w500), - ), - SizedBox( - height: 4.sp, - ), - Text(funcDesc, - style: TextStyle( - color: Colors.white, - fontSize: 12.sp, - )) - ], - ); - } -} diff --git a/circle_app/lib/common/Widgets/rich_text.dart b/circle_app/lib/common/Widgets/rich_text.dart deleted file mode 100644 index fee61f2..0000000 --- a/circle_app/lib/common/Widgets/rich_text.dart +++ /dev/null @@ -1,71 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; - -///searchContent 输入的搜索内容 -///textContent 需要显示的文字内容 -///frontContent 需要另外添加在最前面的文字 -///fontSize 需要显示的字体大小 -///fontColor 需要显示的正常字体颜色 -///selectFontColor 需要显示的搜索字体颜色 -List getTextSpanList(String textContent,Color selectFontColor,fontSize, - {String searchContent = '', - String frontContent = '', - Color fontColor = Colors.white, - }) { - List textSpanList = []; - - if (frontContent.isEmpty == false) { - textSpanList.add(TextSpan( - text: frontContent, - style: TextStyle(fontSize: fontSize, color: fontColor))); - } - - ///搜索内容不为空并且 显示内容中存在与搜索内容相同的文字 - if (searchContent != null && - searchContent.isEmpty == false && - textContent.contains(searchContent)) { - List _strMapList = []; - bool _isContains = true; - while (_isContains) { - int startIndex = textContent.indexOf(searchContent); - String showStr = - textContent.substring(startIndex, startIndex + searchContent.length); - Map _strMap; - if (startIndex > 0) { - String normalStr = textContent.substring(0, startIndex); - _strMap = Map(); - _strMap['content'] = normalStr; - _strMap['isHighlight'] = false; - _strMapList.add(_strMap); - } - _strMap = Map(); - _strMap['content'] = showStr; - _strMap['isHighlight'] = true; - _strMapList.add(_strMap); - textContent = textContent.substring( - startIndex + searchContent.length, textContent.length); - - _isContains = textContent.contains(searchContent); - if (!_isContains && textContent != '') { - _strMap = Map(); - _strMap['content'] = textContent; - _strMap['isHighlight'] = false; - _strMapList.add(_strMap); - } - } - _strMapList.forEach((map) { - textSpanList.add(TextSpan( - text: map['content'], - style: TextStyle( - fontSize: fontSize, - color: map['isHighlight'] ? selectFontColor : fontColor))); - }); - } else { - ///正常显示所有文字 - textSpanList.add(TextSpan( - text: textContent, - style: TextStyle(fontSize: fontSize, color: fontColor), - )); - } - return textSpanList; -} diff --git a/circle_app/lib/common/Widgets/tag_widget.dart b/circle_app/lib/common/Widgets/tag_widget.dart deleted file mode 100644 index 41f093c..0000000 --- a/circle_app/lib/common/Widgets/tag_widget.dart +++ /dev/null @@ -1,41 +0,0 @@ -import 'package:circle_app/common/colors/app_color.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; - -import '../../router/app_routers.dart'; - -class UserTagWidget extends StatelessWidget { - int type; - // TODO: add state variables, methods and constructor params - UserTagWidget(this.type); - // NON(0, "null或0无标识"), - // BACKER(1, "金主"), - // GOOD(2, "Good"), - // YEAR_PARTNER(3, "年合伙人"), - // PARTNER(4, "合伙人"), - // NEW_USER(5, "新人"), -List tagList = '""、金主、Good、年VIP、VIP、新人'.split('、'); - @override - Widget build(BuildContext context) { - // TODO: add widget build method - if (type == 0 || type >= tagList.length + 1) { - return Container(); - } - return GestureDetector( - onTap: () { - }, - child: Container( - alignment: Alignment.center, - height: 18.sp, - padding: EdgeInsets.only(left: 8.sp,right: 8.sp), - decoration: BoxDecoration( - gradient: AppColor.tagVerLinearGradient, - borderRadius: BorderRadius.circular(9.sp) - ), - child: Text(tagList[type],style: TextStyle(color: Colors.white,fontWeight: FontWeight.bold,fontSize: 11.sp),), - ), - ); - } - -} diff --git a/circle_app/lib/common/Widgets/text_more.dart b/circle_app/lib/common/Widgets/text_more.dart deleted file mode 100644 index 8541735..0000000 --- a/circle_app/lib/common/Widgets/text_more.dart +++ /dev/null @@ -1,99 +0,0 @@ -import 'package:flutter/gestures.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; - -///文字超出一定行,自动隐藏,并添加入"...查看更多详情"为它设置点击事件 -class HideText extends StatefulWidget { - - HideText({ - required this.text, //正常字 - required this.style, //正常字样式 - required this.additionText, //附加字,如点击查看更多 - this.additionStyle, //附加字的样式 - this.maxLines = 3, //行数,不传 默认为3 - required this.maxWidth, - this.additionUrl, //点击附加字跳转URL - this.additionParams, - this.onTap,//点击附加字跳转时携带的参数 - }) : assert(text != null), - assert(additionText != null); - final String text; - final TextStyle style; - final String? additionText; - final TextStyle? additionStyle; - final int? maxLines; - final double maxWidth; - final String? additionUrl; - GestureTapCallback? onTap; - final Map? additionParams; - @override - _HideTextState createState() => _HideTextState(); -} - -class _HideTextState extends State { - @override - Widget build(BuildContext context) { - return Container( - // padding: const EdgeInsets.only(top: 10), - child: _textPaint([TextSpan(text: widget.text, style : widget.style)]).didExceedMaxLines ? RichText( - text: TextSpan( - children: [ - TextSpan( - text: "${widget.text.substring(0, _fontNum())}", - style: widget.style, - ), - TextSpan( - children: [ - TextSpan(text: "...", style: widget.style), - TextSpan(text: "${widget.additionText}", style: widget.additionStyle,recognizer: TapGestureRecognizer() - ..onTap = - widget.onTap - // if(isNotBlank(widget.additionUrl)) { - // FlutterBoost.singleton.open(widget.additionUrl); - // }additionUrl - ) - ], - - ) - ] - ), - ) : Container( //未超出指定行数的话全部显示 - child: Text( - widget.text, - style: widget.style, - ), - ), - ); - } - - TextPainter _textPaint(List children){ - return TextPainter( - maxLines: widget.maxLines, - text: TextSpan( - children: children - ), - textDirection: TextDirection.ltr) - ..layout(maxWidth: widget.maxWidth); //若新功能宽度不一致,可尝试修改, - //UIUtils.screenWidth(context)是自定义的获取屏幕宽度的方法 - } - - int _fontNum(){ //计算最多可容纳正常字的数目,可优化 - int num = 0; - int skip = 1; - while(true){ - bool isExceed = widget.text.length < num + skip || _textPaint([TextSpan(text: widget.text.substring(0, num + skip) + "...", style: widget.style), - TextSpan(text: widget.additionText, style: widget.additionStyle)]).didExceedMaxLines; - if(!isExceed) { - num = num + skip; - skip *= 2; - continue; - } - if(isExceed && skip == 1){ - return num; - } - skip = skip ~/ 2; - } - } -} - diff --git a/circle_app/lib/common/Widgets/today_people_dialog.dart b/circle_app/lib/common/Widgets/today_people_dialog.dart deleted file mode 100644 index 723ee71..0000000 --- a/circle_app/lib/common/Widgets/today_people_dialog.dart +++ /dev/null @@ -1,735 +0,0 @@ -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:gradient_borders/gradient_borders.dart'; - -import '../../app/circle/widgets/discover.dart'; -import '../../app/userinfo/logic.dart'; -import '../../network/api.dart'; -import '../../network/dio_manager.dart'; -import '../../router/app_routers.dart'; -import '../../util/SharedPreferencesHelper.dart'; -import '../../util/util.dart'; -import '../colors/app_color.dart'; -import 'dart:math' as math; - -class TodayPeopleDialog extends StatefulWidget { - bool isShow; - TodayPeopleDialog({super.key, this.isShow = false}); - - @override - _TodayPeopleDialogState createState() => new _TodayPeopleDialogState(); -} - -class _TodayPeopleDialogState extends State { - // TODO: add state variables and methods - var recommendCircleFriendData = {}; - List chatImIdList = []; - - bool isLoad = true; - List imgList = []; - @override - void initState() { - // TODO: implement initState - super.initState(); - fetchMyAlbum(Api.getMyAlbum); - // loadRecommendCircleFriendData(); - } - - - Future fetchMyAlbum(String url) async { - var myAlbumData = await DioManager.instance.get(url: url); - var myAlbumBean = BaseResponse.fromJson( - myAlbumData, (myAlbumData) => AlbumResponseBean.fromJson(myAlbumData)); - - if (myAlbumBean.isSuccess()) { - imgList.addAll(myAlbumBean.data.lists); - } - loadRecommendCircleFriendData(); - } - - - - - void loadRecommendCircleFriendData() async { - var data = await DioManager.instance.get( - url: Api.chatRecommendFriend, - ); - - if (data['code'] == 200) { - SharedPreferencesHelper sp = await SharedPreferencesHelper.getInstance(); - if (await sp.isShowMatch() && imgList.isEmpty) { - showOKToast('上传真实头像和形象照后更容易匹配到想认识的人哦~'); - } - isLoad = false; - List dataList = data['data']; - if (dataList.isNotEmpty) { - recommendCircleFriendData = data['data'][0]; - if (mounted) { - setState(() {}); - } - } else { - Get.back(); - } - } else { - if (widget.isShow) { - showOKToast(data['msg']); - Get.back(); - if (data['code'] == 21201 || data['code'] == 21202) { - showVipDialog(); - } - } else { - Get.back(); - } - } - } - - itemWidget() { - var info = {}; - - // 对方喜欢了你100 - // ·你们有共同喜欢的圈友90 - // ·你喜欢的圈友也喜欢TA80 - // ·你们都在深圳留下过足迹70 - // ·你们有2个共同的圈子:圈子名称、圈子名称60 - // ·可能是你想认识的人50 - // ·很多圈友都喜欢TA40 - // ·TA是乐园优秀圈主哦~30 - - var titleList = []; - var user = Users.fromJson(recommendCircleFriendData['user']); - try { - if (recommendCircleFriendData['is_follow_me']) { - titleList.add('对方喜欢了你'); - } else if (recommendCircleFriendData['has_both_friend']) { - titleList.add('你们有共同喜欢的圈友'); - } else if (recommendCircleFriendData['has_friend_follow_to']) { - titleList.add('你喜欢的圈友也喜欢TA'); - } - if (titleList.length < 3) { - List citys = recommendCircleFriendData['both_cities']; - if (citys.isNotEmpty) { - titleList.add('你们都在${citys.first}留下过足迹'); - } - } - if (titleList.length < 3) { - List circles = recommendCircleFriendData['both_interests']; - if (circles.isNotEmpty) { - List both_interests = - recommendCircleFriendData['both_interests']; - List circleList = []; - both_interests.forEach((element) { - circleList.add(element['title']); - }); - if (circleList.isNotEmpty) { - titleList - .add('你们有${circleList.length}个共同的圈子:${circleList.join('、')}'); - } - } - } - - if (titleList.length < 3) { - if (recommendCircleFriendData.containsKey('is_new_user')) { - titleList.add('我刚来到这里哦'); - } - } - - if (titleList.length < 3) { - if (recommendCircleFriendData['is_wanna_meet']) { - titleList.add('很多圈友都喜欢TA'); - } - } - - if (titleList.length < 3) { - if (recommendCircleFriendData['is_most_fans']) { - titleList.add('可能是你想认识的人'); - } - } - - if (titleList.length < 3) { - if (recommendCircleFriendData['is_excellent_qz_leader']) { - titleList.add('TA是乐园优秀圈主哦~'); - } - } - - if (titleList.length >= 1) { - info['city'] = titleList.first; - } - - if (titleList.length >= 2) { - info['both_interests'] = titleList[1]; - } - - if (titleList.length >= 3) { - info['desc'] = titleList[2]; - } - } catch (e) { - loadRecommendCircleFriendData(); - return Container(); - } - - List circleList = recommendCircleFriendData['interests']; - return Container( - width: Get.width, - // constraints: BoxConstraints(maxHeight: 230.sp), - decoration: BoxDecoration( - gradient: - LinearGradient(colors: [Color(0xFF4C3E5F), Color(0xFF324140)]), - borderRadius: BorderRadius.circular(8.sp), - border: GradientBoxBorder( - gradient: AppColor.mainVerLinearGradient, - width: 1.sp, - ), - ), - padding: EdgeInsets.only(left: 12.sp, right: 12.sp, top: 10.sp), - child: Column( - children: [ - GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.UserInfoActivity, - arguments: - recommendCircleFriendData['user']['id'].toString()); - }, - child: Container( - child: Row( - children: [ - ClipOval( - child: Image.network( - recommendCircleFriendData['user']['avatar'], - width: 50.sp, - height: 50.sp, - fit: BoxFit.cover, - ), - ), - SizedBox( - width: 6.sp, - ), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Text( - user.nickname ?? '', - style: TextStyle( - fontSize: 16.sp, - color: Color(0XFFF7FAFA), - fontWeight: FontWeight.bold), - ), - SizedBox( - width: 4.sp, - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - ShaderMask( - shaderCallback: (Rect bounds) { - return const LinearGradient( - begin: Alignment.centerRight, - end: Alignment.centerLeft, - colors: [ - Color(0xff71F3F2), - Color(0xffF657FF) - ], - ).createShader(Offset.zero & bounds.size); - }, - child: Text( - '匹配度' + - (recommendCircleFriendData[ - 'recommend_score'] - .toString() ?? - '') + - '%', - style: TextStyle( - fontSize: 14.sp, - fontWeight: FontWeight.w600, - color: Colors.white), - ), - ), - ], - ) - ], - ), - SizedBox( - height: 4.sp, - ), - Row( - children: [ - Container( - alignment: Alignment.center, - height: 18.sp, - padding: EdgeInsets.only(left: 6.sp, right: 6.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(9.sp), - gradient: const LinearGradient( - begin: Alignment(0.25, 0.5), - end: Alignment(0.75, 0.5), - colors: [ - Color(0xff8DFFF8), - Color(0xffB5D3FF) - ])), - child: Text( - getAgeCOntent(user!.gender ?? 0, user!.age ?? 0, - user!.role ?? 0, user!.orientation ?? 0), - style: TextStyle( - color: Colors.black, - fontSize: 12.sp, - ), - ), - ), - if (user.vip! > 0) - Container( - margin: EdgeInsets.only( - left: 4.sp, - ), - child: Image.asset( - getCircleImage( - user.vip == 1 ? 'vip' : 'year_vip'), - width: 36.sp, - ), - ), - ], - ), - ], - )), - GestureDetector( - onTap: () async { - if (!chatImIdList.contains(user.userId.toString())) { - await createCustomMsg(user.userId.toString(), - recommendCircleFriendData['user']['imId']); - } - - pushChatPage( - user.userId.toString(), - recommendCircleFriendData['user']['imId'], - user.nickname!); - }, - child: Container( - height: 25.sp, - padding: EdgeInsets.only(left: 6.sp, right: 6.sp), - decoration: BoxDecoration( - gradient: AppColor.mainVerLinearGradient, - borderRadius: BorderRadius.circular(12.5.sp)), - alignment: Alignment.center, - child: Text( - '聊一聊', - style: TextStyle(color: Colors.white, fontSize: 15.sp), - ), - ), - ) - ], - ), - ), - ), - if (info.containsKey('desc')) - Container( - margin: EdgeInsets.only(top: 10.sp, right: 16.sp), - child: Row( - children: [ - Container( - margin: EdgeInsets.only(right: 5.sp), - width: 3, - height: 3, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(1.5), - color: Color(0xFF00FFF4)), - ), - Expanded( - child: Container( - child: Text( - info['desc'], - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - fontWeight: FontWeight.w500, - ), - overflow: TextOverflow.ellipsis, - maxLines: 1, - ), - ), - ) - ], - ), - ), - if (info.containsKey('city')) - info['city'].toString().isNotEmpty - ? Container( - margin: EdgeInsets.only(top: 10.sp), - child: Row( - children: [ - Container( - margin: EdgeInsets.only(right: 5.sp), - width: 3.sp, - height: 3.sp, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(1.5.sp), - color: Color(0xFF00FFF4)), - ), - Expanded( - child: Text( - info['city'], - overflow: TextOverflow.ellipsis, - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - fontWeight: FontWeight.w500), - )) - ], - ), - ) - : Container(), - if (info.containsKey('both_interests')) - Container( - margin: EdgeInsets.only(top: 10.sp, right: 16.sp), - child: Row( - children: [ - Container( - margin: EdgeInsets.only(right: 5.sp), - width: 3, - height: 3, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(1.5), - color: Color(0xFF00FFF4)), - ), - Expanded( - child: Container( - child: Text( - info['both_interests'], - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - fontWeight: FontWeight.w500, - ), - overflow: TextOverflow.ellipsis, - maxLines: 1, - ), - ), - ) - ], - ), - ), - Container( - margin: EdgeInsets.only(top: 10.sp, bottom: 10.sp), - alignment: Alignment.centerLeft, - child: - Row(crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - margin: EdgeInsets.only(right: 5.sp, top: 10.sp), - width: 3, - height: 3, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(1.5), - color: Color(0xFF00FFF4)), - ), - Expanded( - child: Text( - '交友宣言:' + recommendCircleFriendData['user']['signature'], - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - fontWeight: FontWeight.w500), - maxLines: 2, - overflow: TextOverflow.ellipsis, - )), - ])), - Image.asset( - getCircleImage('line'), - width: Get.width, - fit: BoxFit.fill, - ), - if (circleList.isNotEmpty) - Container( - height: 72.sp, - margin: EdgeInsets.only(top: 10.sp, bottom: 10.sp), - width: Get.width, - child: ListView.builder( - itemBuilder: (context, index) { - return circleInfoItem(circleList[index], index); - }, - itemCount: circleList.length, - scrollDirection: Axis.horizontal, - ), - ) - ], - ), - ); - } - - circleInfoItem(var bean, int index) { - return GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.Signal_circle_list, - arguments: bean['id'].toString()); - }, - child: Container( - margin: EdgeInsets.only(right: 10.sp), - padding: EdgeInsets.only(left: 12.sp, right: 5.sp), - height: 72.sp, - width: 145.sp, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8.sp), - border: GradientBoxBorder( - gradient: AppColor.mainVerLinearGradient, - width: 1.sp, - ), - ), - child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - width: 42.sp, - height: 42.sp, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8.0), - gradient: const LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [ - Color(0xFF71F3F2), - Color(0xFFF558FF), - ], - stops: [0.0365, 0.9427], - ), - ), - padding: EdgeInsets.all(1.sp), - child: ClipRRect( - borderRadius: BorderRadius.circular(8.0), - child: CachedNetworkImage( - imageUrl: bean['image'], - width: 40.sp, - height: 40.sp, - fit: BoxFit.cover), - ), - ), - Expanded( - child: Container( - padding: EdgeInsets.only( - left: 8.sp, - ), - // alignment: Alignment., - height: 72.sp, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - bean['title'], - style: TextStyle( - color: Colors.white, - fontSize: 12.sp, - fontWeight: FontWeight.w600), - ), - SizedBox( - height: 4.sp, - ), - Text( - // "view_total" -> 21 - '${convertToTenThousand(bean['viewTotal'])}人看过', - textAlign: TextAlign.left, - style: TextStyle( - color: const Color(0xff03FEFB), - fontSize: 12.sp, - ), - ), - ], - ), - )), - ], - ), - ), - ); - } - - @override - Widget build(BuildContext context) { - // TODO: add widget build method - return GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - Get.back(); - }, - child: Scaffold( - backgroundColor: recommendCircleFriendData.isNotEmpty - ? Colors.black.withOpacity(0.75) - : Colors.transparent, - body: Center( - child: Container( - // width: Get.width, - // height: Get.height, - // color: Colors.red, - alignment: Alignment.center, - // margin: EdgeInsets.only(left: 15.sp, right: 15.sp), - // decoration: BoxDecoration( - // image: DecorationImage( - // image: AssetImage(getHomeImage('online_bg')), - // fit: BoxFit.fill - // ) - // ), - child: recommendCircleFriendData.isNotEmpty - ? Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - margin: EdgeInsets.only(bottom: 16.sp), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset( - getMsgImage('heart_icon'), - width: 18.sp, - ), - SizedBox( - width: 4.sp, - ), - ShaderMask( - shaderCallback: (Rect bounds) { - return const LinearGradient( - begin: Alignment(0.0, -1.0), - end: Alignment.bottomCenter, - colors: [Color(0xff71F3F2), Color(0xffF657FF)], - ).createShader(Offset.zero & bounds.size); - }, - child: Text( - '圈友推荐', - style: TextStyle( - fontSize: 18.sp, - fontWeight: FontWeight.w600, - color: Colors.white, - shadows: [ - Shadow( - color: Color(0xffF657FF), offset: Offset(0.0, -1)) - ]), - ), - ), - SizedBox( - width: 4.sp, - ), - Image.asset( - getMsgImage('heart_icon'), - width: 18.sp, - ), - ], - ), - ), - itemWidget(), - Container( - height: 40.sp, - margin: EdgeInsets.only(top: 20.sp), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - GestureDetector( - onTap: () { - Get.back(); - }, - child: Container( - width: 100.sp, - height: 40.sp, - alignment: Alignment.center, - decoration: BoxDecoration( - color: Color(0xFF392D53), - borderRadius: BorderRadius.circular(20.sp)), - child: Text( - '先不看了', - style: TextStyle( - color: Colors.white, fontSize: 15.sp), - ), - ), - ), - SizedBox( - width: 40.sp, - ), - GestureDetector( - onTap: () { - loadRecommendCircleFriendData(); - }, - child: Container( - width: 100.sp, - height: 40.sp, - alignment: Alignment.center, - decoration: BoxDecoration( - gradient: AppColor.mainHorLinearGradient, - borderRadius: BorderRadius.circular(20.sp)), - child: Text( - '换一位', - style: TextStyle( - color: Colors.white, fontSize: 15.sp), - )), - ) - ], - ), - ) - ], - ) - : isLoad - ? SearchAnimationWidget() - : Container(), - )))); - } -} - -class SearchAnimationWidget extends StatefulWidget { - @override - _SearchAnimationWidgetState createState() => _SearchAnimationWidgetState(); -} - -class _SearchAnimationWidgetState extends State - with SingleTickerProviderStateMixin { - late AnimationController _controller; - - @override - void initState() { - super.initState(); - _controller = AnimationController( - vsync: this, - duration: Duration(seconds: 2), - )..repeat(); - } - - @override - Widget build(BuildContext context) { - return Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Stack( - children: [ - Image.asset(getCircleImage('search_bg_icon'),width: 90.sp,), - AnimatedBuilder( - animation: _controller, - builder: (context, child) { - return Container( - margin: EdgeInsets.only(left: 30.sp,top: 30.sp), - child: Transform.translate( - offset: Offset( - 30.0 * math.cos(2 * math.pi * _controller.value), - 30.0 * math.sin(2 * math.pi * _controller.value), - ), - child: Image.asset( - getCircleImage('search_icon'), - - width: 27.sp, - ), - ), - ); - }), - ], - ), - Container( - margin: EdgeInsets.only(top: 20.sp), - child: Text( - '正在为您匹配合适的那个Ta~', - style: TextStyle(color: Colors.white, fontSize: 16.sp), - )) - ], - ); - } - - @override - void dispose() { - _controller.dispose(); - super.dispose(); - } -} diff --git a/circle_app/lib/common/Widgets/unlock_wx_tip.dart b/circle_app/lib/common/Widgets/unlock_wx_tip.dart deleted file mode 100644 index f8861e7..0000000 --- a/circle_app/lib/common/Widgets/unlock_wx_tip.dart +++ /dev/null @@ -1,593 +0,0 @@ -import 'dart:io'; - -import 'package:circle_app/common/Widgets/open_vip_tip/logic.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; -import 'package:get/get.dart'; -import 'package:circle_app/common/Widgets/base_tip_widget.dart'; -import 'package:circle_app/network/api.dart'; -import 'package:circle_app/network/dio_manager.dart'; -import 'package:circle_app/util/paymentUtil.dart'; -import 'package:circle_app/util/util.dart'; - -import '../../components/func_widget.dart'; -import '../../util/PaymentUtils.dart'; - -class UnlockWxTip extends StatefulWidget { - String userId; - String avatarUrl; - bool isMore; - UnlockWxTip(this.userId, this.avatarUrl,this.isMore); - @override - _UnlockWxTipState createState() => _UnlockWxTipState(); -} - -class _UnlockWxTipState extends State { - // TODO: add state variables and methods - List prices = []; - int selectedIndex = -1; - bool isZfbPrice = true; - - Map wxInfo = {}; - - @override - void initState() { - // TODO: implement initState - super.initState(); - loadUserWxConfigData(); - // loadData(); - } - - @override - Widget build(BuildContext context) { - // TODO: add widget build method - return Scaffold( - backgroundColor: Colors.transparent, - body: Stack( - alignment: Alignment.center, - children: [ - Container( - width: Get.width, - height: Get.height, - ), - Stack( - children: [ - Container( - margin: EdgeInsets.only(left: 20.sp, right: 20.sp), - padding: EdgeInsets.all(15.sp), - height: Platform.isAndroid ? (!widget.isMore ? 230.sp : 460.sp) : (!widget.isMore ? 190.sp :430.sp) , - // 460.sp : 430.sp, - decoration: BoxDecoration( - color: const Color(0xFF393949), - borderRadius: BorderRadius.circular(10.sp)), - child: Column( - children: [ - Container( - margin: EdgeInsets.only(bottom: 15.sp), - alignment: Alignment.center, - child: Row( - children: [ - ClipOval( - child: Image.network( - widget.avatarUrl, - width: 45.sp, - height: 45.sp, - fit: BoxFit.cover, - )), - Expanded( - child: Container( - decoration: BoxDecoration( - color: Colors.white.withOpacity(0.05), - borderRadius: BorderRadius.circular(10.sp)), - padding: EdgeInsets.all(4.sp), - margin: EdgeInsets.only(left: 8.sp, right: 25.sp), - child: Text( - wxInfo.isEmpty ? '主动才有故事,解锁我的联系方式后,就可以更加深入地交流哦~' : wxInfo['guideText'] ?? '主动才有故事,解锁我的联系方式后,就可以更加深入地交流哦~', - style: TextStyle( - color: Colors.white, fontSize: 13.sp), - maxLines: 2, - overflow: TextOverflow.ellipsis, - ), - )) - ], - ), - ), - - if (wxInfo['price'] != null) - userItemView(wxInfo['price'].toString()), - if (prices.isNotEmpty && wxInfo['price'] == null) - itemView(context, prices[0], 0), - if (widget.isMore) - Container( - margin: EdgeInsets.only(top: 5.sp, bottom: 10.sp), - child: DottedLine( - color: Colors.white.withOpacity(0.3), - ), - ), - if (widget.isMore) - Text( - '套餐可以解锁TA的联系方式,还可以解锁更多联系方式哦~', - style: TextStyle( - color: const Color(0xFFF7FAFA), fontSize: 13.0.sp), - ), - if (widget.isMore) - SizedBox(height: 10.0.sp), - if (prices.isNotEmpty && widget.isMore) - Expanded( - child: ListView.builder( - // shrinkWrap: true, - physics: const NeverScrollableScrollPhysics(), - itemCount: prices.length - 1, - itemBuilder: (context, index) { - return itemView( - context, prices[index + 1], index + 1); - }, - ), - ), - // SizedBox(height: 20.0.sp), - if (Platform.isAndroid) - Container( - margin: EdgeInsets.only(top: 0.sp, bottom: 20.sp), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - onTap: () { - // 处理支付宝支付逻辑 - isZfbPrice = true; - setState(() {}); - }, - child: Row( - children: [ - Image.asset( - isZfbPrice - ? getMineImage("icon_pay_select") - : getMineImage("icon_pay_is_no_select"), - width: 20.0.sp, - height: 20.0.sp, - ), - SizedBox(width: 8.0.sp), - Image.asset( - getMineImage('icon_cooperate_ali'), - width: 20.0.sp, - height: 20.0.sp, - ), - SizedBox(width: 4.0.sp), - Text( - '支付宝支付', - style: TextStyle( - color: const Color(0xFFF7FAFA), - fontSize: 14.0.sp, - ), - ), - SizedBox(width: 4.0.sp), - Image.asset( - getMineImage('icon_recommend_pay_way'), - width: 32.0.sp, - height: 16.0.sp, - ), - ], - ), - ), - SizedBox(width: 24.0.sp), - GestureDetector( - onTap: () { - isZfbPrice = false; - setState(() {}); - }, - child: Row( - children: [ - Image.asset( - !isZfbPrice - ? getMineImage("icon_pay_select") - : getMineImage("icon_pay_is_no_select"), - width: 20.0.sp, - height: 20.0.sp, - ), - SizedBox(width: 8.0.sp), - Image.asset( - getMineImage('icon_cooperate_wx'), - width: 20.0.sp, - height: 20.0.sp, - ), - SizedBox(width: 4.0.sp), - Text( - '微信支付', - style: TextStyle( - color: const Color(0xFFF7FAFA), - fontSize: 14.0.sp, - ), - ), - ], - ), - ), - ], - ), - ), - GestureDetector( - onTap: () { - if (selectedIndex == -1) { - unlockWxData(); - } else { - if (wxInfo.isNotEmpty) { - if (wxInfo['price'] != null && selectedIndex == 0) { - showOKToast('请选择解锁选项'); - return; - } - } - - SmartDialog.showLoading(); - String itemId = prices[selectedIndex].itemId!; - if (Platform.isIOS ) { - IOSPayment.instance.iosPay(itemId, prices[selectedIndex].id.toString(),5,userId:widget.userId); - } else { - unlockingPayment(prices[selectedIndex].id.toString(), (){ - Get.back(); - checkMyUserStatus(); - unLockWxSuccessResult(widget.userId); - }); - } - } - - - }, - child: Container( - height: 40.sp, - width: Get.width, - decoration: BoxDecoration( - gradient: const LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [Color(0xFF9357FE), Color(0xFFD14CFF)], - ), - borderRadius: BorderRadius.circular(21.0), - ), - child: Center( - child: Text( - '立即解锁', - style: TextStyle( - color: const Color(0xFFF7FAFA), - fontSize: 14.0.sp), - ), - ), - ), - ), - ], - ), - ), - Positioned( - top: 8.sp, - right: 20.sp, - child: IconButton( - icon: const Icon(Icons.close, color: Colors.white), - onPressed: () => Get.back(result: 1), - ), - ), - ], - ), - ], - ), - ); - } - - - unlockingPayment(String cicleId, Function resultCallback) async { - SmartDialog.showLoading(); - if (isZfbPrice) { - var data = await DioManager.instance.post( - url: Api.postAliPayOrder, params: {"product_id": cicleId, "type": 3,'target_id':widget.userId}); - var bean = BaseResponse.fromJson( - data, (data) => PayUrlBean.fromJson(data)); - if (bean.isSuccess()) { - openAliPay(bean.data.payUrl, (isSuccess, errorMsg) { - if (isSuccess) { - resultCallback(true); - } - }); - // showToast(data.toString()); - } else { - showOKToast(bean.msg); - } - } else { - var data = await DioManager.instance - .post(url: Api.postWxOrder, params: {"product_id": cicleId, "type": 3,'target_id':widget.userId}); - var bean = BaseResponse.fromJson( - data, (data) => PaymentData.fromJson(data)); - if (bean.isSuccess()) { - openWxPay(bean.data, (bool isSuccess, String? errorMessage) { - if (isSuccess) { - resultCallback(true); - } else { - // 处理支付失败,errorMessage 可能为 null - } - }); - } else { - showOKToast(bean.msg); - } - - } - SmartDialog.dismiss(); - } - - Widget itemView(BuildContext context, Prices price, int index) { - // int present_bean = item.note['present_bean']; - - String iconIv = getMineImage('bi_icon${index+1}'); - - return GestureDetector( - onTap: () { - selectedIndex = index; - setState(() {}); - }, - child: Container( - height: 49.sp, - margin: const EdgeInsets.only(bottom: 10), - decoration: BoxDecoration( - color: index == selectedIndex - ? const Color(0xFF464556) - : const Color(0xFF464556), - borderRadius: BorderRadius.circular(6), - border: index == selectedIndex - ? Border.all(color: const Color(0xFF21BEAB), width: 1.sp) - : null, - ), - child: Container( - margin: EdgeInsets.only(left: 6.sp, right: 6.sp), - child: Row( - children: [ - Image.asset( - iconIv, // Replace this with the actual image path - width: 31.sp, - height: 29.sp, - ), - SizedBox(width: 8.sp), - Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - price.desc!, - style: TextStyle(color: Colors.white, fontSize: 14.sp), - ), - // Text( - // "同时对方可获得${price.bonus}跨豆", - // style: TextStyle( - // color: const Color(0xFFEFD84E), fontSize: 10.0.sp), - // ), - ], - ), - Expanded(child: Container()), - // To push the next widget to the right edge - Text( - '${price.curPrice}元', - style: TextStyle(color: Colors.white, fontSize: 14.sp), - ), - ], - ), - ), - )); - } - - Widget userItemView(String price) { - // int present_bean = item.note['present_bean']; - - String iconIv = getMineImage('bi_icon${1}'); - - return GestureDetector( - onTap: () { - selectedIndex = -1; - setState(() {}); - }, - child: Container( - height: 49.sp, - margin: const EdgeInsets.only(bottom: 10), - decoration: BoxDecoration( - color: -1 == selectedIndex - ? const Color(0xFF464556) - : const Color(0xFF464556), - borderRadius: BorderRadius.circular(6), - border: -1 == selectedIndex - ? Border.all(color: const Color(0xFF21BEAB), width: 1.sp) - : null, - ), - child: Container( - margin: EdgeInsets.only(left: 6.sp, right: 6.sp), - child: Row( - children: [ - Image.asset( - iconIv, // Replace this with the actual image path - width: 31.sp, - height: 29.sp, - ), - SizedBox(width: 8.sp), - Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - '解锁TA的联系方式 ', - style: TextStyle(color: Colors.white, fontSize: 14.sp), - ), - Text( - "TA设置了解锁价格哦~", - style: TextStyle( - color: const Color(0xFFEFD84E), fontSize: 10.0.sp), - ), - ], - ), - Expanded(child: Container()), - // To push the next widget to the right edge - Text( - '${price}跨豆', - style: TextStyle(color: Colors.white, fontSize: 14.sp), - ), - ], - ), - ), - )); - } - - void loadData() async { - var result = await DioManager().get(url: Api.queryUnlockPrice); - if (result['code'] == 200) { - var data = Autogenerated.fromJson(result); - if (data.prices != null) { - prices = data.prices!; - setState(() {}); - } - } - } - - void loadUserWxConfigData() async { - var result = await DioManager().get(url: Api.wxNumConfig + widget.userId); - if (result['code'] == 200) { - wxInfo = result['data']; - if (wxInfo['price'] == null) { - selectedIndex = 0; - } - loadData(); - } - } - - void unlockWxData() async { - var result = await DioManager().post(url: Api.balanceUnlockWX,params: {'targetUserId':widget.userId}); - if (result['code'] == 200) { - // 处理支付成功 - checkMyUserStatus(); - showOKToast('已成功解锁TA的联系方式,快去和TA私聊呗~'); - Get.back(result: 1); - } else { - showOKToast(result['msg']); - if (result['code'] == 10081) { - showRechargeScreenDialog(); - } - } - } -} - -class Autogenerated { - int? code; - String? msg; - List? prices; - - Autogenerated({this.code, this.msg, this.prices}); - - Autogenerated.fromJson(Map json) { - code = json['code']; - msg = json['msg']; - if (json['data'] != null) { - prices = []; - json['data'].forEach((v) { - prices!.add(new Prices.fromJson(v)); - }); - } - } - - Map toJson() { - final Map data = new Map(); - data['code'] = this.code; - data['msg'] = this.msg; - if (this.prices != null) { - data['prices'] = this.prices!.map((v) => v.toJson()).toList(); - } - return data; - } -} - -class Prices { - int? bonus; - int? curPrice; - String? desc; - int? expireTime; - int? expireType; - int? id; - String? itemId; - int? oldPrice; - int? show; - int? timesNum; - int? timesNumType; - - Prices( - {this.bonus, - this.curPrice, - this.desc, - this.expireTime, - this.expireType, - this.id, - this.itemId, - this.oldPrice, - this.show, - this.timesNum, - this.timesNumType}); - - Prices.fromJson(Map json) { - bonus = json['bonus']; - curPrice = json['curPrice']; - desc = json['desc']; - expireTime = json['expireTime']; - expireType = json['expireType']; - id = json['id']; - itemId = json['itemId']; - oldPrice = json['oldPrice']; - show = json['show']; - timesNum = json['timesNum']; - timesNumType = json['timesNumType']; - } - - Map toJson() { - final Map data = new Map(); - data['bonus'] = this.bonus; - data['curPrice'] = this.curPrice; - data['desc'] = this.desc; - data['expireTime'] = this.expireTime; - data['expireType'] = this.expireType; - data['id'] = this.id; - data['itemId'] = this.itemId; - data['oldPrice'] = this.oldPrice; - data['show'] = this.show; - data['timesNum'] = this.timesNum; - data['timesNumType'] = this.timesNumType; - return data; - } -} - -/// 虚线 -class DottedLine extends StatelessWidget { - final double height; - final Color color; - final Axis direction; - - const DottedLine({ - this.height = 1, - this.color = Colors.black, - this.direction = Axis.horizontal, - }); - - @override - Widget build(BuildContext context) { - return LayoutBuilder( - builder: (BuildContext context, BoxConstraints constraints) { - final boxWidth = direction == Axis.horizontal - ? constraints.constrainWidth() - : constraints.constrainHeight(); - final dashWidth = 10.0; - final dashHeight = height; - final dashCount = (boxWidth / (2 * dashWidth)).floor(); - return Flex( - children: List.generate(dashCount, (_) { - return SizedBox( - width: direction == Axis.horizontal ? dashWidth : dashHeight, - height: direction == Axis.horizontal ? dashHeight : dashWidth, - child: DecoratedBox( - decoration: BoxDecoration(color: color), - ), - ); - }), - mainAxisAlignment: MainAxisAlignment.spaceBetween, - direction: direction, - ); - }, - ); - } -} diff --git a/circle_app/lib/common/Widgets/user_share.dart b/circle_app/lib/common/Widgets/user_share.dart deleted file mode 100644 index f87aa8c..0000000 --- a/circle_app/lib/common/Widgets/user_share.dart +++ /dev/null @@ -1,633 +0,0 @@ -import 'dart:convert'; -import 'dart:io'; - -import 'package:flutter/material.dart'; -import 'package:flutter/rendering.dart'; -import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; -import 'package:get/get.dart'; -import 'package:cached_network_image/cached_network_image.dart'; - -import 'package:flutter/foundation.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get_core/src/get_main.dart'; -import 'package:image_gallery_saver/image_gallery_saver.dart'; -import 'dart:ui' as ui; -import 'package:fluwx/fluwx.dart' as fluwx; -import 'package:path_provider/path_provider.dart'; -import 'package:qr_flutter/qr_flutter.dart'; -import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; - -import '../../app/home/logic.dart'; -import '../../app/likelist/logic.dart'; -import '../../app/userinfo/logic.dart'; -import '../../network/api.dart'; -import '../../network/dio_manager.dart'; -import '../../util/util.dart'; -import '../colors/app_color.dart'; -import 'follow_me_dialog.dart'; - -class UserShare extends StatefulWidget { - String userImgUrl; - String userNIckName; - UserBean userInfoBean; - UserShare( - {super.key, - required this.userImgUrl, - required this.userNIckName, - required this.userInfoBean}); - @override - _UserShareState createState() => new _UserShareState(); -} - -class _UserShareState extends State { - // TODO: add state variables and methods - HomeLogic logic = Get.find(); - - GlobalKey _globalKey = GlobalKey(); - - List lists = []; - List conList = []; - - @override - void initState() { - // TODO: implement initState - super.initState(); - loadFollowMeData(); - } - - @override - Widget build(BuildContext context) { - // TODO: add widget build method - return Scaffold( - backgroundColor: Colors.transparent, - body: Container( - child: Column( - children: [ - Expanded(child: Container()), - Container( - width: Get.width - 40.sp, - // height: Get.height - Get.bottomBarHeight - 164.sp - 10.sp, - child: SingleChildScrollView( - child: RepaintBoundary( - key: _globalKey, - child: Container( - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage(getCircleImage("open_vip_bg")), - fit: BoxFit.fill, - ), - ), - child: Column( - children: [ - Container( - width: Get.width, - height: 65.sp, - margin: EdgeInsets.only( - left: 15.sp, top: 20.sp, right: 15.sp), - child: Row( - children: [ - Center( - child: Stack( - alignment: Alignment.center, - children: [ - Container( - width: 47.sp, - height: 47.sp, - decoration: const BoxDecoration( - shape: BoxShape.circle, - ), - ), - SizedBox( - width: 46.sp, - height: 46.sp, - child: _buildAvatar1(logic), - ) - ], - ), - ), - Expanded( - child: Container( - padding: EdgeInsets.only(left: 10.sp), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - _buildNameRow(logic), - SizedBox(height: 10.sp), - _buildInfoRow(logic), - ], - ), - ), - ), - Image.asset( - getBaseImage("ic_launcher"), - width: 60.sp, - height: 60.sp, - ) - ], - ), - ), - Container( - height: 300.sp, - width: Get.width, - margin: EdgeInsets.only( - left: 10.sp, - right: 10.sp, - top: 10.sp, - bottom: 5.sp), - child: ClipRRect( - borderRadius: BorderRadius.circular(6.sp), - child: Image.network( - widget.userImgUrl, - fit: BoxFit.cover, - )), - ), - Container( - // height: 90.sp, - // color: Color(0xFF334141), - alignment: Alignment.center, - // color: Colors.yellow, - // width: Get.width-40.sp, - margin: - EdgeInsets.only(bottom: 15.sp, top: 10.sp), - padding: - EdgeInsets.only(left: 15.sp, right: 15.sp), - child: Row( - children: [ - Expanded( - child: Container( - // color: Colors.red, - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Container( - // color: Colors.blue, - child: Row( - children: [ - Text( - '专属邀请码', - style: TextStyle( - color: Colors.white, - fontSize: 18.sp), - ), - SizedBox( - width: 8.sp, - ), - Container( - alignment: Alignment.center, - padding: EdgeInsets.only( - left: 10.sp, - right: 10.sp), - height: 25.sp, - decoration: BoxDecoration( - // color: Color(0xFFDC5BFD), - gradient: AppColor - .mainVerLinearGradient, - borderRadius: - BorderRadius.circular( - 12.5.sp)), - child: Text( - logic.inviteCode, - style: TextStyle( - color: Colors.black, - fontSize: 12.sp), - ), - ) - ], - ), - ), - Container( - margin: EdgeInsets.only(top: 10.sp), - width: Get.width - 200.sp, - child: Text( - '扫码或长按识别下载APP,认识更多小众圈子里的人,给生活带来更多乐趣~', - style: TextStyle( - color: Colors.white, - fontSize: 15.sp)), - ) - ], - ), - ), - ), - // Image.asset(getBaseImage("ic_launcher"),width: 80.sp,height: 80.sp,) - Stack( - alignment: Alignment.center, - children: [ - Container( - color: Colors.white, - width: 90.sp, - height: 90.sp, - ), - QrImageView( - data: logic.link + - '#code=${logic.inviteCode}', - padding: EdgeInsets.zero, - version: QrVersions.auto, - size: 80.sp, - gapless: false, - // backgroundColor: Colors.black, - ) - ], - ) - ], - ), - ) - ], - ), - ))), - ), - SafeArea( - top: false, - bottom: false, - child: Container( - height: - lists.isNotEmpty || conList.isNotEmpty ? 264.sp : 164.sp, - width: Get.width, - color: Color(0xFF292247), - child: Column( - children: [ - if (lists.isNotEmpty || conList.isNotEmpty) - Container( - height: 100.sp, - child: ListView.builder( - scrollDirection: Axis.horizontal, - itemBuilder: (context, index) { - if (index == 4) { - return GestureDetector( - onTap: () { - Get.bottomSheet( - FollowMeDialog( - bean: null, - userInfoBean: widget.userInfoBean), - isScrollControlled: true, - enableDrag: false); - }, - behavior: HitTestBehavior.opaque, - child: Container( - width: Get.width / 5, - child: Column( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Image.asset( - getCircleImage('share_more'), - width: 51.sp, - ), - SizedBox( - height: 4.sp, - ), - Text( - '更多', - style: TextStyle( - color: Colors.white, - fontSize: 14.sp), - ) - ], - ), - ), - ); - } - var info; - if (conList.length > index) { - info = conList[index]; - } else { - info = lists[index]; - } - return GestureDetector( - onTap: () { - sendUserHomeCustomMsg( - info.userID ?? info.user.imId, - jsonEncode(widget.userInfoBean.toJson()), - '分享用户[${widget.userInfoBean.nickname}]的主页'); - }, - behavior: HitTestBehavior.opaque, - child: Container( - width: Get.width / 5, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - ClipOval( - child: Image.network( - info.faceUrl ?? info.user.avatar, - width: 51.sp, - height: 51.sp, - fit: BoxFit.cover, - ), - ), - SizedBox( - height: 4.sp, - ), - Text( - info.nickName ?? info.user.nickname, - style: TextStyle( - color: Colors.white, - fontSize: 14.sp), - maxLines: 1, - overflow: TextOverflow.ellipsis, - ) - ], - ), - ), - ); - }, - itemCount: conList.length + lists.length > 5 - ? 5 - : conList.isNotEmpty - ? conList.length - : lists.length, - ), - ), - Expanded( - child: Container( - padding: EdgeInsets.only( - top: 15.sp, left: 15.sp, right: 15.sp), - alignment: Alignment.center, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - shareAction('wx', '微信', () { - shareWxData(1); - }), - shareAction('wxq', '朋友圈', () { - shareWxData(2); - }), - shareAction('save', '复制邀请链接', () { - copyInviteText(logic.model!.nickname!); - }), - // shareAction('wb', '复制链接', () { - // copyInviteText(logic.name); - // }), - - shareAction('hb', '保存邀请海报', () { - _saveLocalImage(); - }), - ], - ), - )), - Container( - height: 1.sp, - color: Color(0x33FFFFFF), - ), - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - Get.back(); - }, - child: Container( - height: 67.sp, - alignment: Alignment.center, - child: Text( - '取消', - style: - TextStyle(color: Colors.white, fontSize: 14.sp), - ), - ), - ) - ], - ), - )) - ], - ), - ), - ); - } - - Widget _buildAvatar1(HomeLogic logic) { - return ClipOval( - child: GestureDetector( - onTap: () { - if (logic.model != null) { - var imgList = []; - imgList.add(logic.model!.avatar!); - // Get.toNamed(AppRoutes.Swiper,arguments:imgList); - // Get.toNamed(AppRoutes.Swiper, arguments: { - // 'imaglist': imgList, - // 'index': 0 - // }); - } - }, - child: logic.model == null - ? SizedBox( - width: 63.sp, - height: 63.sp, - ) - : CachedNetworkImage( - fit: BoxFit.cover, - placeholder: null, - imageUrl: logic.model!.avatar!, - width: 63.sp, - height: 63.sp, - ), - ), - ); - } - - Widget _buildNameRow(HomeLogic logic) { - int gender = logic.model!.gender!; - int role = logic.model!.role!; - int age = logic.model!.age!; - int orientation = logic.model!.orientation!; - - String ageMsg = getAgeCOntent(gender, age, role, orientation); - return Container( - margin: EdgeInsets.only(top: 6.sp), - child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - logic.model!.nickname!, - style: TextStyle( - color: const Color.fromRGBO(247, 250, 250, 1.0), - fontSize: 16.sp, - ), - ), - SizedBox( - width: 4.sp, - ), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color.fromRGBO(141, 255, 248, 1.0), - Color.fromRGBO(181, 211, 255, 1.0), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 2.sp, bottom: 2.sp, left: 10.sp, right: 10.sp), - child: Text( - ageMsg, - style: TextStyle( - color: Colors.black, - fontSize: 10.sp, - ), - ), - ), - ], - ), - ); - } - - Widget _buildInfoRow(HomeLogic logic) { - return Row( - children: [ - Text('邀请您加入', - style: TextStyle( - color: Colors.white, - fontSize: 12.sp, - )), - Text('【微乐园APP】', - style: TextStyle( - color: AppColor.mainColor, - fontSize: 14.sp, - fontWeight: FontWeight.bold)), - ], - ); - } - - shareAction(String img, String name, GestureTapCallback onTap) { - return GestureDetector( - onTap: onTap, - child: Container( - child: Column( - children: [ - Image.asset( - getMineImage(img), - width: 40.sp, - ), - SizedBox( - height: 10.sp, - ), - Text( - name, - style: TextStyle(color: Colors.white, fontSize: 12.sp), - ) - ], - ), - ), - ); - } - - _saveLocalImage() async { - RenderRepaintBoundary boundary = - _globalKey.currentContext!.findRenderObject() as RenderRepaintBoundary; - ui.Image image = - await boundary.toImage(pixelRatio: ui.window.devicePixelRatio); - ByteData? byteData = - await (image.toByteData(format: ui.ImageByteFormat.png)); - if (byteData != null) { - final result = - await ImageGallerySaver.saveImage(byteData.buffer.asUint8List()); - print(result); - // isSuccess - if (result['isSuccess']) { - showOKToast('保存成功'); - } else { - showOKToast('保存失败,请检查相册权限是否开启'); - } - } - } - - copyInviteText( - String username, - ) { - String linkStr = logic.link.replaceAll('https://', ''); - - Clipboard.setData(ClipboardData( - text: - '【${username}】邀请你加入“微乐园”,邀请码为${logic.inviteCode},点击进入${logic.link}' - '这是一款专为各种特色小众圈子爱好者打造的交友平台,资质齐全,安全正规。' - '在这里,能看到很多没听说过的圈子,也能发现很多为数不多的真实情怀,还能见证小众亚文化在生活方式上的新体验。真实、安全、私密、走心,我和很多圈友都在玩哦~')); - showOKToast('您已成功复制分享链接,前往对应平台粘贴发送即可~'); - } - - /** - * 分享图片到微信, - * file=本地路径 - * url=网络地址 - * asset=内置在app的资源图片 - * scene=分享场景,1好友会话,2朋友圈,3收藏 - */ - void shareWxData(int scene) async { - SmartDialog.showLoading(msg: '正在生成分享图片...'); - RenderRepaintBoundary boundary = - _globalKey.currentContext!.findRenderObject() as RenderRepaintBoundary; - ui.Image image = - await boundary.toImage(pixelRatio: ui.window.devicePixelRatio); - ByteData? byteData = - await (image.toByteData(format: ui.ImageByteFormat.png)); - String filePath = ''; - if (byteData != null) { - Uint8List pngBytes = byteData!.buffer.asUint8List(); - Directory directory = await getApplicationDocumentsDirectory(); - filePath = '${directory.path}/widget_image.png'; - File imageFile = File(filePath); - imageFile.writeAsBytesSync(pngBytes); - } - SmartDialog.dismiss(); - fluwx.WeChatScene wxScene = fluwx.WeChatScene.SESSION; - if (scene == 2) { - wxScene = fluwx.WeChatScene.TIMELINE; - } - fluwx.WeChatShareImageModel? model; - - if (filePath.isNotEmpty) { - model = fluwx.WeChatShareImageModel( - fluwx.WeChatImage.file(File(filePath)), - title: '', - description: '', - scene: wxScene); - } - if (model != null) { - fluwx.shareToWeChat(model!); - } - } - - void loadFollowMeData() async { - List stataionList = []; - if (conList.isEmpty) { - stataionList = await loadConverstationListData(); - } - Map typeMap = { - '官方通知': 1, - '活动驿站': 2, - '会员中心': 3, - '资产中心': 4, - '乐园圈子': 5, - '互动通知': 6, - }; - - stataionList.forEach((element) { - if (!typeMap.containsKey(element.nickName ?? '')) { - conList.add(element); - } - }); - - if (conList.length < 5) { - var data = await DioManager.instance - .get(url: Api.fansList, params: {'page': 1, 'page_size': 6}); - var bean = BaseResponse.fromJson( - data, (data) => UserList.fromJson(data)); - if (bean.isSuccess()) { - bean.data.lists.forEach((element) { - bool isContain = false; - conList.forEach((user) { - if (element.user.imId == user.userID!) { - isContain = true; - } - }); - if (!isContain) { - lists.add(element); - } - }); - } - } - - setState(() {}); - } -} diff --git a/circle_app/lib/common/Widgets/wx_edit_dialog.dart b/circle_app/lib/common/Widgets/wx_edit_dialog.dart deleted file mode 100644 index 1339f22..0000000 --- a/circle_app/lib/common/Widgets/wx_edit_dialog.dart +++ /dev/null @@ -1,507 +0,0 @@ -import 'package:circle_app/common/Widgets/base_tip_widget.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:gradient_borders/box_borders/gradient_box_border.dart'; -import 'package:shared_preferences/shared_preferences.dart'; - -import '../../../common/colors/app_color.dart'; -import '../../../components/func_widget.dart'; -import '../../../network/api.dart'; -import '../../../network/dio_manager.dart'; -import '../../../util/SharedPreferencesHelper.dart'; -import '../../../util/util.dart'; - -class WxEditDialog extends StatefulWidget { - String phone; - - WxEditDialog(this.phone,{super.key}); - @override - _WxEditDialogState createState() => new _WxEditDialogState(); -} - -class _WxEditDialogState extends State { - // TODO: add state variables and methods - TextEditingController wxEditingController = TextEditingController(); - TextEditingController descEditingController = TextEditingController(); - TextEditingController moneyEditingController = TextEditingController(); - - Map wxInfo = {}; - - int type = 2; - - Map wxStatusInfo = {}; - - @override - void initState() { - // TODO: implement initState - super.initState(); - loadMyWxInfoData(); - // updateWxText(); - } - - @override - Widget build(BuildContext context) { - // TODO: add widget build method - return GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - FocusManager.instance.primaryFocus?.unfocus(); - }, - child: Scaffold( - backgroundColor: Colors.transparent, - body: Center( - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - padding: EdgeInsets.only(left: 15.sp,right: 15.sp), - height: 455.sp, - margin: EdgeInsets.only(left: 15.sp, right: 15.sp), - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage(getBaseImage("newgui_bg")), - fit: BoxFit.fill, - )), - child: Column( - children: [ - Container( - margin: EdgeInsets.only(top: 18.sp), - child: ShaderMask( - shaderCallback: (Rect bounds) { - return const LinearGradient( - begin: Alignment(0.0, -1.0), - end: Alignment.bottomCenter, - colors: [Color(0xFFCE51FF), Color(0xFFFF8450)], - ).createShader(Offset.zero & bounds.size); - }, - child: Text( - '联系方式设置', - style: TextStyle( - // color: AppColor.mainColor, - color: Colors.white, - fontSize: 18.sp, - shadows: const [ - Shadow( - color: Color(0xffF657FF), - offset: Offset(0.0, -1)) - ]), - ), - )), - Container( - margin: EdgeInsets.only(bottom: 10.sp,top: 15.sp), - // height: 30.sp, - child: Row( - children: [ - GestureDetector( - onTap: () { - showTipPop(); - }, - child: Container( - child: Row( - children: [ - Image.asset( - getMineImage(type == 1 ? 'phone_icon' : type == 3 ? 'qq' : 'wx'), - width: 40.sp, - ), - Container( - margin: EdgeInsets.only(left: 4.sp,right: 4.sp), - child: Icon(Icons.change_circle,color: AppColor.mainColor,size: 30.sp,)), - ], - ), - ), - ), - Expanded(child: Container( - margin: EdgeInsets.only(right: 15.sp), - decoration: BoxDecoration( - color: Color(0xFF260C3E), - borderRadius: BorderRadius.circular(10.sp), - border: GradientBoxBorder( - gradient: - AppColor.mainVerLinearGradient, - width: 1.sp, - ), - ), - child: TextField( - controller: - wxEditingController, - maxLength: 20, - style: TextStyle( - color: Colors.white, - fontSize: 16.sp), - decoration: InputDecoration( - hintText: '请输入真实的联系方式', - hintStyle: TextStyle( - color: Colors.white70, - fontSize: 14.sp), - border: InputBorder.none, - counterText: '', - contentPadding: - EdgeInsets.only( - left: 14.sp)), - ), - )), - - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - if (wxInfo.containsKey('hideContact')) { - wxInfo['hideContact'] = wxInfo['hideContact'] == 0 ? 1 : 0; - - } else { - wxInfo['hideContact'] = 0; - - } - showOKToast(wxInfo['hideContact'] == 1 ? '已对其他人隐藏联系方式' : '已对其他人展示联系方式(需要解锁)'); - setState(() { - - }); - - }, - child: Image.asset(getMineImage(wxInfo.containsKey('hideContact') ? wxInfo['hideContact'] == 1 ? 'no_show_icon' : 'show_icon' : 'show_icon'),width: 30.sp,)) - ], - ), - ), - Container( - margin: EdgeInsets.only(right: 15.sp), - decoration: BoxDecoration( - color: Color(0xFF260C3E), - borderRadius: BorderRadius.circular(10.sp), - border: GradientBoxBorder( - gradient: - AppColor.mainVerLinearGradient, - width: 1.sp, - ), - ), - child: TextField( - controller: - descEditingController, - maxLength: 30, - style: TextStyle( - color: Colors.white, - fontSize: 16.sp), - // keyboardType: TextInputType.phone, - decoration: InputDecoration( - hintText: '请输入解锁引导语', - hintStyle: TextStyle( - color: Colors.white70, - fontSize: 14.sp), - border: InputBorder.none, - counterText: '', - contentPadding: - EdgeInsets.only( - left: 14.sp)), - ), - - ), - Container( - margin: EdgeInsets.only(top: 10.sp), - child: Row( - children: [ - Image.asset( - getBaseImage('day3_icon'), - width: 18.sp, - height: 18.sp, - ), - SizedBox(width: 2.sp,), - Text('设置联系方式解锁价格',style: TextStyle(color: Color(0xCCFFFFFF),fontSize: 14.sp),), - SizedBox( - width: 60.sp, - height: 30.sp, - child: Container( - margin: EdgeInsets.only(left: 5.sp,right: 5.sp), - decoration: BoxDecoration( - color: Color(0xFF260C3E), - borderRadius: BorderRadius.circular(10.sp), - // border: GradientBoxBorder( - // gradient: - // AppColor.newMainVerLinearGradient, - // width: 1.sp, - // ), - ), - child: Row( - children: [ - Expanded(child: TextField( - controller: - moneyEditingController, - maxLength: 4, - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.white, - fontSize: 14.sp), - keyboardType: TextInputType.phone, - inputFormatters: [ - FilteringTextInputFormatter - .digitsOnly, - ], - - decoration: InputDecoration( - hintText: '', - isCollapsed: true, - hintStyle: TextStyle( - color: Colors.white70, - fontSize: 14.sp), - border: InputBorder.none, - counterText: '', - contentPadding: - EdgeInsets.only( - left: 6.sp,right: 6.sp,bottom: 0,top: 0)), - )) - ], - ), - - ), - ), - Text('元',style: TextStyle(color: Color(0xCCFFFFFF),fontSize: 14.sp),) - ], - ), - ), - Container( - margin: EdgeInsets.only(top: 10.sp), - child: Text('温馨提示:\n' - + '1、为了维护站内的社交环境,若检测到为不实的联系方式,或以非社交为目的的其他非法用途,会第一时间将您账号封禁,并扣除相关奖励;\n' - + '2、解锁引导语可以让更多的人愿意解锁您的联系方式,让您赚更多的钱;\n' - + '3、每个人解锁后,您都可以得到设置价格的钱,收益无上限哦;\n' - + '4、此外,还可获得几重奖励。',style: TextStyle(color: Color(0xCCFFFFFF).withOpacity(0.5),fontSize: 14.sp),), - ), - Container( - margin: EdgeInsets.only(top: 10.sp), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - GestureDetector( - onTap: () { - Get.back(); - }, - child: Container( - height: 30.sp, - width: 100.sp, - alignment: Alignment.center, - padding: EdgeInsets.only(left: 10.sp, right: 10.sp), - margin: EdgeInsets.only(bottom: 10.sp), - decoration: BoxDecoration( - color: Colors.grey.withOpacity(0.7), - borderRadius: BorderRadius.circular(20), - ), - child: Text( - '放弃赚钱', - style: TextStyle( - color: Colors.white.withOpacity(0.75), - fontSize: 14.sp, - fontWeight: FontWeight.w500), - )), - ), - GestureDetector( - onTap: () async { - bool isPass = false; - if (type == 2) { - if (wxEditingController.text.length == 11) { - RegExp exp = RegExp( - r'^((13[0-9])|(14[0-9])|(15[0-9])|(16[0-9])|(17[0-9])|(18[0-9])|(19[0-9]))\d{8}$'); - isPass = exp.hasMatch(wxEditingController.text); - } - - if (wxEditingController.text.isNotEmpty && !isPass) { - RegExp wxReg = RegExp(r'^[-_a-zA-Z][-_a-zA-Z0-9]{5,19}$'); - if (!wxReg.hasMatch(wxEditingController.text)) { - showOKToast('请输入正确的微信号'); - return; - } - } - } else if (type == 3) { - isPass = isValidQQ(wxEditingController.text); - if (!isPass) { - showOKToast('请输入正确的QQ号'); - return; - } - } else if (type == 1) { - if (wxEditingController.text.length == 11) { - RegExp exp = RegExp( - r'^((13[0-9])|(14[0-9])|(15[0-9])|(16[0-9])|(17[0-9])|(18[0-9])|(19[0-9]))\d{8}$'); - isPass = exp.hasMatch(wxEditingController.text); - } - if (!isPass) { - showOKToast('请输入正确的手机号'); - return; - } - } - - - if (moneyEditingController.text.isNotEmpty) { - if (int.parse(moneyEditingController.text) <= 0) { - showOKToast('请设置联系方式解锁金额大于零'); - return; - } else if (int.parse(moneyEditingController.text) > 200 || int.parse(moneyEditingController.text) < 1) { - showOKToast('请设置联系方式解锁金额在1元~200元之间'); - return; - } - } - - - - if (wxInfo.containsKey('10034')) { - showOKToast(wxInfo['10034']); - return; - } else if (wxInfo.containsKey('10595')) { - showOKToast(wxInfo['10595']); - } - - var result = await DioManager().postBody(url: Api.confset,params: { "guideText": descEditingController.text, - "hideContact": wxInfo.containsKey('hideContact') ? wxInfo['hideContact'] : 0, - "price": moneyEditingController.text, - 'contactType':type, - "contact": wxEditingController.text}); - if (result['code'] ==200) { - showOKToast('设置成功'); - Get.back(); - } else if (result['code'] == 10081) { - showRechargeScreenDialog(); - } - - - // Get.back(); - // showRechargeDialog(); - }, - child: Container( - height: 30.sp, - width: 100.sp, - alignment: Alignment.center, - padding: EdgeInsets.only(left: 10.sp, right: 10.sp), - margin: EdgeInsets.only(bottom: 10.sp), - decoration: BoxDecoration( - // color: const Color(0xFFFF4D7C), - borderRadius: BorderRadius.circular(20), - gradient: AppColor.mainVerLinearGradient - ), - child: Text( - '确认', - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - fontWeight: FontWeight.w500), - )), - ), - ], - ), - ), - - ], - ), - ), - GestureDetector( - onTap: () { - Get.back(); - }, - child: Container( - margin: EdgeInsets.only(top: 10.sp), - alignment: Alignment.center, - child: Image.asset( - getBaseImage('close_icon'), - width: 24.sp, - ))), - ], - ), - ), - ), - ); - } - - void updateWxText() async { - if (widget.phone.isNotEmpty) { - SharedPreferences sharedPreferences =await SharedPreferences.getInstance(); - String loginPhone = await sharedPreferences.getString(SharedPreferencesHelper.LOGINPHONE)??""; - wxEditingController.text = loginPhone; - type = 1; - wxInfo['hideContact'] = 0; - setState(() { - - }); - } - } - - void loadMyWxInfoData() async { - var data = - await DioManager.instance.get(url: Api.mycontactConf, params: {}); - if (data['code'] == 200) { - wxInfo = data['data']; - - if (widget.phone.isNotEmpty) { - updateWxText(); - } else { - wxEditingController.text = wxInfo['contact'] ?? ''; - type = wxInfo['contactType'] ?? 2; - wxInfo['hideContact'] = wxInfo['hideContact'] == null ? 0 : wxInfo['hideContact']; - descEditingController.text = wxInfo['guideText'] ?? ''; - moneyEditingController.text = wxInfo['price'] != null ? wxInfo['price'].toString() : ''; - setState(() { - - }); - } - } - } - - void loadWxStatus() async { - var result = await DioManager.getInstance().get(url: Api.updateWxNumState,); - if (result['code'] == 10034) { - wxStatusInfo['10034'] = result['msg']; - } else if (result['code'] == 10595) { - wxStatusInfo['10595'] = result['msg']; - } - } - - showTipPop() { - Get.bottomSheet( - CupertinoActionSheet( - title: Text( - '联系方式', - style: TextStyle(fontSize: 22), - ), //标题 - //提示内容 - actions: [ - //操作按钮集合 - CupertinoActionSheetAction( - onPressed: () { - Navigator.pop(context); - type = 1; - setState(() { - - }); - }, - child: Text('手机号'), - ), - CupertinoActionSheetAction( - onPressed: () { - Navigator.pop(context); - type = 3; - setState(() { - - }); - }, - child: Text('QQ'), - ), - CupertinoActionSheetAction( - onPressed: () { - Navigator.pop(context); - type = 2; - setState(() { - - }); - }, - child: Text('微信'), - ), - ], - cancelButton: CupertinoActionSheetAction( - //取消按钮 - onPressed: () { - Navigator.pop(context); - }, - child: Text('取消'), - ), - ), - isScrollControlled: true); - } - -} diff --git a/circle_app/lib/common/colors/app_color.dart b/circle_app/lib/common/colors/app_color.dart deleted file mode 100644 index a49052b..0000000 --- a/circle_app/lib/common/colors/app_color.dart +++ /dev/null @@ -1,69 +0,0 @@ -import 'dart:ui'; - -import 'package:flutter/material.dart'; - -class AppColor { - static Color mainColor = Color(0xFF06F9FA); - static Color bgColor = Color(0xFF120D29); - static Color mainBgColor = Color(0XFF392D53); - - static Color cityBgColor = Color.fromRGBO(52, 41, 67, 1); - - static Gradient mainVerLinearGradient = const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ); - - static Gradient tagVerLinearGradient = LinearGradient( - colors: [ - Color(0xFF06F9FA).withOpacity(0.5), - Color(0xFFDC5BFD).withOpacity(0.5), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ); - - - static Gradient mainHorLinearGradient = const LinearGradient( - - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ); - - static Gradient bgHorLinearGradient = const LinearGradient( - colors: [ - Color(0xFF4C3E5F), - Color(0xFF324140), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ); - - static Gradient clearVerLinearGradient = LinearGradient( - colors: [ - mainColor.withOpacity(0.2), - mainColor.withOpacity(0.2), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ); - - static Gradient clearLinearGradient = LinearGradient( - colors: [ - mainColor.withOpacity(0), - mainColor.withOpacity(0), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ); - - -} diff --git a/circle_app/lib/common/config.dart b/circle_app/lib/common/config.dart deleted file mode 100644 index 8afe597..0000000 --- a/circle_app/lib/common/config.dart +++ /dev/null @@ -1,13 +0,0 @@ -class CONFIG{ - static const IMAGE_HEAD = 'https://qiniuyun.leyuan666.com/'; - - - static const CALL_OUT_VIDEO = 'call_out_video/'; - - static const CALL_OUT_IMAGE = 'call_out_image/'; - - static const USER_INFO_AVATAR = 'user_info_avatar/'; - - static const USER_ALBUM_IMAGE = 'user_album_image/'; - -} \ No newline at end of file diff --git a/circle_app/lib/common/const.dart b/circle_app/lib/common/const.dart deleted file mode 100644 index 7957589..0000000 --- a/circle_app/lib/common/const.dart +++ /dev/null @@ -1,167 +0,0 @@ -import 'package:circle_app/common/Widgets/unlock_wx_tip.dart'; -import 'package:circle_app/network/api.dart'; -import 'package:circle_app/network/dio_manager.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:oktoast/oktoast.dart'; - -import '../app/userinfo/logic.dart'; -import 'Widgets/base_tip_widget.dart'; - -const bgAssetImage = DecorationImage( - image: AssetImage('assets/images/base/bg.png'), - fit: BoxFit.cover, -); - -const bgBoxDecoration = BoxDecoration(image: bgAssetImage); - - -userWxStatusWidget(bool isUnclock,String wx,String userId,int type,String avatarUrl,Function callBack,{bool isSelf = false}) { - double textWidth = boundingTextSize(Get.context!, wx, TextStyle(color: Colors.white, fontSize: 12.sp)).width; - return GestureDetector( - onTap: () async { - if (!isUnclock) { - - var result = await DioManager().post(url: Api.unlockStatus,params: {'targetUserId':userId}); - if (result['code'] == 200) { - int price = result['data']['unlockPrice']; - int residueUnlockNum = result['data']['residueUnlockNum']; - if (price > 0 && (residueUnlockNum == -1 || residueUnlockNum > 0)) { - Get.bottomSheet(UnlockWxTip(userId, avatarUrl,false),isScrollControlled: true,enableDrag: false).then((value) {if (value != null) { - callBack(); - }}); - } else if (price > 0) { - Get.bottomSheet(UnlockWxTip(userId, avatarUrl,true),isScrollControlled: true,enableDrag: false).then((value) {if (value != null) { - callBack(); - }}); - } else { - var result = await DioManager().post(url: Api.unlockWx,params: {'targetUserId':userId}); - if (result['code'] == 200) { - showOKToast('已成功解锁TA的联系方式,快去和TA私聊呗~'); - callBack(); - } else { - Get.bottomSheet(UnlockWxTip(userId, avatarUrl,true),isScrollControlled: true,enableDrag: false).then((value) {if (value != null) { - callBack(); - }}); - } - } - } - } else { - if (!isSelf) { - // Clipboard.setData(ClipboardData(text: wx)); - // showToast('联系方式复制成功'); - } else { - showAddWxPicker(wx.isNotEmpty).then((value) { - if (value != null) { - callBack(); - } - }); - } - - } - - }, - child: Container( - height: 26.sp, - width: (isUnclock ? 32.sp : 43.sp) + textWidth, - padding: EdgeInsets.only(left: 5.sp,right: 5.sp), - decoration: BoxDecoration( - color: Color(0x66000000), - borderRadius: BorderRadius.circular(4.sp) - ), - child: Row( - children: [ - Image.asset(getMineImage(type == 1 ? 'phone_icon' : type == 3 ? 'qq' : 'wx'),width: 14.sp,), - SizedBox(width: 2.sp,), - Text(wx,style: TextStyle(color: Colors.white,fontSize: 12.sp),), - if (!isUnclock) - Image.asset(getDisCoverImage('unclock_icon'),width: 16.sp,) - ], - ), - ), - ); -} - -wxStatusWidget(bool isUnclock,String wx,String userId,int type,String avatarUrl,Function callBack,{bool isSelf = false}) { - double textWidth = boundingTextSize(Get.context!, wx, TextStyle(color: Colors.white, fontSize: 14.sp)).width; - return GestureDetector( - onTap: () async { - if (!isUnclock) { - - var result = await DioManager().post(url: Api.unlockStatus,params: {'targetUserId':userId}); - if (result['code'] == 200) { - int price = result['data']['unlockPrice']; - int residueUnlockNum = result['data']['residueUnlockNum']; - if (price > 0 && (residueUnlockNum == -1 || residueUnlockNum > 0)) { - Get.bottomSheet(UnlockWxTip(userId, avatarUrl,false),isScrollControlled: true,enableDrag: false).then((value) {if (value != null) { - callBack(); - }}); - } else if (price > 0) { - Get.bottomSheet(UnlockWxTip(userId, avatarUrl,true),isScrollControlled: true,enableDrag: false).then((value) {if (value != null) { - callBack(); - }}); - } else { - var result = await DioManager().post(url: Api.unlockWx,params: {'targetUserId':userId}); - if (result['code'] == 200) { - showOKToast('已成功解锁TA的联系方式,快去和TA私聊呗~'); - callBack(); - } else { - Get.bottomSheet(UnlockWxTip(userId, avatarUrl,true),isScrollControlled: true,enableDrag: false).then((value) {if (value != null) { - callBack(); - }}); - } - } - } - } else { - if (!isSelf) { - // Clipboard.setData(ClipboardData(text: wx)); - // showToast('联系方式复制成功'); - } else { - showAddWxPicker(wx.isNotEmpty).then((value) { - if (value != null) { - callBack(); - } - }); - } - - } - - }, - child: Container( - height: 38.sp, - width: (isUnclock ? 45.sp : 65.sp) + textWidth, - padding: EdgeInsets.only(left: 10.sp,right: 10.sp), - decoration: BoxDecoration( - color: Color(0x66000000), - borderRadius: BorderRadius.circular(4.sp) - ), - child: Row( - children: [ - Image.asset(getMineImage(type == 1 ? 'phone_icon' : type == 3 ? 'qq' : 'wx'),width: 16.sp,), - SizedBox(width: 4.sp,), - Text(wx,style: TextStyle(color: Colors.white,fontSize: 14.sp),), - if (!isUnclock) - Image.asset(getDisCoverImage('unclock_icon'),width: 24.sp,) - ], - ), - ), - ); -} - -checkMyUserStatus() async { - var data = await DioManager.instance.get(url: Api.getUserInfo); - var bean = BaseResponse.fromJson( - data, (data) => ResponseBean.fromJson(data)); - - if (bean.isSuccess()) { - UserBean userInfoBean = bean.data.user; - if (userInfoBean.wx_num.isNotEmpty) { - showOKToast('已成功解锁TA的微信,快去和TA私聊呗~'); - } else { - showOKToast('你已成功解锁TA的微信,建议您也填写微信,方便对方快速找到您哦~'); - } - } -} \ No newline at end of file diff --git a/circle_app/lib/common/values/pushconfig.dart b/circle_app/lib/common/values/pushconfig.dart deleted file mode 100644 index 319ac7e..0000000 --- a/circle_app/lib/common/values/pushconfig.dart +++ /dev/null @@ -1,121 +0,0 @@ - -import 'package:device_info/device_info.dart'; -import 'package:tencent_chat_push_for_china/model/appInfo.dart'; -import 'package:tencent_chat_push_for_china/tencent_chat_push_for_china.dart'; - -class PushConfig{ - - //These `Business ID` can be found in the offline push section for each manufacturers, - // on the main page of console from Tencent Cloud IM. - - // Business ID for HUAWEI - static const HWPushBuzID = 30671; - - // Business ID for XiaoMi - static const XMPushBuzID = 30672; - static const String XMChannelID = "111363"; - - // APP Info of XiaoMi - static const String XMPushAPPID = "2882303761520264048"; - static const String XMPushAPPKEY = "Yagmr/c0hntFMGWKweXqgg=="; - - // Business ID for Meizu - static const MZPushBuzID = 0; - - // APP Info of Meizu - static const String MZPushAPPID = ""; - static const String MZPushAPPKEY = ""; - - // Business ID for Vivo - static const VIVOPushBuzID = 30673; - - // Business ID for OPPO - static const OPPOPushBuzID = 30674; - - // APP Info of OPPO - static const String OPPOPushAPPKEY = "09e35257df174f9db390b4b3257f241c"; - static const String OPPOPushAPPSECRET = "7d17a5b2b2fc43eda61005807002f654"; - static const String OPPOPushAPPID = "31286141"; - static const String OPPOChannelID = "new_message"; -//appsecret:7d17a5b2b2fc43eda61005807002f654 - //appserversecret:07a4d3b9f3f249d2954866706af000d9 - //07a4d3b9f3f249d2954866706af000d9 - - // Business ID for Apple APNS 正式环境39381 测试环境39382 - static const ApplePushBuzID = 39381; - - - static final PushAppInfo appInfo = PushAppInfo( - hw_buz_id: PushConfig.HWPushBuzID, - mi_app_id: PushConfig.XMPushAPPID, - mi_app_key: PushConfig.XMPushAPPKEY, - mi_buz_id: PushConfig.XMPushBuzID, - mz_app_id: PushConfig.MZPushAPPID, - mz_app_key: PushConfig.MZPushAPPKEY, - mz_buz_id: PushConfig.MZPushBuzID, - vivo_buz_id: PushConfig.VIVOPushBuzID, - oppo_app_key: PushConfig.OPPOPushAPPKEY, - oppo_app_secret: PushConfig.OPPOPushAPPSECRET, - oppo_buz_id: PushConfig.OPPOPushBuzID, - oppo_app_id: PushConfig.OPPOPushAPPID, - apple_buz_id: PushConfig.ApplePushBuzID - ); -} - - -class ChannelPush{ - static final TimUiKitPushPlugin cPush = TimUiKitPushPlugin(); - - static init(PushClickAction pushClickAction) async { - // initialize the push plugin - print("ChannelPush init"); - bool isInit = await cPush.init( - pushClickAction: pushClickAction, - appInfo: PushConfig.appInfo, - ); - print("token=初始化"+isInit.toString()); - AndroidDeviceInfo androidInfo; - try { - DeviceInfoPlugin deviceInfo = DeviceInfoPlugin(); - androidInfo = await deviceInfo.androidInfo; - } catch (e) { - // 处理异常 - return true; - } - if (androidInfo.brand == 'Xiaomi'||androidInfo.brand == 'Redmi') { - cPush.createNotificationChannel( - channelId: PushConfig.XMChannelID, - channelName: "消息推送", - channelDescription: - "The notification for chat message from Tencent Cloud IM" - ); - }else{ - cPush.createNotificationChannel( - channelId: PushConfig.OPPOChannelID, - channelName: "消息推送", - channelDescription: - "The notification for chat message from Tencent Cloud IM" - ); - } - // create new notification channel - - - - // require the permission for notification - cPush.requireNotificationPermission(); - - - } - - static Future getDeviceToken() async { - return cPush.getDevicePushToken(); - } - static Future uploadToken() async { - return await cPush.uploadToken(PushConfig.appInfo); - } - - static setBadgeNum(int unreadCount){ - cPush.setBadgeNum(unreadCount); - } - -} diff --git a/circle_app/lib/common/values/values.dart b/circle_app/lib/common/values/values.dart deleted file mode 100644 index e229336..0000000 --- a/circle_app/lib/common/values/values.dart +++ /dev/null @@ -1,13 +0,0 @@ -abstract class Values { - static const String images = 'assets/images/'; - static const String base_images = 'assets/images/base/'; - static const String login_images = 'assets/images/login/'; - static const String navigator_images = 'assets/images/navigator/'; - static const String tabbar_images = 'assets/images/tabbar/'; - static const String home_images = 'assets/images/home/'; - static const String mine_images = 'assets/images/mine/'; - static const String msg_images = 'assets/images/msg/'; - static const String circle_images = 'assets/images/circle/'; - static const String discover_images = 'assets/images/circle/'; - -} diff --git a/circle_app/lib/components/func_widget.dart b/circle_app/lib/components/func_widget.dart deleted file mode 100644 index f1cfce1..0000000 --- a/circle_app/lib/components/func_widget.dart +++ /dev/null @@ -1,20 +0,0 @@ -import 'package:circle_app/util/util.dart'; -import 'package:flutter/cupertino.dart'; - -class BgWidget extends StatelessWidget { - Widget widget; - - BgWidget({Key? key, required this.widget}) : super(key: key); - - @override - Widget build(BuildContext context) { - return Container( - width: MediaQuery.of(context).size.width, - height: MediaQuery.of(context).size.height, - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.fill, image: AssetImage(getBaseImage('home_back')))), - child: widget, - ); - } -} diff --git a/circle_app/lib/components/my_app_bar.dart b/circle_app/lib/components/my_app_bar.dart deleted file mode 100644 index 142577b..0000000 --- a/circle_app/lib/components/my_app_bar.dart +++ /dev/null @@ -1,130 +0,0 @@ - -import 'package:circle_app/router/app_routers.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; - -/// 自定义AppBar -class MyAppBar extends StatelessWidget implements PreferredSizeWidget { - - const MyAppBar({ - Key? key, - this.backgroundColor, - this.diyTitleWdiget, - this.title = '', - this.centerTitle = '', - this.actionWdiget, - this.backImg = 'assets/images/navigator/back.png', - this.backImgColor, - this.onPressed, - this.isDiyBack = false, - this.backPressed, - this.onCenterTitlePressed, - this.superContext, - this.backWdiget, - this.isBack = true - }): super(key: key); - - final Color? backgroundColor; - final String title; - final String centerTitle; - final String backImg; - final Color? backImgColor; - final Widget? actionWdiget; - final Widget? backWdiget; - final Widget? diyTitleWdiget; - final VoidCallback? onPressed; - final VoidCallback? onCenterTitlePressed; - final bool isBack; - final bool isDiyBack; - - final VoidCallback? backPressed; - final BuildContext? superContext; - - @override - Widget build(BuildContext context) { - final Color bgColor = backgroundColor ?? Colors.transparent; - - final SystemUiOverlayStyle overlayStyle = ThemeData.estimateBrightnessForColor(bgColor) == Brightness.dark - ? SystemUiOverlayStyle.light : SystemUiOverlayStyle.dark; - - final Widget action = actionWdiget == null ? Container() : GestureDetector( - onTap: onPressed, - child: actionWdiget, - ); - - final Widget back = isBack ? IconButton( - onPressed: isDiyBack ? backPressed : () async { - if (isDiyBack) { - if (backPressed != null) { - - - } else { - Navigator.pop(superContext!); - } - - } else { - FocusManager.instance.primaryFocus?.unfocus(); - final isBack = await Navigator.maybePop(context); - if (!isBack) { - await SystemNavigator.pop(); - } - } - }, - padding: EdgeInsets.only(left: 15.sp), - icon: Image.asset( - backImg, - width: 24.sp, - height: 24.sp, - ), - ) : isDiyBack! ? backWdiget! : Container(); - - Widget titleWidget = diyTitleWdiget != null ? diyTitleWdiget! : GestureDetector( - onTap: onCenterTitlePressed, - child: Semantics( - namesRoute: true, - header: true, - child: Container( - alignment: centerTitle.isEmpty ? Alignment.centerLeft : Alignment.center, - width: double.infinity, - margin: const EdgeInsets.symmetric(horizontal: 48.0), - child: ShaderMask( - shaderCallback: (Rect bounds) { - return const LinearGradient( - begin: Alignment(0.0,-1.0), - end: Alignment.bottomCenter, - colors: [Color(0xff71F3F2), Color(0xffF657FF)], - ).createShader(Offset.zero & bounds.size); - }, - child:Text( - title.isEmpty ? centerTitle : title, - style: TextStyle(fontSize: 18.sp,fontWeight: FontWeight.w600,color: Colors.white,shadows: [Shadow(color: Color(0xffF657FF), offset: Offset(0.0, -1))]), - ), - ), - )), - ); - - return AnnotatedRegion( - value: overlayStyle, - child: Material( - color: bgColor, - child: SafeArea( - child: Stack( - alignment: Alignment.centerLeft, - children: [ - titleWidget, - back, - Positioned( - right: 15.sp, - child: action), - ], - ), - ), - ), - ); - } - - @override - Size get preferredSize => const Size.fromHeight(48.0); -} diff --git a/circle_app/lib/network/api.dart b/circle_app/lib/network/api.dart deleted file mode 100644 index 13777c3..0000000 --- a/circle_app/lib/network/api.dart +++ /dev/null @@ -1,443 +0,0 @@ - - -class Api { - static const baseUrl2 = 'https://wlybiz.cdtszn.net/zuul-service/'; - static const baseUrl1 = 'https://wlybiz.leyuan666.com/zuul-service/'; - - static const baseUrl = 'http://192.168.3.5:2000/'; - - - // 获取验证码 - static const sendCode = 'msg-service/sms/code/send'; - - // 登录 - static const login = 'user-service/login/smscode'; - - // 登录 - static const new_login = 'user-service/login/password'; - - - //获取七牛token - static const getqiniuToken = 'up-service/oss/token'; - - - //上传个人资料 - static const UpdataUserInfo = 'user-service/register/user/info'; - - - //获取圈子列表 - static const getCircleList = 'user-service/app/config'; - - - //获取vip价格 - static const getVipPrice = 'mall-service/vips'; - - - //微信解锁配置信息 - static const queryUnlockPrice = '/mall-service/wxNum/unlock/queryUnlockPrice'; - - - //支付宝支付 - static const postAliPayOrder = 'mall-service/alipay/order'; - - - //微信支付 - static const postWxOrder = 'mall-service/wxpay/order'; - - - //vip状态 - static const getVipStatus = 'mall-service/my/vip'; - - - //刷新token - static const refreshToken = 'user-service/login/token/refresh'; - - - //圈子列表 - static const getCircleInterests = 'up-service/interest/interests'; - - - //版本信息 - static const APP_VERSION = 'user-service/app/version'; - - //入圈出圈 - static const outCrrcle = 'up-service/interest/'; - - - //发布喊话 - static const SendShout = 'up-service/callout'; - - - //mine 基本信息 - static const getUserMine = 'user-service/my/main'; - - //我关注的活跃用户列表 - static const activeUsers = '/user-service/follow/activeUsers'; - - - //访客未读消息 - static const getVisitorMsg = '/user-service/visit/getVisitorMsg'; - - //发消息是否需要vip弹窗 - static const getIsVips = 'mall-service/vips/show/'; - - //IM状态 - static const imstate = '/user-service/user/im/state'; - - - //检查ad号IM状态 - static const adImstate = '/user-service/user/chat/state/'; - - //发视频图片消息增加计数 - static const getAddTrialCount = 'mall-service/vips/trialCount/'; - - //访客信息匹配 - static const getVisitorTotal = '/user-service/visit/getVisitorTotal'; - - //个人信息 - static const getUserInfo = 'user-service/my/home'; - - - //他人信息 - static const getUserInfoTA = 'user-service/user/'; - - - //拉黑 - static const setBlock = 'user-service/user/'; - - //圈子代理人 - static const interestAgent = '/up-service/interest/agent/'; - - //申请圈子代理人 - static const applyToAgent = '/up-service/interest/applyToAgent/'; - - //打赏圈子代理人 - static const rewardAgent = '/up-service/interest/agent/reward'; - - - //喜欢 - static const setLike = 'user-service/user/'; - - - //注销账号 - static const offAccount = 'user-service/user/destroy'; - - - //绑定新手机号 - static const bindingPhoto = 'user-service/user/phone'; - - - //黑名单列表 - static const blackList = 'user-service/blacklist/users'; - - - //我的相册 - static const getMyAlbum = 'up-service/my/albums'; - - - //他的相册 - static const getTaAlbum = 'up-service/user/'; - - - //上传相册照片 - static const updataAlbum = 'up-service/album'; - - - //删除相册照片 - static const deleteAlbum = 'up-service/album/'; - - - //催更Ta的相册 - static const urgeAlbum = 'up-service/user/'; - - -//获取催更状态 - static const getUrgeStatus = 'up-service/user/'; - - - //关注列表 - static const followList = 'user-service/follow/users'; - - //互相喜欢 - static const mutualUsers = '/user-service/mutual/users'; - - //被关注列表 - static const fansList = 'user-service/fans/users'; - - //喜欢列表统计 - static const getFollowTotal = '/user-service/getFollowTotal/'; - - //被关注列表 - static const visitList = 'user-service/visit/users'; - - //召唤喜欢 - static const callMyFollow = '/user-service/callMyFollow'; - - - //举报 - static const postReport = 'up-service/report'; - - - //意见反馈 - static const getFeedBack = 'up-service/feedback'; - - - //意见反馈列表 - static const getFeedBackList = 'up-service/my/feedbacks'; - - - // //圈子访客记录 - // static const getInterestList = 'up-service/interest/20/users'; - - - //猜你想问 - static const getQuestions = 'up-service/guide/feedback/questions'; - - - //附近banner - static const getNearbyBeanner = 'user-service/nearby/banner'; - - - //附近列表 - static const postNearbyList = '/user-service/nearby/queryNearByUserList/v2'; - - - //获取定位城市 - static const getCity = '/user-service/nearby/getCity/'; - - //获取IM配置信息 - static const getIMInfo = 'msg-service/im/token'; - - //发现页统计 - static const getInterestsCount = 'user-service/my/statistics'; - - - // /up-service/my/interests /up-service/interest/statistics - - static const getMyCircleInterests = 'up-service/my/interests'; - - //我的所有圈子 - static const getMyCircleAll = '/up-service/my/interests/all'; - - //缘分匹配 - static const getMatch = 'msg-service/im/chat/match'; - - //系统通知 - static const getNotices = 'msg-service/notices'; - - - //敏感词-屏蔽词 校验 - static const shieldWordCheck = 'msg-service/word/check'; - - //苹果支付 - static const applePayCallBack = 'mall-service/payment/apple/notify'; - - //邀请好友主页 - static const inviteMainPage = 'user-service/invite/mainPage'; - - //邀请统计 - static const inviteTotal = '/user-service/invite/total'; - //系统随机的邀请记录 - static const inviteSysRecord = 'user-service/invite/record/rand'; - - //邀请记录 - static const inviteRecord = '/user-service/invite/record'; - - //邀请总榜 - static const inviteRankRecord = '/user-service/invite/rank/all'; - - //填写邀请码 - static const inviteFillIn = 'user-service/invite/fillin'; - - //微信解锁 - static const UnlockWx = 'user-service/wxNum/unlock'; - - //微信号填写文案 - static const popWxNumStr = 'user-service/content/popup/contact'; - - //微信号修改 - static const updateWxNum = 'user-service/updateWxNum'; - - - //发现数据 - static const findPage = 'user-service/findPage/userList'; - - - //不感兴趣 - static const uninterested = 'user-service/findPage/uninterested/'; - - //发现单个用户数据 - static const getFindPageUserByUserId = 'user-service/findPage/getUserByUserId'; - - //修改密码 - static const userUpdatePassword = 'user-service/userUpdatePassword'; - - - //重置密码 - static const resetPassword = '/user-service/register/user/password/reset'; - - //获取多个圈子是否有新喊话 - static const calloutsNew = '/up-service/interests/callouts/new'; - -//是否置顶圈子 - static const circleTop = '/up-service/interest/top'; - - //是否隐藏微信号 - static const hideWxNum = '/user-service/hideWxNum/'; - - //设置联系方式信息 - static const confset = '/user-service/contact/conf/set'; - - - //是否显示好评反馈 - static const showPositiveFeedBack = '/up-service/showPositiveFeedBack'; - - //钱包充值选项查询 - static const walletRechargeSelectItem = '/mall-service/wallet/walletRechargeConfig'; - - //用户资产 - static const userAsset = '/mall-service/wallet/userAsset'; - - //账单 - static const userBill = '/mall-service/wallet/userBill'; - - static const rechargeOrder = '/mall-service/wallet/walletRechargeConfig'; - - static const sendGift = '/mall-service/gift/sendGift'; - - //新人欢迎 - static const sayHelloV2 = '/user-service/newUser/sayHelloV2/'; - - //礼物列表 - static const giftList = '/mall-service/gift/giftMall'; - - //礼物墙 - static const giftHall = '/mall-service/gift/giftHall/'; - - //速聊推荐 - static const recommendQuickChatUser = '/msg-service/recommendQuickChatUser'; - - //速聊推荐 - static const queryQuickChatUserV2 = '/msg-service/queryQuickChatUser/v2'; - - //站外分享 - static const offSite = '/up-service/share/offSite'; - - //抢占第一 - static const startQuick = '/msg-service/startQuick'; - - - //是否开启速聊 - static const queryQuickStart = '/msg-service/queryQuickStart'; - - //不显示在速聊列表 - static const stopQuick = '/msg-service/stopQuick'; - - //呼唤30人 - static const callOthers = '/msg-service/call/others'; - - - //获取一条招呼语 - static const msgRandOne = '/msg-service/message/hello_word/randOne'; - - //检查更新微信权限 - static const checkWxNumState = '/user-service/user/updateWxNum/state'; - - //保存聊天记录 - static const chatRecord = '/msg-service/message/chat/log/save'; - - //聊天推荐圈友 - static const chatRecommendFriend = '/msg-service/im/chat/recommend/v2'; - - //是否显示送礼物 - static const isShow_give_gift = '/msg-service/message/show_give_gift/'; - - //想要微信 - static const noticeWxNum = '/user-service/user/updateWxNum/notice/'; - - //是否弹窗 - static const popup = '/user-service/follow/popup/'; - - //获取普通活动 - static const getNormalActivity = '/msg-service/activity/normal'; - - //获取系列活动 - static const getSeriesActivity = '/msg-service/activity/series'; - - //获取系列活动详细信息 - static const getActivityDetail = '/msg-service/activity/series/detail/'; - - //查询当前版本环境 - static const getAppEnv = '/user-service/app/env'; - - //查询是否可以领取新人奖励 - static var newUserConfig = '/user-service/popup/newUser/config'; - - //领取新人奖励 - static const receiveToDayReward = '/user-service/popup/newUser/receiveToDayReward'; - - - //获取用户联系方式信息 - static const mycontactConf = '/user-service/contact/conf/get'; - - //获取用户联系方式信息 - static const contactConf = '/user-service/contact/user/conf/get/'; - - //微信更新状态查询 - static const updateWxNumState = '/user-service/user/updateWxNum/state'; - - - //微信解锁 - static const unlockWx = '/user-service/contact/unlock'; - - //联系方式解锁状态 - static const unlockStatus = '/user-service/contact/unlock/status'; - - - - //三方解锁wx - static const buyUnlock = 'mall-service/wxNum/unlock/buyUnlock'; - - - //想要微信 - static const wahtWxNum = '/user-service/user/updateWxNum/notice/'; - - //小票解锁微信 - static const balanceUnlockWX = '/user-service/contact/unlock/balance'; - - - - //获取用户解锁微信号设置信息 - static const wxNumConfig = '/user-service/contact/user/conf/get/'; - - //新人列表 - static const queryNewUserList = '/user-service/newUser/queryNewUserList'; - - //30人打招呼 - static const sayHelloMore = '/user-service/newUser/sayHelloMore'; - - //打招呼 - static const sayHello = '/user-service/newUser/sayHello/'; - - //访问多次且未关注的用户列表 - static const interestedInMeUsers = '/user-service/visit/allInterestedInMeUsers'; - - - //批量关注用户 - static const allUserFollow = '/user-service/follow/users'; - - //全球喊话 - static const worldCallouts = '/up-service/world/callouts'; - - //多次打开会员弹窗是否显示邀请得会员入口 - static const showInvite = 'mall-service/vips/showInvite'; - - //分类下的圈子列表 - static const categoryInterests = '/up-service/interest/category/interests'; - - //圈子分类 - static const categoriesList = '/up-service/interest/categories'; - - //good认证发送 - static const goodAuth = '/user-service/user/goodAuth'; -} \ No newline at end of file diff --git a/circle_app/lib/network/dio_manager.dart b/circle_app/lib/network/dio_manager.dart deleted file mode 100644 index 6ca99f7..0000000 --- a/circle_app/lib/network/dio_manager.dart +++ /dev/null @@ -1,410 +0,0 @@ -import 'dart:convert'; -import 'dart:io'; -import 'dart:math'; -import 'package:circle_app/router/app_routers.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:dio/dio.dart'; - -import '../util/SharedPreferencesHelper.dart'; -import '../util/device.dart'; -import 'api.dart'; -import 'package:connectivity/connectivity.dart'; - -// const String baseUrl = Api.baseUrl; - -/// Dio 请求方法 - -enum DioMethod { - get, - post, - put, - delete, - postBody, -} - -class DioManager { - factory DioManager() => getInstance(); - - static DioManager get instance => getInstance(); - static DioManager? _instance; - - static DioManager getInstance() { - if (_instance == null) { - _instance = DioManager._init(); - } - return _instance!; - } - - Dio? _dio; - - DioManager._init() { - int type = Random().nextInt(2); - _dio ??= Dio(BaseOptions( - // baseUrl2 - baseUrl: - // Api.baseUrl2, - // Api.baseUrl, - - type == 1 ? Api.baseUrl2 : Api.baseUrl1, - // 连接服务器超时时间,单位是毫秒 - connectTimeout: const Duration(seconds: 30), - // 接收数据的最长时限 - receiveTimeout: const Duration(seconds: 30), - )); - _dio!.interceptors.add(LogInterceptor( - responseBody: true, - )); - _dio!.interceptors.add(ConnectivityInterceptor()); - } - - setReceiveTimeout (int time) { - _dio!.options = BaseOptions( - // 请求基地址 - baseUrl: _dio!.options!.baseUrl, - // 连接服务器超时时间,单位是毫秒 - connectTimeout: const Duration(seconds: 30), - // 接收数据的最长时限 - receiveTimeout: Duration(seconds: time), - ); - } - - Future download(String urlPath, String savePath, - ProgressCallback progressCallback) async { - return await _dio! - .download(urlPath, savePath, onReceiveProgress: progressCallback); - } - - /// get请求 - /// [isShowErrorToast] 出现错误的情况是否自动弹窗提示错误,默认true - /// [isAddTokenInHeader] 请求头是否添加token - /// [fromJson]是将json转为model的方法 - Future get({ - required String url, - bool isShowErrorToast = true, - bool isAddTokenInHeader = true, - Map? params, - }) async { - return await requestHttp( - url, - method: DioMethod.get, - isShowErrorToast: isShowErrorToast, - params: params, - ); - } - - /// post 请求 - Future post( - {required String url, - Map? params, - bool isAddTokenInHeader = true, - bool isShowErrorToast = true, - FormData? formData, - CancelToken? cancelToken, - ProgressCallback? onSendProgress, - ProgressCallback? onReceiveProgress}) async { - return await requestHttp(url, - method: DioMethod.post, - isShowErrorToast: isShowErrorToast, - params: params, - formData: formData, - cancelToken: cancelToken, - onSendProgress: onSendProgress, - onReceiveProgress: onReceiveProgress); - } - - /// post 请求 - Future postBody({required String url, - Map? params, - bool isAddTokenInHeader = true, - bool isShowErrorToast = true, - FormData? formData, - CancelToken? cancelToken, - ProgressCallback? onSendProgress, - ProgressCallback? onReceiveProgress}) async { - return await requestHttp(url, - method: DioMethod.postBody, - isShowErrorToast: isShowErrorToast, - params: params, - formData: formData, - cancelToken: cancelToken, - onSendProgress: onSendProgress, - onReceiveProgress: onReceiveProgress); - } - - /// put 请求 - Future put({ - required String url, - Map? params, - bool isAddTokenInHeader = true, - bool isShowErrorToast = true, - FormData? formData, - CancelToken? cancelToken, - ProgressCallback? onSendProgress, - ProgressCallback? onReceiveProgress, - }) async { - return await requestHttp( - url, - method: DioMethod.put, - // 修改请求方法为 put - isShowErrorToast: isShowErrorToast, - params: params, - formData: formData, - cancelToken: cancelToken, - onSendProgress: onSendProgress, - onReceiveProgress: onReceiveProgress, - ); - } - - Future delete({ - required String url, - Map? params, - bool isAddTokenInHeader = true, - bool isShowErrorToast = true, - FormData? formData, - CancelToken? cancelToken, - ProgressCallback? onSendProgress, - ProgressCallback? onReceiveProgress, - }) async { - return await requestHttp( - url, - method: DioMethod.delete, - // 修改请求方法为 delete - isShowErrorToast: isShowErrorToast, - params: params, - formData: formData, - cancelToken: cancelToken, - onSendProgress: onSendProgress, - onReceiveProgress: onReceiveProgress, - ); - } - - /// Dio request 方法 - Future requestHttp(String url, - {DioMethod method = DioMethod.get, - Map? params, - bool isShowErrorToast = true, - bool isAddTokenInHeader = true, - FormData? formData, - CancelToken? cancelToken, - ProgressCallback? onSendProgress, - ProgressCallback? onReceiveProgress}) async { - const methodValues = { - DioMethod.get: 'get', - DioMethod.post: 'post', - DioMethod.delete: 'delete', - DioMethod.put: 'put' - }; - var connectivityResult = await Connectivity().checkConnectivity(); - - if (connectivityResult == ConnectivityResult.none) { - // showOKToast("网络不流畅哦,请检查网络情况"); - return {'code': 404, 'msg': '网络不流畅哦,请检查网络情况'}; - } - - try { - Response response; - - var options = Options(); - bool isAgreemement = await getAgreemement(); - if (isAgreemement) { - options = Options(method: methodValues[method], headers: { - "Authorization": await getAuthorization(), - 'VersionName': await getVersionName(), - 'VersionCode': await getVersionCode(), - 'Platform': Platform.isIOS ? '1' : '0', - 'OsVersion': await getDeviceId(), - 'Imei': await getImei(), - 'Brand': await getBrand(), - }); - } else { - options = Options(method: methodValues[method], headers: { - "Authorization": await getAuthorization(), - 'VersionName': await getVersionName(), - 'VersionCode': await getVersionCode(), - 'Platform': Platform.isIOS ? '1' : '0', - }); - } - - print(">>>>>$params"); - - /// 不同请求方法,不同的请求参数,按实际项目需求分. - /// 这里 get 是 queryParameters,其它用 data. FormData 也是 data - /// 注意: 只有 post 方法支持发送 FormData. - switch (method) { - case DioMethod.get: - response = await _dio! - .request(url, queryParameters: params, options: options); - break; - case DioMethod.post: - response = await _dio!.post(url, - data: params, cancelToken: cancelToken, options: options); - break; - case DioMethod.postBody: - response = await _dio!.post( - url, data: params, cancelToken: cancelToken, options: options); - break; - case DioMethod.put: - response = - await _dio!.put(url, data: json.encode(params), options: options); - break; - case DioMethod.delete: - response = await _dio! - .delete(url, queryParameters: params, options: options); - break; - default: - // 如果有formData参数,说明是传文件,忽略params的参数 - if (formData != null) { - response = await _dio!.post(url, - data: formData, - cancelToken: cancelToken, - onSendProgress: onSendProgress, - onReceiveProgress: onReceiveProgress); - } else { - response = await _dio!.request(url, - data: params, cancelToken: cancelToken, options: options); - } - } - // json转model - String jsonStr = json.encode(response.data); - Map responseMap = json.decode(jsonStr); - if (responseMap["code"] == 5003 || responseMap["code"] == 30003) { - showOKToast(responseMap['msg']); - pushLoginPage(); - } else { - switch (responseMap["code"]) { - case 4001: - case 4002: - case 4003: - case 4004: - case 4100: - case 4101: - case 4102: - case 5002: - case 5001: - case 5000: - pushLoginPage(); - break; - } - if (responseMap["code"] != 200 && responseMap["code"] != 10000 && !url.contains(Api.checkWxNumState) && responseMap["code"] != 21201 && responseMap['code'] != 32104) { - showOKToast(responseMap['msg']); - } - } - return responseMap; - } on DioException catch (e) { - SharedPreferencesHelper sp = await SharedPreferencesHelper.getInstance(); - if (sp.getString(SharedPreferencesHelper.LOGINPHONE) == '18800000100') { - return {'code': 500, 'msg': ''}; - } - return {'code': 500, 'msg': '服务器开小差了,请重试'}; - } catch (e) { - SharedPreferencesHelper sp = await SharedPreferencesHelper.getInstance(); - if (sp.getString(SharedPreferencesHelper.LOGINPHONE) == '18800000100') { - return {'code': 500, 'msg': ''}; - } - - // 其他一些意外的报错 - return {'code': 500, 'msg': '加载中...'}; - } - } -// -// // 错误判断 -// void onErrorInterceptor(DioError err) { -// // 异常分类 -// switch (err.type) { -// // 4xx 5xx response -// case DioErrorType.response: -// err.requestOptions.extra["errorMsg"] = err.response?.data ?? "连接异常"; -// break; -// case DioErrorType.connectTimeout: -// err.requestOptions.extra["errorMsg"] = "连接超时"; -// break; -// case DioErrorType.sendTimeout: -// err.requestOptions.extra["errorMsg"] = "发送超时"; -// break; -// case DioErrorType.receiveTimeout: -// err.requestOptions.extra["errorMsg"] = "接收超时"; -// break; -// case DioErrorType.cancel: -// err.requestOptions.extra["errorMsg"] = -// err.message.isNotEmpty ? err.message : "取消连接"; -// break; -// case DioErrorType.other: -// default: -// err.requestOptions.extra["errorMsg"] = "连接异常"; -// break; -// } -// } -} - -class BaseResponse { - int code; - String msg; - dynamic? data; - - BaseResponse({required this.code, required this.msg, required this.data}); - - isSuccess() { - return code == 200; - } - - factory BaseResponse.fromJson( - Map json, T Function(dynamic) fromJsonData) { - dynamic dataJson = json['data']; - T? data; - - if (dataJson != null) { - if (dataJson is String) { - // 处理 dataJson 是 String 类型的情况 - // 例如,可以直接将其赋值给 data 变量 - data = null; // 根据你的需求修改赋值语句 - } else if (dataJson is Map) { - // 处理 dataJson 是 Map 类型的情况 - if (fromJsonData != null) { - data = fromJsonData(dataJson); - } else { - throw Exception('未提供 fromJsonData 函数来解析数据。'); - } - } else if (dataJson is List) { - data = fromJsonData(dataJson); - } else { - throw Exception('无效的数据格式。期望是 String 或 Map 类型。'); - } - } - - return BaseResponse( - code: json['code'], - msg: json['msg'], - data: data, - ); - } -} - -class ConnectivityInterceptor extends Interceptor { - @override - Future onRequest( - RequestOptions options, RequestInterceptorHandler handler) async { - if (!await isInternetAvailable()) { - showOKToast("网络不流畅哦,请检查网络情况"); - } - return handler.next(options); - } - - Future isInternetAvailable() async { - var connectivityResult = await Connectivity().checkConnectivity(); - return connectivityResult != ConnectivityResult.none; - } -} - -class QnTokenData { - final String token; - final String cdnPrefix; - - QnTokenData({required this.token, required this.cdnPrefix}); - - factory QnTokenData.fromJson(Map json) { - return QnTokenData( - token: json['token'], - cdnPrefix: json['cdn_prefix'], - ); - } -} diff --git a/circle_app/lib/router/app_pages.dart b/circle_app/lib/router/app_pages.dart deleted file mode 100644 index ea43691..0000000 --- a/circle_app/lib/router/app_pages.dart +++ /dev/null @@ -1,286 +0,0 @@ -import 'package:circle_app/app/aboutapp/binding.dart'; -import 'package:circle_app/app/aboutapp/view.dart'; -import 'package:circle_app/app/account/binding.dart'; -import 'package:circle_app/app/account/view.dart'; -import 'package:circle_app/app/bill/binding.dart'; -import 'package:circle_app/app/bill/view.dart'; -import 'package:circle_app/app/bindmail/binding.dart'; -import 'package:circle_app/app/bindmail/view.dart'; -import 'package:circle_app/app/blacklist/binding.dart'; -import 'package:circle_app/app/call_out/binding.dart'; -import 'package:circle_app/app/call_out/view.dart'; -import 'package:circle_app/app/chat/binding.dart'; -import 'package:circle_app/app/chat/view.dart'; -import 'package:circle_app/app/circle/discover_page.dart'; -import 'package:circle_app/app/circle/view.dart'; -import 'package:circle_app/app/edit_pwd/binding.dart'; -import 'package:circle_app/app/edit_pwd/view.dart'; -import 'package:circle_app/app/feedback/binding.dart'; -import 'package:circle_app/app/feedback/view.dart'; -import 'package:circle_app/app/friendslist/binding.dart'; -import 'package:circle_app/app/friendslist/view.dart'; -import 'package:circle_app/app/gift_shop/binding.dart'; -import 'package:circle_app/app/gift_shop/view.dart'; -import 'package:circle_app/app/help/binding.dart'; -import 'package:circle_app/app/help/view.dart'; -import 'package:circle_app/app/home/binding.dart'; -import 'package:circle_app/app/home/view.dart'; -import 'package:circle_app/app/invite/binding.dart'; -import 'package:circle_app/app/invite/view.dart'; -import 'package:circle_app/app/likelist/binding.dart'; -import 'package:circle_app/app/likelist/view.dart'; -import 'package:circle_app/app/login/login/view.dart'; -import 'package:circle_app/app/minefragment/binding.dart'; -import 'package:circle_app/app/minefragment/view.dart'; -import 'package:circle_app/app/msg/binding.dart'; -import 'package:circle_app/app/msg/sys_notify_list/binding.dart'; -import 'package:circle_app/app/msg/sys_notify_list/view.dart'; -import 'package:circle_app/app/msg/view.dart'; -import 'package:circle_app/app/my_assets/view.dart'; -import 'package:circle_app/app/my_circle/binding.dart'; -import 'package:circle_app/app/my_circle/view.dart'; -import 'package:circle_app/app/myfeedbacklist/binding.dart'; -import 'package:circle_app/app/myfeedbacklist/view.dart'; -import 'package:circle_app/app/offaccount/binding.dart'; -import 'package:circle_app/app/offaccount/view.dart'; -import 'package:circle_app/app/photoinfo/binding.dart'; -import 'package:circle_app/app/photoinfo/view.dart'; -import 'package:circle_app/app/privacy/view.dart'; -import 'package:circle_app/app/quick/view.dart'; -import 'package:circle_app/app/report/binding.dart'; -import 'package:circle_app/app/report/view.dart'; -import 'package:circle_app/app/reset_pwd/binding.dart'; -import 'package:circle_app/app/reset_pwd/view.dart'; -import 'package:circle_app/app/select_circle/binding.dart'; -import 'package:circle_app/app/select_circle/view.dart'; -import 'package:circle_app/app/setpassword/binding.dart'; -import 'package:circle_app/app/setpassword/view.dart'; -import 'package:circle_app/app/setup/binding.dart'; -import 'package:circle_app/app/setup/view.dart'; -import 'package:circle_app/app/login/complete_material/binding.dart'; -import 'package:circle_app/app/login/complete_material/view.dart'; -import 'package:circle_app/app/signal_circle_list/binding.dart'; -import 'package:circle_app/app/signal_circle_list/view.dart'; -import 'package:circle_app/app/splash/binding.dart'; -import 'package:circle_app/app/swiper/binding.dart'; -import 'package:circle_app/app/swiper/view.dart'; -import 'package:circle_app/app/userinfo/binding.dart'; -import 'package:circle_app/app/userinfo/view.dart'; - -import 'package:circle_app/app/visitorlist/view.dart'; -import 'package:circle_app/app/webview/binding.dart'; -import 'package:circle_app/app/webview/view.dart'; -import 'package:circle_app/app/world_call_out/view.dart'; -import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; -import 'package:get/get_navigation/src/routes/get_route.dart'; - -import '../app/blacklist/view.dart'; -import '../app/circle/binding.dart'; -import '../app/externalshare/binding.dart'; -import '../app/externalshare/view.dart'; -import '../app/good_reviews/binding.dart'; -import '../app/good_reviews/view.dart'; -import '../app/invent_record/binding.dart'; -import '../app/invent_record/view.dart'; -import '../app/msg/series/binding.dart'; -import '../app/msg/series/view.dart'; -import '../app/my_assets/binding.dart'; -import '../app/privacy/binding.dart'; -import '../app/quick/binding.dart'; -import '../app/splash/view.dart'; -import '../app/visitorlist/binding.dart'; -import 'app_routers.dart'; - -class AppPages { - static final routes = [ - GetPage( - name: AppRoutes.Home, - page: () => HomePage(), - binding: HomeBinding(), - ), - GetPage( - name: AppRoutes.Complete_materialPage, - page: () => Complete_materialPage(), - binding: Complete_materialBinding(), - ), - GetPage( - name: AppRoutes.MineFragment, - page: () => MinefragmentPage(), - binding: MinefragmentBinding(), - ), - GetPage( - name: AppRoutes.SetUpActivity, - page: () => SetupPage(), - binding: SetupBinding(), - ), - GetPage( - name: AppRoutes.AccountActivity, - page: () => AccountPage(), - binding: AccountBinding(), - ), - GetPage( - name: AppRoutes.PhotoActivity, - page: () => PhotoinfoPage(), - binding: PhotoinfoBinding(), - ), - GetPage( - name: AppRoutes.AboutAppActivity, - page: () => AboutappPage(), - binding: AboutappBinding(), - ), - GetPage( - name: AppRoutes.BlackActivity, - page: () => BlacklistPage(), - binding: BlacklistBinding(), - ), - GetPage( - name: AppRoutes.HelpActivity, - page: () => HelpPage(), - binding: HelpBinding(), - ), - GetPage( - name: AppRoutes.FriendsActivity, - page: () => FriendslistPage(), - binding: FriendslistBinding(), - ), - GetPage( - name: AppRoutes.UserInfoActivity, - page: () => UserinfoPage(), - binding: UserinfoBinding(), - ), - GetPage( - name: AppRoutes.Call_out, - page: () => Call_outPage(), - binding: Call_outBinding(), - ), - GetPage(name: AppRoutes.Login, page: () => LoginPage()), - GetPage( - name: AppRoutes.ReportActivity, - page: () => ReportPage(), - binding: ReportBinding(), - ), - GetPage( - name: AppRoutes.FeedbackActivity, - page: () => FeedbackPage(), - binding: FeedbackBinding(), - ), - GetPage( - name: AppRoutes.BindMailActivity, - page: () => BindmailPage(), - binding: BindmailBinding(), - ), - GetPage( - name: AppRoutes.Swiper, - page: () => SwiperPage(), - binding: SwiperBinding(), - ), - GetPage( - name: AppRoutes.OffAccountActivity, - page: () => OffaccountPage(), - binding: OffaccountBinding(), - ), - GetPage( - name: AppRoutes.WebViewActivity, - page: () => WebviewPage(), - binding: WebviewBinding(), - ), - GetPage( - name: AppRoutes.Chat, - page: () => ChatPage(), - // binding: ChatBinding(), - ), - GetPage( - name: AppRoutes.SelectCircleActivity, - page: () => Select_circlePage(), - binding: Select_circleBinding(), - ), - GetPage( - name: AppRoutes.SplashActivity, - page: () => SplashPage(), - binding: SplashBinding(), - ), - GetPage( - name: AppRoutes.MyCircle, - page: () => My_circlePage(), - binding: My_circleBinding(), - ), - GetPage( - name: AppRoutes.MyFeedBackListActivity, - page: () => MyfeedbacklistPage(), - binding: MyfeedbacklistBinding(), - ), - GetPage( - name: AppRoutes.LikeListActivity, - page: () => LikelistPage(), - binding: LikelistBinding(), - ), - GetPage( - name: AppRoutes.VisitorListActivity, - page: () => VisitorlistPage(), - binding: VisitorlistBinding(), - ), - GetPage( - name: AppRoutes.Sys_notify_list, - page: () => Sys_notify_listPage(), - binding: Sys_notify_listBinding(), - ), - GetPage( - name: AppRoutes.PrivacyActivity, - page: () => PrivacyPage(), - binding: PrivacyBinding(), - ), - GetPage( - name: AppRoutes.Signal_circle_list, - page: () => Signal_circle_listPage(), - binding: Signal_circle_listBinding(), - ), - GetPage( - name: AppRoutes.Invite, - page: () => InvitePage(), - binding: InviteBinding(), - ), - GetPage(name: AppRoutes.DisCover, page: () => DiscoverPage()), - GetPage( - name: AppRoutes.SetPasswordActivity, - page: () => SetpasswordPage(), - binding: SetpasswordBinding(), - ), - GetPage( - name: AppRoutes.EditPwd, - page: () => Edit_pwdPage(), - binding: Edit_pwdBinding(), - ), - GetPage( - name: AppRoutes.ResetPwd, - page: () => Reset_pwdPage(), - binding: Reset_pwdBinding(), - ), - GetPage( - name: AppRoutes.ExternalsharePage, - page: () => ExternalsharePage(), - binding: ExternalshareBinding(), - ), - GetPage( - name: AppRoutes.Good_Reviews, - page: () => Good_reviewsPage(), - binding: Good_reviewsBinding(), - ), - GetPage(name: AppRoutes.MyAssets, page: () => My_assetsPage(), - binding: My_assetsBinding(),), - GetPage(name: AppRoutes.BillActivity, page: () => BillPage(), - binding: BillBinding(),), - GetPage(name: AppRoutes.GiftShopPage, page: () => Gift_shopPage(), - binding: Gift_shopBinding(),), - GetPage(name: AppRoutes.Quick, page: () => QuickPage(), - binding: QuickBinding(),), - GetPage( - name: AppRoutes.SeriesPage, - page: () => SeriesPage(), - binding: SeriesBinding(), - ), - GetPage( - name: AppRoutes.Invite_Record, - page: () => Invent_recordPage(), - binding: Invent_recordBinding()), - ]; -} diff --git a/circle_app/lib/router/app_routers.dart b/circle_app/lib/router/app_routers.dart deleted file mode 100644 index 4fd8a6d..0000000 --- a/circle_app/lib/router/app_routers.dart +++ /dev/null @@ -1,58 +0,0 @@ -abstract class AppRoutes { - static const Home = '/home'; - static const Complete_materialPage = '/Complete_materialPage'; - static const Call_out = '/Call_out'; - static const Login = '/Login'; - static const MineFragment = '/home/minefragment'; - static const SetUpActivity = '/user/SetUpActivity'; - static const AccountActivity = '/user/AccountActivity'; - static const PhotoActivity = '/user/PhotoActivity'; - static const AboutAppActivity = '/user/AboutAppActivity'; - static const BlackActivity = '/user/BlackActivity'; - static const HelpActivity = '/user/HelpActivity'; - static const FriendsActivity = '/user/FriendsActivity'; - static const LikeListActivity = '/user/LikeListActivity'; - static const VisitorListActivity = '/user/VisitorListActivity'; - static const UserInfoActivity = '/user/UserInfoActivity'; - static const ReportActivity = '/user/ReportActivity'; - static const FeedbackActivity = '/user/FeedbackActivity'; - static const BindMailActivity = '/user/BindMailActivity'; - static const TextActivity = '/user/TextActivity'; - static const Swiper = '/user/Swiper'; - static const OffAccountActivity = '/user/OffAccountActivity'; - static const WebViewActivity = '/user/WebViewActivity'; - static const Chat = '/chat'; - static const SelectCircleActivity = '/user/SelectCircleActivity'; - static const SplashActivity = '/user/SplashActivity'; - static const MyCircle = '/myCircle'; - static const SetPasswordActivity = '/SetPasswordActivity'; - static const MyFeedBackListActivity = '/mine/MyFeedBackListActivity'; - static const SeriesPage = '/notice/SeriesPage'; - static const Sys_notify_list = '/msg/Sys_notify_list'; - static const Invite_Record = '/Invite/record'; - static const PrivacyActivity = '/user/PrivacyActivity'; - - static const Signal_circle_list = '/msg/chat/signal_circle_list'; - - static const Invite = '/mine/invite'; - - static const DisCover = '/DisCover'; - - static const EditPwd = '/mine/EditPwd'; - static const ResetPwd = '/mine/EditPwd/ResetPwd'; - - static const ExternalsharePage = '/ExternalsharePage'; - - static const Good_Reviews = '/Good_Reviews'; - - static const MyAssets = '/MyAssets'; - - static const BillActivity = '/BillActivity'; - - static const GiftShopPage = '/GiftShopPage'; - - static const Quick = '/msg/quick'; - - static const WorldCallOut = '/world_call_out'; - -} \ No newline at end of file diff --git a/circle_app/lib/util/CacheUtil.dart b/circle_app/lib/util/CacheUtil.dart deleted file mode 100644 index 39d8ddf..0000000 --- a/circle_app/lib/util/CacheUtil.dart +++ /dev/null @@ -1,163 +0,0 @@ -import 'dart:io'; -import 'package:circle_app/util/util.dart'; -import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; -import 'package:get/get.dart'; -import 'package:path_provider/path_provider.dart'; - -class CacheUtil { - static dynamic loadCache() async { - try { - final _tempDir = await getTemporaryDirectory(); - double value = await _getTotalSizeOfFilesInDir(_tempDir); - /*tempDir.list(followLinks: false,recursive: true).listen((file){ - //打印每个缓存文件的路径 - print(file.path); - });*/ - var filePath = await getApplicationSupportDirectoryPath(); - Directory directory = Directory(filePath); // 替换为您想要获取大小的目录路径 - int totalSize = 0; - - if (directory.existsSync()) { - await for (var entity in directory.list(recursive: true)) { - if (entity is File) { - totalSize += await entity.length(); - } - } - } - if(totalSize<600000){ - return _renderSize(value); - } - print('临时目录大小: ' + value.toString()+"\\\\"+totalSize.toString()); - return _renderSize(value+totalSize); - } catch (err) { - print(err); - } - } - - getDirectorySize(Directory directory) async { - int totalSize = 0; - - if (directory.existsSync()) { - await for (var entity in directory.list(recursive: true)) { - if (entity is File) { - totalSize += await entity.length(); - } - } - } - - return totalSize; - } - ///递归方式删除目录 - static Future delDir(FileSystemEntity file) async { - try { - if (file is Directory) { - final List children = file.listSync(); - for (final FileSystemEntity child in children) { - await delDir(child); - } - } - await file.delete(); - } catch (e) { - print(e); - } - } - - static Future _getTotalSizeOfFilesInDir( - final FileSystemEntity file) async { - try { - if (file is File) { - int length = await file.length(); - return double.parse(length.toString()); - } - if (file is Directory) { - final List children = file.listSync(); - double total = 0; - if (children != null) - for (final FileSystemEntity child in children) - total += await _getTotalSizeOfFilesInDir(child); - return total; - } - return 0; - } catch (e) { - print(e); - return 0; - } - } - - ///格式化文件大小 - static _renderSize(double value) { - List unitArr = [] - ..add('B') - ..add('K') - ..add('M') - ..add('G'); - int index = 0; - while (value > 1024) { - index++; - value = value / 1024; - } - String size = value.toStringAsFixed(2); - return size + unitArr[index]; - } - - static clearCache(MyCallback callback) async { - //此处展示加载loading - try { - final _tempDir = await getTemporaryDirectory(); - double value = await _getTotalSizeOfFilesInDir(_tempDir); - print("$value"); - - var filePath = await getApplicationSupportDirectoryPath(); - Directory directory = Directory(filePath); // 替换为您想要获取大小的目录路径 - int totalSize = 0; - - if (directory.existsSync()) { - await for (var entity in directory.list(recursive: true)) { - if (entity is File) { - totalSize += await entity.length(); - } - } - } - - - if (value.toInt() <= 0&&totalSize<=0) { - showOKToast("暂无缓存"); - - // Get.back(); - } else if (value >= 0) { - // Get.back(); - //showToast("正在清理中···"); - SmartDialog.showLoading(msg: "正在清理中···"); - var filePath = await getApplicationSupportDirectoryPath(); - - Future.delayed(const Duration(seconds: 0), () async { - //删除缓存目录 - await delDir(_tempDir); - // File(filePath).delete(); - - if (await directory.exists()) { - await for (var entity in directory.list(recursive: false)) { - if (entity is File) { - await entity.delete(); - } - } - } - - - - await loadCache(); - SmartDialog.dismiss(); - showOKToast("清理缓存成功"); - callback("0KB"); - }); - return "正在清理中···"; - } - } catch (e) { - print(e); - SmartDialog.dismiss(); - showOKToast("清除缓存失败"); - - } - } -} -typedef void MyCallback(String result); \ No newline at end of file diff --git a/circle_app/lib/util/PaymentUtils.dart b/circle_app/lib/util/PaymentUtils.dart deleted file mode 100644 index 7918087..0000000 --- a/circle_app/lib/util/PaymentUtils.dart +++ /dev/null @@ -1,109 +0,0 @@ - -import 'dart:async'; - -import 'package:alipay_kit/alipay_kit.dart'; -import 'package:circle_app/util/util.dart'; - -import '../common/Widgets/open_vip_tip/logic.dart'; -import 'package:fluwx/fluwx.dart' as fluwx; - - - -//注册微信 -void initWxApi() { - fluwx.registerWxApi( - appId: "wxab2387c2198f01e1", - universalLink: "https://www.leyuan666.com/", - ); -} - -//微信支付 -typedef WxPayCallback = void Function(bool isSuccess, String? errorMessage); - -Future openWxPay(PaymentData data, WxPayCallback callback) async { - // 是否安装微信 - bool isInstalled = await fluwx.isWeChatInstalled; - if (!isInstalled) { - showOKToast("请先安装微信"); - callback(false, "请先安装微信"); - return; - } - - // 调起支付 - fluwx.payWithWeChat( - appId: data.appId, - partnerId: data.mchId, - prepayId: data.prepayId, - packageValue: data.packageX, - nonceStr: data.nonceStr, - timeStamp: int.parse(data.timestamp), - sign: data.sign, - ); - - // 监听微信回调 - fluwx.weChatResponseEventHandler.listen((event) { - if (event.isSuccessful) { - showOKToast("微信支付成功"); - callback(true, null); - - } else { - print(event.errStr); - showOKToast(event.errStr ?? "微信支付失败"); - callback(false, event.errStr); - } - }); -} - - StreamSubscription? _paySubs = null; - -/// 返回码,标识支付状态,含义如下: -/// 9000——订单支付成功 下面的result有值 -/// 8000——正在处理中 -/// 4000——订单支付失败 -/// 5000——重复请求 -/// 6001——用户中途取消 -/// 6002——网络连接出错 -void _listenPay(AlipayResp resp) { - final String content = 'pay: ${resp.resultStatus} - ${resp.result}'; - if (resp.resultStatus == 9000) { - callback(true, resp.result); - } else { - switch(resp.resultStatus){ - case 8000: - showOKToast("正在处理中"); - break; - case 4000: - showOKToast("订单支付失败"); - break; - case 5000: - showOKToast("重复请求"); - break; - case 6001: - showOKToast("支付已取消"); - break; - case 6002: - showOKToast("网络连接出错"); - break; - } - callback(false, resp.result); - } - - print("payment"+content); -} - -late WxPayCallback callback; - -openAliPay(String payUrl, WxPayCallback myCallback) async { - callback = myCallback; - bool isInstalled = await AlipayKitPlatform.instance.isInstalled(); - if (!isInstalled) { - showOKToast("请先安装支付宝"); - return; - } - if (null == _paySubs) { - _paySubs = AlipayKitPlatform.instance.payResp().listen(_listenPay); - } - - var data = await AlipayKitPlatform.instance - .pay(orderInfo: payUrl, isShowLoading: true); -} diff --git a/circle_app/lib/util/SharedPreferencesHelper.dart b/circle_app/lib/util/SharedPreferencesHelper.dart deleted file mode 100644 index adb3e13..0000000 --- a/circle_app/lib/util/SharedPreferencesHelper.dart +++ /dev/null @@ -1,117 +0,0 @@ -import 'dart:io'; - -import 'package:shared_preferences/shared_preferences.dart'; - -class SharedPreferencesHelper { - static const VIP = 'vip'; - static const USERID = 'userId'; - static const LIKEMECOUNT = 'likeMeCount'; - static const RECENTVISITCOUNT = 'recentVisitCount'; - static const PHOTO = 'photo'; - static const AUTHORIZATION = 'Authorization'; - - static const AVATAR = 'avatar'; - static const NAME = 'name'; - - static const LOGINPHONE = 'loginPhone'; - static const PWD = 'pwd'; - static const AGREEMENT = 'agreement'; - - static const String firstLogin = 'firstlogin'; - - static const msgTip = 'msgTip'; - - static const FirstMatch = 'FirstMatch'; - - static SharedPreferencesHelper? _instance; - static SharedPreferences? _preferences; - - SharedPreferencesHelper._(); - - static Future getInstance() async { - if (_instance == null) { - _instance = SharedPreferencesHelper._(); - await _instance!._initPreferences(); - } - return _instance!; - } - - Future _initPreferences() async { - _preferences = await SharedPreferences.getInstance(); - } - - SharedPreferences? get preferences { - return _preferences; - } - - setString(String key, String value) async { - final prefs = preferences; - prefs?.setString(key, value) ?? ""; - } - - setInt(String key, int value) async { - final prefs = preferences; - prefs?.setInt(key, value) ?? 0; - } - setBool(String key, bool value) async { - final prefs = preferences; - prefs?.setBool(key, value) ?? 0; - } - - int getInt(String key) { - final prefs = preferences; - return prefs?.getInt(key) ?? 0; - } - - String getString(String key) { - final prefs = preferences; - return prefs?.getString(key) ?? ''; - } - - String getMyUserId() { - return preferences?.getInt(SharedPreferencesHelper.USERID).toString() ?? ''; - } - - setStringList(List value) { - final prefs = preferences; - return prefs?.setStringList(msgTip,value); - } - - List getStringList() { - final prefs = preferences; - return prefs?.getStringList(msgTip) ?? []; - } - - - Future isShowMatch() async { - String time = await preferences!.getString(FirstMatch) ?? ''; - if (time.isNotEmpty) { - DateTime dateTime = DateTime.parse(time); - bool isShow = !isSameDay(dateTime,DateTime.now()); - if (isShow) { - preferences!.setString(FirstMatch, DateTime.now().toString()); - } - return isShow; - } else { - preferences!.setString(FirstMatch, DateTime.now().toString()); - } - return true; - } - - bool isSameDay(DateTime time1, DateTime time2) { - return time1.year == time2.year && - time1.month == time2.month && - time1.day == time2.day; - } - - bool? getBool(String key) { - final prefs = preferences; - return prefs?.getBool(key); - } - - void clear() { - final prefs = preferences; - prefs?.clear(); - } - -} diff --git a/circle_app/lib/util/device.dart b/circle_app/lib/util/device.dart deleted file mode 100644 index b98b3c3..0000000 --- a/circle_app/lib/util/device.dart +++ /dev/null @@ -1,134 +0,0 @@ -import 'dart:io'; - -import 'package:device_info/device_info.dart'; -import 'package:geolocator/geolocator.dart'; -import 'package:shared_preferences/shared_preferences.dart'; -import 'package:package_info_plus/package_info_plus.dart'; - -import 'SharedPreferencesHelper.dart'; - -//手机系统版本 -Future getDeviceId() async { - String deviceId = ""; - final DeviceInfoPlugin deviceInfoPlugin = new DeviceInfoPlugin(); - try { - if (Platform.isAndroid) { - var build = await deviceInfoPlugin.androidInfo; - String version = build.version.release; - deviceId = version; // Android - } else if (Platform.isIOS) { - var data = await deviceInfoPlugin.iosInfo; - String version = data.systemVersion; - deviceId = version; // iOS - } - } catch (e) { - print('Failed to get device id: $e'); - } - return deviceId; -} - -Future getVersion() async { - String version = ""; - final info = await PackageInfo.fromPlatform(); - version = info.version; - return version; -} - -Future getVersionName() async { - String versionName = ""; - final info = await PackageInfo.fromPlatform(); - versionName = info.version; - return versionName; -} - -Future getVersionCode() async { - String versionCode = ""; - final info = await PackageInfo.fromPlatform(); - versionCode = info.buildNumber; - return versionCode; -} - -//imei -Future getImei() async { - String imei = ""; - DeviceInfoPlugin deviceInfo = DeviceInfoPlugin(); - if (Platform.isAndroid) { - AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo; - imei = androidInfo.androidId; - // other specific Android data - } else if (Platform.isIOS) { - IosDeviceInfo iosInfo = await deviceInfo.iosInfo; - imei = iosInfo.identifierForVendor; - // other specific iOS data - } - return imei; -} - -//手机型号 -Future getBrand() async { - String brand = ''; - DeviceInfoPlugin deviceInfo = DeviceInfoPlugin(); - if (Platform.isIOS) { - IosDeviceInfo iosDeviceInfo = await deviceInfo.iosInfo; - brand = iosDeviceInfo.model; - } else if (Platform.isAndroid) { - AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo; - brand = androidInfo.model; - } - return brand; -} - -Future getLocation() async { - LatLng latLng = LatLng(latitude: 0.0, longitude: 0.0); - ; - try { - LocationPermission permission = await Geolocator.requestPermission(); - if (permission == LocationPermission.whileInUse || - permission == LocationPermission.always) { - Position position = await Geolocator.getCurrentPosition( - desiredAccuracy: LocationAccuracy.high, - ); - print('Latitude: ${position.latitude}'); - print('Longitude: ${position.longitude}'); - latLng = - LatLng(latitude: position.latitude, longitude: position.longitude); - } else { - print('Location permission denied'); - } - } catch (e) { - print('Failed to get device or location info: $e'); - } - return latLng; -} - -class LatLng { - final double latitude; - final double longitude; - - LatLng({required this.latitude, required this.longitude}); -} - -Future getAuthorization() async { - String token =""; - SharedPreferences sharedPreferences =await SharedPreferences.getInstance(); - token = sharedPreferences.getString(SharedPreferencesHelper.AUTHORIZATION)??""; - return token; -} - - -Future getVip() async { - int vip =0; - SharedPreferences sharedPreferences =await SharedPreferences.getInstance(); - vip = sharedPreferences.getInt(SharedPreferencesHelper.VIP)??0; - return vip; -} - -Future getAgreemement() async { - if(Platform.isIOS){ - return true; - } - bool isAgreemement =false; - SharedPreferences sharedPreferences =await SharedPreferences.getInstance(); - isAgreemement = sharedPreferences.getBool(SharedPreferencesHelper.AGREEMENT)??false; - return isAgreemement; -} diff --git a/circle_app/lib/util/eventBus.dart b/circle_app/lib/util/eventBus.dart deleted file mode 100644 index 2e86ef8..0000000 --- a/circle_app/lib/util/eventBus.dart +++ /dev/null @@ -1,85 +0,0 @@ -import 'dart:async'; - -import 'package:event_bus/event_bus.dart'; -import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; - -class EventBusManager { - - static EventBus? _eventBus; - - static EventBus get eventBus { - if (_eventBus == null) { - _eventBus = EventBus(); - } - return _eventBus!; - } - - static void fire(dynamic event) { - eventBus.fire(event); - } - - static Stream on() { - return eventBus.on(); - } - - static void cancelSubscription(StreamSubscription subscription) { - subscription.cancel(); - } -} - - -class AssestEvent { -} - - -class CommentVipEvent { - int vip = 0; - - CommentVipEvent(this.vip); -} - -class SendCoustomMessage { - -V2TimValueCallback? createCustomMessageRes = null; - -SendCoustomMessage(this.createCustomMessageRes); -} - -class ChatRefreshMsg { - -} - - -class CommentBlackEvent { - String userId = ""; - bool isBlack = false; - CommentBlackEvent( {required this.userId,required this.isBlack }); -} -class CommentBlackMoreEvent { -} - -class CallRefreshCircle { - String circleId = ""; - - CallRefreshCircle(this.circleId); -} - -class CircleInfoRefresh { - String circleId = ""; - - CircleInfoRefresh(this.circleId); -} - -class ScrollToTop { - -} - - -class RefreshUnread { - -} - - -class LikeRefresh { - -} \ No newline at end of file diff --git a/circle_app/lib/util/location.dart b/circle_app/lib/util/location.dart deleted file mode 100644 index b5bc30f..0000000 --- a/circle_app/lib/util/location.dart +++ /dev/null @@ -1,50 +0,0 @@ -import 'dart:math'; - -double calculateLineDistance(LatLng var0, LatLng var1) { - if (var0 != null && var1 != null) { - try { - double var2 = var0.longitude; - double var4 = var0.latitude; - double var6 = var1.longitude; - double var8 = var1.latitude; - var2 *= 0.01745329251994329; - var4 *= 0.01745329251994329; - var6 *= 0.01745329251994329; - var8 *= 0.01745329251994329; - double var10 = sin(var2); - double var12 = sin(var4); - double var14 = cos(var2); - double var16 = cos(var4); - double var18 = sin(var6); - double var20 = sin(var8); - double var22 = cos(var6); - double var24 = cos(var8); - List var28 = [0, 0, 0]; - List var29 = [0, 0, 0]; - var28[0] = var16 * var14; - var28[1] = var16 * var10; - var28[2] = var12; - var29[0] = var24 * var22; - var29[1] = var24 * var18; - var29[2] = var20; - return (asin(sqrt((var28[0] - var29[0]) * (var28[0] - var29[0]) + (var28[1] - var29[1]) * (var28[1] - var29[1]) + (var28[2] - var29[2]) * (var28[2] - var29[2])) / 2.0) * 1.27420015798544E7).toDouble(); - } catch (e) { - print(e.toString()); - return 0.0; - } - } else { - try { - throw Exception("非法坐标值"); - } catch (e) { - print(e.toString()); - return 0.0; - } - } -} - -class LatLng { - double longitude; - double latitude; - - LatLng(this.longitude, this.latitude); -} diff --git a/circle_app/lib/util/newbie_guide_tip.dart b/circle_app/lib/util/newbie_guide_tip.dart deleted file mode 100644 index d9111d7..0000000 --- a/circle_app/lib/util/newbie_guide_tip.dart +++ /dev/null @@ -1,441 +0,0 @@ -import 'package:circle_app/app/home/logic.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:circle_app/common/colors/app_color.dart'; -import 'package:circle_app/router/app_routers.dart'; -import 'package:gradient_borders/box_borders/gradient_box_border.dart'; - -import '../../network/api.dart'; -import '../../network/dio_manager.dart'; -import '../../util/util.dart'; - -class NewbieGuideTip extends StatefulWidget { - Map data; - - NewbieGuideTip({super.key,required this.data}); - - @override - _NewbieGuideTipState createState() => new _NewbieGuideTipState(); -} - -class _NewbieGuideTipState extends State { - // TODO: add state variables and methods - - bool isGet = false; - - @override - Widget build(BuildContext context) { - // TODO: add widget build method - List rewardList = widget.data['rewards']; - int index = 0; - bool isConta = false; - rewardList.forEach((element) { - if (!element['hasReceived'] && !isConta) { - index = rewardList.indexOf(element); - isConta = true; - } - }); - - return Scaffold( - backgroundColor: Colors.transparent, - body: Column(mainAxisAlignment: MainAxisAlignment.center, children: [ - Container( - child: Stack( - alignment: Alignment.center, - children: [ - Container( - width:Get.width - 30.sp, - height: 414.sp, - decoration: BoxDecoration( - gradient: AppColor.bgHorLinearGradient, - borderRadius: - BorderRadius.circular(20.sp), - border: GradientBoxBorder( - gradient: - AppColor.mainVerLinearGradient, - width: 1.sp, - ), - )), - Column( - mainAxisAlignment: MainAxisAlignment.start, - // crossAxisAlignment: CrossAxisAlignment.start, - children: [ - //标题 - Container( - child: Column(children: [ - Container( - margin: EdgeInsets.only(top: 18.sp), - child: ShaderMask( - shaderCallback: (Rect bounds) { - return const LinearGradient( - begin: Alignment(0.0, -1.0), - end: Alignment.centerRight, - colors: [Color(0xFFD739EA), Color(0xFF03FEFB)], - ).createShader(Offset.zero & bounds.size); - }, - child: Text( - '微乐园APP新人指引', - style: TextStyle( - // color: AppColor.mainColor, - color: Colors.white, - fontSize: 18.sp, - shadows: const [ - Shadow( - color: Color(0xffF657FF), - offset: Offset(0.0, -1)) - ]), - ), - )) - ])), - //奖励 - Container( - height: 143.sp, - width: Get.width - 50.sp, - margin: EdgeInsets.only( - left: 10.sp, - right: 10.sp, - top: 14.sp, - ), - padding: EdgeInsets.all(10.sp), - decoration: BoxDecoration( - color: Color(0xFF260C3E), - border: Border.all( - color: AppColor.mainColor, width: 1.sp), - borderRadius: BorderRadius.circular(8.sp)), - child: Column( - children: [ - Container( - margin: EdgeInsets.only(bottom: 16.sp), - child: Row( - children: [ - Container( - width: 4.sp, - height: 4.sp, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: - BorderRadius.circular(2.sp)), - ), - SizedBox( - width: 4.sp, - ), - Text( - '新人礼包: 连续3天免费领票换钱', - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - fontWeight: FontWeight.bold), - ), - Expanded(child: Container()), - if (!isGet) - GestureDetector( - onTap: () { - getRewardData('${rewardList[index]['coin']}小票'); - }, - child: Container( - width: 64.sp, - height: 21.sp, - alignment: Alignment.center, - decoration: BoxDecoration( - gradient: - AppColor.mainVerLinearGradient, - borderRadius: - BorderRadius.circular(10.5.sp)), - child: Text( - 'Day${index == 0 ? '1' : index == 1 ? '2' : '3'}领取', - style: TextStyle( - color: Colors.white, - fontSize: 13.sp, - ), - ), - ), - ), - ], - ), - ), - Expanded( - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - child: Column( - children: [ - Image.asset( - getMineImage('bi_icon1'), - width: 60.sp, - height: 60.sp, - ), - Padding( - padding: EdgeInsets.only(top: 5.sp), - child: Text( - 'Day1: ${rewardList[0]['coin']}小票', - style: TextStyle( - color: Colors.white, - fontSize: 13.sp, - ), - ), - ) - ], - ), - ), - Container( - child: Column( - children: [ - Image.asset( - getBaseImage('day2_icon'), - width: 60.sp, - height: 60.sp, - ), - Padding( - padding: EdgeInsets.only(top: 5.sp), - child: Text( - 'Day2: ${rewardList[1]['coin']}小票', - style: TextStyle( - color: Colors.white, - fontSize: 13.sp, - ), - ), - ) - ], - ), - ), - Container( - child: Column( - children: [ - Image.asset( - getBaseImage('day3_icon'), - width: 60.sp, - height: 60.sp, - ), - Padding( - padding: EdgeInsets.only(top: 5.sp), - child: Text( - 'Day3: ${rewardList[2]['coin']}小票', - style: TextStyle( - color: Colors.white, - fontSize: 13.sp, - ), - ), - ) - ], - ), - ), - ], - ), - ) - ], - ), - ), - //方式一 - Container( - height: 53.sp, - width: Get.width - 50.sp, - margin: EdgeInsets.only( - left: 10.sp, - right: 10.sp, - top: 8.sp, - ), - padding: EdgeInsets.all(10.sp), - decoration: BoxDecoration( - color: Color(0xFF260C3E), - border: Border.all( - color: AppColor.mainColor, width: 1.sp), - borderRadius: BorderRadius.circular(8.sp)), - child: Row( - children: [ - Container( - width: 4.sp, - height: 4.sp, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(2.sp)), - ), - SizedBox( - width: 4.sp, - ), - Text( - '发布喊话: 让更多圈友看到你', - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - ), - ), - Expanded(child: Container()), - GestureDetector( - onTap: () { - Get.toNamed(AppRoutes.Call_out); - }, - child: Container( - width: 64.sp, - height: 21.sp, - alignment: Alignment.center, - decoration: BoxDecoration( - gradient: AppColor.mainVerLinearGradient, - borderRadius: BorderRadius.circular(10.5.sp)), - child: Text( - '立即发布', - style: TextStyle( - color: Colors.white, - fontSize: 13.sp, - ), - ), - ), - ), - ], - ), - ), - Container( - height: 53.sp, - width: Get.width - 50.sp, - margin: EdgeInsets.only( - left: 10.sp, - right: 10.sp, - top: 8.sp, - ), - padding: EdgeInsets.all(10.sp), - decoration: BoxDecoration( - color: Color(0xFF260C3E), - border: Border.all( - color: AppColor.mainColor, width: 1.sp), - borderRadius: BorderRadius.circular(8.sp)), - child: Row( - children: [ - Container( - width: 4.sp, - height: 4.sp, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(2.sp)), - ), - SizedBox( - width: 4.sp, - ), - Text( - '玩转圈子: 体验无数特色圈子', - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - ), - ), - Expanded(child: Container()), - GestureDetector( - onTap: () { - Get.back(); - Get.until((route) { - return route.isFirst; - }); - var logic = Get.find(); - Future.delayed(Duration(milliseconds: 100),() { - logic.updateIndex(1); - }); - - // Get.toNamed(AppRoutes.MyLive); - }, - child: Container( - width: 64.sp, - height: 21.sp, - alignment: Alignment.center, - decoration: BoxDecoration( - gradient: AppColor.mainVerLinearGradient, - borderRadius: BorderRadius.circular(10.5.sp)), - child: Text( - '前往体验', - style: TextStyle( - color: Colors.white, - fontSize: 13.sp, - ), - ), - ), - ), - ], - ), - ), - Container( - height: 53.sp, - width: Get.width - 50.sp, - margin: EdgeInsets.only( - left: 10.sp, - right: 10.sp, - bottom: 20.sp, - top: 8.sp, - ), - padding: EdgeInsets.all(10.sp), - decoration: BoxDecoration( - color: Color(0xFF260C3E), - border: Border.all( - color: AppColor.mainColor, width: 1.sp), - borderRadius: BorderRadius.circular(8.sp)), - child: Row( - children: [ - Container( - width: 4.sp, - height: 4.sp, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(2.sp)), - ), - SizedBox( - width: 4.sp, - ), - Text( - '赚钱攻略: 多种方式帮你赚钱', - style: TextStyle( - color: Colors.white, - fontSize: 14.sp, - ), - ), - Expanded(child: Container()), - GestureDetector( - onTap: () { - navigateStartGetMoeny(); - }, - child: Container( - width: 64.sp, - height: 21.sp, - alignment: Alignment.center, - decoration: BoxDecoration( - gradient: AppColor.mainVerLinearGradient, - borderRadius: BorderRadius.circular(10.5.sp)), - child: Text( - '查看攻略', - style: TextStyle( - color: Colors.white, - fontSize: 13.sp, - ), - ), - )), - ], - ), - ), - ]), - ], - ), - ), - GestureDetector( - onTap: () { - Get.back(); - }, - child: Container( - margin: EdgeInsets.only(bottom: 5.sp, top: 10.sp), - alignment: Alignment.center, - child: Image.asset( - getHomeImage('wx_close'), - width: 24.sp, - ))), - ]), - ); - } - - void getRewardData(String desc) async { - var data = await DioManager.instance.post(url: Api.receiveToDayReward); - if (data['code'] == 200) { - List rewardList = widget.data['rewards']; - showOKToast('已领取${desc}'); - isGet = true; - setState(() { - - }); - } - } -} diff --git a/circle_app/lib/util/paymentUtil.dart b/circle_app/lib/util/paymentUtil.dart deleted file mode 100644 index 14fcc35..0000000 --- a/circle_app/lib/util/paymentUtil.dart +++ /dev/null @@ -1,275 +0,0 @@ -import 'dart:async'; -import 'package:circle_app/app/circle/logic.dart'; -import 'package:circle_app/network/api.dart'; -import 'package:circle_app/network/dio_manager.dart'; -import 'package:circle_app/util/eventBus.dart'; -import 'package:circle_app/util/util.dart'; -import 'package:event_bus/event_bus.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; -import 'package:get/get.dart'; -import 'package:in_app_purchase/in_app_purchase.dart'; -import 'package:in_app_purchase_storekit/src/types/app_store_purchase_details.dart'; - -// iOS支付单一实例 -// final iOSPayment = IOSPayment(); - -class IOSPayment { - IOSPayment._(); - - static IOSPayment? _instance; - - /// The instance of the [InAppPurchase] to use. - static IOSPayment get instance => _getOrCreateInstance(); - - static IOSPayment _getOrCreateInstance() { - if (_instance != null) { - return _instance!; - } - _instance = IOSPayment._(); - return _instance!; - } - - // 应用内支付实例 - InAppPurchase _inAppPurchase = InAppPurchase.instance; - - // iOS订阅监听 - StreamSubscription>? subscription; - - //1圈子 2会员 3解锁微信 4充值 - int type = 0; - //可以为解锁圈子ID、会员标识ID - String typeId = ''; - - String target_id = ''; - - /// 判断是否可以使用支付 - Future isAvailable() async => await _inAppPurchase.isAvailable(); - - // 开始订阅 - void startSubscription() async { - if (subscription != null) return; - print('>>> start subscription'); - // 支付消息订阅 - // Stream purchaseUpdates = _inAppPurchase.purchaseStream; - Stream> purchaseUpdated = - _inAppPurchase.purchaseStream; - subscription = - purchaseUpdated.listen((List purchaseDetailsList) { - _listenToPurchaseUpdated(purchaseDetailsList); - }, onDone: () { - SmartDialog.dismiss(); - // subscription!.cancel(); - }, onError: (Object error) { - SmartDialog.dismiss(); - showOKToast('出错了,请重新支付'); - // handle error here. - }); - } - - // ListAppStorePurchaseDetails - - Future _listenToPurchaseUpdated( - List purchaseDetailsList) async { - for (final PurchaseDetails purchaseDetails in purchaseDetailsList) { - if (purchaseDetails.status == PurchaseStatus.pending) { - SmartDialog.showLoading(msg: '请稍等片刻'); - } else { - if (purchaseDetails.status == PurchaseStatus.error) { - showOKToast('支付发生错误'); - } else if (purchaseDetails.status == PurchaseStatus.purchased) { - Map params = { - 'payload': purchaseDetails.verificationData.serverVerificationData, - 'transaction_id': purchaseDetails.purchaseID, - 'type': type, - 'product_id': int.parse(typeId) - }; - - if (type == 3) { - params['target_id'] = target_id; - } else if (target_id.isNotEmpty) { - params['target_id'] = target_id; - } - - var result = await DioManager.getInstance() - .post(url: Api.applePayCallBack, params:params); - SmartDialog.dismiss(); - if (result['code'] == 200) { - - try { - if (type != 4) { - Get.back(); - } - } catch (e) {} - - if (type == 1) { - showOKToast('解锁圈子成功'); - if (Get.isRegistered()) { - var logic = Get.find(); - for (var element in logic.circle.lists) { - if (element.id == int.parse(typeId)) { - element.is_limit = false; - element.isJoin = true; - } - } - logic.update(); - } - EventBusManager.fire(CircleInfoRefresh(typeId)); - } else if (type == 2) { - if (target_id.isNotEmpty) { - showOKToast('赠送会员成功'); - target_id = ''; - } else { - showOKToast('开通会员成功'); - EventBusManager.fire(CommentVipEvent(1)); - } - } else if (type == 4) { - showOKToast('充值成功'); - EventBusManager.fire(AssestEvent()); - } else { - showOKToast('解锁联系方式成功'); - unLockWxSuccessResult(target_id); - } - } - await _inAppPurchase.completePurchase(purchaseDetails); - } else if (purchaseDetails.status == PurchaseStatus.canceled || - purchaseDetails.status == PurchaseStatus.error) { - SmartDialog.dismiss(); - if (purchaseDetails.status == PurchaseStatus.canceled) { - showOKToast('取消支付'); - } else { - showOKToast('支付超时了'); - } - } - - await _inAppPurchase.completePurchase(purchaseDetails); - } - } - } - - // Future deliverProduct(PurchaseDetails purchaseDetails) async { - // // IMPORTANT!! Always verify purchase details before delivering the product. - // if (purchaseDetails.productID == _kConsumableId) { - // await ConsumableStore.save(purchaseDetails.purchaseID!); - // final List consumables = await ConsumableStore.load(); - // setState(() { - // _purchasePending = false; - // _consumables = consumables; - // }); - // } else { - // setState(() { - // _purchases.add(purchaseDetails); - // _purchasePending = false; - // }); - // } - // } - - // void handleError(IAPError error) { - // setState(() { - // _purchasePending = false; - // }); - // } - - Future _verifyPurchase(PurchaseDetails purchaseDetails) { - // IMPORTANT!! Always verify a purchase before delivering the product. - // For the purpose of an example, we directly return true. - return Future.value(true); - } - - /// 启动支付 - void iosPay(String skuInfo, String typeID, int productType,{String userId = ''}) async { - if (!await isAvailable()) { - SmartDialog.dismiss(); - showOKToast('无法连接AppStore,请稍后再试'); - return; - } - - // 获取商品列表month_member_3 - var set = [skuInfo].toSet(); - ProductDetailsResponse appStoreProducts = - await _inAppPurchase.queryProductDetails(set); - String orderId = DateTime.now().millisecondsSinceEpoch.toString(); - - if (appStoreProducts.notFoundIDs.isNotEmpty) { - // Handle the error. - SmartDialog.dismiss(); - showOKToast('获取内购产品失败'); - - return; - } - - target_id = userId; - type = productType; - typeId = typeID; - - List products = appStoreProducts.productDetails; - - // 发起支付 - _inAppPurchase - .buyNonConsumable( - purchaseParam: PurchaseParam( - productDetails: products.last, - applicationUserName: orderId, - ), - ) - .then((value) { - if (value) { - // dismissLoading(); - // showLoading(tip: '正在处理订单'); - // 只要能发起,就写入 - // writeStorage(sku, orderId, 'pending'); - } - }).catchError((err) async { - SmartDialog.dismiss(); - showOKToast('当前商品您有未完成的交易,请等待iOS系统核验后再次发起购买。'); - // if (err['details'] != null) { - // Map details = err['details']; - // // "productIdentifier" -> "12rmb" - // var data = await _inAppPurchase.queryProductDetails(details['productIdentifier']); - // if (data.productDetails.isNotEmpty) { - // // await _inAppPurchase.buyConsumable(purchaseParam: purchaseParam) - // } - // } - - // onError?.call('当前商品您有未完成的交易,请等待iOS系统核验后再次发起购买。'); - print(err); - }); - } - - writeStorage(String key, String value, String status) { - // storage.write(key: key, value: '$value¥$status'); - } - - // 关闭交易 - void finalTransaction(PurchaseDetails purchaseDetails) async { - await _inAppPurchase.completePurchase(purchaseDetails); - // 每完成一张订单进行缓存的清除 - // if (!await checkStorage()) { - // stopListen(); - // } - } - - // 凑单机制 - Future foundRecentOrder(String sku) async { - String orderId = ''; - // String values = await storage.read(key: sku); - // - // if (values != null) { - // orderId = values.split('¥')[0]; - // } - return orderId; - } - - // 校验是否还有缓存 - Future checkStorage() async { - // Map remainingValues = await storage.readAll(); - return false; - } - - // 关闭监听 - stopListen() async { - // subscription!.cancel(); - // subscription = null; - } -} diff --git a/circle_app/lib/util/qiniu.dart b/circle_app/lib/util/qiniu.dart deleted file mode 100644 index 9c986ac..0000000 --- a/circle_app/lib/util/qiniu.dart +++ /dev/null @@ -1,135 +0,0 @@ -import 'dart:convert'; -import 'dart:io'; -import 'dart:math'; -import 'dart:typed_data'; - -import 'package:circle_app/util/util.dart'; -import 'package:flutter_image_compress/flutter_image_compress.dart'; -import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; -import 'package:image_picker/image_picker.dart'; -import 'package:qiniu_flutter_sdk/qiniu_flutter_sdk.dart'; -import 'package:intl/intl.dart'; - -import '../common/config.dart'; -import '../network/api.dart'; -import '../network/dio_manager.dart'; -import 'package:image/image.dart' as img; - -typedef void MyCallback(String result); - -//上传七牛云 -void uploadQiniuVideo(File file, String name, String path, String quToken, - MyCallback myCallback) { - var storage = Storage(); - DateTime now = DateTime.now(); - String yearMonth = DateFormat('yyyyMM').format(now); - String imgPath = "$path$yearMonth/${generateRandomString(16)}$name"; - PutController putController = PutController(); - putController.addStatusListener((StorageStatus status) { - if (status == StorageStatus.Success) { - var headUrl = CONFIG.IMAGE_HEAD + imgPath; - myCallback(headUrl); - } - print('状态变化: 当前任务状态:$status'); - }); - - putController.addProgressListener((double status) { - print('上传进度: $status'); - }); - - storage.putFile(file, quToken, - options: PutOptions(controller: putController, key: imgPath)); -} - - -//上传七牛云 -void uploadQiniu(Uint8List bytes, String name, String path, String quToken, - MyCallback myCallback) { - var storage = Storage(); - DateTime now = DateTime.now(); - String yearMonth = DateFormat('yyyyMM').format(now); - String imgPath = "$path$yearMonth/${generateRandomString(16)}$name"; - PutController putController = PutController(); - putController.addStatusListener((StorageStatus status) { - if (status == StorageStatus.Success) { - var headUrl = CONFIG.IMAGE_HEAD + imgPath; - myCallback(headUrl); - } - print('状态变化: 当前任务状态:$status'); - }); - - putController.addProgressListener((double status) { - print('上传进度: $status'); - }); - - storage.putBytes(bytes, quToken, - options: PutOptions(controller: putController, key: imgPath)); -} - -const List jpgSuffix = ["jpg", "jpeg", "JPG", "JPEG", "png", "PNG"]; - -bool isImageJpgOrPng(String imagePath) { - String extension = imagePath.split('.').last.toLowerCase(); - return jpgSuffix.contains(extension); -} - -//封装上传图片 -void uploadImage(String quToken, XFile pickedFile, String updataRoute, - MyCallback myCallback) async { - // print(quToken); - if (quToken.isEmpty) { - var data = - await DioManager.instance.get(url: Api.getqiniuToken, params: {}); - var bean = BaseResponse.fromJson( - data, (data) => QnTokenData.fromJson(data)); - if (bean.isSuccess()) { - quToken = bean.data!.token.toString(); - } else { - showOKToast("图片上传失败"); - SmartDialog.dismiss(force: true); - return; - } - } - - var result = await FlutterImageCompress.compressWithFile( - pickedFile.path, - minWidth: 2300, - minHeight: 1500, - quality: 94, - ); - - var size = await pickedFile.length(); - print(size); - print(result!.length); - - uploadQiniu(result!, pickedFile.name, updataRoute, quToken, (result) { - myCallback(result); - }); -} - -void convertImageFormat( - String imagePath, String outputPath, String outputFormat) { - // 读取原始图像文件 - final File inputFile = File(imagePath); - final List inputBytes = inputFile.readAsBytesSync(); - - // 解码图像 - final img.Image image = img.decodeImage(inputBytes)!; - - // 转换图像格式 - final img.Image convertedImage = - img.copyResize(image, width: image.width, height: image.height); - final List? outputBytes = - img.encodeNamedImage(convertedImage, outputFormat); - - // 写入转换后的图像文件 - final File outputFile = File(outputPath); - outputFile.writeAsBytesSync(outputBytes!); -} - -String generateRandomString(int length) { - var random = Random.secure(); - var values = List.generate(length, (index) => random.nextInt(256)); - var randomString = base64Url.encode(values); - return randomString.substring(0, length); -} diff --git a/circle_app/lib/util/util.dart b/circle_app/lib/util/util.dart deleted file mode 100644 index 46b0cff..0000000 --- a/circle_app/lib/util/util.dart +++ /dev/null @@ -1,1315 +0,0 @@ -import 'dart:convert'; -import 'dart:io'; -import 'dart:ui'; - -import 'package:app_settings/app_settings.dart'; -import 'package:circle_app/app/chat/view.dart'; -import 'package:circle_app/app/circle/view.dart'; -import 'package:circle_app/app/circle/widgets/discover.dart'; -import 'package:circle_app/app/userinfo/logic.dart'; -import 'package:circle_app/common/Widgets/base_tip_widget.dart'; -import 'package:circle_app/common/values/values.dart'; -import 'package:circle_app/main.dart'; -import 'package:circle_app/network/api.dart'; -import 'package:circle_app/router/app_routers.dart'; -import 'package:circle_app/util/eventBus.dart'; -import 'package:event_bus/event_bus.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:geolocator/geolocator.dart'; -import 'package:get/get.dart'; -import 'package:oktoast/oktoast.dart'; - -import 'package:path_provider/path_provider.dart'; -import 'package:pull_to_refresh/pull_to_refresh.dart'; -import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_conversation_view_model.dart'; -import 'package:tencent_cloud_chat_uikit/data_services/services_locatar.dart'; -import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; -import 'package:url_launcher/url_launcher.dart'; -import 'package:video_compress/video_compress.dart'; - -import '../app/circle/logic.dart'; -import '../app/home/logic.dart'; -import '../app/select_circle/logic.dart'; -import '../common/Widgets/open_vip_tip/view.dart'; -import '../common/Widgets/wx_edit_dialog.dart'; -import '../common/colors/app_color.dart'; -import '../network/dio_manager.dart'; -import 'SharedPreferencesHelper.dart'; - -List chatIdList = []; - -class Util {} - -//获取图片 -String getBaseImage(String image) { - return '${Values.base_images}${image}.png'; -} - -String getHomeImage(String image) { - return '${Values.home_images}${image}.png'; -} - -String getDisCoverImage(String image) { - return '${Values.discover_images}${image}.png'; -} - -String getLoginImage(String image) { - return '${Values.login_images}${image}.png'; -} - -String getMineImage(String image) { - return '${Values.mine_images}${image}.png'; -} - -String getMsgImage(String image) { - return '${Values.msg_images}${image}.png'; -} - -String getNavigatorImage(String image) { - return '${Values.navigator_images}${image}.png'; -} - -String getTabbarImage(String image) { - return '${Values.tabbar_images}${image}.png'; -} - -String getCircleImage(String image) { - return '${Values.circle_images}${image}.png'; -} - -///弹窗文本提示 msg: 提示内容 -showOKToast(String msg) { - showToast( - msg, - duration: Duration(seconds: msg.length > 15 ? 5 : msg.length > 10 ? 3 : 2), - position: ToastPosition.center, - backgroundColor: Colors.black, - radius: 13.0, - textStyle: const TextStyle(fontSize: 16.0,color: Colors.white), - ); -} - -loaddingWidget(bool isMore,{String tip = '--到底了--'}) { - return Container( - alignment: Alignment.center, - child: isMore - ? const CircularProgressIndicator( - color: Color(0xFF07FAFB), - ) - : Container( - margin: EdgeInsets.only(top: 4.sp, bottom: 4.sp), - child: Text( - tip, - style: TextStyle(color: Colors.white, fontSize: 13.sp), - ), - ), - ); -} - -noResultWidget({String tip = '正在等待被填充~',Function? callBack, String action = '重新加载'}) { - return Container( - width: Get.width, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset( - getBaseImage('no_result'), - width: 200.sp, - ), - SizedBox( - height: 8.sp, - ), - if (callBack == null || tip.isNotEmpty) - Text( - tip, - style: TextStyle(color: Color(0xffdbdbdb), fontSize: 15.sp), - ), - if (callBack != null) - GestureDetector( - onTap: () { - callBack(); - }, - child: Container( - margin: EdgeInsets.only(top: 10.sp), - height: 42.sp, - width: 160.sp, - alignment: Alignment.center, - // padding: EdgeInsets.only(left: 4.sp,right: 4.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8.sp), - gradient: AppColor.mainVerLinearGradient), - child: Text( - action, - style: TextStyle(color: Colors.white, fontSize: 14.sp), - ), - ), - ) - ], - ), - ); -} - -///value: 文本内容;fontSize : 文字的大小;fontWeight:文字权重;maxWidth:文本框的最大宽度;maxLines:文本支持最大多少行 -double calculateTextHeight(String value, fontSize, FontWeight fontWeight, - double maxWidth, int maxLines) { - value = filterText(value); - TextPainter painter = TextPainter( - - ///AUTO:华为手机如果不指定locale的时候,该方法算出来的文字高度是比系统计算偏小的。 - locale: WidgetsBinding.instance.window.locale, - maxLines: maxLines, - textDirection: TextDirection.ltr, - textScaleFactor: 1, - //字体缩放大小 - text: TextSpan( - text: value, - style: TextStyle( - fontWeight: fontWeight, - fontSize: fontSize, - ))); - painter.layout(maxWidth: maxWidth); - - ///文字的宽度:painter.width - return painter.height; -} - -String filterText(String text) { - String tag = '
'; - while (text.contains('
')) { - // flutter 算高度,单个\n算不准,必须加两个 - text = text.replaceAll(tag, '\n\n'); - } - return text; -} - -String convertToTenThousand(int number) { - if (number >= 10000) { - double result = number / 10000; - return '${result.toStringAsFixed(1)}万'; - } else { - return number.toString(); - } -} - -pushLoginPage() async { - await logoutIM(); - SharedPreferencesHelper.getInstance().then((sharedPreferences) { - String loginPhone = - sharedPreferences.getString(SharedPreferencesHelper.LOGINPHONE) ?? ""; - String pwd = - sharedPreferences.getString(SharedPreferencesHelper.PWD) ?? ""; - print(loginPhone); - List tipList = sharedPreferences.getStringList(); - sharedPreferences.clear(); - sharedPreferences.setString(SharedPreferencesHelper.LOGINPHONE, loginPhone); - sharedPreferences.setString(SharedPreferencesHelper.PWD, pwd); - sharedPreferences.setBool(SharedPreferencesHelper.AGREEMENT, true); - sharedPreferences.setString(SharedPreferencesHelper.firstLogin, '1'); - sharedPreferences.setStringList(tipList); - }); - - if (AppRoutes.Login != Get.currentRoute) { - Get.offAllNamed(AppRoutes.Login); - } - -} - -String filterSensitiveWords(String input, List sensitiveWords) { - String filteredString = input; - for (String word in sensitiveWords) { - String replacement = '*' * word.length; - filteredString = filteredString.replaceAll(word, replacement); - } - return filteredString; -} - -String getAgeCOntent(int gender, int age, int role, int orientation) { - return "${getGenderContent(gender)}·${age}·${getRoleContent(role)}·${getOrientationContent(orientation)}"; -} - -late ConfigBean configBean; -List numbers = []; - -List genderList = []; - -List orientationList = []; - -List roleList = []; - -String getGenderContent(int number) { - if (number == null) return ''; - if (genderList.length != 0) { - return genderList[number - 1]; - } else { - switch (number) { - case 1: - return "男"; - case 2: - return "女"; - case 3: - return "MTF"; - case 4: - return "FTM"; - case 5: - return "CD"; - case 6: - return "酷儿"; - default: - return ""; - } - } -} - -String getOrientationContent(int number) { - if (orientationList.length != 0) { - return orientationList[number - 1]; - } else { - switch (number) { - case 1: - return "异性恋"; - case 2: - return "同性恋"; - case 3: - return "双性恋"; - case 4: - return "泛性恋"; - case 5: - return "无性恋"; - case 6: - return "智性恋"; - case 7: - return "性单恋"; - default: - return ""; - } - } -} - -String getRoleContent(int number) { - if (roleList.length != 0) { - return roleList[number - 1]; - } else { - switch (number) { - case 1: - return "Sado"; - case 2: - return "Maso"; - case 3: - return "Dom"; - case 4: - return "Sub"; - case 5: - return "Switch"; - default: - return ""; - } - } -} - -typedef void MyCallback(String path); - -Future compressVideo( - String inputPath, String outputPath, MyCallback myCallback) async { - final info = await VideoCompress.compressVideo( - inputPath, - quality: VideoQuality.MediumQuality, - deleteOrigin: false, - ); - - if (info != null && null != info.path) { - print(info.path); - myCallback(info.path!); - } else { - print('视频压缩失败'); - } -} - -class CustomRefreshHeader extends StatelessWidget { - @override - Widget build(BuildContext context) { - return ClassicHeader( - // 自定义刷新时的文字 - refreshingText: "正在刷新...", - idleText: "下拉刷新", - completeText: "刷新完成", - failedText: "刷新失败", - ); - } -} - -class CustomLoadFooter extends StatelessWidget { - @override - Widget build(BuildContext context) { - return ClassicFooter( - // 自定义加载更多时的文字 - canLoadingText: "松手开始加载数据", - loadingText: "正在加载...", - idleText: "上拉加载更多", - noDataText: "到底了~", - failedText: "加载失败", - ); - } -} - -class DiyLoadFooter extends StatefulWidget { - String noDataText; - - DiyLoadFooter({super.key,required this.noDataText}); - - - @override - State createState() => _DiyLoadFooterState(); -} - -class _DiyLoadFooterState extends State { - - - @override - Widget build(BuildContext context) { - return ClassicFooter( - // 自定义加载更多时的文字 - canLoadingText: "松手开始加载数据", - loadingText: "正在加载...", - idleText: "上拉加载更多", - noDataText: widget.noDataText, - failedText: "加载失败", - ); - } -} - - -class CustomLikeLoadFooter extends StatelessWidget { - @override - Widget build(BuildContext context) { - return ClassicFooter( - // 自定义加载更多时的文字 - canLoadingText: "松手开始加载数据", - loadingText: "正在加载...", - idleText: "上拉加载更多", - noDataText: "", - height: 20.sp, - spacing: 5, - failedText: "加载失败", - ); - } -} - - -// 获取应用程序的文档目录路径 -Future getApplicationDocumentsDirectoryPath() async { - final directory = await getApplicationDocumentsDirectory(); - return directory.path; -} - -// 获取应用程序的支持目录路径 -Future getApplicationSupportDirectoryPath() async { - final directory = await getApplicationSupportDirectory(); - return directory.path; -} - -// 获取临时目录路径 -Future getTemporaryDirectoryPath() async { - final directory = await getTemporaryDirectory(); - return directory.path; -} - -// 获取库目录路径 -Future getLibraryDirectoryPath() async { - final directory = await getLibraryDirectory(); - return directory.path; -} - -//跳转到文明公约 -void navigateToCodeOfConduct() { - Get.toNamed(AppRoutes.WebViewActivity, arguments: { - 'title': "文明公约", - "url": "https://docs.qq.com/doc/DZUtoZ3V0S3ltY2Zw" - }); -} - -//跳转到用户协议 -void navigateToUserAgreement() { - Get.toNamed(AppRoutes.WebViewActivity, arguments: { - 'title': "用户协议", - "url": Platform.isIOS - ? "https://docs.qq.com/doc/DZVV1SkttZGlPUW1H" - : "https://iquanpai.com/app-h5/4_163.html" - }); -} - -//跳转到如何上精选 -void navigateToQueen() { - Get.toNamed(AppRoutes.WebViewActivity, arguments: { - 'title': "如何上精选", - "url": 'https://iquanpai.com/app-h5/4_184.html' - }); -} - - -//跳转到隐私政策 -void navigateToPrivacyPolicy() { - Get.toNamed(AppRoutes.WebViewActivity, arguments: { - 'title': "隐私协议", - "url": Platform.isIOS - ? "https://docs.qq.com/doc/DZXhvcXV6b1RNTUx1" - : "https://iquanpai.com/app-h5/4_164.html" - }); -} - -//发布内容规范 -void navigateToContentGuidelines() { - Get.toNamed(AppRoutes.WebViewActivity, arguments: { - 'title': "发布内容规范", - "url": Platform.isIOS - ? "https://docs.qq.com/doc/DZVhLamZDQnJ0eHds" - : "https://iquanpai.com/app-h5/4_165.html" - }); -} - -//合伙人协议 -void navigateToPartnerAgreement() { - Get.toNamed(AppRoutes.WebViewActivity, arguments: { - 'title': "合伙人协议", - "url": Platform.isIOS - ? "https://docs.qq.com/doc/DZUpwWFdNcGlsYld4" - : "https://iquanpai.com/app-h5/4_166.html" - }); -} - -//小票充值协议 -void navigateToItem() { - Get.toNamed(AppRoutes.WebViewActivity, arguments: { - 'title': "小票充值协议", - "url":'https://www.iquanpai.com/app-h5/4_173.html' - }); -} - -//邀请攻略 -void navigateToInviteStrategy() { - Get.toNamed(AppRoutes.WebViewActivity, arguments: { - 'title': "邀请攻略", - "url": "https://leyuan666.com/app-h5/4_168.html" - }); -} - -//跳转到赚钱攻略 -navigateStartGetMoeny() { - Get.toNamed(AppRoutes.WebViewActivity, arguments: { - 'title': "微乐园赚钱攻略", - "url": 'https://iquanpai.com/app-h5/4_178.html' - }); -} - -void navigateToCustomRoute(BannerItem bannerItem) async { - print(bannerItem.param); - switch (bannerItem.type) { - case 1: - if (bannerItem.scene == 'internal') { - Get.toNamed(AppRoutes.WebViewActivity, - arguments: {'title': "", "url": bannerItem.param.toString()}); - } else { - await launch(bannerItem.param.toString(),forceSafariVC: false); - } - - break; - case 2: - switch (bannerItem.scene) { - case "scene_2": - List numbers = []; - if (bannerItem.param!.isNotEmpty) { - String paramJson = bannerItem.param.toString(); - paramJson = paramJson.replaceAll(r'\', ''); // 去除反斜杠转义 - Map jsonData = json.decode(paramJson); - numbers.add(MyConfigData( - jsonData['id'].toString(), jsonData['name'], false)); - } - Get.toNamed(AppRoutes.Call_out, arguments: {'numbers': numbers}); - break; - case "scene_3": - Get.toNamed(AppRoutes.FeedbackActivity); - break; - } - break; - case 3: - switch (bannerItem.scene) { - case "scene_1": - Get.toNamed(AppRoutes.Invite); - break; - case "scene_4": - if (bannerItem.param!.isEmpty) { - Get.toNamed(AppRoutes.UserInfoActivity); - } else { - Get.toNamed(AppRoutes.UserInfoActivity, - arguments: bannerItem.param.toString()); - } - break; - } - break; - } -} - -unLockWxSuccessResult(String userId) { - String currentRoute = Get.currentRoute; - if (currentRoute == AppRoutes.Home) { - EventBusManager.fire(DiscoverDataRefresh(userId)); - } else if (currentRoute == AppRoutes.UserInfoActivity) { - var logic = Get.find(); - logic.fetchUserInfo("${Api.getUserInfoTA + userId}/home"); - } else if (currentRoute == AppRoutes.Chat) { - EventBusManager.fire(ChatLoadUserInfoData()); - - } -} - -Size boundingTextSize(BuildContext context, String text, TextStyle style, - {int maxLines = 2 ^ 31, double maxWidth = double.infinity}) { - if (text == null || text.isEmpty) { - return Size.zero; - } - final TextPainter textPainter = TextPainter( - textDirection: TextDirection.ltr, - locale: Localizations.localeOf(context), - text: TextSpan(text: text, style: style), - maxLines: maxLines) - ..layout(maxWidth: maxWidth); - return textPainter.size; -} - - - -//跳转发消息页面 -pushChatPage(String userId, String imId, String userName) { - var con = V2TimConversation( - conversationID: "c2c_$imId", userID: imId, showName: userName, type: 1); - Get.toNamed(AppRoutes.Chat, arguments: con); - createCustomMsg(userId, imId); -} - -createCustomMsg(String userId, String imId) async { - if (chatIdList.contains(imId)) return; - chatIdList.add(imId); - //通过会话ID获取指定会话列表 - V2TimValueCallback> - getConversationListByConversaionIdsRes = await TencentImSDKPlugin - .v2TIMManager - .getConversationManager() - .getConversationListByConversaionIds( - conversationIDList: ["c2c_$imId"]); //需要获取会话列表数据的会话id列表 - if (getConversationListByConversaionIdsRes.code == 0 && - getConversationListByConversaionIdsRes.data!.isEmpty) { - //获取资料,然后发送自定义卡片消息 - var data = await DioManager.instance.get( - url: 'msg-service/user/$userId/chat/card', - ); - if (data['code'] == 200) { - String desc = ''; - String cityStr = ''; - Map info = {}; - - - // 对方喜欢了你100 - // ·你们有共同喜欢的圈友90 - // ·你喜欢的圈友也喜欢TA80 - // ·你们都在深圳留下过足迹70 - // ·你们有2个共同的圈子:圈子名称、圈子名称60 - // ·可能是你想认识的人50 - // ·很多圈友都喜欢TA40 - // ·TA是乐园优秀圈主哦~30 - - var titleList = []; - - var recommendCircleFriendData = data['data']; - - if (data['data']['both_interests'] != null) { - List both_interests = data['data']['both_interests']; - List circleList = []; - both_interests.forEach((element) { - circleList.add(element['title']); - }); - if (circleList.isNotEmpty) { - info['both_interests'] = - '你们有${circleList.length}个共同的圈子:${circleList.join('、')}'; - if (desc.isEmpty) { - desc = '你们有${circleList.length}个共同的圈子:${circleList.join('、')}'; - } - } - } - - if (data['data']['both_cities'] != null) { - List city = data['data']['both_cities']; - print('城市' + city.toString()); - if (city.isNotEmpty) { - desc = '你们都在${city.first}留下过足迹'; - cityStr = '你们都在${city.first}留下过足迹'; - } - } - - if (desc.isNotEmpty) { - if (data['data']['both_cities'] != null) { - info['city'] = cityStr; - } - info['title'] = recommendCircleFriendData; - info['interests'] = data['data']['interests'] ?? []; - info['my'] = data['data']['my'] ?? ''; - info['myInterests'] = data['data']['myInterests'] ?? []; - info['user'] = data['data']['user']; - info['guide_text'] = data['data']['guide_text'] ?? '请问现在有空吗?'; - await sendCustomMsg(imId, jsonEncode(info), desc); - return true; - } - } - } - return false; -} - -//发送文本消息 -sendTextMsg(String userId, {String content = '看看这次缘分匹配到哪位小可爱呢?'}) async { - // 创建文本消息 - V2TimValueCallback createTextMessageRes = - await TencentImSDKPlugin.v2TIMManager - .getMessageManager() - .createTextMessage( - text: content, // 文本信息 - ); - if (createTextMessageRes.code == 0) { - // 文本信息创建成功 - String? id = createTextMessageRes.data?.id; - // 发送文本消息 - // 在sendMessage时,若只填写receiver则发个人用户单聊消息 - // 若只填写groupID则发群组消息 - // 若填写了receiver与groupID则发群内的个人用户,消息在群聊中显示,只有指定receiver能看见 - V2TimValueCallback sendMessageRes = await TencentImSDKPlugin - .v2TIMManager - .getMessageManager() - .sendMessage(id: id!, receiver: userId, groupID: ''); - if (sendMessageRes.code == 0) { - // 发送成功 - return true; - } - return false; - } - // V2TimValueCallback createCustomMessageRes = - // await TencentImSDKPlugin.v2TIMManager - // .getMessageManager() - // .createTextAtMessage(text: '看看这次缘分匹配到哪位小可爱呢?',atUserList: [], - // ); - // if (createCustomMessageRes.code == 0) { - // String? id = createCustomMessageRes.data?.id; - // // 发送自定义消息 - // // 在sendMessage时,若只填写receiver则发个人用户单聊消息 - // // 若只填写groupID则发群组消息 - // // 若填写了receiver与groupID则发群内的个人用户,消息在群聊中显示,只有指定receiver能看见 - // V2TimValueCallback sendMessageRes = await TencentImSDKPlugin - // .v2TIMManager - // .getMessageManager() - // .sendMessage(id: id!, receiver: userId,groupID: ''); - // if (sendMessageRes.code == 0) { - // // 发送成功 - // return true; - // } - // } -} - -//发送卡片自定义消息 -sendCustomMsg(String userId, String data, String desc) async { - // 创建自定义消息 - V2TimValueCallback createCustomMessageRes = - await TencentImSDKPlugin.v2TIMManager - .getMessageManager() - .createCustomMessage( - data: data, - desc: desc, - extension: 'cardData', - ); - if (createCustomMessageRes.code == 0) { - String? id = createCustomMessageRes.data?.id; - // 发送自定义消息 - // if (Get.currentRoute == AppRoutes.Chat) { - // EventBusManager.fire(SendCoustomMessage(createCustomMessageRes)); - // } else { - V2TimValueCallback sendMessageRes = await TencentImSDKPlugin - .v2TIMManager - .getMessageManager() - .sendMessage(id: id!, receiver: userId, groupID: ''); - if (sendMessageRes.code == 0) { - // 发送成功 - EventBusManager.fire(ChatRefreshMsg()); - sendMessageRes.data?.customElem?.data; //自定义data - sendMessageRes.data?.customElem?.desc; //自定义desc - sendMessageRes.data?.customElem?.extension; //自定义extension - } - // } - } -} - -//发送用户主页自定义消息 -sendUserHomeCustomMsg(String userId, String data, String desc) async { - // 创建自定义消息 - V2TimValueCallback createCustomMessageRes = - await TencentImSDKPlugin.v2TIMManager - .getMessageManager() - .createCustomMessage( - data: data, - desc: desc, - extension: 'userHomeData', - ); - if (createCustomMessageRes.code == 0) { - String? id = createCustomMessageRes.data?.id; - - V2TimValueCallback sendMessageRes = await TencentImSDKPlugin - .v2TIMManager - .getMessageManager() - .sendMessage(id: id!, receiver: userId, groupID: ''); - if (sendMessageRes.code == 0) { - // 发送成功 - showOKToast('发送成功'); - sendMessageRes.data?.customElem?.data; //自定义data - sendMessageRes.data?.customElem?.desc; //自定义desc - sendMessageRes.data?.customElem?.extension; //自定义extension - } - - } -} - -//发送圈子自定义消息 -sendCircleCustomMsg(String userId, String data, String desc) async { - // 创建自定义消息 - V2TimValueCallback createCustomMessageRes = - await TencentImSDKPlugin.v2TIMManager - .getMessageManager() - .createCustomMessage( - data: data, - desc: desc, - extension: 'circleData', - ); - if (createCustomMessageRes.code == 0) { - String? id = createCustomMessageRes.data?.id; - if (Get.currentRoute == AppRoutes.Chat) { - EventBusManager.fire(SendCoustomMessage(createCustomMessageRes)); - } else { - V2TimValueCallback sendMessageRes = await TencentImSDKPlugin - .v2TIMManager - .getMessageManager() - .sendMessage(id: id!, receiver: userId, groupID: ''); - if (sendMessageRes.code == 0) { - // 发送成功 - showOKToast('发送成功'); - sendMessageRes.data?.customElem?.data; //自定义data - sendMessageRes.data?.customElem?.desc; //自定义desc - sendMessageRes.data?.customElem?.extension; //自定义extension - } - } - } -} - - -//发送求送礼物自定义消息 -sendGetGiftCustomMsg(String userId, String data, String desc) async { - // 创建自定义消息 - V2TimValueCallback createCustomMessageRes = - await TencentImSDKPlugin.v2TIMManager - .getMessageManager() - .createCustomMessage( - data: data, - desc: desc, - extension: 'getGiftData', - ); - if (createCustomMessageRes.code == 0) { - String? id = createCustomMessageRes.data?.id; - // 发送自定义消息 - EventBusManager.fire(SendCoustomMessage(createCustomMessageRes)); - - } -} - - -//发送许愿自定义消息 -sendGetWishCustomMsg(String userId, String data, String desc) async { - // 创建自定义消息 - V2TimValueCallback createCustomMessageRes = - await TencentImSDKPlugin.v2TIMManager - .getMessageManager() - .createCustomMessage( - data: data, - desc: desc, - extension: 'getWishData', - ); - if (createCustomMessageRes.code == 0) { - String? id = createCustomMessageRes.data?.id; - // 发送自定义消息 - EventBusManager.fire(SendCoustomMessage(createCustomMessageRes)); - // - // // 在sendMessage时,若只填写receiver则发个人用户单聊消息 - // // 若只填写groupID则发群组消息 - // // 若填写了receiver与groupID则发群内的个人用户,消息在群聊中显示,只有指定receiver能看见 - // V2TimValueCallback sendMessageRes = await TencentImSDKPlugin - // .v2TIMManager - // .getMessageManager() - // .sendMessage(id: id!, receiver: userId, groupID: ''); - // if (sendMessageRes.code == 0) { - // // 发送成功 - // sendMessageRes.data?.customElem?.data; //自定义data - // sendMessageRes.data?.customElem?.desc; //自定义desc - // sendMessageRes.data?.customElem?.extension; //自定义extension - // showOKToast('发送成功'); - // } - } -} - - -//发送邀请许愿自定义消息 -sendInventWishCustomMsg(String userId, String data, String desc) async { - // 创建自定义消息 - V2TimValueCallback createCustomMessageRes = - await TencentImSDKPlugin.v2TIMManager - .getMessageManager() - .createCustomMessage( - data: data, - desc: desc, - extension: 'getInventWishData', - ); - if (createCustomMessageRes.code == 0) { - String? id = createCustomMessageRes.data?.id; - // 发送自定义消息 - EventBusManager.fire(SendCoustomMessage(createCustomMessageRes)); - } -} - - - -//判断卡片返回信息 -Map checkCardReturnData(Map recommendCircleFriendData) { - var titleList = []; - Map info = {}; - if (recommendCircleFriendData['is_follow_me']) { - titleList.add('对方喜欢了你'); - } else if (recommendCircleFriendData['has_both_friend']) { - titleList.add('你们有共同喜欢的圈友'); - } else if (recommendCircleFriendData['has_friend_follow_to']) { - titleList.add('你喜欢的圈友也喜欢TA'); - } - if (titleList.length < 3) { - List citys = recommendCircleFriendData['both_cities']; - if (citys.isNotEmpty) { - titleList.add('你们都在${citys.first}留下过足迹'); - } - } - if (titleList.length < 3) { - List circles = recommendCircleFriendData['both_interests']; - if (circles.isNotEmpty) { - List both_interests = - recommendCircleFriendData['both_interests']; - List circleList = []; - both_interests.forEach((element) { - circleList.add(element['title']); - }); - if (circleList.isNotEmpty) { - titleList - .add('你们有${circleList.length}个共同的圈子:${circleList.join('、')}'); - } - } - } - if (titleList.length < 3) { - if (recommendCircleFriendData.containsKey('is_new_user')) { - titleList.add('我刚来到这里哦'); - } - } - - if (titleList.length < 3) { - if (recommendCircleFriendData['is_wanna_meet']) { - titleList.add('很多圈友都喜欢TA'); - } - } - - if (titleList.length < 3) { - if (recommendCircleFriendData['is_most_fans']) { - titleList.add('可能是你想认识的人'); - } - } - - if (titleList.length < 3) { - if (recommendCircleFriendData['is_excellent_qz_leader']) { - titleList.add('TA是乐园优秀圈主哦~'); - } - } - - if (titleList.length >= 1) { - info['city'] = titleList.first; - } - - if (titleList.length >= 2) { - info['both_interests'] = titleList[1]; - } - - if (titleList.length >= 3) { - info['desc'] = titleList[2]; - } - return info; -} - -Future> loadConverstationListData() async { - TUIConversationViewModel model = - serviceLocator(); - - List filteredConversationList = model.conversationList - .where( - (element) => (element?.groupID != null || element?.userID != null)) - .toList(); - - // 过滤指定的 userID qpqz_prod_10_10000000000 - String devtTargetUserID = "qpqz_dev_10_10000000000"; - String prodTargetUserID = "qpqz_prod_10_10000000000"; - filteredConversationList = filteredConversationList - .where((conversation) => - conversation?.userID != devtTargetUserID && - conversation?.userID != prodTargetUserID) - .toList(); - - - List userIdList = []; - - filteredConversationList.forEach((element) { - userIdList.add(element!.userID!); - }); - - V2TimValueCallback getLoginUserRes = - await TencentImSDKPlugin.v2TIMManager.getLoginUser(); - if (getLoginUserRes.code == 0) { - //获取成功 - if (getLoginUserRes.data != null) { - userIdList.insert( - 0, getLoginUserRes.data!); // getLoginUserRes.data为查询到的登录用户的UserID - } - } - //获取用户资料 - V2TimValueCallback> getUsersInfoRes = - await TencentImSDKPlugin.v2TIMManager - .getUsersInfo(userIDList: userIdList); //需要查询的用户id列表 - if (getUsersInfoRes.code == 0) { - // 查询成功 - getUsersInfoRes.data?.forEach((element) { - element.allowType; //用户的好友验证方式 0:允许所有人加我好友 1:不允许所有人加我好友 2:加我好友需我确认 - element.birthday; //用户生日 - element.customInfo; //用户的自定义状态 - element.faceUrl; //用户头像 url - element.gender; //用户的性别 1:男 2:女 - element.level; //用户的等级 - element.nickName; //用户昵称 - element.role; //用户的角色 - element.selfSignature; //用户的签名 - element.userID; //用户 ID - }); - return getUsersInfoRes.data ?? []; - } - return []; -} - -showVipDialog() { - Get.bottomSheet( - Scaffold( - backgroundColor: Colors.transparent, - body: Open_vip_tipPage(false), - ), - isScrollControlled: true, - enableDrag: false).then((value) { - - }); -} - -locationDialog() { - - Get.bottomSheet(CupertinoAlertDialog( - content: - SingleChildScrollView( - child: ListBody( - children: [Text("请开启位置权限用于寻找附近用户")], - ), - ), - actions: [ - CupertinoDialogAction( - child: Text("确定"), - onPressed: (){ - Get.back(); - AppSettings.openAppSettings(); - }, - ), - CupertinoDialogAction( - child: Text("取消"), - onPressed: (){ - Get.back(); - }, - ), - ], - ),isScrollControlled: true, - enableDrag: false - ); -} - - - -Future checkPhotosStatus() async { - var status = await Permission.photos.status; - if (PermissionStatus.permanentlyDenied == status) { - Get.bottomSheet(CupertinoAlertDialog( - content: - SingleChildScrollView( - child: ListBody( - children: [Text("请开启相册权限以上传图片/视频")], - ), - ), - actions: [ - CupertinoDialogAction( - child: Text("确定"), - onPressed: (){ - AppSettings.openAppSettings(); - }, - ), - CupertinoDialogAction( - child: Text("取消"), - onPressed: (){ - Get.back(); - }, - ), - ], - ),isScrollControlled: true, - enableDrag: false - ); - - } - return PermissionStatus.permanentlyDenied == status; -} - -pushPage(String action,String param,{String name = ''}) { - // public final static String MY_MAIN = "my_main";//我的主页 - // public final static String MY_USER_HOME = "my_user_home";//我的个人主页 - // public final static String TO_USER_HOME = "to_user_home";//他人用户主页 - // public final static String MY_GIFT_HALL = "my_gift_hall";//礼物馆 - // public final static String TO_GIFT_HALL = "to_gift_hall";//他人礼物馆 - // public final static String USER_HOME_CALLOUT = "user_home_callout";//个人主页喊话栏目 - // public final static String CHAT = "chat";//私聊 - // public final static String STORY_PERSONAGE = "story_personage";//故事达人 - // public final static String FIND_PAGE = "find_page";//发现栏目 - // public final static String CUSTOM_SERVICE = "custom_service";//客服 - // public final static String INVITE = "invite";//邀请页 - // public final static String WALLET = "wallet";//个人资产/钱包 - // public final static String OFFSITE_SHARE = "offsite_share";//站外分享 - // public final static String GOOD_RATE = "good_rate";//好评反馈 - // public final static String BUY_VIP = "buy_vip";//购买会员 - // public final static String RECHARGE = "recharge";//充值 - // public final static String INTEREST = "interest";//圈子 - // public final static String GOOD_AUTH = "good_auth";//good认证 - if (action == 'my_main') { - Get.until((route) => route.settings.name == '/home'); - final homeLogic = Get.put(HomeLogic()); - homeLogic.tabController.animateTo(3); - homeLogic.updateIndex(3); - } else if (action == 'my_user_home') { - Get.toNamed(AppRoutes.UserInfoActivity); - } else if (action == 'find_page') { - Get.until((route) => route.settings.name == '/home'); - final homeLogic = Get.put(HomeLogic()); - homeLogic.tabController.animateTo(0); - homeLogic.updateIndex(0); - Future.delayed(Duration(milliseconds: 200),() { - EventBusManager.fire(ChangeIndex(2)); - }); - } else if (action == 'to_user_home' || action == 'user_home_callout') { - Get.toNamed(AppRoutes.UserInfoActivity,arguments: param); - } else if (action == 'my_gift_hall') { - Get.toNamed(AppRoutes.GiftShopPage,arguments: ''); - } else if (action == 'to_gift_hall') { - Get.toNamed(AppRoutes.GiftShopPage,arguments: param); - } else if (action == 'invite') { - Get.toNamed(AppRoutes.Invite); - } else if (action == 'wallet') { - Get.toNamed(AppRoutes.MyAssets); - } else if (action == 'offsite_share') { - Get.toNamed(AppRoutes.ExternalsharePage); - } else if (action == 'good_rate') { - if (Platform.isAndroid) { - Get.toNamed(AppRoutes.Good_Reviews); - } else { - launch('https://apps.apple.com/cn/app/%E5%BE%AE%E4%B9%90%E5%9B%AD-%E4%BA%9A%E6%96%87%E5%8C%96%E5%A4%9A%E5%85%83%E4%BA%A4%E5%8F%8B%E5%9F%BA%E5%9C%B0/id6459449499', forceSafariVC: false); - } - - } else if (action == 'buy_vip') { - showOepnVipDialog(); - } else if (action == 'recharge') { - showRechargeScreenDialog(); - } else if (action == 'chat') { - pushChatPage(param.split('_').last, param, name); - } else if (action == 'custom_service') { - var con; - if(kDebugMode){ - con = V2TimConversation( - conversationID: "c2c_qpqz_dev_10_102", userID: "qpqz_dev_10_102", showName: "测试乐园客服", type: 1); - }else{ - con = V2TimConversation( - conversationID: "c2c_qpqz_prod_10_102", userID: "qpqz_prod_10_102", showName: "乐园客服", type: 1); - } - Get.toNamed(AppRoutes.Chat, arguments: con); - } else if(action == 'interest') { - Get.toNamed(AppRoutes.Signal_circle_list,arguments: param); - } else if(action == 'good_auth') { - var con; - if(kDebugMode){ - con = V2TimConversation( - conversationID: "c2c_qpqz_dev_10_102", userID: "qpqz_dev_10_102", showName: "测试乐园客服", type: 1); - }else{ - con = V2TimConversation( - conversationID: "c2c_qpqz_prod_10_102", userID: "qpqz_prod_10_102", showName: "乐园客服", type: 1); - } - Get.toNamed(AppRoutes.Chat, arguments: con); - DioManager.instance.post(url: Api.goodAuth); - } else if (action == 'apply_interest_agent') { - sendApplyToAgentData(param); - } - -} - -void sendApplyToAgentData(var circleId) async { - var data = await DioManager.instance - .post(url: Api.applyToAgent + '$circleId'); - if (data['code'] == 200) { - - var con; - if(kDebugMode){ - con = V2TimConversation( - conversationID: "c2c_qpqz_dev_10_102", userID: "qpqz_dev_10_102", showName: "测试乐园客服", type: 1); - }else{ - con = V2TimConversation( - conversationID: "c2c_qpqz_prod_10_102", userID: "qpqz_prod_10_102", showName: "乐园客服", type: 1); - } - Get.toNamed(AppRoutes.Chat, arguments: con); - } else if (data['code'] == 32104) { - showReportDialog(Get.context!,data['msg']); - } -} - -void showReportDialog(BuildContext context,String msg) { - showDialog( - context: context, - builder: (BuildContext context) { - return Dialog( - backgroundColor: Colors.transparent, - child: Container( - height: 200.sp, - padding: const EdgeInsets.all(1.0), - child: Stack( - children: [ - Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - color: AppColor.bgColor, - borderRadius: BorderRadius.circular(12.0.sp), - // gradient: const LinearGradient( - // colors: [Color(0xFFDD3DF4), Color(0xFF30FFD9)], - // begin: Alignment.topCenter, - // end: Alignment.bottomCenter, - // ), - ), - ), - // Container( - // margin: EdgeInsets.all(1.sp), - // child: Image.asset(getMineImage("im_neglect"),fit: BoxFit.fill,), - // ), - Container( - margin: EdgeInsets.only(top: 12.sp), - child: Column( - children: [ - Center( - child: Text( - "申请代理提示", - style: - TextStyle(color: Colors.white, fontSize: 16.sp), - ), - ), - Container( - margin: EdgeInsets.only( - top: 12.sp, left: 14.sp, right: 14.sp), - alignment: Alignment.center, - child: Text( - msg, - textAlign: TextAlign.left, - style: TextStyle( - color: const Color(0xCCF7FAFA), fontSize: 16.sp), - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - - GestureDetector( - onTap: () { - Get.back(); - Get.toNamed(AppRoutes.Invite); - }, - child: Container( - margin: EdgeInsets.only(top: 16.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17), - gradient: const LinearGradient( - colors: [ - Color(0x26FFFFFF), - Color(0x26FFFFFF), - ], - begin: Alignment.centerLeft, - end: Alignment.centerRight, - ), - ), - padding: EdgeInsets.only( - top: 10.sp, - bottom: 10.sp, - left: 52.sp, - right: 52.sp), - child: const Text( - "前往邀请", - style: TextStyle( - color: Colors.white, - fontSize: 12, - ), - ), - ), - ) - ], - ) - ], - ), - ) - ], - ), - ), - ); - }, - ); -} - -Future getCurrentPosition() async { - return await Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.low); -} - -Future showUpdateWxPicker({String phone = ''}) { - return Get.bottomSheet(WxEditDialog(phone),isScrollControlled: true,enableDrag: false); -} -bool isValidQQ(String qq) { - String qqRegexp = r'^[1-9][0-9]{4,10}$'; - RegExp regExp = RegExp(qqRegexp); - return regExp.hasMatch(qq); -} - - -checkMyUserStatus() async { - var data = await DioManager.instance.get(url: Api.getUserInfo); - if (data['code'] == 200) { - // UserInfoModel model = UserInfoModel.fromJson(data['data']); - // if (model.wxNum?.isNotEmpty ?? false) { - // showToast('已成功解锁TA的微信,快去和TA私聊呗~'); - // } else { - // showToast('你已成功解锁TA的微信,建议您也填写微信,方便对方快速找到您哦~'); - // } - } -}