mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-26 02:58:39 +00:00
opt account
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -3,20 +3,20 @@ import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/models_new/live/live_area_list/area_item.dart';
|
||||
import 'package:PiliPlus/models_new/live/live_area_list/area_list.dart';
|
||||
import 'package:PiliPlus/pages/common/common_list_controller.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:PiliPlus/services/account_service.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class LiveAreaController
|
||||
extends CommonListController<List<AreaList>?, AreaList> {
|
||||
final isLogin = Accounts.main.isLogin;
|
||||
AccountService accountService = Get.find<AccountService>();
|
||||
|
||||
late final isEditing = false.obs;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
if (isLogin) {
|
||||
if (accountService.isLogin.value) {
|
||||
queryFavTags();
|
||||
}
|
||||
queryData();
|
||||
@@ -24,7 +24,7 @@ class LiveAreaController
|
||||
|
||||
@override
|
||||
Future<void> onRefresh() {
|
||||
if (isLogin) {
|
||||
if (accountService.isLogin.value) {
|
||||
queryFavTags();
|
||||
}
|
||||
return super.onRefresh();
|
||||
@@ -35,10 +35,11 @@ class LiveAreaController
|
||||
|
||||
@override
|
||||
Future<LoadingState<List<AreaList>?>> customGetData() =>
|
||||
LiveHttp.liveAreaList(isLogin: isLogin);
|
||||
LiveHttp.liveAreaList(isLogin: accountService.isLogin.value);
|
||||
|
||||
Future<void> queryFavTags() async {
|
||||
favState.value = await LiveHttp.getLiveFavTag(isLogin: isLogin);
|
||||
favState.value =
|
||||
await LiveHttp.getLiveFavTag(isLogin: accountService.isLogin.value);
|
||||
}
|
||||
|
||||
Future<void> setFavTag() async {
|
||||
|
||||
@@ -32,7 +32,7 @@ class _LiveAreaPageState extends State<LiveAreaPage> {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('全部标签'),
|
||||
actions: _controller.isLogin
|
||||
actions: _controller.accountService.isLogin.value
|
||||
? [
|
||||
TextButton(
|
||||
onPressed: _controller.onEdit,
|
||||
@@ -52,7 +52,7 @@ class _LiveAreaPageState extends State<LiveAreaPage> {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (_controller.isLogin)
|
||||
if (_controller.accountService.isLogin.value)
|
||||
Obx(() => _buildFavWidget(theme, _controller.favState.value)),
|
||||
Expanded(
|
||||
child:
|
||||
|
||||
Reference in New Issue
Block a user