|
@@ -173,7 +173,6 @@ class _PageDetailState
|
|
|
super.initState();
|
|
|
_focusNode = FocusNode();
|
|
|
_controller = new TextEditingController(text: '');
|
|
|
-
|
|
|
}
|
|
|
|
|
|
@override
|
|
@@ -191,121 +190,133 @@ class _PageDetailState
|
|
|
builder: (_, model, __) {
|
|
|
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,)
|
|
|
+ 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(
|
|
|
+ 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),
|
|
|
+ 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),
|
|
|
+ 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),
|
|
|
+ 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,
|
|
|
- ),
|
|
|
+ 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),
|
|
|
+ ),
|
|
|
+ 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(),
|
|
|
- enableControlFinishRefresh: true,
|
|
|
- controller: model.refreshController,
|
|
|
- header: buildClassicalHeader(),
|
|
|
- footer: buildClassicalFooter(),
|
|
|
- slivers: <Widget>[
|
|
|
- SliverToBoxAdapter(
|
|
|
- child: _searchWidget(context),
|
|
|
- ),
|
|
|
- if (model.isBusy)
|
|
|
- SliverToBoxAdapter(
|
|
|
- child: RequestLoadingWidget(),
|
|
|
- ),
|
|
|
- SliverList(
|
|
|
- delegate: SliverChildBuilderDelegate(
|
|
|
- (context, index) {
|
|
|
- return _buildItem(model.list[index]);
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ : EasyRefresh.custom(
|
|
|
+ firstRefresh: false,
|
|
|
+ onRefresh: () => model.refresh(),
|
|
|
+ onLoad: () => model.loadMore(),
|
|
|
+ enableControlFinishRefresh: true,
|
|
|
+ controller: model.refreshController,
|
|
|
+ header: buildClassicalHeader(),
|
|
|
+ footer: buildClassicalFooter(),
|
|
|
+ slivers: <Widget>[
|
|
|
+ SliverToBoxAdapter(
|
|
|
+ child: _searchWidget(context),
|
|
|
+ ),
|
|
|
+ if (model.isBusy)
|
|
|
+ SliverToBoxAdapter(
|
|
|
+ child: RequestLoadingWidget(),
|
|
|
+ ),
|
|
|
+ SliverList(
|
|
|
+ delegate: SliverChildBuilderDelegate(
|
|
|
+ (context, index) {
|
|
|
+ return _buildItem(model.list[index]);
|
|
|
+ },
|
|
|
+ childCount: model.list.length,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ if (model.isError)
|
|
|
+ SliverToBoxAdapter(
|
|
|
+ child: RequestErrorWidget(
|
|
|
+ () {
|
|
|
+ model.initData();
|
|
|
},
|
|
|
- childCount: model.list.length,
|
|
|
+ msg: widget.type == 0
|
|
|
+ ? "暂无好友~"
|
|
|
+ : widget.type == 1 ? "暂无关注~" : "暂无关注我的~",
|
|
|
+ assets: "emptypage-image-nomotion.png",
|
|
|
),
|
|
|
),
|
|
|
- if (model.isError)
|
|
|
- SliverToBoxAdapter(
|
|
|
- child: RequestErrorWidget(
|
|
|
- () {
|
|
|
- model.initData();
|
|
|
- },
|
|
|
- msg: widget.type == 0
|
|
|
- ? "暂无好友~"
|
|
|
- : widget.type == 1 ? "暂无关注~" : "暂无关注我的~",
|
|
|
- assets: "emptypage-image-nomotion.png",
|
|
|
- ),
|
|
|
- ),
|
|
|
- ],
|
|
|
- );
|
|
|
+ ],
|
|
|
+ );
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -374,51 +385,51 @@ class _PageDetailState
|
|
|
],
|
|
|
),
|
|
|
),
|
|
|
- if (user?.isFriends == "0")
|
|
|
- user?.isIgnore == 0
|
|
|
- ? GestureDetector(
|
|
|
- child: Container(
|
|
|
- width: 64,
|
|
|
- height: 30,
|
|
|
- alignment: Alignment.center,
|
|
|
- margin: _padding,
|
|
|
- child: Text(
|
|
|
- "关注",
|
|
|
- strutStyle: fixedLine,
|
|
|
- style: Theme.of(context).textTheme.bodyText2,
|
|
|
- ),
|
|
|
- decoration: BoxDecoration(
|
|
|
- borderRadius: BorderRadius.circular(20),
|
|
|
- border: Border.all(
|
|
|
- color: Color(0xff999999),
|
|
|
- width: .5,
|
|
|
- ),
|
|
|
- ),
|
|
|
- ),
|
|
|
- onTap: () async {
|
|
|
- await request(context, () async {
|
|
|
- var resp = await model.api
|
|
|
- .userIgnoreFollow(uid: user?.socialInfo?.id)
|
|
|
- .catchError((onError) {});
|
|
|
- if (resp?.code == 0) {
|
|
|
- setState(() {
|
|
|
- user.isIgnore = 1;
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- )
|
|
|
- : Container(
|
|
|
- width: 64,
|
|
|
- height: 30,
|
|
|
- margin: _padding,
|
|
|
- alignment: Alignment.center,
|
|
|
- child: Text(
|
|
|
- "已忽略",
|
|
|
- strutStyle: fixedLine,
|
|
|
- style: Theme.of(context).textTheme.bodyText2,
|
|
|
- ),
|
|
|
- ),
|
|
|
+// if (user?.isFriends == "0")
|
|
|
+// user?.isIgnore == 0
|
|
|
+// ? GestureDetector(
|
|
|
+// child: Container(
|
|
|
+// width: 64,
|
|
|
+// height: 30,
|
|
|
+// alignment: Alignment.center,
|
|
|
+// margin: _padding,
|
|
|
+// child: Text(
|
|
|
+// "关注",
|
|
|
+// strutStyle: fixedLine,
|
|
|
+// style: Theme.of(context).textTheme.bodyText2,
|
|
|
+// ),
|
|
|
+// decoration: BoxDecoration(
|
|
|
+// borderRadius: BorderRadius.circular(20),
|
|
|
+// border: Border.all(
|
|
|
+// color: Color(0xff999999),
|
|
|
+// width: .5,
|
|
|
+// ),
|
|
|
+// ),
|
|
|
+// ),
|
|
|
+// onTap: () async {
|
|
|
+// await request(context, () async {
|
|
|
+// var resp = await model.api
|
|
|
+// .userIgnoreFollow(uid: user?.socialInfo?.id)
|
|
|
+// .catchError((onError) {});
|
|
|
+// if (resp?.code == 0) {
|
|
|
+// setState(() {
|
|
|
+// user.isIgnore = 1;
|
|
|
+// });
|
|
|
+// }
|
|
|
+// });
|
|
|
+// },
|
|
|
+// )
|
|
|
+// : Container(
|
|
|
+// 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(
|
|
@@ -502,8 +513,13 @@ class _PageDetailState
|
|
|
fontSize: 14.0, color: Color(0xff999999)))
|
|
|
],
|
|
|
)
|
|
|
- : Text("已关注",
|
|
|
- style: TextStyle(fontSize: 14.0, color: Color(0xff999999))),
|
|
|
+ : user.isFriends == "0"
|
|
|
+ ? Text("已关注",
|
|
|
+ style:
|
|
|
+ TextStyle(fontSize: 14.0, color: Color(0xff999999)))
|
|
|
+ : Text("关注",
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 14.0, color: Color(0xff999999))),
|
|
|
// Container(
|
|
|
// width: 82,
|
|
|
// height: 30,
|
|
@@ -528,21 +544,37 @@ class _PageDetailState
|
|
|
Navigator.of(context).pop(true);
|
|
|
},
|
|
|
));
|
|
|
- } else {
|
|
|
+ } else if (user.isFriends == "0") {
|
|
|
flag = true;
|
|
|
}
|
|
|
- if (flag) {
|
|
|
+ if (flag == true) {
|
|
|
await request(context, () async {
|
|
|
var resp = await model.api
|
|
|
.userUnFollow(uid: user?.socialInfo?.id)
|
|
|
.catchError((onError) {});
|
|
|
+ setState(() {
|
|
|
+ user.isFriends = "2";
|
|
|
+// text = "233";
|
|
|
+ });
|
|
|
+// if (resp?.code == 0) {
|
|
|
+// ToastUtil.show("取关成功");
|
|
|
+// setState(() {
|
|
|
+// model.list?.remove(user);
|
|
|
+// if (model.list?.isEmpty == true) {
|
|
|
+// model.initData();
|
|
|
+// }
|
|
|
+// });
|
|
|
+// }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ await request(context, () async {
|
|
|
+ var resp = await model.api
|
|
|
+ .userFollow(uid: user?.socialInfo?.id)
|
|
|
+ .catchError((onError) {});
|
|
|
if (resp?.code == 0) {
|
|
|
- ToastUtil.show("取关成功");
|
|
|
+ ToastUtil.show("关注成功");
|
|
|
setState(() {
|
|
|
- model.list?.remove(user);
|
|
|
- if (model.list?.isEmpty == true) {
|
|
|
- model.initData();
|
|
|
- }
|
|
|
+ user.isFriends = "0";
|
|
|
});
|
|
|
}
|
|
|
});
|