html_widgets
a flutter widget approach for using html tags & css styles in your upcoming apps.
text widgets
*text property is required for all the text widgets.
h1
...
h1(
text: "this is an h1 widget",
...
)
...
h2
...
h2(
text: "this is an h1 widget",
color:colors.red,
...
)
...
h3
...
h3(
text: "this is an h3 widget",
margin:20,
...
)
...
h4
...
h4(
text: "this is an h4 widget",
...
)
...
h5
...
h5(
text: "this is an h5 widget",
...
)
...
h6
...
h6(
text: "this is an h6 widget",
...
)
...
p
...
p(
text: "this is an h6 widget",
...
)
...
there are several properties you can pass to customize the heading widgets
and paragraph widget
api reference
properties | work | default value | values |
---|---|---|---|
color | sets the color of the text | black | color |
bgcolor | sets the background color | null | color |
margin | gives margin around the text container | null | num |
padding | gives padding for the container holding the text | null | num |
fontsize | changes the font size of the heading and p widget | according to the widget | num |
fontweight | changes the font weight of the heading and p widget | according to the widget 700 for headings, 400 for p | 100, 200, 300, 400, 500, 600, 700, 800, 900 |
isloading | if you’re loading something and want to show the text after the process you can set it to true. it will show a shimmer effect until it sets to false | false | bool |
textalign | align your text with respect to the container holding it | ‘left’ | ‘center’, ‘left’, ‘right’, ‘start’, ‘end’, ‘justify’ |
onclick | a function needs to be executed on taping | null | function |
htmltable
if you want to use larger text with bold font weight, you can prefer to use htmltable()
...
htmltable(
columns: [
{'id': "name", 'label': 'name'},
{'id': "pos", 'label': 'position'},
{'id': "hours", 'label': 'hours'},
{'id': "salary", 'label': 'salary'},
],
rows: [
{
'name': "willamson",
'pos': "manager",
'hours': "10",
'salary': "100k"
},
{
'name': "willamson",
'pos': "manager",
'hours': "10",
'salary': "100k"
},
],
),
...
both the rows
and columns
property are required
api reference
properties | work | default value | values |
---|---|---|---|
column | the column of the table | null | array of map which shoud contains id and label |
rows | the rows of the table | null | array of map which contains all the columns id. |
htmlimage
if you want to use larger text with bold font weight, you can prefer to use htmlimage()
...
htmlimage(
src:"https://images.pexels.com/photos/3055008/pexels-photo-3055008.jpeg",
onclick: () {
print("image clicked !!");
},
size: "cover",
margin: 10,
),
...
with htmlimage
you can use both the network and assert images in the same widget.
*the src property is required
api reference
properties | work | default value | values |
---|---|---|---|
src | the source of the image | null | string |
width | width of the image | default image width | double |
height | height of the image | default image height | double |
margin | gives margin for the container holding the image | 0.0 | double |
size | changes the size of the image | ‘contain’ | ‘contain’, ‘cover’, ‘fill’, ‘fitheight’, ‘fitwidth’, ‘none’, ‘scaledown’ |
onclick | a function needs to be executed on taping | null | function |
Comments are closed.