Skip to content

Commit

Permalink
Make functions private that should not be public.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonbhanson committed Dec 7, 2023
1 parent a52d4c5 commit 3350dae
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 47 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [2.3.8]

- Make functions private that should not be public.

## [2.3.7] - (2023-Dec-06)

- Roll back web fade as it was a breaking change. Fixes [#628](https://github.com/jonbhanson/flutter_native_splash/issues/628). Fixes [#627](https://github.com/jonbhanson/flutter_native_splash/issues/627). Fixes [#622](https://github.com/jonbhanson/flutter_native_splash/issues/622).
Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# **Need a great Flutter developer? [I'm available](https://www.linkedin.com/in/hansonjon/)!**

When your app is opened, there is a brief time while the native app loads Flutter. By default, during this time, the native app displays a white splash screen. This package automatically generates iOS, Android, and Web-native code for customizing this native splash screen background color and splash image. Supports dark mode, full screen, and platform-specific options.

<p align='center'>
Expand All @@ -21,7 +19,7 @@ First, add `flutter_native_splash` as a dependency in your pubspec.yaml file.

```yaml
dependencies:
flutter_native_splash: ^2.3.7
flutter_native_splash: ^2.3.8
```
Don't forget to `flutter pub get`.
Expand Down Expand Up @@ -417,7 +415,7 @@ This is caused by an [iOS splash caching bug](https://stackoverflow.com/question
## I see a white screen between splash screen and app

1. It may be caused by an [iOS splash caching bug](https://stackoverflow.com/questions/33002829/ios-keeping-old-launch-screen-and-app-icon-after-update), which can be solved by uninstalling your app, powering off your device, power back on, and then try reinstalling.
2. It may be caused by the delay due to initialization in your app. To solve this, put any initialization code in the `removeAfter` method.
2. It may be caused by the delay due to initialization in your app. To solve this, use the `preserve` and `remove` calls to keep the splash on screen while your app initializes.

## Can I base light/dark mode on app settings?

Expand Down
20 changes: 10 additions & 10 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,17 @@ packages:
dependency: "direct dev"
description:
name: flutter_lints
sha256: a25a15ebbdfc33ab1cd26c63a6ee519df92338a9c10f122adda92938253bef04
sha256: e2a421b7e59244faef694ba7b30562e489c2b489866e505074eb005cd7060db7
url: "https://pub.dev"
source: hosted
version: "2.0.3"
version: "3.0.1"
flutter_native_splash:
dependency: "direct main"
description:
path: ".."
relative: true
source: path
version: "2.3.7"
version: "2.3.8"
flutter_test:
dependency: "direct dev"
description: flutter
Expand Down Expand Up @@ -163,10 +163,10 @@ packages:
dependency: transitive
description:
name: lints
sha256: "6b0206b0bf4f04961fc5438198ccb3a885685cd67d4d4a32cc20ad7f8adbe015"
sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290
url: "https://pub.dev"
source: hosted
version: "2.1.0"
version: "3.0.0"
matcher:
dependency: transitive
description:
Expand Down Expand Up @@ -203,10 +203,10 @@ packages:
dependency: transitive
description:
name: petitparser
sha256: cb3798bef7fc021ac45b308f4b51208a152792445cce0448c9a4ba5879dd8750
sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27
url: "https://pub.dev"
source: hosted
version: "5.4.0"
version: "6.0.2"
pointycastle:
dependency: transitive
description:
Expand Down Expand Up @@ -304,10 +304,10 @@ packages:
dependency: transitive
description:
name: xml
sha256: "5bc72e1e45e941d825fd7468b9b4cc3b9327942649aeb6fc5cdbf135f0a86e84"
sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226
url: "https://pub.dev"
source: hosted
version: "6.3.0"
version: "6.5.0"
yaml:
dependency: transitive
description:
Expand All @@ -317,5 +317,5 @@ packages:
source: hosted
version: "3.1.2"
sdks:
dart: ">=3.2.0-194.0.dev <4.0.0"
dart: ">=3.2.0 <4.0.0"
flutter: ">=2.5.0"
2 changes: 1 addition & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ dev_dependencies:
# activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
flutter_lints: ^2.0.3
flutter_lints: ^3.0.1

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
Expand Down
28 changes: 14 additions & 14 deletions lib/android.dart
Original file line number Diff line number Diff line change
Expand Up @@ -415,76 +415,76 @@ Future<void> _updateStylesFile({
return;
}

replaceElement(
_replaceElement(
launchTheme: launchTheme,
name: 'android:forceDarkAllowed',
value: "false",
);

replaceElement(
_replaceElement(
launchTheme: launchTheme,
name: 'android:windowFullscreen',
value: fullScreen.toString(),
);

replaceElement(
_replaceElement(
launchTheme: launchTheme,
name: 'android:windowDrawsSystemBarBackgrounds',
value: fullScreen.toString());

replaceElement(
_replaceElement(
launchTheme: launchTheme,
name: 'android:windowLayoutInDisplayCutoutMode',
value: 'shortEdges',
);

// In Android 12, the color must be set directly in the styles.xml
if (android12BackgroundColor == null) {
removeElement(
_removeElement(
launchTheme: launchTheme,
name: 'android:windowSplashScreenBackground',
);
} else {
replaceElement(
_replaceElement(
launchTheme: launchTheme,
name: 'android:windowSplashScreenBackground',
value: '#$android12BackgroundColor',
);
}

if (android12BrandingImagePath == null) {
removeElement(
_removeElement(
launchTheme: launchTheme,
name: 'android:windowSplashScreenBrandingImage',
);
} else {
replaceElement(
_replaceElement(
launchTheme: launchTheme,
name: 'android:windowSplashScreenBrandingImage',
value: '@drawable/android12branding',
);
}

if (android12ImagePath == null) {
removeElement(
_removeElement(
launchTheme: launchTheme,
name: 'android:windowSplashScreenAnimatedIcon',
);
} else {
replaceElement(
_replaceElement(
launchTheme: launchTheme,
name: 'android:windowSplashScreenAnimatedIcon',
value: '@drawable/android12splash',
);
}

if (android12IconBackgroundColor == null) {
removeElement(
_removeElement(
launchTheme: launchTheme,
name: 'android:windowSplashScreenIconBackgroundColor',
);
} else {
replaceElement(
_replaceElement(
launchTheme: launchTheme,
name: 'android:windowSplashScreenIconBackgroundColor',
value: '#$android12IconBackgroundColor',
Expand All @@ -496,7 +496,7 @@ Future<void> _updateStylesFile({
);
}

void replaceElement({
void _replaceElement({
required XmlElement launchTheme,
required String name,
required String value,
Expand All @@ -517,7 +517,7 @@ void replaceElement({
);
}

void removeElement({required XmlElement launchTheme, required String name}) {
void _removeElement({required XmlElement launchTheme, required String name}) {
launchTheme.children.removeWhere(
(element) => element.attributes.any(
(attribute) =>
Expand Down
16 changes: 4 additions & 12 deletions lib/cli_commands.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ void createSplash({
}

final config = getConfig(configFile: path, flavor: flavor);
createSplashByConfig(config);
_createSplashByConfig(config);
}

/// Create splash screens for Android and iOS based on a config argument
void createSplashByConfig(Map<String, dynamic> config) {
void _createSplashByConfig(Map<String, dynamic> config) {
// Preparing all the data for later usage
final String? image =
_checkImageExists(config: config, parameter: _Parameter.image);
Expand Down Expand Up @@ -227,15 +227,7 @@ Now go finish building something awesome! 💪 You rock! 🤘🤩
Like the package? Please give it a 👍 here: https://pub.dev/packages/flutter_native_splash
''';

const String whatsNew = '''
╔════════════════════════════════════════════════════════════════════════════╗
║ NEED A GREAT FLUTTER DEVELOPER? ║
╠════════════════════════════════════════════════════════════════════════════╣
║ ║
║ I am available! Find me at https://www.linkedin.com/in/hansonjon/ ║
║ ║
╚════════════════════════════════════════════════════════════════════════════╝
''';
const String whatsNew = '';
print(whatsNew + greet);
}

Expand Down Expand Up @@ -269,7 +261,7 @@ void removeSplash({
if (config.containsKey(_Parameter.plistFiles)) {
removeConfig[_Parameter.plistFiles] = config[_Parameter.plistFiles];
}
createSplashByConfig(removeConfig);
_createSplashByConfig(removeConfig);
}

String? _checkImageExists({
Expand Down
4 changes: 2 additions & 2 deletions lib/web.dart
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ void _createWebSplash({
],
);

createBackgroundImages(
_createBackgroundImages(
backgroundImage: backgroundImage,
darkBackgroundImage: darkBackgroundImage,
);
Expand All @@ -176,7 +176,7 @@ void _createWebSplash({
);
}

void createBackgroundImages({
void _createBackgroundImages({
required String? backgroundImage,
required String? darkBackgroundImage,
}) {
Expand Down
8 changes: 4 additions & 4 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: flutter_native_splash
description: Customize Flutter's default white native splash screen with
background color and splash image. Supports dark mode, full screen, and more.
version: 2.3.7
version: 2.3.8
repository: https://github.com/jonbhanson/flutter_native_splash
issue_tracker: https://github.com/jonbhanson/flutter_native_splash/issues

Expand All @@ -18,17 +18,17 @@ dependencies:
js: ^0.6.7
html: ^0.15.4
image: ^4.1.3
meta: ^1.9.1
meta: ^1.10.0
path: ^1.8.3
universal_io: ^2.2.2
xml: ^6.3.0
xml: ^6.5.0
yaml: ^3.1.2
ansicolor: ^2.0.2

dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^2.0.3
flutter_lints: ^3.0.1

screenshots:
- description: 'Examples of the splash screen on iOS.'
Expand Down

0 comments on commit 3350dae

Please sign in to comment.