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

@ -1,12 +1,9 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.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 '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 { class ExcludeSinglePage extends StatefulWidget {
const ExcludeSinglePage({Key? key}) : super(key: key); const ExcludeSinglePage({Key? key}) : super(key: key);
@ -15,96 +12,114 @@ class ExcludeSinglePage extends StatefulWidget {
} }
class _ExcludeSinglePageState extends State<ExcludeSinglePage> { 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return ScaffoldThemeWidget(
appBar: AppBar( title: '添加单个或批量号码',
elevation: 0, bottom: "添加",
title: Text( onTap: () {},
'添加单个或批量号码', isOpacity:
style: TextStyle( _phoneController.text.isNotEmpty && _nameController.text.isNotEmpty,
fontSize: BaseStyle.fontSize34, child: Container(
color: BaseStyle.color333333,
fontWeight: FontWeight.bold),
),
titleSpacing: 110.w,
leading: const CloudBackButton(isSpecial: true),
backgroundColor: kForeGroundColor),
backgroundColor: Colors.white,
body: Container(
padding: EdgeInsets.only(top: 25.h, left: 50.w, right: 50.w), padding: EdgeInsets.only(top: 25.h, left: 50.w, right: 50.w),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
addNumber("号码", "请输入号码"), addNumber("号码", "请输入号码", _phoneController),
40.hb, 15.heightBox,
addNumber("名称", "请输入名称"), addNumber("名称", "请输入名称", _nameController),
43.hb, 30.heightBox,
Text( RichText(
"使用说明:", text: const TextSpan(
style: TextStyle(color: BaseStyle.color999999, fontSize: 28.sp), children: [
), TextSpan(
12.hb, text: "使用说明:\n",
Text("如输入00852*可匹配所有00852开头的号码", style: TextStyle(
style: TextStyle(color: BaseStyle.color999999, fontSize: 28.sp)) fontWeight: FontWeight.w600,
// RichText( color: Colors.black38,
// text: const TextSpan( ),
// children: [ ),
// TextSpan(text: "使用说明:"), TextSpan(
// TextSpan(text: "如输入000*可屏蔽所有000开头的号码") text: "如输入000*可屏蔽所有000开头的号码",
// ], style: TextStyle(
// ), color: Colors.black38,
// ), ),
),
],
),
),
], ],
), ),
), ),
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( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
title, title,
style: TextStyle( style: const TextStyle(
fontSize: 28.sp, fontSize: 16,
color: Colors.black38, color: Color(0xFF999999),
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
), ),
15.heightBox, 15.heightBox,
CupertinoTextField( TextField(
padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 20.w), controller: controller,
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,
onChanged: (value) { onChanged: (value) {
if(title=="号码"){
phone=value;
print("phone:$phone");
}else{
name=value;
print("name:$name");
}
setState(() {}); 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/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:project_telephony/constants/api.dart'; import 'package:project_telephony/constants/api.dart';
import 'package:project_telephony/model/network/api_client.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_contacts_page.dart';
import 'package:project_telephony/ui/exclude/exclude_single_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'; 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 '../../../model/exclude_phone_model.dart';
import '../../widget/appdialog.dart';
import '../../widget/scaffold_theme_widget.dart'; import '../../widget/scaffold_theme_widget.dart';
class SpecifyPhonePage extends StatefulWidget { class SpecifyPhonePage extends StatefulWidget {
@ -70,8 +70,24 @@ class _SpecifyPhonePageState extends State<SpecifyPhonePage> {
// Get.to(() => const CallRecordsList()); // Get.to(() => const CallRecordsList());
}), }),
_getAddPhone("通迅录添加", "通过本机通讯录添加号码", () { _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())); Get.to(() => (const ExcludeContactsPage()));
}
}), }),
_getAddPhone("添加单个或批量号码", "通过输入号码段添加批量号码", () { _getAddPhone("添加单个或批量号码", "通过输入号码段添加批量号码", () {
Get.to(() => (const ExcludeSinglePage())); Get.to(() => (const ExcludeSinglePage()));

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

@ -74,12 +74,7 @@ class _PrivacyRightsPageState extends State<PrivacyRightsPage> {
bottomNavigationBar: GestureDetector( bottomNavigationBar: GestureDetector(
onTap: () async { onTap: () async {
await _launchUrl(); await _launchUrl();
// await launchUrlString("tel:13111111111");
}, },
// onTap: () async{
//
// },
child: Container( child: Container(
margin: EdgeInsets.symmetric(horizontal: 64.w, vertical: 24.w), margin: EdgeInsets.symmetric(horizontal: 64.w, vertical: 24.w),
padding: EdgeInsets.symmetric(horizontal: 214.w, vertical: 26.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 { Future<void> _launchUrl() async {
if (!await launchUrl(_url)) { if (!await launchUrl(_url)) {
throw 'Could not launch $_url'; throw 'Could not launch $_url';
@ -123,23 +103,6 @@ class _PrivacyRightsPageState extends State<PrivacyRightsPage> {
openAppSettings(); openAppSettings();
setState(() {}); 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( title: Text(
name, name,

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

Loading…
Cancel
Save