surveysparrow_flutter_sdk 1.0.0-beta.4 copy "surveysparrow_flutter_sdk: ^1.0.0-beta.4" to clipboard
surveysparrow_flutter_sdk: ^1.0.0-beta.4 copied to clipboard

SurveySparrow's flutter SDK lets you collect feedback at various touchpoints from your mobile app users. You can easily embed surveys in your mobile app with a few lines of code.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:surveysparrow_flutter_sdk/surveysparrow.dart';

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

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

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const SurveyScreen(),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("SurveySparrow"),
      ),
      body: Builder(
        builder: ((context) => Center(
              child: Container(
                child: ElevatedButton(
                    onPressed: () {
                      showModalBottomSheet(
                        context: context,
                        builder: (BuildContext context) {
                          return Container(
                            width: double.infinity,
                            height: 500,
                            child: SurveyModal(
                              token: 'tt-0207b6', // give your token
                              domain:
                                  'sample.surveysparrow.com', // give your domain name
                              variables: const {
                                "custom_name": "surveysparrow",
                                "custom_number": "2"
                              },
                              firstQuestionAnswer: FirstQuestionAnswer(
                                pageNumber: 1,
                                answers: [
                                  Answer(
                                    opnionScale: CustomOpinionScale(
                                      key: 4646744,
                                      data: 2,
                                      timeTaken: 1,
                                      skipped: false,
                                    ),
                                  ),
                                ],
                              ),
                              onNext: (val) {
                                print("Currently collected answer ${val} ");
                              },
                              onError: () {
                                Navigator.pop(context);
                              },
                              onSubmit: (val) {
                                print("All collected answer ${val} ");
                                Future.delayed(
                                    const Duration(milliseconds: 500), () {
                                  Navigator.of(context).pop();
                                });
                              },
                            ),
                          );
                        },
                      );
                    },
                    child: Text("open survey")),
              ),
            )),
      ),
    );
  }
}
8
likes
0
pub points
57%
popularity

Publisher

verified publishersurveysparrow.com

SurveySparrow's flutter SDK lets you collect feedback at various touchpoints from your mobile app users. You can easily embed surveys in your mobile app with a few lines of code.

Homepage
Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

country_code_picker, country_pickers, easy_debounce, eval_ex, expandable_text, fk_user_agent, flutter, flutter_rating_stars, flutter_spinkit, flutter_svg, http, phone_numbers_parser, readmore, sizer, ua_client_hints, url_launcher

More

Packages that depend on surveysparrow_flutter_sdk