Is it possible to have in flutter grid a cell with link to open the browser ? or a button to open a link
@override
DataGridRowAdapter buildRow(DataGridRow row) {
return DataGridRowAdapter(
cells: row.getCells().map<Widget>((e) {
return e.columnName == "link"
? Container(
alignment: Alignment.center,
padding: EdgeInsets.all(8.0),
child: GestureDetector(
onTap: () => _launchURL(e.value),
child: Text(
'Link',
overflow: TextOverflow.ellipsis,
style: TextStyle(
decoration: TextDecoration.underline, color: Colors.blue),
),
))
: Container(
alignment: Alignment.center,
padding: EdgeInsets.all(8.0),
child: Text(
e.value.toString(),
overflow: TextOverflow.ellipsis,
));
}).toList());
}
_launchURL(String hyperlink) async {
if (await canLaunch(hyperlink)) {
await launch(hyperlink);
} else {
throw 'Could not launch $hyperlink';
}
} |
Hi Renugadevi,
That I wanted. Thanks Steven asked something else relevant.
Can the hyperlink column render an icon?
Stefan