库包替换

master
王亚玲 2 years ago
parent d66244e002
commit da9a2a5549

@ -21,7 +21,7 @@ class API {
} }
static const int networkTimeOut = 10000; static const int networkTimeOut = 10000;
static String get baseURL => '$host'; static String get baseURL => host;
static _App app = _App(); static _App app = _App();
static _Pay pay = _Pay(); static _Pay pay = _Pay();

@ -18,24 +18,24 @@ extension WidgetListExt on List<Widget> {
extension OddListExt<T> on List<T> { extension OddListExt<T> on List<T> {
List<T> oddList() { List<T> oddList() {
List<T> _newList = []; List<T> newList = [];
for (var element in this) { for (var element in this) {
if (indexOf(element).isEven) { if (indexOf(element).isEven) {
_newList.add(element); newList.add(element);
} }
} }
return _newList; return newList;
} }
} }
extension EvenListExt<T> on List<T> { extension EvenListExt<T> on List<T> {
List<T> evenList() { List<T> evenList() {
List<T> _newList = []; List<T> newList = [];
forEach((element) { forEach((element) {
if (indexOf(element).isOdd) { if (indexOf(element).isOdd) {
_newList.add(element); newList.add(element);
} }
}); });
return _newList; return newList;
} }
} }

@ -2,12 +2,12 @@
import 'dart:async'; import 'dart:async';
import 'package:bot_toast/bot_toast.dart'; import 'package:bot_toast/bot_toast.dart';
import 'package:call_log/call_log.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_background_service/flutter_background_service.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_sms/flutter_sms.dart';
import 'package:fluwx/fluwx.dart'; import 'package:fluwx/fluwx.dart';
import 'package:get/get_navigation/src/root/get_material_app.dart'; import 'package:get/get_navigation/src/root/get_material_app.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart';
@ -16,22 +16,14 @@ import 'package:power_logger/power_logger.dart';
import 'package:project_telephony/providers/user_provider.dart'; import 'package:project_telephony/providers/user_provider.dart';
import 'package:project_telephony/ui/home/call.dart'; import 'package:project_telephony/ui/home/call.dart';
import 'package:project_telephony/ui/home/call_sms.dart';
import 'package:project_telephony/ui/tab_navigator.dart'; import 'package:project_telephony/ui/tab_navigator.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:telephony/telephony.dart'; import 'package:telephony/telephony.dart';
import 'package:project_telephony/utils/hive_store.dart'; import 'package:project_telephony/utils/hive_store.dart';
import 'package:workmanager/workmanager.dart';
// 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());
// }
// }
@ -63,7 +55,6 @@ class MyApp extends StatefulWidget {
class _MyAppState extends State<MyApp> { class _MyAppState extends State<MyApp> {
final telephony = Telephony.instance; final telephony = Telephony.instance;
@override
Future<void> _Getpermission() async{ Future<void> _Getpermission() async{
await [Permission.sms,Permission.phone,].request(); await [Permission.sms,Permission.phone,].request();
} }

@ -1,4 +1,4 @@
import 'dart:io';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';

@ -12,10 +12,10 @@ class LoginModel {
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>(); final Map<String, dynamic> data = <String, dynamic>{};
data['message'] = this.message; data['message'] = message;
data['token'] = this.token; data['token'] = token;
data['status'] = this.status; data['status'] = status;
return data; return data;
} }
} }

@ -5,7 +5,7 @@ import '../model/hive/ContentHive.dart';
class ContentListModel extends ChangeNotifier{ class ContentListModel extends ChangeNotifier{
late Box _regionBox; late Box _regionBox;
List<ContentHive> _regions=[]; final List<ContentHive> _regions=[];
List<ContentHive> get regions=>_regions; List<ContentHive> get regions=>_regions;
Future init() async{} Future init() async{}
// _regionBox = await Hive.openBox("ContentListBox"); // _regionBox = await Hive.openBox("ContentListBox");

@ -1,37 +1,16 @@
import 'dart:async'; import 'dart:async';
import 'dart:io';
import 'dart:ui'; import 'dart:ui';
import 'package:call_log/call_log.dart'; import 'package:call_log/call_log.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter_background_service/flutter_background_service.dart'; import 'package:flutter_background_service/flutter_background_service.dart';
import 'package:flutter_sms/flutter_sms.dart';
import 'package:project_telephony/ui/user/user_page.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:telephony/telephony.dart'; import 'package:telephony/telephony.dart';
//
// Future<void> _sendSMS(String message, List<String> recipients) async {
// await sendSMS(message: message, recipients: recipients, sendDirect: true);
// // try{
// // String result =
// // await sendSMS(message: message, recipients: recipients, sendDirect: true);
// // print(result);
// // } catch (error){
// // print(error.toString());
// // }
//
// }
Future<void> initializeService() async { Future<void> initializeService() async {
SharedPreferences preferences = await SharedPreferences.getInstance(); // SharedPreferences preferences = await SharedPreferences.getInstance();
final service = FlutterBackgroundService(); final service = FlutterBackgroundService();
await service.configure( await service.configure(

@ -71,7 +71,7 @@ class _ContentDetailsPageState extends State<ContentDetailsPage> {
}, },
onChanged: (text) { onChanged: (text) {
content = text; content = text;
print(content); // print(content);
setState(() {}); setState(() {});
}, },
style: TextStyle( style: TextStyle(

@ -141,13 +141,4 @@ class _ContentPageState extends State<ContentPage> {
), ),
); );
} }
void _sendSMS(String message, List<String> recipients) async {
String _result = await sendSMS(
message: message, recipients: recipients, sendDirect: true)
.catchError((onError) {
print(onError);
});
print(_result);
}
} }

@ -1,10 +1,10 @@
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_sms/flutter_sms.dart';
import 'package:project_telephony/ui/user/user_page.dart'; import 'package:project_telephony/ui/user/user_page.dart';
import 'package:project_telephony/utils/headers.dart'; import 'package:project_telephony/utils/headers.dart';
import 'home/call.dart';
import 'home/home_page.dart'; import 'home/home_page.dart';
class TabNavigator extends StatefulWidget { class TabNavigator extends StatefulWidget {

@ -1,7 +1,7 @@
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:project_telephony/base/base_style.dart'; import 'package:project_telephony/base/base_style.dart';
import 'package:project_telephony/ui/user/members_page.dart';
import 'package:project_telephony/ui/widget/check_radio.dart'; import 'package:project_telephony/ui/widget/check_radio.dart';
import 'package:project_telephony/ui/widget/plone_back_button.dart'; import 'package:project_telephony/ui/widget/plone_back_button.dart';
import 'package:project_telephony/ui/widget/plone_bottom.dart'; import 'package:project_telephony/ui/widget/plone_bottom.dart';
@ -9,8 +9,7 @@ import 'package:project_telephony/ui/widget/putup_widget.dart';
import 'package:project_telephony/utils/headers.dart'; import 'package:project_telephony/utils/headers.dart';
import 'package:tobias/tobias.dart'; import 'package:tobias/tobias.dart';
import 'package:fluwx/fluwx.dart' as fluwx; import 'package:fluwx/fluwx.dart' as fluwx;
import '../../model/pay/wx_pay_model.dart';
import '../../utils/pay_util.dart';
class MembersPage extends StatefulWidget { class MembersPage extends StatefulWidget {
const MembersPage({Key? key}) : super(key: key); const MembersPage({Key? key}) : super(key: key);
@ -87,7 +86,7 @@ class _MembersPageState extends State<MembersPage> {
}else{ }else{
aliPay("paySign").then((payResult) { aliPay("paySign").then((payResult) {
// map["paySign"] // map["paySign"]
print("支付宝:" + payResult.toString()); print("支付宝:$payResult");
if (payResult['resultStatus'] == '9000') { if (payResult['resultStatus'] == '9000') {
Get.snackbar('提示', "充值成功"); Get.snackbar('提示', "充值成功");
} else { } else {

@ -79,14 +79,12 @@ class _PrivacyRightsPageState extends State<PrivacyRightsPage> {
return ListTile( return ListTile(
onTap: ()async{ onTap: ()async{
if(!(sms && plone)){ if(!(sms && plone)){
print(sms); // print(sms);
print(plone); // print(plone);
openAppSettings(); openAppSettings();
}else{ }else{
print("123123123123"); // print("123123123123");
} }
// await Permission.phone.request(); // await Permission.phone.request();
// await Permission.sms.request(); // await Permission.sms.request();
// Map<Permission, PermissionStatus> statuses = await [ // Map<Permission, PermissionStatus> statuses = await [
@ -95,12 +93,12 @@ class _PrivacyRightsPageState extends State<PrivacyRightsPage> {
// ].request(); // ].request();
// //
// openAppSettings(); // openAppSettings();
print(await Permission.phone.request().isGranted); // print(await Permission.phone.request().isGranted);
print(await Permission.sms.request().isGranted); // print(await Permission.sms.request().isGranted);
}, },
title: Text( title: Text(
'获取设备来电', '获取设备来电',
// style: Theme.of(context).textTheme.titleMedium, style: Theme.of(context).textTheme.titleMedium,
), ),
subtitle: const Text( subtitle: const Text(
"获取设备", "获取设备",

@ -1,31 +1,28 @@
import 'dart:async';
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/services.dart'; import 'package:flutter/services.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/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/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:workmanager/workmanager.dart';
import '../../constants/api.dart'; import '../../constants/api.dart';
import '../../model/network/api_client.dart'; import '../../model/network/api_client.dart';
import '../../permission.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';
import '../home/call.dart';
import '../home/content_details_page.dart'; import '../home/content_details_page.dart';
import '../home/home_page.dart'; import '../home/home_page.dart';
@ -239,7 +236,6 @@ class _UserPageState extends State<UserPage> {
// //
_getSwitch(String url, String name, bool pd) { _getSwitch(String url, String name, bool pd) {
num a=0;
return GestureDetector( return GestureDetector(
onTap: () async { onTap: () async {
pd pd
@ -277,28 +273,12 @@ class _UserPageState extends State<UserPage> {
value: vle, value: vle,
onChanged: (value) async{ onChanged: (value) async{
vle=value; vle=value;
print(vle);
if(vle) { if(vle) {
Telephony.backgroundInstance.sendSms(to: "13395740386", message: "啦啦啦啦啦"); Telephony.backgroundInstance.sendSms(to: "13395740386", message: "啦啦啦啦啦");
// Workmanager().registerOneOffTask("task-identifier", "simpleTask"); // Workmanager().registerOneOffTask("task-identifier", "simpleTask");
} }
setState((){}); setState((){});
// await Permission.phone.request();
// List<Permission> permissions = [
// Permission.sms,
// Permission.phone,
// ];
// PermissionHelper.check(permissions, onSuccess: () {
// print('onSuccess');
// }, onFailed: () {
// print('onFailed');
// }, onOpenSetting: () {
// print('onOpenSetting');
// openAppSettings();
// });
// setState(() {
// vle = value;
// });
}) })
: const Icon(Icons.keyboard_arrow_right)), : const Icon(Icons.keyboard_arrow_right)),
), ),

@ -1,5 +1,5 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:project_telephony/utils/headers.dart'; import 'package:project_telephony/utils/headers.dart';
class Centertipsalterwidget extends StatefulWidget { class Centertipsalterwidget extends StatefulWidget {
@ -23,8 +23,8 @@ class _CentertipsalterwidgetState extends State<Centertipsalterwidget> {
height: 10.w, height: 10.w,
), ),
Align( Align(
child: Text(widget.desText),
alignment: const Alignment(0, 0), alignment: const Alignment(0, 0),
child: Text(widget.desText),
) )
]), ]),
actions: [ actions: [

@ -1025,9 +1025,11 @@ packages:
telephony: telephony:
dependency: "direct main" dependency: "direct main"
description: description:
name: telephony path: "."
url: "https://pub.dartlang.org" ref: HEAD
source: hosted resolved-ref: a7f9c11a4e2f5fb1dac1058c0c96435d31f29a29
url: "https://git.oa00.com/wylyl22/telephony.git"
source: git
version: "0.2.0" version: "0.2.0"
term_glyph: term_glyph:
dependency: transitive dependency: transitive
@ -1183,13 +1185,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.5.2" version: "2.5.2"
workmanager:
dependency: "direct main"
description:
name: workmanager
url: "https://pub.dartlang.org"
source: hosted
version: "0.5.0"
xdg_directories: xdg_directories:
dependency: transitive dependency: transitive
description: description:
@ -1212,5 +1207,5 @@ packages:
source: hosted source: hosted
version: "3.1.1" version: "3.1.1"
sdks: sdks:
dart: ">=2.17.0 <3.0.0" dart: ">=2.17.0-206.0.dev <3.0.0"
flutter: ">=2.8.0" flutter: ">=2.8.0"

@ -34,14 +34,16 @@ dependencies:
# The following adds the Cupertino Icons font to your application. # The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons. # Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2 cupertino_icons: ^1.0.2
telephony: ^0.2.0 telephony:
git:
url: https://git.oa00.com/wylyl22/telephony.git
## 获取来电状态 ## 获取来电状态
# provider: ^6.0.3 # provider: ^6.0.3
# 获取通话记录 # 获取通话记录
call_log: ^4.0.0 call_log: ^4.0.0
permission_handler: ^10.0.0 permission_handler: ^10.0.0
# 后台设置 # 后台设置
workmanager: ^0.5.0
flutter_background_service: ^2.1.3 flutter_background_service: ^2.1.3
flutter_background_service_android: ^2.0.3 flutter_background_service_android: ^2.0.3
device_info_plus: any device_info_plus: any

@ -14,7 +14,7 @@ import 'package:project_telephony/main.dart';
void main() { void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async { testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame. // Build our app and trigger a frame.
await tester.pumpWidget(MyApp()); await tester.pumpWidget(const MyApp());
// Verify that our counter starts at 0. // Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget); expect(find.text('0'), findsOneWidget);

Loading…
Cancel
Save