# Conflicts:
#	lib/ui/exclude/exclude_contacts_page.dart
#	lib/ui/exclude/exclude_single_page.dart
#	lib/ui/home/set/specify_phone_page.dart
master
王亚玲 2 years ago
commit 7e97d5064d

@ -1,12 +1,8 @@
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart';
import 'package:flutter_contacts/contact.dart';
import 'package:flutter_contacts/flutter_contacts.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:project_telephony/ui/widget/scaffold_theme_widget.dart';
class ExcludeContactsPage extends StatefulWidget {
@ -17,20 +13,21 @@ class ExcludeContactsPage extends StatefulWidget {
}
class _ExcludeContactsPageState extends State<ExcludeContactsPage> {
late List<Contact> contacts;
List<Contact>? contacts;
List<String> numbers = [];
List<bool> status = [];
var flag = true;
bool _permissionDenied = false;
@override
void initState() {
super.initState();
_incrementCounter();
_viewLoading();
}
Future _incrementCounter() async {
Future _viewLoading() async {
contacts = await FlutterContacts.getContacts();
for (var element in contacts) {
for (var element in contacts!) {
final full = await FlutterContacts.getContact(element.id);
numbers.add(full!.phones.first.number);
status.add(false);
@ -41,17 +38,17 @@ class _ExcludeContactsPageState extends State<ExcludeContactsPage> {
@override
Widget build(BuildContext context) {
var profileBuilder = FutureBuilder(
future: _incrementCounter(),
future: _viewLoading(),
builder: (BuildContext context, AsyncSnapshot<dynamic> snapshot) {
if (snapshot.connectionState == ConnectionState.waiting && flag) {
flag = false;
return Container();
} else {
return ListView.builder(
itemCount: contacts.length,
itemCount: contacts!.length,
itemBuilder: (context, i) => ListTile(
title: Text(
contacts[i].displayName,
contacts![i].displayName,
style: TextStyle(
fontSize: 32.sp,
fontWeight: FontWeight.w600,

@ -1,12 +1,9 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:project_telephony/utils/headers.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:project_telephony/ui/widget/scaffold_theme_widget.dart';
import 'package:velocity_x/velocity_x.dart';
import '../../base/base_style.dart';
import '../widget/plone_back_button.dart';
import '../widget/plone_bottom.dart';
class ExcludeSinglePage extends StatefulWidget {
const ExcludeSinglePage({Key? key}) : super(key: key);
@ -15,96 +12,114 @@ class ExcludeSinglePage extends StatefulWidget {
}
class _ExcludeSinglePageState extends State<ExcludeSinglePage> {
late TextEditingController _phoneController;
late TextEditingController _nameController;
@override
void initState() {
super.initState();
_phoneController = TextEditingController();
_nameController = TextEditingController();
}
@override
void dispose() {
super.dispose();
_phoneController.dispose();
_nameController.dispose();
}
String phone="";
String name="";
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
elevation: 0,
title: Text(
'添加单个或批量号码',
style: TextStyle(
fontSize: BaseStyle.fontSize34,
color: BaseStyle.color333333,
fontWeight: FontWeight.bold),
),
titleSpacing: 110.w,
leading: const CloudBackButton(isSpecial: true),
backgroundColor: kForeGroundColor),
backgroundColor: Colors.white,
body: Container(
return ScaffoldThemeWidget(
title: '添加单个或批量号码',
bottom: "添加",
onTap: () {},
isOpacity:
_phoneController.text.isNotEmpty && _nameController.text.isNotEmpty,
child: Container(
padding: EdgeInsets.only(top: 25.h, left: 50.w, right: 50.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
addNumber("号码", "请输入号码"),
40.hb,
addNumber("名称", "请输入名称"),
43.hb,
Text(
"使用说明:",
style: TextStyle(color: BaseStyle.color999999, fontSize: 28.sp),
addNumber("号码", "请输入号码", _phoneController),
15.heightBox,
addNumber("名称", "请输入名称", _nameController),
30.heightBox,
RichText(
text: const TextSpan(
children: [
TextSpan(
text: "使用说明:\n",
style: TextStyle(
fontWeight: FontWeight.w600,
color: Colors.black38,
),
),
TextSpan(
text: "如输入000*可屏蔽所有000开头的号码",
style: TextStyle(
color: Colors.black38,
),
),
],
),
),
12.hb,
Text("如输入00852*可匹配所有00852开头的号码",
style: TextStyle(color: BaseStyle.color999999, fontSize: 28.sp))
// RichText(
// text: const TextSpan(
// children: [
// TextSpan(text: "使用说明:"),
// TextSpan(text: "如输入000*可屏蔽所有000开头的号码")
// ],
// ),
// ),
],
),
),
bottomNavigationBar: PloneBottom(
onTap: (){},
border: name.isEmpty || phone.isEmpty,
opacity:name.isEmpty || phone.isEmpty ? 0.4 : 1,
text: "添加",
).paddingOnly(bottom: 30.w),
);
}
addNumber(String title, content) {
addNumber(String title, content, TextEditingController controller) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: TextStyle(
fontSize: 28.sp,
color: Colors.black38,
style: const TextStyle(
fontSize: 16,
color: Color(0xFF999999),
fontWeight: FontWeight.w600,
),
),
15.heightBox,
CupertinoTextField(
padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 20.w),
decoration: BoxDecoration(
border: Border.all(color: Colors.white),
// borderRadius: BorderRadius.all(
// Radius.circular(4.w)
// ),
color: const Color(0xFFF9F9F9)),
placeholderStyle:
TextStyle(color: BaseStyle.color999999, fontSize: 28.sp),
placeholder: content,
TextField(
controller: controller,
onChanged: (value) {
if(title=="号码"){
phone=value;
print("phone:$phone");
}else{
name=value;
print("name:$name");
}
setState(() {});
},
decoration: InputDecoration(
contentPadding: EdgeInsets.all(30.w),
hintText: content,
hintStyle: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: Color(0xFF999999),
),
fillColor: const Color(0xFFF9F9F9),
filled: true,
enabledBorder: const OutlineInputBorder(
/*边角*/
borderRadius: BorderRadius.all(
Radius.circular(5), //5
),
borderSide: BorderSide(
color: Colors.white, //线
width: 1, //线2
),
),
focusedBorder: const OutlineInputBorder(
borderSide: BorderSide(
color: Colors.white, //
width: 1, //5
),
borderRadius: BorderRadius.all(
Radius.circular(5), //30
),
),
),
),
],
);

@ -1,10 +1,10 @@
import 'dart:ffi';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:project_telephony/constants/api.dart';
import 'package:project_telephony/model/network/api_client.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:project_telephony/ui/exclude/exclude_contacts_page.dart';
import 'package:project_telephony/ui/exclude/exclude_single_page.dart';
import 'package:project_telephony/ui/home/set/phone_num_list/call_records_list.dart';
@ -15,7 +15,7 @@ import '../../../base/base_style.dart';
import '../../../model/exclude_phone_model.dart';
import '../../widget/appdialog.dart';
import '../../widget/scaffold_theme_widget.dart';
class SpecifyPhonePage extends StatefulWidget {
@ -70,8 +70,24 @@ class _SpecifyPhonePageState extends State<SpecifyPhonePage> {
// Get.to(() => const CallRecordsList());
}),
_getAddPhone("通迅录添加", "通过本机通讯录添加号码", () {
Get.to(() => (const ExcludeContactsPage()));
_getAddPhone("通迅录添加", "通过本机通讯录添加号码", () async {
if(await Permission.contacts.isDenied){
showDialog(
context: context,
builder: (context) {
return AlertDialog(
content: const Text('获取通讯录权限还未开启'),
actions: [
ElevatedButton(onPressed: (){
openAppSettings();
},
child: const Text("前往开启"),),
],
);
});
}else{
Get.to(() => (const ExcludeContactsPage()));
}
}),
_getAddPhone("添加单个或批量号码", "通过输入号码段添加批量号码", () {
Get.to(() => (const ExcludeSinglePage()));

@ -40,10 +40,12 @@ class _LoginPageState extends State<LoginPage> {
int _countDownNum = 59;
late TextEditingController _phoneController;
late TextEditingController _smsCodeController;
late FocusNode _phoneFocusNode ;
late FocusNode _phoneFocusNode;
late FocusNode _smsCodeFocusNode;
bool _cantSelected = false;
DateTime? _lastTap;
@override
void initState() {
super.initState();
@ -121,35 +123,36 @@ class _LoginPageState extends State<LoginPage> {
blM: false,
border: _phoneController.text.length != 11,
opacity: _phoneController.text.length == 11 ? 1 : 0.4,
onTap: () async{
onTap: () async {
// DateTime? _lastTap;
if (_phoneController.text.length < 11) {
BotToast.showText(text: "请输入手机号");
}else if(_smsCodeController.text.length < 6){
} else if (_smsCodeController.text.length < 6) {
BotToast.showText(text: "请输入验证码");
}else if(!_chooseAgreement){
} else if (!_chooseAgreement) {
BotToast.showText(text: "请同意并勾选隐私政策");
}else{
if(_lastTap != null &&DateTime.now().difference(_lastTap!).inSeconds < 2){
} else {
if (_lastTap != null &&
DateTime.now().difference(_lastTap!).inSeconds < 2) {
// BotToast.showText(text: "过快");
return ;
return;
}
_lastTap = DateTime.now();
var base = await apiClient.request(API.app.login,
data: {'phone': _phoneController.text, 'code': _smsCodeController.text});
if (base.code == 0) {
print("123123${base.data['token']}");
await UserTool.userProvider.setToken(base.data['token']);
_lastTap = DateTime.now();
var base = await apiClient.request(API.app.login, data: {
'phone': _phoneController.text,
'code': _smsCodeController.text
});
if (base.code == 0) {
print("123123${base.data['token']}");
await UserTool.userProvider.setToken(base.data['token']);
// print(a);
// print("4567899");
Get.offAll(const TabNavigator());
}
else {
CloudToast.show(base.msg);
}
// print("4567899");
Get.offAll(const TabNavigator());
} else {
CloudToast.show(base.msg);
}
},
}
},
text: "立即登录",
),
32.hb,
@ -223,10 +226,12 @@ class _LoginPageState extends State<LoginPage> {
await apiClient.request(API.app.captcha, data: {
'phone': _phoneController.text,
});
var res= RegExp( r'^((13[0-9])|(14[0-9])|(15[0-9])|(16[0-9])|(17[0-9])|(18[0-9])|(19[0-9]))\d{8}$');
if((_phoneController.text).isNotEmpty && res.hasMatch(_phoneController.text)){
var res = RegExp(
r'^((13[0-9])|(14[0-9])|(15[0-9])|(16[0-9])|(17[0-9])|(18[0-9])|(19[0-9]))\d{8}$');
if ((_phoneController.text).isNotEmpty &&
res.hasMatch(_phoneController.text)) {
_beginCountDown();
}else{
} else {
BotToast.showText(text: "手机号不能为空且手机号格式错误");
}
if (_cantSelected) return;
@ -308,9 +313,10 @@ class _LoginPageState extends State<LoginPage> {
final TapGestureRecognizer recognizer = TapGestureRecognizer();
recognizer.onTap = () {
if (kDebugMode) {
Get.to(()=>const ContentAuthorityPage());
Get.to(() => const ContentAuthorityPage());
// print("点击协议了");
}
///
};
return recognizer;
@ -336,27 +342,28 @@ class _LoginPageState extends State<LoginPage> {
: const Icon(CupertinoIcons.checkmark_circle,
size: 18, color: Colors.blue),
),
RichText(
text: TextSpan(
text: "我已阅读并同意",
style: TextStyle(
color: BaseStyle.colorcccccc, fontSize: 12 * 2.sp),
children: [
// TextSpan(
// text: '《用户服务协议》',
// style: TextStyle(color: kPrimaryColor, fontSize: 12 * 2.sp),
// recognizer: _recognizer(context, 2)),
// TextSpan(
// text: "",
// style: TextStyle(
// color: BaseStyle.colorcccccc, fontSize: 12 * 2.sp),
// ),
TextSpan(
text: '《短信帮手隐私协议》',
style: TextStyle(color: kPrimaryColor, fontSize: 12 * 2.sp),
recognizer: _recognizer(context, 2)),
]))
text: TextSpan(
text: "我已阅读并同意",
style:
TextStyle(color: BaseStyle.colorcccccc, fontSize: 12 * 2.sp),
children: [
// TextSpan(
// text: '《用户服务协议》',
// style: TextStyle(color: kPrimaryColor, fontSize: 12 * 2.sp),
// recognizer: _recognizer(context, 2)),
// TextSpan(
// text: "",
// style: TextStyle(
// color: BaseStyle.colorcccccc, fontSize: 12 * 2.sp),
// ),
TextSpan(
text: '《短信帮手隐私协议》',
style: TextStyle(color: kPrimaryColor, fontSize: 12 * 2.sp),
recognizer: _recognizer(context, 2)),
],
),
),
],
),
);

@ -74,12 +74,7 @@ class _PrivacyRightsPageState extends State<PrivacyRightsPage> {
bottomNavigationBar: GestureDetector(
onTap: () async {
await _launchUrl();
// await launchUrlString("tel:13111111111");
},
// onTap: () async{
//
// },
child: Container(
margin: EdgeInsets.symmetric(horizontal: 64.w, vertical: 24.w),
padding: EdgeInsets.symmetric(horizontal: 214.w, vertical: 26.w),
@ -95,21 +90,6 @@ class _PrivacyRightsPageState extends State<PrivacyRightsPage> {
);
}
// Color getPermissionColor() {
// if(true){
// return Colors.red;
// }else{
// return Colors.green;
// }
// }
// String getPermissionStu() {
// if (false) {
// return "未允许";
// } else {
// return "已允许";
// }
// }
Future<void> _launchUrl() async {
if (!await launchUrl(_url)) {
throw 'Could not launch $_url';
@ -123,23 +103,6 @@ class _PrivacyRightsPageState extends State<PrivacyRightsPage> {
openAppSettings();
setState(() {});
}
// if(!(sms && plone)){
// // print(sms);
// // print(plone);
// openAppSettings();
// }else{
// // print("123123123123");
// }
// await Permission.phone.request();
// await Permission.sms.request();
// Map<Permission, PermissionStatus> statuses = await [
// Permission.sms,
// Permission.phone,
// ].request();
//
// openAppSettings();
// print(await Permission.phone.request().isGranted);
// print(await Permission.sms.request().isGranted);
},
title: Text(
name,

@ -29,7 +29,7 @@ class ScaffoldThemeWidget extends StatefulWidget {
required this.title,
required this.child,
required this.bottom,
this.isBorder = false,
this.isBorder = true,
this.isOpacity = true,
required this.onTap,
this.wid=162

Loading…
Cancel
Save