Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/cog 82 link list #94

Merged
merged 2 commits into from
Nov 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions lib/models/link_list_model.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class LinkListModel {
String name;
String url;

LinkListModel({
this.name,
this.url
});
}
38 changes: 38 additions & 0 deletions lib/widgets/widgets/link_list/link_list_item.dart
Original file line number Diff line number Diff line change
@@ -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,
);
}
}
37 changes: 37 additions & 0 deletions lib/widgets/widgets/link_list/link_list_widget.dart
Original file line number Diff line number Diff line change
@@ -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 <LinkListModel> get getLinkListItems {
return widget.content["linkListItems"].map<LinkListModel>((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()
],
),
);
}
}
4 changes: 4 additions & 0 deletions lib/widgets/widgets/widget_details.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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,
Expand All @@ -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:
Expand Down