diff --git a/lib/models/dynamics/up.dart b/lib/models/dynamics/up.dart index ce445acb..9bb82f70 100644 --- a/lib/models/dynamics/up.dart +++ b/lib/models/dynamics/up.dart @@ -3,11 +3,13 @@ class FollowUpModel { this.liveUsers, this.upList, this.liveList, + this.myInfo, }); LiveUsers? liveUsers; List? upList; List? liveList; + MyInfo? myInfo; FollowUpModel.fromJson(Map json) { liveUsers = json['live_users'] != null @@ -21,6 +23,7 @@ class FollowUpModel { upList = json['up_list'] != null ? json['up_list'].map((e) => UpItem.fromJson(e)).toList() : []; + myInfo = json['my_info'] != null ? MyInfo.fromJson(json['my_info']) : null; } } @@ -100,3 +103,21 @@ class UpItem { uname = json['uname']; } } + +class MyInfo { + MyInfo({ + this.face, + this.mid, + this.name, + }); + + String? face; + int? mid; + String? name; + + MyInfo.fromJson(Map json) { + face = json['face']; + mid = json['mid']; + name = json['name']; + } +} diff --git a/lib/pages/dynamics/controller.dart b/lib/pages/dynamics/controller.dart index 1d415aa4..b7676663 100644 --- a/lib/pages/dynamics/controller.dart +++ b/lib/pages/dynamics/controller.dart @@ -258,6 +258,10 @@ class DynamicsController extends GetxController { if (upData.value.upList!.isEmpty) { mid.value = -1; } + upData.value.upList!.insertAll(0, [ + UpItem(face: '', uname: '全部动态', mid: -1), + UpItem(face: userInfo.face, uname: '我', mid: userInfo.mid), + ]); } return res; } diff --git a/lib/pages/dynamics/widgets/article_panel.dart b/lib/pages/dynamics/widgets/article_panel.dart index e68d966d..19707435 100644 --- a/lib/pages/dynamics/widgets/article_panel.dart +++ b/lib/pages/dynamics/widgets/article_panel.dart @@ -34,25 +34,25 @@ Widget articlePanel(item, context, {floor = 1}) { ), const SizedBox(height: 8), ], - Text( - item.modules.moduleDynamic.major.opus.title, - style: Theme.of(context) - .textTheme - .titleMedium! - .copyWith(fontWeight: FontWeight.bold), - ), - const SizedBox(height: 2), - if (item.modules.moduleDynamic.major.opus.summary.text != - 'undefined') ...[ - Text( - item.modules.moduleDynamic.major.opus.summary.richTextNodes.first - .text, - maxLines: 4, - style: const TextStyle(height: 1.55), - overflow: TextOverflow.ellipsis, - ), - const SizedBox(height: 2), - ], + // Text( + // item.modules.moduleDynamic.major.opus.title, + // style: Theme.of(context) + // .textTheme + // .titleMedium! + // .copyWith(fontWeight: FontWeight.bold), + // ), + // const SizedBox(height: 2), + // if (item.modules.moduleDynamic.major.opus.summary.text != + // 'undefined') ...[ + // Text( + // item.modules.moduleDynamic.major.opus.summary.richTextNodes.first + // .text, + // maxLines: 4, + // style: const TextStyle(height: 1.55), + // overflow: TextOverflow.ellipsis, + // ), + // const SizedBox(height: 2), + // ], picWidget(item, context) ], ), diff --git a/lib/pages/dynamics/widgets/up_panel.dart b/lib/pages/dynamics/widgets/up_panel.dart index ef0c3731..fd0ae642 100644 --- a/lib/pages/dynamics/widgets/up_panel.dart +++ b/lib/pages/dynamics/widgets/up_panel.dart @@ -1,16 +1,14 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; -import 'package:hive/hive.dart'; import 'package:pilipala/common/widgets/network_img_layer.dart'; import 'package:pilipala/models/dynamics/up.dart'; import 'package:pilipala/models/live/item.dart'; import 'package:pilipala/pages/dynamics/controller.dart'; import 'package:pilipala/utils/feed_back.dart'; -import 'package:pilipala/utils/storage.dart'; import 'package:pilipala/utils/utils.dart'; class UpPanel extends StatefulWidget { - final FollowUpModel? upData; + final FollowUpModel upData; const UpPanel(this.upData, {Key? key}) : super(key: key); @override @@ -24,33 +22,17 @@ class _UpPanelState extends State { List upList = []; List liveList = []; static const itemPadding = EdgeInsets.symmetric(horizontal: 5, vertical: 0); - Box userInfoCache = GStrorage.userInfo; - var userInfo; + late MyInfo userInfo; - @override - void initState() { - super.initState(); - upList = widget.upData!.upList!; - if (widget.upData!.liveList!.isNotEmpty) { - liveList = widget.upData!.liveList!; - } - upList.insert( - 0, - UpItem(face: '', uname: '全部动态', mid: -1), - ); - userInfo = userInfoCache.get('userInfoCache'); - upList.insert( - 1, - UpItem( - face: userInfo.face, - uname: '我', - mid: userInfo.mid, - ), - ); + void listFormat() { + userInfo = widget.upData.myInfo!; + upList = widget.upData.upList!; + liveList = widget.upData.liveList!; } @override Widget build(BuildContext context) { + listFormat(); return SliverPersistentHeader( floating: true, pinned: false, diff --git a/lib/pages/webview/controller.dart b/lib/pages/webview/controller.dart index 37600ea7..f26f4284 100644 --- a/lib/pages/webview/controller.dart +++ b/lib/pages/webview/controller.dart @@ -131,13 +131,13 @@ class WebviewController extends GetxController { Get.back(); } else { // 获取用户信息失败 - SmartDialog.showToast(result.msg); - Clipboard.setData(ClipboardData(text: result.msg.toString())); + SmartDialog.showToast(result['msg']); + Clipboard.setData(ClipboardData(text: result['msg'])); } } catch (e) { SmartDialog.showNotify(msg: e.toString(), notifyType: NotifyType.warning); content = content + e.toString(); + Clipboard.setData(ClipboardData(text: content)); } - Clipboard.setData(ClipboardData(text: content)); } }