|
|
@ -45,12 +45,8 @@ class _UserPageState extends State<UserPage> {
|
|
|
|
final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
|
|
|
|
final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
|
|
|
|
bool isVip = false;
|
|
|
|
bool isVip = false;
|
|
|
|
String? endDate;
|
|
|
|
String? endDate;
|
|
|
|
final service = FlutterBackgroundService();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
late bool vle = false;
|
|
|
|
late bool vle = false;
|
|
|
|
|
|
|
|
final service = FlutterBackgroundService();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final EasyRefreshController _easyRefreshController = EasyRefreshController();
|
|
|
|
final EasyRefreshController _easyRefreshController = EasyRefreshController();
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
@ -59,33 +55,15 @@ class _UserPageState extends State<UserPage> {
|
|
|
|
super.dispose();
|
|
|
|
super.dispose();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// _load() async {
|
|
|
|
// _load() async {
|
|
|
|
|
|
|
|
// // print("123123131313131231231231231313123131232311313131231231");
|
|
|
|
// vle = await service.isRunning();
|
|
|
|
// vle = await service.isRunning();
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
super.initState();
|
|
|
|
UserTool.userProvider.updateUserInfo();
|
|
|
|
// _easyRefreshController.callRefresh();
|
|
|
|
Future.delayed(
|
|
|
|
// UserTool.userProvider.updateUserInfo();
|
|
|
|
const Duration(milliseconds: 0),
|
|
|
|
|
|
|
|
() => setState(() async{
|
|
|
|
|
|
|
|
if (UserTool.userProvider.isLogin) {
|
|
|
|
|
|
|
|
// print(UserTool.userProvider.userInfo.end * 1000);
|
|
|
|
|
|
|
|
// print(DateTime.now().millisecondsSinceEpoch);
|
|
|
|
|
|
|
|
if (UserTool.userProvider.userInfo.isVip != 1) {
|
|
|
|
|
|
|
|
isVip = false;
|
|
|
|
|
|
|
|
vle = false;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
isVip = true;
|
|
|
|
|
|
|
|
vle = await service.isRunning();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//service.isRunning() as bool;
|
|
|
|
|
|
|
|
endDate = DateUtil.formatDateMs(
|
|
|
|
|
|
|
|
UserTool.userProvider.userInfo.end * 1000,
|
|
|
|
|
|
|
|
format: DateFormats.y_mo_d);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
vle = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
@ -98,8 +76,34 @@ class _UserPageState extends State<UserPage> {
|
|
|
|
path: Assets.images.bg.path,
|
|
|
|
path: Assets.images.bg.path,
|
|
|
|
bodyColor: Colors.white,
|
|
|
|
bodyColor: Colors.white,
|
|
|
|
extendBody: true,
|
|
|
|
extendBody: true,
|
|
|
|
body: Column(
|
|
|
|
body: Expanded(child: Column(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
|
|
|
|
Expanded(
|
|
|
|
|
|
|
|
child:EasyRefresh(
|
|
|
|
|
|
|
|
firstRefresh: true,
|
|
|
|
|
|
|
|
header: MaterialHeader(),
|
|
|
|
|
|
|
|
onRefresh: () async {
|
|
|
|
|
|
|
|
// _load();
|
|
|
|
|
|
|
|
// await UserTool.userProvider.updateUserInfo();
|
|
|
|
|
|
|
|
if (UserTool.userProvider.isLogin) {
|
|
|
|
|
|
|
|
// print(UserTool.userProvider.userInfo.end * 1000);
|
|
|
|
|
|
|
|
// print(DateTime.now().millisecondsSinceEpoch);
|
|
|
|
|
|
|
|
if (UserTool.userProvider.userInfo.isVip != 1) {
|
|
|
|
|
|
|
|
isVip = false;
|
|
|
|
|
|
|
|
vle = false;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
isVip = true;
|
|
|
|
|
|
|
|
vle = await service.isRunning();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//service.isRunning() as bool;
|
|
|
|
|
|
|
|
// endDate = DateUtil.formatDateMs(
|
|
|
|
|
|
|
|
// UserTool.userProvider.userInfo.end * 1000,
|
|
|
|
|
|
|
|
// format: DateFormats.y_mo_d);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
vle = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
|
|
|
|
},child:ListView(children: [
|
|
|
|
_getUser(),
|
|
|
|
_getUser(),
|
|
|
|
72.hb,
|
|
|
|
72.hb,
|
|
|
|
_getBanner(),
|
|
|
|
_getBanner(),
|
|
|
@ -112,25 +116,29 @@ class _UserPageState extends State<UserPage> {
|
|
|
|
182.hb,
|
|
|
|
182.hb,
|
|
|
|
UserTool.userProvider.isLogin
|
|
|
|
UserTool.userProvider.isLogin
|
|
|
|
? PloneBottom(
|
|
|
|
? PloneBottom(
|
|
|
|
border: false,
|
|
|
|
border: false,
|
|
|
|
onTap: () async {
|
|
|
|
onTap: () async {
|
|
|
|
var cancel = CloudToast.loading;
|
|
|
|
var cancel = CloudToast.loading;
|
|
|
|
var base = await apiClient.request(API.app.logout,
|
|
|
|
var base = await apiClient.request(API.app.logout,
|
|
|
|
showMessage: true);
|
|
|
|
showMessage: true);
|
|
|
|
if (base.code == 0) {
|
|
|
|
if (base.code == 0) {
|
|
|
|
UserTool.userProvider.logout();
|
|
|
|
UserTool.userProvider.logout();
|
|
|
|
Get.offAll(const TabNavigator());
|
|
|
|
Get.offAll(const TabNavigator());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
cancel();
|
|
|
|
cancel();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
textColor: const Color(0xFF1890FF),
|
|
|
|
textColor: const Color(0xFF1890FF),
|
|
|
|
color1: const Color(0xFFEBF5FF),
|
|
|
|
color1: const Color(0xFFEBF5FF),
|
|
|
|
color2: const Color(0xFFEBF5FF),
|
|
|
|
color2: const Color(0xFFEBF5FF),
|
|
|
|
text: "退出登录",
|
|
|
|
text: "退出登录",
|
|
|
|
)
|
|
|
|
)
|
|
|
|
: const SizedBox()
|
|
|
|
: const SizedBox()],) )
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
),],
|
|
|
|
|
|
|
|
),)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -270,7 +278,7 @@ class _UserPageState extends State<UserPage> {
|
|
|
|
_getVip(),
|
|
|
|
_getVip(),
|
|
|
|
16.hb,
|
|
|
|
16.hb,
|
|
|
|
Text(
|
|
|
|
Text(
|
|
|
|
isVip ? "$endDate到期" : "解锁全部功能",
|
|
|
|
isVip ? "${DateUtil.formatDateMs(UserTool.userProvider.userInfo.end * 1000, format: DateFormats.y_mo_d)}到期" : "解锁全部功能",
|
|
|
|
style: TextStyle(color: Colors.white, fontSize: BaseStyle.fontSize24),
|
|
|
|
style: TextStyle(color: Colors.white, fontSize: BaseStyle.fontSize24),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
],
|
|
|
|
],
|
|
|
|