Skip to content

my font size doesn't work #4

@veronica-pignotti

Description

@veronica-pignotti

Hi!
I've tried to create my item for word cloud, replacing flutter hashtags. Color works but the font size no.
In file flutter_scatter/example/lib/screens/word_cloud.dart, at the line 35, "body1" is deprecated, I've tried to use "bodyText1", "bodyText2" and others, but nothing changed. What can I do?
Thanks.
There is my code:

class WordsCloudItem extends StatelessWidget {
final String text;
Color color;
double size;
int rotated;
final int index;

WordsCloudItem(
this.text,
this.index
){
setSizeAndColor();
this.rotated = Random().nextInt(2);
}

@OverRide
Widget build(BuildContext context) =>
RotatedBox(
quarterTurns: rotated,
child: Text(
this.text,
style: TextStyle(
fontSize: size,
color: color
)
),
);

void setSizeAndColor(){
if(index>81){color = Colors.red; size = 30.0;}
else if(index>61){color = Colors.orange; size = 28.0; }
else if(index>41){color = Colors.green; size = 26.0;}
else if(index>21){color = Colors.blue; size = 24.0;}
else color = Colors.purple; size = 22.0;
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions