83 lines
1.9 KiB
Dart
83 lines
1.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:tdesign_flutter/tdesign_flutter.dart';
|
|
|
|
Widget buildCardTitle({
|
|
required BuildContext context,
|
|
required String title,
|
|
required IconData icon,
|
|
}) {
|
|
return Row(
|
|
children: [
|
|
buildCircleIcon(context: context, icon: icon),
|
|
SizedBox(width: 6),
|
|
Text(
|
|
title,
|
|
style: TextStyle(
|
|
fontSize: 18,
|
|
fontWeight: FontWeight.bold,
|
|
color: Theme.of(context).colorScheme.primary,
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
|
|
Widget buildCircleIcon({
|
|
required BuildContext context,
|
|
required IconData icon,
|
|
}) {
|
|
return Container(
|
|
width: 40,
|
|
height: 40,
|
|
decoration: BoxDecoration(
|
|
color: Theme.of(context).colorScheme.primary.withAlpha(50),
|
|
borderRadius: BorderRadius.circular(20),
|
|
),
|
|
child: Icon(icon, color: Theme.of(context).colorScheme.primary, size: 18),
|
|
);
|
|
}
|
|
|
|
BoxDecoration buildBoxDecoration(BuildContext context) {
|
|
return BoxDecoration(
|
|
borderRadius: BorderRadius.circular(8),
|
|
border: Border.all(
|
|
color: Theme.of(context).colorScheme.primary,
|
|
width: 1.5,
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget buildProgressItem({
|
|
required String title,
|
|
required String current,
|
|
required String target,
|
|
required String unit,
|
|
required double progress,
|
|
required Color color,
|
|
}) {
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Text(title),
|
|
Text(
|
|
'$current/$target $unit',
|
|
style: TextStyle(fontWeight: FontWeight.w500, color: color),
|
|
),
|
|
],
|
|
),
|
|
const SizedBox(height: 8),
|
|
TDProgress(
|
|
type: TDProgressType.linear,
|
|
progressStatus: TDProgressStatus.primary,
|
|
value: progress,
|
|
color: color,
|
|
strokeWidth: 20,
|
|
progressLabelPosition: TDProgressLabelPosition.inside,
|
|
)
|
|
],
|
|
);
|
|
}
|