Developers can customize the buttons on the operation panel of the mini program, including the sharing button and other buttons. The operation panel can be brought up by clicking the More button in the top right corner of the mini program:
@override
Future<List<CustomMenu>> getCustomMenus() async {
CustomMenu menu1 = CustomMenu(
'100', 'res/images/mini_app_wechat_friend.png', 'Share To', true,
shareKey: 'twitter');
CustomMenu menu2 = CustomMenu(
'101', 'https://staticintl.cloudcachetci.com/cms/backend-cms/8WGP653_%E5%BC%80%E5%8F%91%E8%80%85%E5%B7%A5%E5%85%B7%E9%80%9A%E7%94%A8.png', 'Custom', false);
return [
menu1,
menu2,
];
}
Menu click callback:
@override
Future<void> customMenuClick(String menuId, ShareData? shareMenu) async {
print("click menuId:$menuId shareMenu:$shareMenu");
throw UnimplementedError();
}
The menu has built-in buttons for four sharing channels: QQ, Qzone, WeChat, and WeChat Circle of Friends. If you want to display these sharing buttons, you can configure them in the following ways.
_tcmppFlutterPlugin.defaultShareTargets([ShareTarget.qq, ShareTarget.wxMoment]);
Was this page helpful?