mirror of
https://gitlab.com/comunic/comunicmobile
synced 2025-06-19 16:25:17 +00:00
Start to display user groups
This commit is contained in:
50
lib/ui/widgets/group_icon_widget.dart
Normal file
50
lib/ui/widgets/group_icon_widget.dart
Normal file
@ -0,0 +1,50 @@
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:comunic/models/group.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// Custom group icon
|
||||
///
|
||||
/// @author Pierre Hubert
|
||||
class GroupIcon extends StatelessWidget {
|
||||
final Group group;
|
||||
final double width;
|
||||
|
||||
const GroupIcon({
|
||||
Key key,
|
||||
@required this.group,
|
||||
this.width = 50,
|
||||
}) : assert(group != null),
|
||||
assert(width != null),
|
||||
super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Material(
|
||||
child: CachedNetworkImage(
|
||||
imageUrl: group.iconURL,
|
||||
width: width,
|
||||
height: width,
|
||||
placeholder: (c, s) => Container(
|
||||
color: Colors.grey,
|
||||
width: width,
|
||||
height: width,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 4.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
errorWidget: (c, s, o) => Container(
|
||||
color: Colors.red,
|
||||
width: width,
|
||||
height: width,
|
||||
child: Icon(
|
||||
Icons.error,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -15,6 +15,7 @@ enum BarCallbackActions {
|
||||
OPEN_NEWEST_POSTS,
|
||||
OPEN_FRIENDS,
|
||||
OPEN_MY_PAGE,
|
||||
OPEN_GROUPS,
|
||||
OPEN_APP_SETTINGS,
|
||||
NONE,
|
||||
ACTION_LOGOUT
|
||||
@ -81,6 +82,7 @@ final _menuItems = <_MenuItem>[
|
||||
final _menuActionsItem = <_ActionMenuItem>[
|
||||
_ActionMenuItem(
|
||||
label: tr("My Page"), action: BarCallbackActions.OPEN_MY_PAGE),
|
||||
_ActionMenuItem(label: tr("Groups"), action: BarCallbackActions.OPEN_GROUPS),
|
||||
_ActionMenuItem(
|
||||
label: tr("App settings"), action: BarCallbackActions.OPEN_APP_SETTINGS),
|
||||
_ActionMenuItem(
|
||||
|
Reference in New Issue
Block a user