|
|
|
@ -1,29 +1,20 @@
|
|
|
|
|
|
|
|
|
|
import 'package:bot_toast/bot_toast.dart';
|
|
|
|
|
import 'package:flustars/flustars.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
|
import 'package:permission_handler/permission_handler.dart';
|
|
|
|
|
import 'package:permission_handler_platform_interface/permission_handler_platform_interface.dart';
|
|
|
|
|
|
|
|
|
|
import 'package:project_telephony/base/base_style.dart';
|
|
|
|
|
import 'package:project_telephony/ui/login/login_page.dart';
|
|
|
|
|
|
|
|
|
|
import 'package:project_telephony/ui/tab_navigator.dart';
|
|
|
|
|
import 'package:project_telephony/ui/user/content_authority_page.dart';
|
|
|
|
|
import 'package:project_telephony/ui/user/members_page.dart';
|
|
|
|
|
import 'package:project_telephony/ui/user/privacy_rights_page.dart';
|
|
|
|
|
import 'package:project_telephony/ui/widget/image_scaffold.dart';
|
|
|
|
|
import 'package:project_telephony/ui/widget/plone_bottom.dart';
|
|
|
|
|
import 'package:project_telephony/ui/widget/plone_image_picker.dart';
|
|
|
|
|
import 'package:project_telephony/utils/headers.dart';
|
|
|
|
|
import 'package:project_telephony/utils/permissionutils.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
import 'package:telephony/telephony.dart';
|
|
|
|
|
import 'package:velocity_x/velocity_x.dart';
|
|
|
|
|
|
|
|
|
|
import '../../constants/api.dart';
|
|
|
|
|
import '../../model/network/api_client.dart';
|
|
|
|
|
|
|
|
|
|
import '../../providers/user_provider.dart';
|
|
|
|
|
import '../../utils/toast/cloud_toast.dart';
|
|
|
|
|
import '../../utils/user_tool.dart';
|
|
|
|
@ -44,18 +35,20 @@ class _UserPageState extends State<UserPage> {
|
|
|
|
|
// bool vle = PermissionStatus.denied.isGranted;
|
|
|
|
|
//bool vle =PermissionStatus.denied.isGranted;
|
|
|
|
|
final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
|
|
|
|
|
bool vle=false;
|
|
|
|
|
bool isVip=false;
|
|
|
|
|
bool vle = false;
|
|
|
|
|
bool isVip = false;
|
|
|
|
|
String? endDate;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
super.initState();
|
|
|
|
|
if(userProvider.isLogin){
|
|
|
|
|
if(userProvider.userInfo.isVip==1){
|
|
|
|
|
isVip=true;
|
|
|
|
|
}else{
|
|
|
|
|
isVip=false;
|
|
|
|
|
if (userProvider.isLogin) {
|
|
|
|
|
if (userProvider.userInfo.isVip == 1) {
|
|
|
|
|
isVip = true;
|
|
|
|
|
} else {
|
|
|
|
|
isVip = false;
|
|
|
|
|
}
|
|
|
|
|
endDate=DateUtil.formatDateMs(userProvider.userInfo.end * 1000, format: DateFormats.y_mo_d);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -74,10 +67,10 @@ class _UserPageState extends State<UserPage> {
|
|
|
|
|
72.hb,
|
|
|
|
|
_getBanner(),
|
|
|
|
|
120.hb,
|
|
|
|
|
_getSwitch(Assets.icons.switch1.path, "功能开关", true),
|
|
|
|
|
_getSwitch(Assets.icons.switch1.path, "功能开关", true),
|
|
|
|
|
_getSwitch(Assets.icons.privacy.path, "隐私政策", false),
|
|
|
|
|
_getSwitch(Assets.icons.permissions.path, "权限说明", false),
|
|
|
|
|
_getSwitch(Assets.icons.sms.path, "短信标签", false),
|
|
|
|
|
_getSwitch(Assets.icons.permissions.path, "权限说明", false),
|
|
|
|
|
_getSwitch(Assets.icons.sms.path, "短信标签", false),
|
|
|
|
|
// const Spacer(),
|
|
|
|
|
182.hb,
|
|
|
|
|
userProvider.isLogin
|
|
|
|
@ -136,15 +129,15 @@ class _UserPageState extends State<UserPage> {
|
|
|
|
|
const Spacer(),
|
|
|
|
|
GestureDetector(
|
|
|
|
|
onTap: () async {
|
|
|
|
|
var value = await CloudImagePicker.pickSingleImage(title: '选择图片');
|
|
|
|
|
if (value != null) {
|
|
|
|
|
BotToast.showText(text: '头像成功');
|
|
|
|
|
setState(() {});
|
|
|
|
|
}
|
|
|
|
|
// var value = await CloudImagePicker.pickSingleImage(title: '选择图片');
|
|
|
|
|
// if (value != null) {
|
|
|
|
|
// BotToast.showText(text: '头像成功');
|
|
|
|
|
// setState(() {});
|
|
|
|
|
// }//暂时不开放头像更改
|
|
|
|
|
},
|
|
|
|
|
child: ClipOval(
|
|
|
|
|
child: Image.asset(
|
|
|
|
|
Assets.images.portrait.path,
|
|
|
|
|
userProvider.isLogin?Assets.images.portraitDeep.path:Assets.images.portrait.path,
|
|
|
|
|
height: 128.w,
|
|
|
|
|
width: 128.w,
|
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
@ -152,7 +145,6 @@ class _UserPageState extends State<UserPage> {
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
@ -200,7 +192,7 @@ class _UserPageState extends State<UserPage> {
|
|
|
|
|
begin: Alignment.centerLeft,
|
|
|
|
|
end: Alignment.centerRight)),
|
|
|
|
|
child: Text(
|
|
|
|
|
isVip?"立即续费":"立即购买",
|
|
|
|
|
isVip ? "立即续费" : "立即购买",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: const Color(0xFF001F3F), fontSize: BaseStyle.fontSize24),
|
|
|
|
|
)),
|
|
|
|
@ -215,7 +207,7 @@ class _UserPageState extends State<UserPage> {
|
|
|
|
|
_getVip(),
|
|
|
|
|
16.hb,
|
|
|
|
|
Text(
|
|
|
|
|
isVip?"{$userProvider.userInfo.end}到期":"解锁全部功能",
|
|
|
|
|
isVip ? "$endDate到期" : "解锁全部功能",
|
|
|
|
|
style: TextStyle(color: Colors.white, fontSize: BaseStyle.fontSize24),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
@ -243,7 +235,7 @@ class _UserPageState extends State<UserPage> {
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
isVip?"已成为会员":"未开通会员",
|
|
|
|
|
isVip ? "已成为会员" : "未开通会员",
|
|
|
|
|
style: const TextStyle(
|
|
|
|
|
color: Color(
|
|
|
|
|
0xFFFFEAB0,
|
|
|
|
@ -258,26 +250,25 @@ class _UserPageState extends State<UserPage> {
|
|
|
|
|
_getSwitch(String url, String name, bool pd) {
|
|
|
|
|
return GestureDetector(
|
|
|
|
|
onTap: () async {
|
|
|
|
|
|
|
|
|
|
if(!pd){
|
|
|
|
|
switch(name){
|
|
|
|
|
if (!pd) {
|
|
|
|
|
switch (name) {
|
|
|
|
|
case "短信标签":
|
|
|
|
|
Get.to(() => ContentDetailsPage(
|
|
|
|
|
content:
|
|
|
|
|
userProvider.isLogin ? userProvider.userInfo.tag : "",
|
|
|
|
|
ploneBack: (String textContent) {
|
|
|
|
|
// print("这是数据" + textContent);
|
|
|
|
|
// textList.setAll(index, {textContent});
|
|
|
|
|
},
|
|
|
|
|
));
|
|
|
|
|
content:
|
|
|
|
|
userProvider.isLogin ? userProvider.userInfo.tag : "",
|
|
|
|
|
ploneBack: (String textContent) {
|
|
|
|
|
// print("这是数据" + textContent);
|
|
|
|
|
// textList.setAll(index, {textContent});
|
|
|
|
|
},
|
|
|
|
|
));
|
|
|
|
|
break;
|
|
|
|
|
case"隐私政策":
|
|
|
|
|
case "隐私政策":
|
|
|
|
|
Get.to(() => const ContentAuthorityPage());
|
|
|
|
|
break;
|
|
|
|
|
case"权限说明":
|
|
|
|
|
case "权限说明":
|
|
|
|
|
Get.to(() => PrivacyRightsPage(
|
|
|
|
|
name: name,
|
|
|
|
|
));
|
|
|
|
|
name: name,
|
|
|
|
|
));
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
@ -321,8 +312,7 @@ class _UserPageState extends State<UserPage> {
|
|
|
|
|
// setState(() {
|
|
|
|
|
// vle = value;
|
|
|
|
|
// });
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
})
|
|
|
|
|
: const Icon(Icons.keyboard_arrow_right)),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|