flutter_polls 0.0.2 copy "flutter_polls: ^0.0.2" to clipboard
flutter_polls: ^0.0.2 copied to clipboard

outdated

Customizable Polls for Flutter. Simple, easy to use and highly customizable.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_polls/flutter_polls.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 const MaterialApp(
      title: 'Flutter Demo',
      home: ExamplePolls(),
    );
  }
}

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

  @override
  State<ExamplePolls> createState() => _ExamplePollsState();
}

class _ExamplePollsState extends State<ExamplePolls> {
  @override
  Widget build(BuildContext context) => Scaffold(
        appBar: AppBar(title: const Text('Example Polls')),
        body: Padding(
          padding: const EdgeInsets.all(20),
          child: Center(
            child: FlutterPolls(
              pollId: 'Example',
              onVoted: (PollOption pollOption, int newTotalVotes) {
                // ignore: avoid_print
                print('Voted: ${pollOption.id}');
              },
              pollTitle: const Text('Example Polls'),
              pollOptions: [
                PollOption(title: const Text('Option 1'), votes: 1),
                PollOption(title: const Text('Option 2'), votes: 1),
                PollOption(title: const Text('Option 3'), votes: 1),
              ],
            ),
          ),
        ),
      );
}
128
likes
0
pub points
94%
popularity

Publisher

verified publisherthenifemi.com

Customizable Polls for Flutter. Simple, easy to use and highly customizable.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, flutter_hooks, percent_indicator

More

Packages that depend on flutter_polls