Commit be3d2853130c4720e61ea7175376aaa8de06174e

Authored by 蓋亞光
2 parents 68afbdbb f457628a

线上v1.6.3

Showing 49 changed files with 3202 additions and 430 deletions
... ... @@ -11,14 +11,14 @@ if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = "146"
def flutterVersionCode = "163"
if (flutterVersionCode == null) {
flutterVersionCode = '146'
flutterVersionCode = '163'
}
def flutterVersionName = "1.4.6"
def flutterVersionName = "1.6.3"
if (flutterVersionName == null) {
flutterVersionName = '1.4.6'
flutterVersionName = '1.6.3'
}
apply plugin: 'com.android.application'
... ...
7babc7873f8d177769b987ba4c6c2911
\ No newline at end of file
c71e777004aab201609920eac28801f9
\ No newline at end of file
... ...
... ... @@ -255,4 +255,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: a75497545d4391e2d394c3668e20cfb1c2bbd4aa
>>>>>>> v1.4+
COCOAPODS: 1.9.3
COCOAPODS: 1.9.1
... ...
... ... @@ -409,7 +409,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 146;
CURRENT_PROJECT_VERSION = 163;
DEVELOPMENT_TEAM = 8J59HM8B82;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
... ... @@ -422,7 +422,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 1.4.6;
MARKETING_VERSION = 1.6.3;
PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine;
PRODUCT_NAME = "一键订";
PROVISIONING_PROFILE_SPECIFIER = "";
... ... @@ -551,7 +551,7 @@
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 146;
CURRENT_PROJECT_VERSION = 163;
DEVELOPMENT_TEAM = 8J59HM8B82;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
... ... @@ -564,7 +564,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 1.4.6;
MARKETING_VERSION = 1.6.3;
PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine;
PRODUCT_NAME = "一键订";
PROVISIONING_PROFILE_SPECIFIER = "";
... ... @@ -584,7 +584,7 @@
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 146;
CURRENT_PROJECT_VERSION = 163;
DEVELOPMENT_TEAM = 8J59HM8B82;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
... ... @@ -597,7 +597,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 1.4.6;
MARKETING_VERSION = 1.6.3;
PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine;
PRODUCT_NAME = "一键订";
PROVISIONING_PROFILE_SPECIFIER = "";
... ...
... ... @@ -37,6 +37,7 @@ Future<void> main() async {
LogUtil.init(isDebug: false, tag: 'ONE_KEY');
Provider.debugCheckInvalidValueType = null;
await initializeDateFormatting();
Utils.changeStatusColor();
SystemChrome.setPreferredOrientations(
[DeviceOrientation.portraitUp, DeviceOrientation.portraitDown])
.then((_) {
... ...
import 'package:json_annotation/json_annotation.dart';
part 'get_seller_info_model.g.dart';
@JsonSerializable()
class GetSellerInfoModel extends Object {
@JsonKey(name: 'ret')
int ret;
@JsonKey(name: 'data')
GetSellerInfoSunModel data;
@JsonKey(name: 'msg')
String msg;
GetSellerInfoModel(
this.ret,
this.data,
this.msg,
);
factory GetSellerInfoModel.fromJson(Map<String, dynamic> srcJson) =>
_$GetSellerInfoModelFromJson(srcJson);
Map<String, dynamic> toJson() => _$GetSellerInfoModelToJson(this);
}
@JsonSerializable()
class GetSellerInfoSunModel extends Object {
@JsonKey(name: 'data')
Data data;
GetSellerInfoSunModel(
this.data,
);
factory GetSellerInfoSunModel.fromJson(Map<String, dynamic> srcJson) =>
_$GetSellerInfoSunModelFromJson(srcJson);
Map<String, dynamic> toJson() => _$GetSellerInfoSunModelToJson(this);
}
@JsonSerializable()
class Data extends Object {
@JsonKey(name: 'id')
String id;
@JsonKey(name: 'pid')
String pid;
@JsonKey(name: 'openid')
String openid;
@JsonKey(name: 'sellername')
String sellername;
@JsonKey(name: 'selleralias')
String selleralias;
@JsonKey(name: 'slogan')
String slogan;
@JsonKey(name: 'sellerdesc')
String sellerdesc;
@JsonKey(name: 'seller_logo')
String sellerLogo;
@JsonKey(name: 'seller_image')
String sellerImage;
@JsonKey(name: 'seller_tel')
String sellerTel;
@JsonKey(name: 'phone')
String phone;
@JsonKey(name: 'map_address')
String mapAddress;
@JsonKey(name: 'long')
String long;
@JsonKey(name: 'lat')
String lat;
@JsonKey(name: 'discount_type')
String discountType;
@JsonKey(name: 'last_num')
String lastNum;
@JsonKey(name: 'ispass')
String ispass;
@JsonKey(name: 'dis_ispass')
String disIspass;
@JsonKey(name: 'account_money')
String accountMoney;
@JsonKey(name: 'isopen_dc')
String isopenDc;
@JsonKey(name: 'isopen_md')
String isopenMd;
@JsonKey(name: 'dc_adduser_code')
String dcAdduserCode;
@JsonKey(name: 'average')
String average;
@JsonKey(name: 'is_online_reserve')
String isOnlineReserve;
@JsonKey(name: 'is_tele')
String isTele;
@JsonKey(name: 'daily')
String daily;
@JsonKey(name: 'daily_time')
String dailyTime;
@JsonKey(name: 'scale')
String scale;
@JsonKey(name: 'score')
String score;
@JsonKey(name: 'is_auth')
String isAuth;
@JsonKey(name: 'is_call_tel')
String isCallTel;
@JsonKey(name: 'rec_stime')
String recStime;
@JsonKey(name: 'rec_etime')
String recEtime;
@JsonKey(name: 'status')
String status;
@JsonKey(name: 'cdate')
String cdate;
@JsonKey(name: 'pro_code')
String proCode;
@JsonKey(name: 'city_code')
String cityCode;
@JsonKey(name: 'dis_code')
String disCode;
@JsonKey(name: 'seller_code')
String sellerCode;
Data(
this.id,
this.pid,
this.openid,
this.sellername,
this.selleralias,
this.slogan,
this.sellerdesc,
this.sellerLogo,
this.sellerImage,
this.sellerTel,
this.phone,
this.mapAddress,
this.long,
this.lat,
this.discountType,
this.lastNum,
this.ispass,
this.disIspass,
this.accountMoney,
this.isopenDc,
this.isopenMd,
this.dcAdduserCode,
this.average,
this.isOnlineReserve,
this.isTele,
this.daily,
this.dailyTime,
this.scale,
this.score,
this.isAuth,
this.isCallTel,
this.recStime,
this.recEtime,
this.status,
this.cdate,
this.proCode,
this.cityCode,
this.disCode,
this.sellerCode,
);
factory Data.fromJson(Map<String, dynamic> srcJson) =>
_$DataFromJson(srcJson);
Map<String, dynamic> toJson() => _$DataToJson(this);
}
... ...
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'get_seller_info_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
GetSellerInfoModel _$GetSellerInfoModelFromJson(Map<String, dynamic> json) {
return GetSellerInfoModel(
json['ret'] as int,
json['data'] == null
? null
: GetSellerInfoSunModel.fromJson(
json['data'] as Map<String, dynamic>),
json['msg'] as String);
}
Map<String, dynamic> _$GetSellerInfoModelToJson(GetSellerInfoModel instance) =>
<String, dynamic>{
'ret': instance.ret,
'data': instance.data,
'msg': instance.msg
};
GetSellerInfoSunModel _$GetSellerInfoSunModelFromJson(
Map<String, dynamic> json) {
return GetSellerInfoSunModel(json['data'] == null
? null
: Data.fromJson(json['data'] as Map<String, dynamic>));
}
Map<String, dynamic> _$GetSellerInfoSunModelToJson(
GetSellerInfoSunModel instance) =>
<String, dynamic>{'data': instance.data};
Data _$DataFromJson(Map<String, dynamic> json) {
return Data(
json['id'] as String,
json['pid'] as String,
json['openid'] as String,
json['sellername'] as String,
json['selleralias'] as String,
json['slogan'] as String,
json['sellerdesc'] as String,
json['seller_logo'] as String,
json['seller_image'] as String,
json['seller_tel'] as String,
json['phone'] as String,
json['map_address'] as String,
json['long'] as String,
json['lat'] as String,
json['discount_type'] as String,
json['last_num'] as String,
json['ispass'] as String,
json['dis_ispass'] as String,
json['account_money'] as String,
json['isopen_dc'] as String,
json['isopen_md'] as String,
json['dc_adduser_code'] as String,
json['average'] as String,
json['is_online_reserve'] as String,
json['is_tele'] as String,
json['daily'] as String,
json['daily_time'] as String,
json['scale'] as String,
json['score'] as String,
json['is_auth'] as String,
json['is_call_tel'] as String,
json['rec_stime'] as String,
json['rec_etime'] as String,
json['status'] as String,
json['cdate'] as String,
json['pro_code'] as String,
json['city_code'] as String,
json['dis_code'] as String,
json['seller_code'] as String);
}
Map<String, dynamic> _$DataToJson(Data instance) => <String, dynamic>{
'id': instance.id,
'pid': instance.pid,
'openid': instance.openid,
'sellername': instance.sellername,
'selleralias': instance.selleralias,
'slogan': instance.slogan,
'sellerdesc': instance.sellerdesc,
'seller_logo': instance.sellerLogo,
'seller_image': instance.sellerImage,
'seller_tel': instance.sellerTel,
'phone': instance.phone,
'map_address': instance.mapAddress,
'long': instance.long,
'lat': instance.lat,
'discount_type': instance.discountType,
'last_num': instance.lastNum,
'ispass': instance.ispass,
'dis_ispass': instance.disIspass,
'account_money': instance.accountMoney,
'isopen_dc': instance.isopenDc,
'isopen_md': instance.isopenMd,
'dc_adduser_code': instance.dcAdduserCode,
'average': instance.average,
'is_online_reserve': instance.isOnlineReserve,
'is_tele': instance.isTele,
'daily': instance.daily,
'daily_time': instance.dailyTime,
'scale': instance.scale,
'score': instance.score,
'is_auth': instance.isAuth,
'is_call_tel': instance.isCallTel,
'rec_stime': instance.recStime,
'rec_etime': instance.recEtime,
'status': instance.status,
'cdate': instance.cdate,
'pro_code': instance.proCode,
'city_code': instance.cityCode,
'dis_code': instance.disCode,
'seller_code': instance.sellerCode
};
... ...
... ... @@ -115,7 +115,7 @@ class NotebookDetail {
String get ddateMd {
DateTime dateTime =
DateTime.fromMillisecondsSinceEpoch(int.parse(ddate) * 1000);
String md = Utils.addZeroNumber(dateTime.month) +
String md ="${dateTime.year}年 "+Utils.addZeroNumber(dateTime.month) +
"月" +
Utils.addZeroNumber(dateTime.day) +
"日";
... ...
import 'package:json_annotation/json_annotation.dart';
part 'remark.g.dart';
@JsonSerializable()
class Remark extends Object {
@JsonKey(name: 'id')
String id;
@JsonKey(name: 'uid')
String uid;
@JsonKey(name: 'often_use')
String oftenUse;
@JsonKey(name: 'custom')
String custom;
@JsonKey(name: 'cdate')
String cdate;
bool selected = false;
Remark();
factory Remark.fromJson(Map<String, dynamic> srcJson) =>
_$RemarkFromJson(srcJson);
Map<String, dynamic> toJson() => _$RemarkToJson(this);
}
... ...
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'remark.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
Remark _$RemarkFromJson(Map<String, dynamic> json) {
return Remark()
..id = json['id'] as String
..uid=json['uid'] as String
..oftenUse=json['often_use'] as String
..custom=json['custom'] as String
..cdate = json['cdate'] as String;
}
Map<String, dynamic> _$RemarkToJson(Remark instance) => <String, dynamic>{
'id': instance.id,
'uid': instance.uid,
'often_use': instance.oftenUse,
'custom': instance.custom,
'cdate': instance.cdate,
};
... ...
import 'package:json_annotation/json_annotation.dart';
part 'set_seller_info_model.g.dart';
@JsonSerializable()
class SetSellerInfoModel extends Object {
@JsonKey(name: 'ret')
int ret;
@JsonKey(name: 'data')
SetSellerInfoSunModel data;
@JsonKey(name: 'msg')
String msg;
SetSellerInfoModel(this.ret,this.data,this.msg,);
factory SetSellerInfoModel.fromJson(Map<String, dynamic> srcJson) => _$SetSellerInfoModelFromJson(srcJson);
Map<String, dynamic> toJson() => _$SetSellerInfoModelToJson(this);
}
@JsonSerializable()
class SetSellerInfoSunModel extends Object {
@JsonKey(name: 'sellerid')
int sellerid;
SetSellerInfoSunModel(this.sellerid,);
factory SetSellerInfoSunModel.fromJson(Map<String, dynamic> srcJson) => _$DataFromJson(srcJson);
Map<String, dynamic> toJson() => _$DataToJson(this);
}
... ...
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'set_seller_info_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
SetSellerInfoModel _$SetSellerInfoModelFromJson(Map<String, dynamic> json) {
return SetSellerInfoModel(
json['ret'] as int,
json['data'] == null
? null
: SetSellerInfoSunModel.fromJson(
json['data'] as Map<String, dynamic>),
json['msg'] as String);
}
Map<String, dynamic> _$SetSellerInfoModelToJson(SetSellerInfoModel instance) =>
<String, dynamic>{
'ret': instance.ret,
'data': instance.data,
'msg': instance.msg
};
SetSellerInfoSunModel _$DataFromJson(Map<String, dynamic> json) {
return SetSellerInfoSunModel(json['sellerid'] as int);
}
Map<String, dynamic> _$DataToJson(SetSellerInfoSunModel instance) =>
<String, dynamic>{'sellerid': instance.sellerid};
... ...
///桌位区域
class SetTime {
String start;
String end;
SetTime();
factory SetTime.fromJson(Map<String, dynamic> json) => SetTime()
..start = json["start"]
..end = json["end"];
Map<String, dynamic> toJson() =>
<String, dynamic>{"start": start, "end": end};
}
... ...
import 'package:json_annotation/json_annotation.dart';
part 'user_history_entity.g.dart';
@JsonSerializable()
class UserHistoryEntity extends Object {
@JsonKey(name: 'id')
String id;
@JsonKey(name: 'sid')
String sid;
@JsonKey(name: 'rname')
String rname;
@JsonKey(name: 'sex')
String sex;
@JsonKey(name: 'phone')
String phone;
@JsonKey(name: 'cusdem')
String cusdem;
UserHistoryEntity(this.id,this.sid,this.rname,this.sex,this.phone,this.cusdem,);
factory UserHistoryEntity.fromJson(Map<String, dynamic> srcJson) => _$UserHistoryEntityFromJson(srcJson);
Map<String, dynamic> toJson() => _$UserHistoryEntityToJson(this);
}
... ...
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'user_history_entity.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
UserHistoryEntity _$UserHistoryEntityFromJson(Map<String, dynamic> json) {
return UserHistoryEntity(
json['id'] as String,
json['sid'] as String,
json['rname'] as String,
json['sex'] as String,
json['phone'] as String,
json['cusdem'] as String);
}
Map<String, dynamic> _$UserHistoryEntityToJson(UserHistoryEntity instance) =>
<String, dynamic>{
'id': instance.id,
'sid': instance.sid,
'rname': instance.rname,
'sex': instance.sex,
'phone': instance.phone,
'cusdem': instance.cusdem
};
... ...
... ... @@ -215,6 +215,7 @@ class DioUtil {
_data = _dataMap[_dataKey];
_responseData = _dataMap;
}
Loading.hideLoading(context);
return new BaseResp(_status, _code, _msg, _data, _responseData);
} catch (e) {
... ...
... ... @@ -38,4 +38,22 @@ class HttpUrl {
static const String set_switch_status =
"?service=App.Reserve.SetSwitchStatus"; //启用/停用桌位
static const String sms_info = "?service=App.SendSMS.SmsInfo"; //短信余量查询及套餐查询接口
static const String set_seller_info =
"?service=App.Seller.SetSellerById"; // 根据商家ID设置商家信息
static const String get_seller_info =
"?service=App.Seller.GetSellerById"; // 根据商家ID获取商家信息
static const String set_order_time =
"?service=App.Seller.SetReOrderTime"; //在线预订配置-接单时间
static const String get_custom_remark=
"?service=App.User.GetCustomRemark"; //获取常用备注
static const String del_custom_remark=
"?service=App.User.DelCustomRemark"; //删除常用备注
static const String add_custom_remark=
"?service=App.User.AddCustomRemark"; //添加常用备注
static const String get_reserve_user=
"?service=App.Reserve.GetReserveUser"; //获取历史录入联系人
}
... ...
... ... @@ -57,6 +57,7 @@ class HandleOnlinePageState extends State<HandleOnlinePage> {
bool isRefused = false; //是否已拒绝
bool isPause = false; //是否暂停预订
bool isSelf=false;//订单是否自己处理
StateSetter refuseDialogState; //决绝弹框setState
@override
... ... @@ -91,7 +92,11 @@ class HandleOnlinePageState extends State<HandleOnlinePage> {
}
}
});
if (detailEntity.status != "0" && !isPause) {
if(detailEntity.status=="6"){//已拒绝不跳转
if(refuseDialogState!=null){
refuseDialogState((){});
}
}else if (detailEntity.status != "0") {//已拒绝
//已处理
Future.delayed(Duration(milliseconds: 200), () {
NavigatorUtil.goNotebookDetailPage(context, detailEntity.id,
... ... @@ -183,7 +188,6 @@ class HandleOnlinePageState extends State<HandleOnlinePage> {
VEmptyView(20),
GestureDetector(
onTap: () {
Navigator.of(context).pop();
setReserveStatus("6");
},
child: Container(
... ... @@ -304,6 +308,9 @@ class HandleOnlinePageState extends State<HandleOnlinePage> {
],
),
);
if(detailEntity.status=="6"&&isSelf==false){//订单已被拒绝
Navigator.of(context).pop();
}
return container;
},
);
... ... @@ -342,20 +349,21 @@ class HandleOnlinePageState extends State<HandleOnlinePage> {
"cause": json.encode(causeMap)
};
if (status == "6") {
isPause = true;
isPause = (ac=="1"?true:false);
params['ac'] = ac; //0=直接拒绝 1=拒绝并暂停预订
}
bool success = await detailModel.setReserveStatus(context, params,
ifPush: (isPause ? false : true), showLoading: true);
ifPush: (status=="6" ? false : true), showLoading: true);
if (success != null && success) {
bus.emit("refresh_book_list");
if (status == "6") {
isRefused = true;
}
if (isPause) {
isSelf=true;
_getOrderListData();
refuseDialogState(() {});
}
}else{
isSelf=false;
_getOrderListData();
}
}
... ...
... ... @@ -2,20 +2,24 @@ import 'dart:convert';
import 'dart:ui';
import 'package:common_utils/common_utils.dart';
// import 'package:contacts_service/contacts_service.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/screenutil.dart';
import 'package:one_key/models/notebook_detail.dart';
import 'package:one_key/models/remark.dart';
import 'package:one_key/models/reserve_info_model.dart';
import 'package:one_key/provider/notebook_detail_change_model.dart';
import 'package:one_key/provider/notebook_detail_model.dart';
import 'package:one_key/provider/remark_manager_model.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/res/styles.dart';
import 'package:one_key/utils/dialog_util.dart';
import 'package:one_key/utils/event_bus.dart';
import 'package:one_key/utils/misc.dart';
import 'package:one_key/utils/navigator_util.dart';
import 'package:one_key/utils/triangle_custom_painter.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/MyDivider.dart';
import 'package:one_key/widgets/app_bar.dart';
... ... @@ -23,7 +27,6 @@ import 'package:one_key/widgets/common_button.dart';
import 'package:one_key/widgets/h_empty_view.dart';
import 'package:one_key/widgets/new_table_item.dart';
import 'package:one_key/widgets/round_button.dart';
import 'package:one_key/widgets/table_item.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:provider/provider.dart';
... ... @@ -39,6 +42,7 @@ class NoteBookChangePage extends StatefulWidget {
const NoteBookChangePage({Key key, this.detailEntity, this.rid})
: super(key: key);
@override
_NoteBookChangePageState createState() => _NoteBookChangePageState();
}
... ... @@ -51,6 +55,14 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> {
FocusNode _needNode = FocusNode();
NotebookDetailModel detailModel = NotebookDetailModel();
EasyContactPicker _contactPicker = EasyContactPicker();
RemarkManagerModel remarkManagerModel;
String currentRemark = '';
bool showPhoneHistory = false; //显示客户历史记录
String sid = ""; //商户id
ScrollController _controller = ScrollController();
@override
void initState() {
... ... @@ -59,6 +71,7 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> {
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
// _notebookDetailChangeModel =
// Provider.of<NotebookDetailChangeModel>(context, listen: false);
sid = Provider.of<UserModel>(context, listen: false).user.sellerid;
_notebookDetailChangeModel.initDateHourMinuteList(context);
String ddate = widget.detailEntity.ddate.toString() + '000';
_notebookDetailChangeModel.getNewTableList(
... ... @@ -68,23 +81,10 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> {
widget.detailEntity.pnum,
widget.detailEntity.tables);
_initData();
// //输入框焦点
// _nameNode.addListener(() {
// if (!_nameNode.hasFocus) {
// print('失去焦点');
// } else {
// print('得到焦点');
// _phoneNode.unfocus();
// }
// });
// //输入框焦点
// _phoneNode.addListener(() {
// if (!_phoneNode.hasFocus) {
// print('失去焦点');
// } else {
// print('得到焦点');
// }
// });
Map<String, String> params = {
"uid": Provider.of<UserModel>(context, listen: false).user.openid
};
remarkManagerModel.getRemarks(context, params);
});
}
... ... @@ -114,7 +114,9 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: _notebookDetailChangeModel.dateList.map((value) {
return CustomButton(
dateText: value['title'],
dateText: value['title'].toString().length <= 5
? value['title'].toString()
: value['title'].toString().substring(5),
fontSize: value['fontSize'],
dayText: value['dayText'],
isImage: value['isImage'],
... ... @@ -142,14 +144,10 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> {
}
if (j ==
_notebookDetailChangeModel.dateList.length - 1) {
String selectStr =
_notebookDetailChangeModel.dateList[2]['title'];
String timeNow = DateUtil.formatDate(
DateTime.now(),
);
String selectDate =
timeNow.replaceRange(5, 10, selectStr);
_calendWidget(DateUtil.getDateTime(selectDate));
String selectStr = _notebookDetailChangeModel
.dateList[2]['title'] +
" 00:00:00";
_calendWidget(DateUtil.getDateTime(selectStr));
}
}
}
... ... @@ -310,7 +308,8 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> {
// _createDateText(day);
dateTime = day;
int dateTimeMill = day.millisecondsSinceEpoch;
String dateText = DateUtil.formatDateMs(dateTimeMill, format: 'MM-dd');
String dateText =
DateUtil.formatDateMs(dateTimeMill, format: 'yyyy-MM-dd');
bool isThird = true;
for (int i = 0; i < _notebookDetailChangeModel.dateList.length; i++) {
_notebookDetailChangeModel.dateList[i]['select'] = false;
... ... @@ -354,17 +353,13 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> {
InkWell(
onTap: () async {
FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
//当前选中 月 日string
String mdStr = '';
String ymyStr = ""; //年月日
//今天 明天 其他天
for (var item in _notebookDetailChangeModel.dateList) {
if (item['select'] == true) {
mdStr = item['title'];
ymyStr = item['title'];
}
}
String timeNowYear =
DateUtil.formatDate(DateTime.now(), format: 'yyyy');
String ymyStr = timeNowYear + '-' + mdStr; //年月日
String timeStr = ymyStr + ' ' + "00:00:00";
int ddate = DateUtil.getDateMsByTimeStr(timeStr); //筛选日期时间戳
String ddateSolt = '';
... ... @@ -596,11 +591,33 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> {
// EdgeInsets.only(bottom: ScreenUtil().setWidth(17)),
border: InputBorder.none,
),
onChanged: (value) {},
onChanged: (value) {
LogUtil.v("value:$value");
if (value.isEmpty || value.length >= 11) {
//内容为空,或 超过11位
setState(() {
_notebookDetailChangeModel.userHistorys.clear();
});
return;
}
Map<String, String> params = {
"keywords": value,
"sid": sid
};
_notebookDetailChangeModel.getUserHistorys(context, params);
},
onEditingComplete: () {
print('fff');
_phoneNode.unfocus();
},
onTap: () {
setState(() {
showPhoneHistory = true;
});
Future.delayed(Duration(milliseconds: 300),(){
_controller.jumpTo(_controller.position.maxScrollExtent);
});
},
keyboardType: TextInputType.number,
),
),
... ... @@ -635,47 +652,239 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> {
)
],
),
VEmptyView(40),
MyDivider(ScreenUtil().setWidth(335 * 2), ScreenUtil().setWidth(2),
color: MyColours.color_F1F0F4),
VEmptyView(52),
TextField(
maxLines: 1,
inputFormatters: [LengthLimitingTextInputFormatter(25)],
//输入文本的样式
style: TextStyle(
fontSize: ScreenUtil().setSp(34),
color: MyColours.color_353535),
controller: _notebookDetailChangeModel.customController,
focusNode: _needNode,
// textAlignVertical: TextAlignVertical.top,
decoration: InputDecoration(
hintText: "客户要求(25字以内,选填)",
hintStyle: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(34),
Stack(
children: [
Column(
mainAxisSize: MainAxisSize.min,
children: [
VEmptyView(40),
MyDivider(
ScreenUtil().setWidth(335 * 2), ScreenUtil().setWidth(2),
color: MyColours.color_F1F0F4),
VEmptyView(52),
Row(
children: [
Expanded(
child: TextField(
maxLines: 1,
inputFormatters: [LengthLimitingTextInputFormatter(25)],
//输入文本的样式
style: TextStyle(
fontSize: ScreenUtil().setSp(34),
color: MyColours.color_353535),
controller: _notebookDetailChangeModel.customController,
focusNode: _needNode,
// textAlignVertical: TextAlignVertical.top,
decoration: InputDecoration(
hintText: "客户要求(25字以内,选填)",
hintStyle: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(34),
),
// contentPadding:
// EdgeInsets.only(bottom: ScreenUtil().setWidth(17)),
border: InputBorder.none,
),
onChanged: (value) {
print(value);
currentRemark = value;
// print();
},
onEditingComplete: () {
print('fff');
_needNode.unfocus();
},
// keyboardType: TextInputType.number,
)),
InkWell(
onTap: () {
DialogUtil.showRemarkDialog(
context, remarkManagerModel.ofenRemarks, (item) {
int index =
remarkManagerModel.ofenRemarks.indexOf(item);
_refreshRemark(remarkManagerModel.ofenRemarks, index);
});
},
child: Container(
margin:
EdgeInsets.only(left: ScreenUtil().setWidth(40)),
width: ScreenUtil().setWidth(122),
height: ScreenUtil().setWidth(42),
child: Text(
'快速备注',
style: TextStyle(
fontSize: ScreenUtil().setSp(30),
color: MyColours.color_199095),
),
),
),
],
),
VEmptyView(40),
MyDivider(
ScreenUtil().setWidth(335 * 2), ScreenUtil().setWidth(2),
color: MyColours.color_F1F0F4),
VEmptyView(30),
_remarkListWidget()
],
),
// contentPadding:
// EdgeInsets.only(bottom: ScreenUtil().setWidth(17)),
border: InputBorder.none,
),
onChanged: (value) {},
onEditingComplete: () {
print('fff');
_needNode.unfocus();
},
// keyboardType: TextInputType.number,
),
VEmptyView(40),
MyDivider(ScreenUtil().setWidth(335 * 2), ScreenUtil().setWidth(2),
color: MyColours.color_F1F0F4),
// VEmptyView(72),
Offstage(
offstage: !(showPhoneHistory &&
_notebookDetailChangeModel.userHistorys.length > 0),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
border: Border.all(color: Colors.white),
color: MyColours.color_ffffff,
boxShadow: [
BoxShadow(
color: MyColours.color_e5e5e5,
blurRadius: ScreenUtil().setWidth(20))
]),
width: ScreenUtil().setWidth(440),
height: _notebookDetailChangeModel.userHistorys.length>1?ScreenUtil().setWidth(208):ScreenUtil().setWidth(104),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(30)),
child: Align(
alignment: Alignment.topCenter,
child: MediaQuery.removePadding(context: context, removeTop:true,child: ListView.builder(
itemBuilder: (context, index) {
return GestureDetector(
onTap: () {
setState(() {
showPhoneHistory = false;
_notebookDetailChangeModel
.phoneController.text =
_notebookDetailChangeModel
.userHistorys[index].phone;
_notebookDetailChangeModel.nameController.text =
_notebookDetailChangeModel
.userHistorys[index].rname;
_phoneNode.unfocus();
_notebookDetailChangeModel.userHistorys.clear();
});
},
child: Container(
width: double.infinity,
height: ScreenUtil().setWidth(102),
decoration: BoxDecoration(
border: Border(
bottom: (index !=
(_notebookDetailChangeModel
.userHistorys.length -
1) &&
_notebookDetailChangeModel
.userHistorys.length >
1)
? BorderSide(
color: MyColours.color_e5e5e5,
width: ScreenUtil().setWidth(2))
: BorderSide.none)),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
_notebookDetailChangeModel
.userHistorys[index].phone,
style: TextStyle(
color: MyColours.color_333333,
fontSize: ScreenUtil().setSp(32)),
),
Text(
_notebookDetailChangeModel
.userHistorys[index].rname,
style: TextStyle(
color: MyColours.color_333333,
fontSize: ScreenUtil().setSp(32)),
)
],
),
),
);
},
itemExtent: ScreenUtil().setWidth(104),
itemCount:
_notebookDetailChangeModel.userHistorys.length,
))
),
),
)
],
)
// VEmptyView(62),
],
),
);
}
_remarkListWidget() {
List<Remark> remark = [];
if (remarkManagerModel.ofenRemarks.length > 4) {
remark = remarkManagerModel.ofenRemarks.sublist(0, 5);
} else {
remark = remarkManagerModel.ofenRemarks;
}
return Container(
height: ScreenUtil().setWidth(50),
child: ListView.builder(
shrinkWrap: true,
itemCount: remark.length,
scrollDirection: Axis.horizontal,
itemBuilder: (BuildContext contxt, int index) {
return remarkButton(
content: remark[index].custom,
isSelect: remark[index].selected,
onPress: () {
setState(() {
remark[index].selected = !remark[index].selected;
});
_refreshRemark(remark, index);
});
}),
);
}
_refreshRemark(List<Remark> remark, int index) {
if (remark[index].selected) {
if (currentRemark.length == 0) {
currentRemark += '${remark[index].custom}';
} else {
if (!currentRemark.contains(remark[index].custom)) {
if (currentRemark.endsWith('、')) {
currentRemark += '${remark[index].custom}';
} else {
currentRemark += '、${remark[index].custom}';
}
}
}
} else {
if (currentRemark.contains(remark[index].custom)) {
int start = currentRemark.indexOf(remark[index].custom);
int end = start + remark[index].custom.length;
currentRemark = currentRemark.replaceRange(start, end, '');
if (currentRemark.endsWith('、')) {
currentRemark = currentRemark.substring(0, currentRemark.length - 1);
}
if (currentRemark.startsWith('、')) {
currentRemark = currentRemark.substring(1, currentRemark.length);
}
if (currentRemark.contains('、、')) {
currentRemark = currentRemark.replaceRange(
currentRemark.indexOf('、、'),
currentRemark.indexOf('、、') + 2,
'、');
}
}
}
if (currentRemark.length > 25) {
currentRemark = currentRemark.substring(0, 25);
}
setState(() {
_notebookDetailChangeModel.customController.text = currentRemark;
});
}
///底部弹框,设置时间30分钟间隔布局
_showDateChooseWidget(BuildContext context) async {
List tempMndList = [];
... ... @@ -689,18 +898,9 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> {
tempMndList = _notebookDetailChangeModel.dailyMap[key];
}
}
//计算行数
int line = 0;
int count = tempMndList.length;
if (count % 3 == 0) {
line = int.parse('${count / 3}');
} else {
line = (count / 3).ceil();
}
int height = 85 + 40 + 36 * line + (line - 1) * 15;
final option = await showModalBottomSheet(
context: context,
isScrollControlled: true,
backgroundColor: Colors.white,
builder: (context) {
return StatefulBuilder(builder: (context, state) {
... ... @@ -709,8 +909,8 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> {
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(ScreenUtil().setWidth(10))),
height: ScreenUtil().setWidth(height * 2),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
InkWell(
onTap: () {
... ... @@ -739,10 +939,10 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> {
fontWeight: FontWeight.bold,
color: MyColours.color_353535)),
),
VEmptyView(40),
Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(60)),
horizontal: ScreenUtil().setWidth(60),
vertical: ScreenUtil().setWidth(40)),
child: GridView.builder(
padding:
EdgeInsets.only(top: ScreenUtil().setWidth(20)),
... ... @@ -838,7 +1038,12 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> {
if (permissionStatus == PermissionStatus.neverAskAgain) {
//用户选择不在弹出权限提示框
print('never');
DialogUtil.openAlertDialog(context);
DialogUtil.openAlertDialog(
context, '未获得通讯录权限', "请在手机的权限管理里,将通讯录权限开启", '去设置', 340.0,
onTap: () {
openSetting();
Navigator.pop(context, '');
});
} else {
// 申请权限
bool canContacts = await requestContactPermission();
... ... @@ -846,7 +1051,12 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> {
_getContactData();
} else {
//拒绝通讯录权限 , 苹果拒绝权限后,不再提示权限框,进入此处
DialogUtil.openAlertDialog(context);
DialogUtil.openAlertDialog(
context, '未获得通讯录权限', "请在手机的权限管理里,将通讯录权限开启。", '去设置', 340.0,
onTap: () {
openSetting();
Navigator.pop(context, '');
});
}
}
} else {
... ... @@ -866,7 +1076,6 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> {
} else {
fullName = contact.fullName;
}
_notebookDetailChangeModel.phoneController.text = contact.phoneNumber;
_notebookDetailChangeModel.nameController.text = fullName;
});
... ... @@ -876,6 +1085,7 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> {
Widget build(BuildContext context) {
_notebookDetailChangeModel =
Provider.of<NotebookDetailChangeModel>(context, listen: true);
remarkManagerModel = Provider.of<RemarkManagerModel>(context, listen: true);
return GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: () {
... ... @@ -891,9 +1101,14 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> {
),
Expanded(
child: SingleChildScrollView(
controller: _controller,
child: Column(
children: [_topWidget(), _middleWidget(), _bottomWidget()],
))),
children: [
_topWidget(),
_middleWidget(),
_bottomWidget()
],
))),
Container(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40),
... ... @@ -1001,12 +1216,14 @@ class CustomButton extends StatefulWidget {
this.model,
this.height = 25,
}) : super(key: key);
@override
_ButtonState createState() => _ButtonState();
}
class _ButtonState extends State<CustomButton> {
FocusNode _cancelNode = FocusNode();
@override
Widget build(BuildContext context) {
String imgStrSelect = widget.isImage && !widget.isTextFiled
... ... @@ -1134,3 +1351,29 @@ class _ButtonState extends State<CustomButton> {
);
}
}
Widget remarkButton({GestureTapCallback onPress, content, isSelect = false}) {
return InkWell(
onTap: onPress,
child: Container(
height: ScreenUtil().setHeight(48),
margin: EdgeInsets.only(right: ScreenUtil().setWidth(20)),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(20),
vertical: ScreenUtil().setWidth(6)),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10)),
color: isSelect ? MyColours.color_199095 : MyColours.color_f5f5f5,
),
child: Align(
alignment: Alignment.center,
child: Text(
content,
style: TextStyle(
color: isSelect ? Colors.white : MyColours.color_353535,
fontSize: ScreenUtil().setSp(28)),
),
),
),
);
}
... ...
... ... @@ -134,6 +134,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
/// 开启DEBUG
XgFlutterPlugin().setEnableDebug(false);
/// 添加回调事件
XgFlutterPlugin().addEventHandler(
onRegisteredDeviceToken: (String msg) async {
... ... @@ -434,9 +435,9 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
_currIndex = index;
});
if (_currIndex == 3) {
Utils.changeStatusColor(color: MyColours.color_199095);
Utils.changeStatusColor(color: Colors.transparent);
} else {
Utils.changeStatusColor(color: MyColours.color_ffffff);
Utils.changeStatusColor(color: Colors.white);
}
}
},
... ...
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:one_key/utils/event_bus.dart';
import 'package:one_key/widgets/system_app_bar.dart';
import 'package:webview_flutter/webview_flutter.dart';
... ... @@ -14,7 +15,9 @@ class WebPage extends StatelessWidget {
final Completer<WebViewController> _controller =
Completer<WebViewController>();
return Scaffold(
appBar: SystemAppBar(title),
appBar: SystemAppBar(title, onTap: () {
Navigator.of(context).pop();
}),
body: WebView(
initialUrl: "http://colorcun.com/privacy1.html",
javascriptMode: JavascriptMode.unrestricted,
... ... @@ -31,9 +34,7 @@ class WebPage extends StatelessWidget {
}
return NavigationDecision.navigate;
},
onPageStarted: (String url) {
},
onPageStarted: (String url) {},
onPageFinished: (String url) {
// Loading.hideLoading(context);
},
... ...
import 'package:common_utils/common_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/models/message.dart';
import 'package:one_key/pages/detail/handle_online_page.dart';
import 'package:one_key/pages/home/home_page.dart';
import 'package:one_key/provider/message_dialog_model.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
... ... @@ -10,6 +13,8 @@ import 'package:one_key/widgets/h_empty_view.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
import '../../app.dart';
class MessageDialogItem extends StatelessWidget {
final Message message;
... ...
import 'package:common_utils/common_utils.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/screenutil.dart';
import 'package:one_key/models/seller_info.dart';
import 'package:one_key/models/set_seller_info_model.dart';
import 'package:one_key/models/settime.dart';
import 'package:one_key/provider/book_set_time_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/utils/dialog_util.dart';
import 'package:one_key/utils/event_bus.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/MyDivider.dart';
import 'package:one_key/widgets/common_button.dart';
import 'package:one_key/widgets/h_empty_view.dart';
import 'package:one_key/widgets/set_time_widget.dart';
import 'package:one_key/widgets/system_app_bar.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
typedef BookTimeSetCallback = void Function(bool needChange);
class BookTimeSetPage extends StatefulWidget {
BookTimeSetPage({Key key}) : super(key: key);
@override
_BookTimeSetPageState createState() => _BookTimeSetPageState();
}
class _BookTimeSetPageState extends State<BookTimeSetPage> {
List swichState;
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
SetTime morning = SetTime();
SetTime noon = SetTime();
SetTime night = SetTime();
BookSetTimeModel bookSetTimeModel;
@override
void initState() {
super.initState();
morning.start = '07:00';
morning.end = '10:00';
noon.start = '11:00';
noon.end = '14:30';
night.start = '16:00';
night.end = '21:00';
swichState = [false, true, true];
WidgetsBinding.instance.addPostFrameCallback((_) {
_getDailyTime();
});
}
/// 从接口获取可订时段信息 daily
_getDailyTime() async {
SunSellerInfoModel model = await bookSetTimeModel.getManagersInfo(context);
setState(() {
if (model.daily.morning.isNotEmpty) {
List temp = model.daily.morning.split('-');
morning.start = temp.length > 0 ? temp[0] : '07:00';
morning.end = temp.length > 1 ? temp[1] : '10:00';
swichState[0] = true;
} else {
swichState[0] = false;
}
if (model.daily.noon.isNotEmpty) {
List temp = model.daily.noon.split('-');
noon.start = temp.length > 0 ? temp[0] : '11:00';
noon.end = temp.length > 1 ? temp[1] : '14:30';
swichState[1] = true;
} else {
swichState[1] = false;
noon.start = '11:00';
noon.end = '14:30';
}
if (model.daily.night.isNotEmpty) {
List temp = model.daily.night.split('-');
night.start = temp.length > 0 ? temp[0] : '16:00';
night.end = temp.length > 1 ? temp[1] : '21:00';
swichState[2] = true;
} else {
swichState[2] = false;
night.start = '16:00';
night.end = '21:00';
}
if (swichState[0] == false) {
if (model.daily.noon.isNotEmpty) {
Utils.compareDateTime(noon.start, morning.end, (needChange) {
if (needChange) {
morning.end = noon.start;
} else {
morning.end = '10:00';
}
});
Utils.compareDateTime(noon.start, morning.start, (needChange) {
if (needChange) {
morning.start = noon.start;
} else {
morning.start = '07:00';
}
});
} else if (model.daily.night.isNotEmpty) {
Utils.compareDateTime(night.start, morning.end, (needChange) {
if (needChange) {
morning.end = night.start;
} else {
morning.end = '10:00';
}
});
Utils.compareDateTime(night.start, morning.start, (needChange) {
if (needChange) {
morning.start = night.start;
} else {
morning.start = '07:00';
}
});
}
}
if (swichState[1] == false) {
if (model.daily.morning.isNotEmpty) {
Utils.compareDateTime(noon.start, morning.end, (needChange) {
if (needChange) {
noon.start = morning.end;
} else {
noon.start = '11:00';
}
});
Utils.compareDateTime(noon.end, morning.end, (needChange) {
if (needChange) {
noon.end = morning.end;
} else {
Utils.compareDateTime(noon.end, night.start, (needChange) {
if (needChange) {
noon.end = '14:30';
} else {
noon.end = night.start;
}
});
}
});
}
if (model.daily.night.isNotEmpty) {
Utils.compareDateTime(noon.start, night.start, (needChange) {
if (!needChange) {
noon.start = night.start;
}
});
Utils.compareDateTime(noon.end, night.start, (needChange) {
if (!needChange) {
noon.end = night.start;
}
});
}
}
if (swichState[2] == false) {
if (model.daily.noon.isNotEmpty) {
Utils.compareDateTime(night.start, noon.end, (needChange) {
if (needChange) {
night.start = noon.end;
Utils.compareDateTime(night.end, noon.end, (needChange) {
if (needChange) {
night.end = noon.end;
}
});
}
});
Utils.compareDateTime(night.end, noon.start, (needChange) {
if (needChange) {
night.end = noon.start;
}
});
} else if (model.daily.morning.isNotEmpty) {
Utils.compareDateTime(night.start, morning.end, (needChange) {
if (needChange) {
night.start = morning.end;
Utils.compareDateTime(night.end, noon.end, (needChange) {
if (needChange) {
night.end = morning.end;
}
});
}
});
Utils.compareDateTime(night.start, morning.start, (needChange) {
if (needChange) {
night.start = morning.start;
}
});
}
}
});
}
///item 早市,晚市,午时widhet
Widget _itemWidget(String title, String startTime, String endTime, int tag) {
return Container(
color: MyColours.color_ffffff,
child: Column(
children: [
Padding(
padding:
EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(40)),
child: Container(
height: ScreenUtil().setWidth(124),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(title,
style: TextStyle(
color: MyColours.color_353535,
fontSize: ScreenUtil().setSp(32),
fontWeight: FontWeight.bold)),
InkWell(
onTap: () {
setState(() {
swichState[tag] = !swichState[tag];
});
},
child: Image.asset(
swichState[tag]
? Utils.getImgPath('swich_on')
: Utils.getImgPath('swich_off'),
width: ScreenUtil().setWidth(122),
height: ScreenUtil().setWidth(82),
),
)
],
),
)),
MyDivider(
double.infinity,
ScreenUtil().setWidth(2),
color: MyColours.color_f3f3f3,
),
timeWidget('开始时间', startTime, highted: swichState[tag], onTap: () {
if (swichState[tag]) {
List data = SetTimeWidget.dateData;
if (tag == 0) {
//早市
data = SetTimeWidget.dateData;
} else if (tag == 1) {
//午市
data =
Utils.getPickerData(morning.end, SetTimeWidget.dateData);
} else if (tag == 2) {
//晚市
data = Utils.getPickerData(noon.end, SetTimeWidget.dateData);
}
SetTimeWidget().showTimeSelector(context, data, startTime,
(value) {
if (value != null) {
String tempMinute = _getMinuteStrFromPicker(data, value);
print(data[value[0]].keys.first);
String time = Utils.getTimeString(
Utils.getHourFromTitle(data[value[0]].keys.first),
tempMinute);
setState(() {
if (tag == 0) {
//早市
morning.start = time;
setState(() {
Utils.compareDateTime(morning.end, time,
(needChange) {
if (needChange) {
morning.end = time;
}
});
Utils.compareDateTime(noon.start, time, (needChange) {
if (needChange) {
noon.start = time;
}
});
Utils.compareDateTime(noon.end, time, (needChange) {
if (needChange) {
noon.end = time;
}
});
Utils.compareDateTime(night.start, time,
(needChange) {
if (needChange) {
night.start = time;
}
});
Utils.compareDateTime(night.end, time, (needChange) {
if (needChange) {
night.end = time;
}
});
});
} else if (tag == 1) {
//午市
noon.start = time;
setState(() {
Utils.compareDateTime(noon.end, time, (needChange) {
if (needChange) {
noon.end = time;
}
});
Utils.compareDateTime(night.start, time,
(needChange) {
if (needChange) {
night.start = time;
}
});
Utils.compareDateTime(night.end, time, (needChange) {
if (needChange) {
night.end = time;
}
});
});
} else if (tag == 2) {
//晚市
night.start = time;
setState(() {
Utils.compareDateTime(night.end, time, (needChange) {
if (needChange) {
night.end = time;
}
});
});
}
});
print(value);
}
});
}
}),
Padding(
padding:
EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(40)),
child: MyDivider(
double.infinity,
ScreenUtil().setWidth(2),
color: MyColours.color_f3f3f3,
)),
timeWidget('结束时间', endTime, highted: swichState[tag], onTap: () {
if (swichState[tag]) {
List data = SetTimeWidget.dateData;
if (tag == 0) {
//早市
data = Utils.getPickerData(
morning.start, SetTimeWidget.dateData);
} else if (tag == 1) {
//午市
data =
Utils.getPickerData(noon.start, SetTimeWidget.dateData);
} else if (tag == 2) {
//晚市
data =
Utils.getPickerData(night.start, SetTimeWidget.dateData);
}
SetTimeWidget().showTimeSelector(context, data, startTime,
(value) {
if (value != null) {
String tempMinute = _getMinuteStrFromPicker(data, value);
String time = Utils.getTimeString(
Utils.getHourFromTitle(data[value[0]].keys.first),
tempMinute);
setState(() {
if (tag == 0) {
//早市
morning.end = time;
setState(() {
Utils.compareDateTime(noon.start, time, (needChange) {
if (needChange) {
noon.start = time;
}
});
Utils.compareDateTime(noon.end, time, (needChange) {
if (needChange) {
noon.end = time;
}
});
Utils.compareDateTime(night.start, time,
(needChange) {
if (needChange) {
night.start = time;
}
});
Utils.compareDateTime(night.end, time, (needChange) {
if (needChange) {
night.end = time;
}
});
});
} else if (tag == 1) {
//午市
noon.end = time;
setState(() {
Utils.compareDateTime(night.start, time,
(needChange) {
if (needChange) {
night.start = time;
}
});
Utils.compareDateTime(night.end, time, (needChange) {
if (needChange) {
night.end = time;
}
});
});
} else if (tag == 2) {
//晚市
night.end = time;
}
});
print(value);
}
});
}
})
],
));
}
///从时间选择器中获取分钟数字符串 00 or 30
String _getMinuteStrFromPicker(List data, List value) {
if (data.length == 1) {
return '30';
} else {
if (value[1] == 0) {
return '00';
} else {
return '30';
}
}
}
///底部widget
///
_bottomWidget() {
return Container(
padding: EdgeInsets.fromLTRB(
ScreenUtil().setWidth(40),
ScreenUtil().setWidth(60),
ScreenUtil().setWidth(40),
ScreenUtil().setWidth(60),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
textWidget('温馨提示:'),
VEmptyView(10),
textWidget('1.时段停用,表示餐厅将不支持该时段的预订;'),
VEmptyView(10),
textWidget('2.修改起始时间后,为确保正常生效,建议重启话机。'),
],
),
);
}
@override
Widget build(BuildContext context) {
bookSetTimeModel = Provider.of<BookSetTimeModel>(context, listen: true);
return WillPopScope(
child: Scaffold(
key: _scaffoldKey,
backgroundColor: MyColours.color_f5f5f5,
appBar: SystemAppBar(
'可订时段',
onTap: () {
EventBus().emit('changeStatusColor');
Navigator.of(context).pop();
},
),
body: SafeArea(
child: Column(
children: [
Expanded(
child: SingleChildScrollView(
child: Column(
children: [
_itemWidget('早市', morning.start, morning.end, 0),
VEmptyView(20),
_itemWidget('午市', noon.start, noon.end, 1),
VEmptyView(20),
_itemWidget('晚市', night.start, night.end, 2),
_bottomWidget()
],
),
)),
Padding(
padding: EdgeInsets.fromLTRB(
ScreenUtil().setWidth(40),
ScreenUtil().setWidth(0),
ScreenUtil().setWidth(40),
ScreenUtil().setWidth(60)),
child: CommonButton(
width: double.infinity,
height: 84,
fontSize: 34,
content: '保存',
state: 2,
onPress: () async {
String morningStr = '';
String noonStr = '';
String nightStr = '';
if (swichState[0]) {
morningStr = Utils.getTimelLongString(
morning.start, morning.end);
}
if (swichState[1]) {
noonStr =
Utils.getTimelLongString(noon.start, noon.end);
}
if (swichState[2]) {
nightStr =
Utils.getTimelLongString(night.start, night.end);
}
DialogUtil.confirmTimeAlertDialog(
context, morningStr, noonStr, nightStr, () async {
///接口
///
SetSellerInfoSunModel sunModel = await bookSetTimeModel
.setSellerInfoById(context, {
'morning': morningStr,
'noon': noonStr,
'night': nightStr
});
if (sunModel != null) {
//修改成功
Utils.showToast('保存成功');
EventBus().emit('changeStatusColor');
Navigator.pop(context);
} else {
// Utils.showToast('保存失败');
}
});
},
))
],
)),
),
onWillPop: () async {
EventBus().emit('changeStatusColor');
return true;
});
}
}
/// 开始时间和结束时间widget
timeWidget(String title, String time,
{bool highted = true, GestureTapCallback onTap}) {
return InkWell(
onTap: onTap,
child: Padding(
padding: EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(40)),
child: Container(
height: ScreenUtil().setWidth(124),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(title,
style: TextStyle(
color: highted
? MyColours.color_353535
: MyColours.color_999999,
fontSize: ScreenUtil().setSp(30),
)),
Spacer(),
Text(time,
style: TextStyle(
color: highted
? MyColours.color_353535
: MyColours.color_999999,
fontSize: ScreenUtil().setSp(30),
)),
HEmptyView(20),
Image.asset(
Utils.getImgPath('arrow_right_new'),
width: ScreenUtil().setWidth(16),
height: ScreenUtil().setWidth(28),
)
],
),
)));
}
///文本widget
///
textWidget(String title) {
return Container(
height: ScreenUtil().setWidth(40),
child: Text(
title,
style: TextStyle(
color: MyColours.color_353535, fontSize: ScreenUtil().setSp(28)),
),
);
}
... ...
... ... @@ -6,6 +6,8 @@ import 'package:one_key/provider/my_model.dart';
import 'package:one_key/provider/update_model.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/utils/event_bus.dart';
import 'package:one_key/utils/navigator_util.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/MyDivider.dart';
import 'package:one_key/widgets/app_bar.dart';
... ... @@ -28,11 +30,14 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
String cur_version = "";
bool newVersion = false;
MyModel myModel;
ScrollController controller;
@override
void initState() {
// TODO: implement initState
super.initState();
controller = ScrollController(initialScrollOffset: 0.0);
WidgetsBinding.instance.addObserver(this);
Utils.getCurrVersion().then((version) {
setState(() {
... ... @@ -43,6 +48,16 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
///获取短信余量
_getSmsInfo(context);
});
EventBus().on('changeStatusColor', (arg) {
Utils.changeStatusColor(color: Colors.transparent);
});
}
@override
void dispose() {
// TODO: implement dispose
super.dispose();
EventBus().off('changeStatusColor');
}
@override
... ... @@ -70,6 +85,7 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
///获取短信余量
_getSmsInfo(context) async {
myModel = Provider.of<MyModel>(context, listen: false);
await myModel.getSmsInfo(context);
// setState(() {
// if (smsInfoData != null) {
... ... @@ -87,12 +103,110 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
@override
Widget build(BuildContext context) {
myModel = Provider.of<MyModel>(context, listen: true);
return Stack(
children: <Widget>[
Padding(
padding: EdgeInsets.only(top: ScreenUtil().setHeight(242 + 121)),
child: Column(
return Scaffold(
appBar: AppBar(
backgroundColor: MyColours.color_199095, //把appbar的背景色改成透明
elevation: 0, //appbar的阴影
centerTitle: true, // 标题居中
title: Text(
'我的',
style: TextStyle(
color: MyColours.color_fefefe,
fontSize: ScreenUtil().setSp(34),
fontWeight: FontWeight.normal,
decoration: TextDecoration.none),
)),
body: NestedScrollView(
// controller: _scrollViewController,
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
return <Widget>[
SliverAppBar(
pinned: false,
floating: false,
expandedHeight: ScreenUtil().setWidth(200),
flexibleSpace: FlexibleSpaceBar(
collapseMode: CollapseMode.pin,
background: Consumer<UserModel>(builder:
(BuildContext context, UserModel model, Widget child) {
return Stack(
children: [
Container(
width: double.infinity,
height: ScreenUtil().setHeight(200),
alignment: Alignment.centerLeft,
color: MyColours.color_199095,
),
Padding(
padding:
EdgeInsets.only(left: ScreenUtil().setWidth(40)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
VEmptyView(38),
Text(
model.user.sellername,
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(36)),
),
VEmptyView(38),
Text(
model.user.account +
" | " +
model.user.role_name,
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(30)),
),
],
))
],
);
}),
),
)
];
}, body: Consumer<UserModel>(
builder: (BuildContext context, UserModel model, Widget child) {
return MediaQuery.removePadding(
context: context,
child: SingleChildScrollView(
child: Column(
children: <Widget>[
// Stack(
// children: [
// Container(
// width: double.infinity,
// height: ScreenUtil().setHeight(200),
// alignment: Alignment.centerLeft,
// color: MyColours.color_199095,
// ),
// Padding(
// padding:
// EdgeInsets.only(left: ScreenUtil().setWidth(40)),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// VEmptyView(38),
// Text(
// model.user.sellername,
// style: TextStyle(
// color: MyColours.color_ffffff,
// fontSize: ScreenUtil().setSp(36)),
// ),
// VEmptyView(38),
// Text(
// model.user.account +
// " | " +
// model.user.role_name,
// style: TextStyle(
// color: MyColours.color_ffffff,
// fontSize: ScreenUtil().setSp(30)),
// ),
// ],
// ))
// ],
// ),
VEmptyView(40),
MyItem(
title: "短信管理",
... ... @@ -114,6 +228,42 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
Utils.goMiniProgramZm(context, "roomtype/roomtype");
},
),
MyDivider(
double.infinity,
ScreenUtil().setHeight(1),
color: MyColours.color_f3f3f3,
),
MyItem(
title: "可订时段管理",
content: "",
callback: () {
NavigatorUtil.goBookTimeSetPage(context);
},
),
MyDivider(
double.infinity,
ScreenUtil().setHeight(1),
color: MyColours.color_f3f3f3,
),
MyItem(
title: "接单时间管理",
content: "",
callback: () {
NavigatorUtil.goReceiveOrdersTimeSetPage(context);
},
),
MyDivider(
double.infinity,
ScreenUtil().setHeight(1),
color: MyColours.color_f3f3f3,
),
MyItem(
title: "常用备注管理",
content: "",
callback: () {
NavigatorUtil.goRemarkManagerPage(context);
},
),
VEmptyView(40),
MyItem(
title: "联系客服",
... ... @@ -229,215 +379,8 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
},
)
],
)),
Container(
width: double.infinity,
height: ScreenUtil().setHeight(242 + 121),
alignment: Alignment.centerLeft,
color: MyColours.color_199095,
child: Scaffold(
backgroundColor: Colors.transparent, //把scaffold的背景色改成透明
appBar: AppBar(
backgroundColor: Colors.transparent, //把appbar的背景色改成透明
elevation: 0, //appbar的阴影
centerTitle: true, // 标题居中
title: Text(
'我的',
style: TextStyle(
color: MyColours.color_fefefe,
fontSize: ScreenUtil().setSp(34),
fontWeight: FontWeight.normal,
decoration: TextDecoration.none),
)),
body: Consumer<UserModel>(
builder:
(BuildContext context, UserModel model, Widget child) {
return Padding(
padding:
EdgeInsets.only(left: ScreenUtil().setWidth(40)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
VEmptyView(38),
Text(
model.user.sellername,
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(36)),
),
VEmptyView(38),
Text(
model.user.account +
" | " +
model.user.role_name,
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(30)),
),
],
));
},
)))
],
);
// TODO: implement build
/* 原来的
return Container(
width: double.infinity,
height: double.infinity,
color: MyColours.color_f5f5f5,
child: Column(
children: <Widget>[
MyAppBar(
"我的",
showBack: false,
backgroundColor: MyColours.color_199095,
fontColor: MyColours.color_fefefe,
),
Container(
width: double.infinity,
height: ScreenUtil().setHeight(242),
alignment: Alignment.centerLeft,
padding: EdgeInsets.only(left: ScreenUtil().setWidth(40)),
color: MyColours.color_199095,
child: Consumer<UserModel>(
builder: (BuildContext context, UserModel model, Widget child) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
VEmptyView(38),
Text(
model.user.sellername,
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(36)),
),
VEmptyView(38),
Text(
model.user.account + " | " + model.user.role_name,
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(30)),
),
],
);
},
)),
VEmptyView(44),
MyItem(
title: "联系客服",
content: "09:00~21:00",
callback: () {
Utils.goPhone("400-000-9690");
},
),
MyDivider(
double.infinity,
ScreenUtil().setHeight(1),
color: MyColours.color_f3f3f3,
),
MyItem(
title: "帮助与反馈",
content: "",
callback: () {
Utils.goHelp(context);
},
),
MyDivider(double.infinity, ScreenUtil().setHeight(1),
color: MyColours.color_f3f3f3),
GestureDetector(
onTap: checkUpdate,
child: Container(
width: double.infinity,
height: ScreenUtil().setHeight(122),
color: MyColours.color_ffffff,
padding:
EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(40)),
alignment: Alignment.center,
child: Row(
children: <Widget>[
Text(
"版本更新",
style: TextStyle(
fontSize: ScreenUtil().setSp(30),
color: MyColours.color_353535),
),
Spacer(),
newVersion
? Container(
width: ScreenUtil().setWidth(120),
height: ScreenUtil().setWidth(34),
decoration: BoxDecoration(
color: MyColours.color_E14553,
borderRadius: BorderRadius.all(
Radius.circular(ScreenUtil().setWidth(6))),
),
child: Center(
child: Text(
"发现新版本",
style: TextStyle(
fontSize: ScreenUtil().setSp(24),
color: MyColours.color_ffffff),
),
),
)
: Text(
cur_version,
style: TextStyle(
fontSize: ScreenUtil().setSp(28),
color: MyColours.color_666666),
),
HEmptyView(20),
Image.asset(
"assets/arr_right_gray.png",
width: ScreenUtil().setWidth(14),
height: ScreenUtil().setWidth(22),
)
],
),
),
),
MyDivider(
double.infinity,
ScreenUtil().setHeight(1),
color: MyColours.color_f3f3f3,
),
VEmptyView(40),
Consumer<UserModel>(
builder: (BuildContext context, UserModel model, Widget child) {
return GestureDetector(
onTap: () {
model.showLoginOutDialog(context);
},
child: Container(
height: ScreenUtil().setHeight(122),
color: MyColours.color_ffffff,
child: Center(
child: Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Image.asset(
"assets/icon_exist.png",
width: ScreenUtil().setWidth(30),
height: ScreenUtil().setWidth(30),
),
HEmptyView(18),
Text("退出登录",
style: TextStyle(
color: MyColours.color_199095,
fontSize: ScreenUtil().setSp(34),
))
],
),
),
),
);
},
)
],
),
)));
})),
);
*/
}
}
... ...
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/screenutil.dart';
import 'package:one_key/models/get_seller_info_model.dart';
import 'package:one_key/models/settime.dart';
import 'package:one_key/pages/my/book_time_set.dart';
import 'package:one_key/provider/book_set_time_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/utils/dialog_util.dart';
import 'package:one_key/utils/event_bus.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/MyDivider.dart';
import 'package:one_key/widgets/common_button.dart';
import 'package:one_key/widgets/set_time_widget.dart';
import 'package:one_key/widgets/system_app_bar.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
class ReceiveOrdersTimeSetPage extends StatefulWidget {
ReceiveOrdersTimeSetPage({Key key}) : super(key: key);
@override
_ReceiveOrdersTimeSetPageState createState() =>
_ReceiveOrdersTimeSetPageState();
}
class _ReceiveOrdersTimeSetPageState extends State<ReceiveOrdersTimeSetPage> {
SetTime receiveOrdersTime = SetTime();
BookSetTimeModel bookSetTimeModel;
@override
void initState() {
super.initState();
receiveOrdersTime.start = '08:00';
receiveOrdersTime.end = '23:00';
WidgetsBinding.instance.addPostFrameCallback((_) {
_getReceiveOrdersTime();
});
}
///获取接单时间接口
_getReceiveOrdersTime() async {
GetSellerInfoSunModel model = await bookSetTimeModel.getSellerById(context);
setState(() {
receiveOrdersTime.start = model.data.recStime;
receiveOrdersTime.end = model.data.recEtime;
});
}
///从时间选择器中获取分钟数字符串 00 or 30
String _getMinuteStrFromPicker(List value) {
if (value[1] == 0) {
return '00';
} else {
return '30';
}
}
@override
Widget build(BuildContext context) {
bookSetTimeModel = Provider.of<BookSetTimeModel>(context, listen: true);
return WillPopScope(
child: Scaffold(
backgroundColor: MyColours.color_f5f5f5,
appBar: SystemAppBar(
'接单时间',
onTap: () {
EventBus().emit('changeStatusColor');
Navigator.of(context).pop();
},
),
body: SafeArea(
child: Column(
children: [
Expanded(
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
height: ScreenUtil().setWidth(126 * 2),
color: MyColours.color_ffffff,
child: Column(
children: [
timeWidget('开始时间', receiveOrdersTime.start,
highted: true, onTap: () {
SetTimeWidget().showTimeSelector(
context,
SetTimeWidget.dateData,
receiveOrdersTime.start, (value) {
if (value != null) {
String tempMinute =
_getMinuteStrFromPicker(value);
String time = Utils.getTimeString(
Utils.getHourFromTitle(SetTimeWidget
.dateData[value[0]].keys.first),
tempMinute);
setState(() {
receiveOrdersTime.start = time;
});
}
});
}),
Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40)),
child: MyDivider(
double.infinity,
ScreenUtil().setWidth(2),
color: MyColours.color_f3f3f3,
)),
timeWidget('结束时间', receiveOrdersTime.end,
highted: true, onTap: () {
SetTimeWidget().showTimeSelector(
context,
SetTimeWidget.dateData,
receiveOrdersTime.end, (value) {
if (value != null) {
String tempMinute =
_getMinuteStrFromPicker(value);
String time = Utils.getTimeString(
Utils.getHourFromTitle(SetTimeWidget
.dateData[value[0]].keys.first),
tempMinute);
setState(() {
receiveOrdersTime.end = time;
});
}
});
}),
],
),
),
VEmptyView(60),
Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40)),
child: textWidget('温馨提示:'),
),
VEmptyView(10),
Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40)),
child: textWidget('修改接单时间后,必须重启话机才能正常生效。'))
],
),
)),
Padding(
padding: EdgeInsets.fromLTRB(
ScreenUtil().setWidth(40),
ScreenUtil().setWidth(0),
ScreenUtil().setWidth(40),
ScreenUtil().setWidth(60)),
child: CommonButton(
width: double.infinity,
height: 84,
fontSize: 34,
content: '保存',
state: 2,
onPress: () async {
bool isSuccess = await bookSetTimeModel.setReOrderTime(
context,
receiveOrdersTime.start,
receiveOrdersTime.end);
if (isSuccess) {
///弹出提示框
///
DialogUtil.openAlertDialog(
context, '接单时间已修改', '需要重启电话机才能生效', '知道了', 295,
fontSize: 30, onTap: () {
EventBus().emit('changeStatusColor');
Navigator.of(context).pop();
Navigator.of(context).pop();
});
}
},
))
],
)),
),
onWillPop: () async {
EventBus().emit('changeStatusColor');
return true;
});
}
}
... ...
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/screenutil.dart';
import 'package:one_key/constant/state.dart';
import 'package:one_key/models/remark.dart';
import 'package:one_key/provider/remark_manager_model.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/utils/event_bus.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/MyDivider.dart';
import 'package:one_key/widgets/h_empty_view.dart';
import 'package:one_key/widgets/page_exception.dart';
import 'package:one_key/widgets/system_app_bar.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
import '../../app.dart';
class RemarkManagerPage extends StatefulWidget {
@override
State<StatefulWidget> createState() {
// TODO: implement createState
return RemarkManagerPageState();
}
}
class RemarkManagerPageState extends State<RemarkManagerPage> {
RemarkManagerModel remarkManagerModel;
bool isAdding = false; //正在添加备注
TextEditingController _controller = TextEditingController();
FocusNode focusNode = FocusNode();
int alwaysCount = 0; //常用备注数
@override
void initState() {
// TODO: implement initState
super.initState();
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
_getRemarks(showPageLoading: true);
});
}
//获取备注
_getRemarks({bool showPageLoading = false}) {
Map<String, String> params = {
"uid": Provider.of<UserModel>(context, listen: false).user.openid
};
remarkManagerModel.getRemarks(context, params,
showPageLoading: showPageLoading);
}
//添加备注
_addRemark() async {
Map<String, String> params = {
"uid": Provider.of<UserModel>(context, listen: false).user.openid,
"custom": _controller.text
};
await remarkManagerModel.addRemark(context, params);
_getRemarks(showPageLoading: false); //添加完重新获取备注信息
}
//添加常用备注
_addCustomRemark(Remark remark) {
Map<String, String> params = {
"uid": Provider.of<UserModel>(context, listen: false).user.openid,
"kid": remark.id,
"flag": "custom"
};
remarkManagerModel.getRemarks(context, params);
}
//取消常用备注
_delCustomRemark(Remark remark) {
if (remark.id == "-1") return;
Map<String, String> params = {
"uid": Provider.of<UserModel>(context, listen: false).user.openid,
"kid": remark.id,
"flag": "often"
};
remarkManagerModel.getRemarks(context, params);
}
//构建常用备注
List<Widget> _buildAlwayItems() {
List<Widget> always = [];
for (Remark remark in remarkManagerModel.remarks) {
if (remark.oftenUse != null && remark.oftenUse.isNotEmpty)
always.add(Container(
height: ScreenUtil().setWidth(50),
decoration: BoxDecoration(
color: MyColours.color_199095,
borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10))),
child: Row(mainAxisSize: MainAxisSize.min, children: <Widget>[
Flexible(
child: Padding(
padding:
EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(20)),
child: Text(
"${remark.oftenUse}",
style: TextStyle(
fontSize: ScreenUtil().setSp(30),
color: MyColours.color_ffffff,
),
overflow: TextOverflow.ellipsis,
),
),
),
MyDivider(
ScreenUtil().setWidth(2),
ScreenUtil().setWidth(30),
color: MyColours.color_6AB6B9,
),
GestureDetector(
onTap: () {
setState(() {
remark.oftenUse = "";
});
_delCustomRemark(remark);
},
child: Padding(
padding: EdgeInsets.all(ScreenUtil().setWidth(10)),
child: Image.asset(
"assets/icon_remark_del.png",
width: ScreenUtil().setWidth(18),
height: ScreenUtil().setWidth(18),
),
))
]),
));
}
alwaysCount = always.length;
return always;
}
//构建所有备注
List<Widget> _buildAllItems() {
List<Widget> alls = [];
for (Remark remark in remarkManagerModel.remarks) {
alls.add(
GestureDetector(
onTap: () {
if (alwaysCount >= 10) {
Utils.showToast("最多添加10个常用备注");
return;
}
setState(() {
remark.oftenUse = remark.custom;
_addCustomRemark(remark);
});
},
child: Container(
height: ScreenUtil().setWidth(50),
padding:
EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(20)),
decoration:
(remark.oftenUse != null && remark.oftenUse.isNotEmpty)
? BoxDecoration(
color: MyColours.color_199095,
borderRadius:
BorderRadius.circular(ScreenUtil().setWidth(10)))
: BoxDecoration(
color: MyColours.color_ffffff,
borderRadius:
BorderRadius.circular(ScreenUtil().setWidth(10)),
border: Border.all(
color: MyColours.color_6AB6B9,
width: ScreenUtil().setWidth(2))),
child: Row(mainAxisSize: MainAxisSize.min, children: <Widget>[
Flexible(
child: Text(
"${remark.custom}",
style: TextStyle(
fontSize: ScreenUtil().setSp(30),
color:
(remark.oftenUse != null && remark.oftenUse.isNotEmpty)
? MyColours.color_ffffff
: MyColours.color_199095,
),
overflow: TextOverflow.ellipsis,
)),
]),
)),
);
}
alls.add(Stack(
children: [
isAdding
? Container(
width: ScreenUtil().setWidth(200),
height: ScreenUtil().setWidth(50),
alignment: Alignment.center,
padding:
EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(20)),
decoration: BoxDecoration(
border: Border.all(
color: MyColours.color_cccccc,
width: ScreenUtil().setWidth(2)),
borderRadius:
BorderRadius.circular(ScreenUtil().setWidth(10))),
child: TextField(
controller: _controller,
focusNode: focusNode,
autofocus: true,
textInputAction: TextInputAction.done,
textAlignVertical: TextAlignVertical.center,
keyboardType: TextInputType.text,
decoration: InputDecoration.collapsed(hintText: ""),
inputFormatters: [LengthLimitingTextInputFormatter(10)],
style: TextStyle(
color: MyColours.color_353535,
fontSize: ScreenUtil().setSp(30),
textBaseline: TextBaseline.alphabetic),
onEditingComplete: () {
if (_controller.text.isEmpty) {
setState(() {
isAdding = false;
return;
});
}
setState(() {
isAdding = false;
});
_addRemark();
_controller.clear();
},
))
: GestureDetector(
onTap: () {
if (remarkManagerModel.remarks.length >= 20) {
Utils.showToast("最多添加20个备注");
return;
}
if (alwaysCount >= 10) {
Utils.showToast("最多添加10个常用备注");
return;
}
setState(() {
isAdding = true;
});
},
child: Container(
width: ScreenUtil().setWidth(200),
height: ScreenUtil().setWidth(50),
alignment: Alignment.center,
decoration: BoxDecoration(
border: Border.all(
color: MyColours.color_cccccc,
width: ScreenUtil().setWidth(2)),
borderRadius:
BorderRadius.circular(ScreenUtil().setWidth(10))),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Image.asset(
"assets/icon_remark_add.png",
width: ScreenUtil().setWidth(30),
height: ScreenUtil().setWidth(30),
),
HEmptyView(10),
Text(
"添加备注",
style: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(30)),
)
],
),
),
)
],
));
return alls;
}
@override
Widget build(BuildContext context) {
// TODO: implement build
remarkManagerModel =
Provider.of<RemarkManagerModel>(context, listen: false);
return WillPopScope(
child: Scaffold(
backgroundColor: MyColours.color_ffffff,
appBar: SystemAppBar(
'常用备注管理',
onTap: () {
EventBus().emit('changeStatusColor');
Navigator.of(context).pop();
},
),
body: SafeArea(
child: Consumer<RemarkManagerModel>(
builder: (context, model, _) {
if (model.pageState != PageState.Success) {
return ExceptionPage(
pageState: model.pageState,
callback: () {
_getRemarks(showPageLoading: true);
},
emptyMsg: "暂时没有备注哦",
emptyImg: "empty_search",
showMsg: "加载中,请稍后...",
);
} else {
return Container(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
VEmptyView(60),
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
"我的常用备注",
style: TextStyle(
color: MyColours.color_353535,
fontSize: ScreenUtil().setSp(30),
fontWeight: FontWeight.bold),
),
Text(
"(最多添加10个)",
style: TextStyle(
color: MyColours.color_666666,
fontSize: ScreenUtil().setSp(26)),
),
],
),
Padding(
padding: EdgeInsets.symmetric(
vertical: ScreenUtil().setWidth(40)),
child: Wrap(
spacing: ScreenUtil().setWidth(20),
runSpacing: ScreenUtil().setWidth(20),
children: _buildAlwayItems()),
),
MyDivider(
double.infinity,
ScreenUtil().setWidth(2),
color: MyColours.color_f3f3f3,
),
VEmptyView(40),
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
"所有备注",
style: TextStyle(
color: MyColours.color_353535,
fontSize: ScreenUtil().setSp(30),
fontWeight: FontWeight.bold),
),
Text(
"(最多添加20个)",
style: TextStyle(
color: MyColours.color_666666,
fontSize: ScreenUtil().setSp(26)),
),
],
),
Padding(
padding: EdgeInsets.symmetric(
vertical: ScreenUtil().setWidth(40)),
child: Wrap(
spacing: ScreenUtil().setWidth(20),
runSpacing: ScreenUtil().setWidth(20),
children: _buildAllItems()),
)
],
),
);
}
},
),
)),
onWillPop: () async {
EventBus().emit('changeStatusColor');
return true;
});
}
}
... ...
... ... @@ -20,7 +20,6 @@ import 'package:one_key/widgets/page_exception.dart';
import 'package:provider/provider.dart';
class NoteBookPage extends StatefulWidget {
@override
State<StatefulWidget> createState() {
// TODO: implement createState
... ... @@ -41,6 +40,8 @@ class NoteBookPageState extends State<NoteBookPage> {
UserModel userModel;
int tabIndex = 0; //当前选中的tab 标签
@override
void initState() {
// TODO: implement initState
... ... @@ -68,7 +69,7 @@ class NoteBookPageState extends State<NoteBookPage> {
//初始化时间
_initTime() {
dateTime = DateTime.now();
dateText = Utils.addZeroNumber(dateTime.month) +
dateText = "${dateTime.year}年 "+Utils.addZeroNumber(dateTime.month) +
"月" +
Utils.addZeroNumber(dateTime.day) +
"日" +
... ... @@ -141,6 +142,9 @@ class NoteBookPageState extends State<NoteBookPage> {
"keywords": "",
"sort": "1"
};
if(tabIndex==1){
params["account"]=userModel.user.account;
}
model.getReserveList(context, params);
}
... ... @@ -180,6 +184,9 @@ class NoteBookPageState extends State<NoteBookPage> {
? "0" + dateTime.day.toString()
: dateTime.day.toString())
};
if(tabIndex==1){
params["account"]=userModel.user.account;
}
model.getReserveCountDay(context, params);
}
... ... @@ -256,7 +263,7 @@ class NoteBookPageState extends State<NoteBookPage> {
if (Utils.isOneDay(day, dateTime)) return; //日期没变
setState(() {
DateTime dateNow = DateTime.now();
dateText = Utils.addZeroNumber(day.month) +
dateText = "${day.year}年 "+Utils.addZeroNumber(day.month) +
"月" +
Utils.addZeroNumber(day.day) +
"日";
... ... @@ -275,6 +282,122 @@ class NoteBookPageState extends State<NoteBookPage> {
_reserveCountDay();
}
Widget _buildTabbar() {
Container container = Container(
color: MyColours.color_ffffff,
width: double.infinity,
padding: EdgeInsets.only(left: ScreenUtil().setWidth(20),top: ScreenUtil().setWidth(20)),
child: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Container(
padding: EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(20)),
child: GestureDetector(
onTap: () {
if(tabIndex==0)return;
setState(() {
tabIndex = 0;
_getReserveList();
_reserveCountDay();
});
},
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
"全部预订",
style: TextStyle(
color: tabIndex == 0
? MyColours.color_353535
: MyColours.color_999999,
fontSize: tabIndex == 0
? ScreenUtil().setSp(36)
: ScreenUtil().setSp(28),
fontWeight: tabIndex == 0
? FontWeight.bold
: FontWeight.normal),
),
Align(
alignment: Alignment.bottomCenter,
child: Container(
height: ScreenUtil().setWidth(6),
width: ScreenUtil().setWidth(60),
margin:
EdgeInsets.only(top: ScreenUtil().setWidth(8)),
decoration: tabIndex == 0
? BoxDecoration(color: MyColours.color_199095,borderRadius: BorderRadius.circular(
ScreenUtil()
.setWidth(
6)))
: BoxDecoration(
color: MyColours.color_ffffff,
borderRadius: BorderRadius.circular(
ScreenUtil()
.setWidth(
6))
),
),
),
],
)),
),
Container(
padding: EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(20)),
child: GestureDetector(
onTap: () {
if(tabIndex==1)return;
setState(() {
tabIndex = 1;
_getReserveList();
_reserveCountDay();
});
},
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
"我录入的",
style: TextStyle(
color: tabIndex == 1
? MyColours.color_353535
: MyColours.color_999999,
fontSize: tabIndex == 1
? ScreenUtil().setSp(36)
: ScreenUtil().setSp(28),
fontWeight: tabIndex == 1
? FontWeight.bold
: FontWeight.normal),
),
Align(
alignment: Alignment.bottomCenter,
child: Container(
height: ScreenUtil().setWidth(6),
width: ScreenUtil().setWidth(60),
margin:
EdgeInsets.only(top: ScreenUtil().setWidth(8)),
decoration: tabIndex == 1
? BoxDecoration(color: MyColours.color_199095,borderRadius: BorderRadius.circular(
ScreenUtil()
.setWidth(
6)))
: BoxDecoration(
color: MyColours.color_ffffff,
borderRadius: BorderRadius.circular(
ScreenUtil()
.setWidth(
6))
),
),
),
],
)),
),
],
),
);
return container;
}
@override
Widget build(BuildContext context) {
// TODO: implement build
... ... @@ -284,10 +407,7 @@ class NoteBookPageState extends State<NoteBookPage> {
color: MyColours.color_f5f5f5,
child: Column(
children: <Widget>[
MyAppBar(
"已预订",
showBack: false,
),
_buildTabbar(),
Container(
color: MyColours.color_ffffff,
width: double.infinity,
... ...
... ... @@ -2,28 +2,29 @@ import 'dart:async';
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:one_key/utils/event_bus.dart';
import 'package:one_key/widgets/app_bar.dart';
import 'package:one_key/widgets/system_app_bar.dart';
import 'package:webview_flutter/webview_flutter.dart';
class WebViewPage extends StatefulWidget {
@override
_WebViewPageState createState() => _WebViewPageState();
}
class _WebViewPageState extends State<WebViewPage> {
final Completer<WebViewController> _controller =
Completer<WebViewController>();
Completer<WebViewController>();
@override
Widget build(BuildContext context) {
return Scaffold(
// We're using a Builder here so we have a context that is below the Scaffold
// to allow calling Scaffold.of(context) so we can show a snackbar.
appBar: AppBar(
title: const Text('一键订'),
// This drop down menu demonstrates that Flutter widgets can be shown over the web view.
),
appBar: SystemAppBar('一键订',onTap: () {
EventBus().emit('changeStatusColor');
Navigator.of(context).pop();
},),
body: Builder(builder: (BuildContext context) {
return WebView(
initialUrl: "https://support.qq.com/product/152856",
... ... @@ -65,5 +66,4 @@ class _WebViewPageState extends State<WebViewPage> {
);
});
}
}
\ No newline at end of file
}
... ...
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:one_key/constant/constant.dart';
import 'package:one_key/models/get_seller_info_model.dart';
import 'package:one_key/models/seller_info.dart';
import 'package:one_key/models/set_seller_info_model.dart';
import 'package:one_key/net/base_resp.dart';
import 'package:one_key/net/dio_util.dart';
import 'package:one_key/net/http_url.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/utils/utils.dart';
import 'package:provider/provider.dart';
class BookSetTimeModel with ChangeNotifier {
//构造函数,初始化
BookSetTimeModel() {}
///获取某个商家下所有服务员信息 **** 取得某个商家的早市、午市、晚市营业时间
Future<SunSellerInfoModel> getManagersInfo(BuildContext context) async {
UserModel userModel = Provider.of<UserModel>(context, listen: false);
Map<String, String> params = {
"seller_id": userModel.user.sellerid,
"seller_openid": userModel.user.openid
};
BaseResp<Map<String, dynamic>> baseResp = await DioUtil()
.request<Map<String, dynamic>>(context, Method.get, HttpUrl.sellerinfo,
data: params)
.catchError((error) {
print(error.toString());
});
SunSellerInfoModel itemModel;
if (baseResp == null) return itemModel;
if (baseResp.code == Constant.status_success) {
if (int.parse(baseResp.status) != Constant.status_success) {
Utils.showToast(baseResp.msg ?? "");
return itemModel;
}
if (baseResp.responseData['data'] != null) {
itemModel = SellerInfoModel.fromJson(baseResp.responseData).data;
} else {
Utils.showToast(baseResp.msg ?? "");
}
return itemModel;
}
}
///根据商家ID修改商家信息
Future<SetSellerInfoSunModel> setSellerInfoById(
BuildContext context, Map daily) async {
UserModel userModel = Provider.of<UserModel>(context, listen: false);
Map<String, String> params = {
"id": userModel.user.sellerid,
"daily": jsonEncode(daily)
};
BaseResp<Map<String, dynamic>> baseResp = await DioUtil()
.request<Map<String, dynamic>>(
context, Method.get, HttpUrl.set_seller_info,
data: params)
.catchError((error) {
print(error.toString());
});
SetSellerInfoSunModel itemModel;
if (baseResp == null) return itemModel;
if (baseResp.code == Constant.status_success) {
if (int.parse(baseResp.status) != Constant.status_success) {
Utils.showToast(baseResp.msg ?? "");
return itemModel;
}
if (baseResp.responseData['data'] != null) {
itemModel = SetSellerInfoModel.fromJson(baseResp.responseData).data;
} else {
Utils.showToast(baseResp.msg ?? "");
}
return itemModel;
}
}
///根据商家ID获取商家信息
Future<GetSellerInfoSunModel> getSellerById(BuildContext context) async {
UserModel userModel = Provider.of<UserModel>(context, listen: false);
Map<String, String> params = {
"sellerid": userModel.user.sellerid,
};
BaseResp<Map<String, dynamic>> baseResp = await DioUtil()
.request<Map<String, dynamic>>(
context, Method.get, HttpUrl.get_seller_info,
data: params)
.catchError((error) {
print(error.toString());
});
GetSellerInfoSunModel itemModel;
if (baseResp == null) return itemModel;
if (baseResp.code == Constant.status_success) {
if (int.parse(baseResp.status) != Constant.status_success) {
Utils.showToast(baseResp.msg ?? "");
return itemModel;
}
if (baseResp.responseData['data'] != null) {
itemModel = GetSellerInfoModel.fromJson(baseResp.responseData).data;
} else {
Utils.showToast(baseResp.msg ?? "");
}
return itemModel;
}
}
///在线预订配置-接单时间
Future<bool> setReOrderTime(
BuildContext context, String start, String end) async {
UserModel userModel = Provider.of<UserModel>(context, listen: false);
Map<String, dynamic> params = {
"sellerid": int.parse(userModel.user.sellerid),
"start": start,
'end': end
};
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.get, HttpUrl.set_order_time,
data: params)
.catchError((error) {
print(error.toString());
});
if (baseResp == null) return false;
if (baseResp.code == Constant.status_success) {
if (int.parse(baseResp.status) != Constant.status_success) {
Utils.showToast(baseResp.msg ?? "");
return false;
}
if (baseResp.responseData['ret'] == 200) {
// if (baseResp.responseData['data'] == 0) {
return true;
// } else {
// return false;
// }
} else {
Utils.showToast(baseResp.msg ?? "");
return false;
}
}
}
}
... ...
... ... @@ -6,6 +6,7 @@ import 'package:one_key/models/notebook_detail.dart';
import 'package:one_key/models/reserve_info_model.dart';
import 'package:one_key/models/seller_info.dart';
import 'package:one_key/models/table_list.dart';
import 'package:one_key/models/user_history_entity.dart';
import 'package:one_key/net/base_resp.dart';
import 'package:one_key/net/dio_util.dart';
import 'package:one_key/net/http_url.dart';
... ... @@ -15,6 +16,7 @@ import 'package:one_key/utils/utils.dart';
import 'package:provider/provider.dart';
class NotebookDetailChangeModel with ChangeNotifier {
List dateList = []; //日期选择 月-日 某天
List sunDateList = []; // 早市、午市、晚市
List personNumList = []; // 人数
... ... @@ -35,6 +37,8 @@ class NotebookDetailChangeModel with ChangeNotifier {
bool isRecommend = false; //是否展示推荐
List oldTableList = [];
List<UserHistoryEntity> userHistorys=[];//历史录入
clearData() {
dateList = []; //日期选择 月-日 某天
sunDateList = []; // 早市、午市、晚市
... ... @@ -77,11 +81,11 @@ class NotebookDetailChangeModel with ChangeNotifier {
ddateStr = DateUtil.formatDate(createTime, format: DateFormats.h_m);
String dateTimeSelect = DateUtil.formatDateMs(
createTime.millisecondsSinceEpoch,
format: 'MM-dd');
format: 'yyyy-MM-dd');
//今天
DateTime dateTime = DateTime.now();
int dateTimeMill = dateTime.millisecondsSinceEpoch;
String dateText = DateUtil.formatDateMs(dateTimeMill, format: 'MM-dd');
String dateText = DateUtil.formatDateMs(dateTimeMill, format: 'yyyy-MM-dd');
dateList.add({
'title': dateText,
'select': dateTimeSelect == dateText ? true : false,
... ... @@ -92,7 +96,7 @@ class NotebookDetailChangeModel with ChangeNotifier {
//明天
int tomorrowMill = dateTimeMill + 24 * 60 * 60 * 1000;
String dateTextTomorrow =
DateUtil.formatDateMs(tomorrowMill, format: 'MM-dd');
DateUtil.formatDateMs(tomorrowMill, format: 'yyyy-MM-dd');
dateList.add({
'title': dateTextTomorrow,
'select': dateTimeSelect == dateTextTomorrow ? true : false,
... ... @@ -316,16 +320,14 @@ class NotebookDetailChangeModel with ChangeNotifier {
//初始化早市午市晚市选中时间
initHourAndMinuteSelect() {
int timeMillsNow = DateTime.now().millisecondsSinceEpoch;
//当前选中 月 日string
String mdStr = '';
//当前选中 年-月-日
String ymyStr="";
//今天 明天 其他天
for (var item in dateList) {
if (item['select'] == true) {
mdStr = item['title'];
ymyStr = item['title'];
}
}
String timeNowYear = DateUtil.formatDate(DateTime.now(), format: 'yyyy');
String ymyStr = timeNowYear + '-' + mdStr; //年月日
String timeStr = ymyStr + ' 00:00:00';
LogUtil.v(timeStr);
DateTime dateTime = DateUtil.getDateTime(timeStr); //当前年月日
... ... @@ -589,16 +591,14 @@ class NotebookDetailChangeModel with ChangeNotifier {
sex = item['code'];
}
}
//当前选中 月 日string
String mdStr = '';
//当前选中 年-月-日string
String ymyStr="";
//今天 明天 其他天
for (var item in dateList) {
if (item['select'] == true) {
mdStr = item['title'];
ymyStr = item['title'];
}
}
String timeNowYear = DateUtil.formatDate(DateTime.now(), format: 'yyyy');
String ymyStr = timeNowYear + '-' + mdStr; //年月日
String timeStr = ymyStr + ' ' + ddateStr + ':00';
// int start = DateUtil.getDateMsByTimeStr(timeStr);
... ... @@ -708,16 +708,14 @@ class NotebookDetailChangeModel with ChangeNotifier {
sex = item['code'];
}
}
//当前选中 月 日string
String mdStr = '';
//当前选中 年-月-日string
String ymyStr="";
//今天 明天 其他天
for (var item in dateList) {
if (item['select'] == true) {
mdStr = item['title'];
ymyStr = item['title'];
}
}
String timeNowYear = DateUtil.formatDate(DateTime.now(), format: 'yyyy');
String ymyStr = timeNowYear + '-' + mdStr; //年月日
String timeStr = ymyStr + ' ' + ddateStr + ':00';
// int start = DateUtil.getDateMsByTimeStr(timeStr);
... ... @@ -802,4 +800,20 @@ class NotebookDetailChangeModel with ChangeNotifier {
return itemModel;
}
}
//获取历史录入
getUserHistorys(BuildContext context, Map<String, String> params) async {
BaseResp<List> baseResp = await DioUtil()
.request<List>(context, Method.get, HttpUrl.get_reserve_user,
data: params, showLoading: false)
.catchError((error) {
print(error.toString());
});
if (baseResp != null && baseResp.code == Constant.status_success) {
userHistorys = baseResp.data.map<UserHistoryEntity>((value) {
return UserHistoryEntity.fromJson(value);
}).toList();
notifyListeners();
}
}
}
... ...
... ... @@ -105,15 +105,15 @@ class NotebookDetailModel extends ChangeNotifier {
.catchError((error) {
print(error.toString());
});
if (baseResp == null) return false;
if (baseResp.code == Constant.status_success) {
if (baseResp == null)return false;
if (baseResp.code == Constant.status_success&&baseResp.data!=null) {
if (ifPush) {
NavigatorUtil.goNotebookDetailPage(context, params["rid"],
replace: true);
}
return true;
} else {
Utils.showToast(baseResp.msg);
Utils.showToast("订单已被处理");
return false;
}
}
... ...
import 'package:flutter/material.dart';
import 'package:one_key/constant/constant.dart';
import 'package:one_key/constant/error.dart';
import 'package:one_key/constant/state.dart';
import 'package:one_key/models/remark.dart';
import 'package:one_key/net/base_resp.dart';
import 'package:one_key/net/dio_util.dart';
import 'package:one_key/net/http_url.dart';
/**
* 常用备注管理
*/
class RemarkManagerModel extends ChangeNotifier {
List<Remark> remarks = []; //所有备注
List<Remark> ofenRemarks = []; //常用备注
PageState pageState = PageState.Loading;
//获取备注
getRemarks(BuildContext context, Map<String, String> params,
{bool showPageLoading = false}) async {
if (showPageLoading) {
pageState = PageState.Loading;
notifyListeners();
}
BaseResp<List> baseResp = await DioUtil()
.request<List>(context, Method.get, HttpUrl.get_custom_remark,
data: params, showLoading: showPageLoading ? false : true)
.catchError((error) {
print(error.toString());
if (error is MyError) {
switch (error.type) {
case 1:
pageState = PageState.ConnectivityError;
break;
case 2:
pageState = PageState.ConnectivityTimeOut;
break;
default:
pageState = PageState.ConnectivityError;
break;
}
}
notifyListeners();
});
if (baseResp != null && baseResp.code == Constant.status_success) {
remarks = baseResp.data.map<Remark>((value) {
return Remark.fromJson(value);
}).toList();
ofenRemarks = [];
for (Remark item in remarks) {
if (item.oftenUse != '') {
ofenRemarks.add(item);
}
}
if (remarks.isEmpty) {
pageState = PageState.Empty;
} else {
pageState = PageState.Success;
}
notifyListeners();
}
}
//添加备注
Future addRemark(BuildContext context, Map<String, String> params) async {
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.get, HttpUrl.add_custom_remark,
data: params, showLoading: false)
.catchError((error) {
print(error.toString());
});
return;
}
//删除备注
delRemark(BuildContext context, Map<String, String> params) async {
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.get, HttpUrl.del_custom_remark,
data: params, showLoading: false)
.catchError((error) {
print(error.toString());
});
if (baseResp != null && baseResp.code == Constant.status_success) {}
}
}
... ...
... ... @@ -51,7 +51,7 @@ class TableManagerModel with ChangeNotifier{
initTime(BuildContext context) async {
userModel = Provider.of<UserModel>(context, listen: false);
dateTime = DateTime.now();
dateText = Utils.addZeroNumber(dateTime.month) +
dateText = "${dateTime.year}年 "+Utils.addZeroNumber(dateTime.month) +
"月" +
Utils.addZeroNumber(dateTime.day) +
"日" +
... ... @@ -346,7 +346,7 @@ class TableManagerModel with ChangeNotifier{
createDateText(BuildContext context,DateTime day) {
if (Utils.isOneDay(day, dateTime)) return; //日期没变
DateTime dateNow = DateTime.now();
dateText = Utils.addZeroNumber(day.month) +
dateText = "${day.year}年 "+Utils.addZeroNumber(day.month) +
"月" +
Utils.addZeroNumber(day.day) +
"日";
... ...
... ... @@ -11,6 +11,7 @@ class MyColours {
static const Color color_d8d8d8 = Color(0xffD8D8D8);
static const Color color_bff6f7 = Color(0xffBFF6F7);
static const Color color_c1c1c1 = Color(0xffC1C1C1);
static const Color color_cccccc = Color(0xffCCCCCC);
static const Color color_2bb5b7 = Color(0xff2BB5B7);
static const Color color_26000000 = Color(0x26000000);
static const Color color_d93535 = Color(0xffD93535);
... ... @@ -48,4 +49,5 @@ class MyColours {
static const Color color_A9E3E6 = Color(0xffA9E3E6);
static const Color color_e5e5e5 = Color(0xffe5e5e5);
static const Color color_efefef = Color(0xffefefef);
static const Color color_0A0A0A = Color(0xff0A0A0A);
}
... ...
... ... @@ -12,12 +12,17 @@ import 'package:one_key/pages/login/login_page.dart';
import 'package:one_key/pages/detail/handle_online_page.dart';
import 'package:one_key/pages/detail/notebook_detail_page.dart';
import 'package:one_key/pages/login/web_page.dart';
import 'package:one_key/pages/my/book_time_set.dart';
import 'package:one_key/pages/my/receive_orders_time_set.dart';
import 'package:one_key/pages/my/remark_manager_page.dart';
import 'package:one_key/pages/sms/sms_page.dart';
import 'package:one_key/pages/table/select_table_page.dart';
import 'package:one_key/pages/webview/webview_page.dart';
import 'package:one_key/provider/book_set_time_model.dart';
import 'package:one_key/provider/choose_table_model.dart';
import 'package:one_key/provider/notebook_detail_change_model.dart';
import 'package:one_key/provider/notebook_detail_model.dart';
import 'package:one_key/provider/remark_manager_model.dart';
import 'package:one_key/utils/fluro_convert_utils.dart';
import 'package:provider/provider.dart';
... ... @@ -97,8 +102,8 @@ var handleInvicationHandler = new Handler(
String ddate = params["ddate"].first;
String ddateStr =
FluroConvertUtils.fluroCnParamsDecode(params["ddateStr"].first);
String phone=params["phone"].first;
return InvicationPage(rid, tableInfo, ddate, ddateStr,phone);
String phone = params["phone"].first;
return InvicationPage(rid, tableInfo, ddate, ddateStr, phone);
});
// 发短信
... ... @@ -132,5 +137,28 @@ var handleChangeDetailHandler = new Handler(
String rid = params['rid'].first;
return ChangeNotifierProvider<NotebookDetailChangeModel>(
create: (_) => NotebookDetailChangeModel(detailEntity),
child: NoteBookChangePage(detailEntity: detailEntity, rid: rid));
child: ChangeNotifierProvider<RemarkManagerModel>(
create: (_) => RemarkManagerModel(),
child: NoteBookChangePage(detailEntity: detailEntity, rid: rid)));
});
// 跳转可订时段管理页面
var handleBookTimeSetHandler = new Handler(
handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
return ChangeNotifierProvider<BookSetTimeModel>(
create: (_) => BookSetTimeModel(), child: BookTimeSetPage());
});
// 跳转接单时间管理
var handleReceiveOrdersTimeSetHandler = new Handler(
handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
return ChangeNotifierProvider<BookSetTimeModel>(
create: (_) => BookSetTimeModel(), child: ReceiveOrdersTimeSetPage());
});
// 常用备注管理
var handleRemarkManagerHandler = new Handler(
handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
return ChangeNotifierProvider<RemarkManagerModel>(
create: (_) => RemarkManagerModel(), child: RemarkManagerPage());
});
... ...
... ... @@ -5,17 +5,19 @@ import 'package:one_key/pages/login/login_page.dart';
import 'route_handles.dart';
class Routes {
static String login = "/";//登录页
static String home = "/home";//主页
static String handle_online_page="/handle_online_page";//处理在线预订
static String reserve_detail="/reserve_detail";//预订详情
static String select_table="/select_table";//选择桌位
static String invication="/invication";//邀请函
static String sms="/sms";//发短信
static String webview="/webview";//网页
static String login = "/"; //登录页
static String home = "/home"; //主页
static String handle_online_page = "/handle_online_page"; //处理在线预订
static String reserve_detail = "/reserve_detail"; //预订详情
static String select_table = "/select_table"; //选择桌位
static String invication = "/invication"; //邀请函
static String sms = "/sms"; //发短信
static String webview = "/webview"; //网页
static String web_page = '/web_page'; //隐私协议
static String change_detail="/change_detail";//变更预订
static String change_detail = "/change_detail"; //变更预订
static String book_time_set = "/book_time_set"; //可订时段管理
static String receive_orders_time_set = "/receive_orders_time_set"; //接单时间管理
static String remark_manager = "/remark_manager"; //常用备注管理
static void configureRoutes(Router router) {
router.notFoundHandler = new Handler(
... ... @@ -33,5 +35,10 @@ class Routes {
router.define(webview, handler: handleWebviewHandler);
router.define(web_page, handler: webPageHandler);
router.define(change_detail, handler: handleChangeDetailHandler);
router.define(book_time_set, handler: handleBookTimeSetHandler);
router.define(receive_orders_time_set,
handler: handleReceiveOrdersTimeSetHandler);
router.define(remark_manager,
handler: handleRemarkManagerHandler);
}
}
... ...
... ... @@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_picker/flutter_picker.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/constant/constant.dart';
import 'package:one_key/models/remark.dart';
import 'package:one_key/pages/message/message_dialog_item.dart';
import 'package:one_key/provider/message_dialog_model.dart';
import 'package:one_key/res/colors.dart';
... ... @@ -19,7 +20,120 @@ import 'package:provider/provider.dart';
import 'package:table_calendar/table_calendar.dart';
import 'package:one_key/models/table.dart' as t;
typedef CustomCallBack = void Function(Object object);
class DialogUtil {
//备注弹框
static showRemarkDialog(
BuildContext context, List<Remark> remarks, CustomCallBack callback,
{GestureTapCallback onTapLeft, GestureTapCallback onTapRight}) {
return showModalBottomSheet(
context: context,
isScrollControlled: true,
// isDismissible: false,
backgroundColor: Colors.transparent,
builder: (context) {
return StatefulBuilder(builder: (context, state) {
// locationState = state;
return Container(
decoration: BoxDecoration(
color: MyColours.color_ffffff,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(ScreenUtil().setWidth(24)),
topRight: Radius.circular(ScreenUtil().setWidth(24)))),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
VEmptyView(40),
InkWell(
onTap: () {
Navigator.pop(context);
},
child: Container(
height: ScreenUtil().setWidth(44),
// color: Colors.red,
child: Stack(
children: [
Center(
child: Text(
'更多标签',
style: TextStyle(
fontSize: ScreenUtil().setSp(32),
color: MyColours.color_353535,
),
softWrap: true,
textAlign: TextAlign.center,
),
),
Positioned(
top: ScreenUtil().setWidth(10),
right: ScreenUtil().setWidth(40),
child: Image.asset(
Utils.getImgPath('close1'),
width: ScreenUtil().setWidth(28),
height: ScreenUtil().setWidth(28),
),
)
],
),
)),
VEmptyView(60),
Container(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40)),
child: Wrap(
children: listWidget(remarks, state, callback),
spacing: ScreenUtil().setWidth(20),
runSpacing: ScreenUtil().setWidth(20),
// alignment: WrapAlignment.start,
// runAlignment: WrapAlignment.end,
),
),
VEmptyView(60)
]));
});
});
}
static listWidget(
List<Remark> remarks, StateSetter state, CustomCallBack callback) {
List<Widget> lists = remarks.map((item) {
return remarkButton(
content: item.custom,
isSelect: item.selected,
onPress: () {
state(() {
item.selected = !item.selected;
});
callback(item);
});
}).toList();
return lists;
}
static Widget remarkButton(
{GestureTapCallback onPress, content, isSelect = false}) {
return InkWell(
onTap: onPress,
child: Container(
height: ScreenUtil().setHeight(54),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(20),
vertical: ScreenUtil().setWidth(10)),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10)),
color: isSelect ? MyColours.color_199095 : MyColours.color_f5f5f5,
),
child: Text(
content,
style: TextStyle(
color: isSelect ? Colors.white : MyColours.color_353535,
fontSize: ScreenUtil().setSp(28)),
),
));
}
//显示消息弹框
static showMessageDialog(BuildContext context) async {
MessageDialogModel messageModel =
... ... @@ -654,15 +768,18 @@ class DialogUtil {
//显示选择客户经理弹框
static Future<List<int>> showSelectCusmanDialog(
BuildContext context, List<String> data, ValueChanged valueChanged) {
BuildContext context, List<dynamic> data, ValueChanged valueChanged,
{List<int> selecteds}) {
return Picker(
selecteds: selecteds,
adapter: PickerDataAdapter<String>(pickerdata: data),
height: ScreenUtil().setWidth(480),
hideHeader: false,
cancelText: "取消",
cancelTextStyle: TextStyle(
color: MyColours.color_828282, fontSize: ScreenUtil().setSp(36)),
confirmText: "确定",
itemExtent: ScreenUtil().setWidth(80),
itemExtent: ScreenUtil().setWidth(90),
confirmTextStyle: TextStyle(
color: MyColours.color_2bb5b7, fontSize: ScreenUtil().setSp(36)),
selectedTextStyle: TextStyle(
... ... @@ -680,14 +797,16 @@ class DialogUtil {
});
}
static Future openAlertDialog(BuildContext context) async {
static Future openAlertDialog(BuildContext context, String title,
String content, String btnTitle, double height,
{GestureTapCallback onTap, double fontSize = 36}) async {
final action = await showDialog(
context: context,
barrierDismissible: true,
builder: (BuildContext context) {
return Center(
child: Container(
height: ScreenUtil().setWidth(160 * 2 + 20),
height: ScreenUtil().setWidth(height),
width: ScreenUtil().setWidth(280 * 2),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(ScreenUtil().setWidth(30))),
... ... @@ -701,9 +820,9 @@ class DialogUtil {
Container(
height: ScreenUtil().setWidth(48),
alignment: Alignment.center,
child: Text('未获得通讯录权限',
child: Text(title,
style: TextStyle(
fontSize: ScreenUtil().setSp(36),
fontSize: ScreenUtil().setSp(fontSize),
color: MyColours.color_353535)),
),
VEmptyView(20),
... ... @@ -720,10 +839,10 @@ class DialogUtil {
ScreenUtil()
.setWidth(2)), //1为 StrutStyle 的 leading的值
child: Text(
"请在手机的权限管理里,将通讯录权限开启",
content,
style: TextStyle(
color: MyColours.color_353535,
fontSize: ScreenUtil().setSp(28),
fontSize: ScreenUtil().setSp(30),
),
strutStyle: StrutStyle(
forceStrutHeight: true,
... ... @@ -740,34 +859,156 @@ class DialogUtil {
height: ScreenUtil().setWidth(47 * 2),
alignment: Alignment.center,
child: Text(
'去设置',
btnTitle,
style: TextStyle(
color: MyColours.color_2bb5b7,
color: MyColours.color_199095,
fontSize: ScreenUtil().setWidth(34)),
),
),
onTap: () {
openSetting();
Navigator.pop(context, '');
},
onTap: onTap,
)
],
),
),
),
);
},
);
}
///时段设置提示弹框
static Future confirmTimeAlertDialog(BuildContext context, String morning,
String noon, String night, VoidCallback callback) async {
int space = 52;
List temp = [morning, noon, night];
int tempHeight = 0;
for (int i = 0; i < temp.length; i++) {
if (temp[i] == '') {
if (i == 2) {
space = 42;
}
tempHeight += space;
}
}
int height = 166 * 2 + 20 + 15 * 2 + 20 - tempHeight;
final action = await showDialog(
context: context,
barrierDismissible: true,
builder: (BuildContext context) {
return Center(
child: Container(
height: ScreenUtil().setWidth(height),
width: ScreenUtil().setWidth(280 * 2),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(ScreenUtil().setWidth(20))),
child: Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(
Radius.circular(ScreenUtil().setWidth(20)))), //设置圆角
child: Column(
children: [
VEmptyView(40),
Container(
height: ScreenUtil().setWidth(42),
alignment: Alignment.center,
child: Text(
"请确认时段信息",
style: TextStyle(
color: MyColours.color_353535,
fontSize: ScreenUtil().setSp(30),
fontWeight: FontWeight.bold),
),
),
VEmptyView(20),
Column(
children: [
morning.isNotEmpty
? Container(
height: ScreenUtil().setWidth(42),
child: Text("早市:${morning}",
style: TextStyle(
color: MyColours.color_353535,
fontSize: ScreenUtil().setSp(30),
)))
: Container(),
morning.isNotEmpty ? VEmptyView(10) : VEmptyView(0),
noon.isNotEmpty
? Container(
height: ScreenUtil().setWidth(42),
child: Text(
"午市:${noon}",
style: TextStyle(
color: MyColours.color_353535,
fontSize: ScreenUtil().setSp(30),
),
))
: Container(),
noon.isNotEmpty ? VEmptyView(10) : VEmptyView(0),
night.isNotEmpty
? Container(
height: ScreenUtil().setWidth(42),
child: Text(
"晚市:${night}",
style: TextStyle(
color: MyColours.color_353535,
fontSize: ScreenUtil().setSp(30),
),
))
: Container(),
],
),
VEmptyView(40),
MyDivider(
ScreenUtil().setWidth(280 * 2), ScreenUtil().setWidth(2),
color: MyColours.color_efefef),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
InkWell(
child: Container(
height: ScreenUtil().setWidth(47 * 2),
width: ScreenUtil().setWidth(135 * 2),
alignment: Alignment.center,
child: Text(
"信息有误",
style: TextStyle(
color: MyColours.color_666666,
fontSize: ScreenUtil().setSp(34)),
),
),
onTap: () {
Navigator.pop(context, '');
},
),
Container(
color: MyColours.color_efefef,
width: ScreenUtil().setWidth(2),
height: ScreenUtil().setWidth(47 * 2),
),
InkWell(
child: Container(
height: ScreenUtil().setWidth(47 * 2),
width: ScreenUtil().setWidth(135 * 2),
alignment: Alignment.center,
child: Text(
"确认无误",
style: TextStyle(
color: MyColours.color_199095,
fontSize: ScreenUtil().setSp(34)),
),
),
onTap: () {
Navigator.pop(context, '');
callback();
},
)
],
)
],
),
),
),
);
// return AlertDialog(
// title: Text('未获得通讯录权限'),
// content: Text('请在手机的权限管理里,将联系人权限开启'),
// actions: <Widget>[
// FlatButton(
// child: Text('去设置'),
// onPressed: () {
// Navigator.pop(context, '确认');
// },
// ),
// ],
// );
},
);
... ...
... ... @@ -38,14 +38,17 @@ class NavigatorUtil {
/// 订单详情
static void goNotebookDetailPage(BuildContext context, String rid,
{String mid="",bool fromNotify=false,replace = false}) {
_navigateTo(context, "${Routes.reserve_detail}?rid=$rid&mid=$mid&fromNotify=$fromNotify", replace: replace);
{String mid = "", bool fromNotify = false, replace = false}) {
_navigateTo(context,
"${Routes.reserve_detail}?rid=$rid&mid=$mid&fromNotify=$fromNotify",
replace: replace);
}
/// 处理在线预订
static void goHandleOnlinePage(BuildContext context, String rid, String mid,
{fromNotify=false,replace = false}) {
_navigateTo(context, "${Routes.handle_online_page}?rid=$rid&mid=$mid&fromNotify=$fromNotify",
{fromNotify = false, replace = false}) {
_navigateTo(context,
"${Routes.handle_online_page}?rid=$rid&mid=$mid&fromNotify=$fromNotify",
replace: replace);
}
... ... @@ -64,7 +67,7 @@ class NavigatorUtil {
/// 邀请函
static void goInvicationPage(BuildContext context, String rid,
String tableInfo, String ddate, String ddateStr,String phone,
String tableInfo, String ddate, String ddateStr, String phone,
{bool replace = false}) {
_navigateTo(context,
"${Routes.invication}?rid=$rid&tableInfo=${FluroConvertUtils.fluroCnParamsEncode(tableInfo)}&ddate=$ddate&ddateStr=${FluroConvertUtils.fluroCnParamsEncode(ddateStr)}&phone=$phone",
... ... @@ -94,19 +97,27 @@ class NavigatorUtil {
static void goNoteBookChangePage(
BuildContext context, NotebookDetail detailEntity, String rid,
{replace = false}) {
if(detailEntity.type=="0"){//内部预订
detailEntity.is_set_ddate="1";
if (detailEntity.type == "0") {
//内部预订
detailEntity.is_set_ddate = "1";
}
_navigateTo(context,
"${Routes.change_detail}?detail=${FluroConvertUtils.object2string(detailEntity)}&rid=$rid",
replace: replace);
}
// /// 变更预订
// static void goNoteBookChangePage(
// BuildContext context, NotebookDetail detailEntity, String rid,
// {replace = false}) {
// _navigateTo(context,
// "${Routes.change_detail}?detail=${FluroConvertUtils.object2string(detailEntity)}&rid=$rid",
// replace: replace);
// }
/// 可订时段管理
static void goBookTimeSetPage(BuildContext context) {
_navigateTo(context, "${Routes.book_time_set}");
}
/// 可订时段管理
static void goReceiveOrdersTimeSetPage(BuildContext context) {
_navigateTo(context, "${Routes.receive_orders_time_set}");
}
/// 常用备注管理
static void goRemarkManagerPage(BuildContext context) {
_navigateTo(context, "${Routes.remark_manager}");
}
}
... ...
import 'package:flutter/material.dart';
//自定义 坐标
class Coordinate {
final double cx;
final double cy;
Coordinate({this.cx, this.cy});
}
class TriangleCustomPainter extends CustomPainter {
Paint _paint = new Paint(); //画笔富含各种属性方法。仔细查看源码
final BuildContext context;
final List spots;
final Color color;
TriangleCustomPainter(this.context, this.spots, {this.color});
@override
void paint(Canvas canvas, Size size) {
Path path = new Path()..moveTo(spots[0].cx, spots[0].cy);
path.lineTo(spots[1].cx, spots[1].cy);
path.lineTo(spots[2].cx, spots[2].cy);
canvas.drawPath(
path,
_paint
..style = PaintingStyle.fill
..color = color);
}
@override
bool shouldRepaint(CustomPainter oldDelegate) {
return true;
}
}
... ...
... ... @@ -18,9 +18,12 @@ import 'package:webview_flutter/webview_flutter.dart';
import '../app.dart';
typedef BookTimeSetCallback = void Function(bool needChange);
class Utils {
static void showToast(String msg) {
Fluttertoast.showToast(msg: msg, gravity: ToastGravity.CENTER);
Fluttertoast.showToast(
msg: msg, toastLength: Toast.LENGTH_LONG, gravity: ToastGravity.CENTER);
}
//本地图片资源路径
... ... @@ -160,16 +163,13 @@ class Utils {
/// 获取日期 今天 明天 后天等等
static int getDdate(List dateList) {
//当前选中 月 日string
String mdStr = '';
String ymyStr = ""; //年月日
//今天 明天 其他天
for (var item in dateList) {
if (item['select'] == true) {
mdStr = item['title'];
ymyStr = item['title'];
}
}
String timeNowYear = DateUtil.formatDate(DateTime.now(), format: 'yyyy');
String ymyStr = timeNowYear + '-' + mdStr; //年月日
String timeStr = ymyStr + ' ' + "00:00:00";
int ddate = DateUtil.getDateMsByTimeStr(timeStr); //筛选日期时间戳
return ddate;
... ... @@ -199,4 +199,64 @@ class Utils {
}
return pnum;
}
///工具
/// 组装成07:00
static getTimeString(dynamic hour, String minute) {
return '${hour}:${minute}';
}
/// 组装成 07:00-10:00
static getTimelLongString(String start, String end) {
return '${start}-${end}';
}
/// 从07:00中获取07
static getHourFromhourAndMinute(String hourAndMinute) {
return hourAndMinute.substring(0, 2);
}
///从深夜00时中获取00
static getHourFromTitle(String title) {
return title.substring(2, 4);
}
/// 0 还是 30
/// 从07:00中获取0 或者 30
static getMinuteFromhourAndMinute(String hourAndMinute) {
return hourAndMinute.substring(3, 5);
}
/// a < b 则 a = b
static compareDateTime(String a, String b, BookTimeSetCallback callback) {
String tempa = '${DateUtil.getNowDateStr().substring(0, 10)} ${a}:00';
String tempb = '${DateUtil.getNowDateStr().substring(0, 10)} ${b}:00';
int aMs = DateUtil.getDateMsByTimeStr(tempa);
int bMs = DateUtil.getDateMsByTimeStr(tempb);
if (aMs < bMs) {
callback(true);
} else {
callback(false);
}
}
///获取时间选择器数据
static getPickerData(String lastTime, List dateData) {
String hour = Utils.getHourFromhourAndMinute(lastTime);
String minute = Utils.getMinuteFromhourAndMinute(lastTime);
if (minute == '30') {
hour = '${int.parse(hour) + 1}';
}
List tempList = List();
tempList.addAll(dateData);
tempList.removeRange(0, int.parse(hour));
if (tempList.length == 0) {
tempList = [
{
'晚上23时': [30]
}
];
}
return tempList;
}
}
... ...
import 'package:flutter/material.dart';
import 'package:one_key/utils/dialog_util.dart';
import 'package:one_key/utils/utils.dart';
typedef SetTimeCallback = void Function(List value);
class SetTimeWidget {
static List dateData = [
{
'深夜00时': [00, 30]
},
{
'深夜01时': [00, 30]
},
{
'深夜02时': [00, 30]
},
{
'深夜03时': [00, 30]
},
{
'深夜04时': [00, 30]
},
{
'深夜05时': [00, 30]
},
{
'早上06时': [00, 30]
},
{
'早上07时': [00, 30]
},
{
'早上08时': [00, 30]
},
{
'早上09时': [00, 30]
},
{
'中午10时': [00, 30]
},
{
'中午11时': [00, 30]
},
{
'中午12时': [00, 30]
},
{
'中午13时': [00, 30]
},
{
'中午14时': [00, 30]
},
{
'下午15时': [00, 30]
},
{
'下午16时': [00, 30]
},
{
'下午17时': [00, 30]
},
{
'下午18时': [00, 30]
},
{
'晚上19时': [00, 30]
},
{
'晚上20时': [00, 30]
},
{
'晚上21时': [00, 30]
},
{
'晚上22时': [00, 30]
},
{
'晚上23时': [00, 30]
}
];
showTimeSelector(context, data, hourAndMinute, SetTimeCallback setTimeCallback) {
DialogUtil.showSelectCusmanDialog(context, data, (value) {
setTimeCallback(value);
}, selecteds: [
_getFirSelected(hourAndMinute, data),
_getSecSelected(hourAndMinute)
]).then((value) {
print(value);
});
}
// 第一列当前选中第几个
_getFirSelected(String hourAndMinute, List data) {
String hour = Utils.getHourFromhourAndMinute(hourAndMinute);
for (int i = 0; i < data.length; i++) {
Map map = data[i];
String key = map.keys.first;
if (key.contains(hour)) {
return i;
}
}
return 0;
}
// 第二列当前选中第几个
_getSecSelected(String hourAndMinute) {
String minute = Utils.getMinuteFromhourAndMinute(hourAndMinute);
if (minute == '00') {
return 0;
}
return 1;
}
}
... ...
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/screenutil.dart';
import 'package:one_key/res/colors.dart';
... ... @@ -16,9 +15,7 @@ class SystemAppBar extends StatelessWidget implements PreferredSizeWidget {
return AppBar(
elevation: 0,
leading: InkWell(
onTap: () {
Navigator.of(context).pop();
},
onTap: onTap,
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40),
... ...