Add button under account to show userid+tokens

This commit is contained in:
2025-11-09 20:27:59 +01:00
parent 521c1e94c0
commit b3083d37c3
9 changed files with 121 additions and 18 deletions

View File

@@ -10,6 +10,7 @@ import 'package:simplecloudnotifier/api/api_client.dart';
import 'package:simplecloudnotifier/components/error_display/error_display.dart';
import 'package:simplecloudnotifier/models/user.dart';
import 'package:simplecloudnotifier/pages/account/login.dart';
import 'package:simplecloudnotifier/pages/account/show_token_modal.dart';
import 'package:simplecloudnotifier/pages/channel_list/channel_list_extended.dart';
import 'package:simplecloudnotifier/pages/client_list/client_list.dart';
import 'package:simplecloudnotifier/pages/filtered_message_view/filtered_message_view.dart';
@@ -268,7 +269,20 @@ class _AccountRootPageState extends State<AccountRootPage> {
_buildHeader(context, user),
const SizedBox(height: 16),
Text(user.username ?? user.userID, overflow: TextOverflow.ellipsis, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20)),
const SizedBox(height: 16),
const SizedBox(height: 8),
if (acc.tokenSend != null || acc.tokenAdmin != null)
Row(
children: [
Expanded(
child: UI.button(
text: 'UserID & Token kopieren',
onPressed: () => _showTokenModal(context, acc),
icon: FontAwesomeIcons.copy,
),
),
],
),
const SizedBox(height: 8),
..._buildCards(context, user),
SizedBox(height: 16),
_buildFooter(context, user),
@@ -456,18 +470,20 @@ class _AccountRootPageState extends State<AccountRootPage> {
child: Row(
children: [
Expanded(
child: UI.button(
text: 'Logout',
onPressed: _logout,
color: Colors.orange,
)),
child: UI.button(
text: 'Logout',
onPressed: _logout,
color: Colors.orange,
),
),
const SizedBox(width: 8),
Expanded(
child: UI.button(
text: 'Delete Account',
onPressed: _deleteAccount,
color: Colors.red,
)),
child: UI.button(
text: 'Delete Account',
onPressed: _deleteAccount,
color: Colors.red,
),
),
],
),
);
@@ -717,4 +733,11 @@ class _AccountRootPageState extends State<AccountRootPage> {
return completer.future;
}
void _showTokenModal(BuildContext context, AppAuth acc) {
showDialog<void>(
context: context,
builder: (context) => ShowTokenModal(account: acc),
);
}
}