feat:更新图表模块

This commit is contained in:
2025-07-27 22:28:04 +08:00
parent a2ed0f3d98
commit 34780651a8
7 changed files with 305 additions and 115 deletions

View File

@@ -27,6 +27,25 @@ InputDecoration formInputDecoration({
);
}
Widget circleIconButton({
required IconData icon,
required VoidCallback onPressed,
required BuildContext context,
}) {
return ElevatedButton(
onPressed: onPressed,
style: ElevatedButton.styleFrom(
fixedSize: Size(32, 32),
shape: CircleBorder(),
elevation: 0,
backgroundColor: Theme.of(context).primaryColor,
padding: EdgeInsets.zero,
minimumSize: const Size(0, 0),
),
child: Icon(icon, color: Colors.white, size: 18),
);
}
/// 确认按钮样式
ButtonStyle primaryButtonStyle() {
return ButtonStyle(

View File

@@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
import 'package:tdesign_flutter/tdesign_flutter.dart';
import 'package:food_hub_app/widgets/common/index.dart';
class YearSelector extends StatefulWidget {
final int initialYear;
@@ -88,15 +88,11 @@ class _YearSelectorState extends State<YearSelector>
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
TDButton(
circleIconButton(
context: context,
icon: Icons.chevron_left,
size: TDButtonSize.small,
type: TDButtonType.fill,
shape: TDButtonShape.circle,
theme: TDButtonTheme.primary,
onTap: () => _previousYear(),
onPressed: () => _previousYear(),
),
SizedBox(width: 10),
// 年份显示
AnimatedBuilder(
animation: _scaleAnimation,
@@ -112,16 +108,12 @@ class _YearSelectorState extends State<YearSelector>
),
),
),
SizedBox(width: 10),
TDButton(
circleIconButton(
context: context,
icon: Icons.chevron_right,
size: TDButtonSize.small,
type: TDButtonType.fill,
shape: TDButtonShape.circle,
theme: TDButtonTheme.primary,
onTap: () => _nextYear(),
),
onPressed: () => _nextYear(),
)
],
);
}
}
}