You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
72 lines
1.7 KiB
72 lines
1.7 KiB
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
import 'package:smartfit_app_mobile/modele/user.dart';
|
|
|
|
class Info extends StatelessWidget {
|
|
const Info({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
String distance = Provider.of<User>(context, listen: false)
|
|
.managerSelectedActivity
|
|
.getTotalDistance()
|
|
.toString();
|
|
|
|
return Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
children: [
|
|
Stats(value: distance, unit: 'm', label: 'Distance'),
|
|
],
|
|
);
|
|
}
|
|
}
|
|
|
|
class Stats extends StatelessWidget {
|
|
String value;
|
|
String unit;
|
|
String label;
|
|
|
|
Stats({
|
|
Key? key,
|
|
required this.value,
|
|
required this.unit,
|
|
required this.label,
|
|
}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Text.rich(
|
|
TextSpan(
|
|
text: value,
|
|
style: const TextStyle(
|
|
fontSize: 20,
|
|
fontWeight: FontWeight.w900,
|
|
),
|
|
children: [
|
|
const TextSpan(text: ' '),
|
|
TextSpan(
|
|
text: unit,
|
|
style: TextStyle(
|
|
fontSize: 10,
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
),
|
|
]),
|
|
),
|
|
const SizedBox(height: 6),
|
|
Text(
|
|
label,
|
|
style: const TextStyle(
|
|
fontSize: 10,
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|