buy_me_a_coffee_widget 1.0.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 65

Buy Me A Coffee

Buy me a coffee widget #

Did you ever needed a widget for buy me a coffee, well here it is.

Buy me a coffee widget

Important note #

Be very careful with using this widget. According to the Google Play Guidelines you are not allowed to get payments from external ressources. So a donation button could lead to a ban of your app!

This app should only be used in Web or in Stores that allow a donation.

For more information please read this

Getting Started #

You have to import

import 'package:buy_me_a_coffee_widget/buy_me_a_coffee_widget.dart';

then you can use the Widget.

Container(
  width: 217.0,
  child: BuyMeACoffeeWidget(
      sponsorID: "sBGXj7Pl4",
      theme: theme,
  ),
)

For a more in depth example please go to the Example Folder.

[0.0.1] - 28.01.2020 #

  • First release of the package. You can use the widget now and change the appearance with the different Themes that are provided.

[0.0.2] - 28.01.2020 #

  • Added the example to the project

[1.0.0] - 28.01.2020 #

  • Added an important note to the readme file.

example/lib/main.dart

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

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  // This widget is the root of your application.
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  BuyMeACoffeeThemeData theme = OrangeTheme();

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        // This is the theme of your application.
        //
        // Try running your application with "flutter run". You'll see the
        // application has a blue toolbar. Then, without quitting the app, try
        // changing the primarySwatch below to Colors.green and then invoke
        // "hot reload" (press "r" in the console where you ran "flutter run",
        // or simply save your changes to "hot reload" in a Flutter IDE).
        // Notice that the counter didn't reset back to zero; the application
        // is not restarted.
        primarySwatch: Colors.blue,
      ),
      home: Scaffold(
        appBar: AppBar(
          title: Text("Buy me a coffee Widget"),
        ),
        body: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Center(
              child: Container(
                width: 217.0,
                child: BuyMeACoffeeWidget(
                  sponsorID: "sBGXj7Pl4",
                  theme: theme,
                ),
              ),
            ),
            SizedBox(height: 20),
            Padding(
              padding: const EdgeInsets.all(8.0),
              child: Column(
                children: <Widget>[
                  Row(
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: <Widget>[
                      ThemeSelector(
                        color: Color(0xFFFF813F),
                        onTap: () {
                          setState(() {
                            theme = OrangeTheme();
                          });
                        },
                      ),
                      ThemeSelector(
                        color: Color(0xFFFFDD00),
                        onTap: () {
                          setState(() {
                            theme = YellowTheme();
                          });
                        },
                      ),
                      ThemeSelector(
                        color: Color(0xFFbd5fff),
                        onTap: () {
                          setState(() {
                            theme = PurpleTheme();
                          });
                        },
                      ),
                      ThemeSelector(
                        color: Colors.black,
                        onTap: () {
                          setState(() {
                            theme = BlackTheme();
                          });
                        },
                      ),
                    ],
                  ),
                  Row(
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: <Widget>[
                      ThemeSelector(
                        color: Colors.white,
                        onTap: () {
                          setState(() {
                            theme = WhiteTheme();
                          });
                        },
                      ),
                      ThemeSelector(
                        color: Color(0xFF79D6B5),
                        onTap: () {
                          setState(() {
                            theme = TealTheme();
                          });
                        },
                      ),
                      ThemeSelector(
                        color: Color(0xFFFF5F5F),
                        onTap: () {
                          setState(() {
                            theme = RedTheme();
                          });
                        },
                      ),
                      ThemeSelector(
                        color: Color(0xFFF471FF),
                        onTap: () {
                          setState(() {
                            theme = PinkTheme();
                          });
                        },
                      )
                    ],
                  ),
                ],
              ),
            )
          ],
        ),
      ),
    );
  }
}

class ThemeSelector extends StatelessWidget {
  final Function onTap;
  final Color color;

  const ThemeSelector({Key key, this.onTap, this.color}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.all(8.0),
      child: GestureDetector(
        onTap: onTap,
        child: new Container(
            child: new CircleAvatar(backgroundColor: color),
            width: 64.0,
            height: 64.0,
            padding: const EdgeInsets.all(1.0),
            decoration: new BoxDecoration(
              color: Colors.black, // border color
              shape: BoxShape.circle,
            )),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  buy_me_a_coffee_widget: ^1.0.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:buy_me_a_coffee_widget/buy_me_a_coffee_widget.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
34
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
65
Learn more about scoring.

We analyzed this package on May 24, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.1
  • pana: 0.13.8-dev
  • Flutter: 1.17.0

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (google_fonts).

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
flutter_svg ^0.17.0 0.17.4
google_fonts ^0.3.4 0.3.10 1.1.0
url_launcher ^5.4.1 5.4.10
Transitive dependencies
charcode 1.1.3
collection 1.14.12
convert 2.1.1
crypto 2.1.5
flutter_web_plugins 0.0.0
http 0.12.1
http_parser 3.1.4
meta 1.1.8
path 1.7.0
path_drawing 0.4.1
path_parsing 0.1.4
path_provider 1.6.9
path_provider_macos 0.0.4+3
path_provider_platform_interface 1.0.2
pedantic 1.9.0
petitparser 3.0.2
platform 2.2.1
platform_detect 1.4.0
plugin_platform_interface 1.0.2
pub_semver 1.4.4
sky_engine 0.0.99
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
url_launcher_macos 0.0.1+7
url_launcher_platform_interface 1.0.7
url_launcher_web 0.1.1+6
vector_math 2.0.8
xml 3.7.0 4.1.0
Dev dependencies
flutter_test