opt: live follow
This commit is contained in:
@ -194,7 +194,10 @@ class _LivePageState extends State<LivePage>
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
InkWell(
|
Obx(
|
||||||
|
() => Visibility(
|
||||||
|
visible: _liveController.liveFollowingCount.value > 0,
|
||||||
|
child: InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Get.toNamed('/liveFollowing');
|
Get.toNamed('/liveFollowing');
|
||||||
},
|
},
|
||||||
@ -216,25 +219,26 @@ class _LivePageState extends State<LivePage>
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
FutureBuilder(
|
FutureBuilder(
|
||||||
future: _futureBuilderFuture2,
|
future: _futureBuilderFuture2,
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
if (snapshot.connectionState == ConnectionState.done) {
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
if (snapshot.data == null) {
|
|
||||||
return const SizedBox();
|
|
||||||
}
|
|
||||||
Map? data = snapshot.data;
|
Map? data = snapshot.data;
|
||||||
if (data?['status']) {
|
if (data != null && data['status']) {
|
||||||
RxList list = _liveController.liveFollowingList;
|
RxList list = _liveController.liveFollowingList;
|
||||||
return LiveFollowingListView(list: list);
|
return list.isNotEmpty
|
||||||
|
? LiveFollowingListView(list: list)
|
||||||
|
: const Center(child: Text('没有人在直播'));
|
||||||
} else {
|
} else {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
height: 80,
|
height: 80,
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
data?['msg'] ?? '',
|
data?['msg'] ?? '请求异常',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Theme.of(context).colorScheme.outline,
|
color: Theme.of(context).colorScheme.outline,
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
@ -283,6 +287,15 @@ class LiveFollowingListView extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
onLongPress: () {
|
||||||
|
Get.toNamed(
|
||||||
|
'/member?mid=${list[index].uid}',
|
||||||
|
arguments: {
|
||||||
|
'face': list[index].face,
|
||||||
|
'heroTag': list[index].uid.toString(),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 54,
|
width: 54,
|
||||||
height: 54,
|
height: 54,
|
||||||
|
|||||||
@ -9,7 +9,7 @@ class LiveFollowController extends GetxController {
|
|||||||
RxInt crossAxisCount = 2.obs;
|
RxInt crossAxisCount = 2.obs;
|
||||||
Box setting = GStorage.setting;
|
Box setting = GStorage.setting;
|
||||||
int _currentPage = 1;
|
int _currentPage = 1;
|
||||||
RxInt liveFollowingCount = 0.obs;
|
RxString liveFollowingCount = '- '.obs;
|
||||||
RxList<LiveFollowingItemModel> liveFollowingList =
|
RxList<LiveFollowingItemModel> liveFollowingList =
|
||||||
<LiveFollowingItemModel>[].obs;
|
<LiveFollowingItemModel>[].obs;
|
||||||
|
|
||||||
@ -28,10 +28,11 @@ class LiveFollowController extends GetxController {
|
|||||||
if (res['status']) {
|
if (res['status']) {
|
||||||
if (type == 'init') {
|
if (type == 'init') {
|
||||||
liveFollowingList.value = res['data'].list;
|
liveFollowingList.value = res['data'].list;
|
||||||
liveFollowingCount.value = res['data'].liveCount;
|
liveFollowingCount.value = res['data'].liveCount.toString();
|
||||||
} else if (type == 'onLoad') {
|
} else if (type == 'onLoad') {
|
||||||
liveFollowingList.addAll(res['data'].list);
|
liveFollowingList.addAll(res['data'].list);
|
||||||
}
|
}
|
||||||
|
liveFollowingList.removeWhere((e) => e.liveStatus != 1);
|
||||||
_currentPage += 1;
|
_currentPage += 1;
|
||||||
} else {
|
} else {
|
||||||
SmartDialog.showToast(res['msg']);
|
SmartDialog.showToast(res['msg']);
|
||||||
|
|||||||
Reference in New Issue
Block a user