mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
feat: 初步支持查看【回复我的】【at我】【收到的赞】内容
This commit is contained in:
43
lib/pages/msg_feed_top/at_me/controller.dart
Normal file
43
lib/pages/msg_feed_top/at_me/controller.dart
Normal file
@@ -0,0 +1,43 @@
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pilipala/http/msg.dart';
|
||||
import 'package:pilipala/models/msg/msgfeed_at_me.dart';
|
||||
|
||||
class AtMeController extends GetxController {
|
||||
RxList<AtMeItems> msgFeedAtMeList = <AtMeItems>[].obs;
|
||||
bool isLoading = false;
|
||||
int cursor = -1;
|
||||
int cursorTime = -1;
|
||||
bool isEnd = false;
|
||||
|
||||
Future queryMsgFeedAtMe() async {
|
||||
if (isLoading) return;
|
||||
isLoading = true;
|
||||
var res = await MsgHttp.msgFeedAtMe(cursor: cursor, cursorTime: cursorTime);
|
||||
isLoading = false;
|
||||
if (res['status']) {
|
||||
MsgFeedAtMe data = MsgFeedAtMe.fromJson(res['data']);
|
||||
isEnd = data.cursor?.isEnd ?? false;
|
||||
if (cursor == -1) {
|
||||
msgFeedAtMeList.assignAll(data.items!);
|
||||
} else {
|
||||
msgFeedAtMeList.addAll(data.items!);
|
||||
}
|
||||
cursor = data.cursor?.id ?? -1;
|
||||
cursorTime = data.cursor?.time ?? -1;
|
||||
} else {
|
||||
SmartDialog.showToast(res['msg']);
|
||||
}
|
||||
}
|
||||
|
||||
Future onLoad() async {
|
||||
if (isEnd) return;
|
||||
queryMsgFeedAtMe();
|
||||
}
|
||||
|
||||
Future onRefresh() async {
|
||||
cursor = -1;
|
||||
queryMsgFeedAtMe();
|
||||
}
|
||||
|
||||
}
|
||||
4
lib/pages/msg_feed_top/at_me/index.dart
Normal file
4
lib/pages/msg_feed_top/at_me/index.dart
Normal file
@@ -0,0 +1,4 @@
|
||||
library whisper;
|
||||
|
||||
export './controller.dart';
|
||||
export './view.dart';
|
||||
124
lib/pages/msg_feed_top/at_me/view.dart
Normal file
124
lib/pages/msg_feed_top/at_me/view.dart
Normal file
@@ -0,0 +1,124 @@
|
||||
import 'package:easy_debounce/easy_throttle.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||
|
||||
import 'controller.dart';
|
||||
|
||||
class AtMePage extends StatefulWidget {
|
||||
const AtMePage({super.key});
|
||||
|
||||
@override
|
||||
State<AtMePage> createState() => _AtMePageState();
|
||||
}
|
||||
|
||||
class _AtMePageState extends State<AtMePage> {
|
||||
late final AtMeController _atMeController = Get.put(AtMeController());
|
||||
final ScrollController _scrollController = ScrollController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_atMeController.queryMsgFeedAtMe();
|
||||
super.initState();
|
||||
_scrollController.addListener(_scrollListener);
|
||||
}
|
||||
|
||||
Future _scrollListener() async {
|
||||
if (_scrollController.position.pixels >=
|
||||
_scrollController.position.maxScrollExtent - 200) {
|
||||
EasyThrottle.throttle('my-throttler', const Duration(milliseconds: 800),
|
||||
() async {
|
||||
await _atMeController.onLoad();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('@我的'),
|
||||
),
|
||||
body: RefreshIndicator(
|
||||
onRefresh: () async {
|
||||
await _atMeController.onRefresh();
|
||||
},
|
||||
child: SingleChildScrollView(
|
||||
controller: _scrollController,
|
||||
child: LayoutBuilder(
|
||||
builder: (BuildContext context, BoxConstraints constraints) {
|
||||
return Obx(
|
||||
() {
|
||||
if (_atMeController.msgFeedAtMeList.isEmpty) {
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
);
|
||||
}
|
||||
return ListView.separated(
|
||||
itemCount: _atMeController.msgFeedAtMeList.length,
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemBuilder: (_, int i) {
|
||||
return ListTile(
|
||||
onTap: () {
|
||||
String nativeUri = _atMeController
|
||||
.msgFeedAtMeList[i].item?.nativeUri ??
|
||||
"";
|
||||
SmartDialog.showToast("跳转至:$nativeUri(暂未实现)");
|
||||
},
|
||||
leading: NetworkImgLayer(
|
||||
width: 45,
|
||||
height: 45,
|
||||
type: 'avatar',
|
||||
src: _atMeController.msgFeedAtMeList[i].user?.avatar,
|
||||
),
|
||||
title: Text(
|
||||
"${_atMeController.msgFeedAtMeList[i].user?.nickname} "
|
||||
"在${_atMeController.msgFeedAtMeList[i].item?.business}中@了我",
|
||||
style: Theme.of(context).textTheme.bodyMedium!,
|
||||
),
|
||||
subtitle: Text(
|
||||
_atMeController
|
||||
.msgFeedAtMeList[i].item?.sourceContent ??
|
||||
"",
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.labelMedium!
|
||||
.copyWith(
|
||||
color:
|
||||
Theme.of(context).colorScheme.outline)),
|
||||
trailing: _atMeController
|
||||
.msgFeedAtMeList[i].item?.image !=
|
||||
null &&
|
||||
_atMeController.msgFeedAtMeList[i].item?.image !=
|
||||
""
|
||||
? NetworkImgLayer(
|
||||
width: 45,
|
||||
height: 45,
|
||||
type: 'cover',
|
||||
src: _atMeController
|
||||
.msgFeedAtMeList[i].item?.image,
|
||||
)
|
||||
: null,
|
||||
);
|
||||
},
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return Divider(
|
||||
indent: 72,
|
||||
endIndent: 20,
|
||||
height: 6,
|
||||
color: Colors.grey.withOpacity(0.1),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
43
lib/pages/msg_feed_top/like_me/controller.dart
Normal file
43
lib/pages/msg_feed_top/like_me/controller.dart
Normal file
@@ -0,0 +1,43 @@
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pilipala/http/msg.dart';
|
||||
import '../../../models/msg/msgfeed_like_me.dart';
|
||||
|
||||
class LikeMeController extends GetxController {
|
||||
RxList<LikeMeItems> msgFeedLikeMeList = <LikeMeItems>[].obs;
|
||||
bool isLoading = false;
|
||||
int cursor = -1;
|
||||
int cursorTime = -1;
|
||||
bool isEnd = false;
|
||||
|
||||
Future queryMsgFeedLikeMe() async {
|
||||
if (isLoading) return;
|
||||
isLoading = true;
|
||||
var res = await MsgHttp.msgFeedLikeMe(cursor: cursor, cursorTime: cursorTime);
|
||||
isLoading = false;
|
||||
if (res['status']) {
|
||||
MsgFeedLikeMe data = MsgFeedLikeMe.fromJson(res['data']);
|
||||
isEnd = data.total?.cursor?.isEnd ?? false;
|
||||
if (cursor == -1) {
|
||||
msgFeedLikeMeList.assignAll(data.total!.items!);
|
||||
} else {
|
||||
msgFeedLikeMeList.addAll(data.total!.items!);
|
||||
}
|
||||
cursor = data.total?.cursor?.id ?? -1;
|
||||
cursorTime = data.total?.cursor?.time ?? -1;
|
||||
} else {
|
||||
SmartDialog.showToast(res['msg']);
|
||||
}
|
||||
}
|
||||
|
||||
Future onLoad() async {
|
||||
if (isEnd) return;
|
||||
queryMsgFeedLikeMe();
|
||||
}
|
||||
|
||||
Future onRefresh() async {
|
||||
cursor = -1;
|
||||
queryMsgFeedLikeMe();
|
||||
}
|
||||
|
||||
}
|
||||
4
lib/pages/msg_feed_top/like_me/index.dart
Normal file
4
lib/pages/msg_feed_top/like_me/index.dart
Normal file
@@ -0,0 +1,4 @@
|
||||
library whisper;
|
||||
|
||||
export './controller.dart';
|
||||
export './view.dart';
|
||||
167
lib/pages/msg_feed_top/like_me/view.dart
Normal file
167
lib/pages/msg_feed_top/like_me/view.dart
Normal file
@@ -0,0 +1,167 @@
|
||||
import 'package:easy_debounce/easy_throttle.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||
|
||||
import 'controller.dart';
|
||||
|
||||
class LikeMePage extends StatefulWidget {
|
||||
const LikeMePage({super.key});
|
||||
|
||||
@override
|
||||
State<LikeMePage> createState() => _LikeMePageState();
|
||||
}
|
||||
|
||||
class _LikeMePageState extends State<LikeMePage> {
|
||||
late final LikeMeController _likeMeController = Get.put(LikeMeController());
|
||||
final ScrollController _scrollController = ScrollController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_likeMeController.queryMsgFeedLikeMe();
|
||||
super.initState();
|
||||
_scrollController.addListener(_scrollListener);
|
||||
}
|
||||
|
||||
Future _scrollListener() async {
|
||||
if (_scrollController.position.pixels >=
|
||||
_scrollController.position.maxScrollExtent - 200) {
|
||||
EasyThrottle.throttle('my-throttler', const Duration(milliseconds: 800),
|
||||
() async {
|
||||
await _likeMeController.onLoad();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('收到的赞'),
|
||||
),
|
||||
body: RefreshIndicator(
|
||||
onRefresh: () async {
|
||||
await _likeMeController.onRefresh();
|
||||
},
|
||||
child: SingleChildScrollView(
|
||||
controller: _scrollController,
|
||||
child: LayoutBuilder(
|
||||
builder: (BuildContext context, BoxConstraints constraints) {
|
||||
return Obx(
|
||||
() {
|
||||
if (_likeMeController.msgFeedLikeMeList.isEmpty) {
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
);
|
||||
}
|
||||
return ListView.separated(
|
||||
itemCount: _likeMeController.msgFeedLikeMeList.length,
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemBuilder: (_, int i) {
|
||||
return ListTile(
|
||||
onTap: () {
|
||||
String nativeUri = _likeMeController
|
||||
.msgFeedLikeMeList[i].item?.nativeUri ??
|
||||
"";
|
||||
SmartDialog.showToast("跳转至:$nativeUri(暂未实现)");
|
||||
},
|
||||
leading: SizedBox(
|
||||
width: 50,
|
||||
height: 50,
|
||||
child: Stack(
|
||||
children: [
|
||||
for (var j = 0;
|
||||
j <
|
||||
_likeMeController.msgFeedLikeMeList[i]
|
||||
.users!.length &&
|
||||
j < 4;
|
||||
j++) ...<Widget>[
|
||||
Positioned(
|
||||
left: 15 * (j % 2).toDouble(),
|
||||
top: 15 * (j ~/ 2).toDouble(),
|
||||
child: NetworkImgLayer(
|
||||
width: _likeMeController
|
||||
.msgFeedLikeMeList[i]
|
||||
.users!
|
||||
.length >
|
||||
1
|
||||
? 30
|
||||
: 45,
|
||||
height: _likeMeController
|
||||
.msgFeedLikeMeList[i]
|
||||
.users!
|
||||
.length >
|
||||
1
|
||||
? 30
|
||||
: 45,
|
||||
type: 'avatar',
|
||||
src: _likeMeController
|
||||
.msgFeedLikeMeList[i]
|
||||
.users![j]
|
||||
.avatar,
|
||||
)),
|
||||
]
|
||||
],
|
||||
)),
|
||||
title: Text(
|
||||
"${_likeMeController.msgFeedLikeMeList[i].users!.map((e) => e.nickname).join("、")} "
|
||||
"赞了我的${_likeMeController.msgFeedLikeMeList[i].item?.business}",
|
||||
style: Theme.of(context).textTheme.bodyMedium!,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
subtitle:
|
||||
_likeMeController.msgFeedLikeMeList[i].item?.title !=
|
||||
null &&
|
||||
_likeMeController
|
||||
.msgFeedLikeMeList[i].item?.title !=
|
||||
""
|
||||
? Text(
|
||||
_likeMeController
|
||||
.msgFeedLikeMeList[i].item?.title ??
|
||||
"",
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.labelMedium!
|
||||
.copyWith(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.outline))
|
||||
: null,
|
||||
trailing:
|
||||
_likeMeController.msgFeedLikeMeList[i].item?.image !=
|
||||
null &&
|
||||
_likeMeController
|
||||
.msgFeedLikeMeList[i].item?.image !=
|
||||
""
|
||||
? NetworkImgLayer(
|
||||
width: 45,
|
||||
height: 45,
|
||||
type: 'cover',
|
||||
src: _likeMeController
|
||||
.msgFeedLikeMeList[i].item?.image,
|
||||
)
|
||||
: null,
|
||||
);
|
||||
},
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return Divider(
|
||||
indent: 72,
|
||||
endIndent: 20,
|
||||
height: 6,
|
||||
color: Colors.grey.withOpacity(0.1),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
44
lib/pages/msg_feed_top/reply_me/controller.dart
Normal file
44
lib/pages/msg_feed_top/reply_me/controller.dart
Normal file
@@ -0,0 +1,44 @@
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pilipala/http/msg.dart';
|
||||
|
||||
import '../../../models/msg/msgfeed_reply_me.dart';
|
||||
|
||||
class ReplyMeController extends GetxController {
|
||||
RxList<ReplyMeItems> msgFeedReplyMeList = <ReplyMeItems>[].obs;
|
||||
bool isLoading = false;
|
||||
int cursor = -1;
|
||||
int cursorTime = -1;
|
||||
bool isEnd = false;
|
||||
|
||||
Future queryMsgFeedReplyMe() async {
|
||||
if (isLoading) return;
|
||||
isLoading = true;
|
||||
var res = await MsgHttp.msgFeedReplyMe(cursor: cursor, cursorTime: cursorTime);
|
||||
isLoading = false;
|
||||
if (res['status']) {
|
||||
MsgFeedReplyMe data = MsgFeedReplyMe.fromJson(res['data']);
|
||||
isEnd = data.cursor?.isEnd ?? false;
|
||||
if (cursor == -1) {
|
||||
msgFeedReplyMeList.assignAll(data.items!);
|
||||
} else {
|
||||
msgFeedReplyMeList.addAll(data.items!);
|
||||
}
|
||||
cursor = data.cursor?.id ?? -1;
|
||||
cursorTime = data.cursor?.time ?? -1;
|
||||
} else {
|
||||
SmartDialog.showToast(res['msg']);
|
||||
}
|
||||
}
|
||||
|
||||
Future onLoad() async {
|
||||
if (isEnd) return;
|
||||
queryMsgFeedReplyMe();
|
||||
}
|
||||
|
||||
Future onRefresh() async {
|
||||
cursor = -1;
|
||||
queryMsgFeedReplyMe();
|
||||
}
|
||||
|
||||
}
|
||||
4
lib/pages/msg_feed_top/reply_me/index.dart
Normal file
4
lib/pages/msg_feed_top/reply_me/index.dart
Normal file
@@ -0,0 +1,4 @@
|
||||
library whisper;
|
||||
|
||||
export './controller.dart';
|
||||
export './view.dart';
|
||||
149
lib/pages/msg_feed_top/reply_me/view.dart
Normal file
149
lib/pages/msg_feed_top/reply_me/view.dart
Normal file
@@ -0,0 +1,149 @@
|
||||
import 'package:easy_debounce/easy_throttle.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||
|
||||
import 'controller.dart';
|
||||
|
||||
class ReplyMePage extends StatefulWidget {
|
||||
const ReplyMePage({super.key});
|
||||
|
||||
@override
|
||||
State<ReplyMePage> createState() => _ReplyMePageState();
|
||||
}
|
||||
|
||||
class _ReplyMePageState extends State<ReplyMePage> {
|
||||
late final ReplyMeController _replyMeController =
|
||||
Get.put(ReplyMeController());
|
||||
final ScrollController _scrollController = ScrollController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_replyMeController.queryMsgFeedReplyMe();
|
||||
super.initState();
|
||||
_scrollController.addListener(_scrollListener);
|
||||
}
|
||||
|
||||
Future _scrollListener() async {
|
||||
if (_scrollController.position.pixels >=
|
||||
_scrollController.position.maxScrollExtent - 200) {
|
||||
EasyThrottle.throttle('my-throttler', const Duration(milliseconds: 800),
|
||||
() async {
|
||||
await _replyMeController.onLoad();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('回复我的'),
|
||||
),
|
||||
body: RefreshIndicator(
|
||||
onRefresh: () async {
|
||||
await _replyMeController.onRefresh();
|
||||
},
|
||||
child: SingleChildScrollView(
|
||||
controller: _scrollController,
|
||||
child: LayoutBuilder(
|
||||
builder: (BuildContext context, BoxConstraints constraints) {
|
||||
return Obx(
|
||||
() {
|
||||
if (_replyMeController.msgFeedReplyMeList.isEmpty) {
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
);
|
||||
}
|
||||
return ListView.separated(
|
||||
itemCount: _replyMeController.msgFeedReplyMeList.length,
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemBuilder: (_, int i) {
|
||||
return ListTile(
|
||||
onTap: () {
|
||||
String nativeUri = _replyMeController
|
||||
.msgFeedReplyMeList[i].item?.nativeUri ??
|
||||
"";
|
||||
SmartDialog.showToast("跳转至:$nativeUri(暂未实现)");
|
||||
},
|
||||
leading: NetworkImgLayer(
|
||||
width: 45,
|
||||
height: 45,
|
||||
type: 'avatar',
|
||||
src: _replyMeController
|
||||
.msgFeedReplyMeList[i].user?.avatar,
|
||||
),
|
||||
title: Text(
|
||||
"${_replyMeController.msgFeedReplyMeList[i].user?.nickname} "
|
||||
"回复了我的${_replyMeController.msgFeedReplyMeList[i].item?.business}",
|
||||
style: Theme.of(context).textTheme.bodyMedium!,
|
||||
),
|
||||
subtitle: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
_replyMeController.msgFeedReplyMeList[i].item
|
||||
?.sourceContent ??
|
||||
"",
|
||||
style: Theme.of(context).textTheme.bodyMedium),
|
||||
const SizedBox(height: 4),
|
||||
if (_replyMeController.msgFeedReplyMeList[i].item
|
||||
?.targetReplyContent !=
|
||||
null &&
|
||||
_replyMeController.msgFeedReplyMeList[i].item
|
||||
?.targetReplyContent !=
|
||||
"")
|
||||
Text(
|
||||
"| ${_replyMeController.msgFeedReplyMeList[i].item?.targetReplyContent}",
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.labelMedium!
|
||||
.copyWith(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.outline,
|
||||
height: 1.5)),
|
||||
if (_replyMeController.msgFeedReplyMeList[i].item
|
||||
?.rootReplyContent !=
|
||||
null &&
|
||||
_replyMeController.msgFeedReplyMeList[i].item
|
||||
?.rootReplyContent !=
|
||||
"")
|
||||
Text(
|
||||
" | ${_replyMeController.msgFeedReplyMeList[i].item?.rootReplyContent}",
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.labelMedium!
|
||||
.copyWith(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.outline,
|
||||
height: 1.5)),
|
||||
]),
|
||||
);
|
||||
},
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return Divider(
|
||||
indent: 72,
|
||||
endIndent: 20,
|
||||
height: 6,
|
||||
color: Colors.grey.withOpacity(0.1),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -16,25 +16,25 @@ class WhisperController extends GetxController {
|
||||
{
|
||||
"name":"回复我的",
|
||||
"icon":Icons.message_outlined,
|
||||
"route": "/",
|
||||
"route": "/replyMe",
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"name":"@我",
|
||||
"icon":Icons.alternate_email_outlined,
|
||||
"route": "/",
|
||||
"route": "/atMe",
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"name":"收到的赞",
|
||||
"icon":Icons.favorite_border_outlined,
|
||||
"route": "/",
|
||||
"route": "/likeMe",
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"name":"系统通知",
|
||||
"icon":Icons.notifications_none_outlined,
|
||||
"route": "/",
|
||||
"route": "/sysMsg",
|
||||
"value": 0
|
||||
},
|
||||
].obs;
|
||||
|
||||
@@ -58,20 +58,20 @@ class _WhisperPageState extends State<WhisperPage> {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(left: 20, right: 20),
|
||||
child: SizedBox(
|
||||
height: constraints.maxWidth / 5,
|
||||
height: constraints.maxWidth / 4,
|
||||
child: Obx(
|
||||
() => GridView.count(
|
||||
primary: false,
|
||||
crossAxisCount: 4,
|
||||
padding: const EdgeInsets.all(0),
|
||||
childAspectRatio: 1.25,
|
||||
children:
|
||||
_whisperController.msgFeedTop.map((item) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Badge(
|
||||
children: _whisperController.msgFeedTop.map((item) {
|
||||
return GestureDetector(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Badge(
|
||||
isLabelVisible: item['value'] > 0,
|
||||
backgroundColor:
|
||||
Theme.of(context).colorScheme.primary,
|
||||
@@ -80,38 +80,25 @@ class _WhisperPageState extends State<WhisperPage> {
|
||||
.onInverseSurface,
|
||||
label: Text(" ${item['value']} "),
|
||||
alignment: Alignment.topRight,
|
||||
child: SizedBox(
|
||||
width: 36,
|
||||
height: 36,
|
||||
child: IconButton(
|
||||
style: ButtonStyle(
|
||||
padding: MaterialStateProperty.all(
|
||||
EdgeInsets.zero),
|
||||
backgroundColor:
|
||||
MaterialStateProperty.resolveWith(
|
||||
(states) {
|
||||
return Theme.of(context)
|
||||
.colorScheme
|
||||
.primary
|
||||
.withOpacity(0.1);
|
||||
}),
|
||||
),
|
||||
onPressed: () => Get.toNamed(
|
||||
item['route'],
|
||||
),
|
||||
icon: Icon(
|
||||
item['icon'],
|
||||
size: 18,
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.primary,
|
||||
),
|
||||
child: CircleAvatar(
|
||||
radius: 22,
|
||||
backgroundColor: Theme.of(context)
|
||||
.colorScheme
|
||||
.onInverseSurface,
|
||||
child: Icon(
|
||||
item['icon'],
|
||||
size: 20,
|
||||
color:
|
||||
Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
)),
|
||||
const SizedBox(height: 6),
|
||||
Text(item['name'],
|
||||
style: const TextStyle(fontSize: 13))
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
Text(item['name'],
|
||||
style: const TextStyle(fontSize: 13))
|
||||
],
|
||||
),
|
||||
onTap: () => Get.toNamed(item['route']),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
|
||||
@@ -133,6 +133,7 @@ class ChatItem extends StatelessWidget {
|
||||
jsonDecode(content['content'])
|
||||
.map((m) => m['text'] as String)
|
||||
.join("\n"),
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
letterSpacing: 0.6,
|
||||
height: 5,
|
||||
|
||||
Reference in New Issue
Block a user