An app Banner Widget that shows the current app version. Can be used with App Flavors to show what flavor of the app is currently being used.
This widget should wrap MaterialApp
or CupertinoApp
.
VersionBanner(
text: "Yay!",
packageExtensions: [".dev"],
child: MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
)
);
packageExtensions
will check the app's package name with the given array. If the package name contains part of the String in the array, then the banner is visible.
The following properties can be changed:
color
- Banner's colortextStyle
- Banner's text styletext
- The text to appear. If set to null will show thepubspec
versionlocation
- the banner's location on the screen, based on the class BannerLocationpackageExtensions
- will check the app's package name with the given array. If the package name contains part of the String in the array, then the banner is visible.visible
- decides if the banner is visible or not. If set tofalse
, it overrides thepackageExtensions
attribute