feat:重构UI模块
This commit is contained in:
@@ -86,7 +86,7 @@ class _ImagePreviewPageState extends State<ImagePreviewPage> {
|
||||
}
|
||||
}
|
||||
|
||||
Widget networkImage(String url) {
|
||||
Widget buildNetworkImage(String url) {
|
||||
return ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
child: Image.network(
|
||||
|
||||
@@ -27,18 +27,29 @@ InputDecoration formInputDecoration({
|
||||
);
|
||||
}
|
||||
|
||||
Widget cardContainer(Widget content) {
|
||||
Widget buildCard({required BuildContext context, required Widget child}) {
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
return Card(
|
||||
elevation: 0,
|
||||
color: Colors.white,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: content,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: colors.surface,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(color: colors.outline.withAlpha(50), width: 1),
|
||||
),
|
||||
child: Padding(padding: EdgeInsets.all(8), child: child),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildEmptyData() {
|
||||
return Center(
|
||||
child: Text('暂无数据', style: TextStyle(fontSize: 16, color: Colors.grey)),
|
||||
);
|
||||
}
|
||||
|
||||
/// 圆形图标按钮
|
||||
Widget circleIconButton({
|
||||
required IconData icon,
|
||||
@@ -48,14 +59,14 @@ Widget circleIconButton({
|
||||
return ElevatedButton(
|
||||
onPressed: onPressed,
|
||||
style: ElevatedButton.styleFrom(
|
||||
fixedSize: Size(32, 32),
|
||||
fixedSize: Size(26, 26),
|
||||
shape: CircleBorder(),
|
||||
elevation: 0,
|
||||
backgroundColor: Theme.of(context).primaryColor,
|
||||
backgroundColor: Theme.of(context).colorScheme.primary,
|
||||
padding: EdgeInsets.zero,
|
||||
minimumSize: const Size(0, 0),
|
||||
),
|
||||
child: Icon(icon, color: Colors.white, size: 18),
|
||||
child: Icon(icon, color: Colors.white),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -93,6 +93,7 @@ class _YearSelectorState extends State<YearSelector>
|
||||
icon: Icons.chevron_left,
|
||||
onPressed: () => _previousYear(),
|
||||
),
|
||||
SizedBox(width: 5),
|
||||
// 年份显示
|
||||
AnimatedBuilder(
|
||||
animation: _scaleAnimation,
|
||||
@@ -102,12 +103,13 @@ class _YearSelectorState extends State<YearSelector>
|
||||
child: Text(
|
||||
'$_currentYear',
|
||||
style: TextStyle(
|
||||
fontSize: 24,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Theme.of(context).primaryColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 5),
|
||||
circleIconButton(
|
||||
context: context,
|
||||
icon: Icons.chevron_right,
|
||||
|
||||
Reference in New Issue
Block a user