feat:重构UI模块
This commit is contained in:
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:food_hub_app/apis/stats.dart';
|
||||
import 'package:food_hub_app/models/stats.dart';
|
||||
import 'package:food_hub_app/widgets/common/chart.dart';
|
||||
import 'package:food_hub_app/widgets/common/index.dart';
|
||||
import 'package:food_hub_app/widgets/stats/card.dart';
|
||||
|
||||
class StatsPage extends StatefulWidget {
|
||||
@@ -45,7 +46,10 @@ class _StatsPage extends State<StatsPage> {
|
||||
rankStats = result4;
|
||||
|
||||
if (recordStats.isNotEmpty) {
|
||||
double sumValue = recordStats.fold(0.0, (sum, item) => sum + item.value);
|
||||
double sumValue = recordStats.fold(
|
||||
0.0,
|
||||
(sum, item) => sum + item.value,
|
||||
);
|
||||
averageRecordCount = sumValue / recordStats.length;
|
||||
}
|
||||
});
|
||||
@@ -54,55 +58,22 @@ class _StatsPage extends State<StatsPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(5),
|
||||
child: Column(
|
||||
children: [
|
||||
_buildSummaryStats(),
|
||||
SizedBox(
|
||||
height: chartHeight,
|
||||
child: Card(
|
||||
color: Colors.white,
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: _buildRecordStats(),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: chartHeight,
|
||||
child: Card(
|
||||
color: Colors.white,
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: _buildCategoryStats(),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: chartHeight,
|
||||
child: Card(
|
||||
color: Colors.white,
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: _buildRankStats(),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
_buildSummaryStats(),
|
||||
SizedBox(
|
||||
height: chartHeight,
|
||||
child: buildCard(context: context, child: _buildRecordStats()),
|
||||
),
|
||||
SizedBox(
|
||||
height: chartHeight,
|
||||
child: buildCard(context: context, child: _buildCategoryStats()),
|
||||
),
|
||||
SizedBox(
|
||||
height: chartHeight,
|
||||
child: buildCard(context: context, child: _buildRankStats()),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user