|
|
@ -44,18 +44,18 @@ 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;
|
|
|
|
late bool vle;
|
|
|
|
late bool vle=false;
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
super.initState();
|
|
|
|
if ( UserTool.userProvider.isLogin) {
|
|
|
|
if ( UserTool.userProvider.isLogin) {
|
|
|
|
print(UserTool.userProvider.userInfo.end*1000);
|
|
|
|
print(UserTool.userProvider.userInfo.end*1000);
|
|
|
|
print(DateTime.now().millisecondsSinceEpoch);
|
|
|
|
print(DateTime.now().millisecondsSinceEpoch);
|
|
|
|
|
|
|
|
|
|
|
|
if (UserTool.userProvider.userInfo.end*1000<=DateTime.now().millisecondsSinceEpoch ) {
|
|
|
|
if (UserTool.userProvider.userInfo.end*1000<=DateTime.now().millisecondsSinceEpoch ) {
|
|
|
|
isVip = false;
|
|
|
|
isVip = false;
|
|
|
|
vle =false;
|
|
|
|
vle =false;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
vle =true;
|
|
|
|
|
|
|
|
isVip = true;
|
|
|
|
isVip = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
endDate=DateUtil.formatDateMs(UserTool.userProvider.userInfo.end * 1000, format: DateFormats.y_mo_d);
|
|
|
|
endDate=DateUtil.formatDateMs(UserTool.userProvider.userInfo.end * 1000, format: DateFormats.y_mo_d);
|
|
|
@ -290,6 +290,10 @@ class _UserPageState extends State<UserPage> {
|
|
|
|
onChanged: (value) async {
|
|
|
|
onChanged: (value) async {
|
|
|
|
final service = FlutterBackgroundService();
|
|
|
|
final service = FlutterBackgroundService();
|
|
|
|
final SharedPreferences prefs = await _prefs;
|
|
|
|
final SharedPreferences prefs = await _prefs;
|
|
|
|
|
|
|
|
// if(value){
|
|
|
|
|
|
|
|
// WidgetsFlutterBinding.ensureInitialized();
|
|
|
|
|
|
|
|
// await initializeService();
|
|
|
|
|
|
|
|
// }
|
|
|
|
// if(!value){
|
|
|
|
// if(!value){
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// }
|
|
|
|
// }
|
|
|
@ -305,12 +309,13 @@ class _UserPageState extends State<UserPage> {
|
|
|
|
print("true");
|
|
|
|
print("true");
|
|
|
|
prefs.remove("kg");
|
|
|
|
prefs.remove("kg");
|
|
|
|
prefs.setBool("kg", vle);
|
|
|
|
prefs.setBool("kg", vle);
|
|
|
|
service.startService();
|
|
|
|
|
|
|
|
|
|
|
|
// service.startService();
|
|
|
|
// WidgetsFlutterBinding.ensureInitialized();
|
|
|
|
// WidgetsFlutterBinding.ensureInitialized();
|
|
|
|
// initializeService();
|
|
|
|
initializeService();
|
|
|
|
// UserTool.userProvider.setKg(vle)
|
|
|
|
// UserTool.userProvider.setKg(vle)
|
|
|
|
// initializeService();
|
|
|
|
// initializeService();
|
|
|
|
initializeService();
|
|
|
|
// initializeService();
|
|
|
|
BotToast.showText(text: " 你开启了该功能");
|
|
|
|
BotToast.showText(text: " 你开启了该功能");
|
|
|
|
// initializeService();
|
|
|
|
// initializeService();
|
|
|
|
// print("这是数据${prefs.getBool("kg")}");
|
|
|
|
// print("这是数据${prefs.getBool("kg")}");
|
|
|
|