Skip to content

Commit

Permalink
fix: expose default splash factory
Browse files Browse the repository at this point in the history
  • Loading branch information
vanlooverenkoen committed Mar 1, 2024
1 parent b1d34eb commit 76ec8d5
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 10 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 0.0.24

## Feat

- ImpaktfullTheme expose the defaultSplashFactory

# 0.0.23

## Feat
Expand Down
19 changes: 13 additions & 6 deletions lib/src/impaktfull_app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,28 @@ class ImpaktfullApp extends StatelessWidget {
setImpaktfullTheme(impaktfullTheme);
setImpaktfullLocale(locale);
return SnackyConfiguratorWidget(
textDirection: intl.Bidi.isRtlLanguage(locale?.languageCode ?? '') ? TextDirection.rtl : TextDirection.ltr,
textDirection: intl.Bidi.isRtlLanguage(locale?.languageCode ?? '')
? TextDirection.rtl
: TextDirection.ltr,
snackyController: snackyController,
snackyBuilder: snackyBuilder ??
SimpleSnackyBuilder(
borderRadius: BorderRadius.circular(theme.dimens.generalBorderRadius),
borderRadius:
BorderRadius.circular(theme.dimens.generalBorderRadius),
colorBuilder: (snacky) {
switch (snacky.type) {
case SnackyType.error:
return Color.lerp(theme.colors.error, Colors.white, 0.8) ?? theme.colors.error;
return Color.lerp(theme.colors.error, Colors.white, 0.8) ??
theme.colors.error;
case SnackyType.info:
return Color.lerp(theme.colors.info, Colors.white, 0.8) ?? theme.colors.info;
return Color.lerp(theme.colors.info, Colors.white, 0.8) ??
theme.colors.info;
case SnackyType.success:
return Color.lerp(theme.colors.success, Colors.white, 0.8) ?? theme.colors.success;
return Color.lerp(theme.colors.success, Colors.white, 0.8) ??
theme.colors.success;
case SnackyType.warning:
return Color.lerp(theme.colors.warning, Colors.white, 0.8) ?? theme.colors.warning;
return Color.lerp(theme.colors.warning, Colors.white, 0.8) ??
theme.colors.warning;
}
},
borderBuilder: (snacky) {
Expand Down
12 changes: 8 additions & 4 deletions lib/src/theme/impaktfull_theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ import 'package:impaktfull_ui/src/theme/impaktfull_branding.dart';
import 'package:impaktfull_ui/src/theme/theme_configurator.dart';
import 'package:impaktfull_ui/src/util/test_util.dart';

class ImpaktfullTheme {
static InteractiveInkFeatureFactory get _defaultSplashFactory =>
class ImpaktfullThemeConfig {
static InteractiveInkFeatureFactory get defaultSplashFactory =>
TestUtil.isInTest
? InkSparkle.constantTurbulenceSeedSplashFactory
: InkSparkle.splashFactory;
}

class ImpaktfullTheme {
bool get useDarkStatusBar =>
(theme.colors.primary.computeLuminance() > 0.179) ? true : false;

Expand Down Expand Up @@ -59,7 +61,8 @@ class ImpaktfullTheme {
dimens: dimens ?? ImpaktfullDimens.getDefaults(),
durations: durations ?? ImpaktfullDurations.getDefaults(),
localizations: localizations ?? ImpaktfullLocalizations.getDefaults(),
splashFactory: splashFactory ?? _defaultSplashFactory,
splashFactory:
splashFactory ?? ImpaktfullThemeConfig.defaultSplashFactory,
);

static ImpaktfullTheme fromColors({
Expand Down Expand Up @@ -113,7 +116,8 @@ class ImpaktfullTheme {
dimens: dimens ?? ImpaktfullDimens.getDefaults(),
durations: durations ?? ImpaktfullDurations.getDefaults(),
localizations: localizations ?? ImpaktfullLocalizations.getDefaults(),
splashFactory: splashFactory ?? _defaultSplashFactory,
splashFactory:
splashFactory ?? ImpaktfullThemeConfig.defaultSplashFactory,
);

final ImpaktfullColorTheme colors;
Expand Down

0 comments on commit 76ec8d5

Please sign in to comment.