Commit 3b27d23dc2947fff49ad2b57b34f651706fc9631

Authored by 蓋亞光
2 parents 4d1866fd 5316c2b8

测试v1.5.1

<<<<<<< HEAD
c71e777004aab201609920eac28801f9
=======
7babc7873f8d177769b987ba4c6c2911
>>>>>>> 4ecf950986f1856303c83ccacadc2b15efeb20ac
7babc7873f8d177769b987ba4c6c2911
\ No newline at end of file
... ...
... ... @@ -152,4 +152,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: a75497545d4391e2d394c3668e20cfb1c2bbd4aa
COCOAPODS: 1.9.1
COCOAPODS: 1.9.3
... ...
... ... @@ -409,11 +409,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
<<<<<<< HEAD
CURRENT_PROJECT_VERSION = 145;
=======
CURRENT_PROJECT_VERSION = 146;
>>>>>>> 4ecf950986f1856303c83ccacadc2b15efeb20ac
DEVELOPMENT_TEAM = 8J59HM8B82;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
... ... @@ -426,11 +422,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
<<<<<<< HEAD
MARKETING_VERSION = 1.4.5;
=======
MARKETING_VERSION = 1.4.6;
>>>>>>> 4ecf950986f1856303c83ccacadc2b15efeb20ac
PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine;
PRODUCT_NAME = "一键订";
PROVISIONING_PROFILE_SPECIFIER = "";
... ... @@ -559,11 +551,7 @@
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
<<<<<<< HEAD
CURRENT_PROJECT_VERSION = 145;
=======
CURRENT_PROJECT_VERSION = 146;
>>>>>>> 4ecf950986f1856303c83ccacadc2b15efeb20ac
DEVELOPMENT_TEAM = 8J59HM8B82;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
... ... @@ -576,11 +564,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
<<<<<<< HEAD
MARKETING_VERSION = 1.4.5;
=======
MARKETING_VERSION = 1.4.6;
>>>>>>> 4ecf950986f1856303c83ccacadc2b15efeb20ac
PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine;
PRODUCT_NAME = "一键订";
PROVISIONING_PROFILE_SPECIFIER = "";
... ... @@ -600,11 +584,7 @@
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
<<<<<<< HEAD
CURRENT_PROJECT_VERSION = 145;
=======
CURRENT_PROJECT_VERSION = 146;
>>>>>>> 4ecf950986f1856303c83ccacadc2b15efeb20ac
DEVELOPMENT_TEAM = 8J59HM8B82;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
... ... @@ -617,11 +597,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
<<<<<<< HEAD
MARKETING_VERSION = 1.4.5;
=======
MARKETING_VERSION = 1.4.6;
>>>>>>> 4ecf950986f1856303c83ccacadc2b15efeb20ac
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
};
... ...
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};
... ...
... ... @@ -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,11 @@ 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"; //在线预订配置-接单时间
}
... ...
... ... @@ -114,7 +114,9 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: _notebookDetailChangeModel.dateList.map((value) {
return CustomButton(
dateText: value['title'].toString().length<=5?value['title'].toString():value['title'].toString().substring(5),
dateText: value['title'].toString().length <= 5
? value['title'].toString()
: value['title'].toString().substring(5),
fontSize: value['fontSize'],
dayText: value['dayText'],
isImage: value['isImage'],
... ... @@ -819,7 +821,11 @@ 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();
... ... @@ -827,7 +833,12 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> {
_getContactData();
} else {
//拒绝通讯录权限 , 苹果拒绝权限后,不再提示权限框,进入此处
DialogUtil.openAlertDialog(context);
DialogUtil.openAlertDialog(
context, '未获得通讯录权限', "请在手机的权限管理里,将通讯录权限开启。", '去设置', 340.0,
onTap: () {
openSetting();
Navigator.pop(context, '');
});
}
}
} else {
... ...
... ... @@ -434,9 +434,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/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/app_bar.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);
... ... @@ -22,10 +30,10 @@ class BookTimeSetPage extends StatefulWidget {
class _BookTimeSetPageState extends State<BookTimeSetPage> {
List swichState;
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
List dateData;
SetTime morning = SetTime();
SetTime noon = SetTime();
SetTime night = SetTime();
BookSetTimeModel bookSetTimeModel;
@override
void initState() {
... ... @@ -36,95 +44,153 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> {
noon.end = '14:30';
night.start = '16:00';
night.end = '21:00';
swichState = [
{
'on': false,
},
{
'on': true,
},
{
'on': true,
}
];
swichState = [false, true, true];
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]
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
///item 早市,晚市,午时widhet
Widget _itemWidget(String title, String startTime, String endTime, int tag) {
return Container(
color: MyColours.color_ffffff,
... ... @@ -147,11 +213,11 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> {
InkWell(
onTap: () {
setState(() {
swichState[tag]["on"] = !swichState[tag]["on"];
swichState[tag] = !swichState[tag];
});
},
child: Image.asset(
swichState[tag]["on"]
swichState[tag]
? Utils.getImgPath('swich_on')
: Utils.getImgPath('swich_off'),
width: ScreenUtil().setWidth(122),
... ... @@ -166,52 +232,97 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> {
ScreenUtil().setWidth(2),
color: MyColours.color_f3f3f3,
),
_timeWidget('开始时间', startTime, highted: swichState[tag]["on"],
onTap: () {
if (swichState[tag]["on"]) {
List data = dateData;
timeWidget('开始时间', startTime, highted: swichState[tag], onTap: () {
if (swichState[tag]) {
List data = SetTimeWidget.dateData;
if (tag == 0) {
//早市
data = dateData;
data = SetTimeWidget.dateData;
} else if (tag == 1) {
//午市
data = _getPickerData(morning.end);
data =
Utils.getPickerData(morning.end, SetTimeWidget.dateData);
} else if (tag == 2) {
//晚市
data = _getPickerData(noon.end);
data = Utils.getPickerData(noon.end, SetTimeWidget.dateData);
}
DialogUtil.showSelectCusmanDialog(context, data, (value) {
SetTimeWidget().showTimeSelector(context, data, startTime,
(value) {
if (value != null) {
String temp;
if (value[1] == 0) {
temp = '00';
} else {
temp = '30';
}
String tempMinute = _getMinuteStrFromPicker(data, value);
print(data[value[0]].keys.first);
String time = _getTimeString(
_getHourFromTitle(data[value[0]].keys.first), temp);
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);
_compare(time);
}
}, selecteds: [
_getFirSelected(startTime, data),
_getSecSelected(startTime)
]).then((value) {
print(value);
});
}
}),
... ... @@ -223,50 +334,79 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> {
ScreenUtil().setWidth(2),
color: MyColours.color_f3f3f3,
)),
_timeWidget('结束时间', endTime, highted: swichState[tag]["on"],
onTap: () {
if (swichState[tag]["on"]) {
List data = dateData;
timeWidget('结束时间', endTime, highted: swichState[tag], onTap: () {
if (swichState[tag]) {
List data = SetTimeWidget.dateData;
if (tag == 0) {
//早市
data = _getPickerData(morning.start);
data = Utils.getPickerData(
morning.start, SetTimeWidget.dateData);
} else if (tag == 1) {
//午市
data = _getPickerData(noon.start);
data =
Utils.getPickerData(noon.start, SetTimeWidget.dateData);
} else if (tag == 2) {
//晚市
data = _getPickerData(night.start);
data =
Utils.getPickerData(night.start, SetTimeWidget.dateData);
}
DialogUtil.showSelectCusmanDialog(context, data, (value) {
SetTimeWidget().showTimeSelector(context, data, startTime,
(value) {
if (value != null) {
String temp;
if (value[1] == 0) {
temp = '00';
} else {
temp = '30';
}
String time = _getTimeString(
_getHourFromTitle(data[value[0]].keys.first), temp);
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);
_compare(time);
}
}, selecteds: [
_getFirSelected(endTime, data),
_getSecSelected(endTime)
]).then((value) {
print(value);
});
}
})
... ... @@ -274,173 +414,180 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> {
));
}
/// 开始时间和结束时间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),
)
],
),
)));
}
///工具
/// 组装成07:00
_getTimeString(dynamic hour, String minute) {
return '${hour}:${minute}';
}
/// 从07:00中获取07
_getHourFromhourAndMinute(String hourAndMinute) {
return hourAndMinute.substring(0, 2);
}
///从深夜00时中获取00
_getHourFromTitle(String title) {
return title.substring(2, 4);
}
// 第一列当前选中第几个
_getFirSelected(String hourAndMinute, List data) {
String hour = _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 = _getMinuteFromhourAndMinute(hourAndMinute);
if (minute == '00') {
return 0;
}
return 1;
}
/// 0 还是 30
/// 从07:00中获取0 或者 30
_getMinuteFromhourAndMinute(String hourAndMinute) {
return hourAndMinute.substring(3, 5);
}
///获取选择器数据
_getPickerData(String lastTime) {
String hour = _getHourFromhourAndMinute(lastTime);
String minute = _getMinuteFromhourAndMinute(lastTime);
if (minute == '30') {
hour = '${int.parse(hour) + 1}';
}
List tempList = List();
tempList.addAll(dateData);
tempList.removeRange(0, int.parse(hour));
return tempList;
}
///判断时间大小
/// a > b
_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) {
a = b;
callback(true);
///从时间选择器中获取分钟数字符串 00 or 30
String _getMinuteStrFromPicker(List data, List value) {
if (data.length == 1) {
return '30';
} else {
callback(false);
if (value[1] == 0) {
return '00';
} else {
return '30';
}
}
}
_compare(String time) {
setState(() {
_compareDateTime(morning.start, time, (needChange) {
if (needChange) {
morning.start = time;
}
});
_compareDateTime(morning.end, time, (needChange) {
if (needChange) {
morning.end = time;
}
});
_compareDateTime(noon.start, time, (needChange) {
if (needChange) {
noon.start = time;
}
});
_compareDateTime(noon.end, time, (needChange) {
if (needChange) {
noon.end = time;
}
});
_compareDateTime(night.start, time, (needChange) {
if (needChange) {
night.start = time;
}
});
_compareDateTime(night.end, time, (needChange) {
if (needChange) {
night.end = time;
}
});
});
///底部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) {
return Scaffold(
key: _scaffoldKey,
body: SafeArea(
child: SingleChildScrollView(
child: Column(
children: [
MyAppBar(
"可订时段",
showBack: true,
),
_itemWidget('早市', morning.start, morning.end, 0),
VEmptyView(20),
_itemWidget('午市', noon.start, noon.end, 1),
VEmptyView(20),
_itemWidget('晚市', night.start, night.end, 2),
],
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,7 @@ 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';
... ... @@ -35,6 +36,7 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
void initState() {
// TODO: implement initState
super.initState();
controller = ScrollController(initialScrollOffset: 0.0);
WidgetsBinding.instance.addObserver(this);
Utils.getCurrVersion().then((version) {
... ... @@ -46,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
... ... @@ -73,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) {
... ... @@ -103,227 +116,209 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
fontWeight: FontWeight.normal,
decoration: TextDecoration.none),
)),
body: NestedScrollView(
controller: controller,
headerSliverBuilder:
(BuildContext context, bool innerBoxIsScrolled) {
return <Widget>[
SliverAppBar(
pinned: false,
floating: true,
expandedHeight: ScreenUtil().setWidth(242),
flexibleSpace: FlexibleSpaceBar(
collapseMode: CollapseMode.pin,
background: Container(
//头部整个背景颜色
// height: ScreenUtil().getAdapterSize(800),
child: Consumer<UserModel>(builder:
(BuildContext context, UserModel model,
Widget child) {
return Stack(
children: [
Container(
width: double.infinity,
height: ScreenUtil().setHeight(242 + 121),
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 SingleChildScrollView(
physics: NeverScrollableScrollPhysics(),
body: Consumer<UserModel>(
builder: (BuildContext context, UserModel model, Widget child) {
return MediaQuery.removePadding(
context: context,
child: SingleChildScrollView(
child: Column(
children: <Widget>[
VEmptyView(40),
MyItem(
title: "短信管理",
content: myModel.smsInfo.isNotEmpty
? '剩余${myModel.smsInfo}条'
: '',
callback: () {
Utils.goMiniProgramZm(context, "setting/sms");
},
),
MyDivider(
double.infinity,
ScreenUtil().setHeight(1),
color: MyColours.color_f3f3f3,
),
MyItem(
title: "包间类型置满管理",
content: "",
callback: () {
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: () {},
),
VEmptyView(40),
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);
},
children: <Widget>[
Stack(
children: [
Container(
width: double.infinity,
height: ScreenUtil().setHeight(200),
alignment: Alignment.centerLeft,
color: MyColours.color_199095,
),
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>[
Padding(
padding:
EdgeInsets.only(left: ScreenUtil().setWidth(40)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
VEmptyView(38),
Text(
"版本更新",
model.user.sellername,
style: TextStyle(
fontSize: ScreenUtil().setSp(30),
color: MyColours.color_353535),
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)),
),
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),
)
],
))
],
),
VEmptyView(40),
MyItem(
title: "短信管理",
content: myModel.smsInfo.isNotEmpty
? '剩余${myModel.smsInfo}条'
: '',
callback: () {
Utils.goMiniProgramZm(context, "setting/sms");
},
),
MyDivider(
double.infinity,
ScreenUtil().setHeight(1),
color: MyColours.color_f3f3f3,
),
MyItem(
title: "包间类型置满管理",
content: "",
callback: () {
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);
},
),
VEmptyView(40),
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),
),
),
),
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),
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),
),
HEmptyView(18),
Text("退出登录",
style: TextStyle(
color: MyColours.color_199095,
fontSize: ScreenUtil().setSp(34),
))
],
),
)
: 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;
});
}
}
... ...
... ... @@ -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;
}
}
}
}
... ...
... ... @@ -48,4 +48,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);
}
... ...
... ... @@ -13,9 +13,11 @@ 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/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';
... ... @@ -139,5 +141,13 @@ var handleChangeDetailHandler = new Handler(
// 跳转可订时段管理页面
var handleBookTimeSetHandler = new Handler(
handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
return BookTimeSetPage();
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());
});
... ...
... ... @@ -15,7 +15,8 @@ class Routes {
static String webview = "/webview"; //网页
static String web_page = '/web_page'; //隐私协议
static String change_detail = "/change_detail"; //变更预订
static String book_time_set = "/book_time_set"; //可订时段管理
static String book_time_set = "/book_time_set"; //可订时段管理
static String receive_orders_time_set = "/receive_orders_time_set"; //接单时间管理
static void configureRoutes(Router router) {
router.notFoundHandler = new Handler(
... ... @@ -34,5 +35,7 @@ class Routes {
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);
}
}
... ...
... ... @@ -683,14 +683,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))),
... ... @@ -704,9 +706,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),
... ... @@ -723,10 +725,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,
... ... @@ -743,34 +745,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, '确认');
// },
// ),
// ],
// );
},
);
... ...
... ... @@ -110,4 +110,9 @@ class NavigatorUtil {
static void goBookTimeSetPage(BuildContext context) {
_navigateTo(context, "${Routes.book_time_set}");
}
/// 可订时段管理
static void goReceiveOrdersTimeSetPage(BuildContext context) {
_navigateTo(context, "${Routes.receive_orders_time_set}");
}
}
... ...
... ... @@ -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, toastLength:Toast.LENGTH_LONG,gravity: ToastGravity.CENTER);
Fluttertoast.showToast(
msg: msg, toastLength: Toast.LENGTH_LONG, gravity: ToastGravity.CENTER);
}
//本地图片资源路径
... ... @@ -196,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),
... ...