Provide LocalKey to every custom transition (#1869)

Fixes #1551.

Also, remove superfluous `debugPrint` calls and other `Logger` setup
since the latest `pkg:logging` does this stuff automatically and so the
setup lead to duplicate messages in console.

## Pre-launch Checklist

- [x] I read the [Flutter Style Guide] _recently_, and have followed its
advice.
- [x] I signed the [CLA].
- [x] I read the [Contributors Guide].
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] All existing and new tests are passing.

<!-- Links -->
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[CLA]: https://cla.developers.google.com/
[Discord]: https://github.com/flutter/flutter/wiki/Chat
[Contributors Guide]:
https://github.com/flutter/samples/blob/main/CONTRIBUTING.md
pull/1879/head
Filip Hracek 2 years ago committed by GitHub
parent 0071c662c3
commit dd4fc132a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -8,7 +8,6 @@
// import 'firebase_options.dart';
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:go_router/go_router.dart';
@ -64,16 +63,6 @@ Future<void> main() async {
/// Without logging and crash reporting, this would be `void main()`.
void guardedMain() {
if (kReleaseMode) {
// Don't log anything below warnings in production.
Logger.root.level = Level.WARNING;
}
Logger.root.onRecord.listen((record) {
debugPrint('${record.level.name}: ${record.time}: '
'${record.loggerName}: '
'${record.message}');
});
WidgetsFlutterBinding.ensureInitialized();
_log.info('Going full screen');
@ -134,8 +123,10 @@ class MyApp extends StatelessWidget {
GoRoute(
path: 'play',
pageBuilder: (context, state) => buildMyTransition<void>(
key: ValueKey('play'),
child: const LevelSelectionScreen(
key: Key('level selection')),
key: Key('level selection'),
),
color: context.watch<Palette>().backgroundLevelSelection,
),
routes: [
@ -147,6 +138,7 @@ class MyApp extends StatelessWidget {
final level = gameLevels
.singleWhere((e) => e.number == levelNumber);
return buildMyTransition<void>(
key: ValueKey('level'),
child: PlaySessionScreen(
level,
key: const Key('play session'),
@ -172,6 +164,7 @@ class MyApp extends StatelessWidget {
final score = map['score'] as Score;
return buildMyTransition<void>(
key: ValueKey('won'),
child: WinGameScreen(
score: score,
key: const Key('win game'),

Loading…
Cancel
Save