小编Sri*_*tha的帖子

未处理的异常:异常:请在 flutter 中提供 ShowCaseView 上下文

我正在尝试在 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)

dart showcaseview flutter

13
推荐指数
2
解决办法
6800
查看次数

标签 统计

dart ×1

flutter ×1

showcaseview ×1