fix(ui): Hide the delete button if we have only one account
This commit is contained in:
parent
8928d3a34c
commit
d7927d3ca9
@ -2,11 +2,10 @@ import 'dart:ui';
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:moxxyv2/i18n/strings.g.dart';
|
||||||
import 'package:moxxyv2/ui/bloc/account.dart';
|
import 'package:moxxyv2/ui/bloc/account.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/avatar.dart';
|
import 'package:moxxyv2/ui/widgets/avatar.dart';
|
||||||
|
|
||||||
import 'package:moxxyv2/i18n/strings.g.dart';
|
|
||||||
|
|
||||||
const double _accountListTileVerticalPadding = 8;
|
const double _accountListTileVerticalPadding = 8;
|
||||||
const double _accountListTilePictureHeight = 58;
|
const double _accountListTilePictureHeight = 58;
|
||||||
|
|
||||||
@ -15,6 +14,7 @@ class AccountListTile extends StatelessWidget {
|
|||||||
required this.displayName,
|
required this.displayName,
|
||||||
required this.jid,
|
required this.jid,
|
||||||
required this.active,
|
required this.active,
|
||||||
|
required this.showDelete,
|
||||||
super.key,
|
super.key,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -27,6 +27,9 @@ class AccountListTile extends StatelessWidget {
|
|||||||
/// Flag indicating whether the account is currently active.
|
/// Flag indicating whether the account is currently active.
|
||||||
final bool active;
|
final bool active;
|
||||||
|
|
||||||
|
/// Flag indicating whether to show the delete button or not.
|
||||||
|
final bool showDelete;
|
||||||
|
|
||||||
static double get height =>
|
static double get height =>
|
||||||
_accountListTileVerticalPadding * 2 + _accountListTilePictureHeight;
|
_accountListTileVerticalPadding * 2 + _accountListTilePictureHeight;
|
||||||
|
|
||||||
@ -88,6 +91,7 @@ class AccountListTile extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
if (showDelete)
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(left: 24),
|
padding: const EdgeInsets.only(left: 24),
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
@ -136,6 +140,7 @@ class AccountsBottomModal extends StatelessWidget {
|
|||||||
displayName: account.displayName,
|
displayName: account.displayName,
|
||||||
jid: account.jid,
|
jid: account.jid,
|
||||||
active: account.jid == cubit.state.account.jid,
|
active: account.jid == cubit.state.account.jid,
|
||||||
|
showDelete: accounts.length > 1,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.toList();
|
.toList();
|
||||||
|
Loading…
Reference in New Issue
Block a user