Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flutter 3.22 #505

Merged
merged 30 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
d00f503
Updates dependencies to flutter 3.22, fixes code to run with new depe…
astivi May 29, 2024
6716286
Dart format fixes
astivi Jul 2, 2024
c929483
Updates sdk versions
astivi Jul 2, 2024
42359ee
Some more dependency version updates and restores Cloudstore function…
astivi Jul 2, 2024
e7ae150
Adds some more files to ignore on .gitignore
astivi Jul 2, 2024
cea3368
Fixes Initials Submission Failure Display Test
astivi Jul 2, 2024
04d1f6d
Fixes Leaderboard Display Tests
astivi Jul 2, 2024
1e5cc0c
Fixes some async issues with ramp tests
astivi Jul 2, 2024
3ae8a0c
Fixes some more async test issues
astivi Jul 2, 2024
d157d81
Fixes even more async test issues
astivi Jul 2, 2024
5da3017
Dart format fix
astivi Jul 2, 2024
5e64ec7
Fixes emitting new state on closed AssetsManager
astivi Jul 3, 2024
e2648e3
Restores initial leaderboard entries loading
astivi Jul 3, 2024
2f3efcf
Removes unused import
astivi Jul 3, 2024
2b03a92
Makes the coverage tool happy
astivi Jul 3, 2024
56abc8d
Adds more Canvas Wrapper tests
astivi Jul 3, 2024
73e0627
Fixes Dino Walls
astivi Jul 3, 2024
5e29fbd
Fixes some more tests
astivi Jul 3, 2024
781293e
Restores Camera Zoom completed test
astivi Jul 3, 2024
989b0ed
Fixes Sparky Bumper Tests
astivi Jul 3, 2024
d69dbf6
Fixes some of the animatronic tests
astivi Jul 3, 2024
00b3546
Fixes Draining Behavior tests
astivi Jul 3, 2024
f8c313b
Adds spelling exceptions for MacOS and Flutterfire
astivi Jul 3, 2024
a73a96b
Some more fixes to Flapper tests
astivi Jul 3, 2024
19b0751
Remove CODEOWNERS file
astivi Jul 3, 2024
cf3b00c
Fixes Android Bumper tests
astivi Jul 3, 2024
a35e668
Fixes launch by touching rocket
astivi Jul 8, 2024
935c3e6
Adds some more awaits in tests
astivi Jul 8, 2024
c7e1701
Restores backbox size
astivi Jul 8, 2024
961ebd5
Restores backbox test
astivi Jul 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .firebaserc

This file was deleted.

3 changes: 0 additions & 3 deletions .github/CODEOWNERS

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/flutter_package.yml@v1
with:
flutter_channel: stable
flutter_version: 2.10.5
flutter_version: 3.22.2
coverage_excludes: "lib/gen/*.dart"
test_optimization: false

6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,14 @@ unlinked_spec.ds
# Coverage
coverage/

# Golden tests related
**/failures

# Submodules
!pubspec.lock
packages/**/pubspec.lock

# Web related
lib/generated_plugin_registrant.dart

# Symbolication related
app.*.symbols
Expand All @@ -128,6 +130,8 @@ app.*.map.json

# Firebase related
.firebase
firebase.json
lib/firebase_options.dart

test/.test_runner.dart
web/__/firebase/init.js
4 changes: 3 additions & 1 deletion .vscode/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@
"dpad",
"endtemplate",
"firestore",
"flutterfire",
"gapless",
"genhtml",
"goldens",
"lcov",
"leaderboard",
"loadables",
"localizable",
"macos",
"mixins",
"mocktail",
"mostrado",
Expand All @@ -47,4 +49,4 @@
"ignorePaths": [
".github/workflows/**"
]
}
}
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@ _Created using [Very Good CLI][very_good_cli_link] 🤖_

## Getting Started 🚀

### Firebase
First, please create a Firebase project for development.
After you create your project, remember to activate the following features:
- **Authentication** with the **anonymous** option
- **Firestore** with the rules in firestore.rules.

Next, use the instructions on [Firebase website](https://firebase.google.com/docs/flutter/setup?platform=web) to set up the **flutterfire_cli**.

Allow it to override the **lib/firebase_options.dart** file with your project settings.

### Running locally
To run the desired project either use the launch configuration in VSCode/Android Studio or use the following commands:

```sh
Expand Down
4 changes: 4 additions & 0 deletions devtools_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
description: This file stores settings for Dart & Flutter DevTools.
documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states
extensions:
- flame: true
33 changes: 0 additions & 33 deletions firebase.json

This file was deleted.

1 change: 1 addition & 0 deletions lib/assets_manager/cubit/assets_manager_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class AssetsManagerCubit extends Cubit<AssetsManagerState> {
/// do its job without adding too much delay for the user, we are letting
/// the UI paint first, and then we start loading the assets.
await Future<void>.delayed(const Duration(seconds: 1));
if (isClosed) return;
final loadables = <Future<void> Function()>[
_game.preFetchLeaderboard,
..._game.preLoadAssets(),
Expand Down
4 changes: 2 additions & 2 deletions lib/assets_manager/views/assets_loading_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class AssetsLoadingPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
final l10n = context.l10n;
final headline1 = Theme.of(context).textTheme.headline1;
final displayLarge = Theme.of(context).textTheme.displayLarge;
return Container(
decoration: const CrtBackground(),
child: Center(
Expand All @@ -30,7 +30,7 @@ class AssetsLoadingPage extends StatelessWidget {
const SizedBox(height: 40),
AnimatedEllipsisText(
l10n.loading,
style: headline1,
style: displayLarge,
),
const SizedBox(height: 40),
FractionallySizedBox(
Expand Down
31 changes: 0 additions & 31 deletions lib/bootstrap.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import 'dart:async';
import 'dart:developer';

import 'package:bloc/bloc.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/widgets.dart';

class AppBlocObserver extends BlocObserver {
@override
Expand All @@ -19,30 +15,3 @@ class AppBlocObserver extends BlocObserver {
super.onError(bloc, error, stackTrace);
}
}

typedef BootstrapBuilder = Future<Widget> Function(
FirebaseFirestore firestore,
FirebaseAuth firebaseAuth,
);

Future<void> bootstrap(BootstrapBuilder builder) async {
WidgetsFlutterBinding.ensureInitialized();
FlutterError.onError = (details) {
log(details.exceptionAsString(), stackTrace: details.stack);
};

await runZonedGuarded(
() async {
await BlocOverrides.runZoned(
() async => runApp(
await builder(
FirebaseFirestore.instance,
FirebaseAuth.instance,
),
),
blocObserver: AppBlocObserver(),
);
},
(error, stackTrace) => log(error.toString(), stackTrace: stackTrace),
);
}
63 changes: 63 additions & 0 deletions lib/firebase_options.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// File generated by FlutterFire CLI.
// ignore_for_file: type=lint
import 'package:firebase_core/firebase_core.dart' show FirebaseOptions;
import 'package:flutter/foundation.dart'
show defaultTargetPlatform, kIsWeb, TargetPlatform;

/// Default [FirebaseOptions] for use with your Firebase apps.
///
/// Example:
/// ```dart
/// import 'firebase_options.dart';
/// // ...
/// await Firebase.initializeApp(
/// options: DefaultFirebaseOptions.currentPlatform,
/// );
/// ```
class DefaultFirebaseOptions {
static FirebaseOptions get currentPlatform {
if (kIsWeb) {
return web;
}
switch (defaultTargetPlatform) {
case TargetPlatform.android:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for android - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
case TargetPlatform.iOS:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for ios - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
case TargetPlatform.macOS:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for macos - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
case TargetPlatform.windows:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for windows - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
case TargetPlatform.linux:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for linux - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
default:
throw UnsupportedError(
'DefaultFirebaseOptions are not supported for this platform.',
);
}
}

static const FirebaseOptions web = FirebaseOptions(
apiKey: '',
appId: '',
messagingSenderId: '',
projectId: '',
authDomain: '',
storageBucket: '',
);
}
5 changes: 2 additions & 3 deletions lib/game/behaviors/animatronic_looping_behavior.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:flame/components.dart';
import 'package:pinball_flame/pinball_flame.dart';

class AnimatronicLoopingBehavior extends TimerComponent
with ParentIsA<SpriteAnimationComponent> {
Expand All @@ -10,8 +9,8 @@ class AnimatronicLoopingBehavior extends TimerComponent
@override
Future<void> onLoad() async {
await super.onLoad();
parent.animation?.onComplete = () {
parent.animation?.reset();
parent.animationTicker?.onComplete = () {
parent.animationTicker?.reset();
parent.playing = false;
timer
..reset()
Expand Down
11 changes: 4 additions & 7 deletions lib/game/behaviors/camera_focusing_behavior.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import 'package:flame/components.dart';
import 'package:flame/game.dart';
import 'package:flame_bloc/flame_bloc.dart';
import 'package:pinball/game/game.dart';
import 'package:pinball_components/pinball_components.dart';

/// {@template focus_data}
/// Defines a [Camera] focus point.
/// Defines a [CameraComponent] focus point.
/// {@endtemplate}
class _FocusData {
/// {@macro focus_data}
Expand Down Expand Up @@ -69,16 +68,14 @@ class CameraFocusingBehavior extends Component
@override
Future<void> onLoad() async {
await super.onLoad();
onGameResize(gameRef.camera.viewport.size);
_snap(GameStatus.waiting);
}

void _snap(GameStatus focusKey) {
final focusData = _foci[_activeFocus = focusKey]!;

gameRef.camera
..speed = 100
..followVector2(focusData.position)
..zoom = focusData.zoom;
gameRef.camera.moveTo(focusData.position, speed: 100);
gameRef.camera.viewfinder.zoom = focusData.zoom;
}

void _zoomTo(GameStatus focusKey) {
Expand Down
6 changes: 5 additions & 1 deletion lib/game/components/backbox/backbox.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ class Backbox extends PositionComponent with ZIndex, HasGameRef {
_build(_bloc.state);

_subscription = _bloc.stream.listen((state) {
_display.children.removeWhere((_) => true);
final removals = _display.children.map((child) {
_display.remove(child);
return child.removed;
});
Future.wait(removals);
_build(state);
});
}
Expand Down
2 changes: 1 addition & 1 deletion lib/game/components/backbox/bloc/backbox_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ part of 'backbox_bloc.dart';

/// {@template backbox_state}
/// The base state for all [BackboxState].
/// {@endtemplate backbox_state}
/// {@endtemplate}
abstract class BackboxState extends Equatable {
/// {@macro backbox_state}
const BackboxState();
Expand Down
16 changes: 9 additions & 7 deletions lib/game/components/backbox/displays/game_over_info_display.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'dart:async';

import 'package:flame/components.dart';
import 'package:flame/input.dart';
import 'package:flame/events.dart';
import 'package:flutter/material.dart';
import 'package:pinball/game/game.dart';
import 'package:pinball/l10n/l10n.dart';
Expand Down Expand Up @@ -164,7 +164,7 @@ class _LinksComponent extends PositionComponent with HasGameRef {
/// {@template share_link_component}
/// Link button to navigate to sharing score display.
/// {@endtemplate}
class ShareLinkComponent extends TextComponent with HasGameRef, Tappable {
class ShareLinkComponent extends TextComponent with HasGameRef, TapCallbacks {
/// {@macro share_link_component}
ShareLinkComponent({
OnShareTap? onTap,
Expand All @@ -178,7 +178,7 @@ class ShareLinkComponent extends TextComponent with HasGameRef, Tappable {
final OnShareTap? _onTap;

@override
bool onTapDown(TapDownInfo info) {
bool onTapDown(TapDownEvent event) {
_onTap?.call();
return true;
}
Expand All @@ -202,7 +202,8 @@ class ShareLinkComponent extends TextComponent with HasGameRef, Tappable {
/// {@template google_io_link_component}
/// Link button to navigate to Google I/O site.
/// {@endtemplate}
class GoogleIOLinkComponent extends TextComponent with HasGameRef, Tappable {
class GoogleIOLinkComponent extends TextComponent
with HasGameRef, TapCallbacks {
/// {@macro google_io_link_component}
GoogleIOLinkComponent()
: super(
Expand All @@ -212,7 +213,7 @@ class GoogleIOLinkComponent extends TextComponent with HasGameRef, Tappable {
);

@override
bool onTapUp(TapUpInfo info) {
bool onTapUp(TapUpEvent event) {
openLink(ShareRepository.googleIOEvent);
return true;
}
Expand Down Expand Up @@ -280,7 +281,8 @@ class _FirebaseTextComponent extends TextComponent with HasGameRef {
/// Link text to navigate to Open Source site.
/// {@endtemplate}
@visibleForTesting
class OpenSourceTextComponent extends TextComponent with HasGameRef, Tappable {
class OpenSourceTextComponent extends TextComponent
with HasGameRef, TapCallbacks {
/// {@macro open_source_link_component}
OpenSourceTextComponent()
: super(
Expand All @@ -290,7 +292,7 @@ class OpenSourceTextComponent extends TextComponent with HasGameRef, Tappable {
);

@override
bool onTapUp(TapUpInfo info) {
bool onTapUp(TapUpEvent event) {
openLink(ShareRepository.openSourceCode);
return true;
}
Expand Down
Loading
Loading