add edit button on owned accounts

This commit is contained in:
shilangyu 2020-09-30 23:53:20 +02:00
parent 701b6f8de3
commit ba3c1d59e1
1 changed files with 14 additions and 0 deletions

View File

@ -5,6 +5,7 @@ import 'package:intl/intl.dart';
import 'package:lemmy_api_client/lemmy_api_client.dart';
import 'package:timeago/timeago.dart' as timeago;
import '../hooks/stores.dart';
import '../util/extensions/api.dart';
import '../util/goto.dart';
import '../util/intl.dart';
@ -312,6 +313,11 @@ class _AboutTab extends HookWidget {
final theme = Theme.of(context);
final instanceUrl = userDetails.user.instanceUrl;
final accStore = useAccountsStore();
final isOwnedAccount = accStore.loggedInInstances.contains(instanceUrl) &&
accStore.tokens[instanceUrl].containsKey(userDetails.user.name);
const wallPadding = EdgeInsets.symmetric(horizontal: 15);
final divider = Padding(
@ -323,6 +329,14 @@ class _AboutTab extends HookWidget {
return ListView(
padding: EdgeInsets.symmetric(vertical: 20),
children: [
if (isOwnedAccount)
Center(
child: FlatButton.icon(
icon: Icon(Icons.edit),
label: Text('edit profile'),
onPressed: () {}, // TODO: go to account editing
),
),
if (userDetails.user.bio != null) ...[
Padding(
padding: wallPadding,