build_badge 0.0.4 copy "build_badge: ^0.0.4" to clipboard
build_badge: ^0.0.4 copied to clipboard

Badge to distinguish different builds. Such as staging, dev, production etc

Build Badge workflow #

You can't distinguish different build no hassle. just use --dart-define='env=staging' parameter.

Features #

  • Just add badge to your app's left top corner
  • You decide what to do with it
  • Depends on basic flutter widgets. No material or Cupertino dependency.
  • That is it, Very simple

Getting started #

Add dependency to pubspec.yaml #

dependencies:
  build_badge: ^0.0.2

Fetch dependencies #

flutter pub get

Usage #

to /example folder.

const String env = String.fromEnvironment("env", defaultValue: "dev");

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return BuildBadge(
      textColor: Colors.white,
      backgroundColor: Colors.red,
      text: env.toUpperCase(),
      visible: env != "prod",
      child: MaterialApp(
        title: 'Build Badge Demo',
        theme: ThemeData(
          primarySwatch: Colors.blue,
        ),
        home: const HomePage(),
      ),
    );
  }
}

When you change --dart-define="env=dev" parameter when building, your badge will change accordingly. Obviously, when the environment is the production /prod/, BuildBadge will disappear.

Result #

Screencast

Additional information #

If you have idea in your mind, Feel free to open an issue or pull request.

3
likes
140
pub points
44%
popularity

Publisher

unverified uploader

Badge to distinguish different builds. Such as staging, dev, production etc

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (LICENSE)

Dependencies

flutter

More

Packages that depend on build_badge