Skip to content

Instantly share code, notes, and snippets.

@ghulamostafa
Created January 10, 2019 14:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ghulamostafa/b72bea8ca3a03a6df8f2daaf5c970df8 to your computer and use it in GitHub Desktop.
Save ghulamostafa/b72bea8ca3a03a6df8f2daaf5c970df8 to your computer and use it in GitHub Desktop.
class HomeScreenGridButton extends StatelessWidget {
final String text;
final Function onTap;
final Color color;
final IconData icon;
final Color iconColor;
final bool disabled;
const HomeScreenGridButton(
{Key key,
@required this.text,
@required this.onTap,
this.icon,
this.iconColor,
this.color,
this.disabled})
: super(key: key);
@override
Widget build(BuildContext context) {
return Material(
child: Stack(
children: <Widget>[
Card(
child: InkWell(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Icon(
this.icon,
color: this.iconColor ?? mColors().aRed,
size: 30.0,
),
SizedBox(
height: 10.0,
),
Center(
child: Text(
this.text,
textAlign: TextAlign.center,
style: TextStyle(color: Colors.white, fontSize: 18.0),
)),
],
),
onTap: this.onTap,
),
color: this.color ?? Colors.white,
),
this.disabled == true
? Card(
child: Container(
child: Center(
child: Text(
'Login please.',
textAlign: TextAlign.center,
style: TextStyle(color: Colors.white, fontSize: 18.0),
),
),
),
color: Color.fromRGBO(0, 0, 0, 0.7),
)
: Container()
],
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment