1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-26 06:49:22 +00:00

Display virtual directory

This commit is contained in:
Pierre HUBERT 2020-05-16 14:01:59 +02:00
parent 9b0c1323b6
commit e7181c1f59
2 changed files with 26 additions and 5 deletions

View File

@ -41,6 +41,9 @@ class User extends CacheModel {
/// Get user display name
String get displayName => htmlDecodeCharacters(fullName);
bool get hasVirtualDirectory =>
virtualDirectory != null && virtualDirectory.length > 0;
Map<String, dynamic> toMap() {
return {
UserTableContract.C_ID: id,

View File

@ -65,28 +65,46 @@ class _UserPageTabletState extends State<UserPageTablet> {
showPostsTarget: false,
);
/// Main user information card
Widget _buildMainCard() => ConstrainedBox(
constraints: BoxConstraints(minWidth: 200),
constraints: BoxConstraints(maxWidth: 200),
child: Card(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: <Widget>[
Center(child: AccountImageWidget(user: _userInfo, width: 75)),
SizedBox(height: 10),
_MainCardSpacer(),
Text(
_userInfo.displayName,
textAlign: TextAlign.center,
style: TextStyle(fontSize: 20),
),
SizedBox(height: 10),
SizedBox(height: 10),
_MainCardSpacer(),
Container(
child: _userInfo.hasVirtualDirectory
? Text("@${_userInfo.virtualDirectory}")
: null),
_MainCardSpacer(visible: _userInfo.hasVirtualDirectory),
LikeWidget(likeElement: _userInfo),
SizedBox(height: 10),
],
),
),
),
);
/// Build user information card
Widget _buildAboutCard() => Container();
}
class _MainCardSpacer extends StatelessWidget {
final bool visible;
const _MainCardSpacer({this.visible = true, Key key})
: assert(visible != null),
super(key: key);
@override
Widget build(BuildContext context) =>
visible ? SizedBox(height: 10) : Container();
}