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.

Libraries

build_badge