Skip to content

Commit

Permalink
ui: group_page: add policy tile
Browse files Browse the repository at this point in the history
  • Loading branch information
jjanku committed May 12, 2024
1 parent cc99564 commit 180e1f0
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions lib/ui/group_page.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:material_symbols_icons/symbols.dart';
import 'package:meesign_core/meesign_model.dart';
Expand All @@ -21,6 +23,14 @@ class GroupPage extends StatelessWidget {
bool isUser(Member m) => m.device.kind == DeviceKind.user;
final nUsers = group.members.where(isUser).length;
final nBots = group.members.length - nUsers;
var policy = group.note;
if (policy != null) {
try {
policy = jsonDecode(policy).toString();
} on Exception {
// show raw policy
}
}

final children = [
ListTile(
Expand Down Expand Up @@ -90,6 +100,15 @@ class GroupPage extends StatelessWidget {
title: const Text('Protocol'),
subtitle: Text(group.protocol.name.toUpperCase()),
),
if (policy != null)
ListTile(
leading: const SizedBox.square(
dimension: kIconSize,
child: Icon(Symbols.policy),
),
title: const Text('Policy'),
subtitle: Text(policy),
),
];

return Scaffold(
Expand Down

0 comments on commit 180e1f0

Please sign in to comment.