引入pub:
dependencies:
quick_actions: ^1.0.2
地址:
https://pub.dev/packages/quick_actions
https://pub.flutter-io.cn/packages/quick_actions
使用:
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:quick_actions/quick_actions.dart';
import 'app/routes/app_pages.dart';
void main() {
runApp(
......
);
///建议放在runApp 的后面
const QuickActions quickActions = QuickActions();
quickActions.initialize((shortcutType) {
if (shortcutType == 'action_main') {
print('用户点击了“主视图”操作。');
}
// 更多处理代码...
});
quickActions.setShortcutItems(<ShortcutItem>[
const ShortcutItem(
type: 'action_main', localizedTitle: '主视图', icon: 'icon_main'),
const ShortcutItem(
type: 'action_help', localizedTitle: '帮助', icon: 'icon_help')
]);
}
THE END