ec0c10f312
ApiClient.buildDio takes on401; the library's dioProvider wires it to the auth controller's clearSession. The router redirect already handles navigation away from authed screens once the session goes null. HomeScreen surfaces the banner on connection_refused with Retry + Change URL.
32 lines
887 B
Dart
32 lines
887 B
Dart
import 'package:flutter/material.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
|
|
import '../../theme/theme_extension.dart';
|
|
|
|
class ConnectionErrorBanner extends StatelessWidget {
|
|
const ConnectionErrorBanner({required this.onRetry, super.key});
|
|
final VoidCallback onRetry;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final fs = Theme.of(context).extension<FabledSwordTheme>()!;
|
|
return Container(
|
|
color: fs.iron,
|
|
padding: const EdgeInsets.all(12),
|
|
child: Row(children: [
|
|
Expanded(
|
|
child: Text(
|
|
"Couldn't reach the server.",
|
|
style: TextStyle(color: fs.parchment),
|
|
),
|
|
),
|
|
TextButton(onPressed: onRetry, child: const Text('Retry')),
|
|
TextButton(
|
|
onPressed: () => context.go('/server-url'),
|
|
child: const Text('Change URL'),
|
|
),
|
|
]),
|
|
);
|
|
}
|
|
}
|