update pickup

This commit is contained in:
tzw
2021-10-09 17:08:28 +06:30
parent 46da87dc0e
commit 50901992d7
21 changed files with 597 additions and 274 deletions

View File

@@ -1,6 +1,8 @@
import 'package:fcs/domain/constants.dart';
import 'package:fcs/domain/entities/user.dart';
import 'package:fcs/helpers/theme.dart';
import 'package:fcs/pages/chat/message_detail.dart';
import 'package:fcs/pages/chat/model/message_model.dart';
import 'package:fcs/pages/customer/model/customer_model.dart';
import 'package:fcs/pages/main/util.dart';
import 'package:fcs/pages/widgets/display_text.dart';
@@ -51,6 +53,14 @@ class _CustomerEditorState extends State<CustomerEditor> {
color: enabled ? primaryColor : Colors.grey,
callBack: () => _enable(!enabled),
);
final chatBox = LocalButton(
textKey: "customer.chat.btn",
iconData: Icons.chat,
color: primaryColor,
callBack: () => _gotoChat(),
);
return LocalProgress(
inAsyncCall: _isLoading,
child: SafeArea(
@@ -100,6 +110,7 @@ class _CustomerEditorState extends State<CustomerEditor> {
context, "customer.invitation.request.confirm"),
callack: _add)
: Container(),
chatBox,
widget.customer!.joined || widget.customer!.disabled
? enableBox
: Container()
@@ -149,4 +160,25 @@ class _CustomerEditorState extends State<CustomerEditor> {
});
}
}
_gotoChat() {
MessageModel messageModel =
Provider.of<MessageModel>(context, listen: false);
messageModel.initQuery(widget.customer!.id);
Navigator.of(context)
.push(CupertinoPageRoute(
builder: (context) => MessageDetail(
receiverID: widget.customer!.id,
receiverName: widget.customer!.name,
messageModel: messageModel,
)))
.then((value) {
if (widget.customer!.fcsUnseenCount > 0) {
messageModel.seenMessages(widget.customer!.id ?? "", false);
}
});
if (widget.customer!.fcsUnseenCount > 0) {
messageModel.seenMessages(widget.customer!.id ?? "", false);
}
}
}