import 'package:flutter/material.dart'; class CardCommonEr extends StatelessWidget { final image; final text; final subText; final bool locked; final Function onTap; const CardCommonEr({ this.locked = false, @required this.image, @required this.text, @required this.subText, @required this.onTap, }); @override Widget build(BuildContext context) { return GestureDetector( onTap: locked ? null : onTap, child: Opacity( opacity: locked ? 0.25 : 1.0, child: Stack( children: [ Container( width: double.infinity, padding: EdgeInsets.only(left: 20, right: 20, bottom: 15, top: 28), decoration: BoxDecoration( borderRadius: BorderRadius.circular(15), color: Colors.white, border: Border.all( color: Color(0xffefefef), width: 1, ), ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Image.asset(this.image, width: 42.0, height: 42.0), Text( text + "${subText.isEmpty ? "" : "\n$subText"}", style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 20 / 16), ), ], ), ), if (locked) Align(alignment: Alignment.center, child: lock()) ], ), ), ); } Widget lock() { return Container( child: Icon(Icons.lock_rounded, size: 80), ); } }