commit
769139fa03
After Width: | Height: | Size: 6.6 KiB |
After Width: | Height: | Size: 4.2 KiB |
After Width: | Height: | Size: 7.7 KiB |
@ -0,0 +1,70 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:smartfit_app_mobile/common/colo_extension.dart';
|
||||
import 'package:smartfit_app_mobile/main.dart';
|
||||
|
||||
class ProfileSwitch extends StatefulWidget {
|
||||
final String title;
|
||||
final String description;
|
||||
final String iconFilename;
|
||||
|
||||
const ProfileSwitch(this.title, this.description, this.iconFilename,
|
||||
{super.key});
|
||||
|
||||
@override
|
||||
State<ProfileSwitch> createState() => _ProfileSwitchState();
|
||||
}
|
||||
|
||||
class _ProfileSwitchState extends State<ProfileSwitch> {
|
||||
bool switchValue = localDB.getSaveLocally();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 15),
|
||||
decoration: BoxDecoration(
|
||||
color: TColor.white,
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
boxShadow: const [BoxShadow(color: Colors.black12, blurRadius: 2)]),
|
||||
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
Text(
|
||||
widget.title,
|
||||
style: TextStyle(
|
||||
color: TColor.black,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
SizedBox(
|
||||
height: 30,
|
||||
child:
|
||||
Row(crossAxisAlignment: CrossAxisAlignment.center, children: [
|
||||
Image.asset("assets/img/${widget.iconFilename}",
|
||||
height: 28, width: 28, fit: BoxFit.contain),
|
||||
const SizedBox(
|
||||
width: 15,
|
||||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
widget.description,
|
||||
style: TextStyle(
|
||||
color: TColor.black,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
),
|
||||
Switch(
|
||||
value: switchValue,
|
||||
activeColor: Colors.orange,
|
||||
onChanged: (bool value) {
|
||||
setState(() {
|
||||
switchValue = value;
|
||||
localDB.setSaveLocally(switchValue);
|
||||
});
|
||||
}),
|
||||
]))
|
||||
]));
|
||||
}
|
||||
}
|
@ -0,0 +1,118 @@
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:smartfit_app_mobile/common/colo_extension.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:smartfit_app_mobile/modele/convertisseur.dart';
|
||||
|
||||
class WorkoutRowGeneric extends StatelessWidget {
|
||||
final Map wObj;
|
||||
final bool isSelected;
|
||||
final VoidCallback onDelete;
|
||||
final VoidCallback onClick;
|
||||
|
||||
const WorkoutRowGeneric({
|
||||
Key? key,
|
||||
required this.wObj,
|
||||
required this.onDelete,
|
||||
required this.onClick,
|
||||
required this.isSelected,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: onClick,
|
||||
child: Container(
|
||||
margin: const EdgeInsets.symmetric(vertical: 8, horizontal: 2),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: isSelected
|
||||
? const Color.fromARGB(255, 144, 252, 148)
|
||||
: Colors.transparent,
|
||||
width: 2.0,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Material(
|
||||
color: isSelected
|
||||
? const Color.fromARGB(255, 240, 255, 240)
|
||||
: Colors.transparent,
|
||||
child: InkWell(
|
||||
borderRadius:
|
||||
BorderRadius.circular(10), // Utiliser le même borderRadius
|
||||
splashColor: const Color.fromARGB(255, 42, 94, 44)
|
||||
.withOpacity(0.3), // Couleur du fond au survol
|
||||
onTap: onClick,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 15, horizontal: 15),
|
||||
child: Row(
|
||||
children: [
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
child: SvgPicture.asset(
|
||||
wObj["image"].toString(),
|
||||
width: 60,
|
||||
height: 60,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 15),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"Type : ${wObj["categorie"].toString()}",
|
||||
style: TextStyle(
|
||||
color: TColor.black,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
"Date : ${wObj["date"].toString()}",
|
||||
style: TextStyle(
|
||||
color: TColor.black,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
"Temps : ${Convertisseur.secondeIntoMinute(wObj["time"]).toStringAsFixed(2)} m",
|
||||
style: TextStyle(
|
||||
color: TColor.black,
|
||||
fontSize: 12,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: onClick,
|
||||
icon: Image.asset(
|
||||
"assets/img/next_icon.png",
|
||||
width: 30,
|
||||
height: 30,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: onDelete,
|
||||
icon: Image.asset(
|
||||
"assets/img/corbeille.png",
|
||||
width: 30,
|
||||
height: 30,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
class Convertisseur {
|
||||
// Mettre que des trucs static
|
||||
|
||||
static double secondeIntoMinute(double seconde) {
|
||||
return seconde / 60;
|
||||
}
|
||||
|
||||
static double msIntoKmh(double metreSeconde) {
|
||||
return metreSeconde * 3.6;
|
||||
}
|
||||
}
|
Loading…
Reference in new issue