44 lines
957 B
Dart
44 lines
957 B
Dart
import 'dart:io';
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:localization/localization.dart';
|
|
import '../../global.dart' as global;
|
|
|
|
class AccountSettings extends StatelessWidget {
|
|
const AccountSettings({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Row(
|
|
children: const [LogoutButton()],
|
|
);
|
|
}
|
|
}
|
|
|
|
class LogoutButton extends StatelessWidget {
|
|
const LogoutButton({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
String url = global
|
|
.settings!.identities[global.settings!.activeIdentity]!.instanceUrl;
|
|
|
|
return Row(
|
|
children: [
|
|
Text(url),
|
|
TextButton.icon(
|
|
onPressed: () {
|
|
logout();
|
|
},
|
|
icon: const Icon(Icons.logout),
|
|
label: Text("logout".i18n()))
|
|
],
|
|
);
|
|
}
|
|
}
|
|
|
|
void logout() async {
|
|
//await global.settings!.saveAuthCode("");
|
|
exit(0);
|
|
}
|