-
-
Notifications
You must be signed in to change notification settings - Fork 934
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into spydon/proper-fixed-resolution-viewport
- Loading branch information
Showing
21 changed files
with
888 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# This file tracks properties of this Flutter project. | ||
# Used by Flutter tool to assess capabilities and perform upgrades etc. | ||
# | ||
# This file should be version controlled and should not be manually edited. | ||
|
||
version: | ||
revision: 68841bdab9840b5d72499f9cdd80b69894046ed0 | ||
channel: master | ||
|
||
project_type: package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
## 0.2.0 | ||
|
||
- Added linter | ||
- Updated dependencies | ||
- Improved README | ||
- Updated to Flutter 3.13.0 | ||
|
||
## 0.1.0 | ||
|
||
- Added non nullability support | ||
- Update to new logo | ||
|
||
## 0.0.1 | ||
|
||
- Initial implementation with theme, controller and of course, the splash screen widget. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021 Blue Fire | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
<!-- markdownlint-disable MD013 --> | ||
<p align="center"> | ||
<a href="https://flame-engine.org"> | ||
<img alt="flame" width="200px" src="https://user-images.githubusercontent.com/6718144/101553774-3bc7b000-39ad-11eb-8a6a-de2daa31bd64.png"> | ||
</a> | ||
</p> | ||
|
||
Style your [Flame](https://github.com/flame-engine/flame) game with a beautiful splash screen. | ||
|
||
This package includes a `FlameSplashScreen` widget. | ||
|
||
<p align="center"> | ||
<a title="Pub" href="https://pub.dev/packages/flame_splash_screen" ><img src="https://img.shields.io/pub/v/flame_splash_screen.svg?style=popout" /></a> | ||
<a title="Test" href="https://github.com/flame-engine/flame/actions?query=workflow%3Acicd+branch%3Amain"><img src="https://github.com/flame-engine/flame/workflows/cicd/badge.svg?branch=main&event=push"/></a> | ||
<a title="Discord" href="https://discord.gg/pxrBmy4"><img src="https://img.shields.io/discord/509714518008528896.svg"/></a> | ||
<a title="Melos" href="https://github.com/invertase/melos"><img src="https://img.shields.io/badge/maintained%20with-melos-f700ff.svg"/></a> | ||
</p> | ||
|
||
<p align="center"> | ||
<img src="demo.gif" /> | ||
</p> | ||
|
||
<!-- markdownlint-disable-next-line MD002 --> | ||
## Install | ||
|
||
Add `flame_splash_screen` as a dependency to | ||
[your pubspec.yaml file](https://pub.dev/packages/flame_splash_screen/install). | ||
|
||
Import the widget: | ||
|
||
```dart | ||
import 'package:flame_splash_screen/flame_splash_screen.dart'; | ||
``` | ||
|
||
|
||
## Usage | ||
|
||
The splash screen is a widget that can be used to show the splash screen. | ||
|
||
|
||
### Simple usage | ||
|
||
There is just two required params: | ||
|
||
- `onFinish`, a callback that is executed when all animations from the splash screen is over. | ||
- `theme`, than can be either `FlameSplashTheme.dark` or `FlameSplashTheme.white`. | ||
|
||
```dart | ||
FlameSplashScreen( | ||
theme: FlameSplashTheme.dark, | ||
onFinish: (BuildContext context) => Navigator.pushNamed(context, '/your-game-initial-screen'), | ||
) | ||
``` | ||
|
||
|
||
#### Adding your own content | ||
|
||
You can pass your own logo (or/and anything else) to be shown before or after the Flame's logo. | ||
|
||
```dart | ||
FlameSplashScreen( | ||
theme: FlameSplashTheme.dark, | ||
showBefore: (BuildContext context) { | ||
return Text("To be shown before flame animation"); | ||
}, | ||
onFinish: (BuildContext context) => Navigator.pushNamed(context, '/your-game-initial-screen'), | ||
) | ||
``` | ||
|
||
```dart | ||
FlameSplashScreen( | ||
theme: FlameSplashTheme.dark, | ||
showAfter: (BuildContext context) { | ||
return Text("To be shown after flame animation"); | ||
}, | ||
onFinish: (BuildContext context) => Navigator.pushNamed(context, '/your-game-initial-screen'), | ||
) | ||
``` | ||
|
||
Remember: you can also specify both `showBefore` and `showAfter` at the same time. | ||
|
||
|
||
#### Changing theme | ||
|
||
By default the splash screen has a dark background. You can change it by specifying the `white` | ||
theme. | ||
|
||
Aside from `FlameSplashTheme.dark`, you can pass `FlameSplashTheme.white` for a white background. | ||
|
||
```dart | ||
FlameSplashScreen( | ||
theme: FlameSplashTheme.white, | ||
onFinish: (BuildContext context) => Navigator.pushNamed(context, '/your-game-initial-screen'), | ||
) | ||
``` | ||
|
||
You can create your own theme passing a custom logo builder (changing flames logo for another one) | ||
and a background decoration | ||
|
||
|
||
### Usage with controller | ||
|
||
Controller enables `FlameSplashScreen` to be customized regarding animation duration and when it | ||
starts. | ||
|
||
There is duration params and `autoStart` (which is true by default). | ||
|
||
To use it, make the controller lives as much as a widget state: | ||
|
||
```dart | ||
class SplashScreenGameState extends State<SplashScreenGame> { | ||
FlameSplashController controller; | ||
@override | ||
void initState() { | ||
super.initState(); | ||
controller = FlameSplashController( | ||
fadeInDuration: Duration(seconds: 1), | ||
fadeOutDuration: Duration(milliseconds: 250), | ||
waitDuration: Duration(seconds: 2), | ||
autoStart: false, | ||
); | ||
} | ||
@override | ||
void dispose() { | ||
controller.dispose(); // dispose it when necessary | ||
super.dispose(); | ||
} | ||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
body: FlameSplashScreen( | ||
showBefore: (BuildContext context) { | ||
return Text("Before the logo"); | ||
}, | ||
showAfter: (BuildContext context) { | ||
return Text("After the logo"); | ||
}, | ||
theme: FlameSplashTheme.white, | ||
onFinish: (context) => Navigator.pushNamed(context, '/the-game-initial-screen'), | ||
controller: controller, | ||
), | ||
); | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include: package:flame_lint/analysis_options.yaml |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# This file tracks properties of this Flutter project. | ||
# Used by Flutter tool to assess capabilities and perform upgrades etc. | ||
# | ||
# This file should be version controlled and should not be manually edited. | ||
|
||
version: | ||
revision: "12fccda598477eddd19f93040a1dba24f915b9be" | ||
channel: "stable" | ||
|
||
project_type: app | ||
|
||
# Tracks metadata for the flutter migrate command | ||
migration: | ||
platforms: | ||
- platform: root | ||
create_revision: 12fccda598477eddd19f93040a1dba24f915b9be | ||
base_revision: 12fccda598477eddd19f93040a1dba24f915b9be | ||
- platform: linux | ||
create_revision: 12fccda598477eddd19f93040a1dba24f915b9be | ||
base_revision: 12fccda598477eddd19f93040a1dba24f915b9be | ||
|
||
# User provided section | ||
|
||
# List of Local paths (relative to this file) that should be | ||
# ignored by the migrate tool. | ||
# | ||
# Files that are not part of the templates will be ignored by default. | ||
unmanaged_files: | ||
- 'lib/main.dart' | ||
- 'ios/Runner.xcodeproj/project.pbxproj' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Splash screen example app | ||
|
||
Example of usage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include: package:flame_lint/analysis_options.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import 'package:flame_splash_screen/flame_splash_screen.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
void main() { | ||
runApp(const MyApp()); | ||
} | ||
|
||
class MyApp extends StatelessWidget { | ||
const MyApp({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return MaterialApp( | ||
home: const SplashScreenGame(), | ||
theme: ThemeData.dark(), | ||
debugShowCheckedModeBanner: false, | ||
); | ||
} | ||
} | ||
|
||
class OtherScreen extends StatelessWidget { | ||
const OtherScreen({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
body: Center( | ||
child: ElevatedButton( | ||
child: const Text('Come again'), | ||
onPressed: () { | ||
Navigator.push<void>( | ||
context, | ||
MaterialPageRoute(builder: (context) => const SplashScreenGame()), | ||
); | ||
}, | ||
), | ||
), | ||
); | ||
} | ||
} | ||
|
||
class SplashScreenGame extends StatefulWidget { | ||
const SplashScreenGame({super.key}); | ||
|
||
@override | ||
SplashScreenGameState createState() => SplashScreenGameState(); | ||
} | ||
|
||
class SplashScreenGameState extends State<SplashScreenGame> { | ||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
body: FlameSplashScreen( | ||
showBefore: (BuildContext context) { | ||
return const Text('Before logo'); | ||
}, | ||
showAfter: (BuildContext context) { | ||
return const Text('After logo'); | ||
}, | ||
theme: FlameSplashTheme.dark, | ||
onFinish: (context) => Navigator.pushReplacement<void, void>( | ||
context, | ||
MaterialPageRoute(builder: (context) => const OtherScreen()), | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: flame_splash_screen_example | ||
description: Flame Splash Screen Example | ||
publish_to: none | ||
|
||
version: 1.0.0+1 | ||
|
||
environment: | ||
sdk: ">=3.0.0 <4.0.0" | ||
flutter: ">=3.13.0" | ||
|
||
dependencies: | ||
flame_splash_screen: ^0.2.0 | ||
flutter: | ||
sdk: flutter | ||
|
||
dev_dependencies: | ||
flame_lint: ^1.1.1 | ||
flutter_test: | ||
sdk: flutter | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export 'src/controller.dart'; | ||
export 'src/splash.dart'; | ||
export 'src/theme.dart'; |
Oops, something went wrong.