flutter_polls 0.0.4 copy "flutter_polls: ^0.0.4" to clipboard
flutter_polls: ^0.0.4 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),
              ],
            ),
          ),
        ),
      );
}
154
likes
0
points
1.38k
downloads

Publisher

verified publisherthenifemi.com

Weekly Downloads

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