tapsurvey_flutter 0.1.1 copy "tapsurvey_flutter: ^0.1.1" to clipboard
tapsurvey_flutter: ^0.1.1 copied to clipboard

A Flutter library for integrating AI-powered surveys into your applications. TapSurvey provides a conversational survey experience with dynamic, adaptive questioning based on user responses.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:tapsurvey_flutter/tapsurvey_flutter.dart';

void main() {
  runApp(const MyApp());
}

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'TapSurvey Flutter Example',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.indigo),
        useMaterial3: true,
      ),
      home: const SurveyDemo(),
      debugShowCheckedModeBanner: false,
    );
  }
}

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

  @override
  State<SurveyDemo> createState() => _SurveyDemoState();
}

class _SurveyDemoState extends State<SurveyDemo> {
  bool _surveyVisible = false;
  final String _userId = 'user_${DateTime.now().millisecondsSinceEpoch}';
  
  void _handleSurveyComplete() {
    ScaffoldMessenger.of(context).showSnackBar(
      const SnackBar(
        content: Text('Survey completed successfully!'),
        backgroundColor: Colors.green,
      ),
    );
  }
  
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('TapSurvey Demo'),
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            const Text(
              'TapSurvey Flutter SDK Demo',
              style: TextStyle(
                fontSize: 24,
                fontWeight: FontWeight.bold,
              ),
            ),
            const SizedBox(height: 20),
            const Text(
              'Press the button below to open a sample survey',
              textAlign: TextAlign.center,
              style: TextStyle(fontSize: 16),
            ),
            const SizedBox(height: 40),
            ElevatedButton(
              onPressed: () {
                setState(() {
                  _surveyVisible = true;
                });
              },
              style: ElevatedButton.styleFrom(
                padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 16),
              ),
              child: const Text('Open Survey'),
            ),
            const SizedBox(height: 20),
            if (_surveyVisible)
              Text(
                'User ID: $_userId',
                style: const TextStyle(fontSize: 12, color: Colors.grey),
              ),
          ],
        ),
      ),
      bottomSheet: _surveyVisible
        ? SurveyWindow(
            open: _surveyVisible,
            onClose: () {
              setState(() {
                _surveyVisible = false;
              });
            },
            onSubmit: _handleSurveyComplete,
            appToken: 'YOUR_APP_TOKEN',  // Replace with your app token
            surveyId: 'YOUR_SURVEY_ID',  // Replace with your survey ID
            userId: _userId,
            debug: true,  // Set to false for production
          )
        : null,
    );
  }
}
0
likes
115
points
11
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A Flutter library for integrating AI-powered surveys into your applications. TapSurvey provides a conversational survey experience with dynamic, adaptive questioning based on user responses.

License

MIT (license)

Dependencies

flutter, http

More

Packages that depend on tapsurvey_flutter