contributors 0.0.2
contributors: ^0.0.2 copied to clipboard

A Flutter package for showing contributors of a project on GitHub in a nice UI.

example/lib/main.dart

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

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Home(),
    );
  }
}

class Home extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(
          "Contributors Example",
        ),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            ElevatedButton(
              onPressed: () async {
                await Navigator.push(
                  context,
                  MaterialPageRoute(
                    builder: (_) => ReadyUI(),
                  ),
                );
              },
              child: Text("Ready UI"),
            ),
            const SizedBox(height: 20),
            ElevatedButton(
              onPressed: () async {
                await Navigator.push(
                  context,
                  MaterialPageRoute(
                    builder: (_) => CustomUI(),
                  ),
                );
              },
              child: Text("Custom UI"),
            ),
          ],
        ),
      ),
    );
  }
}

class ReadyUI extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(),
      body: ContributorsView(
        ownerName: "flutter",
        repoName: "flutter",
        locale: Locale("en"), // try this for english language
        // locale: Locale("ar"), // try this for arabic language
        translations: <ContributorsTranslation>[
          ContributorsTranslation.en(),
          ContributorsTranslation.ar(),
          ContributorsTranslation.cs(),
          ContributorsTranslation(
            languageCode: 'es',
            contributions: 'Contribuciones',
            followers: 'Seguidores',
            following: 'Siguiendo',
            publicRepos: 'Reposiciones Públicas',
            publicGists: 'Gists Públicos',
            oopsSomethingWentWrong: '¡UPS! ¡Algo salió mal!',
            isRTL: false,
          ),
        ],
      ),
    );
  }
}

class CustomUI extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(),
      body: ContributorsBuilderView(
        ownerName: "flutter",
        repoName: "flutter",
        locale: Locale("en"), // try this for english language
        // locale: Locale("ar"), // try this for arabic language
        translations: <ContributorsTranslation>[
          ContributorsTranslation.en(),
          ContributorsTranslation.ar(),
          ContributorsTranslation.cs(),
          ContributorsTranslation(
            languageCode: 'es',
            contributions: 'Contribuciones',
            followers: 'Seguidores',
            following: 'Siguiendo',
            publicRepos: 'Reposiciones Públicas',
            publicGists: 'Gists Públicos',
            oopsSomethingWentWrong: '¡UPS! ¡Algo salió mal!',
            isRTL: false,
          ),
        ],
        builder: (
          BuildContext context,
          List<ContributorStatistics> contributorStatisticsList,
        ) {
          return ListView.builder(
            itemCount: contributorStatisticsList.length,
            itemBuilder: (
              BuildContext context,
              int index,
            ) {
              final ContributorStatistics contributorStatistics =
                  contributorStatisticsList[index];

              return Container(
                color: index.isEven ? Colors.red : Colors.blue,
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: <Widget>[
                    Text(
                      contributorStatistics.author.login,
                    ),
                    SizedBox(
                      height: 250,
                      child: ListView.builder(
                        itemCount: contributorStatistics.weeks.length,
                        itemBuilder: (BuildContext context, int index) {
                          return Column(
                            children: [
                              Text(
                                "Start: " +
                                    DateTime.fromMillisecondsSinceEpoch(
                                      contributorStatistics.weeks[index].start *
                                          1000,
                                    ).toString(),
                                style: TextStyle(
                                  color: Colors.white,
                                ),
                              ),
                              Text(
                                "Commits: " +
                                    contributorStatistics.weeks[index].commits
                                        .toString(),
                                style: TextStyle(
                                  color: Colors.white,
                                ),
                              ),
                              Text(
                                "Additions: " +
                                    contributorStatistics.weeks[index].additions
                                        .toString(),
                                style: TextStyle(
                                  color: Colors.white,
                                ),
                              ),
                              Text(
                                "Deletions: " +
                                    contributorStatistics.weeks[index].deletions
                                        .toString(),
                                style: TextStyle(
                                  color: Colors.white,
                                ),
                              ),
                            ],
                          );
                        },
                      ),
                    ),
                  ],
                ),
              );
            },
          );
        },
      ),
    );
  }
}
6
likes
90
pub points
0%
popularity

Publisher

flutterbuddies.com

A Flutter package for showing contributors of a project on GitHub in a nice UI.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

fl_chart, flutter, github, stacked

More

Packages that depend on contributors