github_colour 1.0.0 copy "github_colour: ^1.0.0" to clipboard
github_colour: ^1.0.0 copied to clipboard

outdated

Receive ozh's GitHub colour to Flutter's colour implementation with caching and fallback.

Apply GitHub's languages colours into Flutter's Color object. #

Pub Version GitHub Sponsors

Receiving ozh's github-colors repository with latest commit of colors.json to Flutter's Color object.

Usage #

You can either initalized GitHubColour before runApp(Widget):

void main() async {
    await GitHubColour.getInstance();
    runApp(const YourApp());
}

then uses getExistedInstance() inside the Widget:

class YourAppWidget extends StatelessWidget {
    @override
    Widget build(BuildContext context) => Scaffold(
        appBar: AppBar(backgroundColor: GitHubColour.getExistedInstance().find("Go"))
    );
}

or wrapped into FutureBuilder directly in State's initState (not recommended uses getInstance() directly in FutureBuilder):

class _YourAnotherAppWidgetState extends State<YourAnotherAppWidget> {
    late final Future<GitHubColour> _ghc;

    @override
    void initState() {
        super.initState();
        _ghc = GitHubColour.getInstance();
    }

    @override
    Widget build(BuildContext context) => FutureBuilder<GitHubColour>(
        future: _ghc,
        builder: (context, snapshot) {
            // Implement whatever you want
        }
    );
}

Cache for connection failed #

This package supported caching system as a backup when making request failed. It uses LZMA compress data and store as a file under temporary directory (for VM) or store as shared_preference (for Web, which is LocalStorage).

Note for American English developers #

It's provide alias class GitHubColor for who uses "color" mostly.

Screenshots #

C++ Dart

Go Java

Python

License #

BSD-3

1
likes
0
pub points
0%
popularity

Publisher

verified publisherrk0cc.xyz

Receive ozh's GitHub colour to Flutter's colour implementation with caching and fallback.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, http, lzma, meta, path, path_provider, shared_preferences

More

Packages that depend on github_colour