王亚玲 2 years ago
parent c5ffb51db4
commit e8581eff61

Binary file not shown.

File diff suppressed because one or more lines are too long

@ -1,4 +1,5 @@
import 'dart:async';
import 'package:bot_toast/bot_toast.dart';
import 'package:call_log/call_log.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@ -129,24 +130,25 @@ class _MyAppState extends State<MyApp> {
child: ScreenUtilInit(
designSize: const Size(750, 1334),
builder: (context, child) {
return const AnnotatedRegion<SystemUiOverlayStyle>(
value: SystemUiOverlayStyle(
return AnnotatedRegion<SystemUiOverlayStyle>(
value: const SystemUiOverlayStyle(
statusBarColor: Colors.transparent, //
statusBarIconBrightness: Brightness.dark),
child: GetMaterialApp(
// get.testmode=true,
debugShowCheckedModeBanner: false,
home: TabNavigator(),
// supportedLocales: [Locale('zh')],
// locale: Locale('zh'),
// builder: ( context,child){
home: const TabNavigator(),
builder: (context, child) {
// ScreenUtil.setContext(context);
// return MediaQuery(
// //
// data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
// // child: BotToastInit().call(context, child),
// );
// },
return MediaQuery(
//
data: MediaQueryData.fromWindow(
WidgetsBinding.instance!.window)
.copyWith(textScaleFactor: 1.0),
child: BotToastInit().call(context, child),
);
},
navigatorObservers: [BotToastNavigatorObserver()],
));
},
));

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

@ -1,3 +1,6 @@
import 'dart:async';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart';
@ -21,24 +24,24 @@ class LoginPage extends StatefulWidget {
class _LoginPageState extends State<LoginPage> {
// String _operator="";
// String _phone="";
// bool _chooseAgreement = false;
// bool _getCodeEnable = true;
// late Timer _timer;
//
// ///
// String _countDownStr = "发送验证码";
//
// ///
// int _countDownNum = 59;
bool _chooseAgreement = false;
bool _getCodeEnable = true;
late Timer _timer;
///
String _countDownStr = "发送验证码";
///
int _countDownNum = 59;
///
late final TextEditingController _phoneController =
TextEditingController(text: "");
late final TextEditingController _smsCodeController =
TextEditingController(text: "");
// late final TextEditingController _phoneController =
// TextEditingController(text: "");
// late final TextEditingController _smsCodeController =
// TextEditingController(text: "");
// // late FocusNode _smsCodeFocusNode=FocusNode (canRequestFocus: );
// bool _cantSelected = false;
// late FocusNode _smsCodeFocusNode=FocusNode (canRequestFocus: );
bool _cantSelected = false;
@override
void initState() {
super.initState();
@ -46,7 +49,8 @@ class _LoginPageState extends State<LoginPage> {
// _phone = '12345678909';
}
String ploneText = "";
String ploneText = ""; //
String codeText = ""; //
@override
Widget build(BuildContext context) {
return CloudScaffold(
@ -90,15 +94,27 @@ class _LoginPageState extends State<LoginPage> {
style: TextStyle(fontSize: 32.sp, color: const Color(0xFF999999)),
),
80.hb,
_getBox('+86', 36, "请输入手机号", 11),
_getBox('验证码', 32, "请输入验证码", 6),
_getBox('+86', 36, _phoneTFWidget()),
_getBox('验证码', 32, _codeWidget()),
112.hb,
PloneBottom(
blM: false,
border: ploneText.length != 11,
opacity: ploneText.length == 11 ? 1 : 0.4,
onTap: () {
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: "立即登录",
),
@ -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(
height: 144.w,
width: double.infinity,
@ -138,20 +154,20 @@ class _LoginPageState extends State<LoginPage> {
margin: EdgeInsets.symmetric(horizontal: 32.w),
color: const Color(0xFFE8E8E8),
),
_phoneTFWidget(hit, num),
plone,
]),
);
}
//
_phoneTFWidget(String hit, int num) {
//
_phoneTFWidget() {
return SizedBox(
// alignment: Alignment.centerLeft,
// padding: EdgeInsets.symmetric(horizontal: 72.w),
width: 300.w,
width: 430.w,
height: 50.w,
child: TextField(
maxLength: num,
maxLength: 11,
inputFormatters: [FilteringTextInputFormatter.allow(RegExp(r'[0-9]'))],
textCapitalization: TextCapitalization.none,
onChanged: (text) {
@ -163,81 +179,90 @@ class _LoginPageState extends State<LoginPage> {
border: InputBorder.none,
counterText: "",
//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),
),
),
)),
),
);
}
//
_codeWidget() {
return SizedBox(
width: 300.w,
// alignment: Alignment.centerLeft,
// padding: EdgeInsets.symmetric(horizontal: 72.w),
width: 430.w,
height: 50.w,
child: TextField(
onChanged: (String phone) {
maxLength: 6,
inputFormatters: [FilteringTextInputFormatter.allow(RegExp(r'[0-9]'))],
textCapitalization: TextCapitalization.none,
onChanged: (text) {
codeText = text;
setState(() {});
},
controller: _smsCodeController,
// focusNode: _smsCodeFocusNode,
keyboardType: TextInputType.number,
style: TextStyle(fontSize: 36.sp, color: BaseStyle.color999999),
inputFormatters: [
LengthLimitingTextInputFormatter(4),
],
cursorColor: Colors.black,
decoration: InputDecoration(
// prefixIcon: Container(
// width: 10.w,
// alignment: Alignment.centerLeft,
// 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,
contentPadding: EdgeInsets.only(bottom: 20.w),
border: InputBorder.none,
counterText: "",
//textfieldiOSplaceholder
hintText: "请输入验证码",
//
hintStyle: TextStyle(color: Colors.black12),
),
),
hintText: "请输入验证码",
hintStyle: TextStyle(color: BaseStyle.colorcccccc, fontSize: 36.sp),
)),
);
}
// //
// _beginCountDown() {
// ///
// setState(() {
// _getCodeEnable = false;
// _countDownStr = "重新获取($_countDownNum)";
// });
// _timer = Timer.periodic(const Duration(seconds: 1), (timer) {
// if (!mounted) {
// return;
// }
// setState(() {
// if (_countDownNum == 0) {
// _countDownNum = 59;
// _countDownStr = "获取验证码";
// _getCodeEnable = true;
// _timer.cancel();
// return;
// }
// _countDownStr = "重新获取(${_countDownNum--})";
// });
// });
// }
_beginCountDown() {
///
setState(() {
_getCodeEnable = false;
_countDownStr = "${_countDownNum}s";
});
_timer = Timer.periodic(const Duration(seconds: 1), (timer) {
if (!mounted) {
return;
}
setState(() {
if (_countDownNum == 0) {
_countDownNum = 59;
_countDownStr = "获取验证码";
_getCodeEnable = true;
_timer.cancel();
return;
}
_countDownStr = "${_countDownNum--}s";
});
});
}
//
_recognizer(context, int type) {
@ -255,7 +280,7 @@ class _LoginPageState extends State<LoginPage> {
_getText() {
return GestureDetector(
onTap: () {
// _chooseAgreement = !_chooseAgreement;
_chooseAgreement = !_chooseAgreement;
setState(() {});
},
child: Row(
@ -266,13 +291,12 @@ class _LoginPageState extends State<LoginPage> {
width: 50.w,
height: 50.w,
padding: EdgeInsets.only(top: 6.w, right: 5.w),
child: const Icon(CupertinoIcons.circle,
size: 18, color: Color(0xFFdddddd))),
// !_chooseAgreement
// ? const Icon(CupertinoIcons.circle,
// size: 18, color: Color(0xFFdddddd))
// : const Icon(CupertinoIcons.checkmark_circle,
// size: 18, color: Colors.red)),
child: !_chooseAgreement
? const Icon(CupertinoIcons.circle,
size: 18, color: Color(0xFFdddddd))
: const Icon(CupertinoIcons.checkmark_circle,
size: 18, color: Colors.blue),
),
RichText(
text: TextSpan(
text: "我已阅读并同意",

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

@ -1,7 +1,9 @@
import 'package:flutter/material.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/utils/headers.dart';
import 'package:telephony/telephony.dart';
class PrivacyRightsPage extends StatefulWidget {
final String name;
@ -11,6 +13,14 @@ class PrivacyRightsPage extends StatefulWidget {
_PrivacyRightsPageState createState() => _PrivacyRightsPageState();
}
final Telephony telephony = Telephony.instance;
// late final bool permissionsGranted;
// String body = "";
// @override
// void initState() async {
// initPlatformState();
// }
class _PrivacyRightsPageState extends State<PrivacyRightsPage> {
@override
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) {
return GestureDetector(
onTap: () {},
@ -53,7 +87,7 @@ class _PrivacyRightsPageState extends State<PrivacyRightsPage> {
fontWeight: FontWeight.bold),
),
16.hb,
Text('用于获取设备',
Text('用于获取设备1',
style: TextStyle(
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/services.dart';
import 'package:project_telephony/base/base_style.dart';
@ -7,7 +8,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/widget/image_scaffold.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/permissionutils.dart';
import 'package:telephony/telephony.dart';
class UserPage extends StatefulWidget {
const UserPage({Key? key}) : super(key: key);
@ -16,12 +20,14 @@ class UserPage extends StatefulWidget {
_UserPageState createState() => _UserPageState();
}
final Telephony telephony = Telephony.instance;
@override
void initState() {}
class _UserPageState extends State<UserPage> {
bool bl = true;
bool vle = false;
bool tooken = true;
@override
Widget build(BuildContext context) {
return CloudScaffold(
@ -58,19 +64,19 @@ class _UserPageState extends State<UserPage> {
//
_getUser() {
return GestureDetector(
onTap: () {
Get.to(() => const LoginPage());
},
child: Container(
return Container(
margin: EdgeInsets.only(left: 64.w, right: 64.w, top: 216.w),
child: Row(
children: [
Column(
GestureDetector(
onTap: () {
Get.to(() => const LoginPage());
},
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
bl ? "登录/注册" : "xxxxx",
tooken ? "登录/注册" : "xxxxx",
style: TextStyle(
fontSize: BaseStyle.fontSize48,
color: BaseStyle.color333333,
@ -78,15 +84,23 @@ class _UserPageState extends State<UserPage> {
),
24.hb,
Text(
bl ? "登录获取更多信息" : "欢迎您登录短信帮手",
tooken ? "登录获取更多信息" : "欢迎您登录短信帮手",
style: TextStyle(
fontSize: BaseStyle.fontSize28,
color: BaseStyle.color333333),
)
],
),
),
const Spacer(),
Container(
GestureDetector(
onTap: () async {
var value = await CloudImagePicker.pickSingleImage(title: '选择图片');
if (value != null) {
BotToast.showText(text: '头像成功');
setState(() {});
}
},
child: ClipOval(
child: Image.asset(
Assets.images.portrait.path,
@ -98,7 +112,6 @@ class _UserPageState extends State<UserPage> {
)
],
),
),
);
}
@ -169,13 +182,18 @@ class _UserPageState extends State<UserPage> {
_getVip() {
return Row(
children: [
const Text(
"vip",
style: TextStyle(color: Color(0xFFFFEAB0)),
Text(
"VIP",
style: TextStyle(
color: const Color(0xFFFFEAB0),
fontFamily: "BlackItalic",
fontSize: 32.sp),
),
Container(
width: 8.w,
height: 8.w,
alignment: Alignment.center,
margin: EdgeInsets.symmetric(horizontal: 8.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
color: const Color(0xFFFFEAB0),
@ -183,7 +201,11 @@ class _UserPageState extends State<UserPage> {
),
const Text(
"未开通会员",
style: TextStyle(color: Color(0xFFFFEAB0)),
style: TextStyle(
color: Color(
0xFFFFEAB0,
),
fontWeight: FontWeight.w700),
)
],
);
@ -192,9 +214,9 @@ class _UserPageState extends State<UserPage> {
//
_getSwitch(String url, String name, bool pd) {
return GestureDetector(
onTap: () {
onTap: () async {
pd
? ""
? PermissionUtils.requestAllPermission()
: Get.to(() => PrivacyRightsPage(
name: name,
));

@ -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)),
child: Column(
children: [
Padding(padding: EdgeInsets.only(top: 16.w)),
Padding(padding: EdgeInsets.only(top: 32.w)),
Text(
"${item.month}个月VIP",
style: TextStyle(
fontFamily: "SemiBold",
fontSize: BaseStyle.fontSize28,
color: BaseStyle.color333333,
fontWeight: FontWeight.bold),
@ -99,18 +100,17 @@ class SortWidget extends StatelessWidget {
TextSpan(
text: "${item.pice}",
style: TextStyle(
fontFamily: "SemiBold",
fontSize: 64.sp,
color: pickItem == item
? const Color(0xFFFF3F3F)
: BaseStyle.color333333))
])),
Text(
"${(item.pice / item.month).toStringAsFixed(2)}元/月",
Text("${(item.pice / item.month).toStringAsFixed(2)}元/月",
style: TextStyle(
fontSize: BaseStyle.fontSize24,
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"
source: hosted
version: "4.1.0"
archive:
dependency: transitive
description:
name: archive
url: "https://pub.dartlang.org"
source: hosted
version: "3.3.1"
args:
dependency: transitive
description:
@ -29,6 +36,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
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:
dependency: transitive
description:
@ -127,6 +141,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
cli_util:
dependency: transitive
description:
name: cli_util
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.5"
clock:
dependency: transitive
description:
@ -147,7 +168,7 @@ packages:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0"
version: "1.16.0"
color:
dependency: transitive
description:
@ -155,6 +176,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
common_utils:
dependency: transitive
description:
name: common_utils
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
convert:
dependency: transitive
description:
@ -162,6 +190,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
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:
dependency: transitive
description:
@ -190,20 +225,62 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
decimal:
dependency: transitive
description:
name: decimal
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.0"
device_info_plus:
dependency: "direct main"
description:
name: device_info_plus
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.1"
version: "4.0.0"
device_info_plus_linux:
dependency: transitive
description:
name: device_info_plus_linux
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
device_info_plus_macos:
dependency: transitive
description:
name: device_info_plus_macos
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.3"
device_info_plus_platform_interface:
dependency: transitive
description:
name: device_info_plus_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.3.0+1"
device_info_plus_web:
dependency: transitive
description:
name: device_info_plus_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
device_info_plus_windows:
dependency: transitive
description:
name: device_info_plus_windows
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.3.0"
ffi:
dependency: transitive
description:
@ -225,6 +302,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
flustars:
dependency: "direct main"
description:
name: flustars
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
flutter:
dependency: "direct main"
description: flutter
@ -279,6 +363,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
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:
dependency: "direct main"
description:
@ -291,6 +389,18 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_web_plugins:
dependency: transitive
description: flutter
source: sdk
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:
dependency: transitive
description:
@ -319,6 +429,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
grinder:
dependency: "direct dev"
description:
name: grinder
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.2"
hive:
dependency: "direct main"
description:
@ -333,6 +450,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
http:
dependency: transitive
description:
name: http
url: "https://pub.dartlang.org"
source: hosted
version: "0.13.5"
http_multi_server:
dependency: transitive
description:
@ -347,6 +471,55 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
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:
dependency: transitive
description:
@ -362,7 +535,7 @@ packages:
source: hosted
version: "0.6.4"
json_annotation:
dependency: transitive
dependency: "direct main"
description:
name: json_annotation
url: "https://pub.dartlang.org"
@ -409,7 +582,7 @@ packages:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.3"
version: "0.1.4"
meta:
dependency: transitive
description:
@ -451,7 +624,7 @@ packages:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
version: "1.8.1"
path_provider:
dependency: transitive
description:
@ -501,6 +674,41 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.7"
permission_handler:
dependency: "direct main"
description:
name: permission_handler
url: "https://pub.dartlang.org"
source: hosted
version: "10.0.0"
permission_handler_android:
dependency: transitive
description:
name: permission_handler_android
url: "https://pub.dartlang.org"
source: hosted
version: "10.0.0"
permission_handler_apple:
dependency: transitive
description:
name: permission_handler_apple
url: "https://pub.dartlang.org"
source: hosted
version: "9.0.4"
permission_handler_platform_interface:
dependency: transitive
description:
name: permission_handler_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "3.7.0"
permission_handler_windows:
dependency: transitive
description:
name: permission_handler_windows
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.0"
petitparser:
dependency: transitive
description:
@ -557,6 +765,69 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
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:
dependency: transitive
description:
@ -596,7 +867,14 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
version: "1.8.2"
sp_util:
dependency: transitive
description:
name: sp_util
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.3"
stack_trace:
dependency: transitive
description:
@ -625,6 +903,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
synchronized:
dependency: transitive
description:
name: synchronized
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0+2"
telephony:
dependency: "direct main"
description:
@ -645,7 +930,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.8"
version: "0.4.9"
time:
dependency: transitive
description:
@ -660,6 +945,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
tobias:
dependency: "direct main"
description:
name: tobias
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.1"
typed_data:
dependency: transitive
description:
@ -667,13 +959,34 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
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:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
version: "2.1.2"
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:
dependency: transitive
description:
@ -717,5 +1030,5 @@ packages:
source: hosted
version: "3.1.1"
sdks:
dart: ">=2.16.1 <3.0.0"
dart: ">=2.17.0-0 <3.0.0"
flutter: ">=2.8.1"

@ -37,6 +37,7 @@ dependencies:
# 获取来电状态
telephony: any
provider: ^6.0.3
permission_handler: ^10.0.0
# 获取通话记录
call_log: ^4.0.0
# 后台设置
@ -55,6 +56,18 @@ dependencies:
bot_toast: ^4.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
# jverify: ^2.2.5
## pub 集成
@ -76,11 +89,22 @@ dev_dependencies:
yaml: ^3.1.0
pub_semver: ^2.1.0
flutter_gen_runner: ^4.1.3
# patgh: ^1.8.1
#脚本工具
grinder: ^0.9.1
flutter_native_splash: ^1.1.8+4
flutter:
uses-material-design: true
generate: true
fonts:
- family: BlackItalic
fonts:
- asset: asset/fonts/Barlow-BlackItalic.ttf
- family: SemiBold
fonts:
- asset: asset/fonts/Barlow-SemiBold.ttf
assets:
- assets/
- assets/icons/

@ -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