mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-30 00:36:28 +00:00
39 lines
909 B
Dart
39 lines
909 B
Dart
import 'package:comunic/enums/post_visibility_level.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
/// Post visibility level tile
|
|
///
|
|
/// @author Pierre HUBERT
|
|
|
|
class PostVisibilityLevelTile extends StatelessWidget {
|
|
final PostVisibilityLevel level;
|
|
final String title;
|
|
final void Function(PostVisibilityLevel) onSelect;
|
|
final bool visible;
|
|
|
|
const PostVisibilityLevelTile({
|
|
Key key,
|
|
@required this.level,
|
|
@required this.title,
|
|
@required this.onSelect,
|
|
this.visible = true,
|
|
}) : assert(level != null),
|
|
assert(title != null),
|
|
assert(onSelect != null),
|
|
assert(visible != null),
|
|
super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
|
|
if(!visible)
|
|
return Container();
|
|
|
|
return ListTile(
|
|
leading: Icon(PostVisibilityLevelsMapIcons[level]),
|
|
title: Text(title),
|
|
onTap: () => onSelect(level),
|
|
);
|
|
}
|
|
}
|