reviews_slider 2.0.0 copy "reviews_slider: ^2.0.0" to clipboard
reviews_slider: ^2.0.0 copied to clipboard

Animated widget with changing smile to collect user review score.

example/lib/main.dart

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

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  int selectedValue1;
  int selectedValue2;

  void onChange1(int value) {
    setState(() {
      selectedValue1 = value;
    });
  }

  void onChange2(int value) {
    setState(() {
      selectedValue2 = value;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: Scaffold(
        body: SafeArea(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              Text(
                'How was the help you received?',
                style: TextStyle(color: Color(0xFF6f7478), fontSize: 18),
              ),
              SizedBox(height: 20),
              ReviewSlider(
                onChange: onChange1,
              ),
              Text(selectedValue1.toString()),
              SizedBox(height: 20),
              Text(
                '¿Cómo fue la ayuda que recibiste?',
                style: TextStyle(color: Color(0xFF6f7478), fontSize: 18),
              ),
              SizedBox(height: 20),
              ReviewSlider(
                  optionStyle: TextStyle(
                    color: Colors.red,
                    fontWeight: FontWeight.bold,
                  ),
                  onChange: onChange2,
                  initialValue: 1,
                  options: ['Terrible', 'Malo', 'Bien', 'Vale', 'Genial']),
              Text(selectedValue2.toString()),
            ],
          ),
        ),
      ),
    );
  }
}
111
likes
130
points
315
downloads

Publisher

verified publisherkherel.com

Weekly Downloads

Animated widget with changing smile to collect user review score.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter, vector_math

More

Packages that depend on reviews_slider