Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 24 additions & 7 deletions lib/splashscreen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ class SplashScreen extends StatefulWidget {
/// Whether to display a loader or not
final bool useLoader;

// Custom loader widget
final Widget? customLoader;

/// Custom page route if you have a custom transition you want to play
final Route? pageRoute;

Expand Down Expand Up @@ -84,6 +87,7 @@ class SplashScreen extends StatefulWidget {
this.imageBackground,
this.gradientBackground,
required this.useLoader,
this.customLoader,
this.routeName,
}) : assert(
routeName == null ||
Expand Down Expand Up @@ -129,6 +133,7 @@ class SplashScreen extends StatefulWidget {
ImageProvider? imageBackground,
Gradient? gradientBackground,
bool useLoader = true,
Widget? customLoader,
String? routeName,
}) =>
SplashScreen(
Expand All @@ -147,6 +152,7 @@ class SplashScreen extends StatefulWidget {
imageBackground: imageBackground,
gradientBackground: gradientBackground,
useLoader: useLoader,
customLoader: customLoader,
routeName: routeName,
);

Expand All @@ -166,6 +172,7 @@ class SplashScreen extends StatefulWidget {
ImageProvider? imageBackground,
Gradient? gradientBackground,
bool useLoader = true,
Widget? customLoader,
String? routeName,
}) =>
SplashScreen(
Expand All @@ -184,6 +191,7 @@ class SplashScreen extends StatefulWidget {
imageBackground: imageBackground,
gradientBackground: gradientBackground,
useLoader: useLoader,
customLoader: customLoader,
routeName: routeName,
);

Expand Down Expand Up @@ -287,13 +295,22 @@ class _SplashScreenState extends State<SplashScreen> {
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
widget.useLoader
? CircularProgressIndicator(
valueColor: AlwaysStoppedAnimation<Color?>(
widget.loaderColor,
),
)
: Container(),
if (widget.useLoader == true) ...[
if (widget.customLoader != null) ...[
Container(
alignment: Alignment.center,
child: widget.customLoader,
)
] else ...[
CircularProgressIndicator(
valueColor: AlwaysStoppedAnimation<Color?>(
widget.loaderColor,
),
)
]
] else ...[
Container()
],
Padding(
padding: const EdgeInsets.only(top: 20.0),
),
Expand Down