我正在尝试在 flutter 应用程序中使用ShowoCaseView包,以下是我所做的步骤:
GlobalKey _oneShowcaseKey = GlobalKey();
startShowCase() {
WidgetsBinding.instance.addPostFrameCallback((_) async {
ShowCaseWidget.of(context).startShowCase([_oneShowcaseKey]);
});
}
@override
void initState() {
startShowCase();
super.initState();
}
@override
Widget build(BuildContext context) {
super.build(context);
return ShowCaseWidget(
builder: Builder(
builder: (context) => Scaffold(
child: Showcase(
key: _oneShowcaseKey,
title: 'Menu',
description: 'Click here to see menu options',
child: Column())
)
Run Code Online (Sandbox Code Playgroud)
这是我在应用程序中实现包的方式,但出现此错误:
[ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: Exception: Please provide ShowCaseView context
Run Code Online (Sandbox Code Playgroud)