diff --git a/assets/icons/notxlphone.png b/assets/icons/notxlphone.png new file mode 100644 index 0000000..3abc656 Binary files /dev/null and b/assets/icons/notxlphone.png differ diff --git a/assets/icons/nullphonelist.png b/assets/icons/nullphonelist.png new file mode 100644 index 0000000..231b3e6 Binary files /dev/null and b/assets/icons/nullphonelist.png differ diff --git a/assets/icons/rylyphone.png b/assets/icons/rylyphone.png new file mode 100644 index 0000000..4feca3a Binary files /dev/null and b/assets/icons/rylyphone.png differ diff --git a/assets/icons/set.png b/assets/icons/set.png new file mode 100644 index 0000000..70ed20d Binary files /dev/null and b/assets/icons/set.png differ diff --git a/assets/icons/txlphone.png b/assets/icons/txlphone.png new file mode 100644 index 0000000..f83e4d3 Binary files /dev/null and b/assets/icons/txlphone.png differ diff --git a/assets/icons/zdphone.png b/assets/icons/zdphone.png new file mode 100644 index 0000000..c0413e9 Binary files /dev/null and b/assets/icons/zdphone.png differ diff --git a/lib/gen/assets.gen.dart b/lib/gen/assets.gen.dart index 46c2bab..0c983d3 100644 --- a/lib/gen/assets.gen.dart +++ b/lib/gen/assets.gen.dart @@ -34,6 +34,14 @@ class $AssetsIconsGen { AssetGenImage get mySelected => const AssetGenImage('assets/icons/my_selected.png'); + /// File path: assets/icons/notxlphone.png + AssetGenImage get notxlphone => + const AssetGenImage('assets/icons/notxlphone.png'); + + /// File path: assets/icons/nullphonelist.png + AssetGenImage get nullphonelist => + const AssetGenImage('assets/icons/nullphonelist.png'); + /// File path: assets/icons/permissions.png AssetGenImage get permissions => const AssetGenImage('assets/icons/permissions.png'); @@ -44,15 +52,29 @@ class $AssetsIconsGen { /// File path: assets/icons/right.png AssetGenImage get right => const AssetGenImage('assets/icons/right.png'); + /// File path: assets/icons/rylyphone.png + AssetGenImage get rylyphone => + const AssetGenImage('assets/icons/rylyphone.png'); + + /// File path: assets/icons/set.png + AssetGenImage get set => const AssetGenImage('assets/icons/set.png'); + /// File path: assets/icons/sms.png AssetGenImage get sms => const AssetGenImage('assets/icons/sms.png'); /// File path: assets/icons/switch1.png AssetGenImage get switch1 => const AssetGenImage('assets/icons/switch1.png'); + /// File path: assets/icons/txlphone.png + AssetGenImage get txlphone => + const AssetGenImage('assets/icons/txlphone.png'); + /// File path: assets/icons/weixin.png AssetGenImage get weixin => const AssetGenImage('assets/icons/weixin.png'); + /// File path: assets/icons/zdphone.png + AssetGenImage get zdphone => const AssetGenImage('assets/icons/zdphone.png'); + /// File path: assets/icons/zhifubao.png AssetGenImage get zhifubao => const AssetGenImage('assets/icons/zhifubao.png'); diff --git a/lib/ui/home/home_page.dart b/lib/ui/home/home_page.dart index afa35a5..681195e 100644 --- a/lib/ui/home/home_page.dart +++ b/lib/ui/home/home_page.dart @@ -7,6 +7,7 @@ import 'package:flutter_background_service/flutter_background_service.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:project_telephony/ui/home/content_connect_page.dart'; import 'package:project_telephony/ui/home/content_refuse_page.dart'; +import 'package:project_telephony/ui/home/set/phone_set_page.dart'; import 'package:project_telephony/ui/user/privacy_rights_page.dart'; import 'package:project_telephony/ui/widget/appdialog.dart'; @@ -26,13 +27,12 @@ class HomePage extends StatefulWidget { bool sms = false; bool plone = false; -bool kg=false; +bool kg = false; final service = FlutterBackgroundService(); + @override class _HomePageState extends State with WidgetsBindingObserver { - - @override void initState() { super.initState(); @@ -124,20 +124,18 @@ class _HomePageState extends State with WidgetsBindingObserver { offstage: (sms && plone && callLog && kg), child: GestureDetector( onTap: () { - if(!(sms && plone && callLog && kg)){ - if(!(sms && plone && callLog )){ - Get.to(()=>const PrivacyRightsPage(name: "权限说明")); + if (!(sms && plone && callLog && kg)) { + if (!(sms && plone && callLog)) { + Get.to(() => const PrivacyRightsPage(name: "权限说明")); // Get.to(()=>const TabNavigator(index: 1,)); - }else{ + } else { BotToast.showText(text: '功能开关未开启'); - } } // print(); // openAppSettings(); }, - child: - Container( + child: Container( width: 622.w, margin: EdgeInsets.symmetric(horizontal: 64.w), padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 20.w), @@ -155,17 +153,21 @@ class _HomePageState extends State with WidgetsBindingObserver { ), 16.wb, Text( - !(sms && plone && callLog ) ? "必须权限没有授予,本APP无法正常使用":"功能开关未开启,请到我的页面开启", + !(sms && plone && callLog) + ? "必须权限没有授予,本APP无法正常使用" + : "功能开关未开启,请到我的页面开启", style: TextStyle(color: const Color(0xFFFF3F3F), fontSize: 24.sp), ), - !(sms && plone && callLog ) ?32.wb: 0.wb, - !(sms && plone && callLog )? Image( - image: AssetImage(Assets.icons.right.path), - width: 28.w, - height: 28.w, - fit: BoxFit.fill, - ):const SizedBox() + !(sms && plone && callLog) ? 32.wb : 0.wb, + !(sms && plone && callLog) + ? Image( + image: AssetImage(Assets.icons.right.path), + width: 28.w, + height: 28.w, + fit: BoxFit.fill, + ) + : const SizedBox() ], ), ), @@ -186,12 +188,14 @@ class _HomePageState extends State with WidgetsBindingObserver { color: const Color(0xFF333333), fontWeight: FontWeight.bold), ), - 8.hb, + 24.hb, Text( "希望能成为您的短信小助手", style: TextStyle(fontSize: 32.sp, color: const Color(0xFF999999)), ), - 50.hb, + 48.hb, + _getSet(), + 32.hb, _getContainer("接听后", "编辑接听后发送的短信内容", Assets.images.answer.path, const Color(0xFF74BCFF), const Color(0xFF1890FF)), 30.hb, @@ -202,6 +206,44 @@ class _HomePageState extends State with WidgetsBindingObserver { ); } + _getSet() { + return GestureDetector( + onTap: (){ + Get.to(()=>const PhoneSetPage()); + }, + child: Container( + padding: EdgeInsets.symmetric(horizontal: 42.w, vertical: 20.w), + decoration: BoxDecoration( + color: const Color(0xFFF2F9FF), + border: Border.all(color: const Color(0xFF1890FF), width: 2.w), + borderRadius: BorderRadius.circular(16.w)), + child: Row( + children: [ + SizedBox( + width: 48.w, + height: 48.w, + child: Image.asset(Assets.icons.set.path), + ), + 16.wb, + Text( + "短信发送号码设置", + style: TextStyle(fontSize: 28.sp, color: const Color(0xFF1890FF)), + ), + 190.wb, + SizedBox( + width: 48.w, + height: 48.w, + child: const Icon( + Icons.chevron_right, + color: Color(0xFF1890FF), + ), + ), + ], + ), + ), + ); + } + _getContainer(String title, String text, String image, Color cl1, Color cl2) { return GestureDetector( onTap: () { diff --git a/lib/ui/home/set/phone_set_page.dart b/lib/ui/home/set/phone_set_page.dart new file mode 100644 index 0000000..118e826 --- /dev/null +++ b/lib/ui/home/set/phone_set_page.dart @@ -0,0 +1,158 @@ +import 'package:flutter/material.dart'; +import 'package:project_telephony/ui/home/set/specify_phone_page.dart'; +import 'package:project_telephony/utils/headers.dart'; + +import '../../../base/base_style.dart'; + +import '../../widget/plone_back_button.dart'; + +// class setItem{ +// +// } + +class PhoneSetPage extends StatefulWidget { + const PhoneSetPage({Key? key}) : super(key: key); + + @override + _PhoneSetPageState createState() => _PhoneSetPageState(); +} + +class _PhoneSetPageState extends State { + int select = 0; + List setList = [ + { + "icon": Assets.icons.rylyphone.path, + "title": "任意来源号码发送", + "text": "所有的号码来电都会发送", + // "select": true, + }, + { + "icon": Assets.icons.txlphone.path, + "title": "在通讯录中的号码发送", + "text": "只给在通讯录中的号码来电发送", + // "select": false, + }, + { + "icon": Assets.icons.notxlphone.path, + "title": "不在通讯录中的号码发送", + "text": "只给不在通讯录中的号码来电发送", + // "select": false, + }, + ]; + + @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: 162.w, + leading: const CloudBackButton(isSpecial: true), + backgroundColor: kForeGroundColor), + backgroundColor: kForeGroundColor, + body: Column( + children: [ + _getList(), + 24.hb, + GestureDetector( + onTap: () { + Get.to(()=>const SpecifyPhonePage()); + }, + child: Container( + padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 30.w), + height: 144.w, + child: ListTile( + leading: SizedBox( + width: 72.w, + height: 72.w, + child: Image.asset( + Assets.icons.zdphone.path, + fit: BoxFit.fill, + ), + ), + title: Text( + "指定号码不发送", + style: + TextStyle(fontSize: 32.sp, fontWeight: FontWeight.bold), + ), + subtitle: Text( + "通过添加指定号码来设置不发送", + style: TextStyle( + fontSize: 28.sp, color: const Color(0xFF999999)), + ), + trailing: SizedBox( + width: 48.w, + height: 48.w, + child: const Icon(Icons.arrow_forward_ios), + )), + ), + ) + ], + ), + ); + } + + _getList() { + return Container( + padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 30.w), + height: 500.w, + child: ListView.builder( + itemBuilder: (context, index) { + return _getListBox(setList, index); + }, + itemCount: setList.length, + ), + ); + } + + _getListBox(List item, int index) { + return GestureDetector( + onTap: () { + select = index; + // print(_selectIndex); + setState(() {}); + }, + child: ListTile( + leading: SizedBox( + width: 72.w, + height: 72.w, + child: Image.asset( + item[index]["icon"], + fit: BoxFit.fill, + )), + title: Text( + item[index]["title"], + style: TextStyle(fontSize: 32.sp, fontWeight: FontWeight.bold), + ), + subtitle: Text( + item[index]["text"], + style: TextStyle(fontSize: 28.sp, color: const Color(0xFF999999)), + ), + trailing: SizedBox( + width: 40.w, + height: 40.w, + child: Radio( + onChanged: (int? value) { + select = index; + // print(_selectIndex); + setState(() {}); + }, + groupValue: select, + value: index, + ), + ), + + // BeeCheckRadio( + // value: index, + // groupValue: [select], + // ), + ), + ); + } +} diff --git a/lib/ui/home/set/specify_phone_page.dart b/lib/ui/home/set/specify_phone_page.dart new file mode 100644 index 0000000..c40d6c1 --- /dev/null +++ b/lib/ui/home/set/specify_phone_page.dart @@ -0,0 +1,158 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_easyrefresh/easy_refresh.dart'; +import 'package:project_telephony/ui/home/home_page.dart'; +import 'package:project_telephony/utils/headers.dart'; +import 'package:project_telephony/ui/widget/plone_bottom.dart'; + +import '../../../base/base_style.dart'; + +import '../../widget/plone_back_button.dart'; + +class SpecifyPhonePage extends StatefulWidget { + const SpecifyPhonePage({Key? key}) : super(key: key); + + @override + _SpecifyPhonePageState createState() => _SpecifyPhonePageState(); +} + +class _SpecifyPhonePageState extends State { + final EasyRefreshController _refreshController = EasyRefreshController(); + + @override + void dispose() { + _refreshController.dispose(); + super.dispose(); + } + + @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: 162.w, + leading: const CloudBackButton(isSpecial: true), + backgroundColor: kForeGroundColor), + backgroundColor: kForeGroundColor, + body: EasyRefresh( + firstRefresh: true, + controller: _refreshController, + header: MaterialHeader(), + // footer: MaterialFooter(), + onRefresh: () async { + // await userProvider.updateUserInfo(); + + setState(() {}); + }, + child: ListView( + children: [ + _getNullList(), + PloneBottom( + onTap: () { + showModalBottomSheet( + builder: (BuildContext context) { + return Container( + width: double.infinity, + height: 750.w, + padding: EdgeInsets.symmetric(horizontal: 32.w), + child: Column( + children: [ + 48.hb, + Text( + "添加号码", + style: TextStyle( + fontSize: 34.w, + fontWeight: FontWeight.bold), + ), + Expanded( + child: ListView( + children: [ + _getAddPhone("通话记录添加", "通过本机通话记录添加号码", () { + + }), + _getAddPhone("通迅录添加", "通过本机通讯录添加号码", () {}), + _getAddPhone( + "添加单个或批量号码", "通过输入号码段添加批量号码", () {}), + ], + )), + PloneBottom( + onTap: () { + Navigator.pop(context); + }, + hPadding: 32, + border: true, + textColor: const Color(0xFF1890FF), + color2: const Color(0xFFF9F9F9), + color1: const Color(0xFFF9F9F9), + text: "取消", + ), + 32.hb + ], + ), + ); + }, + context: context); + }, + border: true, + color2: const Color(0xFF74BCFF), + color1: const Color(0xFF1890FF), + text: "添加", + ), + ], + )), + ); + } + + _getAddPhone(String title, String text, VoidCallback widget) { + return GestureDetector( + onTap: widget, + child: ListTile( + title: Text( + title, + style: TextStyle(fontSize: 32.sp, fontWeight: FontWeight.bold), + ), + subtitle: Text( + text, + style: TextStyle(fontSize: 28.sp, color: BaseStyle.color999999), + ), + trailing: const Icon(Icons.chevron_right), + ), + ); + } + + _getNullList() { + return Column( + mainAxisAlignment: MainAxisAlignment.center, + // crossAxisAlignment: CrossAxisAlignment.center, + children: [ + 490.hb, + Image.asset( + Assets.icons.nullphonelist.path, + width: 240.w, + height: 212.w, + fit: BoxFit.fill, + ), + 48.hb, + Text( + "这里是空的", + style: TextStyle( + color: const Color(0xFF999999), + fontWeight: FontWeight.bold, + fontSize: 36.sp), + ), + 16.hb, + Text( + "还没有添加指定号码", + style: TextStyle(color: const Color(0xFF999999), fontSize: 28.sp), + ), + 490.hb, + ], + ); + } +} diff --git a/lib/ui/user/user_page.dart b/lib/ui/user/user_page.dart index 4798fb9..09be0db 100644 --- a/lib/ui/user/user_page.dart +++ b/lib/ui/user/user_page.dart @@ -4,7 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_background_service/flutter_background_service.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart'; -import 'package:permission_handler/permission_handler.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'; @@ -20,14 +20,14 @@ import 'package:telephony/telephony.dart'; import '../../constants/api.dart'; import '../../model/network/api_client.dart'; import '../../providers/user_provider.dart'; -import '../../utils/hive_store.dart'; + import '../../utils/toast/cloud_toast.dart'; import '../../utils/user_tool.dart'; import '../home/call.dart'; import '../widget/appdialog.dart'; import 'content_details_page.dart'; -import '../home/home_page.dart'; + class UserPage extends StatefulWidget { const UserPage({Key? key}) : super(key: key); diff --git a/lib/ui/widget/appdialog.dart b/lib/ui/widget/appdialog.dart index 767c65c..362e63d 100644 --- a/lib/ui/widget/appdialog.dart +++ b/lib/ui/widget/appdialog.dart @@ -70,6 +70,7 @@ _getBotton(String bContent, context) { var res = await apiClient.request(API.app.trialVip); if (res.code == 0) { CloudToast.show(res.msg); + Navigator.pop(context); } else { CloudToast.show(res.msg); Navigator.pop(context); diff --git a/lib/ui/widget/plone_bottom.dart b/lib/ui/widget/plone_bottom.dart index 7d4a369..f364911 100644 --- a/lib/ui/widget/plone_bottom.dart +++ b/lib/ui/widget/plone_bottom.dart @@ -12,6 +12,7 @@ class PloneBottom extends StatefulWidget { final bool blM; //是否间距 final bool border; //是否有边框 final double opacity; + final int hPadding; const PloneBottom({ Key? key, this.text = '返回首页', @@ -21,6 +22,7 @@ class PloneBottom extends StatefulWidget { this.blM = true, this.border = false, this.opacity = 1, + this.hPadding=64, required this.onTap, }); @@ -40,7 +42,7 @@ class _PloneBottomState extends State { alignment: Alignment.center, padding: EdgeInsets.symmetric(vertical: 14.w), margin: widget.blM - ? EdgeInsets.symmetric(horizontal: 64.w) + ? EdgeInsets.symmetric(horizontal: widget.hPadding.w) : EdgeInsets.only(left: 0.w), decoration: BoxDecoration( border: Border.all(