diff --git a/lib/models/link_list_model.dart b/lib/models/link_list_model.dart new file mode 100644 index 0000000..3f7fc2c --- /dev/null +++ b/lib/models/link_list_model.dart @@ -0,0 +1,9 @@ +class LinkListModel { + String name; + String url; + + LinkListModel({ + this.name, + this.url + }); +} \ No newline at end of file diff --git a/lib/widgets/widgets/link_list/link_list_item.dart b/lib/widgets/widgets/link_list/link_list_item.dart new file mode 100644 index 0000000..12dc9c3 --- /dev/null +++ b/lib/widgets/widgets/link_list/link_list_item.dart @@ -0,0 +1,38 @@ +import 'package:flutter/material.dart'; + +class LinkListItem extends StatelessWidget { + final String name; + final String url; + + LinkListItem({ + @required this.name, + @required this.url, + }); + + void openUrl() { + } + + @override + Widget build(BuildContext context) { + return GestureDetector( + child: Container( + child: Row( + children: [ + Container( + child: Text( + "$name", + style: TextStyle( + fontSize: 20, + color: Colors.white, + ), + ), + margin: const EdgeInsets.fromLTRB(26.0, 10.0, 0, 15.0), + ), + ], + ), + margin: const EdgeInsets.fromLTRB(5.0, 10, 0, 0), + ), + onTap: openUrl, + ); + } +} diff --git a/lib/widgets/widgets/link_list/link_list_widget.dart b/lib/widgets/widgets/link_list/link_list_widget.dart new file mode 100644 index 0000000..816533a --- /dev/null +++ b/lib/widgets/widgets/link_list/link_list_widget.dart @@ -0,0 +1,37 @@ +import 'package:cogboardmobileapp/models/link_list_model.dart'; +import 'package:cogboardmobileapp/models/widget_model.dart'; +import 'package:cogboardmobileapp/widgets/widgets/details_container.dart'; +import 'package:cogboardmobileapp/widgets/widgets/details_header.dart'; +import 'package:cogboardmobileapp/widgets/widgets/link_list/link_list_item.dart'; +import 'package:flutter/material.dart'; + +class LinkListWidget extends StatelessWidget { + final DashboardWidget widget; + + LinkListWidget({ + @required this.widget, + }); + + List get getLinkListItems { + return widget.content["linkListItems"].map((item) => LinkListModel( + name: item["linkTitle"], + url: item["linkUrl"], + )).toList(); + } + + @override + Widget build(BuildContext context) { + return Container( + margin: const EdgeInsets.fromLTRB(0, 20.0, 0, 0), + child: DetailsContainer( + children: [ + ...getLinkListItems + .map((item) => LinkListItem( + name: item.name, + url: item.url,)) + .toList() + ], + ), + ); + } +} diff --git a/lib/widgets/widgets/widget_details.dart b/lib/widgets/widgets/widget_details.dart index d4c68a9..4045fa9 100644 --- a/lib/widgets/widgets/widget_details.dart +++ b/lib/widgets/widgets/widget_details.dart @@ -7,6 +7,7 @@ import 'package:cogboardmobileapp/widgets/widgets/bamboo_plan/bamboo_plan_widget import 'package:cogboardmobileapp/widgets/widgets/checkbox/checkbox_widget.dart'; import 'package:cogboardmobileapp/widgets/widgets/jenkins_job/jenkins_job_widget.dart'; import 'package:cogboardmobileapp/widgets/widgets/jira_buckets/jira_buckets_widget.dart'; +import 'package:cogboardmobileapp/widgets/widgets/link_list/link_list_widget.dart'; import 'package:cogboardmobileapp/widgets/widgets/sonar_qube/sonar_qube_widget.dart'; import 'package:cogboardmobileapp/widgets/widgets/world_clock/world_clock_widget.dart'; import 'package:cogboardmobileapp/widgets/widgets/zabbix/zabbix_widget.dart'; @@ -41,6 +42,8 @@ class WidgetDetails extends StatelessWidget { return JiraBucketWidget(widget: widget); case WidgetTypes.ZABBIX_WIDGET: return ZabbixWidget(widget: widget); + case WidgetTypes.LINK_LIST_WIDGET: + return LinkListWidget(widget: widget); default: return Container( child: null, @@ -57,6 +60,7 @@ class WidgetDetails extends StatelessWidget { case WidgetTypes.AEM_HEALTHCHECK_WIDGET: case WidgetTypes.AEM_BUNDLE_INFO_WIDGET: case WidgetTypes.JIRA_BUCKETS_WIDGET: + case WidgetTypes.LINK_LIST_WIDGET: return true; case WidgetTypes.CHECKBOX_WIDGET: case WidgetTypes.WORLD_CLOCK_WIDGET: