|
@@ -1,6 +1,9 @@
|
|
|
+import 'package:azlistview/azlistview.dart';
|
|
|
+import 'package:cached_network_image/cached_network_image.dart';
|
|
|
import 'package:extended_nested_scroll_view/extended_nested_scroll_view.dart';
|
|
|
import 'package:flutter/material.dart' hide NestedScrollView;
|
|
|
import 'package:flutter_easyrefresh/easy_refresh.dart';
|
|
|
+import 'package:sport/bean/login.dart';
|
|
|
import 'package:sport/bean/post_user.dart';
|
|
|
import 'package:sport/bean/user_friend.dart';
|
|
|
import 'package:sport/pages/social/chat_page.dart';
|
|
@@ -13,12 +16,14 @@ import 'package:sport/router/navigator_util.dart';
|
|
|
import 'package:sport/utils/DateFormat.dart';
|
|
|
import 'package:sport/utils/toast.dart';
|
|
|
import 'package:sport/widgets/appbar.dart';
|
|
|
+import 'package:sport/widgets/dialog/alert_dialog.dart';
|
|
|
import 'package:sport/widgets/dialog/request_dialog.dart';
|
|
|
import 'package:sport/widgets/error.dart';
|
|
|
import 'package:sport/widgets/image.dart';
|
|
|
import 'package:sport/widgets/loading.dart';
|
|
|
import 'package:sport/widgets/misc.dart';
|
|
|
import 'package:sport/widgets/persistent_header.dart';
|
|
|
+import 'package:sport/widgets/space.dart';
|
|
|
|
|
|
class UserFriendPage extends StatefulWidget {
|
|
|
@override
|
|
@@ -28,7 +33,7 @@ class UserFriendPage extends StatefulWidget {
|
|
|
class _PageState extends State<UserFriendPage> {
|
|
|
PageController _controller;
|
|
|
bool _refresh = false;
|
|
|
- int _page =0;
|
|
|
+ int _page = 0;
|
|
|
|
|
|
@override
|
|
|
void initState() {
|
|
@@ -66,25 +71,32 @@ class _PageState extends State<UserFriendPage> {
|
|
|
},
|
|
|
headerSliverBuilder: (context, innerBoxIsScrolled) {
|
|
|
return <Widget>[
|
|
|
- buildSliverAppBar(context, "好友列表", innerBoxIsScrolled: innerBoxIsScrolled, actions: <Widget>[
|
|
|
- IconButton(
|
|
|
- icon:Image.asset("lib/assets/img/bbs_icon_addmore.png",width: 22.0,height: 22.0,),
|
|
|
+ buildSliverAppBar(context, "好友列表",
|
|
|
+ innerBoxIsScrolled: innerBoxIsScrolled,
|
|
|
+ actions: <Widget>[
|
|
|
+ IconButton(
|
|
|
+ icon: Image.asset(
|
|
|
+ "lib/assets/img/bbs_icon_addmore.png",
|
|
|
+ width: 22.0,
|
|
|
+ height: 22.0,
|
|
|
+ ),
|
|
|
// icon: Text(
|
|
|
// "添加",
|
|
|
// style: TextStyle(fontSize: 15, color: Theme.of(context).accentColor),
|
|
|
// ),
|
|
|
- onPressed: () async {
|
|
|
- await NavigatorUtil.goPage(context, (context) => UserFriendAddPage());
|
|
|
- setState(() {
|
|
|
- _refresh = true;
|
|
|
- });
|
|
|
- await Future.delayed(Duration(seconds: 1));
|
|
|
- setState(() {
|
|
|
- _refresh = false;
|
|
|
- });
|
|
|
- },
|
|
|
- )
|
|
|
- ]),
|
|
|
+ onPressed: () async {
|
|
|
+ await NavigatorUtil.goPage(
|
|
|
+ context, (context) => UserFriendAddPage());
|
|
|
+ setState(() {
|
|
|
+ _refresh = true;
|
|
|
+ });
|
|
|
+ await Future.delayed(Duration(seconds: 1));
|
|
|
+ setState(() {
|
|
|
+ _refresh = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ )
|
|
|
+ ]),
|
|
|
SliverPersistentHeader(
|
|
|
delegate: PersistentHeader(
|
|
|
min: tabHeader,
|
|
@@ -99,10 +111,16 @@ class _PageState extends State<UserFriendPage> {
|
|
|
height: 35,
|
|
|
child: TabBar(
|
|
|
isScrollable: true,
|
|
|
- labelPadding: EdgeInsets.symmetric(horizontal: 32),
|
|
|
+ labelPadding:
|
|
|
+ EdgeInsets.symmetric(horizontal: 32),
|
|
|
indicatorWeight: 3,
|
|
|
- indicatorPadding: EdgeInsets.symmetric(horizontal: 6),
|
|
|
- tabs: <Widget>[Tab(text: '好友'), Tab(text: '我关注'), Tab(text: '关注我')],
|
|
|
+ indicatorPadding:
|
|
|
+ EdgeInsets.symmetric(horizontal: 6),
|
|
|
+ tabs: <Widget>[
|
|
|
+ Tab(text: '好友'),
|
|
|
+ Tab(text: '我关注'),
|
|
|
+ Tab(text: '关注我')
|
|
|
+ ],
|
|
|
onTap: (index) {
|
|
|
_controller?.jumpToPage(index);
|
|
|
},
|
|
@@ -117,13 +135,16 @@ class _PageState extends State<UserFriendPage> {
|
|
|
),
|
|
|
];
|
|
|
},
|
|
|
- body: _refresh? RequestLoadingWidget(): PageView.builder(
|
|
|
- controller: _controller = PageController(initialPage: _page)..addListener(() {
|
|
|
- _page = _controller.page.toInt();
|
|
|
- }),
|
|
|
- physics: NeverScrollableScrollPhysics(),
|
|
|
- itemCount: 3,
|
|
|
- itemBuilder: (_, index) => _PageDetailPage(index)),
|
|
|
+ body: _refresh
|
|
|
+ ? RequestLoadingWidget()
|
|
|
+ : PageView.builder(
|
|
|
+ controller: _controller = PageController(initialPage: _page)
|
|
|
+ ..addListener(() {
|
|
|
+ _page = _controller.page.toInt();
|
|
|
+ }),
|
|
|
+ physics: NeverScrollableScrollPhysics(),
|
|
|
+ itemCount: 3,
|
|
|
+ itemBuilder: (_, index) => _PageDetailPage(index)),
|
|
|
),
|
|
|
),
|
|
|
);
|
|
@@ -139,7 +160,8 @@ class _PageDetailPage extends StatefulWidget {
|
|
|
State<StatefulWidget> createState() => _PageDetailState(type);
|
|
|
}
|
|
|
|
|
|
-class _PageDetailState extends ViewStateLifecycle<_PageDetailPage, UserFriendModel> {
|
|
|
+class _PageDetailState
|
|
|
+ extends ViewStateLifecycle<_PageDetailPage, UserFriendModel> {
|
|
|
TextEditingController _controller;
|
|
|
FocusNode _focusNode;
|
|
|
ValueNotifier<String> _searchValue = ValueNotifier<String>("");
|
|
@@ -151,6 +173,7 @@ class _PageDetailState extends ViewStateLifecycle<_PageDetailPage, UserFriendMod
|
|
|
super.initState();
|
|
|
_focusNode = FocusNode();
|
|
|
_controller = new TextEditingController(text: '');
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@override
|
|
@@ -166,7 +189,86 @@ class _PageDetailState extends ViewStateLifecycle<_PageDetailPage, UserFriendMod
|
|
|
model: model,
|
|
|
onModelReady: (model) => model.initData(),
|
|
|
builder: (_, model, __) {
|
|
|
- return EasyRefresh.custom(
|
|
|
+ return widget.type == 0
|
|
|
+ ? Column(
|
|
|
+ children: <Widget>[
|
|
|
+ _searchWidget(context),
|
|
|
+ Space(height: 16.0,),
|
|
|
+ Expanded(
|
|
|
+ child: AzListView(
|
|
|
+ data: model.items,
|
|
|
+ susItemHeight:200,
|
|
|
+ itemCount: model.items.length,
|
|
|
+ indexBarData: model.items.map((e) => "${e.getSuspensionTag()}").toList(),
|
|
|
+ itemBuilder: (BuildContext context, int index) {
|
|
|
+ return ListTile(
|
|
|
+ leading: Container(
|
|
|
+ width: 44,
|
|
|
+ height: 44,
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ shape: BoxShape.rectangle,
|
|
|
+ borderRadius: BorderRadius.circular(4.0),
|
|
|
+ image: DecorationImage(
|
|
|
+ image: CachedNetworkImageProvider(model.items[index].user.avatar,)
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ title: Text("${model.items[index].user.name}"),
|
|
|
+ onTap: () {
|
|
|
+
|
|
|
+ },
|
|
|
+ );
|
|
|
+ },
|
|
|
+ physics: BouncingScrollPhysics(),
|
|
|
+ padding: EdgeInsets.zero,
|
|
|
+ susItemBuilder: (BuildContext context, int index) {
|
|
|
+ return Column(
|
|
|
+ children: <Widget>[
|
|
|
+ Container(
|
|
|
+// height: 40,
|
|
|
+ width: MediaQuery.of(context).size.width,
|
|
|
+ padding: EdgeInsets.only(left: 16.0),
|
|
|
+// color: Color(0xFFF3F4F5),
|
|
|
+ alignment: Alignment.centerLeft,
|
|
|
+ child: Text(
|
|
|
+ '${model.items[index].getSuspensionTag()}',
|
|
|
+ softWrap: false,
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 14.0,
|
|
|
+ color: Color(0xff9999999),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ Divider(indent: 12.0,endIndent: 12.0,),
|
|
|
+ ],
|
|
|
+ );
|
|
|
+ },
|
|
|
+ indexBarOptions: IndexBarOptions(
|
|
|
+ needRebuild: true,
|
|
|
+ ignoreDragCancel: true,
|
|
|
+ textStyle: TextStyle(color:Color(0xff999999),fontSize: 12.0),
|
|
|
+ selectTextStyle: TextStyle(fontSize: 20, color: Theme.of(context).accentColor),
|
|
|
+// downTextStyle: TextStyle(fontSize: 12, color: Theme.of(context).accentColor),
|
|
|
+// selectItemDecoration: BoxDecoration(color: Colors.green),
|
|
|
+// downItemDecoration:
|
|
|
+// BoxDecoration(color: Colors.green),
|
|
|
+ indexHintWidth: 33,
|
|
|
+ indexHintHeight: 33,
|
|
|
+ indexHintDecoration: BoxDecoration(
|
|
|
+ image: DecorationImage(
|
|
|
+ image: AssetImage("lib/assets/img/friendlist_bg_letter.png"),
|
|
|
+ fit: BoxFit.contain,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ indexHintTextStyle:TextStyle(fontSize: 18.0,color:Colors.white),
|
|
|
+ indexHintAlignment: Alignment.centerRight,
|
|
|
+ indexHintChildAlignment: Alignment(-0.25, 0.0),
|
|
|
+ indexHintOffset: Offset(0, 0),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ) : EasyRefresh.custom(
|
|
|
firstRefresh: false,
|
|
|
onRefresh: () => model.refresh(),
|
|
|
onLoad: () => model.loadMore(),
|
|
@@ -178,60 +280,27 @@ class _PageDetailState extends ViewStateLifecycle<_PageDetailPage, UserFriendMod
|
|
|
SliverToBoxAdapter(
|
|
|
child: _searchWidget(context),
|
|
|
),
|
|
|
-// if (widget.type == 2)
|
|
|
-// SliverToBoxAdapter(
|
|
|
-// child: Center(
|
|
|
-// child: Padding(
|
|
|
-// padding: const EdgeInsets.all(8.0),
|
|
|
-// child: Row(
|
|
|
-// children: <Widget>[
|
|
|
-// Image.asset("lib/assets/img/linkpop_icon_modify.png"),
|
|
|
-// SizedBox(
|
|
|
-// width: 6,
|
|
|
-// ),
|
|
|
-// Text(
|
|
|
-// "互相关注后可成为好友",
|
|
|
-// style: TextStyle(fontSize: 12, color: Color(0xffcecece)),
|
|
|
-// )
|
|
|
-// ],
|
|
|
-// mainAxisSize: MainAxisSize.min,
|
|
|
-// ),
|
|
|
-// ),
|
|
|
-// ),
|
|
|
-// ),
|
|
|
if (model.isBusy)
|
|
|
SliverToBoxAdapter(
|
|
|
child: RequestLoadingWidget(),
|
|
|
),
|
|
|
- if (model.isEmpty)
|
|
|
- SliverFillRemaining(
|
|
|
- child:Container(
|
|
|
- alignment: Alignment.center,
|
|
|
- child: Center(
|
|
|
- child: RequestErrorWidget(
|
|
|
- null,
|
|
|
- msg: widget.type == 0 ? "暂无好友~" : widget.type == 1 ? "暂无关注~" : "暂无关注我的~",
|
|
|
- assets: "emptypage-image-nomotion.png",
|
|
|
+ SliverList(
|
|
|
+ delegate: SliverChildBuilderDelegate(
|
|
|
+ (context, index) {
|
|
|
+ return _buildItem(model.list[index]);
|
|
|
+ },
|
|
|
+ childCount: model.list.length,
|
|
|
+ ),
|
|
|
),
|
|
|
- ),
|
|
|
- )
|
|
|
- ),
|
|
|
- if (model.isIdle)
|
|
|
- SliverList(
|
|
|
- delegate: SliverChildBuilderDelegate(
|
|
|
- (context, index) {
|
|
|
- return _buildItem(model.list[index]);
|
|
|
- },
|
|
|
- childCount: model.list.length,
|
|
|
- ),
|
|
|
- ),
|
|
|
if (model.isError)
|
|
|
SliverToBoxAdapter(
|
|
|
child: RequestErrorWidget(
|
|
|
() {
|
|
|
model.initData();
|
|
|
},
|
|
|
- msg: widget.type == 0 ? "暂无好友~" : widget.type == 1 ? "暂无关注~" : "暂无关注我的~",
|
|
|
+ msg: widget.type == 0
|
|
|
+ ? "暂无好友~"
|
|
|
+ : widget.type == 1 ? "暂无关注~" : "暂无关注我的~",
|
|
|
assets: "emptypage-image-nomotion.png",
|
|
|
),
|
|
|
),
|
|
@@ -259,15 +328,49 @@ class _PageDetailState extends ViewStateLifecycle<_PageDetailPage, UserFriendMod
|
|
|
children: <Widget>[
|
|
|
Text(
|
|
|
"${user?.socialInfo?.name}",
|
|
|
- style: Theme.of(context).textTheme.headline3.copyWith(fontWeight: FontWeight.normal),
|
|
|
+ style: Theme.of(context)
|
|
|
+ .textTheme
|
|
|
+ .headline3
|
|
|
+ .copyWith(fontWeight: FontWeight.normal),
|
|
|
),
|
|
|
SizedBox(
|
|
|
height: 5,
|
|
|
),
|
|
|
- Text(
|
|
|
- "${DateFormat.formatCreateAt(user?.createdAt)}关注了你",
|
|
|
- style: Theme.of(context).textTheme.bodyText1,
|
|
|
+ RichText(
|
|
|
+ text: TextSpan(
|
|
|
+ style: Theme.of(context).textTheme.subtitle2,
|
|
|
+ children: <InlineSpan>[
|
|
|
+ TextSpan(
|
|
|
+ text: '${DateFormat.formatCreateAt(user?.createdAt)}',
|
|
|
+ style: Theme.of(context).textTheme.bodyText1,
|
|
|
+ ),
|
|
|
+ user.makeFrom == 'follow'
|
|
|
+ ? TextSpan(
|
|
|
+ text: '通过线上',
|
|
|
+ style: Theme.of(context)
|
|
|
+ .textTheme
|
|
|
+ .bodyText1
|
|
|
+ .copyWith(
|
|
|
+ color: Theme.of(context).accentColor),
|
|
|
+ )
|
|
|
+ : TextSpan(
|
|
|
+ text: '通过扫码',
|
|
|
+ style: Theme.of(context)
|
|
|
+ .textTheme
|
|
|
+ .bodyText1
|
|
|
+ .copyWith(
|
|
|
+ color: Theme.of(context).accentColor),
|
|
|
+ ),
|
|
|
+ TextSpan(
|
|
|
+ text: "关注了你",
|
|
|
+ style: Theme.of(context).textTheme.bodyText1,
|
|
|
+ )
|
|
|
+ ]),
|
|
|
),
|
|
|
+// TextSpan(
|
|
|
+// "${DateFormat.formatCreateAt(user?.createdAt)}通过${user.makeFrom}关注了你",
|
|
|
+//
|
|
|
+// ),
|
|
|
],
|
|
|
),
|
|
|
),
|
|
@@ -280,7 +383,7 @@ class _PageDetailState extends ViewStateLifecycle<_PageDetailPage, UserFriendMod
|
|
|
alignment: Alignment.center,
|
|
|
margin: _padding,
|
|
|
child: Text(
|
|
|
- "忽略",
|
|
|
+ "关注",
|
|
|
strutStyle: fixedLine,
|
|
|
style: Theme.of(context).textTheme.bodyText2,
|
|
|
),
|
|
@@ -294,7 +397,9 @@ class _PageDetailState extends ViewStateLifecycle<_PageDetailPage, UserFriendMod
|
|
|
),
|
|
|
onTap: () async {
|
|
|
await request(context, () async {
|
|
|
- var resp = await model.api.userIgnoreFollow(uid: user?.socialInfo?.id).catchError((onError) {});
|
|
|
+ var resp = await model.api
|
|
|
+ .userIgnoreFollow(uid: user?.socialInfo?.id)
|
|
|
+ .catchError((onError) {});
|
|
|
if (resp?.code == 0) {
|
|
|
setState(() {
|
|
|
user.isIgnore = 1;
|
|
@@ -304,16 +409,16 @@ class _PageDetailState extends ViewStateLifecycle<_PageDetailPage, UserFriendMod
|
|
|
},
|
|
|
)
|
|
|
: Container(
|
|
|
- width: 64,
|
|
|
- height: 30,
|
|
|
- margin: _padding,
|
|
|
- alignment: Alignment.center,
|
|
|
- child: Text(
|
|
|
- "已忽略",
|
|
|
- strutStyle: fixedLine,
|
|
|
- style: Theme.of(context).textTheme.bodyText2,
|
|
|
- ),
|
|
|
- ),
|
|
|
+ width: 64,
|
|
|
+ height: 30,
|
|
|
+ margin: _padding,
|
|
|
+ alignment: Alignment.center,
|
|
|
+ child: Text(
|
|
|
+ "已忽略",
|
|
|
+ strutStyle: fixedLine,
|
|
|
+ style: Theme.of(context).textTheme.bodyText2,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
if (user?.isIgnore == 0)
|
|
|
user.isFriends == "1"
|
|
|
? Container(
|
|
@@ -324,7 +429,10 @@ class _PageDetailState extends ViewStateLifecycle<_PageDetailPage, UserFriendMod
|
|
|
child: Text(
|
|
|
"已关注",
|
|
|
strutStyle: fixedLine,
|
|
|
- style: Theme.of(context).textTheme.bodyText2.copyWith(color: Theme.of(context).accentColor),
|
|
|
+ style: Theme.of(context)
|
|
|
+ .textTheme
|
|
|
+ .bodyText2
|
|
|
+ .copyWith(color: Theme.of(context).accentColor),
|
|
|
),
|
|
|
)
|
|
|
: GestureDetector(
|
|
@@ -336,7 +444,10 @@ class _PageDetailState extends ViewStateLifecycle<_PageDetailPage, UserFriendMod
|
|
|
child: Text(
|
|
|
"关注",
|
|
|
strutStyle: fixedLine,
|
|
|
- style: Theme.of(context).textTheme.bodyText2.copyWith(color: Theme.of(context).accentColor),
|
|
|
+ style: Theme.of(context)
|
|
|
+ .textTheme
|
|
|
+ .bodyText2
|
|
|
+ .copyWith(color: Theme.of(context).accentColor),
|
|
|
),
|
|
|
decoration: BoxDecoration(
|
|
|
borderRadius: BorderRadius.circular(20),
|
|
@@ -349,7 +460,9 @@ class _PageDetailState extends ViewStateLifecycle<_PageDetailPage, UserFriendMod
|
|
|
onTap: () async {
|
|
|
if (user.isFriends == "1") return;
|
|
|
await request(context, () async {
|
|
|
- var resp = await model.api.userFollow(uid: user?.socialInfo?.id).catchError((onError) {});
|
|
|
+ var resp = await model.api
|
|
|
+ .userFollow(uid: user?.socialInfo?.id)
|
|
|
+ .catchError((onError) {});
|
|
|
if (resp?.code == 0) {
|
|
|
ToastUtil.show("关注成功");
|
|
|
setState(() {
|
|
@@ -374,95 +487,151 @@ class _PageDetailState extends ViewStateLifecycle<_PageDetailPage, UserFriendMod
|
|
|
Expanded(
|
|
|
child: Text(
|
|
|
"${user?.socialInfo?.name}",
|
|
|
- style: Theme.of(context).textTheme.headline3.copyWith(fontWeight: FontWeight.normal),
|
|
|
+ style: Theme.of(context)
|
|
|
+ .textTheme
|
|
|
+ .headline3
|
|
|
+ .copyWith(fontWeight: FontWeight.normal),
|
|
|
),
|
|
|
),
|
|
|
GestureDetector(
|
|
|
- child: Container(
|
|
|
- width: 82,
|
|
|
- height: 30,
|
|
|
- alignment: Alignment.center,
|
|
|
- child: Text(
|
|
|
- "取消关注",
|
|
|
- strutStyle: fixedLine,
|
|
|
- style: Theme.of(context).textTheme.bodyText2,
|
|
|
- ),
|
|
|
- decoration: BoxDecoration(
|
|
|
- borderRadius: BorderRadius.circular(20),
|
|
|
- border: Border.all(
|
|
|
- color: Color(0xffDCDCDC),
|
|
|
- width: .5,
|
|
|
- ),
|
|
|
- ),
|
|
|
- ),
|
|
|
+ child: user.isFriends == "1"
|
|
|
+ ? Row(
|
|
|
+ children: <Widget>[
|
|
|
+ Text("互关好友",
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 14.0, color: Color(0xff999999)))
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ : Text("已关注",
|
|
|
+ style: TextStyle(fontSize: 14.0, color: Color(0xff999999))),
|
|
|
+// Container(
|
|
|
+// width: 82,
|
|
|
+// height: 30,
|
|
|
+// alignment: Alignment.center,
|
|
|
+// child:
|
|
|
+// decoration: BoxDecoration(
|
|
|
+// borderRadius: BorderRadius.circular(20),
|
|
|
+// border: Border.all(
|
|
|
+// color: Color(0xffDCDCDC),
|
|
|
+// width: .5,
|
|
|
+// ),
|
|
|
+// ),
|
|
|
+// ),
|
|
|
onTap: () async {
|
|
|
- await request(context, () async {
|
|
|
- var resp = await model.api.userUnFollow(uid: user?.socialInfo?.id).catchError((onError) {});
|
|
|
- if (resp?.code == 0) {
|
|
|
- ToastUtil.show("取关成功");
|
|
|
- setState(() {
|
|
|
- model.list?.remove(user);
|
|
|
- if(model.list?.isEmpty == true){
|
|
|
- model.initData();
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
+ bool flag;
|
|
|
+ if (user.isFriends == "1") {
|
|
|
+ flag = await showDialog(
|
|
|
+ context: context,
|
|
|
+ builder: (context) => CustomAlertDialog(
|
|
|
+ title: '是否取消关注,解除好友关系',
|
|
|
+ ok: () {
|
|
|
+ Navigator.of(context).pop(true);
|
|
|
+ },
|
|
|
+ ));
|
|
|
+ } else {
|
|
|
+ flag = true;
|
|
|
+ }
|
|
|
+ if (flag) {
|
|
|
+ await request(context, () async {
|
|
|
+ var resp = await model.api
|
|
|
+ .userUnFollow(uid: user?.socialInfo?.id)
|
|
|
+ .catchError((onError) {});
|
|
|
+ if (resp?.code == 0) {
|
|
|
+ ToastUtil.show("取关成功");
|
|
|
+ setState(() {
|
|
|
+ model.list?.remove(user);
|
|
|
+ if (model.list?.isEmpty == true) {
|
|
|
+ model.initData();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
},
|
|
|
)
|
|
|
],
|
|
|
);
|
|
|
} else {
|
|
|
- child = Row(
|
|
|
- children: <Widget>[
|
|
|
- CircleAvatar(
|
|
|
- backgroundImage: userAvatarProvider(user?.socialInfo?.avatar),
|
|
|
- radius: 22,
|
|
|
- ),
|
|
|
- SizedBox(
|
|
|
- width: 8,
|
|
|
- ),
|
|
|
- Expanded(
|
|
|
- child: Column(
|
|
|
- crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
- children: <Widget>[
|
|
|
- Text(
|
|
|
- "${user?.socialInfo?.name}",
|
|
|
- style: Theme.of(context).textTheme.headline3.copyWith(fontWeight: FontWeight.normal),
|
|
|
- ),
|
|
|
- SizedBox(
|
|
|
- height: 5,
|
|
|
- ),
|
|
|
- Text(
|
|
|
- "${DateFormat.formatCreateAt(user?.updatedAt)}在线",
|
|
|
- style: Theme.of(context).textTheme.bodyText1,
|
|
|
- ),
|
|
|
- ],
|
|
|
- ),
|
|
|
- ),
|
|
|
- ],
|
|
|
- );
|
|
|
+// child = Row(
|
|
|
+// children: <Widget>[
|
|
|
+// CircleAvatar(
|
|
|
+// backgroundImage: userAvatarProvider(user?.socialInfo?.avatar),
|
|
|
+// radius: 22,
|
|
|
+// ),
|
|
|
+// SizedBox(
|
|
|
+// width: 8,
|
|
|
+// ),
|
|
|
+// Expanded(
|
|
|
+// child: Column(
|
|
|
+// crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
+// children: <Widget>[
|
|
|
+// Text(
|
|
|
+// "${user?.socialInfo?.name}",
|
|
|
+// style: Theme.of(context)
|
|
|
+// .textTheme
|
|
|
+// .headline3
|
|
|
+// .copyWith(fontWeight: FontWeight.normal),
|
|
|
+// ),
|
|
|
+// SizedBox(
|
|
|
+// height: 5,
|
|
|
+// ),
|
|
|
+// Text(
|
|
|
+// "${DateFormat.formatCreateAt(user?.updatedAt)}在线",
|
|
|
+// style: Theme.of(context).textTheme.bodyText1,
|
|
|
+// ),
|
|
|
+// ],
|
|
|
+// ),
|
|
|
+// ),
|
|
|
+// ],
|
|
|
+// );
|
|
|
}
|
|
|
+// return Column(
|
|
|
+// children: <Widget>[
|
|
|
+// Padding(
|
|
|
+// padding: const EdgeInsets.symmetric(horizontal: 12.0, vertical: 12.0),
|
|
|
+// child: InkWell(
|
|
|
+// onTap: () async {
|
|
|
+//// if(widget.type == 0) await NavigatorUtil.goPage(context, (context) => ChatPage(user?.socialInfo));
|
|
|
+//// else
|
|
|
+// await NavigatorUtil.goPage(
|
|
|
+// context,
|
|
|
+// (context) => UserDetailPage(
|
|
|
+// PostUser(
|
|
|
+// id: "${user?.socialInfo?.id}",
|
|
|
+// name: user?.socialInfo?.name,
|
|
|
+// avatar: user?.socialInfo?.avatar),
|
|
|
+// userFriends: model.list));
|
|
|
+// setState(() {});
|
|
|
+// },
|
|
|
+// child: child),
|
|
|
+// ),
|
|
|
+// Divider(
|
|
|
+// indent: 12.0,
|
|
|
+// height: 1,
|
|
|
+// endIndent: 12.0,
|
|
|
+// )
|
|
|
+// ],
|
|
|
+// );
|
|
|
return Column(
|
|
|
children: <Widget>[
|
|
|
Padding(
|
|
|
- padding: const EdgeInsets.symmetric(horizontal: 12.0,vertical: 12.0),
|
|
|
+ padding: const EdgeInsets.all(12.0),
|
|
|
child: InkWell(
|
|
|
onTap: () async {
|
|
|
-// if(widget.type == 0) await NavigatorUtil.goPage(context, (context) => ChatPage(user?.socialInfo));
|
|
|
-// else
|
|
|
await NavigatorUtil.goPage(
|
|
|
context,
|
|
|
- (context) => UserDetailPage(PostUser(id: "${user?.socialInfo?.id}", name: user?.socialInfo?.name, avatar: user?.socialInfo?.avatar),
|
|
|
+ (context) => UserDetailPage(
|
|
|
+ PostUser(
|
|
|
+ id: "${user?.socialInfo?.id}",
|
|
|
+ name: user?.socialInfo?.name,
|
|
|
+ avatar: user?.socialInfo?.avatar),
|
|
|
userFriends: model.list));
|
|
|
setState(() {});
|
|
|
},
|
|
|
child: child),
|
|
|
),
|
|
|
Divider(
|
|
|
- indent: 12.0,
|
|
|
height: 1,
|
|
|
- endIndent: 12.0,
|
|
|
)
|
|
|
],
|
|
|
);
|
|
@@ -498,9 +667,10 @@ class _PageDetailState extends ViewStateLifecycle<_PageDetailPage, UserFriendMod
|
|
|
hintText: '输入账号/用户昵称',
|
|
|
border: InputBorder.none,
|
|
|
contentPadding: EdgeInsets.symmetric(
|
|
|
- vertical: 11.5,),
|
|
|
- hintStyle: TextStyle(
|
|
|
- color:Color(0xff999999),
|
|
|
+ vertical: 11.5,
|
|
|
+ ),
|
|
|
+ hintStyle: TextStyle(
|
|
|
+ color: Color(0xff999999),
|
|
|
),
|
|
|
),
|
|
|
onChanged: (value) {
|
|
@@ -512,9 +682,9 @@ class _PageDetailState extends ViewStateLifecycle<_PageDetailPage, UserFriendMod
|
|
|
// _searchModel.setKeyword(value);
|
|
|
// Provider.of<SearchModel>(context, listen: false).queryValue(value);
|
|
|
},
|
|
|
- style: TextStyle(
|
|
|
- color:Color(0xff333333),
|
|
|
- ),
|
|
|
+ style: TextStyle(
|
|
|
+ color: Color(0xff333333),
|
|
|
+ ),
|
|
|
),
|
|
|
),
|
|
|
Visibility(
|
|
@@ -534,8 +704,6 @@ class _PageDetailState extends ViewStateLifecycle<_PageDetailPage, UserFriendMod
|
|
|
);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
@override
|
|
|
UserFriendModel createModel() => UserFriendModel(widget.type);
|
|
|
-
|
|
|
}
|