github_issues 2.0.0 github_issues: ^2.0.0 copied to clipboard
Flutter package to create Github issues. Good for collecting user feedback.
Github Issues #
Use Github issues to collect user feedback.
Features #
- Create Github issues with title, comment and labels
- Easy internationalization with
GithubIssuesLocalizations
- Supports two authentication methods
Getting started #
- Create a repository to store the user feedback (or use an existing one).
- Get a token with read and write access on issues for your repository
Option 1: Generate a personal access token
Option 2: Create a Github App -> Install your own Github App -> Generate a private key for your Github App.
Usage #
Dart #
import 'dart:io';
import 'package:github_issues/github_issues_dart.dart';
const appId = 385403;
const owner = 'abichinger';
const repo = 'github-issues-test';
// Personal access token
Future<String> get personalToken {
return File('assets/token.txt').readAsString();
}
// Installation token of Github app
Future<String> get installationToken async {
final pem = await File('assets/private.pem').readAsString();
return PrivateKeyAuth(id: appId, pem: pem)
.getInstallationToken(owner: owner, repo: repo);
}
void main() async {
final token = await personalToken;
// final token = await installationToken;
final github = Github(Authentication.token(token));
github.createIssue(
owner: owner,
repo: repo,
issue: const IssueRequest(
title: 'Hello World!',
body: '...',
labels: ['bug'],
),
);
}
Flutter #
Fill input fields in advance
showDialog(
context: context,
builder: (context) {
return GithubIssueDialog(
github: github,
owner: kOwner,
repo: kRepo,
initialValue: const IssueRequest(title: "Hello World!"),
);
},
);
Pass your custom localizations
class CustomLocalization extends GithubIssuesLocalizationsEn {
@override
String get dialogTitle => 'Thanks for your feedback!';
}
showDialog(
context: context,
builder: (context) {
return GithubIssueDialog(
github: github,
owner: kOwner,
repo: kRepo,
localizations: CustomLocalization(),
);
},
);