Browse Source

完善页面

dev-2.0
王子贤 2 weeks ago
parent
commit
7eec42dd85
6 changed files with 53 additions and 3 deletions
  1. BIN
      assets/images/message_page_empty.png
  2. BIN
      assets/images/search_page_empty.png
  3. 4
      lib/controller/discover/search_page_controller.dart
  4. 2
      lib/generated/assets.dart
  5. 22
      lib/pages/discover/search_page.dart
  6. 28
      lib/pages/message/conversation_tab.dart

BIN
assets/images/message_page_empty.png

Before After
Width: 262  |  Height: 290  |  Size: 20 KiB

BIN
assets/images/search_page_empty.png

Before After
Width: 278  |  Height: 306  |  Size: 24 KiB

4
lib/controller/discover/search_page_controller.dart

@ -23,6 +23,8 @@ class SearchPageController extends GetxController {
final matchmakerList = <Records>[].obs;
final search = false.obs;
Timer? _debounce;
void onTextChanged(String text) {
@ -37,6 +39,7 @@ class SearchPageController extends GetxController {
searchData() async {
if(name.value.trim() == "" || name.value.trim().isEmpty){
search.value = false;
return;
}
try{
@ -48,6 +51,7 @@ class SearchPageController extends GetxController {
final data = response.data.data?.records ?? [];
matchmakerList.value = data.toList();
search.value = true;
} else {

2
lib/generated/assets.dart

@ -160,6 +160,7 @@ class Assets {
static const String imagesMatchmakerIcon4 = 'assets/images/matchmaker_icon4.png';
static const String imagesMatchmakerTag = 'assets/images/matchmaker_tag.png';
static const String imagesMessageNol = 'assets/images/message_nol.png';
static const String imagesMessagePageEmpty = 'assets/images/message_page_empty.png';
static const String imagesMessagePre = 'assets/images/message_pre.png';
static const String imagesMicClose = 'assets/images/mic_close.png';
static const String imagesMicCouponIcon = 'assets/images/mic_coupon_icon.png';
@ -202,6 +203,7 @@ class Assets {
static const String imagesRoseWhite = 'assets/images/rose_white.png';
static const String imagesRtcEmpty = 'assets/images/rtc_empty.png';
static const String imagesSearch = 'assets/images/search.png';
static const String imagesSearchPageEmpty = 'assets/images/search_page_empty.png';
static const String imagesSeat = 'assets/images/seat.png';
static const String imagesSendCall = 'assets/images/send_call.png';
static const String imagesSendMessageIcon = 'assets/images/send_message_icon.png';

22
lib/pages/discover/search_page.dart

@ -90,7 +90,7 @@ class SearchPage extends StatelessWidget {
padding: EdgeInsets.symmetric(horizontal: 15.w),
child: Column(
children: [
if(controller.matchmakerList.isEmpty) Container(
if(controller.matchmakerList.isEmpty && !controller.search.value) Container(
padding: EdgeInsets.only(top: 45.w),
child: Column(
children: [
@ -106,6 +106,26 @@ class SearchPage extends StatelessWidget {
],
),
),
if(controller.matchmakerList.isEmpty && controller.search.value) Container(
padding: EdgeInsets.only(top: 45.w),
child: Column(
children: [
Image.asset(
Assets.imagesSearchPageEmpty,
width: 69.w,
),
Text(
"搜索失败"
),
Text(
"请输入正确的昵称或ID",
style: TextStyle(
color: const Color.fromRGBO(189, 189, 189, 1)
),
),
],
),
),
...controller.matchmakerList.map((e){
return SearchItem(item: e,);
}),

28
lib/pages/message/conversation_tab.dart

@ -100,7 +100,7 @@ class _ConversationTabState extends State<ConversationTab>
return Obx(() {
final filteredConversations = controller.conversations;
if (filteredConversations.isEmpty) {
if (filteredConversations.isEmpty && !controller.isSearch.value) {
return Center(
child: Text(
controller.filterType.value == FilterType.none
@ -114,12 +114,36 @@ class _ConversationTabState extends State<ConversationTab>
);
}
if (filteredConversations.isEmpty && controller.isSearch.value) {
return Container(
padding: EdgeInsets.only(top: 45.w),
child: Column(
children: [
Image.asset(
Assets.imagesMessagePageEmpty,
width: 69.w,
),
Text(
"暂无消息"
),
Text(
"换个关键词试试吧",
style: TextStyle(
color: const Color.fromRGBO(189, 189, 189, 1)
),
),
],
),
);
}
return ListView.builder(
padding: const EdgeInsets.only(top: 8),
itemCount: filteredConversations.length,
itemBuilder: (context, index) {
final conversation = filteredConversations[index];
return BuildConversationItem(conversation: conversation);
return BuildConversationItem(conversation: conversation, key: ValueKey(conversation.id),);
},
);
});

Loading…
Cancel
Save