Commit cc1b4797ce403eb198f4fea1b694756b52f1685f

Authored by “gaiyaguang”
2 parents ff9b53f2 0df94843

推送iOS原生回传参数给flutter

... ... @@ -13,12 +13,12 @@ if (flutterRoot == null) {
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '112'
flutterVersionCode = '121'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.1.2'
flutterVersionName = '1.2.1'
}
apply plugin: 'com.android.application'
... ...
... ... @@ -31,12 +31,23 @@
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/launch_background" />
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
<!-- 通知栏跳转intent -->
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<data
android:scheme="xgscheme"
android:host="com.naji.book"
android:path="/book_detail" />
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
... ...
... ... @@ -4,10 +4,54 @@ import androidx.annotation.NonNull;
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugins.GeneratedPluginRegistrant
import android.os.Bundle
import android.util.Log
import io.flutter.plugin.common.MethodChannel
import io.flutter.plugin.common.MethodCall
class MainActivity: FlutterActivity() {
private var TAG = "| com.naji.book |"
// 通道名称
private var CHANNEL = "com.naji/book"
// native端的Intent数据
private var intentMap = mutableMapOf<String, String>()
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine);
}
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
val paramsMap = mutableMapOf<String, String>()
if (uri != null) {
val set = uri.queryParameterNames
for (name in set) {
val value = uri.getQueryParameter(name)
paramsMap[name.toString()] = value.toString()
}
}
intentMap = paramsMap
channel.setMethodCallHandler { call, result ->
Log.i(TAG,intentMap.toString());
when (call.method) {
"getIntent" -> get_intent(call, result)
}
}
}
// 获取intent
private fun get_intent(call: MethodCall, result: MethodChannel.Result) {
Log.i(TAG, "调用${call.method}方法")
result.success(intentMap)
}
}
... ...
... ... @@ -7,7 +7,22 @@ import Flutter
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
let controller = self.window.rootViewController as! FlutterViewController
let channel = FlutterMethodChannel.init(name: "com.naji/book", binaryMessenger: controller as! FlutterBinaryMessenger)
channel.setMethodCallHandler { (call, result) in
if call.method == "getIntent" {
// let para = call.arguments
// print(para!)
let userInfo = launchOptions?[UIApplication.LaunchOptionsKey.remoteNotification];
result(userInfo);
}else{
result(FlutterMethodNotImplemented)
}
}
GeneratedPluginRegistrant.register(with: self)
// NSDictionary * userInfo = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];//获取
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}
... ...
... ... @@ -6,8 +6,10 @@ import 'package:flutter_easyrefresh/ball_pulse_footer.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_easyrefresh/material_header.dart';
import 'package:fluwx/fluwx.dart';
import 'package:one_key/pages/detail/handle_online_page.dart';
import 'package:one_key/provider/message_dialog_model.dart';
import 'package:intl/date_symbol_data_local.dart';
import 'package:one_key/provider/tools.dart';
import 'package:one_key/utils/utils.dart';
import 'package:provider/provider.dart';
import 'package:tpns_flutter_plugin/tpns_flutter_plugin.dart';
... ... @@ -29,7 +31,7 @@ Future<void> main() async {
Routes.configureRoutes(router);
App.router = router;
App.setupLocator();
LogUtil.init(isDebug: false, tag: 'ONE_KEY');
LogUtil.init(isDebug: true, tag: 'ONE_KEY');
Provider.debugCheckInvalidValueType = null;
await initializeDateFormatting();
SystemChrome.setPreferredOrientations(
... ... @@ -61,6 +63,7 @@ class MyApp extends StatefulWidget {
}
class MyAppState extends State<MyApp> {
@override
void initState() {
// TODO: implement initState
... ...
... ... @@ -22,9 +22,11 @@ import 'package:provider/provider.dart';
import 'package:one_key/utils/event_bus.dart';
class HandleOnlinePage extends StatefulWidget {
final String rid;
final String mid;
HandleOnlinePage(this.rid, this.mid);
final bool fromNotify;
HandleOnlinePage(this.rid, this.mid, {this.fromNotify=false});
@override
State<StatefulWidget> createState() {
... ... @@ -59,7 +61,7 @@ class HandleOnlinePageState extends State<HandleOnlinePage> {
if (detailEntity.status != "0") {
//已处理
Future.delayed(Duration(milliseconds: 200), () {
NavigatorUtil.goNotebookDetailPage(context, detailEntity.id,
NavigatorUtil.goNotebookDetailPage(context, detailEntity.id,fromNotify: widget.fromNotify,
replace: true);
});
setMessageStatus();
... ... @@ -163,233 +165,234 @@ class HandleOnlinePageState extends State<HandleOnlinePage> {
Widget build(BuildContext context) {
// TODO: implement build
return SafeArea(
child: detailEntity == null
? Container(
width: double.infinity,
height: double.infinity,
color: MyColours.color_ffffff,
)
: Column(
children: <Widget>[
MyAppBar(
"在线预订详情",
showBack: true,
),
Expanded(
child: DefaultTextStyle(
style: TextStyle(decoration: TextDecoration.none),
child: Container(
color: MyColours.color_ffffff,
child: Column(
children: <Widget>[
Expanded(
child: SingleChildScrollView(
child: Container(
color: MyColours.color_ffffff,
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(43)),
child: Column(
child: WillPopScope(
child: detailEntity == null
? Container(
width: double.infinity,
height: double.infinity,
color: MyColours.color_ffffff,
)
: Column(
children: <Widget>[
MyAppBar(
"在线预订详情",
showBack: true,
),
Expanded(
child: DefaultTextStyle(
style: TextStyle(decoration: TextDecoration.none),
child: Container(
color: MyColours.color_ffffff,
child: Column(
children: <Widget>[
Expanded(
child: SingleChildScrollView(
child: Container(
color: MyColours.color_ffffff,
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(43)),
child: Column(
children: <Widget>[
RowMultiText(
"用餐时段", detailEntity.ddateMd),
Stack(
alignment: Alignment.center,
children: <Widget>[
RowMultiText(
"用餐时段", detailEntity.ddateMd),
Stack(
alignment: Alignment.center,
Column(
children: <Widget>[
Column(
children: <Widget>[
RowMultiText("用餐时间",
detailEntity.ddateHm),
Offstage(
offstage:
detailEntity.type == "0"
? false
: true,
child: RowMultiText("用餐人数",
detailEntity.pnum),
)
],
),
Image.asset(
detailEntity.statuImgAssets,
width: ScreenUtil().setWidth(100),
height: ScreenUtil().setWidth(30),
)
],
),
RowMultiText(
"包间需求",
(detailEntity.demands.length
.toString() +
"个") ??
""),
Align(
alignment: Alignment.centerRight,
child: Offstage(
RowMultiText("用餐时间",
detailEntity.ddateHm),
Offstage(
offstage:
detailEntity.demands.length >
0
detailEntity.type == "0"
? false
: true,
child: Container(
height:
ScreenUtil().setHeight(210),
child: ListView.builder(
itemBuilder:
(BuildContext contxt,
int index) {
return NeedItem(detailEntity
.demands[index]);
},
itemCount: detailEntity
.demands.length,
shrinkWrap: true,
scrollDirection:
Axis.horizontal,
),
),
)),
RowMultiText(
"客户姓名", detailEntity.rnameStr),
RowMultiText(
"客户电话", detailEntity.phone),
RowMultiText(
"备注信息", detailEntity.cusdem ?? ""),
MyDivider(double.infinity,
ScreenUtil().setHeight(1)),
Container(
color: MyColours.color_ffffff,
width: double.infinity,
height: ScreenUtil().setHeight(80),
alignment: Alignment.center,
child: Stack(
alignment: Alignment.center,
children: <Widget>[
Positioned(
left: 0,
child: Text(
"客户经理",
style: TextStyle(
color: MyColours
.color_828282,
fontSize: ScreenUtil()
.setSp(30)),
),
),
Positioned(
right: 0,
child: GestureDetector(
onTap: () async {
List<String> list = [];
for (Manager manager
in managers) {
list.add(
manager.roleUserName);
}
DialogUtil
.showSelectCusmanDialog(
context, list,(value){
if(value!=null){
setState(() {
cusmanText = managers[
value.first]
.userName;
});
_setCurrManager();
}
})
.then((value) {
});
},
child: Text(
cusmanText,
style: TextStyle(
color: MyColours
.color_353535,
fontSize: ScreenUtil()
.setSp(30),
decoration: TextDecoration
.underline,
),
),
),
)
],
),
child: RowMultiText("用餐人数",
detailEntity.pnum),
)
],
),
Image.asset(
detailEntity.statuImgAssets,
width: ScreenUtil().setWidth(100),
height: ScreenUtil().setWidth(30),
)
],
)),
),
),
Container(
margin: EdgeInsets.only(
top: ScreenUtil().setHeight(30),
bottom: ScreenUtil().setHeight(30)),
child: Column(
children: <Widget>[
CommonButton(
content: "安排包间",
width: 669,
height: 76,
fontSize: 34,
onPress: () async {
Map map = await NavigatorUtil
.goSelectTablePage(
context,
widget.rid,
int.parse(detailEntity.ddate) *
1000,
detailEntity.ddate_solt);
if (map['tid'] != null) {
setReserveStatus("5", tid: map['tid']);
}
},
),
VEmptyView(20),
Container(
width: ScreenUtil().setWidth(669),
height: ScreenUtil().setHeight(76),
decoration: BoxDecoration(
border: Border.all(
color: MyColours.color_199095),
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(5)),
),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.center,
children: <Widget>[
Expanded(
RowMultiText(
"包间需求",
(detailEntity.demands.length
.toString() +
"个") ??
""),
Align(
alignment: Alignment.centerRight,
child: Offstage(
offstage:
detailEntity.demands.length >
0
? false
: true,
child: Container(
height:
ScreenUtil().setHeight(210),
child: ListView.builder(
itemBuilder:
(BuildContext contxt,
int index) {
return NeedItem(detailEntity
.demands[index]);
},
itemCount: detailEntity
.demands.length,
shrinkWrap: true,
scrollDirection:
Axis.horizontal,
),
),
)),
RowMultiText(
"客户姓名", detailEntity.rnameStr),
RowMultiText(
"客户电话", detailEntity.phone),
RowMultiText(
"备注信息", detailEntity.cusdem ?? ""),
MyDivider(double.infinity,
ScreenUtil().setHeight(1)),
Container(
color: MyColours.color_ffffff,
width: double.infinity,
height: ScreenUtil().setHeight(80),
alignment: Alignment.center,
child: Stack(
alignment: Alignment.center,
children: <Widget>[
Positioned(
left: 0,
child: Text(
"客户经理",
style: TextStyle(
color: MyColours
.color_828282,
fontSize: ScreenUtil()
.setSp(30)),
),
),
Positioned(
right: 0,
child: GestureDetector(
onTap: () async {
List<String> list = [];
for (Manager manager
in managers) {
list.add(
manager.roleUserName);
}
DialogUtil
.showSelectCusmanDialog(
context, list,(value){
if(value!=null){
setState(() {
cusmanText = managers[
value.first]
.userName;
});
_setCurrManager();
}
})
.then((value) {
});
},
child: Text(
cusmanText,
style: TextStyle(
color: MyColours
.color_353535,
fontSize: ScreenUtil()
.setSp(30),
decoration: TextDecoration
.underline,
),
),
),
)
],
),
),
],
)),
),
),
Container(
margin: EdgeInsets.only(
top: ScreenUtil().setHeight(30),
bottom: ScreenUtil().setHeight(30)),
child: Column(
children: <Widget>[
CommonButton(
content: "安排包间",
width: 669,
height: 76,
fontSize: 34,
onPress: () async {
Map map = await NavigatorUtil
.goSelectTablePage(
context,
widget.rid,
int.parse(detailEntity.ddate) *
1000,
detailEntity.ddate_solt);
if (map['tid'] != null) {
setReserveStatus("5", tid: map['tid']);
}
},
),
VEmptyView(20),
Container(
width: ScreenUtil().setWidth(669),
height: ScreenUtil().setHeight(76),
decoration: BoxDecoration(
border: Border.all(
color: MyColours.color_199095),
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(5)),
),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.center,
children: <Widget>[
Expanded(
child: GestureDetector(
child: Center(
child: Text(
"拒绝订单",
style: TextStyle(
color:
MyColours.color_199095,
MyColours.color_199095,
fontSize:
ScreenUtil().setSp(34)),
ScreenUtil().setSp(34)),
),
),
onTap: () {
_showRefuseDialog();
},
)),
MyDivider(
ScreenUtil().setWidth(2),
ScreenUtil().setHeight(52),
color: MyColours.color_199095,
),
Expanded(
child: GestureDetector(
MyDivider(
ScreenUtil().setWidth(2),
ScreenUtil().setHeight(52),
color: MyColours.color_199095,
),
Expanded(
child: GestureDetector(
child: Center(
child: Text(
"联系顾客",
style: TextStyle(
color:
MyColours.color_199095,
MyColours.color_199095,
fontSize:
ScreenUtil().setSp(34)),
ScreenUtil().setSp(34)),
),
),
onTap: () {
... ... @@ -403,17 +406,26 @@ class HandleOnlinePageState extends State<HandleOnlinePage> {
}
},
)),
],
),
)
],
),
)
],
))),
)
],
),
],
),
)
],
),
)
],
))),
)
],
),
onWillPop: ()async{
if(widget.fromNotify){
NavigatorUtil.goHomePage(context,initialIndex: 0);
return true;
}
Navigator.of(context).pop();
return true;
},
)
);
}
}
... ...
... ... @@ -29,8 +29,9 @@ import 'package:provider/provider.dart';
class NotebookDetailPage extends StatefulWidget {
final String rid;
final bool fromNotify;
NotebookDetailPage(this.rid);
NotebookDetailPage(this.rid, {this.fromNotify=false});
@override
State<StatefulWidget> createState() {
... ... @@ -142,7 +143,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
"cause": json.encode(causeMap)
};
bool success =
await detailModel.setReserveStatus(context, params, ifPush: false);
await detailModel.setReserveStatus(context, params, ifPush: false);
if (success) {
_getReserveDetail();
}
... ... @@ -169,7 +170,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
context: context,
barrierDismissible: false,
barrierLabel:
MaterialLocalizations.of(context).modalBarrierDismissLabel,
MaterialLocalizations.of(context).modalBarrierDismissLabel,
transitionDuration: const Duration(milliseconds: 150),
pageBuilder: (BuildContext context, Animation animation,
Animation secondaryAnimation) {
... ... @@ -196,7 +197,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
decoration: BoxDecoration(
color: Colors.white,
borderRadius:
BorderRadius.circular(ScreenUtil().setWidth(10)),
BorderRadius.circular(ScreenUtil().setWidth(10)),
),
child: Column(
mainAxisSize: MainAxisSize.min,
... ... @@ -276,7 +277,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
Text(value['title'],
style: TextStyle(
fontSize:
ScreenUtil().setSp(32),
ScreenUtil().setSp(32),
fontWeight: FontWeight.normal,
decoration: TextDecoration.none,
color: MyColours.color_333333))
... ... @@ -284,42 +285,42 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
),
value['title'] == '其他原因' && isShowTF
? Material(
child: Container(
color: Colors.white,
padding: EdgeInsets.only(
left:
ScreenUtil().setWidth(76)),
child: TextField(
maxLines: 1,
controller: _cancelController,
focusNode: _cancelNode,
textAlignVertical:
TextAlignVertical.bottom,
decoration: InputDecoration(
hintText: "请填写原因",
hintStyle: TextStyle(
color: MyColours.color_999999,
fontSize:
ScreenUtil().setSp(30),
),
enabledBorder:
UnderlineInputBorder(
borderSide: BorderSide(
color: MyColours
.color_d8d8d8),
),
// border: InputBorder.none,
child: Container(
color: Colors.white,
padding: EdgeInsets.only(
left:
ScreenUtil().setWidth(76)),
child: TextField(
maxLines: 1,
controller: _cancelController,
focusNode: _cancelNode,
textAlignVertical:
TextAlignVertical.bottom,
decoration: InputDecoration(
hintText: "请填写原因",
hintStyle: TextStyle(
color: MyColours.color_999999,
fontSize:
ScreenUtil().setSp(30),
),
onChanged: (_) {
setState(() {});
},
onEditingComplete: () {
print('fff');
_cancelNode.unfocus();
},
// keyboardType: TextInputType.number,
enabledBorder:
UnderlineInputBorder(
borderSide: BorderSide(
color: MyColours
.color_d8d8d8),
),
// border: InputBorder.none,
),
))
onChanged: (_) {
setState(() {});
},
onEditingComplete: () {
print('fff');
_cancelNode.unfocus();
},
// keyboardType: TextInputType.number,
),
))
: Container(),
VEmptyView(40)
]),
... ... @@ -353,7 +354,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
Navigator.of(context).pop();
Loading.showLoading(context);
setReserveStatus('4', desc: desc);
bus.emit("refresh_book_list");
bus.emit("refresh_book_list");
},
text: '确认',
height: ScreenUtil().setWidth(80),
... ... @@ -375,296 +376,297 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
if (MediaQuery.of(context).viewInsets.bottom == 0) {
_cancelNode.unfocus();
}
return detailEntity == null
? Container(
width: double.infinity,
height: double.infinity,
color: MyColours.color_ffffff,
)
: Container(
color: MyColours.color_ffffff,
child: Column(
children: <Widget>[
SizedBox(height: ScreenUtil.statusBarHeight),
MyAppBar(
"订座详情",
showBack: true,
),
Expanded(
child: DefaultTextStyle(
style: TextStyle(decoration: TextDecoration.none),
return WillPopScope(
child: detailEntity == null
? Container(
width: double.infinity,
height: double.infinity,
color: MyColours.color_ffffff,
)
: Container(
color: MyColours.color_ffffff,
child: Column(
children: <Widget>[
SizedBox(height: ScreenUtil.statusBarHeight),
MyAppBar(
"订座详情",
showBack: true,
),
Expanded(
child: DefaultTextStyle(
style: TextStyle(decoration: TextDecoration.none),
child: Container(
color: MyColours.color_ffffff,
child: SingleChildScrollView(
child: Container(
color: MyColours.color_ffffff,
child: SingleChildScrollView(
child: Container(
color: MyColours.color_ffffff,
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(43)),
child: Column(
color: MyColours.color_ffffff,
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(43)),
child: Column(
children: <Widget>[
RowMultiText("用餐时段", detailEntity.ddateMd),
Stack(
alignment: Alignment.center,
children: <Widget>[
RowMultiText("用餐时段", detailEntity.ddateMd),
Stack(
alignment: Alignment.center,
Column(
children: <Widget>[
Column(
children: <Widget>[
RowMultiText(
"用餐时间", detailEntity.ddateHm),
Offstage(
offstage: detailEntity.type == "0"
? false
: true,
child: RowMultiText(
"用餐人数", detailEntity.pnum),
)
],
),
Image.asset(
detailEntity.statuImgAssets,
width: ScreenUtil().setWidth(100),
height: ScreenUtil().setWidth(30),
RowMultiText(
"用餐时间", detailEntity.ddateHm),
Offstage(
offstage: detailEntity.type == "0"
? false
: true,
child: RowMultiText(
"用餐人数", detailEntity.pnum),
)
],
),
Offstage(
offstage: detailEntity.demands.length <= 0
? true
: false,
child: Column(
children: <Widget>[
RowMultiText(
"包间需求",
(detailEntity.demands.length
.toString() +
"个") ??
""),
Align(
alignment: Alignment.centerRight,
child: Offstage(
offstage:
detailEntity.demands.length >
0
? false
: true,
child: Container(
height:
ScreenUtil().setHeight(210),
child: ListView.builder(
itemBuilder:
(BuildContext contxt,
int index) {
return NeedItem(detailEntity
.demands[index]);
},
itemCount: detailEntity
.demands.length,
shrinkWrap: true,
scrollDirection:
Axis.horizontal,
),
),
))
],
),
),
RowMultiText(
"预订桌位",
(detailEntity.tables.length.toString() +
"个")),
Align(
alignment: Alignment.centerRight,
child: Offstage(
offstage: detailEntity.tables.length > 0
? false
: true,
child: Container(
height: ScreenUtil().setHeight(210),
child: ListView.builder(
itemBuilder: (BuildContext contxt,
int index) {
return TableItem(
detailEntity.tables[index]);
},
itemCount:
detailEntity.tables.length,
shrinkWrap: true,
scrollDirection: Axis.horizontal,
),
),
)),
RowMultiText("客户姓名", detailEntity.rnameStr),
RowMultiText(
"客户电话", detailEntity.phone ?? ""),
MyDivider(double.infinity,
ScreenUtil().setHeight(1)),
Container(
color: MyColours.color_ffffff,
width: double.infinity,
height: ScreenUtil().setHeight(80),
alignment: Alignment.center,
child: Stack(
alignment: Alignment.center,
children: <Widget>[
Positioned(
left: 0,
child: Text(
"客户经理",
style: TextStyle(
color: MyColours.color_828282,
fontSize:
ScreenUtil().setSp(30)),
),
),
Positioned(
right: 0,
child: GestureDetector(
onTap: () async {
List<String> list = [];
for (Manager manager
in managers) {
list.add(manager.roleUserName);
}
DialogUtil.showSelectCusmanDialog(
context, list, (value) {
if (value != null) {
setState(() {
cusmanText =
managers[value.first]
.userName;
});
_setCurrManager();
}
}).then((value) {});
},
child: Text(
cusmanText,
style: TextStyle(
color: MyColours.color_353535,
fontSize:
ScreenUtil().setSp(30),
decoration:
TextDecoration.underline,
),
Image.asset(
detailEntity.statuImgAssets,
width: ScreenUtil().setWidth(100),
height: ScreenUtil().setWidth(30),
)
],
),
Offstage(
offstage: detailEntity.demands.length <= 0
? true
: false,
child: Column(
children: <Widget>[
RowMultiText(
"包间需求",
(detailEntity.demands.length
.toString() +
"个") ??
""),
Align(
alignment: Alignment.centerRight,
child: Offstage(
offstage:
detailEntity.demands.length >
0
? false
: true,
child: Container(
height:
ScreenUtil().setHeight(210),
child: ListView.builder(
itemBuilder:
(BuildContext contxt,
int index) {
return NeedItem(detailEntity
.demands[index]);
},
itemCount: detailEntity
.demands.length,
shrinkWrap: true,
scrollDirection:
Axis.horizontal,
),
),
)
],
),
),
Offstage(
offstage: detailEntity.note_name == '',
child: RowMultiText(
"记录人", detailEntity.note_name ?? ""),
),
Offstage(
offstage: (detailEntity.status == "4" &&
detailEntity.cancel != null)
))
],
),
),
RowMultiText(
"预订桌位",
(detailEntity.tables.length.toString() +
"个")),
Align(
alignment: Alignment.centerRight,
child: Offstage(
offstage: detailEntity.tables.length > 0
? false
: true,
child: Column(
children: <Widget>[
MyDivider(double.infinity,
ScreenUtil().setHeight(2)),
RowMultiText("取消原因",
detailEntity.cancel?.desc ?? "",
textAlign: TextAlign.left),
RowMultiText(
"取消时间",
detailEntity.cancel?.cdateStr ??
""),
RowMultiText(
"操作人",
detailEntity.abolition == '2'
? '顾客在线取消'
: detailEntity.cancel?.uname ??
""),
],
child: Container(
height: ScreenUtil().setHeight(210),
child: ListView.builder(
itemBuilder: (BuildContext contxt,
int index) {
return TableItem(
detailEntity.tables[index]);
},
itemCount:
detailEntity.tables.length,
shrinkWrap: true,
scrollDirection: Axis.horizontal,
),
),
),
],
)),
),
)),
),
Offstage(
offstage: (detailEntity.status == "3" ||
detailEntity.status == "4" ||
detailEntity.status == "6")
? true
: false,
child: Container(
width: double.infinity,
decoration: BoxDecoration(
color: MyColours.color_ffffff,
border: Border(
top: BorderSide(
color: MyColours.color_dbe3e3,
width: ScreenUtil().setWidth(1)))),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setHeight(40)),
margin: EdgeInsets.symmetric(
vertical: ScreenUtil().setHeight(20)),
child: CommonButton(
content: "通知客户",
width: 669,
height: 80,
fontSize: 34,
onPress: () {
DialogUtil.showShareDialog(context)?.then((value) {
switch (value) {
case 1: //微信
NavigatorUtil.goInvicationPage(
context,
detailEntity.id,
detailEntity.tableinfoStr,
detailEntity.ddate,
detailEntity.ddateStr);
break;
case 2: //短信
NavigatorUtil.goSmsPage(context, detailEntity.id);
break;
case 3: //电话
if (detailEntity.phone != null &&
detailEntity.phone.isNotEmpty) {
Utils.goPhone(detailEntity.phone);
} else {
Utils.showToast("没有客户电话!");
}
break;
}
});
},
)),
RowMultiText("客户姓名", detailEntity.rnameStr),
RowMultiText(
"客户电话", detailEntity.phone ?? ""),
MyDivider(double.infinity,
ScreenUtil().setHeight(1)),
Container(
color: MyColours.color_ffffff,
width: double.infinity,
height: ScreenUtil().setHeight(80),
alignment: Alignment.center,
child: Stack(
alignment: Alignment.center,
children: <Widget>[
Positioned(
left: 0,
child: Text(
"客户经理",
style: TextStyle(
color: MyColours.color_828282,
fontSize:
ScreenUtil().setSp(30)),
),
),
Positioned(
right: 0,
child: GestureDetector(
onTap: () async {
List<String> list = [];
for (Manager manager
in managers) {
list.add(manager.roleUserName);
}
DialogUtil.showSelectCusmanDialog(
context, list, (value) {
if (value != null) {
setState(() {
cusmanText =
managers[value.first]
.userName;
});
_setCurrManager();
}
}).then((value) {});
},
child: Text(
cusmanText,
style: TextStyle(
color: MyColours.color_353535,
fontSize:
ScreenUtil().setSp(30),
decoration:
TextDecoration.underline,
),
),
),
)
],
),
),
Offstage(
offstage: detailEntity.note_name == '',
child: RowMultiText(
"记录人", detailEntity.note_name ?? ""),
),
Offstage(
offstage: (detailEntity.status == "4" &&
detailEntity.cancel != null)
? false
: true,
child: Column(
children: <Widget>[
MyDivider(double.infinity,
ScreenUtil().setHeight(2)),
RowMultiText("取消原因",
detailEntity.cancel?.desc ?? "",
textAlign: TextAlign.left),
RowMultiText(
"取消时间",
detailEntity.cancel?.cdateStr ??
""),
RowMultiText(
"操作人",
detailEntity.abolition == '2'
? '顾客在线取消'
: detailEntity.cancel?.uname ??
""),
],
),
),
],
)),
),
),
)),
),
Offstage(
offstage: (detailEntity.status == "3" ||
detailEntity.status == "4" ||
detailEntity.status == "6")
? true
: false,
child: Container(
width: double.infinity,
decoration: BoxDecoration(
color: MyColours.color_ffffff,
border: Border(
top: BorderSide(
color: MyColours.color_dbe3e3,
width: ScreenUtil().setWidth(1)))),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setHeight(40)),
margin: EdgeInsets.symmetric(
vertical: ScreenUtil().setHeight(20)),
child: CommonButton(
content: "通知客户",
width: 669,
height: 80,
fontSize: 34,
onPress: () {
DialogUtil.showShareDialog(context)?.then((value) {
switch (value) {
case 1: //微信
NavigatorUtil.goInvicationPage(
context,
detailEntity.id,
detailEntity.tableinfoStr,
detailEntity.ddate,
detailEntity.ddateStr);
break;
case 2: //短信
NavigatorUtil.goSmsPage(context, detailEntity.id);
break;
case 3: //电话
if (detailEntity.phone != null &&
detailEntity.phone.isNotEmpty) {
Utils.goPhone(detailEntity.phone);
} else {
Utils.showToast("没有客户电话!");
}
break;
}
});
},
),
Offstage(
offstage: (detailEntity.status == "3" ||
detailEntity.status == "4" ||
detailEntity.status == "6")
? true
: false,
child: Container(
width: double.infinity,
height: ScreenUtil().setWidth(80),
margin: EdgeInsets.symmetric(
horizontal: ScreenUtil().setHeight(40)),
decoration: BoxDecoration(
border: Border.all(
color: MyColours.color_199095,
width: ScreenUtil().setWidth(2)),
borderRadius:
BorderRadius.circular(ScreenUtil().setWidth(5)),
),
// child: Text('fff'),
child: Material(
child: Row(
),
),
Offstage(
offstage: (detailEntity.status == "3" ||
detailEntity.status == "4" ||
detailEntity.status == "6")
? true
: false,
child: Container(
width: double.infinity,
height: ScreenUtil().setWidth(80),
margin: EdgeInsets.symmetric(
horizontal: ScreenUtil().setHeight(40)),
decoration: BoxDecoration(
border: Border.all(
color: MyColours.color_199095,
width: ScreenUtil().setWidth(2)),
borderRadius:
BorderRadius.circular(ScreenUtil().setWidth(5)),
),
// child: Text('fff'),
child: Material(
child: Row(
children: [
Expanded(
child: _cancelAndChangeBtn(() {
print('点击变更预订');
NavigatorUtil.goNoteBookChangePage(
context, detailEntity, widget.rid);
}, '变更预订')),
print('点击变更预订');
NavigatorUtil.goNoteBookChangePage(
context, detailEntity, widget.rid);
}, '变更预订')),
MyDivider(
ScreenUtil().setWidth(2),
ScreenUtil().setWidth(50),
... ... @@ -672,15 +674,24 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
),
Expanded(
child: _cancelAndChangeBtn(() {
_showCancelWidget(context);
}, '取消预订')),
_showCancelWidget(context);
}, '取消预订')),
],
)),
),
),
VEmptyView(ScreenUtil().setWidth(60))
],
),
),
);
VEmptyView(ScreenUtil().setWidth(60))
],
),
),
onWillPop: ()async{
if(widget.fromNotify){
NavigatorUtil.goHomePage(context,initialIndex: 0);
return true;
}
Navigator.of(context).pop();
return true;
},
);
}
}
... ...
... ... @@ -12,20 +12,21 @@ import 'package:one_key/provider/message_dialog_model.dart';
import 'package:one_key/provider/message_model.dart';
import 'package:one_key/provider/my_model.dart';
import 'package:one_key/provider/notebook_model.dart';
import 'package:one_key/provider/tools.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/log_util.dart';
import 'package:one_key/utils/navigator_util.dart';
import 'package:one_key/utils/utils.dart';
import 'package:provider/provider.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:tpns_flutter_plugin/tpns_flutter_plugin.dart';
class HomePage extends StatefulWidget{
class HomePage extends StatefulWidget {
final int initialIndex; //初始tab
final int initialIndex;//初始tab
HomePage({this.initialIndex=1});
HomePage({this.initialIndex = 1});
@override
State<StatefulWidget> createState() {
... ... @@ -34,9 +35,7 @@ class HomePage extends StatefulWidget{
}
}
class HomePageState extends State<HomePage> with WidgetsBindingObserver{
class HomePageState extends State<HomePage> with WidgetsBindingObserver {
List<Widget> pages = List<Widget>();
int _currIndex = 1;
Color _activeColor = MyColours.color_2bb5b7;
... ... @@ -44,7 +43,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver{
Timer timer;
int xgCount=1;//注册信鸽次数,最多5次
int xgCount = 1; //注册信鸽次数,最多5次
@override
void initState() {
... ... @@ -52,40 +51,58 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver{
super.initState();
LogUtil.v("home_initState");
WidgetsBinding.instance.addObserver(this);
_currIndex=widget.initialIndex;
_currIndex = widget.initialIndex;
pages
..add(ChangeNotifierProvider<MessageModel>(
create: (_)=>MessageModel(),
create: (_) => MessageModel(),
child: MessagePage(),
))
..add(ChangeNotifierProvider<NoteBookModel>(
create: (_)=>NoteBookModel(),
create: (_) => NoteBookModel(),
child: NoteBookPage(),
))
..add(ChangeNotifierProvider<MyModel>(
create: (_)=>MyModel(),
create: (_) => MyModel(),
child: MyPage(),
));
WidgetsBinding.instance.addPostFrameCallback((_){
if(widget.initialIndex==0)return;
Future.delayed(Duration(milliseconds: 300),(){
WidgetsBinding.instance.addPostFrameCallback((_) {
if (widget.initialIndex == 0) return;
_getIntent();
Future.delayed(Duration(milliseconds: 300), () {
initPlatformState();
});
Future.delayed(Duration(milliseconds: 30000),(){
Future.delayed(Duration(milliseconds: 30000), () {
ContactModel.getInstance().uploadLocalContact(context);
});
getUntreatedMessage();
timer=Timer.periodic(Duration(minutes: 3), (_){
timer = Timer.periodic(Duration(minutes: 3), (_) {
getUntreatedMessage();
});
UpdateModel updateModel=new UpdateModel();
updateModel.checkUpdate(context,showToast: false);
UpdateModel updateModel = new UpdateModel();
updateModel.checkUpdate(context, showToast: false);
});
}
//初始化信鸽推送
initPlatformState(){
_getIntent() async {
Map notifyParam = await Tools().getIntent();
LogUtil.v(notifyParam.toString());
if (notifyParam != null && notifyParam.isNotEmpty) {
switch (notifyParam["messageType"]) {
case "10":
NavigatorUtil.goNotebookDetailPage(context, notifyParam['rid'],
fromNotify: true);
break;
case "11":
NavigatorUtil.goHandleOnlinePage(
context, notifyParam["rid"], notifyParam['mid'],
fromNotify: true);
break;
}
}
}
//初始化信鸽推送
initPlatformState() {
/// 开启DEBUG
XgFlutterPlugin().setEnableDebug(false);
... ... @@ -95,18 +112,18 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver{
print("flutter onRegisteredDeviceToken: $msg");
},
onRegisteredDone: (String msg) async {
String token="";
try{
token=await XgFlutterPlugin.xgToken;
}catch(e){
String token = "";
try {
token = await XgFlutterPlugin.xgToken;
} catch (e) {
LogUtil.v("注册失败:${e.toString()}");
// Utils.showToast("注册失败:${e.toString()}");
}
if(token==null||token.isEmpty){
if (token == null || token.isEmpty) {
LogUtil.v("注册失败:${xgCount.toString()}");
// Utils.showToast("注册失败:${xgCount.toString()}");
registerPush();
}else{
} else {
LogUtil.v("注册成功:$token");
// Utils.showToast("注册成功:$token");
userTokenInit(token);
... ... @@ -124,6 +141,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver{
},
xgPushDidSetBadge: (String msg) async {
print("flutter xgPushDidSetBadge: $msg");
/// 在此可设置应用角标
XgFlutterPlugin().setAppBadge(0);
},
... ... @@ -140,7 +158,22 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver{
print("flutter xgPushDidClearAllIdentifiers: $msg");
},
xgPushClickAction: (Map<String, dynamic> msg) async {
print("flutter xgPushClickAction $msg");
print("flutter xgPushClickAction ${msg['custom']}");
if (Platform.isIOS && msg != null && msg['custom'] != null) {
Map<String, dynamic> custom = msg['custom'];
switch (custom["messageType"].toString()) {
case "10":
NavigatorUtil.goNotebookDetailPage(
context, custom['rid'].toString(),
fromNotify: true);
break;
case "11":
NavigatorUtil.goHandleOnlinePage(
context, custom["rid"].toString(), custom['mid'],
fromNotify: true);
break;
}
}
},
);
registerPush();
... ... @@ -148,51 +181,58 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver{
//注册信鸽
registerPush() async {
if(xgCount>5)return;
if(Platform.isAndroid){
if (xgCount > 5) return;
if (Platform.isAndroid) {
/// 设置OPPO AppKey 和 AppSecret
if(await XgFlutterPlugin().getXgAndroidApi().isOppoRom()){
XgFlutterPlugin().getXgAndroidApi().enableOppoNotification();
XgFlutterPlugin().getXgAndroidApi().setOppoPushAppId(appId:"30260281");
XgFlutterPlugin().getXgAndroidApi().setOppoPushAppKey(appKey: "9b7e372f93794593953f93f118619570");
}
// 设置小米 AppID 和 AppKey。
if(await XgFlutterPlugin().getXgAndroidApi().isMiuiRom()){
XgFlutterPlugin().getXgAndroidApi().setMiPushAppId(appId:"2882303761518639456");
XgFlutterPlugin().getXgAndroidApi().setMiPushAppKey(appKey: "5231863961456");
}
XgFlutterPlugin().getXgAndroidApi().enableOtherPush();
if (await XgFlutterPlugin().getXgAndroidApi().isOppoRom()) {
XgFlutterPlugin().getXgAndroidApi().enableOppoNotification();
XgFlutterPlugin().getXgAndroidApi().setOppoPushAppId(appId: "30260281");
XgFlutterPlugin()
.getXgAndroidApi()
.setOppoPushAppKey(appKey: "9b7e372f93794593953f93f118619570");
}
// 设置小米 AppID 和 AppKey。
if (await XgFlutterPlugin().getXgAndroidApi().isMiuiRom()) {
XgFlutterPlugin()
.getXgAndroidApi()
.setMiPushAppId(appId: "2882303761518639456");
XgFlutterPlugin()
.getXgAndroidApi()
.setMiPushAppKey(appKey: "5231863961456");
}
XgFlutterPlugin().getXgAndroidApi().enableOtherPush();
}
/// 启动TPNS服务
LogUtil.v("register:${xgCount.toString()}");
XgFlutterPlugin().startXg("1600012876", "INUIMFK21WGH");
xgCount++;
}
//初始化推送token
userTokenInit(String token){
UserModel userModel=Provider.of<UserModel>(context,listen: false);
userModel.token=token;
Map<String,String> params={
"sid":userModel.user.sellerid,
"account":userModel.user.account,
"user_token":Platform.isAndroid?"Android_$token":"Ios_$token"
userTokenInit(String token) {
UserModel userModel = Provider.of<UserModel>(context, listen: false);
userModel.token = token;
Map<String, String> params = {
"sid": userModel.user.sellerid,
"account": userModel.user.account,
"user_token": Platform.isAndroid ? "Android_$token" : "Ios_$token"
};
userModel.userTokenInit(context, params);
}
//获取未处理在线预订消息
getUntreatedMessage(){
UserModel userModel=Provider.of<UserModel>(context,listen: false);
Map<String,String> params={
"sid":userModel.user.sellerid,
"type_id":"10",//10 在线预订
"status":"0",//未处理
"offset":"0",
"limit":"100",
getUntreatedMessage() {
UserModel userModel = Provider.of<UserModel>(context, listen: false);
Map<String, String> params = {
"sid": userModel.user.sellerid,
"type_id": "10", //10 在线预订
"status": "0", //未处理
"offset": "0",
"limit": "100",
};
MessageDialogModel messageModel=Provider.of<MessageDialogModel>(context,listen: false);
MessageDialogModel messageModel =
Provider.of<MessageDialogModel>(context, listen: false);
messageModel.getUntreatedMsg(context, params);
}
... ... @@ -200,9 +240,11 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver{
void didChangeAppLifecycleState(AppLifecycleState state) {
// TODO: implement didChangeAppLifecycleState
super.didChangeAppLifecycleState(state);
switch(state){
case AppLifecycleState.resumed://应用前台可见
getUntreatedMessage();
switch (state) {
case AppLifecycleState.resumed: //应用前台可见
getUntreatedMessage();
break;
default:
break;
}
}
... ... @@ -231,7 +273,8 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver{
title: Text(
"消息中心",
style: TextStyle(
color: _currIndex == 0 ? _activeColor : _defaultColor,fontSize: ScreenUtil().setSp(22)),
color: _currIndex == 0 ? _activeColor : _defaultColor,
fontSize: ScreenUtil().setSp(22)),
),
),
BottomNavigationBarItem(
... ... @@ -248,7 +291,8 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver{
title: Text(
"预定本",
style: TextStyle(
color: _currIndex == 1 ? _activeColor : _defaultColor,fontSize: ScreenUtil().setSp(22)),
color: _currIndex == 1 ? _activeColor : _defaultColor,
fontSize: ScreenUtil().setSp(22)),
),
),
BottomNavigationBarItem(
... ... @@ -265,7 +309,8 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver{
title: Text(
"我的",
style: TextStyle(
color: _currIndex == 2 ? _activeColor : _defaultColor,fontSize: ScreenUtil().setSp(22)),
color: _currIndex == 2 ? _activeColor : _defaultColor,
fontSize: ScreenUtil().setSp(22)),
),
),
],
... ... @@ -276,9 +321,9 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver{
setState(() {
_currIndex = index;
});
if(_currIndex==2){
if (_currIndex == 2) {
Utils.changeStatusColor(color: MyColours.color_2bb5b7);
}else{
} else {
Utils.changeStatusColor(color: MyColours.color_ffffff);
}
}
... ... @@ -293,11 +338,10 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver{
// TODO: implement dispose
super.dispose();
LogUtil.v("home_dispose");
if(timer!=null){
if (timer != null) {
timer.cancel();
}
XgFlutterPlugin().stopXg();
WidgetsBinding.instance.removeObserver(this);
}
}
... ...
... ... @@ -50,7 +50,7 @@ class MessageDialogItem extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text(
"在线预订",
message.message_type=="10"?"在线预订":"取消预订",
style: TextStyle(
color: textColor,
fontSize: ScreenUtil().setSp(28)),
... ...
... ... @@ -51,7 +51,7 @@ class MessageItem extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text(
"在线预订",
message.message_type=="10"?"在线预订":"取消预订",
style: TextStyle(
color: textColor,
fontSize: ScreenUtil().setSp(28)),
... ...
... ... @@ -49,13 +49,14 @@ class NoteBookPageState extends State<NoteBookPage> {
_getReserveList();
_reserveCountDay();
bus.on("refresh_book_list", (args) {
_getReserveList();
_getReserveList();
});
});
}
@override
@override
void dispose() {
super.dispose();
bus.off("refresh_book_list");
}
... ... @@ -315,63 +316,63 @@ class NoteBookPageState extends State<NoteBookPage> {
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Offstage(
offstage: morning == "00:00-00:00" ? true : false,
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(10)),
child: CommonButton(
content: "早市",
state: currTimeIndex == 1 ? 1 : 0,
width: ScreenUtil().setWidth(180),
height: ScreenUtil().setHeight(100),
fontSize: 32,
onPress: () {
if (currTimeIndex == 1) return;
setState(() {
currTimeIndex = 1;
});
_getReserveList();
},
))
),
Offstage(
offstage: noon == "00:00-00:00" ? true : false,
offstage: morning == "00:00-00:00" ? true : false,
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(10)),
child: CommonButton(
content: "午市",
state: currTimeIndex == 2 ? 1 : 0,
content: "早市",
state: currTimeIndex == 1 ? 1 : 0,
width: ScreenUtil().setWidth(180),
height: ScreenUtil().setHeight(100),
fontSize: 32,
onPress: () {
if (currTimeIndex == 2) return;
if (currTimeIndex == 1) return;
setState(() {
currTimeIndex = 2;
currTimeIndex = 1;
});
_getReserveList();
},
))),
Offstage(
offstage: night == "00:00-00:00" ? true : false,
offstage: noon == "00:00-00:00" ? true : false,
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(10)),
child: CommonButton(
content: "晚市",
state: currTimeIndex == 3 ? 1 : 0,
content: "午市",
state: currTimeIndex == 2 ? 1 : 0,
width: ScreenUtil().setWidth(180),
height: ScreenUtil().setHeight(100),
fontSize: 32,
onPress: () {
if (currTimeIndex == 3) return;
if (currTimeIndex == 2) return;
setState(() {
currTimeIndex = 3;
currTimeIndex = 2;
});
_getReserveList();
},
)),),
))),
Offstage(
offstage: night == "00:00-00:00" ? true : false,
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(10)),
child: CommonButton(
content: "晚市",
state: currTimeIndex == 3 ? 1 : 0,
width: ScreenUtil().setWidth(180),
height: ScreenUtil().setHeight(100),
fontSize: 32,
onPress: () {
if (currTimeIndex == 3) return;
setState(() {
currTimeIndex = 3;
});
_getReserveList();
},
)),
),
],
),
)
... ...
import 'dart:convert';
import 'package:flutter/services.dart';
import 'package:one_key/utils/utils.dart';
class Tools {
static const MethodChannel _channel = MethodChannel("com.naji/book");
Future<Map> getIntent() async {
Map result = await _channel.invokeMethod("getIntent");
// Utils.showToast(json.encode(result));
return result;
}
}
... ...
... ... @@ -36,11 +36,12 @@ var homeHandler = new Handler(
);
});
// 跳转到处理在线预订
// 跳转预订详情页
var reserveDetailHandler = new Handler(
handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
String rid = params['rid'].first;
return NotebookDetailPage(rid);
bool fromNotify=FluroConvertUtils.string2bool(params["fromNotify"].first);
return NotebookDetailPage(rid,fromNotify: fromNotify,);
});
// 跳转到处理在线预订
... ... @@ -48,7 +49,8 @@ var handleOnlineHandler = new Handler(
handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
String rid = params['rid'].first;
String mid = params["mid"].first;
return HandleOnlinePage(rid, mid);
bool fromNotify=FluroConvertUtils.string2bool(params["fromNotify"].first);
return HandleOnlinePage(rid, mid,fromNotify: fromNotify,);
});
// 跳转到选择桌位
... ...
... ... @@ -39,14 +39,14 @@ class NavigatorUtil {
/// 订单详情
static void goNotebookDetailPage(BuildContext context, String rid,
{replace = false}) {
_navigateTo(context, "${Routes.reserve_detail}?rid=$rid", replace: replace);
{bool fromNotify=false,replace = false}) {
_navigateTo(context, "${Routes.reserve_detail}?rid=$rid&fromNotify=$fromNotify", replace: replace);
}
/// 处理在线预订
static void goHandleOnlinePage(BuildContext context, String rid, String mid,
{replace = false}) {
_navigateTo(context, "${Routes.handle_online_page}?rid=$rid&mid=$mid",
{fromNotify=false,replace = false}) {
_navigateTo(context, "${Routes.handle_online_page}?rid=$rid&mid=$mid&fromNotify=$fromNotify",
replace: replace);
}
... ...