diff --git a/assets/icons/mass.png b/assets/icons/mass.png new file mode 100644 index 0000000..c95bf1f Binary files /dev/null and b/assets/icons/mass.png differ diff --git a/assets/icons/nomass.png b/assets/icons/nomass.png new file mode 100644 index 0000000..c9cf04a Binary files /dev/null and b/assets/icons/nomass.png differ diff --git a/lib/gen/assets.gen.dart b/lib/gen/assets.gen.dart index d783583..0e02fff 100644 --- a/lib/gen/assets.gen.dart +++ b/lib/gen/assets.gen.dart @@ -29,6 +29,9 @@ class $AssetsIconsGen { /// File path: assets/icons/horn.png AssetGenImage get horn => const AssetGenImage('assets/icons/horn.png'); + /// File path: assets/icons/mass.png + AssetGenImage get mass => const AssetGenImage('assets/icons/mass.png'); + /// File path: assets/icons/my_noselected.png AssetGenImage get myNoselected => const AssetGenImage('assets/icons/my_noselected.png'); @@ -37,6 +40,9 @@ class $AssetsIconsGen { AssetGenImage get mySelected => const AssetGenImage('assets/icons/my_selected.png'); + /// File path: assets/icons/nomass.png + AssetGenImage get nomass => const AssetGenImage('assets/icons/nomass.png'); + /// File path: assets/icons/notxlphone.png AssetGenImage get notxlphone => const AssetGenImage('assets/icons/notxlphone.png'); diff --git a/lib/model/mass_list_model.dart b/lib/model/mass_list_model.dart new file mode 100644 index 0000000..79c33c6 --- /dev/null +++ b/lib/model/mass_list_model.dart @@ -0,0 +1,24 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:equatable/equatable.dart'; +import 'package:project_telephony/model/phone_num_model.dart'; +part 'mass_list_model.g.dart'; + + +@JsonSerializable() +class MassListModel extends Equatable{ + final String title; + final String time; + bool state; + final List list; + factory MassListModel.fromJson(Map json) =>_$MassListModelFromJson(json); + + + MassListModel({ + required this.title, + required this.time, + required this.state, + required this.list, + }); + @override + List get props => [title,time,state,list]; +} \ No newline at end of file diff --git a/lib/model/mass_list_model.g.dart b/lib/model/mass_list_model.g.dart new file mode 100644 index 0000000..8d9a754 --- /dev/null +++ b/lib/model/mass_list_model.g.dart @@ -0,0 +1,15 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'mass_list_model.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +MassListModel _$MassListModelFromJson(Map json) => + MassListModel( + title: json['title'] as String, + time: json['time'] as String, + state: json['state'] as bool, + list: json['list'] as List, + ); diff --git a/lib/providers/phone_num_provider.dart b/lib/providers/phone_num_provider.dart index 9bf5397..36032a3 100644 --- a/lib/providers/phone_num_provider.dart +++ b/lib/providers/phone_num_provider.dart @@ -1,8 +1,8 @@ -import 'package:call_log/call_log.dart'; + import 'package:flutter/material.dart'; import '../model/phone_num_model.dart'; -import '../utils/hive_store.dart'; + class PhoneNumProvider extends ChangeNotifier{ final List _phoneNum=[PhoneNumModel(num: "",time: 0,name: "", state:false)]; diff --git a/lib/providers/user_provider.dart b/lib/providers/user_provider.dart index ba7e2e8..4754978 100644 --- a/lib/providers/user_provider.dart +++ b/lib/providers/user_provider.dart @@ -9,6 +9,7 @@ import '../constants/api.dart'; import '../model/exclude_phone_model.dart'; import '../model/login_info_model.dart'; import '../model/network/api_client.dart'; +import '../model/phone_num_model.dart'; import '../model/user_info_model.dart'; import '../ui/home/set/func/exclude_contacts_func.dart'; import '../utils/hive_store.dart'; @@ -26,7 +27,6 @@ class UserProvider extends ChangeNotifier { String get contentCon => _contentCon; late String _contentRef; - String get contentRef => _contentRef; Future init() async { @@ -49,12 +49,15 @@ class UserProvider extends ChangeNotifier { Future setToken(String token, {User? user}) async { final prefs = await SharedPreferences.getInstance(); + // List dxText=[]; apiClient.setToken(token); await HiveStore.appBox!.put('token', token); _isLogin = true; //每次打开app更新用户信息 await updateUserInfo(); prefs.setInt("numIndex", 0); + _viewLoading(); + // prefs.setStringList("dxText",["祝你万事顺心","欢迎你的来电,祝你生活愉快","感谢您的来电,我们会尽快处理",]); updateConSms(); updateRefSms(); updateCallSms(); @@ -222,4 +225,29 @@ class UserProvider extends ChangeNotifier { notifyListeners(); } + + Future _viewLoading() async { + List? contacts; + List numbers=[]; + List nameList=[]; + final SharedPreferences prefs = await SharedPreferences.getInstance(); + contacts = await FlutterContacts.getContacts(); + for (var element in contacts) { + final full = await FlutterContacts.getContact(element.id); + if(full?.phones.length==0){ + numbers.add('无'); + }else{ + nameList.add(full!.displayName); + numbers.add(full.phones.first.number); + // phoneList.add(PhoneNumModel(time: 0, name: full!.displayName, state: false, num: full.phones.first.number)); + // numbers.add(full!.phones.first.number); + } + } + + await prefs.setStringList("nameList",nameList ); + prefs.setStringList("number", numbers); + // print(contacts.length); + notifyListeners(); + } + } diff --git a/lib/ui/TextMe/address_book.dart b/lib/ui/TextMe/address_book.dart new file mode 100644 index 0000000..839bfba --- /dev/null +++ b/lib/ui/TextMe/address_book.dart @@ -0,0 +1,216 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_contacts/contact.dart'; +import 'package:flutter_contacts/flutter_contacts.dart'; +import 'package:flutter_easyrefresh/easy_refresh.dart'; +import 'package:project_telephony/utils/headers.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +import '../../base/base_style.dart'; +import '../../model/mass_list_model.dart'; +import '../../model/phone_num_model.dart'; +import '../widget/plone_back_button.dart'; +import '../widget/plone_bottom.dart'; + +class AddressBook extends StatefulWidget { + const AddressBook({Key? key}) : super(key: key); + + @override + _AddressBookState createState() => _AddressBookState(); +} + +class _AddressBookState extends State { + final EasyRefreshController _easyRefreshController = EasyRefreshController(); + String phoneName = ""; + List massList = []; + List phoneList = []; + + @override + void initState() { + a(); + super.initState(); + } + + @override + void dispose() { + _easyRefreshController.dispose(); + super.dispose(); + } + + a() async { + final SharedPreferences prefs = await SharedPreferences.getInstance(); + List numbers = []; + List? nameList = []; + List? contacts; + contacts = await FlutterContacts.getContacts(); + for (var element in contacts) { + final full = await FlutterContacts.getContact(element.id); + if (full?.phones.length == 0) { + numbers.add('无'); + } else { + nameList.add(full!.displayName); + numbers.add(full.phones.first.number); + phoneList.add(PhoneNumModel( + num: full.phones.first.number, + state: false, + time: 0, + name: full.displayName)); + } + } + await prefs.setStringList("nameList", nameList ); + prefs.setStringList("number", numbers); + print(phoneList); + massList.add(MassListModel( + state: false, list: phoneList, title: '未分组联系人', time: '')); + + } + + @override + Widget build(BuildContext context) { + return Scaffold( + resizeToAvoidBottomInset: false, + appBar: AppBar( + elevation: 0, + title: Text( + '通讯录', + style: TextStyle( + fontSize: BaseStyle.fontSize34, + color: BaseStyle.color333333, + fontWeight: FontWeight.bold), + ), + titleSpacing: 185.w, + actions: [ + GestureDetector( + onTap: () { + showDialog( + context: context, + builder: (context) { + return CupertinoAlertDialog( + title: Text( + "添加分组", + style: TextStyle( + color: BaseStyle.color333333, fontSize: 34.sp), + ), + content: Column( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + 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( + fontSize: 28.sp, + color: BaseStyle.color999999), + placeholder: "请输入分组名称(10个字以内)", + onChanged: (value) { + phoneName = value; + setState(() {}); + }, + ), + + 82.hb, + // _getUpdate("爸爸", "123123123"), + PloneBottom( + blM: false, + border: true, + color1: const Color(0xFF1890FF), + color2: const Color(0xFF74BCFF), + onTap: () async { + DateTime now = DateTime.now(); + String nowTime = + "${now.year}-${now.month}-${now.day} ${now.hour}:${now.minute}:${now.millisecond}"; + massList.add(MassListModel( + state: false, + list: [], + title: phoneName, + time: nowTime)); + // await + Navigator.pop(context); + _easyRefreshController.callRefresh(); + }, + text: "保存", + ) + ], + ), + ], + ), + ); + }); + }, + child: Padding( + padding: EdgeInsets.only(top: 40.w, right: 32.w), + child: SizedBox( + height: 28.w, + width: 120.w, + child: Text( + "添加分组", + style: TextStyle( + color: BaseStyle.color333333, fontSize: 28.sp), + ), + ))) + ], + leading: const CloudBackButton(isSpecial: true), + backgroundColor: kForeGroundColor), + backgroundColor: Colors.white, + body: EasyRefresh( + firstRefresh: true, + header: MaterialHeader(), + controller: _easyRefreshController, + onRefresh: () async { + setState(() {}); + }, + child: ListView.builder( + itemBuilder: (context, index) { + return _getBox(massList[index], index, massList[index].list.length); + }, + itemCount: massList.length, + ), + ), + ); + } + + _getBox(MassListModel item, int index, int num) { + return GestureDetector( + child: CheckboxListTile( + onChanged: (bool? value) { + setState(() { + item.state = value!; + if (item.state) { + // phoneNum3.add({"phone":num,"remark":name}); + // phoneNum3.add((phone: num, remark: name)); + + } else { + // phoneNum3.remove({"phone":num,"remark":name}); + // phoneNum3.remove(ExcludePnModel(phone: num, remark: name)) ; + } + }); + }, + value: item.state, + title: Text( + "${item.title}($num)", + style: TextStyle(fontSize: 32.w, fontWeight: FontWeight.bold), + ), + subtitle: Row( + children: [ + Text( + index == 0 ? "本机通讯录" : item.time, + style: TextStyle(fontSize: 28.sp, color: BaseStyle.color999999), + ), + // 30.wb, + // Text( + // item.name == null ? "" : item.name!, + // style: TextStyle(fontSize: 28.sp, color: BaseStyle.color999999), + // ) + ], + ), + ), + ); + } +} diff --git a/lib/ui/TextMe/text_me_page.dart b/lib/ui/TextMe/text_me_page.dart new file mode 100644 index 0000000..86aac51 --- /dev/null +++ b/lib/ui/TextMe/text_me_page.dart @@ -0,0 +1,256 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_sms/flutter_sms.dart'; + +import 'package:project_telephony/base/base_style.dart'; +import 'package:project_telephony/ui/TextMe/text_template.dart'; +import 'package:project_telephony/ui/widget/plone_bottom.dart'; +import 'package:project_telephony/utils/headers.dart'; +import 'package:project_telephony/utils/toast/cloud_toast.dart'; +import 'package:telephony/telephony.dart'; +import 'package:velocity_x/velocity_x.dart'; + +import '../widget/plone_back_button.dart'; +import 'address_book.dart'; + +class TextMePage extends StatefulWidget { + const TextMePage({Key? key}) : super(key: key); + + @override + _TextMePageState createState() => _TextMePageState(); +} + +class _TextMePageState extends State { + // String contentText = ""; + // String phoneText = ""; + String signatureText = ""; + late TextEditingController _controller; + late TextEditingController _phoneController; + + @override + void initState() { + _controller = TextEditingController(); + _phoneController = TextEditingController(); + _controller.text = ""; + _phoneController.text = ""; + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + resizeToAvoidBottomInset: false, + appBar: AppBar( + elevation: 0, + title: Text( + "群发短信", + style: TextStyle( + fontSize: BaseStyle.fontSize34, + color: BaseStyle.color333333, + fontWeight: FontWeight.bold), + ), + titleSpacing: 200.w, + leading: const CloudBackButton( + isSpecial: true, + isSpecials: false, + ), + backgroundColor: kForeGroundColor), + backgroundColor: Colors.white, + body: ListView( + children: [ + _getBox('短信内容', "选择短信模版", () { + Get.to(() => TextTemplate( + callback: (String content) { + _controller.text = content; + }, + )); + }, "请输入短信内容...", _controller), + 32.hb, + _getBox('收信号码', "通讯录中选择", () { + Get.to(() => const AddressBook()); + }, "请输入收信号码,多个号码请用逗号隔开
例如:136xxxx6666,132xxxx8888", _phoneController), + 32.hb, + _getBox2(), + 64.hb, + PloneBottom( + onTap: () async { + final Telephony telephony = Telephony.instance; + if (_controller.text.isEmpty && + _phoneController.text.isEmpty && + signatureText.isEmpty) { + CloudToast.show("内容不可为空"); + } else { + print(_controller.text); + print(_phoneController.text); + print(signatureText); + // await sendSMS( + // message: _controller.text, + // recipients: [ + // "13395740386", + // "13486828191", + // "18815060992", + // "18294841148" + // ], + // sendDirect: true); + + await telephony.sendSms( + to: "13486828191,13395740386;18815060992;18294841148", + message: "【$signatureText】${_controller.text}" + ); + CloudToast.show("发送成功"); + // Telephony.sendSms(to: phoneNum!, message: idle); + } + }, + border: _controller.text.isEmpty || + _phoneController.text.isEmpty || + signatureText.isEmpty, + opacity: _controller.text.isEmpty || + _phoneController.text.isEmpty || + signatureText.isEmpty + ? 0.4 + : 1, + text: "发送", + ) + ], + ), + ); + } + + _getBox(String title, String onTapText, VoidCallback onTap, String hitText, + TextEditingController controller) { + return Column( + children: [ + GestureDetector( + onTap: onTap, + child: Container( + height: 100.w, + margin: EdgeInsets.symmetric(horizontal: 64.w), + child: Row( + children: [ + Text( + title, + style: TextStyle( + fontSize: 28.sp, + color: BaseStyle.color999999, + fontWeight: FontWeight.bold), + ), + 290.wb, + Text( + onTapText, + style: TextStyle( + fontSize: 28.sp, color: const Color(0xFF1890FF)), + ), + const Icon( + Icons.keyboard_arrow_right, + color: Color(0xFF1890FF), + ), + ], + ), + ), + ), + 16.hb, + Container( + height: 240.w, + decoration: BoxDecoration( + color: const Color(0xFFF9F9F9), + borderRadius: BorderRadius.circular(8.w), + ), + padding: EdgeInsets.all(30.w), + margin: EdgeInsets.symmetric( + horizontal: 64.w, + ), + child: TextField( + // focusNode: verifyNode, + maxLines: 100, + keyboardType: TextInputType.text, + onChanged: (text) { + if (title == "短信内容") { + _controller.text = text; + } else { + _phoneController.text = text; + } + setState(() {}); + }, + onEditingComplete: () { + setState(() {}); + // _refreshController.callRefresh(); + }, + style: TextStyle( + color: BaseStyle.color333333, + fontSize: BaseStyle.fontSize28, + ), + controller: controller, + decoration: InputDecoration( + contentPadding: EdgeInsets.zero, + filled: true, + isDense: true, + fillColor: Colors.transparent, + hintText: hitText, + hintStyle: TextStyle( + color: BaseStyle.color999999, + fontSize: 28.sp, + ), + border: InputBorder.none, + ), + ), + ), + ], + ); + } + + _getBox2() { + return Container( + margin: EdgeInsets.symmetric(horizontal: 64.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "短信签名", + style: TextStyle( + fontSize: 28.sp, + color: const Color(0xFF999999), + fontWeight: FontWeight.w600, + ), + ), + 15.heightBox, + TextField( + // controller: controller, + onChanged: (value) { + signatureText = value; + setState(() {}); + }, + decoration: InputDecoration( + contentPadding: EdgeInsets.all(30.w), + hintText: "请输入短信签名", + hintStyle: TextStyle( + fontSize: 28.sp, + // fontWeight: FontWeight.w600, + color: const 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 + ), + ), + ), + ), + ], + ), + ); + } +} diff --git a/lib/ui/TextMe/text_template.dart b/lib/ui/TextMe/text_template.dart new file mode 100644 index 0000000..c50c19d --- /dev/null +++ b/lib/ui/TextMe/text_template.dart @@ -0,0 +1,193 @@ +import 'package:bot_toast/bot_toast.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_easyrefresh/easy_refresh.dart'; +import 'package:project_telephony/utils/headers.dart'; +import 'package:project_telephony/utils/user_tool.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + + +import '../../base/base_style.dart'; +import '../home/add_sms_page.dart'; + +import '../widget/plone_back_button.dart'; + +typedef TextCallback = Function(String content); +class TextTemplate extends StatefulWidget { + final TextCallback callback; + const TextTemplate({Key? key,required this.callback}) : super(key: key); + + @override + _TextTemplateState createState() => _TextTemplateState(); +} + +class _TextTemplateState extends State { + EasyRefreshController refreshController = EasyRefreshController(); + + List textList = []; + + void initState() { + addText(); + super.initState(); + } + + addText() async { + final prefs = await SharedPreferences.getInstance(); + if (textList.length == 1) { + prefs.setStringList("dxText", [ + "祝你万事顺心", + "欢迎你的来电,祝你生活愉快", + "感谢您的来电,我们会尽快处理", + ]); + } + } + + @override + void dispose() { + // TODO: implement dispose + refreshController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + resizeToAvoidBottomInset: false, + 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: Colors.white, + body: EasyRefresh( + firstRefresh: true, + controller: refreshController, + header: MaterialHeader(), + footer: MaterialFooter(), + onRefresh: () async { + final prefs = await SharedPreferences.getInstance(); + textList = prefs.getStringList("dxText")!; + textList.add("自定义短信模版"); + setState(() {}); + }, + child: ListView( + children: [ + SizedBox( + height: 1000.w, + child: ListView.builder( + itemBuilder: (context, index) { + return _getListContent(textList[index], index); + }, + itemCount: textList.length, + )) + ], + ), + ), + ); + } + + _getListContent(String item, int index) { + return GestureDetector( + onTap: () async { + final prefs = await SharedPreferences.getInstance(); + if (item != "自定义短信模版") { + // BotToast.showText(text: item); + widget.callback(item); + Get.back(); + } else { + if (UserTool.userProvider.userInfo.isVip == 1) { + if (textList.length > 5) { + BotToast.showText(text: '自定义数量已达上限,请先删除不需要的短信'); + } else { + Navigator.of(context) + .push( + MaterialPageRoute( + builder: (_) => AddSmsPage(status: 0, ploneBack: (String textContent) { },qfBool: true,)), + ) + .then((val) =>refreshController.callRefresh()); + // textList.add("value"); + // await prefs.setStringList("dxTExt", textList); + } + } else { + BotToast.showText(text: '请先开通会员'); + } + } + setState(() {}); + }, + onLongPress: () { + if (item != "自定义短信模版") { + if (textList.length == 3) { + BotToast.showText(text: '内容不可删除'); + } else { + showDialog( + context: context, + builder: (context) { + return CupertinoAlertDialog( + title: const Text("删除短信模板"), + content: Column( + children: [ + SizedBox( + height: 10.w, + ), + const Align( + child: Text("你确定要删除这个短信模版吗,删除之后无法还原。"), + ) + ], + ), + actions: [ + CupertinoDialogAction( + textStyle: const TextStyle(color: Color(0xFF999999)), + onPressed: () { + Navigator.pop(context); + }, + child: const Text("取消"), + ), + CupertinoDialogAction( + child: const Text("确定"), + onPressed: () async { + final prefs = await SharedPreferences.getInstance(); + textList.remove(item[index]); + await prefs.setStringList("dxIndex", textList); + refreshController.callRefresh(); + }, + ), + ], + ); + }); + } + } + setState(() {}); + }, + child: Container( + // width: 686.w, + height: 128.w, + margin: EdgeInsets.only(top: 32.w, left: 64.w, right: 64.w), + padding: EdgeInsets.only(left: 40.w, top: 45.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(16.w), + gradient: const LinearGradient( + begin: Alignment.centerLeft, + end: Alignment.centerRight, + colors: [ + Color(0xFFF9F9F9), + Color(0xFFF9F9F9), + ]), + ), + child: Text( + item, + style: TextStyle( + fontSize: BaseStyle.fontSize28, + color: BaseStyle.color333333, + fontWeight: FontWeight.bold), + ), + ), + ); + } +} diff --git a/lib/ui/home/add_sms_page.dart b/lib/ui/home/add_sms_page.dart index 2e57651..c151dca 100644 --- a/lib/ui/home/add_sms_page.dart +++ b/lib/ui/home/add_sms_page.dart @@ -3,6 +3,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:provider/provider.dart'; +import 'package:shared_preferences/shared_preferences.dart'; import '../../base/base_style.dart'; import '../../constants/api.dart'; @@ -18,7 +19,8 @@ import '../widget/plone_bottom.dart'; class AddSmsPage extends StatefulWidget { final int status; final TextCallback ploneBack; - const AddSmsPage({Key? key, required this.status, required this.ploneBack}) : super(key: key); + final bool qfBool; + const AddSmsPage({Key? key, required this.status, required this.ploneBack,this.qfBool=false}) : super(key: key); @override _AddSmsPageState createState() => _AddSmsPageState(); @@ -94,6 +96,14 @@ class _AddSmsPageState extends State { border: _controller.text.isEmpty, opacity: contant.isEmpty ? 0.4 : 1, onTap: () async { + + final prefs = await SharedPreferences.getInstance(); + List? contentList=prefs.getStringList("dxText"); + if(widget.qfBool){ + contentList?.add(contant); + await prefs.setStringList("dxText", contentList!); + Get.back(); + }else{ BaseModel res = await apiClient.request(API.content.content, data: { 'content': _controller.text, 'status': widget.status, @@ -118,7 +128,7 @@ class _AddSmsPageState extends State { } else { CloudToast.show(res.msg); } - Get.back(); + Get.back();} }, text: "保存", ).paddingOnly(bottom: 30.w), diff --git a/lib/ui/tab_navigator.dart b/lib/ui/tab_navigator.dart index edfd04c..0bf8f17 100644 --- a/lib/ui/tab_navigator.dart +++ b/lib/ui/tab_navigator.dart @@ -6,6 +6,7 @@ import 'package:project_telephony/utils/headers.dart'; import '../utils/hive_store.dart'; +import 'TextMe/text_me_page.dart'; import 'home/home_page.dart'; class TabNavigator extends StatefulWidget { @@ -33,7 +34,7 @@ class _TabNavigatorState extends State //Hive.initFlutter; await HiveStore.init(); }); - _pages = [const HomePage(), const UserPage()]; + _pages = [const HomePage(), const TextMePage(),const UserPage()]; _tabController = TabController( length: _pages.length, vsync: this, initialIndex: widget.index ?? 0); } @@ -61,6 +62,8 @@ class _TabNavigatorState extends State List _bottomNav = [ _buildBottomBar("首页", Assets.icons.homeNoSelected.path, Assets.icons.homeSelected.path), + _buildBottomBar("群发", Assets.icons.nomass.path, + Assets.icons.mass.path), _buildBottomBar( "我的", Assets.icons.myNoselected.path, Assets.icons.mySelected.path) ]; diff --git a/lib/ui/user/content_details_page.dart b/lib/ui/user/content_details_page.dart index 4138539..03895d5 100644 --- a/lib/ui/user/content_details_page.dart +++ b/lib/ui/user/content_details_page.dart @@ -67,7 +67,10 @@ final FocusNode verifyNode=FocusNode(); ), padding: EdgeInsets.all(30.w), margin: EdgeInsets.symmetric(horizontal: 40.w, vertical: 50.w), - child: TextField( + child: + + + TextField( focusNode: verifyNode, maxLines: 100, keyboardType: TextInputType.text, diff --git a/lib/ui/user/user_page.dart b/lib/ui/user/user_page.dart index 93b99c5..ad9c810 100644 --- a/lib/ui/user/user_page.dart +++ b/lib/ui/user/user_page.dart @@ -134,7 +134,6 @@ class _UserPageState extends State { } // print(UserTool.userProvider.userInfo.end * 1000); // print(DateTime.now().millisecondsSinceEpoch); - if (UserTool.userProvider.userInfo.isVip != 1) { isVip = false; vle = false; @@ -147,7 +146,6 @@ class _UserPageState extends State { // UserTool.userProvider.userInfo.end * 1000, // format: DateFormats.y_mo_d); } else { - vle = false; Get.to(()=>const LoginPage()); } @@ -294,6 +292,7 @@ class _UserPageState extends State { if (UserTool.userProvider.userInfo.isVip != 1) { isVip = false; vle = false; + // _easyRefreshController.callRefresh(); } else { isVip = true; vle = await service.isRunning(); @@ -303,7 +302,6 @@ class _UserPageState extends State { // endDate = DateUtil.formatDateMs( // UserTool.userProvider.userInfo.end * 1000, // format: DateFormats.y_mo_d); - } else { vle = false; } diff --git a/lib/ui/widget/plone_back_button.dart b/lib/ui/widget/plone_back_button.dart index fe0e40f..637b48b 100644 --- a/lib/ui/widget/plone_back_button.dart +++ b/lib/ui/widget/plone_back_button.dart @@ -5,11 +5,12 @@ import 'package:project_telephony/utils/headers.dart'; class CloudBackButton extends StatelessWidget { final Color color; final bool isSpecial; - +final bool isSpecials; const CloudBackButton({ Key? key, this.color = const Color(0xFF111111), this.isSpecial = false, + this.isSpecials=true, }); @override @@ -21,7 +22,7 @@ class CloudBackButton extends StatelessWidget { onPressed: () { print("返回传值"); Navigator.pop(context,true); - Get.back(); + isSpecials? Get.back():""; }, icon: Icon( diff --git a/lib/ui/widget/update_dialog.dart b/lib/ui/widget/update_dialog.dart new file mode 100644 index 0000000..285bc5d --- /dev/null +++ b/lib/ui/widget/update_dialog.dart @@ -0,0 +1,42 @@ +// import 'package:flutter/material.dart'; +// import 'package:flutter_screenutil/flutter_screenutil.dart'; +// import 'package:project_telephony/utils/headers.dart'; +// +// class UpdateDialog extends Dialog { +// @override +// Widget build(BuildContext context) { +// final String upDateContent; +// final bool isForce; +// return Center( +// child: Column( +// mainAxisAlignment: MainAxisAlignment.center, +// children: [ +// SizedBox( +// width: 640.w, +// height: 740.w, +// child: Stack( +// children: [ +// Image.asset( +// Assets.images.cardbg.path, +// fit: BoxFit.cover, +// ), +// Container( +// child: Column( +// children: [ +// Container( +// child: Text( +// "发现新版本", +// style: TextStyle(fontSize: 32.w,color: Colors.), +// ), +// ) +// ], +// ), +// ) +// ], +// ), +// ) +// ], +// ), +// ); +// } +// } diff --git a/lib/utils/hive_store.dart b/lib/utils/hive_store.dart index d1afcd3..8855591 100644 --- a/lib/utils/hive_store.dart +++ b/lib/utils/hive_store.dart @@ -17,6 +17,7 @@ class HiveStore { if (!kIsWeb) { var dir = await getApplicationDocumentsDirectory(); Hive.init(dir.path); + // Hive.registerAdapter(()); //HiveTypeId:0 _appBox = await Hive.openBox('app'); _userBox = await Hive.openBox('userBox'); _dataBox = await Hive.openBox('dataBox'); diff --git a/pubspec.lock b/pubspec.lock index bd4ed2e..9d94742 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -423,6 +423,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "5.5.3+2" + flutter_sms: + dependency: "direct main" + description: + name: flutter_sms + url: "https://pub.dartlang.org" + source: hosted + version: "2.3.3" flutter_test: dependency: "direct dev" description: flutter diff --git a/pubspec.yaml b/pubspec.yaml index 96aeeee..7444237 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -97,6 +97,8 @@ dependencies: flutter_contacts: ^1.1.5 #工具类 common_utils: ^2.1.0 +# 群发号码 + flutter_sms: ^2.3.3 # # jdk # jverify: ^2.2.5 ## pub 集成