nps_plugin 0.2.0 copy "nps_plugin: ^0.2.0" to clipboard
nps_plugin: ^0.2.0 copied to clipboard

A Flutter component that presents Net Promoter Score (NPS) survey.

example/lib/main.dart

import 'dart:developer';

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

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

class AppWidget extends StatelessWidget {
  const AppWidget({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'NPS Plugin',
      theme: ThemeData(
        useMaterial3: true,
        colorScheme: ColorScheme.fromSeed(
          seedColor: Colors.blue,
          brightness: Brightness.light,
        ),
        inputDecorationTheme: const InputDecorationTheme(
          border: OutlineInputBorder(),
        ),
      ),
      home: const HomePage(),
    );
  }
}

class HomePage extends StatelessWidget {
  const HomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: FilledButton(
          child: const Text('Show NPS'),
          onPressed: () async {
            final npsTitle = Text.rich(
              TextSpan(
                text: 'So far, how likely are you to recommend ',
                children: [
                  TextSpan(
                    text: 'NPS Plugin',
                    style: TextStyle(
                      fontWeight: FontWeight.w700,
                      fontSize: 25,
                      color: Theme.of(context).colorScheme.primary,
                    ),
                  ),
                  const TextSpan(text: ' to a friend?'),
                ],
              ),
              overflow: TextOverflow.ellipsis,
              textAlign: TextAlign.center,
              style: Theme.of(context).textTheme.titleLarge,
              maxLines: 2,
            );

            final (:nps, :message, :phone) = await npsStart(
              context,
              npsTitle: npsTitle,
              showInputPhone: true,
            );

            log('NPS: $nps, Message: $message, Phone: $phone');
          },
        ),
      ),
    );
  }
}
4
likes
140
pub points
54%
popularity

Publisher

unverified uploader

A Flutter component that presents Net Promoter Score (NPS) survey.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on nps_plugin