flutter_user_recorder 0.2.9
flutter_user_recorder: ^0.2.9 copied to clipboard
Record and replay user interactions in Flutter apps. Automatically captures taps, text input, scrolls, navigation, and gestures. Perfect for automated testing, user flow analysis, and interaction repl [...]
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:flutter_recorder_example/app_router.dart';
import 'package:flutter_recorder_example/recorder_config.dart';
import 'package:flutter_user_recorder/flutter_user_recorder.dart';
import 'app.dart';
void main() {
// That's it! RecorderLayer will automatically configure go_router integration.
// No manual setup needed!
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
// Create router with RecorderNavigatorObserver
final router = buildAppRouter(recorderController, replayer);
// Minimal usage: wrap MaterialApp.router with RecorderLayer
// go_router integration is now automatic - no manual setup needed!
if (!kEnableRecorder) {
return MaterialApp.router(
title: 'Flutter Recorder Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
routerConfig: router,
);
}
return RecorderLayer(
controller: recorderController,
replayer: replayer,
recordNavigation: true,
recordGlobalScroll: true,
recordDrag: true,
showControls: false, // Disable global FAB since each page has its own
child: MaterialApp.router(
title: 'Flutter Recorder Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
routerConfig: router,
),
);
}
}
// Global recorder and replayer for the example app
final RecorderController recorderController = RecorderController();
final Replayer replayer = Replayer(
minDelayMs: 200,
respectTiming: true,
onReplayStart: () => debugPrint('Replay started'),
onReplayComplete: () => debugPrint('Replay completed'),
onEventReplayed: (event) => debugPrint('Replayed: $event'),
onEventFailed: (event, error) => debugPrint('Failed: $event - $error'),
);
// Toggle to enable/disable the recorder globally
const bool kEnableRecorder = true;
// Note: go_router integration is now automatic!
// RecorderLayer will automatically detect MaterialApp.router and configure go_router.
// No manual setup needed - just wrap your app with RecorderLayer!