Skip to content

Commit 9c01afe

Browse files
flut-5993-[bug][flutter]: axislabelformatter changed
1 parent cad2ad9 commit 9c01afe

File tree

1 file changed

+14
-20
lines changed

1 file changed

+14
-20
lines changed

lib/main.dart

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -42,26 +42,20 @@ class _MyHomePageState extends State<MyHomePage> {
4242
axisLabelFormatter: (AxisLabelRenderDetails args) {
4343
late String text;
4444
late TextStyle textStyle;
45-
if (args.axis.name == 'primaryXAxis') {
46-
text = '${args.text}st\nMonth';
47-
if (args.text == 'Jan')
48-
textStyle = args.textStyle
49-
.copyWith(fontFamily: 'DancingScript');
50-
if (args.text == 'Feb')
51-
textStyle =
52-
args.textStyle.copyWith(color: Colors.green);
53-
if (args.text == 'Mar')
54-
textStyle = args.textStyle.copyWith(fontSize: 15);
55-
if (args.text == 'Apr')
56-
textStyle = args.textStyle
57-
.copyWith(fontStyle: FontStyle.italic);
58-
if (args.text == 'May')
59-
textStyle = args.textStyle
60-
.copyWith(fontWeight: FontWeight.bold);
61-
} else {
62-
text = args.text;
63-
textStyle = args.textStyle;
64-
}
45+
text = '${args.text}st\nMonth';
46+
if (args.text == 'Jan')
47+
textStyle =
48+
args.textStyle.copyWith(fontFamily: 'DancingScript');
49+
if (args.text == 'Feb')
50+
textStyle = args.textStyle.copyWith(color: Colors.green);
51+
if (args.text == 'Mar')
52+
textStyle = args.textStyle.copyWith(fontSize: 15);
53+
if (args.text == 'Apr')
54+
textStyle =
55+
args.textStyle.copyWith(fontStyle: FontStyle.italic);
56+
if (args.text == 'May')
57+
textStyle =
58+
args.textStyle.copyWith(fontWeight: FontWeight.bold);
6559
return ChartAxisLabel(text, textStyle);
6660
},
6761
),

0 commit comments

Comments
 (0)