Before Width: | Height: | Size: 283 KiB After Width: | Height: | Size: 270 KiB |
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 56 KiB |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 28 KiB |
@ -0,0 +1,31 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flame/input.dart';
|
||||
import 'package:pinball_components/pinball_components.dart';
|
||||
import 'package:pinball_flame/pinball_flame.dart';
|
||||
import 'package:sandbox/stories/ball/basic_ball_game.dart';
|
||||
|
||||
class DinoWallGame extends BallGame {
|
||||
DinoWallGame() : super();
|
||||
|
||||
static const description = '''
|
||||
Shows how DinoWalls are rendered.
|
||||
|
||||
- Activate the "trace" parameter to overlay the body.
|
||||
- Tap anywhere on the screen to spawn a ball into the game.
|
||||
''';
|
||||
|
||||
@override
|
||||
Future<void> onLoad() async {
|
||||
await super.onLoad();
|
||||
|
||||
await images.loadAll([
|
||||
Assets.images.dino.topWall.keyName,
|
||||
Assets.images.dino.bottomWall.keyName,
|
||||
]);
|
||||
|
||||
await addFromBlueprint(DinoWalls());
|
||||
camera.followVector2(Vector2.zero());
|
||||
await traceAllBodies();
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
import 'package:dashbook/dashbook.dart';
|
||||
import 'package:sandbox/common/common.dart';
|
||||
import 'package:sandbox/stories/dino_wall/dino_wall_game.dart';
|
||||
|
||||
void addDinoWallStories(Dashbook dashbook) {
|
||||
dashbook.storiesOf('DinoWall').addGame(
|
||||
title: 'Traced',
|
||||
description: DinoWallGame.description,
|
||||
gameBuilder: (_) => DinoWallGame(),
|
||||
);
|
||||
}
|
Before Width: | Height: | Size: 1.0 MiB After Width: | Height: | Size: 1.0 MiB |
Before Width: | Height: | Size: 166 KiB After Width: | Height: | Size: 148 KiB |
@ -1,3 +1,4 @@
|
||||
library share_repository;
|
||||
|
||||
export 'src/models/models.dart';
|
||||
export 'src/share_repository.dart';
|
||||
|
@ -0,0 +1 @@
|
||||
export 'share_platform.dart';
|
@ -0,0 +1,8 @@
|
||||
/// The platform that is being used to share a score.
|
||||
enum SharePlatform {
|
||||
/// Twitter platform.
|
||||
twitter,
|
||||
|
||||
/// Facebook platform.
|
||||
facebook,
|
||||
}
|
@ -1,7 +1,30 @@
|
||||
import 'package:share_repository/share_repository.dart';
|
||||
|
||||
/// {@template share_repository}
|
||||
/// Repository to facilitate sharing scores.
|
||||
/// {@endtemplate}
|
||||
class ShareRepository {
|
||||
/// {@macro share_repository}
|
||||
const ShareRepository();
|
||||
const ShareRepository({
|
||||
required String appUrl,
|
||||
}) : _appUrl = appUrl;
|
||||
|
||||
final String _appUrl;
|
||||
|
||||
/// 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.
|
||||
String shareText({
|
||||
required String value,
|
||||
required SharePlatform platform,
|
||||
}) {
|
||||
final encodedUrl = Uri.encodeComponent(_appUrl);
|
||||
final encodedShareText = Uri.encodeComponent(value);
|
||||
switch (platform) {
|
||||
case SharePlatform.twitter:
|
||||
return 'https://twitter.com/intent/tweet?url=$encodedUrl&text=$encodedShareText';
|
||||
case SharePlatform.facebook:
|
||||
return 'https://www.facebook.com/sharer.php?u=$encodedUrl"e=$encodedShareText';
|
||||
}
|
||||
}
|
||||
}
|
||||
|