增加卡密界面

master
王亚玲 2 years ago
parent cca1967b9d
commit 83052cf5e8

Binary file not shown.

After

Width:  |  Height:  |  Size: 491 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 KiB

@ -15,6 +15,9 @@ class $AssetsIconsGen {
/// File path: assets/icons/Start.png /// File path: assets/icons/Start.png
AssetGenImage get start => const AssetGenImage('assets/icons/Start.png'); AssetGenImage get start => const AssetGenImage('assets/icons/Start.png');
/// File path: assets/icons/card.png
AssetGenImage get card => const AssetGenImage('assets/icons/card.png');
/// File path: assets/icons/home_noSelected.png /// File path: assets/icons/home_noSelected.png
AssetGenImage get homeNoSelected => AssetGenImage get homeNoSelected =>
const AssetGenImage('assets/icons/home_noSelected.png'); const AssetGenImage('assets/icons/home_noSelected.png');
@ -99,6 +102,9 @@ class $AssetsImagesGen {
AssetGenImage get bouncedbg => AssetGenImage get bouncedbg =>
const AssetGenImage('assets/images/bouncedbg.png'); const AssetGenImage('assets/images/bouncedbg.png');
/// File path: assets/images/cardbg.png
AssetGenImage get cardbg => const AssetGenImage('assets/images/cardbg.png');
/// File path: assets/images/emptylist.png /// File path: assets/images/emptylist.png
AssetGenImage get emptylist => AssetGenImage get emptylist =>
const AssetGenImage('assets/images/emptylist.png'); const AssetGenImage('assets/images/emptylist.png');

@ -48,17 +48,20 @@ class UserProvider extends ChangeNotifier {
} }
Future setToken(String token, {User? user}) async { Future setToken(String token, {User? user}) async {
final prefs = await SharedPreferences.getInstance();
apiClient.setToken(token); apiClient.setToken(token);
await HiveStore.appBox!.put('token', token); await HiveStore.appBox!.put('token', token);
_isLogin = true; _isLogin = true;
//app //app
await updateUserInfo(); await updateUserInfo();
prefs.setInt("numIndex", 0);
updateConSms(); updateConSms();
updateRefSms(); updateRefSms();
updateCallSms(); updateCallSms();
updateIdleSms(); updateIdleSms();
viewLoading(); viewLoading();
getExclude(); getExclude();
} }
Future logout() async { Future logout() async {
@ -191,13 +194,13 @@ class UserProvider extends ChangeNotifier {
} }
notifyListeners(); notifyListeners();
} }
Future viewLoading() async { Future viewLoading( ) async {
List<String>? numList=[]; List<String>? numList=[];
List<String>? numbers=[]; List<String>? numbers=[];
final service = FlutterBackgroundService(); final service = FlutterBackgroundService();
final SharedPreferences prefs = await SharedPreferences.getInstance(); final SharedPreferences prefs = await SharedPreferences.getInstance();
var contact = await FlutterContacts.getContacts(); var contact = await FlutterContacts.getContacts();
for (var element in contact!) { for (var element in contact) {
final full = await FlutterContacts.getContact(element.id); final full = await FlutterContacts.getContact(element.id);
numbers.add(full!.phones.first.number.replaceAll(" ", "")); numbers.add(full!.phones.first.number.replaceAll(" ", ""));
// status.add(false); // status.add(false);
@ -206,14 +209,17 @@ class UserProvider extends ChangeNotifier {
for (int i = 0; i < numberList.length; i++) { for (int i = 0; i < numberList.length; i++) {
numList.add(numberList[i].phone); numList.add(numberList[i].phone);
} }
await prefs.setStringList("specified", numList); await prefs.setStringList("specified", numList ?? []);
await prefs.setStringList("addressList", numbers); await prefs.setStringList("addressList", numbers ?? []);
service.invoke("stopService"); service.invoke("stopService");
if (prefs.getBool('kg')!) { if (prefs.getBool('kg')!) {
Future.delayed(const Duration(seconds: 1), () async { Future.delayed(const Duration(seconds: 1), () async {
service.startService(); service.startService();
}); });
} }
notifyListeners(); notifyListeners();
} }
} }

@ -60,7 +60,7 @@ void onStart(ServiceInstance service) async {
bool? callSw = prefs.getBool('callSwitch'); bool? callSw = prefs.getBool('callSwitch');
bool? idleSw = prefs.getBool('idleSwitch'); bool? idleSw = prefs.getBool('idleSwitch');
int? numberSet = prefs.getInt("numIndex"); int? numberSet = prefs.getInt("numIndex");
List<String>? numberList = prefs.getStringList("addressList"); List<String>? numberList = prefs.getStringList("addressList") ;
List<String>? noNumberList = prefs.getStringList("specified"); List<String>? noNumberList = prefs.getStringList("specified");
print("号码设置$numberSet 通讯列表$numberList 指定不发送$noNumberList"); print("号码设置$numberSet 通讯列表$numberList 指定不发送$noNumberList");
if (callState == "IDLE") { if (callState == "IDLE") {
@ -71,7 +71,7 @@ void onStart(ServiceInstance service) async {
print(phoneNum); print(phoneNum);
switch (numberSet) { switch (numberSet) {
case 0: case 0:
if (!(noNumberList?.contains(phoneNum))!) { if (!(noNumberList!.contains(phoneNum))) {
if (flag > 0) { if (flag > 0) {
print("来电拒接/未接"); print("来电拒接/未接");
print("${phoneNum!}:${ref!}"); print("${phoneNum!}:${ref!}");
@ -109,8 +109,8 @@ void onStart(ServiceInstance service) async {
} }
break; break;
case 1: case 1:
if ((numberList?.contains(phoneNum))! && if ((numberList!.contains(phoneNum)) &&
!(noNumberList?.contains(phoneNum))!) { !(noNumberList!.contains(phoneNum))) {
if (flag > 0) { if (flag > 0) {
print("来电拒接/未接"); print("来电拒接/未接");
print("${phoneNum!}:${ref!}"); print("${phoneNum!}:${ref!}");
@ -148,8 +148,8 @@ void onStart(ServiceInstance service) async {
} }
break; break;
case 2: case 2:
if (!(numberList?.contains(phoneNum))! && if (!(numberList!.contains(phoneNum)) &&
!(noNumberList?.contains(phoneNum))!) { !(noNumberList!.contains(phoneNum))) {
if (flag > 0) { if (flag > 0) {
print("来电拒接/未接"); print("来电拒接/未接");
print("${phoneNum!}:${ref!}"); print("${phoneNum!}:${ref!}");

@ -79,7 +79,8 @@ class _PhoneSetPageState extends State<PhoneSetPage> {
// footer: MaterialFooter(), // footer: MaterialFooter(),
onRefresh: () async { onRefresh: () async {
final SharedPreferences prefs = await SharedPreferences.getInstance(); final SharedPreferences prefs = await SharedPreferences.getInstance();
select = (prefs.getInt("numIndex"))!; print(prefs.getInt("numIndex"));
select = (prefs.getInt("numIndex")) ?? 0;
// _viewLoading(); // _viewLoading();
setState(() {}); setState(() {});
}, },

@ -160,7 +160,7 @@ class _MembersPageState extends State<MembersPage> {
const CloudBackButton( const CloudBackButton(
isSpecial: true, isSpecial: true,
), ),
154.wb, 182.wb,
Text('会员中心', style: Theme.of(context).textTheme.headline6), Text('会员中心', style: Theme.of(context).textTheme.headline6),
], ],
)), )),

@ -0,0 +1,191 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:project_telephony/base/base_style.dart';
import 'package:project_telephony/ui/widget/plone_bottom.dart';
import 'package:project_telephony/utils/headers.dart';
import 'package:project_telephony/utils/toast/cloud_toast.dart';
import '../widget/image_scaffold.dart';
class UserCardPage extends StatefulWidget {
const UserCardPage({Key? key}) : super(key: key);
@override
_UserCardPageState createState() => _UserCardPageState();
}
class _UserCardPageState extends State<UserCardPage> {
String cardMi = "";
@override
Widget build(BuildContext context) {
return CloudScaffold(
systemStyle: const SystemUiOverlayStyle(
statusBarIconBrightness: Brightness.dark,
// systemNavigationBarColor: Colors.white,
),
path: Assets.images.bg.path,
bodyColor: Colors.white,
extendBody: true,
body: Column(
children: [
44.hb,
ListTile(
leading: Padding(
padding: EdgeInsets.only(left: 32.w, right: 156.w),
child: const Icon(
Icons.chevron_left,
color: Colors.black,
),
),
onTap: () {
Get.back();
},
title: Text(
"卡密兑换",
style: TextStyle(
fontSize: 34.sp,
fontWeight: FontWeight.bold,
color: BaseStyle.color333333),
)),
58.hb,
Container(
width: 750.w,
height: 700.w,
padding: EdgeInsets.symmetric(horizontal: 64.w),
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(Assets.images.cardbg.path))),
child: Column(
children: [
88.hb,
Padding(
padding: EdgeInsets.only(left: 34.w),
child: getText(),
),
124.hb,
_getCard(),
88.hb,
PloneBottom(
blM: false,
onTap: () {
if(cardMi.isEmpty){
CloudToast.show("卡密为空");
}else{
CloudToast.show("卡密兑换成功");
}
},
border: cardMi.isEmpty?true:false,
opacity: cardMi.isEmpty? 0.4:1,
text: "立即兑换",
)
],
),
)
],
));
}
_getCard() {
return TextField(
// controller: ,
onChanged: (value) {
cardMi = value;
setState(() {});
},
decoration: InputDecoration(
contentPadding: EdgeInsets.all(30.w),
hintText: "请在此处输入卡密",
hintStyle: TextStyle(
fontSize: 28.sp,
fontWeight: FontWeight.w600,
color: const Color(0xFF999999),
),
fillColor: const Color(0xFFFFFFFF),
filled: true,
enabledBorder: const OutlineInputBorder(
/*边角*/
borderRadius: BorderRadius.all(
Radius.circular(5), //5
),
borderSide: BorderSide(
color: Colors.white, //线
width: 0, //线2
),
),
focusedBorder: const OutlineInputBorder(
borderSide: BorderSide(
color: Colors.white, //
width: 0, //5
),
borderRadius: BorderRadius.all(
Radius.circular(5), //30
),
),
),
);
}
getText() {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Text(
"快速兑换",
style: TextStyle(
color: const Color(0xFFFFEAB0),
fontSize: 40.sp,
fontWeight: FontWeight.bold),
),
300.wb,
Text(
"VIP",
style: TextStyle(
color: const Color(0xFFE7F3FF),
fontFamily: "BlackItalic",
fontSize: 40.sp),
),
],
),
24.hb,
Text(
"短信帮手会员时长",
style: TextStyle(color: const Color(0xFFFFEAB0), fontSize: 24.sp),
)
],
);
// RichText(
// text: const TextSpan(
// children: [
// TextSpan(
// text: "快速兑换",
// style: TextStyle(
// fontWeight: FontWeight.w600,
// color: Colors.black38,
// ),
// ),
// TextSpan(
// text: "VIP \n",
// style: TextStyle(
// color: Colors.black38,
// ),
// ),
// TextSpan(
// text: "\n",
// style: TextStyle(
// color: Colors.black38,
// ),
// ),
// TextSpan(
// text: "vip",
// style: TextStyle(
// color: Colors.black38,
// ),
// ),
// ],
// ),
// );
}
}

@ -11,6 +11,7 @@ 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/user/user_card_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/utils/headers.dart'; import 'package:project_telephony/utils/headers.dart';
@ -152,14 +153,15 @@ class _UserPageState extends State<UserPage> {
_getUser(), _getUser(),
72.hb, 72.hb,
_getBanner(), _getBanner(),
120.hb, 64.hb,
_getSwitch2(), _getSwitch2(),
_getSwitch(Assets.icons.privacy.path, "隐私政策", false), _getSwitch(Assets.icons.privacy.path, "隐私政策", false),
_getSwitch( _getSwitch(
Assets.icons.permissions.path, "权限说明", false), Assets.icons.permissions.path, "权限说明", false),
_getSwitch(Assets.icons.sms.path, "短信标签", false), _getSwitch(Assets.icons.sms.path, "短信标签", false),
_getSwitch(Assets.icons.card.path, "卡密兑换", false),
// const Spacer(), // const Spacer(),
182.hb, 100.hb,
UserTool.userProvider.isLogin UserTool.userProvider.isLogin
? PloneBottom( ? PloneBottom(
border: false, border: false,
@ -472,6 +474,9 @@ class _UserPageState extends State<UserPage> {
name: name, name: name,
)); ));
break; break;
case "卡密兑换":
Get.to(()=>UserCardPage());
break;
default: default:
break; break;
} }

Loading…
Cancel
Save