shepherd_heat 0.0.11
shepherd_heat: ^0.0.11 copied to clipboard
Pure Flutter heat map tracking SDK for the Shepherd platform. Captures semantic UI interactions via shepherd_tag.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:shepherd_heat/shepherd_heat.dart';
import 'package:shepherd_tag/shepherd_tag.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: ShepherdHeatTracker(
endpoint: 'https://union.shepherdplatform.com/graphql',
apiKey: 'YOUR_API_KEY',
child: const MyHomePage(),
),
);
}
}
class MyHomePage extends StatelessWidget {
const MyHomePage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Shepherd Heat Example')),
body: Center(
child: ShepherdPageKey(
id: 'home_page',
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ShepherdElementKey(
id: 'my_button',
child: ElevatedButton(
onPressed: () {
// Interaction is captured automatically
},
child: const Text('Click me to record heat map!'),
),
),
const SizedBox(height: 20),
ElevatedButton(
onPressed: () {
// Manually report interaction (e.g., if a click was swallowed by a custom DS widget)
ShepherdHeat.reportInteraction('manual_button', inputSource: 'MOUSE');
},
child: const Text('Manual Interaction'),
),
],
),
),
),
);
}
}