|
@@ -1,12 +1,12 @@
|
|
|
import 'dart:ui';
|
|
import 'dart:ui';
|
|
|
|
|
|
|
|
|
|
+import 'package:flutter/material.dart';
|
|
|
import 'package:flutter/src/widgets/framework.dart';
|
|
import 'package:flutter/src/widgets/framework.dart';
|
|
|
import 'package:flutter/widgets.dart';
|
|
import 'package:flutter/widgets.dart';
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
import 'package:get/get.dart';
|
|
import 'package:get/get.dart';
|
|
|
import 'package:get/get_core/src/get_main.dart';
|
|
import 'package:get/get_core/src/get_main.dart';
|
|
|
import 'package:location/base/base_page.dart';
|
|
import 'package:location/base/base_page.dart';
|
|
|
-import 'package:location/data/bean/message_info.dart';
|
|
|
|
|
import 'package:location/utils/common_expand.dart';
|
|
import 'package:location/utils/common_expand.dart';
|
|
|
import '../../resource/assets.gen.dart';
|
|
import '../../resource/assets.gen.dart';
|
|
|
import '../../resource/colors.gen.dart';
|
|
import '../../resource/colors.gen.dart';
|
|
@@ -37,27 +37,25 @@ class NewsPage extends BasePage<NewsController> {
|
|
|
top: 24.w,
|
|
top: 24.w,
|
|
|
right: 19.w,
|
|
right: 19.w,
|
|
|
child: SafeArea(child: Obx(() {
|
|
child: SafeArea(child: Obx(() {
|
|
|
- return Opacity(
|
|
|
|
|
- opacity: 1 - controller.opacity,
|
|
|
|
|
- child: Assets.images.iconNews.image(width: 118.w));
|
|
|
|
|
|
|
+ return Visibility(
|
|
|
|
|
+ visible: controller.waitingNewsCount > 0 ||
|
|
|
|
|
+ controller.messageList.isNotEmpty,
|
|
|
|
|
+ child: Opacity(
|
|
|
|
|
+ opacity: 1 - controller.opacity,
|
|
|
|
|
+ child: Assets.images.iconNews.image(width: 118.w)),
|
|
|
|
|
+ );
|
|
|
}))),
|
|
}))),
|
|
|
SafeArea(
|
|
SafeArea(
|
|
|
child: Column(
|
|
child: Column(
|
|
|
children: [
|
|
children: [
|
|
|
buildHeadView(),
|
|
buildHeadView(),
|
|
|
- Expanded(
|
|
|
|
|
- child: CustomScrollView(
|
|
|
|
|
- controller: controller.scrollController,
|
|
|
|
|
- slivers: [
|
|
|
|
|
- buildSliverTitle(),
|
|
|
|
|
- buildSliverWaiting(),
|
|
|
|
|
- Obx(() {
|
|
|
|
|
- return SliverList.builder(
|
|
|
|
|
- itemBuilder: buildNewsItem,
|
|
|
|
|
- itemCount: controller.messageList.length);
|
|
|
|
|
- })
|
|
|
|
|
- ],
|
|
|
|
|
- ))
|
|
|
|
|
|
|
+ Obx(() {
|
|
|
|
|
+ return Expanded(
|
|
|
|
|
+ child: controller.waitingNewsCount == 0 &&
|
|
|
|
|
+ controller.messageList.isEmpty
|
|
|
|
|
+ ? buildNoMessageView()
|
|
|
|
|
+ : buildHasMessageView());
|
|
|
|
|
+ })
|
|
|
],
|
|
],
|
|
|
),
|
|
),
|
|
|
)
|
|
)
|
|
@@ -65,6 +63,21 @@ class NewsPage extends BasePage<NewsController> {
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ CustomScrollView buildHasMessageView() {
|
|
|
|
|
+ return CustomScrollView(
|
|
|
|
|
+ controller: controller.scrollController,
|
|
|
|
|
+ slivers: [
|
|
|
|
|
+ buildSliverTitle(),
|
|
|
|
|
+ buildSliverWaiting(),
|
|
|
|
|
+ Obx(() {
|
|
|
|
|
+ return SliverList.builder(
|
|
|
|
|
+ itemBuilder: buildNewsItem,
|
|
|
|
|
+ itemCount: controller.messageList.length);
|
|
|
|
|
+ })
|
|
|
|
|
+ ],
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
SliverToBoxAdapter buildSliverTitle() {
|
|
SliverToBoxAdapter buildSliverTitle() {
|
|
|
return SliverToBoxAdapter(
|
|
return SliverToBoxAdapter(
|
|
|
child: Column(
|
|
child: Column(
|
|
@@ -117,29 +130,32 @@ class NewsPage extends BasePage<NewsController> {
|
|
|
if (controller.waitingNewsCount == 0) {
|
|
if (controller.waitingNewsCount == 0) {
|
|
|
return SizedBox.shrink();
|
|
return SizedBox.shrink();
|
|
|
}
|
|
}
|
|
|
- return buildMessageItem(Assets.images.iconNewsItem.provider(),
|
|
|
|
|
- title: StringName.newsRequestTitle,
|
|
|
|
|
- content: StringName.newsRequestDesc,
|
|
|
|
|
- contentTextStyle:
|
|
|
|
|
- TextStyle(fontSize: 12.sp, color: ColorName.black60),
|
|
|
|
|
- createTime: controller.latestFriendRequest?.createTime ?? 0,
|
|
|
|
|
- statusWidget: Container(
|
|
|
|
|
- height: 16.w,
|
|
|
|
|
- constraints: BoxConstraints(
|
|
|
|
|
- minWidth: 16.w,
|
|
|
|
|
- ),
|
|
|
|
|
- padding: EdgeInsets.symmetric(horizontal: 2.w),
|
|
|
|
|
- decoration: BoxDecoration(
|
|
|
|
|
- color: '#FF333D'.color,
|
|
|
|
|
- borderRadius: BorderRadius.circular(100),
|
|
|
|
|
- ),
|
|
|
|
|
- child: Center(
|
|
|
|
|
- child: Text('${controller.waitingNewsCount}',
|
|
|
|
|
- textAlign: TextAlign.center,
|
|
|
|
|
- style: TextStyle(
|
|
|
|
|
- fontSize: 10.sp, color: ColorName.white, height: 1)),
|
|
|
|
|
- ),
|
|
|
|
|
- ));
|
|
|
|
|
|
|
+ return GestureDetector(
|
|
|
|
|
+ onTap: () => controller.onMessageWaitingClick(),
|
|
|
|
|
+ child: buildMessageItem(Assets.images.iconNewsItem.provider(),
|
|
|
|
|
+ title: StringName.newsRequestTitle,
|
|
|
|
|
+ content: StringName.newsRequestDesc,
|
|
|
|
|
+ contentTextStyle:
|
|
|
|
|
+ TextStyle(fontSize: 12.sp, color: ColorName.black60),
|
|
|
|
|
+ createTime: controller.latestFriendRequest?.createTime ?? 0,
|
|
|
|
|
+ statusWidget: Container(
|
|
|
|
|
+ height: 16.w,
|
|
|
|
|
+ constraints: BoxConstraints(
|
|
|
|
|
+ minWidth: 16.w,
|
|
|
|
|
+ ),
|
|
|
|
|
+ padding: EdgeInsets.symmetric(horizontal: 2.w),
|
|
|
|
|
+ decoration: BoxDecoration(
|
|
|
|
|
+ color: '#FF333D'.color,
|
|
|
|
|
+ borderRadius: BorderRadius.circular(100),
|
|
|
|
|
+ ),
|
|
|
|
|
+ child: Center(
|
|
|
|
|
+ child: Text('${controller.waitingNewsCount}',
|
|
|
|
|
+ textAlign: TextAlign.center,
|
|
|
|
|
+ style: TextStyle(
|
|
|
|
|
+ fontSize: 10.sp, color: ColorName.white, height: 1)),
|
|
|
|
|
+ ),
|
|
|
|
|
+ )),
|
|
|
|
|
+ );
|
|
|
}));
|
|
}));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -148,4 +164,20 @@ class NewsPage extends BasePage<NewsController> {
|
|
|
return buildMessageInfoItem(
|
|
return buildMessageInfoItem(
|
|
|
item, (info) => controller.onMessageFunClick(info));
|
|
item, (info) => controller.onMessageFunClick(info));
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ Widget buildNoMessageView() {
|
|
|
|
|
+ return Align(
|
|
|
|
|
+ alignment: Alignment(0, -0.1),
|
|
|
|
|
+ child: IntrinsicHeight(
|
|
|
|
|
+ child: Column(
|
|
|
|
|
+ children: [
|
|
|
|
|
+ Assets.images.iconNews.image(width: 150.w),
|
|
|
|
|
+ SizedBox(height: 9.w),
|
|
|
|
|
+ Text(StringName.messageNoData,
|
|
|
|
|
+ style: TextStyle(fontSize: 16.sp, color: ColorName.black60))
|
|
|
|
|
+ ],
|
|
|
|
|
+ ),
|
|
|
|
|
+ ),
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|