-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #94 from Cognifide/feature/COG-82-Link-list
Feature/cog 82 link list
- Loading branch information
Showing
4 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
], | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters