Commit 9002f6aa28071bfa149e1132c0db0fd481541c45

Authored by wdn127929
1 parent 37a42703

3。7。0初次提交测试

... ... @@ -9,6 +9,7 @@ import android.util.Log
import io.flutter.plugin.common.MethodChannel
import io.flutter.plugin.common.MethodCall
import android.content.Intent
import me.yohom.foundation_fluttify.gMethodChannel
class MainActivity: FlutterActivity() {
... ... @@ -26,12 +27,15 @@ class MainActivity: FlutterActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// flutter版本更新后使用 getFlutterEngine().getDartExecutor().getBinaryMessenger()代替 getFlutterView()
val channel = MethodChannel(getFlutterEngine()?.getDartExecutor()?.getBinaryMessenger(), CHANNEL)
// 这里要获取启动时的intent
val uri = intent.data
if(intent.data != null){
Log.i("flutter","onCreate"+intent.data.toString())
}
val paramsMap = mutableMapOf<String, String>()
if (uri != null) {
val set = uri.queryParameterNames
... ... @@ -52,7 +56,11 @@ class MainActivity: FlutterActivity() {
}
override fun onNewIntent(intent: Intent) {
super.onNewIntent(intent)
// flutter版本更新后使用 getFlutterEngine().getDartExecutor().getBinaryMessenger()代替 getFlutterView()
if(intent.data != null){
Log.i("flutter","onNewIntent"+intent.data.toString())
}
// flutter版本更新后使用 getFlutterEngine().getDartExecutor().getBinaryMessenger()代替 getFlutterView()
val channel = MethodChannel(getFlutterEngine()?.getDartExecutor()?.getBinaryMessenger(), CHANNEL)
// 这里要获取启动时的intent
... ... @@ -68,12 +76,15 @@ class MainActivity: FlutterActivity() {
intentMap = paramsMap
channel.setMethodCallHandler { call, result ->
Log.i(TAG,intentMap.toString());
when (call.method) {
"getIntent" -> get_intent(call, result)
}
}
channel.invokeMethod("getIntent",intentMap)
// channel.setMethodCallHandler { call, result ->
// Log.i(TAG,intentMap.toString());
// when (call.method) {
// "getIntent" -> get_intent(call, result)
// }
// }
}
// 获取intent
... ...
... ... @@ -101,26 +101,29 @@ class NewUnmessage extends Object {
@JsonKey(name: 'room_info')
dynamic room_info;
@JsonKey(name: 'uname')
String uname;
NewUnmessage(
this.id,
this.uid,
this.message_type,
this.handle_time,
this.read_time,
this.is_read,
this.is_handle,
this.ddate,
this.rname,
this.sex,
this.cdate,
this.rid,
this.room_demand,
this.ddate_solt,
this.ddate_long,
this.cancelName,
this.status,
this.room_info,
);
this.id,
this.uid,
this.message_type,
this.handle_time,
this.read_time,
this.is_read,
this.is_handle,
this.ddate,
this.rname,
this.sex,
this.cdate,
this.rid,
this.room_demand,
this.ddate_solt,
this.ddate_long,
this.cancelName,
this.status,
this.room_info,
this.uname);
String get rnameStr {
if (rname == null || rname == '') return "";
... ...
... ... @@ -60,6 +60,7 @@ NewUnmessage _$NewUnmessageFromJson(Map<String, dynamic> json) {
json['cancel_name'] as dynamic,
json['status'] as dynamic,
json['room_info'] as dynamic,
json['uname'] as String,
);
}
... ... @@ -83,4 +84,5 @@ Map<String, dynamic> _$NewUnmessageToJson(NewUnmessage instance) =>
'cancel_name': instance.cancelName,
'status': instance.status,
'room_info': instance.room_info,
'uname': instance.uname
};
... ...
... ... @@ -4,6 +4,7 @@ import 'dart:io';
import 'package:common_utils/common_utils.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_app_update/azhon_app_update.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/models/new_unmessage_model.dart';
... ... @@ -40,8 +41,15 @@ class HomePage extends StatefulWidget {
final bool needReresh;
final bool mine;
final DateTime date;
final String solt;
HomePage({this.initialIndex = 1, this.needReresh = true, this.mine = false});
HomePage(
{this.initialIndex = 1,
this.needReresh = true,
this.mine = false,
this.date,
this.solt});
@override
State<StatefulWidget> createState() {
... ... @@ -66,6 +74,21 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
PageController _pageController;
bool needUpdate = true;
bool needRefreshTemp = true;
static const MethodChannel _channel = MethodChannel("com.naji/book");
//实现监听
Future<dynamic> platformCallHandler(MethodCall call) async {
switch (call.method) {
case "getIntent":
// dynamic result = await _channel.invokeMethod("getIntent");
// return result;
dynamic result = call.arguments;
print(result);
_getIntent(result);
break;
}
}
@override
void initState() {
... ... @@ -73,6 +96,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
super.initState();
LogUtil.v("home_initState");
needRefreshTemp = widget.needReresh;
_channel.setMethodCallHandler(platformCallHandler); //设置监听
AzhonAppUpdate.listener(
// () {
... ... @@ -103,6 +127,8 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
child: SafeArea(
child: NoteBookPage(
tabIndex: widget.mine ? 1 : 0,
date: widget.date,
solt: widget.solt,
)),
))
..add(ChangeNotifierProvider<TableManagerModel>(
... ... @@ -145,10 +171,9 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
});
}
}
// if (widget.initialIndex == 0 ||
// if (widget.initialIndex == 1 && needRefreshTemp == false) return;
if (widget.initialIndex == 0) return;
_getIntent();
if (widget.initialIndex == 0 ||
widget.initialIndex == 1 && needRefreshTemp == false) return;
_initNotification();
Future.delayed(Duration(milliseconds: 30000), () {
ContactModel.getInstance().uploadLocalContact(context);
if (needUpdate) {
... ... @@ -165,6 +190,11 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
});
}
_initNotification() async {
Map param = await Tools().getIntent();
_getIntent(param);
}
_endTimerSeller() {
if (timerSeller != null) {
timerSeller.cancel();
... ... @@ -202,9 +232,9 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
}
//获取点击通知栏的自定义参数
_getIntent() async {
_getIntent(Map param) async {
_clearBadge(() {});
Map param = await Tools().getIntent();
Map notifyParam = param;
if (Platform.isIOS && param != null) {
notifyParam = json.decode(param['custom'].toString());
... ... @@ -261,7 +291,21 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
case "15":
//店内消息
NavigatorUtil.goHomePage(context,
initialIndex: 1, needRefresh: false, mine: true);
initialIndex: 1,
needRefresh: false,
mine: true,
dateTime:
DateTime.parse(notifyParam['ddate'].replaceAll('/', '-'))
.millisecondsSinceEpoch,
solt: notifyParam['ddate_solt']);
Map<String, String> params = {
"sid": Provider.of<UserModel>(context, listen: false).user.sellerid,
"id": notifyParam['mid'],
"status": "is_read"
};
MessageDialogModel messageDialogModel =
Provider.of<MessageDialogModel>(context, listen: false);
await messageDialogModel.setMessageStatus(context, params);
break;
case "16":
//经理取消预订
... ... @@ -426,7 +470,13 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
break;
case "15":
//店内消息
NavigatorUtil.goHomePage(context, initialIndex: 1, mine: true);
NavigatorUtil.goHomePage(context,
initialIndex: 1,
needRefresh: false,
mine: true,
dateTime: DateTime.parse(custom['ddate'].replaceAll('/', '-'))
.millisecondsSinceEpoch,
solt: custom['ddate_solt']);
Map<String, String> params = {
"sid": Provider.of<UserModel>(context, listen: false)
.user
... ... @@ -562,12 +612,12 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
super.didChangeAppLifecycleState(state);
switch (state) {
case AppLifecycleState.resumed: //应用前台可见
// if (widget.initialIndex == 1 && needRefreshTemp == false) {
// } else {
// _clearBadge(() {
// _getAllUnMessages();
// });
// }
if (widget.initialIndex == 1 && needRefreshTemp == false) {
} else {
_clearBadge(() {
_getAllUnMessages();
});
}
break;
case AppLifecycleState.inactive:
... ...
... ... @@ -66,6 +66,10 @@ class MessageDialogItemF extends StatelessWidget {
titleText = "店内\n消息";
bgcolor = MyColours.color_5F7292;
btnname = 'store_info_go';
} else if (message.message_type == "16") {
titleText = "取消\n预订";
bgcolor = MyColours.color_999999;
btnname = 'cancel_go';
}
if (isTreated) {
bgcolor = MyColours.color_BFC4D4;
... ... @@ -96,6 +100,19 @@ class MessageDialogItemF extends StatelessWidget {
};
await messageDialogModel.setMessageStatus(context, params);
bus.emit("refresh_untreated_num"); //刷新未读消息数目
} else if (message.message_type == "16") {
NavigatorUtil.goNotebookDetailPage(
context, message.rid.toString(), message.uid);
bus.emit("remove_untreated_message", message.id);
Map<String, String> params = {
"sid":
Provider.of<UserModel>(context, listen: false).user.sellerid,
"id": message.id,
"status": message.message_type == "1" ? "is_read" : "is_handle"
};
await messageDialogModel.setMessageStatus(context, params);
bus.emit("refresh_untreated_num"); //刷新未读消息数目
} else if (message.message_type == "1") {
//提前点餐
NavigatorUtil.goHasOrderFoodPage(context, rid: message.rid);
... ... @@ -140,6 +157,25 @@ class MessageDialogItemF extends StatelessWidget {
};
await messageDialogModel.setMessageStatus(context, params);
bus.emit("refresh_untreated_num"); //刷新未读消息数目
} else if (message.message_type == "15") {
//店内消息
NavigatorUtil.goHomePage(context,
initialIndex: 1,
needRefresh: false,
mine: true,
dateTime: DateTime.parse(message.ddate.replaceAll('/', '-'))
.millisecondsSinceEpoch,
solt: message.ddate_solt);
bus.emit("remove_untreated_message", message.id);
Map<String, String> params = {
"sid":
Provider.of<UserModel>(context, listen: false).user.sellerid,
"id": message.id,
"status": message.message_type == "1" ? "is_read" : "is_handle"
};
await messageDialogModel.setMessageStatus(context, params);
bus.emit("refresh_untreated_num"); //刷新未读消息数目
}
},
child: Stack(
... ... @@ -211,81 +247,81 @@ class MessageDialogItemF extends StatelessWidget {
fontSize:
ScreenUtil().setSp(32)),
)),
attr == '' || attr == null
? Container(
margin: EdgeInsets.only(
right: ScreenUtil()
.setWidth(12)),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil()
.setWidth(16),
vertical: ScreenUtil()
.setWidth(6)),
decoration: BoxDecoration(
color: isTreated
? MyColours.color_BFC4D4
: attr == '沉睡'
? Color.fromRGBO(
223, 33, 81, 1)
: attr == '活跃'
? Color
.fromRGBO(
81,
170,
94,
1)
: attr == '流失'
? Color
.fromRGBO(
109,
101,
248,
1)
: Color
.fromRGBO(
239,
143,
49,
1),
borderRadius:
BorderRadius.circular(
8)),
child: Text(
'活跃',
style: TextStyle(
color: MyColours
.color_ffffff,
fontSize: ScreenUtil()
.setSp(24)),
),
)
: SizedBox(),
Container(
padding: EdgeInsets.symmetric(
horizontal:
ScreenUtil().setWidth(16),
vertical:
ScreenUtil().setWidth(6)),
decoration: BoxDecoration(
border: Border.all(
width: ScreenUtil().setWidth(2),
color: isTreated
? MyColours.color_BFC4D4
: MyColours.color_F2995F,
),
borderRadius:
BorderRadius.circular(8)),
child: Text(
'biaoqianvipdsds',
// overflow: TextOverflow.ellipsis,
style: TextStyle(
color: isTreated
? MyColours.color_BFC4D4
: MyColours.color_F2995F,
fontSize:
ScreenUtil().setSp(24)),
),
)
// attr == '' || attr == null
// ? Container(
// margin: EdgeInsets.only(
// right: ScreenUtil()
// .setWidth(12)),
// padding: EdgeInsets.symmetric(
// horizontal: ScreenUtil()
// .setWidth(16),
// vertical: ScreenUtil()
// .setWidth(6)),
// decoration: BoxDecoration(
// color: isTreated
// ? MyColours.color_BFC4D4
// : attr == '沉睡'
// ? Color.fromRGBO(
// 223, 33, 81, 1)
// : attr == '活跃'
// ? Color
// .fromRGBO(
// 81,
// 170,
// 94,
// 1)
// : attr == '流失'
// ? Color
// .fromRGBO(
// 109,
// 101,
// 248,
// 1)
// : Color
// .fromRGBO(
// 239,
// 143,
// 49,
// 1),
// borderRadius:
// BorderRadius.circular(
// 8)),
// child: Text(
// '活跃',
// style: TextStyle(
// color: MyColours
// .color_ffffff,
// fontSize: ScreenUtil()
// .setSp(24)),
// ),
// )
// : SizedBox(),
// Container(
// padding: EdgeInsets.symmetric(
// horizontal:
// ScreenUtil().setWidth(16),
// vertical:
// ScreenUtil().setWidth(6)),
// decoration: BoxDecoration(
// border: Border.all(
// width: ScreenUtil().setWidth(2),
// color: isTreated
// ? MyColours.color_BFC4D4
// : MyColours.color_F2995F,
// ),
// borderRadius:
// BorderRadius.circular(8)),
// child: Text(
// 'biaoqianvipdsds',
// // overflow: TextOverflow.ellipsis,
// style: TextStyle(
// color: isTreated
// ? MyColours.color_BFC4D4
// : MyColours.color_F2995F,
// fontSize:
// ScreenUtil().setSp(24)),
// ),
// )
]);
})),
VEmptyView(16),
... ... @@ -315,7 +351,9 @@ class MessageDialogItemF extends StatelessWidget {
],
))
: SizedBox(),
message.message_type == "11" || message.message_type == "1"
message.message_type == "11" ||
message.message_type == "16" ||
message.message_type == "1"
? Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
... ... @@ -345,7 +383,9 @@ class MessageDialogItemF extends StatelessWidget {
message.message_type == "1"
? SizedBox()
: Text(
true ? '取消操作人:顾客在线取消' : '取消操作人:方硕',
message.message_type == "11"
? '取消操作人:顾客在线取消'
: '取消操作人:${message.uname}',
style: TextStyle(
color: isTreated
? MyColours.color_BFC4D4
... ... @@ -355,12 +395,12 @@ class MessageDialogItemF extends StatelessWidget {
],
)
: SizedBox(),
message.message_type == "店内消息"
message.message_type == "15"
? Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"请确认 2022-04-02 午餐 客人是否会如约到店!",
"请确认 ${DateUtil.formatDate(DateTime.parse(message.ddate.replaceAll('/', '-')), format: DateFormats.y_mo_d)} ${message.dsoltStr} \n客人是否会如约到店!",
style: TextStyle(
color: isTreated
? MyColours.color_BFC4D4
... ... @@ -414,6 +454,23 @@ class MessageDialogItemF extends StatelessWidget {
await messageDialogModel.setMessageStatus(
context, params);
bus.emit("refresh_untreated_num"); //刷新未读消息数目
} else if (message.message_type == "16") {
NavigatorUtil.goNotebookDetailPage(
context, message.rid.toString(), message.uid);
bus.emit("remove_untreated_message", message.id);
Map<String, String> params = {
"sid": Provider.of<UserModel>(context, listen: false)
.user
.sellerid,
"id": message.id,
"status": message.message_type == "1"
? "is_read"
: "is_handle"
};
await messageDialogModel.setMessageStatus(
context, params);
bus.emit("refresh_untreated_num"); //刷新未读消息数目
} else if (message.message_type == "1") {
//提前点餐
NavigatorUtil.goHasOrderFoodPage(context,
... ... @@ -472,6 +529,29 @@ class MessageDialogItemF extends StatelessWidget {
await messageDialogModel.setMessageStatus(
context, params);
bus.emit("refresh_untreated_num"); //刷新未读消息数目
} else if (message.message_type == "15") {
//店内消息
NavigatorUtil.goHomePage(context,
initialIndex: 1,
needRefresh: false,
mine: true,
dateTime:
DateTime.parse(message.ddate.replaceAll('/', '-'))
.millisecondsSinceEpoch,
solt: message.ddate_solt);
bus.emit("remove_untreated_message", message.id);
Map<String, String> params = {
"sid": Provider.of<UserModel>(context, listen: false)
.user
.sellerid,
"id": message.id,
"status": message.message_type == "1"
? "is_read"
: "is_handle"
};
await messageDialogModel.setMessageStatus(
context, params);
bus.emit("refresh_untreated_num"); //刷新未读消息数目
}
},
child: Image.asset(
... ...
... ... @@ -62,6 +62,10 @@ class MessageItemF extends StatelessWidget {
titleText = "店内\n消息";
bgcolor = MyColours.color_5F7292;
btnname = 'store_info_go';
} else if (message.message_type == "16") {
titleText = "取消\n预订";
bgcolor = MyColours.color_999999;
btnname = 'cancel_go';
}
if (isTreated) {
bgcolor = MyColours.color_BFC4D4;
... ... @@ -101,6 +105,15 @@ class MessageItemF extends StatelessWidget {
} else if (message.message_type == "14") {
//发票详情页面跳转
NavigatorUtil.goInvoiceDetailPage(context, rid: '${message.rid}');
} else if (message.message_type == "15") {
//店内消息
NavigatorUtil.goHomePage(context,
initialIndex: 1,
needRefresh: false,
mine: true,
dateTime: DateTime.parse(message.ddate.replaceAll('/', '-'))
.millisecondsSinceEpoch,
solt: message.ddate_solt);
}
} else {
messageDialogModel.removeMessage(message.id);
... ... @@ -186,7 +199,12 @@ class MessageItemF extends StatelessWidget {
} else if (message.message_type == "15") {
//店内消息
NavigatorUtil.goHomePage(context,
initialIndex: 1, needRefresh: false, mine: true);
initialIndex: 1,
needRefresh: false,
mine: true,
dateTime: DateTime.parse(message.ddate.replaceAll('/', '-'))
.millisecondsSinceEpoch,
solt: message.ddate_solt);
bus.emit("remove_untreated_message", message.id);
Map<String, String> params = {
... ... @@ -270,81 +288,81 @@ class MessageItemF extends StatelessWidget {
fontSize:
ScreenUtil().setSp(32)),
)),
attr == '' || attr == null
? Container(
margin: EdgeInsets.only(
right: ScreenUtil()
.setWidth(12)),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil()
.setWidth(16),
vertical: ScreenUtil()
.setWidth(6)),
decoration: BoxDecoration(
color: isTreated
? MyColours.color_BFC4D4
: attr == '沉睡'
? Color.fromRGBO(
223, 33, 81, 1)
: attr == '活跃'
? Color
.fromRGBO(
81,
170,
94,
1)
: attr == '流失'
? Color
.fromRGBO(
109,
101,
248,
1)
: Color
.fromRGBO(
239,
143,
49,
1),
borderRadius:
BorderRadius.circular(
8)),
child: Text(
'活跃',
style: TextStyle(
color: MyColours
.color_ffffff,
fontSize: ScreenUtil()
.setSp(24)),
),
)
: SizedBox(),
Container(
padding: EdgeInsets.symmetric(
horizontal:
ScreenUtil().setWidth(16),
vertical:
ScreenUtil().setWidth(6)),
decoration: BoxDecoration(
border: Border.all(
width: ScreenUtil().setWidth(2),
color: isTreated
? MyColours.color_BFC4D4
: MyColours.color_F2995F,
),
borderRadius:
BorderRadius.circular(8)),
child: Text(
'biaoqianvipdsds',
// overflow: TextOverflow.ellipsis,
style: TextStyle(
color: isTreated
? MyColours.color_BFC4D4
: MyColours.color_F2995F,
fontSize:
ScreenUtil().setSp(24)),
),
)
// attr == '' || attr == null
// ? Container(
// margin: EdgeInsets.only(
// right: ScreenUtil()
// .setWidth(12)),
// padding: EdgeInsets.symmetric(
// horizontal: ScreenUtil()
// .setWidth(16),
// vertical: ScreenUtil()
// .setWidth(6)),
// decoration: BoxDecoration(
// color: isTreated
// ? MyColours.color_BFC4D4
// : attr == '沉睡'
// ? Color.fromRGBO(
// 223, 33, 81, 1)
// : attr == '活跃'
// ? Color
// .fromRGBO(
// 81,
// 170,
// 94,
// 1)
// : attr == '流失'
// ? Color
// .fromRGBO(
// 109,
// 101,
// 248,
// 1)
// : Color
// .fromRGBO(
// 239,
// 143,
// 49,
// 1),
// borderRadius:
// BorderRadius.circular(
// 8)),
// child: Text(
// '活跃',
// style: TextStyle(
// color: MyColours
// .color_ffffff,
// fontSize: ScreenUtil()
// .setSp(24)),
// ),
// )
// : SizedBox(),
// Container(
// padding: EdgeInsets.symmetric(
// horizontal:
// ScreenUtil().setWidth(16),
// vertical:
// ScreenUtil().setWidth(6)),
// decoration: BoxDecoration(
// border: Border.all(
// width: ScreenUtil().setWidth(2),
// color: isTreated
// ? MyColours.color_BFC4D4
// : MyColours.color_F2995F,
// ),
// borderRadius:
// BorderRadius.circular(8)),
// child: Text(
// 'biaoqianvipdsds',
// // overflow: TextOverflow.ellipsis,
// style: TextStyle(
// color: isTreated
// ? MyColours.color_BFC4D4
// : MyColours.color_F2995F,
// fontSize:
// ScreenUtil().setSp(24)),
// ),
// )
]);
})),
VEmptyView(16),
... ... @@ -377,7 +395,9 @@ class MessageItemF extends StatelessWidget {
],
))
: SizedBox(),
message.message_type == "11" || message.message_type == "1"
message.message_type == "11" ||
message.message_type == "16" ||
message.message_type == "1"
? Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
... ... @@ -430,7 +450,9 @@ class MessageItemF extends StatelessWidget {
message.message_type == "1"
? SizedBox()
: Text(
'取消操作人:${message.cancelName}',
message.message_type == "11"
? '取消操作人:顾客在线取消'
: '取消操作人:${message.uname}',
style: TextStyle(
color: isTreated
? MyColours.color_BFC4D4
... ... @@ -573,8 +595,15 @@ class MessageItemF extends StatelessWidget {
bus.emit("refresh_untreated_num"); //刷新未读消息数目
} else if (message.message_type == "15") {
//店内消息
NavigatorUtil.goHomePage(context,
initialIndex: 1, needRefresh: false, mine: true);
initialIndex: 1,
needRefresh: false,
mine: true,
dateTime:
DateTime.parse(message.ddate.replaceAll('/', '-'))
.millisecondsSinceEpoch,
solt: message.ddate_solt);
bus.emit("remove_untreated_message", message.id);
Map<String, String> params = {
"sid": Provider.of<UserModel>(context, listen: false)
... ...
... ... @@ -23,7 +23,11 @@ import 'package:provider/provider.dart';
class NoteBookPage extends StatefulWidget {
final int tabIndex;
const NoteBookPage({Key key, this.tabIndex = 0}) : super(key: key);
final DateTime date;
final String solt;
const NoteBookPage({Key key, this.tabIndex = 0, this.date, this.solt})
: super(key: key);
@override
State<StatefulWidget> createState() {
// TODO: implement createState
... ... @@ -75,69 +79,84 @@ class NoteBookPageState extends State<NoteBookPage> {
//初始化时间
_initTime() {
dateTimeNow = DateTime.now();
dateTimeNow = widget.date != null ? widget.date : DateTime.now();
dateText = "${dateTimeNow.year}年 " +
Utils.addZeroNumber(dateTimeNow.month) +
"月" +
Utils.addZeroNumber(dateTimeNow.day) +
"日" +
" 今天";
"日";
DateTime dateNow = DateTime.now();
if (Utils.isOneDay(dateTimeNow, dateNow)) {
dateText += " 今天";
} else if (Utils.isOneDay(dateTimeNow, dateNow.add(Duration(days: 1)))) {
dateText += " 明天";
} else if (Utils.isOneDay(dateTimeNow, dateNow.add(Duration(days: 2)))) {
dateText += " 后天";
} else {
dateText += " 周${Utils.formatWeekDayNum(dateTimeNow.weekday)}";
}
morning =
userModel.user.morning.isEmpty ? "00:00-00:00" : userModel.user.morning;
noon = userModel.user.noon.isEmpty ? "00:00-00:00" : userModel.user.noon;
night = userModel.user.night.isEmpty ? "00:00-00:00" : userModel.user.night;
if (morning != '' &&
dateTimeNow.isBefore(DateTime.parse(dateTimeNow.year.toString() +
"-" +
Utils.addZeroNumber(dateTimeNow.month) +
"-" +
Utils.addZeroNumber(dateTimeNow.day) +
" " +
morning.split("-")[1] +
":00"))) {
//未过早市
currTimeIndex = 1;
} else if (noon != '' &&
dateTimeNow.isAfter(DateTime.parse(dateTimeNow.year.toString() +
"-" +
Utils.addZeroNumber(dateTimeNow.month) +
"-" +
Utils.addZeroNumber(dateTimeNow.day) +
" " +
morning.split("-")[1] +
":00")) &&
dateTimeNow.isBefore(DateTime.parse(dateTimeNow.year.toString() +
"-" +
Utils.addZeroNumber(dateTimeNow.month) +
"-" +
Utils.addZeroNumber(dateTimeNow.day) +
" " +
noon.split("-")[1] +
":00"))) {
//过了早市,未过午市
currTimeIndex = 2;
} else if (night != '' &&
dateTimeNow.isAfter(DateTime.parse(dateTimeNow.year.toString() +
"-" +
Utils.addZeroNumber(dateTimeNow.month) +
"-" +
Utils.addZeroNumber(dateTimeNow.day) +
" " +
noon.split("-")[1] +
":00")) &&
dateTimeNow.isBefore(DateTime.parse(dateTimeNow.year.toString() +
"-" +
Utils.addZeroNumber(dateTimeNow.month) +
"-" +
Utils.addZeroNumber(dateTimeNow.day) +
" " +
night.split("-")[1] +
":00"))) {
//过了午市,未过晚市
currTimeIndex = 3;
if (widget.solt != null) {
currTimeIndex = int.parse(widget.solt);
} else {
//过了晚市
currTimeIndex = 3;
if (morning != '' &&
dateTimeNow.isBefore(DateTime.parse(dateTimeNow.year.toString() +
"-" +
Utils.addZeroNumber(dateTimeNow.month) +
"-" +
Utils.addZeroNumber(dateTimeNow.day) +
" " +
morning.split("-")[1] +
":00"))) {
//未过早市
currTimeIndex = 1;
} else if (noon != '' &&
dateTimeNow.isAfter(DateTime.parse(dateTimeNow.year.toString() +
"-" +
Utils.addZeroNumber(dateTimeNow.month) +
"-" +
Utils.addZeroNumber(dateTimeNow.day) +
" " +
morning.split("-")[1] +
":00")) &&
dateTimeNow.isBefore(DateTime.parse(dateTimeNow.year.toString() +
"-" +
Utils.addZeroNumber(dateTimeNow.month) +
"-" +
Utils.addZeroNumber(dateTimeNow.day) +
" " +
noon.split("-")[1] +
":00"))) {
//过了早市,未过午市
currTimeIndex = 2;
} else if (night != '' &&
dateTimeNow.isAfter(DateTime.parse(dateTimeNow.year.toString() +
"-" +
Utils.addZeroNumber(dateTimeNow.month) +
"-" +
Utils.addZeroNumber(dateTimeNow.day) +
" " +
noon.split("-")[1] +
":00")) &&
dateTimeNow.isBefore(DateTime.parse(dateTimeNow.year.toString() +
"-" +
Utils.addZeroNumber(dateTimeNow.month) +
"-" +
Utils.addZeroNumber(dateTimeNow.day) +
" " +
night.split("-")[1] +
":00"))) {
//过了午市,未过晚市
currTimeIndex = 3;
} else {
//过了晚市
currTimeIndex = 3;
}
}
}
... ...
... ... @@ -234,7 +234,7 @@ class MessageModel extends ChangeNotifier {
removeUntreatedMessageByMid(String mid) {
messages.removeWhere((element) => element.id == mid);
if (messages.length == 0) {
pageState = PageState.Empty;
pageStateUn = PageState.Empty;
}
notifyListeners();
}
... ...
... ... @@ -55,9 +55,13 @@ class NavigatorUtil {
/// 首页
static void goHomePage(BuildContext context,
{int initialIndex = 1, needRefresh = true, mine = false}) {
{int initialIndex = 1,
needRefresh = true,
mine = false,
int dateTime,
String solt}) {
_navigateTo(context,
"${Routes.home}?initialIndex=$initialIndex&needRefresh=$needRefresh&mine=$mine",
"${Routes.home}?initialIndex=$initialIndex&needRefresh=$needRefresh&mine=$mine&dateTime=$dateTime&solt=$solt",
clearStack: true);
}
... ...
... ... @@ -148,11 +148,18 @@ var homeHandler = new Handler(
String initialIndex = params["initialIndex"].first;
bool needRefresh = FluroConvertUtils.string2bool(params["needRefresh"].first);
bool mine = FluroConvertUtils.string2bool(params["mine"].first);
String solt = params["solt"].first;
DateTime dateTime =
DateTime.fromMillisecondsSinceEpoch(int.parse(params["dateTime"].first));
return HomePage(
initialIndex: int.parse(initialIndex),
needReresh: needRefresh,
mine: mine,
);
initialIndex: int.parse(initialIndex),
needReresh: needRefresh,
mine: mine,
date: dateTime,
solt: solt);
});
// 跳转预订详情页
... ...
... ... @@ -2974,7 +2974,7 @@ class DialogUtil {
isScrollControlled: true,
builder: (BuildContext dialogContext) {
Widget widget = Container(
color: MyColours.color_ffffff,
color:messageModel.messages.length > 3 ? MyColours.color_24A4A8: MyColours.color_ffffff,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
... ... @@ -3008,7 +3008,7 @@ class DialogUtil {
padding: EdgeInsets.all(
ScreenUtil().setWidth(12)),
child: Image.asset(
"assets/close1.png",
"assets/close.png",
width: ScreenUtil().setWidth(28),
height: ScreenUtil().setWidth(28),
),
... ...
... ... @@ -1041,7 +1041,7 @@ packages:
description:
path: "."
ref: "V1.1.6"
resolved-ref: ccc583f7387bbc8a960aaf288bbb6815a0ebe112
resolved-ref: bc1adc7f1d17d10a8de849fbdcb22b9f3e597d74
url: "https://github.com/TencentCloud/TPNS-Flutter-Plugin.git"
source: git
version: "1.1.6"
... ...