Search packages, repositories and app categories

GitHub repositorydavidsdearaujo/rating

rating

Flutter: Rating bottom sheet

rating project cover
Stars
5
Forks
7
Last push (UTC)
Jan 1, 2022
Project status
Active

Original README

English project snapshot. Visit GitHub for the latest content.

Rating bottom sheet

Features

Getting started

pubspec.yaml

rating: <lastest version>

Usage

Implement the RatingController

class PrintRatingController extends RatingController {
  PrintRatingController(RatingModel ratingModel) : super(ratingModel);

  @override
  Future<void> ignoreForEverCallback() async {
    print('Rating ignored forever!');
    await Future.delayed(const Duration(seconds: 3));
  }

  @override
  Future<void> saveRatingCallback(int rate, List<RatingCriterionModel> selectedCriterions) async {
    print('Rating saved!\nRate: $rate\nsSelectedItems: $selectedCriterions');
    await Future.delayed(const Duration(seconds: 3));
  }
}

Create one RatingModel

final ratingModel = RatingModel(
  id: 1,
  title: null,
  subtitle: 'Classifique nosso app:',
  ratingConfig: RatingConfigModel(
    id: 1,
    ratingSurvey1: 'Em que podemos melhorar?',
    ratingSurvey2: 'Em que podemos melhorar?',
    ratingSurvey3: 'Em que podemos melhorar?',
    ratingSurvey4: 'Em que podemos melhorar?',
    ratingSurvey5: 'O que você mais gostou?',
    items: [
      RatingCriterionModel(id: 1, name: 'Qualidade do atendimento'),
      RatingCriterionModel(id: 2, name: 'Competência dos atendentes'),
      RatingCriterionModel(id: 3, name: 'Limpeza do ambiente'),
      RatingCriterionModel(id: 4, name: 'Tempo de espera'),
    ],
  ),
);

Show the Rating Widget using the custom Rating Controller PrintRatingController and the new RatingModel

showModalBottomSheet(
  context: context,
  builder: (context) => RatingWidget(controller: PrintRatingController(ratingModel)),
);
David Araujo GitHub avatar
GitHub author

David Araujo ↗

Front End Developer at Autonation | Flutter Google Mentor | Flutterando Founder

Autonation
LanguagesDartHTMLSwiftKotlinObjective-C

Packages published by this repository

Dependencies used

Dependency list 5 items

How do I choose a repository?

Start with your use case, compare repository activity, and check the original project before adopting it.

  1. Search by repository name, owner or description, then narrow the results by topic.
  2. Compare stars, forks and recent pushes. Stars show community interest, not a guarantee of quality.
  3. Read the README, license and issues on GitHub before using a project.

Sources and maintenance

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗