|
|
|
@ -1,11 +1,12 @@
|
|
|
|
|
part of '../neon.dart'; |
|
|
|
|
|
|
|
|
|
class AccountTile extends StatefulWidget { |
|
|
|
|
class AccountTile extends StatelessWidget { |
|
|
|
|
const AccountTile({ |
|
|
|
|
required this.account, |
|
|
|
|
this.color, |
|
|
|
|
this.trailing, |
|
|
|
|
this.onTap, |
|
|
|
|
this.textColor, |
|
|
|
|
this.dense = false, |
|
|
|
|
super.key, |
|
|
|
|
}); |
|
|
|
@ -14,39 +15,30 @@ class AccountTile extends StatefulWidget {
|
|
|
|
|
final Color? color; |
|
|
|
|
final Widget? trailing; |
|
|
|
|
final VoidCallback? onTap; |
|
|
|
|
final Color? textColor; |
|
|
|
|
final bool dense; |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
State<AccountTile> createState() => _AccountTileState(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
class _AccountTileState extends State<AccountTile> { |
|
|
|
|
late final UserDetailsBloc _userDetailsBloc; |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
void initState() { |
|
|
|
|
super.initState(); |
|
|
|
|
Widget build(final BuildContext context) { |
|
|
|
|
final userDetailsBloc = RxBlocProvider.of<AccountsBloc>(context).getUserDetailsBloc(account); |
|
|
|
|
|
|
|
|
|
_userDetailsBloc = RxBlocProvider.of<AccountsBloc>(context).getUserDetailsBloc(widget.account); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
Widget build(final BuildContext context) => ListTile( |
|
|
|
|
onTap: widget.onTap, |
|
|
|
|
dense: widget.dense, |
|
|
|
|
contentPadding: widget.dense ? EdgeInsets.zero : null, |
|
|
|
|
visualDensity: widget.dense |
|
|
|
|
return ListTile( |
|
|
|
|
textColor: textColor, |
|
|
|
|
onTap: onTap, |
|
|
|
|
dense: dense, |
|
|
|
|
contentPadding: dense ? EdgeInsets.zero : null, |
|
|
|
|
visualDensity: dense |
|
|
|
|
? const VisualDensity( |
|
|
|
|
horizontal: -4, |
|
|
|
|
vertical: -4, |
|
|
|
|
) |
|
|
|
|
: null, |
|
|
|
|
leading: AccountAvatar( |
|
|
|
|
account: widget.account, |
|
|
|
|
account: account, |
|
|
|
|
requestManager: Provider.of<RequestManager>(context), |
|
|
|
|
), |
|
|
|
|
title: StandardRxResultBuilder<UserDetailsBloc, ProvisioningApiUserDetails>( |
|
|
|
|
bloc: _userDetailsBloc, |
|
|
|
|
bloc: userDetailsBloc, |
|
|
|
|
state: (final bloc) => bloc.userDetails, |
|
|
|
|
builder: ( |
|
|
|
|
final context, |
|
|
|
@ -61,7 +53,7 @@ class _AccountTileState extends State<AccountTile> {
|
|
|
|
|
Text( |
|
|
|
|
userDetailsData.getDisplayName()!, |
|
|
|
|
style: Theme.of(context).textTheme.bodyLarge!.copyWith( |
|
|
|
|
color: widget.color, |
|
|
|
|
color: textColor, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
@ -74,7 +66,7 @@ class _AccountTileState extends State<AccountTile> {
|
|
|
|
|
width: 10, |
|
|
|
|
child: CircularProgressIndicator( |
|
|
|
|
strokeWidth: 1, |
|
|
|
|
color: widget.color, |
|
|
|
|
color: color, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
@ -85,17 +77,18 @@ class _AccountTileState extends State<AccountTile> {
|
|
|
|
|
Icon( |
|
|
|
|
Icons.error_outline, |
|
|
|
|
size: 20, |
|
|
|
|
color: widget.color, |
|
|
|
|
color: color, |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
subtitle: Text( |
|
|
|
|
widget.account.client.humanReadableID, |
|
|
|
|
account.client.humanReadableID, |
|
|
|
|
style: Theme.of(context).textTheme.bodySmall!.copyWith( |
|
|
|
|
color: widget.color, |
|
|
|
|
color: textColor, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|