ueman/feedback

repository·master·Indexed 19 days ago

https://github.com/ueman/feedback

A Flutter package for obtaining high-quality user feedback by allowing users to annotate screenshots of the current app screen and add text descriptions. It features a BetterFeedback widget for integration, a FeedbackController for programmatic control, and extensible plugins for routing feedback to platforms like GitLab (feedback_gitlab), Sentry (feedback_sentry), and GitHub (feedback_github).

Tokens
4.8K
Snippets
22
Records
26
Agent score
65%

What's inside feedback

  1. Overview of the feedback package

    master
    The feedback package is a Flutter library designed to improve user experience by allowing users to provide interactive feedback directly within an app. Users can provide feedback by annotating a screenshot of the current page and adding text descriptions. This helps developers understand specific issues or feature requests more clearly than text alone.
  2. Integrate feedback with external platforms using plugins

    master

    The feedback package is designed to be extensible. You can use existing plugins to route user feedback to various issue trackers or services.

    Available specialized plugins:

    • feedback_gitlab: For GitLab Issues.
    • feedback_sentry: For Sentry User Feedback.
    • feedback_github: For GitHub Issues (note: this uses Firebase Storage for images).

    Manual integration targets: If a dedicated plugin is not available, you can manually handle the feedback data to send it to:

    • A custom server: Use a MultipartRequest (from the http package) to upload the annotated image and text.
    • Platform share dialog: Use the share_plus package to let users share the feedback via system dialogs.
    • Firebase: Use cloud_firestore, firebase_storage, or firebase_database.
    • Project Management Tools: Use the REST APIs for Jira or Trello to create issues and upload files.
    • E-Mail: Use a package like flutter_email_sender to open the user's email client with the feedback content.
  3. Customize iOS launch screen assets

    master

    To customize the iOS launch screen, replace the existing image files located in the feedback/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/ directory with your own assets.

    Alternatively, you can manage these assets using Xcode:

    1. Open the iOS workspace using open ios/Runner.xcworkspace.
    2. In the Xcode Project Navigator, navigate to Runner/Assets.xcassets.
    3. Drag and drop your desired images into the asset catalog.
    open ios/Runner.xcworkspace
  4. Initialize BetterFeedback in your app

    master

    To enable feedback capabilities, wrap your root application widget with the BetterFeedback widget.

    import 'package:feedback/feedback.dart';
    import 'package:flutter/material.dart';
    
    void main() {
      runApp(
        BetterFeedback(
          child: const MyApp(),
        ),
      );
    }
  5. Install feedback_gitlab via pubspec.yaml

    master

    To use the GitLab feedback integration, add feedback_gitlab to your Flutter project's pubspec.yaml dependencies. After adding the dependency, run flutter pub get in your terminal to install it.

    dependencies:
      flutter:
        sdk: flutter
      feedback_gitlab: x.y.z # use the latest version found on pub.dev
  6. Use GlobalFeedbackLocalizationsDelegate for default translations

    master

    The GlobalFeedbackLocalizationsDelegate provides built-in support for many languages including English (en), German (de), French (fr), Arabic (ar), Russian (ru), Spanish (es), Chinese (zh), and many others.

    To use the default translations in your Flutter application, add GlobalFeedbackLocalizationsDelegate.delegate to your localizationsDelegates list in MaterialApp.

    MaterialApp(
      localizationsDelegates: [
        GlobalFeedbackLocalizationsDelegate.delegate,
        // ... other delegates
      ],
      supportedLocales: [
        const Locale('en'),
        const Locale('de'),
        // ... other supported locales
      ],
      home: MyHomePage(),
    );
  7. Setup BetterFeedback as the root widget

    master

    To use the feedback interface, wrap your application (typically your MaterialApp) with the BetterFeedback widget. This must be placed above any Navigator widgets in your tree to ensure the feedback overlay can be displayed correctly.

    By default, BetterFeedback uses FeedbackMode.draw, allowing users to navigate and draw on the screen before submitting feedback. It also defaults to a pixelRatio of 3.0 for screenshot captures.

    BetterFeedback(
      child: MaterialApp(
        title: 'App',
        home: MyHomePage(),
      ),
    );
  8. Show and upload feedback to GitLab

    master

    Use BetterFeedback.of(context).showAndUploadToGitLab(...) to display the feedback panel and automatically upload the submitted feedback to a GitLab project. You must provide the projectId and a valid apiToken.

    BetterFeedback.of(context).showAndUploadToGitLab(
        projectId: 'project-Id',
        apiToken: 'api-token',
    );
  9. Show and upload feedback to Sentry

    master

    To trigger the feedback panel and automatically upload the user's feedback to Sentry, use BetterFeedback.of(context).showAndUploadToSentry(...).

    import 'package:feedback_sentry/feedback_sentry.dart';
    
    BetterFeedback.of(context).showAndUploadToSentry(
        name: 'Foo Bar', // optional
        email: 'foo_bar@example.com', // optional
    );
  10. Configure BetterFeedback themes and localization

    master

    The BetterFeedback widget allows customization of its visual appearance and language:

    • themeMode: Controls theme selection. Use ThemeMode.system (default), ThemeMode.light, or ThemeMode.dark.
    • theme: The FeedbackThemeData used when themeMode is light or system-is-light.
    • darkTheme: The FeedbackThemeData used when themeMode is dark or system-is-dark.
    • localizationsDelegates: A list of delegates required if you customize localization. You must include MaterialLocalizations, CupertinoLocalizations, WidgetsLocalizations, and an instance of LocalizationsDelegate<FeedbackLocalizations>.
    • localeOverride: Sets a specific Locale for the feedback UI; otherwise, it defaults to the platform locale or English.