You can't distinguish different build no hassle. just use --dart-define='env=staging'
parameter.
- 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
dependencies:
build_badge: ^0.0.2
flutter pub get
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.
If you have idea in your mind, Feel free to open an issue or pull request.