Flutter SmartLook SDK 仅适用于首页

问题描述 投票:0回答:1

我正在尝试在我的 Flutter 项目中使用 SmartLook。我使用最新的

flutter_smartlook
包。这是我根据他们的文档编写的代码:

void main() => runApp(const MyApp());

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();

    final SetupOptions options = (SetupOptionsBuilder('*******')
          ..Fps = 10
          ..StartNewSession = true)
        .build();

    Smartlook.setupAndStartRecording(options);
  }

  @override
  Widget build(BuildContext context) {
    return SmartlookHelperWidget(
      child: MaterialApp(
        title: 'My App',
        theme: ThemeData(
          fontFamily: 'OpenSans',
          primarySwatch: Colors.blue,
          visualDensity: VisualDensity.adaptivePlatformDensity,
        ),
        debugShowCheckedModeBanner: false,
        navigatorKey: Global.navigatorKey,
        initialRoute: AppRouter.main,
        onGenerateRoute: AppRouter.onGenerateRoute,
        onGenerateInitialRoutes: AppRouter.onGenerateInitialRoutes,
      ),
    );
  }
}

问题是在录制中,只有第一页可见(质量非常差/fps不错,但质量很差)。我应该提到的是,我的第一页包含来自

google_maps_flutter
包的 GoogleMap 小部件,它几乎占据了整个屏幕的三分之二。在录音中,您可以看到屏幕的三分之一,每当用户打开新页面时,该部分就会更新。所以我认为它与 Google 地图小部件有关,但我不确定。

flutter google-maps dart
1个回答
0
投票

您可以在项目设置中更改录制质量

使用此代码:

    static Future<void> initSmartLook() async {
    await smartlook.preferences.setProjectKey(smartLookKey);//your project key
    await smartlook.preferences.setFrameRate(2);
    smartlook.user.setIdentifier('Your Identifier');
    smartlook.user.setName('Your Name');
    smartlook.user.setEmail('Your Email');
    await smartlook.start();

    smartlook.sensitivity.changeNativeClassSensitivity([
      SensitivityTuple(
        classType: SmartlookNativeClassSensitivity.WebView,
        isSensitive: false,
      ),
      SensitivityTuple(
        classType: SmartlookNativeClassSensitivity.WKWebView,
        isSensitive: false,
      ),
      SensitivityTuple(
        classType: SmartlookNativeClassSensitivity.EditText,
        isSensitive: false,
      ),
    ]);
    Smartlook.instance.eventListeners.registerSessionChangedListener((_) {
      //TODO
    });
  }
© www.soinside.com 2019 - 2024. All rights reserved.