0 purchases
build badge
Build Badge #
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
copied to clipboard
Fetch dependencies #
flutter pub get
copied to clipboard
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(),
),
);
}
}
copied to clipboard
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 #
Additional information #
If you have idea in your mind, Feel free to open an issue or pull request.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.