Replaced tenary operator with Visibility Widget
This commit is contained in:
@@ -25,60 +25,64 @@ class _GraphViewState extends State<GraphView> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
print('roundNumber: ${widget.gameSession.roundNumber}');
|
||||||
return CupertinoPageScaffold(
|
return CupertinoPageScaffold(
|
||||||
navigationBar: CupertinoNavigationBar(
|
navigationBar: CupertinoNavigationBar(
|
||||||
middle: Text(AppLocalizations.of(context).scoring_history),
|
middle: Text(AppLocalizations.of(context).scoring_history),
|
||||||
previousPageTitle: AppLocalizations.of(context).back,
|
previousPageTitle: AppLocalizations.of(context).back,
|
||||||
),
|
),
|
||||||
child: widget.gameSession.roundNumber > 1
|
child: Visibility(
|
||||||
? Padding(
|
visible: widget.gameSession.roundNumber > 1 ||
|
||||||
padding: const EdgeInsets.fromLTRB(0, 100, 0, 0),
|
widget.gameSession.isGameFinished,
|
||||||
child: SfCartesianChart(
|
replacement: Column(
|
||||||
enableAxisAnimation: true,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
legend: const Legend(
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
overflowMode: LegendItemOverflowMode.wrap,
|
children: [
|
||||||
isVisible: true,
|
const Center(
|
||||||
position: LegendPosition.bottom),
|
child: Icon(CupertinoIcons.chart_bar_alt_fill, size: 60),
|
||||||
primaryXAxis: const NumericAxis(
|
),
|
||||||
labelStyle: TextStyle(fontWeight: FontWeight.bold),
|
const SizedBox(height: 10),
|
||||||
interval: 1,
|
Padding(
|
||||||
decimalPlaces: 0,
|
padding: const EdgeInsets.symmetric(horizontal: 40),
|
||||||
),
|
child: Text(
|
||||||
primaryYAxis: NumericAxis(
|
AppLocalizations.of(context).empty_graph_text,
|
||||||
labelStyle: const TextStyle(fontWeight: FontWeight.bold),
|
textAlign: TextAlign.center,
|
||||||
labelAlignment: LabelAlignment.center,
|
style: const TextStyle(fontSize: 16),
|
||||||
labelPosition: ChartDataLabelPosition.inside,
|
|
||||||
interval: 1,
|
|
||||||
decimalPlaces: 0,
|
|
||||||
axisLabelFormatter: (AxisLabelRenderDetails details) {
|
|
||||||
if (details.value == 0) {
|
|
||||||
return ChartAxisLabel('', const TextStyle());
|
|
||||||
}
|
|
||||||
return ChartAxisLabel(
|
|
||||||
'${details.value.toInt()}', const TextStyle());
|
|
||||||
},
|
|
||||||
),
|
|
||||||
series: getCumulativeScores(),
|
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
: Column(
|
],
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
),
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
child: Padding(
|
||||||
children: [
|
padding: const EdgeInsets.fromLTRB(0, 100, 0, 0),
|
||||||
const Center(
|
child: SfCartesianChart(
|
||||||
child: Icon(CupertinoIcons.chart_bar_alt_fill, size: 60),
|
enableAxisAnimation: true,
|
||||||
),
|
legend: const Legend(
|
||||||
const SizedBox(height: 10),
|
overflowMode: LegendItemOverflowMode.wrap,
|
||||||
Padding(
|
isVisible: true,
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 40),
|
position: LegendPosition.bottom),
|
||||||
child: Text(
|
primaryXAxis: const NumericAxis(
|
||||||
AppLocalizations.of(context).empty_graph_text,
|
labelStyle: TextStyle(fontWeight: FontWeight.bold),
|
||||||
textAlign: TextAlign.center,
|
interval: 1,
|
||||||
style: const TextStyle(fontSize: 16),
|
decimalPlaces: 0,
|
||||||
),
|
),
|
||||||
),
|
primaryYAxis: NumericAxis(
|
||||||
],
|
labelStyle: const TextStyle(fontWeight: FontWeight.bold),
|
||||||
));
|
labelAlignment: LabelAlignment.center,
|
||||||
|
labelPosition: ChartDataLabelPosition.inside,
|
||||||
|
interval: 1,
|
||||||
|
decimalPlaces: 0,
|
||||||
|
axisLabelFormatter: (AxisLabelRenderDetails details) {
|
||||||
|
if (details.value == 0) {
|
||||||
|
return ChartAxisLabel('', const TextStyle());
|
||||||
|
}
|
||||||
|
return ChartAxisLabel(
|
||||||
|
'${details.value.toInt()}', const TextStyle());
|
||||||
|
},
|
||||||
|
),
|
||||||
|
series: getCumulativeScores(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a list of LineSeries representing the cumulative scores of each player.
|
/// Returns a list of LineSeries representing the cumulative scores of each player.
|
||||||
|
|||||||
Reference in New Issue
Block a user