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