master
jack ning 3 years ago
parent 54316e06b5
commit 4773ee0f0e

@ -5,7 +5,7 @@ connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(7.1.1))
connection.project.dir=
eclipse.preferences.version=1
gradle.user.home=
java.home=/Library/Java/JavaVirtualMachines/jdk1.8.0_311.jdk/Contents/Home
java.home=/Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home
jvm.arguments=
offline.mode=false
override.workspace.settings=true

@ -22,7 +22,7 @@ void main() {
)));
// https://github.com/Bytedesk/bytedesk-flutter
// https://www.bytedesk.com/antv/user/login
// https://www.bytedesk.com/admin
// appkeysubDomain
// appkey->->Flutter->->appkey
String _appKey = '81f427ea-4467-4c7c-b0cd-5c0e4b51456f';

@ -12,9 +12,13 @@ class UserInfoPage extends StatefulWidget {
_UserInfoPageState createState() => _UserInfoPageState();
}
class _UserInfoPageState extends State<UserInfoPage> {
String _nickname = '';
String _avatar = BytedeskConstants.DEFAULT_AVATA;
String _uid = ''; // uid
String _username = ''; //
String _nickname = ''; //
String _avatar = BytedeskConstants.DEFAULT_AVATA; //
String _description = ''; //
@override
void initState() {
_getProfile();
@ -52,6 +56,14 @@ class _UserInfoPageState extends State<UserInfoPage> {
_setAvatar();
},
),
ListTile(
title: Text('设置备注(见代码)'),
subtitle: Text(_description),
onTap: () {
//
_setDescription();
},
),
],
).toList()),
);
@ -61,8 +73,11 @@ class _UserInfoPageState extends State<UserInfoPage> {
//
BytedeskKefu.getProfile().then((user) => {
setState(() {
_uid = user.uid!;
_username = user.username!;
_nickname = user.nickname!;
_avatar = user.avatar!;
_description = user.description!;
})
});
}
@ -80,7 +95,8 @@ class _UserInfoPageState extends State<UserInfoPage> {
void _setAvatar() {
// url-
String myavatarurl = 'https://chainsnow.oss-cn-shenzhen.aliyuncs.com/avatars/visitor_default_avatar.png'; // url
String myavatarurl =
'https://chainsnow.oss-cn-shenzhen.aliyuncs.com/avatars/visitor_default_avatar.png'; // url
BytedeskKefu.updateAvatar(myavatarurl).then((user) => {
setState(() {
_avatar = myavatarurl;
@ -88,4 +104,15 @@ class _UserInfoPageState extends State<UserInfoPage> {
Fluttertoast.showToast(msg: "设置头像成功")
});
}
void _setDescription() {
// -
String description = '自定义用户备注';
BytedeskKefu.updateDescription(description).then((user) => {
setState(() {
description = description;
}),
Fluttertoast.showToast(msg: "设置备注成功")
});
}
}

@ -40,7 +40,7 @@ dependencies:
# 请在ios/Podfile中添加use_frameworks!
vibration: ^1.7.3
# 在线客服 https://pub.dev/packages/bytedesk_kefu
bytedesk_kefu: ^1.1.8
bytedesk_kefu: ^1.2.0
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.

Loading…
Cancel
Save