戴余标 2 years ago
commit 5e53e777f5

Binary file not shown.

File diff suppressed because one or more lines are too long

@ -1,4 +1,5 @@
import 'dart:async'; import 'dart:async';
import 'package:bot_toast/bot_toast.dart';
import 'package:call_log/call_log.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';
@ -27,7 +28,7 @@ void main() async {
Future<void> initializeService() async { Future<void> initializeService() async {
final service = FlutterBackgroundService(); final service = FlutterBackgroundService();
service.setNotificationInfo(title: '短信助手',content: '正在后台运行'); service.setNotificationInfo(title: '短信助手', content: '正在后台运行');
await service.configure( await service.configure(
androidConfiguration: AndroidConfiguration( androidConfiguration: AndroidConfiguration(
onStart: onStart, onStart: onStart,
@ -62,7 +63,11 @@ void onStart() {
final Iterable<CallLogEntry> result = await CallLog.query(); final Iterable<CallLogEntry> result = await CallLog.query();
phoneNum = result.first.number; phoneNum = result.first.number;
print(phoneNum); print(phoneNum);
Phone.telephony.sendSms(to: phoneNum!, message: "hello",isMultipart:true,); Phone.telephony.sendSms(
to: phoneNum!,
message: "hello",
isMultipart: true,
);
phoneNum = result.first.number; phoneNum = result.first.number;
// print(phoneNum); // print(phoneNum);
Phone.telephony.sendSms( Phone.telephony.sendSms(
@ -79,7 +84,7 @@ void onStart() {
}); });
} }
class Phone{ class Phone {
static Telephony telephony = Telephony.instance; static Telephony telephony = Telephony.instance;
} }
@ -109,15 +114,14 @@ class _MyAppState extends State<MyApp> {
Permission.sms, Permission.sms,
Permission.phone, Permission.phone,
]; ];
PermissionHelper.check(permissions, PermissionHelper.check(permissions, onSuccess: () {
onSuccess: () { print('onSuccess');
print('onSuccess'); }, onFailed: () {
}, onFailed: () { print('onFailed');
print('onFailed'); }, onOpenSetting: () {
}, onOpenSetting: () { print('onOpenSetting');
print('onOpenSetting'); openAppSettings();
openAppSettings(); });
});
} }
onMessage(SmsMessage message) async { onMessage(SmsMessage message) async {
@ -148,27 +152,27 @@ class _MyAppState extends State<MyApp> {
child: ScreenUtilInit( child: ScreenUtilInit(
designSize: const Size(750, 1334), designSize: const Size(750, 1334),
builder: (context, child) { builder: (context, child) {
return const AnnotatedRegion<SystemUiOverlayStyle>( return AnnotatedRegion<SystemUiOverlayStyle>(
value: SystemUiOverlayStyle( value: const SystemUiOverlayStyle(
statusBarColor: Colors.transparent, // statusBarColor: Colors.transparent, //
statusBarIconBrightness: Brightness.dark), statusBarIconBrightness: Brightness.dark),
child: GetMaterialApp( child: GetMaterialApp(
// get.testmode=true, // get.testmode=true,
debugShowCheckedModeBanner: false, debugShowCheckedModeBanner: false,
home: TabNavigator(), home: const TabNavigator(),
// supportedLocales: [Locale('zh')], builder: (context, child) {
// locale: Locale('zh'), // ScreenUtil.setContext(context);
// builder: ( context,child){ return MediaQuery(
// ScreenUtil.setContext(context); //
// return MediaQuery( data: MediaQueryData.fromWindow(
// // WidgetsBinding.instance!.window)
// data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0), .copyWith(textScaleFactor: 1.0),
// // child: BotToastInit().call(context, child), child: BotToastInit().call(context, child),
// ); );
// }, },
navigatorObservers: [BotToastNavigatorObserver()],
)); ));
}, },
)); ));
} }
} }

@ -52,14 +52,7 @@ class _ContentPageState extends State<ContentPage> {
return GestureDetector( return GestureDetector(
onTap: () async { onTap: () async {
_select = index; _select = index;
if (index != textList.length - 1) { if (index == textList.length - 1) {
await Get.to(() => ContentDetailsPage(
content: content,
ploneBack: (String textContent) {
textList1.add(textContent);
},
));
} else {
await Get.to(() => ContentDetailsPage( await Get.to(() => ContentDetailsPage(
content: "", content: "",
ploneBack: (String textContent) { ploneBack: (String textContent) {
@ -67,22 +60,24 @@ class _ContentPageState extends State<ContentPage> {
textList.setAll(index, {textContent}); textList.setAll(index, {textContent});
}, },
)); ));
setState(() {}); } else {}
} setState(() {});
// print("这是数据" + textList[_s lect]); // print("这是数据" + textList[_s lect]);
// print(index); // print(index);
}, },
onLongPress: () { onLongPress: () {
setState(() {}); setState(() {});
showDialog( if (index == textList.length - 1) {
context: context, showDialog(
builder: (context) { context: context,
return const Centertipsalterwidget( builder: (context) {
desText: '你确定要删除这个短信模版吗,删除之后无法还原。', return const Centertipsalterwidget(
title: '删除短信模板', desText: '你确定要删除这个短信模版吗,删除之后无法还原。',
); title: '删除短信模板',
}); );
});
}
}, },
child: Container( child: Container(
// width: 686.w, // width: 686.w,
@ -94,7 +89,7 @@ class _ContentPageState extends State<ContentPage> {
color: pd color: pd
? widget.isAnswer! ? widget.isAnswer!
? Colors.blue ? Colors.blue
: Color(0xFF72E4C8) : const Color(0xFF72E4C8)
: const Color(0xFFF9F9F9), : const Color(0xFFF9F9F9),
), ),
child: Text( child: Text(

@ -1,3 +1,6 @@
import 'dart:async';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
@ -21,24 +24,24 @@ class LoginPage extends StatefulWidget {
class _LoginPageState extends State<LoginPage> { class _LoginPageState extends State<LoginPage> {
// String _operator=""; // String _operator="";
// String _phone=""; // String _phone="";
// bool _chooseAgreement = false; bool _chooseAgreement = false;
// bool _getCodeEnable = true; bool _getCodeEnable = true;
// late Timer _timer; late Timer _timer;
//
// /// ///
// String _countDownStr = "发送验证码"; String _countDownStr = "发送验证码";
//
// /// ///
// int _countDownNum = 59; int _countDownNum = 59;
/// ///
late final TextEditingController _phoneController = // late final TextEditingController _phoneController =
TextEditingController(text: ""); // TextEditingController(text: "");
late final TextEditingController _smsCodeController = // late final TextEditingController _smsCodeController =
TextEditingController(text: ""); // TextEditingController(text: "");
// // late FocusNode _smsCodeFocusNode=FocusNode (canRequestFocus: ); // late FocusNode _smsCodeFocusNode=FocusNode (canRequestFocus: );
// bool _cantSelected = false; bool _cantSelected = false;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
@ -46,7 +49,8 @@ class _LoginPageState extends State<LoginPage> {
// _phone = '12345678909'; // _phone = '12345678909';
} }
String ploneText = ""; String ploneText = ""; //
String codeText = ""; //
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return CloudScaffold( return CloudScaffold(
@ -90,15 +94,27 @@ class _LoginPageState extends State<LoginPage> {
style: TextStyle(fontSize: 32.sp, color: const Color(0xFF999999)), style: TextStyle(fontSize: 32.sp, color: const Color(0xFF999999)),
), ),
80.hb, 80.hb,
_getBox('+86', 36, "请输入手机号", 11), _getBox('+86', 36, _phoneTFWidget()),
_getBox('验证码', 32, "请输入验证码", 6), _getBox('验证码', 32, _codeWidget()),
112.hb, 112.hb,
PloneBottom( PloneBottom(
blM: false, blM: false,
border: ploneText.length != 11, border: ploneText.length != 11,
opacity: ploneText.length == 11 ? 1 : 0.4, opacity: ploneText.length == 11 ? 1 : 0.4,
onTap: () { onTap: () {
Get.to(() => const TabNavigator()); if (ploneText.length < 11) {
BotToast.showText(text: "请输入手机号");
} else {
if (codeText.length < 6) {
BotToast.showText(text: "请输入验证码");
} else {
if (_chooseAgreement) {
Get.to(() => const TabNavigator());
} else {
BotToast.showText(text: "请同意并勾选隐私政策");
}
}
}
}, },
text: "立即登录", text: "立即登录",
), ),
@ -110,7 +126,7 @@ class _LoginPageState extends State<LoginPage> {
); );
} }
_getBox(String text, int fontSize, String hit, int num) { _getBox(String text, int fontSize, Widget plone) {
return Container( return Container(
height: 144.w, height: 144.w,
width: double.infinity, width: double.infinity,
@ -138,20 +154,20 @@ class _LoginPageState extends State<LoginPage> {
margin: EdgeInsets.symmetric(horizontal: 32.w), margin: EdgeInsets.symmetric(horizontal: 32.w),
color: const Color(0xFFE8E8E8), color: const Color(0xFFE8E8E8),
), ),
_phoneTFWidget(hit, num), plone,
]), ]),
); );
} }
//
_phoneTFWidget(String hit, int num) { //
_phoneTFWidget() {
return SizedBox( return SizedBox(
// alignment: Alignment.centerLeft, // alignment: Alignment.centerLeft,
// padding: EdgeInsets.symmetric(horizontal: 72.w), // padding: EdgeInsets.symmetric(horizontal: 72.w),
width: 300.w, width: 430.w,
height: 50.w, height: 50.w,
child: TextField( child: TextField(
maxLength: num, maxLength: 11,
inputFormatters: [FilteringTextInputFormatter.allow(RegExp(r'[0-9]'))], inputFormatters: [FilteringTextInputFormatter.allow(RegExp(r'[0-9]'))],
textCapitalization: TextCapitalization.none, textCapitalization: TextCapitalization.none,
onChanged: (text) { onChanged: (text) {
@ -159,14 +175,40 @@ class _LoginPageState extends State<LoginPage> {
setState(() {}); setState(() {});
}, },
decoration: InputDecoration( decoration: InputDecoration(
contentPadding: EdgeInsets.only(bottom: 20.w), contentPadding: EdgeInsets.only(bottom: 20.w),
border: InputBorder.none, border: InputBorder.none,
counterText: "", counterText: "",
//textfieldiOSplaceholder //textfieldiOSplaceholder
hintText: hit, hintText: "请输入手机号",
// //
hintStyle: TextStyle(color: Colors.black12), hintStyle: const TextStyle(color: Colors.black12),
), suffixIcon: GestureDetector(
onTap: !_getCodeEnable
? () {}
: () async {
// await apiClient.request(API.login.phoneCode, data: {
// 'phone': UserTool.userProvider.userInfo.phone,
// });
_beginCountDown();
if (_cantSelected) return;
_cantSelected = true;
Future.delayed(const Duration(seconds: 1), () {
_cantSelected = false;
});
},
child: Container(
width: 180.w,
alignment: Alignment.centerRight,
color: Colors.transparent,
child: Text(
_countDownStr,
style: TextStyle(
color: _getCodeEnable
? kPrimaryColor
: BaseStyle.colorcccccc),
),
),
)),
), ),
); );
} }
@ -174,70 +216,53 @@ class _LoginPageState extends State<LoginPage> {
// //
_codeWidget() { _codeWidget() {
return SizedBox( return SizedBox(
width: 300.w, // alignment: Alignment.centerLeft,
// padding: EdgeInsets.symmetric(horizontal: 72.w),
width: 430.w,
height: 50.w, height: 50.w,
child: TextField( child: TextField(
onChanged: (String phone) { maxLength: 6,
setState(() {}); inputFormatters: [FilteringTextInputFormatter.allow(RegExp(r'[0-9]'))],
}, textCapitalization: TextCapitalization.none,
controller: _smsCodeController, onChanged: (text) {
// focusNode: _smsCodeFocusNode, codeText = text;
keyboardType: TextInputType.number, setState(() {});
style: TextStyle(fontSize: 36.sp, color: BaseStyle.color999999), },
inputFormatters: [ decoration: InputDecoration(
LengthLimitingTextInputFormatter(4), contentPadding: EdgeInsets.only(bottom: 20.w),
], border: InputBorder.none,
cursorColor: Colors.black, counterText: "",
decoration: InputDecoration( //textfieldiOSplaceholder
// prefixIcon: Container( hintText: "请输入验证码",
// width: 10.w, //
// alignment: Alignment.centerLeft, hintStyle: TextStyle(color: Colors.black12),
// child: Text( ),
// "验证码", ),
// style: TextStyle(
// fontSize: 32.sp,
// color: const Color(0xFF000000)),
// ),
// ),
prefixText: "验证码",
prefixStyle: const TextStyle(
color: Colors.black,
),
enabledBorder: const UnderlineInputBorder(
//
borderSide: BorderSide(
color: BaseStyle.color999999,
),
),
hintText: "请输入验证码",
hintStyle: TextStyle(color: BaseStyle.colorcccccc, fontSize: 36.sp),
)),
); );
} }
// // _beginCountDown() {
// _beginCountDown() { ///
// /// setState(() {
// setState(() { _getCodeEnable = false;
// _getCodeEnable = false; _countDownStr = "${_countDownNum}s";
// _countDownStr = "重新获取($_countDownNum)"; });
// }); _timer = Timer.periodic(const Duration(seconds: 1), (timer) {
// _timer = Timer.periodic(const Duration(seconds: 1), (timer) { if (!mounted) {
// if (!mounted) { return;
// return; }
// } setState(() {
// setState(() { if (_countDownNum == 0) {
// if (_countDownNum == 0) { _countDownNum = 59;
// _countDownNum = 59; _countDownStr = "获取验证码";
// _countDownStr = "获取验证码"; _getCodeEnable = true;
// _getCodeEnable = true; _timer.cancel();
// _timer.cancel(); return;
// return; }
// } _countDownStr = "${_countDownNum--}s";
// _countDownStr = "重新获取(${_countDownNum--})"; });
// }); });
// }); }
// }
// //
_recognizer(context, int type) { _recognizer(context, int type) {
@ -255,7 +280,7 @@ class _LoginPageState extends State<LoginPage> {
_getText() { _getText() {
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
// _chooseAgreement = !_chooseAgreement; _chooseAgreement = !_chooseAgreement;
setState(() {}); setState(() {});
}, },
child: Row( child: Row(
@ -263,16 +288,15 @@ class _LoginPageState extends State<LoginPage> {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Container( Container(
width: 50.w, width: 50.w,
height: 50.w, height: 50.w,
padding: EdgeInsets.only(top: 6.w, right: 5.w), padding: EdgeInsets.only(top: 6.w, right: 5.w),
child: const Icon(CupertinoIcons.circle, child: !_chooseAgreement
size: 18, color: Color(0xFFdddddd))), ? const Icon(CupertinoIcons.circle,
// !_chooseAgreement size: 18, color: Color(0xFFdddddd))
// ? const Icon(CupertinoIcons.circle, : const Icon(CupertinoIcons.checkmark_circle,
// size: 18, color: Color(0xFFdddddd)) size: 18, color: Colors.blue),
// : const Icon(CupertinoIcons.checkmark_circle, ),
// size: 18, color: Colors.red)),
RichText( RichText(
text: TextSpan( text: TextSpan(
text: "我已阅读并同意", text: "我已阅读并同意",

@ -1,3 +1,4 @@
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/widget/check_radio.dart'; import 'package:project_telephony/ui/widget/check_radio.dart';
@ -33,6 +34,7 @@ List payWay = [
}, },
{'payName': '支付宝支付', 'payUrl': Assets.icons.zhifubao.path} {'payName': '支付宝支付', 'payUrl': Assets.icons.zhifubao.path}
]; ];
Map a = {};
class _MembersPageState extends State<MembersPage> { class _MembersPageState extends State<MembersPage> {
@override @override
@ -66,7 +68,9 @@ class _MembersPageState extends State<MembersPage> {
_getSpay(payWay), _getSpay(payWay),
PloneBottom( PloneBottom(
border: true, border: true,
onTap: () {}, onTap: () async {
if (_selectIndex == 0) {}
},
textColor: const Color(0xFF333333), textColor: const Color(0xFF333333),
text: "立即开通", text: "立即开通",
color1: const Color(0xFFFFF6D8), color1: const Color(0xFFFFF6D8),
@ -107,7 +111,7 @@ class _MembersPageState extends State<MembersPage> {
)), )),
Positioned( Positioned(
child: Container( child: Container(
margin: EdgeInsets.symmetric(horizontal: 64.w, vertical: 16.w), margin: EdgeInsets.symmetric(horizontal: 64.w, vertical: 50.w),
child: _getText())) child: _getText()))
]), ]),
); );
@ -129,9 +133,9 @@ class _MembersPageState extends State<MembersPage> {
), ),
16.hb, 16.hb,
Text( Text(
"解锁全部功能", "暂未开通会员",
style: TextStyle(color: Colors.white, fontSize: BaseStyle.fontSize24), style: TextStyle(color: Colors.white, fontSize: BaseStyle.fontSize24),
) ),
], ],
); );
} }
@ -139,13 +143,18 @@ class _MembersPageState extends State<MembersPage> {
_getVip() { _getVip() {
return Row( return Row(
children: [ children: [
const Text( Text(
"vip", "VIP",
style: TextStyle(color: Color(0xFFFFEAB0)), style: TextStyle(
color: const Color(0xFFFFEAB0),
fontFamily: "BlackItalic",
fontSize: 32.sp),
), ),
Container( Container(
width: 8.w, width: 8.w,
height: 8.w, height: 8.w,
alignment: Alignment.center,
margin: EdgeInsets.symmetric(horizontal: 8.w),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4), borderRadius: BorderRadius.circular(4),
color: const Color(0xFFFFEAB0), color: const Color(0xFFFFEAB0),
@ -153,12 +162,48 @@ class _MembersPageState extends State<MembersPage> {
), ),
const Text( const Text(
"未开通会员", "未开通会员",
style: TextStyle(color: Color(0xFFFFEAB0)), style: TextStyle(
color: Color(
0xFFFFEAB0,
),
fontWeight: FontWeight.w700),
) )
], ],
); );
} }
// Future _wxPayFunc() async {
// var base = await apiClient.request(API.user.wallet.assessRecharge, data: {
// 'count': widget.count,
// 'payType': 2,
// });
// if (base.code == 0) {
// var wxPayModel = WxPayModel.fromJson(base.data['content']);
// await PayUtil().callWxPay(
// payModel: wxPayModel,
// );
// } else {
// BotToast.showText(text: "${base.msg}");
// }
// }
// Future _aliPayFunc() async {
// var base = await apiClient.request(API.user.wallet.assessRecharge, data: {
// 'count': widget.count,
// 'payType': 1,
// });
// if (base.code == 0) {
// var re = await PayUtil().callAliPay(base.data['content']);
// if (re) {
// _paySuccess();
// } else {
// BotToast.closeAllLoading();
// }
// } else {
// CloudToast.show(base.msg);
// }
// }
// //
_getRecharge() { _getRecharge() {
return Container( return Container(
@ -223,6 +268,7 @@ class _MembersPageState extends State<MembersPage> {
child: Text( child: Text(
item[index]['payName'], item[index]['payName'],
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.w700,
color: BaseStyle.color333333, color: BaseStyle.color333333,
fontSize: BaseStyle.fontSize28), fontSize: BaseStyle.fontSize28),
), ),

@ -1,7 +1,9 @@
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/main.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/utils/headers.dart'; import 'package:project_telephony/utils/headers.dart';
import 'package:telephony/telephony.dart';
class PrivacyRightsPage extends StatefulWidget { class PrivacyRightsPage extends StatefulWidget {
final String name; final String name;
@ -11,6 +13,14 @@ class PrivacyRightsPage extends StatefulWidget {
_PrivacyRightsPageState createState() => _PrivacyRightsPageState(); _PrivacyRightsPageState createState() => _PrivacyRightsPageState();
} }
final Telephony telephony = Telephony.instance;
// late final bool permissionsGranted;
// String body = "";
// @override
// void initState() async {
// initPlatformState();
// }
class _PrivacyRightsPageState extends State<PrivacyRightsPage> { class _PrivacyRightsPageState extends State<PrivacyRightsPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -32,6 +42,30 @@ class _PrivacyRightsPageState extends State<PrivacyRightsPage> {
); );
} }
// onMessage(SmsMessage message) async {
// setState(() {
// body = message.body ?? "error reading message body.";
// print(body);
// });
// }
//
// onSendStatus(SendStatus status) {
// setState(() {
// body = status == SendStatus.SENT ? "sent" : "delivered";
// });
// }
//
// Future<void> initPlatformState() async {
// final bool? result = await telephony.requestPhoneAndSmsPermissions;
// if (result != null && result) {
// telephony.listenIncomingSms(
// onNewMessage: onMessage,
// onBackgroundMessage: onBackgroundMessage,
// listenInBackground: true);
// }
// if (!mounted) return;
// }
_getRights(bool pd) { _getRights(bool pd) {
return GestureDetector( return GestureDetector(
onTap: () {}, onTap: () {},
@ -53,7 +87,7 @@ class _PrivacyRightsPageState extends State<PrivacyRightsPage> {
fontWeight: FontWeight.bold), fontWeight: FontWeight.bold),
), ),
16.hb, 16.hb,
Text('用于获取设备', Text('用于获取设备1',
style: TextStyle( style: TextStyle(
fontSize: 28.sp, color: BaseStyle.color999999)), fontSize: 28.sp, color: BaseStyle.color999999)),
], ],

@ -1,3 +1,4 @@
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/permission_handler.dart';
@ -8,7 +9,10 @@ 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/utils/headers.dart'; import 'package:project_telephony/utils/headers.dart';
import 'package:project_telephony/utils/permissionutils.dart';
import 'package:telephony/telephony.dart';
import '../../permission.dart'; import '../../permission.dart';
@ -19,12 +23,14 @@ class UserPage extends StatefulWidget {
_UserPageState createState() => _UserPageState(); _UserPageState createState() => _UserPageState();
} }
final Telephony telephony = Telephony.instance;
@override @override
void initState() {} void initState() {}
class _UserPageState extends State<UserPage> { class _UserPageState extends State<UserPage> {
bool bl = true;
bool vle = false; bool vle = false;
bool tooken = true;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return CloudScaffold( return CloudScaffold(
@ -62,19 +68,19 @@ class _UserPageState extends State<UserPage> {
// //
_getUser() { _getUser() {
return GestureDetector( return Container(
onTap: () { margin: EdgeInsets.only(left: 64.w, right: 64.w, top: 216.w),
Get.to(() => const LoginPage()); child: Row(
}, children: [
child: Container( GestureDetector(
margin: EdgeInsets.only(left: 64.w, right: 64.w, top: 216.w), onTap: () {
child: Row( Get.to(() => const LoginPage());
children: [ },
Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
bl ? "登录/注册" : "xxxxx", tooken ? "登录/注册" : "xxxxx",
style: TextStyle( style: TextStyle(
fontSize: BaseStyle.fontSize48, fontSize: BaseStyle.fontSize48,
color: BaseStyle.color333333, color: BaseStyle.color333333,
@ -82,26 +88,33 @@ class _UserPageState extends State<UserPage> {
), ),
24.hb, 24.hb,
Text( Text(
bl ? "登录获取更多信息" : "欢迎您登录短信帮手", tooken ? "登录获取更多信息" : "欢迎您登录短信帮手",
style: TextStyle( style: TextStyle(
fontSize: BaseStyle.fontSize28, fontSize: BaseStyle.fontSize28,
color: BaseStyle.color333333), color: BaseStyle.color333333),
) )
], ],
), ),
const Spacer(), ),
Container( const Spacer(),
child: ClipOval( GestureDetector(
child: Image.asset( onTap: () async {
Assets.images.portrait.path, var value = await CloudImagePicker.pickSingleImage(title: '选择图片');
height: 128.w, if (value != null) {
width: 128.w, BotToast.showText(text: '头像成功');
fit: BoxFit.cover, setState(() {});
), }
},
child: ClipOval(
child: Image.asset(
Assets.images.portrait.path,
height: 128.w,
width: 128.w,
fit: BoxFit.cover,
), ),
) ),
], )
), ],
), ),
); );
} }
@ -173,13 +186,18 @@ class _UserPageState extends State<UserPage> {
_getVip() { _getVip() {
return Row( return Row(
children: [ children: [
const Text( Text(
"vip", "VIP",
style: TextStyle(color: Color(0xFFFFEAB0)), style: TextStyle(
color: const Color(0xFFFFEAB0),
fontFamily: "BlackItalic",
fontSize: 32.sp),
), ),
Container( Container(
width: 8.w, width: 8.w,
height: 8.w, height: 8.w,
alignment: Alignment.center,
margin: EdgeInsets.symmetric(horizontal: 8.w),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4), borderRadius: BorderRadius.circular(4),
color: const Color(0xFFFFEAB0), color: const Color(0xFFFFEAB0),
@ -187,7 +205,11 @@ class _UserPageState extends State<UserPage> {
), ),
const Text( const Text(
"未开通会员", "未开通会员",
style: TextStyle(color: Color(0xFFFFEAB0)), style: TextStyle(
color: Color(
0xFFFFEAB0,
),
fontWeight: FontWeight.w700),
) )
], ],
); );
@ -196,7 +218,7 @@ class _UserPageState extends State<UserPage> {
// //
_getSwitch(String url, String name, bool pd) { _getSwitch(String url, String name, bool pd) {
return GestureDetector( return GestureDetector(
onTap: () { onTap: () async {
pd pd
? "" ? ""
: Get.to(() => PrivacyRightsPage( : Get.to(() => PrivacyRightsPage(

@ -0,0 +1,154 @@
import 'dart:io';
import 'package:flutter/cupertino.dart';
import 'package:image_picker/image_picker.dart';
// import 'package:image_picker/image_picker.dart';
import 'package:project_telephony/utils/headers.dart';
import 'package:velocity_x/velocity_x.dart';
// import 'package:velocity_x/velocity_x.dart';
class CloudImagePicker {
static Future<List<File>> pickMultiImage(
{required String title,
double maxWidth = 1000,
double maxHeight = 1000}) async {
List<XFile>? files = [];
files = await ImagePicker().pickMultiImage();
if (files == null) {
return <File>[];
} else {
return files.map((e) => File(e.path)).toList();
}
}
static Future<List<File>> pickMultiAndSingleImage(
{required String title,
double maxWidth = 1000,
double maxHeight = 1000}) async {
List<XFile>? files = [];
// _files = await ImagePicker().pickMultiImage();
files = await Get.bottomSheet(CupertinoActionSheet(
title: title.text.isIntrinsic.make(),
actions: [
CupertinoDialogAction(
onPressed: () async {
await ImagePicker().pickMultiImage().then((value) {
if (value != null) {
Get.back(
result: value,
);
}
});
},
child: Row(
children: [
const Icon(CupertinoIcons.photo),
30.wb,
'相册(长按图片多选)'.text.isIntrinsic.make(),
],
),
),
CupertinoDialogAction(
onPressed: () async {
await ImagePicker()
.pickImage(
source: ImageSource.camera,
maxHeight: maxHeight,
maxWidth: maxWidth,
)
.then((value) {
if (value != null) {
XFile pickFile = value;
List<XFile> files = [];
files.add(pickFile);
Get.back(
result: files,
);
}
});
},
child: Row(
children: [
const Icon(CupertinoIcons.camera),
30.wb,
'相机'.text.isIntrinsic.make(),
],
),
),
],
cancelButton: CupertinoDialogAction(
onPressed: Get.back,
child: '取消'.text.isIntrinsic.make(),
),
));
if (files == null) {
return <File>[];
} else {
return files.map((e) => File(e.path)).toList();
}
}
static Future<File?> pickSingleImage(
{required String title,
double maxWidth = 1000,
double maxHeight = 1000}) async {
XFile? xFile = await Get.bottomSheet(CupertinoActionSheet(
title: title.text.isIntrinsic.make(),
actions: [
CupertinoDialogAction(
onPressed: () async {
await ImagePicker()
.pickImage(
source: ImageSource.gallery,
maxHeight: maxHeight,
maxWidth: maxWidth,
)
.then((value) {
Get.back(
result: value,
);
});
},
child: Row(
children: [
const Icon(CupertinoIcons.photo),
30.wb,
'相册'.text.isIntrinsic.make(),
],
)),
CupertinoDialogAction(
onPressed: () async {
await ImagePicker()
.pickImage(
source: ImageSource.camera,
maxHeight: maxHeight,
maxWidth: maxWidth,
)
.then((value) {
Get.back(
result: value,
);
});
},
child: Row(
children: [
const Icon(CupertinoIcons.camera),
30.wb,
'相机'.text.isIntrinsic.make(),
],
)),
],
cancelButton: CupertinoDialogAction(
onPressed: Get.back,
child: '取消'.text.isIntrinsic.make(),
),
));
if (xFile != null) {
return File(xFile.path);
} else {
return null;
}
}
}

@ -80,10 +80,11 @@ class SortWidget extends StatelessWidget {
: Border.all(color: const Color(0xFFFFDF66), width: 1.w)), : Border.all(color: const Color(0xFFFFDF66), width: 1.w)),
child: Column( child: Column(
children: [ children: [
Padding(padding: EdgeInsets.only(top: 16.w)), Padding(padding: EdgeInsets.only(top: 32.w)),
Text( Text(
"${item.month}个月VIP", "${item.month}个月VIP",
style: TextStyle( style: TextStyle(
fontFamily: "SemiBold",
fontSize: BaseStyle.fontSize28, fontSize: BaseStyle.fontSize28,
color: BaseStyle.color333333, color: BaseStyle.color333333,
fontWeight: FontWeight.bold), fontWeight: FontWeight.bold),
@ -99,18 +100,17 @@ class SortWidget extends StatelessWidget {
TextSpan( TextSpan(
text: "${item.pice}", text: "${item.pice}",
style: TextStyle( style: TextStyle(
fontFamily: "SemiBold",
fontSize: 64.sp, fontSize: 64.sp,
color: pickItem == item color: pickItem == item
? const Color(0xFFFF3F3F) ? const Color(0xFFFF3F3F)
: BaseStyle.color333333)) : BaseStyle.color333333))
])), ])),
Text( Text("${(item.pice / item.month).toStringAsFixed(2)}元/月",
"${(item.pice / item.month).toStringAsFixed(2)}元/月", style: TextStyle(
style: TextStyle(
fontSize: BaseStyle.fontSize24, fontSize: BaseStyle.fontSize24,
color: BaseStyle.color999999, color: BaseStyle.color999999,
fontWeight: FontWeight.bold), )),
),
], ],
)), )),
); );

@ -0,0 +1,166 @@
// import 'dart:async';
// import 'dart:convert';
// import 'package:bot_toast/bot_toast.dart';
// import 'package:cloud_car/model/pay/wx_pay_model.dart';
// import 'package:cloud_car/utils/new_work/api_client.dart';
// import 'package:cloud_car/utils/toast/cloud_toast.dart';
// import 'package:dio/dio.dart';
// import 'package:flutter/foundation.dart';
// import 'package:fluwx/fluwx.dart';
// import 'package:power_logger/power_logger.dart';
// import 'package:tobias/tobias.dart';
// import '../model/pay/pay_model.dart';
// enum PAYTYPE {
// ///
// ali,
// ///
// wx,
// ///
// cash,
// ///pos
// pos
// }
// class PayUtil {
// static final PayUtil _instance = PayUtil._();
// factory PayUtil() => _instance;
// PayUtil._();
// void resultSatus(String status) {
// switch (status) {
// case '8000':
// BotToast.showText(text: '正在处理中');
// break;
// case '4000':
// BotToast.showText(text: '订单支付失败');
// break;
// case '5000':
// BotToast.showText(text: '重复请求');
// break;
// case '6001':
// BotToast.showText(text: ' 用户中途取消');
// break;
// case '6002':
// BotToast.showText(text: '网络连接出错');
// break;
// case '6004':
// BotToast.showText(text: '支付结果未知,请查询商户订单列表中订单的支付状态');
// break;
// default:
// BotToast.showText(text: '其他支付错误');
// break;
// }
// }
// String _resultStatus = '';
// ///
// ///
// Future<bool> callAliPay(String order, {String? apiPath}) async {
// var install = await isAliPayInstalled();
// if (!install) {
// BotToast.showText(text: '未安装支付宝!');
// return false;
// }
// Map<dynamic, dynamic> result = {};
// try {
// result = await aliPay(order);
// } catch (e) {
// if (kDebugMode) {
// print(e.toString());
// }
// }
// _resultStatus = result['resultStatus'];
// if (_resultStatus == '9000') {
// String res = result['result'];
// PayModel model = PayModel.fromJson(jsonDecode(res));
// if (apiPath != null) {
// bool confirmResult = await _confirmPayResult(
// apiPath, model.aliPayTradeAppPayResponse.outTradeNo);
// return confirmResult;
// } else {
// CloudToast.show('支付成功');
// return true;
// }
// } else {
// resultSatus(_resultStatus);
// return false;
// }
// }
// Future<bool> _confirmPayResult(String path, String code) async {
// try {
// int status = 0;
// for (var i = 0; i < 3; i++) {
// await Future.delayed(const Duration(milliseconds: 1000), () async {
// Response response = await apiClient.dio.get(path, queryParameters: {
// "code": code,
// });
// status = response.data['status'] as int;
// });
// if (status == 2) {
// break;
// }
// }
// if (status == 2) {
// BotToast.showText(text: '交易成功');
// return true;
// } else {
// BotToast.showText(text: '交易失败 错误码$status');
// return false;
// }
// } catch (e) {
// BotToast.showText(text: '网络请求错误');
// LoggerData.addData(e);
// return false;
// }
// }
// ///
// StreamSubscription? _wxPayStream;
// void wxPayAddListener(
// {required VoidCallback paySuccess,
// Function(BaseWeChatResponse)? payError}) {
// _wxPayStream = weChatResponseEventHandler.listen((event) {
// if (kDebugMode) {
// print('errorCode:${event.errCode} errorStr:${event.errStr}');
// }
// if (event.errCode == 0) {
// paySuccess();
// } else {
// LoggerData.addData(
// 'errorCode:${event.errCode} errorStr:${event.errStr ?? '支付失败'}');
// CloudToast.show(event.errStr ?? '支付失败');
// if (payError != null) payError(event);
// //payError == null ? null : payError(event);
// }
// });
// }
// void removeWxPayListener() {
// _wxPayStream?.cancel();
// }
// Future callWxPay({
// required WxPayModel payModel,
// }) async {
// await payWithWeChat(
// appId: 'wx9bc3ffb23a749254',
// partnerId: payModel.partnerId,
// prepayId: payModel.prepayId,
// packageValue: payModel.package,
// nonceStr: payModel.nonceStr,
// timeStamp: int.parse(payModel.timeStamp),
// sign: payModel.sign);
// }
// }

@ -0,0 +1,16 @@
import 'package:bot_toast/bot_toast.dart';
import 'package:permission_handler/permission_handler.dart';
class PermissionUtils {
static Future requestAllPermission() async {
Map<Permission, PermissionStatus> permission =
await [Permission.phone, Permission.sms].request();
if (await Permission.phone.isGranted) {
BotToast.showText(text: "手机申请通过");
} else {
BotToast.showText(text: "手机申请不通过");
}
}
}

@ -15,6 +15,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "4.1.0" version: "4.1.0"
archive:
dependency: transitive
description:
name: archive
url: "https://pub.dartlang.org"
source: hosted
version: "3.3.1"
args: args:
dependency: transitive dependency: transitive
description: description:
@ -29,6 +36,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.8.2" version: "2.8.2"
auto_size_text_pk:
dependency: transitive
description:
name: auto_size_text_pk
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:
@ -127,6 +141,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.1" version: "2.0.1"
cli_util:
dependency: transitive
description:
name: cli_util
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.5"
clock: clock:
dependency: transitive dependency: transitive
description: description:
@ -155,6 +176,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.0.0" version: "3.0.0"
common_utils:
dependency: transitive
description:
name: common_utils
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
convert: convert:
dependency: transitive dependency: transitive
description: description:
@ -162,6 +190,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.0.2" version: "3.0.2"
cross_file:
dependency: transitive
description:
name: cross_file
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.3+1"
crypto: crypto:
dependency: transitive dependency: transitive
description: description:
@ -190,6 +225,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0" version: "1.1.0"
decimal:
dependency: transitive
description:
name: decimal
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.0"
device_info_plus: device_info_plus:
dependency: "direct main" dependency: "direct main"
description: description:
@ -260,6 +302,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.1" version: "1.0.1"
flustars:
dependency: "direct main"
description:
name: flustars
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
flutter: flutter:
dependency: "direct main" dependency: "direct main"
description: flutter description: flutter
@ -271,7 +320,28 @@ packages:
name: flutter_background_service name: flutter_background_service
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.2.6" version: "0.2.8+5"
flutter_background_service_android:
dependency: transitive
description:
name: flutter_background_service_android
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.2"
flutter_background_service_ios:
dependency: transitive
description:
name: flutter_background_service_ios
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.2"
flutter_background_service_platform_interface:
dependency: transitive
description:
name: flutter_background_service_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.1+3"
flutter_gen_core: flutter_gen_core:
dependency: transitive dependency: transitive
description: description:
@ -293,6 +363,20 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.4" version: "1.0.4"
flutter_native_splash:
dependency: "direct dev"
description:
name: flutter_native_splash
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.3"
flutter_plugin_android_lifecycle:
dependency: transitive
description:
name: flutter_plugin_android_lifecycle
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.7"
flutter_screenutil: flutter_screenutil:
dependency: "direct main" dependency: "direct main"
description: description:
@ -310,6 +394,13 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
fluwx:
dependency: "direct main"
description:
name: fluwx
url: "https://pub.dartlang.org"
source: hosted
version: "3.9.1"
frontend_server_client: frontend_server_client:
dependency: transitive dependency: transitive
description: description:
@ -338,6 +429,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0" version: "2.1.0"
grinder:
dependency: "direct dev"
description:
name: grinder
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.2"
hive: hive:
dependency: "direct main" dependency: "direct main"
description: description:
@ -352,6 +450,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0" version: "1.1.0"
http:
dependency: transitive
description:
name: http
url: "https://pub.dartlang.org"
source: hosted
version: "0.13.5"
http_multi_server: http_multi_server:
dependency: transitive dependency: transitive
description: description:
@ -366,6 +471,55 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "4.0.1" version: "4.0.1"
image:
dependency: transitive
description:
name: image
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.3"
image_picker:
dependency: "direct main"
description:
name: image_picker
url: "https://pub.dartlang.org"
source: hosted
version: "0.8.5+3"
image_picker_android:
dependency: transitive
description:
name: image_picker_android
url: "https://pub.dartlang.org"
source: hosted
version: "0.8.5+1"
image_picker_for_web:
dependency: transitive
description:
name: image_picker_for_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.8"
image_picker_ios:
dependency: transitive
description:
name: image_picker_ios
url: "https://pub.dartlang.org"
source: hosted
version: "0.8.5+6"
image_picker_platform_interface:
dependency: transitive
description:
name: image_picker_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.6.1"
intl:
dependency: transitive
description:
name: intl
url: "https://pub.dartlang.org"
source: hosted
version: "0.17.0"
io: io:
dependency: transitive dependency: transitive
description: description:
@ -381,7 +535,7 @@ packages:
source: hosted source: hosted
version: "0.6.3" version: "0.6.3"
json_annotation: json_annotation:
dependency: transitive dependency: "direct main"
description: description:
name: json_annotation name: json_annotation
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
@ -422,6 +576,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.12.11" version: "0.12.11"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.3"
meta: meta:
dependency: transitive dependency: transitive
description: description:
@ -436,13 +597,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.2" version: "1.0.2"
nested:
dependency: transitive
description:
name: nested
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
package_config: package_config:
dependency: transitive dependency: transitive
description: description:
@ -477,7 +631,7 @@ packages:
name: path_provider_android name: path_provider_android
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.12" version: "2.0.17"
path_provider_ios: path_provider_ios:
dependency: transitive dependency: transitive
description: description:
@ -583,13 +737,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "4.2.4" version: "4.2.4"
provider:
dependency: "direct main"
description:
name: provider
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.3"
pub_semver: pub_semver:
dependency: "direct dev" dependency: "direct dev"
description: description:
@ -604,13 +751,76 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0" version: "1.2.0"
rational:
dependency: transitive
description:
name: rational
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.0"
shared_preferences:
dependency: transitive
description:
name: shared_preferences
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.15"
shared_preferences_android:
dependency: transitive
description:
name: shared_preferences_android
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.12"
shared_preferences_ios:
dependency: transitive
description:
name: shared_preferences_ios
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
shared_preferences_linux:
dependency: transitive
description:
name: shared_preferences_linux
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
shared_preferences_macos:
dependency: transitive
description:
name: shared_preferences_macos
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.4"
shared_preferences_platform_interface:
dependency: transitive
description:
name: shared_preferences_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
shared_preferences_web:
dependency: transitive
description:
name: shared_preferences_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.4"
shared_preferences_windows:
dependency: transitive
description:
name: shared_preferences_windows
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
shelf: shelf:
dependency: transitive dependency: transitive
description: description:
name: shelf name: shelf
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0" version: "1.3.2"
shelf_web_socket: shelf_web_socket:
dependency: transitive dependency: transitive
description: description:
@ -644,6 +854,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.1" version: "1.8.1"
sp_util:
dependency: transitive
description:
name: sp_util
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.3"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
@ -672,6 +889,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0" version: "1.1.0"
synchronized:
dependency: transitive
description:
name: synchronized
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0+2"
telephony: telephony:
dependency: "direct main" dependency: "direct main"
description: description:
@ -692,7 +916,7 @@ packages:
name: test_api name: test_api
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.4.3" version: "0.4.8"
time: time:
dependency: transitive dependency: transitive
description: description:
@ -707,6 +931,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.0" version: "1.0.0"
tobias:
dependency: "direct main"
description:
name: tobias
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.1"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
@ -714,6 +945,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.3.0" version: "1.3.0"
universal_io:
dependency: transitive
description:
name: universal_io
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.4"
vector_math: vector_math:
dependency: transitive dependency: transitive
description: description:
@ -721,6 +959,20 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.1" version: "2.1.1"
velocity_x:
dependency: "direct main"
description:
name: velocity_x
url: "https://pub.dartlang.org"
source: hosted
version: "3.5.1"
vxstate:
dependency: transitive
description:
name: vxstate
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.0"
watcher: watcher:
dependency: transitive dependency: transitive
description: description:
@ -764,5 +1016,5 @@ packages:
source: hosted source: hosted
version: "3.1.1" version: "3.1.1"
sdks: sdks:
dart: ">=2.15.0 <3.0.0" dart: ">=2.16.1 <3.0.0"
flutter: ">=2.8.0" flutter: ">=2.8.1"

@ -35,8 +35,8 @@ dependencies:
# 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.1.4 telephony: ^0.1.4
# 获取来电状态 ## 获取来电状态
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
@ -56,6 +56,18 @@ dependencies:
bot_toast: ^4.0.3 bot_toast: ^4.0.3
# 汉转音 # 汉转音
lpinyin: ^2.0.3 lpinyin: ^2.0.3
#各种扩展
velocity_x: ^3.0.0
# 相机
image_picker: ^0.8.5
#微信登录及支付
fluwx: ^3.8.3
#支付宝支付
tobias: ^2.4.0+2
# 工具
flustars: ^2.0.1
# model生成
json_annotation: ^4.6.0
# # jdk # # jdk
# jverify: ^2.2.5 # jverify: ^2.2.5
## pub 集成 ## pub 集成
@ -77,14 +89,25 @@ dev_dependencies:
yaml: ^3.1.0 yaml: ^3.1.0
pub_semver: ^2.1.0 pub_semver: ^2.1.0
flutter_gen_runner: ^4.1.3 flutter_gen_runner: ^4.1.3
# patgh: ^1.8.1
#脚本工具
grinder: ^0.9.1
flutter_native_splash: ^1.1.8+4
flutter: flutter:
uses-material-design: true uses-material-design: true
generate: true generate: true
assets: fonts:
- assets/ - family: BlackItalic
- assets/icons/ fonts:
- assets/images/ - asset: asset/fonts/Barlow-BlackItalic.ttf
- family: SemiBold
fonts:
- asset: asset/fonts/Barlow-SemiBold.ttf
assets:
- assets/
- assets/icons/
- assets/images/
# - assets/data/ # - assets/data/

@ -0,0 +1,62 @@
part of './grind.dart';
@Task('打包Android项目')
buildApk() async {
await runAsync(
'fvm',
arguments: [
'flutter',
'build',
'apk',
'--target-platform=android-arm64',
'--dart-define',
'BUILD_TYPE=PRODUCT',
],
);
String date = DateUtil.formatDate(DateTime.now(), format: 'yy_MM_dd_HH_mm');
String version = await getVersion();
await runAsync('rm', arguments: ['-rf', Config.apkDir]);
await runAsync('mkdir', arguments: ['-p', Config.apkDir]);
await runAsync('mv', arguments: [
Config.buildPath,
'${Config.apkDir}/${Config.packageName}_${version}_release_$date.apk'
]);
}
@Task('打包Android项目')
buildApkDev() async {
await runAsync(
'fvm',
arguments: [
'flutter',
'build',
'apk',
'--target-platform=android-arm64',
'--dart-define',
'BUILD_TYPE=Dev',
],
);
String date = DateUtil.formatDate(DateTime.now(), format: 'yy_MM_dd_HH_mm');
String version = await getVersion();
await runAsync('rm', arguments: ['-rf', Config.apkDevDir]);
await runAsync('mkdir', arguments: ['-p', Config.apkDevDir]);
await runAsync('mv', arguments: [
Config.buildPath,
'${Config.apkDevDir}/${Config.packageName}_${version}_beta_$date.apk'
]);
}
@Task('打包iOS项目')
buildIos() async {
await runAsync(
'fvm',
arguments: [
'flutter',
'build',
'ios',
'--dart-define',
'BUILD_TYPE=PRODUCT',
],
);
}

@ -0,0 +1,64 @@
part of './grind.dart';
@Task('import 排序')
void sort() {
Pub.run('import_sorter:main');
}
@Task('格式化dart代码')
void format() {
DartFmt.format(libDir);
}
@Task('自动提交修改')
@Depends(sort, format, gitPush)
void git() {
log(' commit to git');
run(
'git',
arguments: [
'commit',
'-a',
'-m',
'[auto task] sort & format',
],
);
}
@Task('推送代码')
void gitPush() {
log(' push to git');
run(
'git',
arguments: ['push'],
);
}
@Task('build runner')
void gen() async {
await runAsync(
'fvm',
arguments: [
'flutter',
'pub',
'run',
'build_runner',
'build',
],
);
}
@Task('build runner clean')
void genClean() async {
await runAsync(
'fvm',
arguments: [
'flutter',
'pub',
'run',
'build_runner',
'build',
'--delete-conflicting-outputs'
],
);
}

@ -0,0 +1,70 @@
import 'dart:io';
import 'package:flustars/flustars.dart';
import 'package:grinder/grinder.dart';
import 'package:path/path.dart';
import 'package:pub_semver/pub_semver.dart';
import 'package:yaml/yaml.dart';
import 'config.dart';
import 'version_tool.dart';
part '_build.dart';
part '_project_manage.dart';
main(args) => grind(args);
@Task('add minor version number')
void addVersion() async {
String projectPath = Directory('.').absolute.path;
String yamlPath = join(projectPath, 'pubspec.yaml');
String yamlContent = await File(yamlPath).readAsString();
dynamic content = loadYaml(yamlContent);
String version = content['version'];
//rename version
Version resultVersion = VersionTool.fromText(version).nextMinorTag('dev');
String result = yamlContent.replaceFirst(version, resultVersion.toString());
await File(yamlPath).writeAsString(result);
}
@Task('add path version number')
void addVersionPatch() async {
String projectPath = Directory('.').absolute.path;
String yamlPath = join(projectPath, 'pubspec.yaml');
String yamlContent = await File(yamlPath).readAsString();
dynamic content = loadYaml(yamlContent);
String version = content['version'];
//rename version
Version resultVersion = VersionTool.fromText(version).nextPatchTag('dev');
String result = yamlContent.replaceFirst(version, resultVersion.toString());
await File(yamlPath).writeAsString(result);
}
@Task('add major version number')
void addVersionMajor() async {
String projectPath = Directory('.').absolute.path;
String yamlPath = join(projectPath, 'pubspec.yaml');
String yamlContent = await File(yamlPath).readAsString();
dynamic content = loadYaml(yamlContent);
String version = content['version'];
//rename version
Version resultVersion = VersionTool.fromText(version).nextMajorTag('dev');
String result = yamlContent.replaceFirst(version, resultVersion.toString());
await File(yamlPath).writeAsString(result);
}
@Task()
Future<String> getVersion() async {
String projectPath = Directory('.').absolute.path;
String yamlPath = join(projectPath, 'pubspec.yaml');
String yamlContent = await File(yamlPath).readAsString();
dynamic content = loadYaml(yamlContent);
String version = content['version'];
return version;
}

@ -0,0 +1,59 @@
import 'package:pub_semver/pub_semver.dart';
enum VersionNumber {
major,
minor,
patch,
}
class VersionTool {
Version version;
VersionTool(this.version);
VersionTool.fromText(String text) : version = Version.parse(text);
Version get nextMajor => _addBuildNumber(VersionNumber.major);
Version get nextMinor => _addBuildNumber(VersionNumber.minor);
Version get nextPatch => _addBuildNumber(VersionNumber.patch);
Version nextMajorTag(String tag) => _addBuildNumber(
VersionNumber.major,
tag: tag,
);
Version nextMinorTag(String tag) => _addBuildNumber(
VersionNumber.minor,
tag: tag,
);
Version nextPatchTag(String tag) => _addBuildNumber(
VersionNumber.patch,
tag: tag,
);
Version _addBuildNumber(VersionNumber type, {String? tag}) {
switch (type) {
case VersionNumber.major:
return Version(
version.major,
version.minor,
version.patch + 1,
pre: tag,
build: '${(version.build.first as int) + 1}',
);
case VersionNumber.minor:
return Version(
version.major,
version.minor + 1,
0,
pre: tag,
build: '${(version.build.first as int) + 1}',
);
case VersionNumber.patch:
return Version(
version.major + 1,
0,
0,
pre: tag,
build: '${(version.build.first as int) + 1}',
);
}
}
}
Loading…
Cancel
Save