87 lines
2.0 KiB
Dart
87 lines
2.0 KiB
Dart
import 'package:fitnote/utils/record_utils.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:getwidget/getwidget.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),
|
|
GFProgressBar(
|
|
animation: true,
|
|
lineHeight: 20,
|
|
percentage: progress,
|
|
progressBarColor: color,
|
|
child: Text(
|
|
'${roundNum(progress * 100)}%',
|
|
textAlign: TextAlign.end,
|
|
style: TextStyle(color: Colors.white),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|