flutter_emoji_feedback 1.0.0 copy "flutter_emoji_feedback: ^1.0.0" to clipboard
flutter_emoji_feedback: ^1.0.0 copied to clipboard

A fully customizable widget to receive feedback from your users. Useful to get the user's mood, evaluate their experience, and more!

example/lib/main.dart

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

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

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

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      title: 'Example App',
      home: HomePage(),
    );
  }
}

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

  @override
  State<HomePage> createState() => _HomePageState();
}

final emojiPresets = {
  'notoAnimatedEmojis': notoAnimatedEmojis,
  'classicEmojiPreset': classicEmojiPreset,
  'threeDEmojiPreset': threeDEmojiPreset,
  'handDrawnEmojiPreset': handDrawnEmojiPreset,
};

class _HomePageState extends State<HomePage> {
  int? rating;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SafeArea(
        child: Padding(
          padding: const EdgeInsets.all(16.0),
          child: ListView(
            children: [
              ...emojiPresets.entries.map((entry) => Column(
                    children: [
                      Text(entry.key),
                      EmojiFeedback(
                        initialRating: 3,
                        onChangeWaitForAnimation: true,
                        emojiPreset: entry.value,
                        labelTextStyle: Theme.of(context)
                            .textTheme
                            .bodySmall
                            ?.copyWith(fontWeight: FontWeight.w400),
                        onChanged: (value) {
                          setState(() => rating = value);
                          // Show snackbar
                          ScaffoldMessenger.of(context)
                            ..clearSnackBars()
                            ..showSnackBar(SnackBar(content: Text('$value')));
                        },
                      )
                    ],
                  )),
              Column(
                children: [
                  const Text("Custom preset builder"),
                  EmojiFeedback(
                    initialRating: 3,
                    onChangeWaitForAnimation: true,
                    presetBuilder: (p0, p1, p2) => const Icon(Icons.star),
                    labelTextStyle: Theme.of(context)
                        .textTheme
                        .bodySmall
                        ?.copyWith(fontWeight: FontWeight.w400),
                    onChanged: (value) {
                      setState(() => rating = value);
                      // Show snackbar
                      ScaffoldMessenger.of(context)
                        ..clearSnackBars()
                        ..showSnackBar(SnackBar(content: Text('$value')));
                    },
                  )
                ],
              )
            ],
          ),
        ),
      ),
    );
  }
}
54
likes
0
points
561
downloads

Publisher

verified publisherstevenosse.com

Weekly Downloads

A fully customizable widget to receive feedback from your users. Useful to get the user's mood, evaluate their experience, and more!

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

collection, flutter, flutter_svg, lottie

More

Packages that depend on flutter_emoji_feedback