From d522a440291c98f2289366e59be96ca9bbdf1682 Mon Sep 17 00:00:00 2001 From: mr Date: Tue, 19 Nov 2024 16:16:53 +0100 Subject: [PATCH] Shared improved with rules --- lib/models/shared.dart | 4 ++-- lib/pages/shared.dart | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/lib/models/shared.dart b/lib/models/shared.dart index ce4e11c..e657acc 100644 --- a/lib/models/shared.dart +++ b/lib/models/shared.dart @@ -55,7 +55,7 @@ class CollaborativeArea extends SerializerDeserializer { List workspaces = []; List workflows = []; List peers = []; - List rules = []; + List rules = []; CollaborativeAreaRule? rule; CollaborativeArea( @@ -85,7 +85,7 @@ class CollaborativeArea extends SerializerDeserializer { workspaces: json.containsKey("shared_workspaces") ? fromListJson(json["shared_workspaces"], Workspace()) : [], workflows: json.containsKey("shared_workflows") ? fromListJson(json["shared_workflows"], Workflow()) : [], peers: json.containsKey("shared_peers") ? fromListJson(json["shared_peers"], Peer()) : [], - rules: json.containsKey("shared_rules") ? fromListJson(json["shared_rules"], Rule()) : [], + rules: json.containsKey("rules") ? json["rules"] : [], ); } @override diff --git a/lib/pages/shared.dart b/lib/pages/shared.dart index 8a4d3a9..9be9297 100644 --- a/lib/pages/shared.dart +++ b/lib/pages/shared.dart @@ -425,6 +425,7 @@ class WorkspaceSharedPageWidgetState extends State { ], ) ), + Row( children: [ Text("COLLABORATIVE AREA PEERS", textAlign: TextAlign.start, style: TextStyle(color: darkColor, fontSize: 20, fontWeight: FontWeight.bold), overflow: TextOverflow.clip), @@ -466,6 +467,21 @@ class WorkspaceSharedPageWidgetState extends State { padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 50), child: Wrap( alignment: WrapAlignment.center, children: getCardItems(space.peers)), ), + space.rules.isNotEmpty ? Text("RULES", textAlign: TextAlign.start, + style: TextStyle(color: darkColor, fontSize: 20, fontWeight: FontWeight.bold), overflow: TextOverflow.clip) : Container(), + space.rules.isNotEmpty ? Container( + width: getMainWidth(context) - 50, + margin: EdgeInsets.symmetric(vertical: 20), + color: Colors.white, + padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 50), + child: Column( children: space.rules.map( (e) { + return Row( children: [ + Padding( padding: EdgeInsets.symmetric(horizontal: 20, vertical: 10), + child:Text("-", style: TextStyle(color: Colors.black, fontSize: 15, fontWeight: FontWeight.bold), overflow: TextOverflow.clip)), + Text(e ?? "", style: TextStyle(color: Colors.grey, fontSize: 15), overflow: TextOverflow.clip) + ]); + }).toList() ) + ) : Container(), Row( children: [ Text("WORKSPACES / RESOURCES", textAlign: TextAlign.start, style: TextStyle(color: darkColor, fontSize: 20, fontWeight: FontWeight.bold), overflow: TextOverflow.clip),