@@ -10,6 +10,7 @@ import 'package:setonix/bloc/world/bloc.dart';
1010import 'package:setonix/pages/home/background.dart' ;
1111import 'package:setonix/services/file_system.dart' ;
1212import 'package:setonix_api/setonix_api.dart' ;
13+ import 'package:url_launcher/url_launcher_string.dart' ;
1314
1415class GameErrorView extends StatelessWidget {
1516 final MultiplayerDisconnectedState state;
@@ -26,15 +27,40 @@ class GameErrorView extends StatelessWidget {
2627 final theme = Theme .of (context);
2728 final error = state.error;
2829 var message = AppLocalizations .of (context).disconnectedMessage;
29- Widget ? content;
30+ List < Widget > ? content;
3031 if (error is FatalServerEventError ) {
3132 message = switch (error) {
3233 InvalidPacksError () => AppLocalizations .of (context).invalidPacks,
3334 };
3435 content = switch (error) {
35- InvalidPacksError () =>
36- _PacksGameErrorView (error: error, onReconnect: onReconnect),
36+ InvalidPacksError () => [
37+ _PacksGameErrorView (error: error, onReconnect: onReconnect)
38+ ],
3739 };
40+ } else if (error is KickMessage ) {
41+ final link = error.link;
42+ content = [
43+ Text (error.message),
44+ const SizedBox (height: 4 ),
45+ if (link != null )
46+ Row (
47+ children: [
48+ Expanded (
49+ child: TextFormField (
50+ initialValue: link,
51+ readOnly: true ,
52+ decoration: InputDecoration (
53+ labelText: AppLocalizations .of (context).link,
54+ suffixIcon: IconButton (
55+ icon: const Icon (PhosphorIconsLight .paperPlaneRight),
56+ onPressed: () => launchUrlString (link,
57+ mode: LaunchMode .externalApplication),
58+ ),
59+ ),
60+ ))
61+ ],
62+ )
63+ ];
3864 }
3965 return Scaffold (
4066 body: Stack (
@@ -63,7 +89,7 @@ class GameErrorView extends StatelessWidget {
6389 ),
6490 if (content != null ) ...[
6591 const SizedBox (height: 16 ),
66- content,
92+ ... content,
6793 ],
6894 const SizedBox (height: 16 ),
6995 Row (
0 commit comments