Revert "登录界面"

This reverts commit f0136e906d.
dyb
戴余标 2 years ago
parent f0136e906d
commit 890c23e739

@ -12,16 +12,19 @@ import 'package:power_logger/power_logger.dart';
import 'package:project_telephony/providers/user_provider.dart';
import 'package:project_telephony/ui/tab_navigator.dart';
import 'package:project_telephony/ui/user/privacy_rights_page.dart';
import 'package:provider/provider.dart';
import 'package:telephony/telephony.dart';
import 'package:project_telephony/utils/hive_store.dart';
void _sendSMS(String message, List<String> recipents) async {
String _result = await sendSMS(message: message, recipients: recipents)
.catchError((onError) {
print(onError);
});
print(_result);
void _sendSMS(String message, List<String> recipients) async {
try{
String result =
await sendSMS(message: message, recipients: recipients, sendDirect: true);
print(result);
} on PlatformException catch(e){
print(e.toString());
}
}
void main() async {
@ -66,33 +69,24 @@ void onStart() {
Timer.periodic(const Duration(seconds: 1), (timer) async {
CallState state = await Telephony.instance.callState;
callState = state.name;
print(callState!+" $flag");
// print(callState!+"$flag");
if (callState == "IDLE") {
if (flag != 0) {
flag = 0;
// print("object");
final Iterable<CallLogEntry> result = await CallLog.query();
phoneNum = result.first.number;
// print(phoneNum);
// String message = "This is a test message!";
// List<String> recipents = ["10000", "10086"];
// String _result = await sendSMS(message: message, recipients: recipents, sendDirect: true)
// .catchError((onError) {
// print(onError);
// });
// print(_result);
phoneNum = result.first.number;
print(phoneNum);
final SmsSendStatusListener listener = (SendStatus status) {
print(status);
};
Phone.telephony.sendSms(
to: phoneNum!,
message: "hello",
statusListener: listener,
isMultipart: true,
);
// final Iterable<CallLogEntry> result = await CallLog.query();
// phoneNum = result.first.number;
// // print(phoneNum);
List<String> recipents = ["13486828191"];
// CallState state = await telephony.callState;
_sendSMS("你好", recipents);
// phoneNum = result.first.number;
// // print(phoneNum);
// Phone.telephony.sendSms(
// to: phoneNum!,
// message: "hello",
// isMultipart: true,
// );
}
} else if (callState == "RINGING") {
flag++;

@ -132,7 +132,7 @@ class _LoginPageState extends State<LoginPage> {
data: {'phone': _phoneController.text, 'code': _smsCodeController.text});
if (base.code == 0) {
await UserTool.userProvider.setToken(base.data['token']);
Get.to(() => const TabNavigator());
Get.back();
} else {
CloudToast.show(base.msg);
}

@ -5,7 +5,6 @@ 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/members_page.dart';
import 'package:project_telephony/ui/user/privacy_rights_page.dart';
import 'package:project_telephony/ui/widget/image_scaffold.dart';
@ -13,15 +12,9 @@ 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 '../../constants/api.dart';
import '../../model/network/api_client.dart';
import '../../permission.dart';
import '../../providers/user_provider.dart';
import '../../utils/toast/cloud_toast.dart';
import '../../utils/user_tool.dart';
import '../home/home_page.dart';
class UserPage extends StatefulWidget {
@ -33,9 +26,13 @@ class UserPage extends StatefulWidget {
final Telephony telephony = Telephony.instance;
@override
void initState() {}
class _UserPageState extends State<UserPage> {
bool vle = false;
final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
bool tooken = true;
@override
Widget build(BuildContext context) {
@ -58,24 +55,17 @@ class _UserPageState extends State<UserPage> {
_getSwitch(Assets.icons.sms.path, "短信标签", false),
// const Spacer(),
182.hb,
userProvider.isLogin
? PloneBottom(
tooken?
PloneBottom(
border: false,
onTap: () async{
var cancel = CloudToast.loading;
var base = await apiClient.request(API.manager.logout, showMessage: true);
if (base.code == 0) {
UserTool.userProvider.logout();
Get.offAll(const HomePage());
}
cancel();
onTap: () {
Get.to(() => const HomePage());
},
textColor: const Color(0xFF1890FF),
color1: const Color(0xFFEBF5FF),
color2: const Color(0xFFEBF5FF),
text: "退出登录",
)
: const SizedBox()
):const SizedBox()
]),
);
}
@ -94,7 +84,7 @@ class _UserPageState extends State<UserPage> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
userProvider.isLogin ? userProvider.userInfo.name : "登录/注册",
tooken? "xxxxx": "登录/注册" ,
style: TextStyle(
fontSize: BaseStyle.fontSize48,
color: BaseStyle.color333333,
@ -102,7 +92,7 @@ class _UserPageState extends State<UserPage> {
),
24.hb,
Text(
userProvider.isLogin ? "欢迎您登录短信帮手" : "登录获取更多信息",
tooken ? "登录获取更多信息" : "欢迎您登录短信帮手",
style: TextStyle(
fontSize: BaseStyle.fontSize28,
color: BaseStyle.color333333),

Loading…
Cancel
Save