getWidget method
Implementation
Widget getWidget({bool reverse = false, required double composWidth}) {
final String path = isMotrice ? "motrice.png" : "voiture.png";
Widget imageWidget = Image.asset("assets/images/$path");
imageWidget =
reverse
? Transform(
alignment: Alignment.center,
transform: Matrix4.rotationY(pi),
child: imageWidget,
)
: imageWidget;
return SizedBox(
width: composWidth,
child: Stack(
children: [
Container(
margin: const EdgeInsets.only(top: 20),
child: Column(
children: [
Container(color: color, child: imageWidget),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 5,
vertical: 5,
),
child: FittedBox(
child: Text(
identifient,
style: const TextStyle(fontWeight: FontWeight.bold),
),
),
),
],
),
),
if (listPersonAffc.isNotEmpty)
Positioned.fill(
child: Align(
alignment: Alignment.topCenter,
child: CircleAvatar(
maxRadius: 15,
backgroundColor: Colors.yellow,
child: Text(listPersonAffc.length.toString()),
),
),
),
],
),
);
}