mirror of
https://github.com/vleeuwenmenno/supplements.git
synced 2025-09-11 18:29:12 +02:00
feat: adds RDA for intake of vitamins and certain elements based on
canada health values
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:supplements/widgets/info_chip.dart';
|
||||
|
||||
import '../models/supplement.dart';
|
||||
import '../providers/supplement_provider.dart';
|
||||
@@ -306,13 +307,13 @@ class _ArchivedSupplementCard extends StatelessWidget {
|
||||
// Dosage info
|
||||
Row(
|
||||
children: [
|
||||
_InfoChip(
|
||||
InfoChip(
|
||||
icon: Icons.schedule,
|
||||
label: '${supplement.frequencyPerDay}x daily',
|
||||
context: context,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
_InfoChip(
|
||||
InfoChip(
|
||||
icon: Icons.medication,
|
||||
label: '${supplement.numberOfUnits} ${supplement.unitType}',
|
||||
context: context,
|
||||
@@ -322,7 +323,7 @@ class _ArchivedSupplementCard extends StatelessWidget {
|
||||
|
||||
if (supplement.reminderTimes.isNotEmpty) ...[
|
||||
const SizedBox(height: 8),
|
||||
_InfoChip(
|
||||
InfoChip(
|
||||
icon: Icons.notifications_off,
|
||||
label: 'Was: ${supplement.reminderTimes.join(', ')}',
|
||||
context: context,
|
||||
@@ -336,51 +337,3 @@ class _ArchivedSupplementCard extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _InfoChip extends StatelessWidget {
|
||||
final IconData icon;
|
||||
final String label;
|
||||
final BuildContext context;
|
||||
final bool fullWidth;
|
||||
|
||||
const _InfoChip({
|
||||
required this.icon,
|
||||
required this.label,
|
||||
required this.context,
|
||||
this.fullWidth = false,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: fullWidth ? double.infinity : null,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 6),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.surfaceVariant.withOpacity(0.4),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: fullWidth ? MainAxisSize.max : MainAxisSize.min,
|
||||
children: [
|
||||
Icon(
|
||||
icon,
|
||||
size: 14,
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Flexible(
|
||||
child: Text(
|
||||
label,
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user