1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-22 21:09:21 +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 /// Get user display name
String get displayName => htmlDecodeCharacters(fullName); String get displayName => htmlDecodeCharacters(fullName);
bool get hasVirtualDirectory =>
virtualDirectory != null && virtualDirectory.length > 0;
Map<String, dynamic> toMap() { Map<String, dynamic> toMap() {
return { return {
UserTableContract.C_ID: id, UserTableContract.C_ID: id,

View File

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