Skip to content

Instantly share code, notes, and snippets.

@MarcinusX
Created September 3, 2018 04:33
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 MarcinusX/62c23a426bc7d1a3ad1d733a08738c0b to your computer and use it in GitHub Desktop.
Save MarcinusX/62c23a426bc7d1a3ad1d733a08738c0b to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
class RoundedButton extends StatelessWidget {
final String text;
final bool selected;
final GestureTapCallback onTap;
const RoundedButton({Key key, this.text, this.selected = false, this.onTap})
: super(key: key);
@override
Widget build(BuildContext context) {
Color backgroundColor = selected ? Colors.white : Colors.transparent;
Color textColor = selected ? Colors.red : Colors.white;
return Expanded(
child: Padding(
padding: const EdgeInsets.all(4.0),
child: new InkWell(
onTap: onTap,
child: new Container(
height: 36.0,
decoration: new BoxDecoration(
color: backgroundColor,
border: new Border.all(color: Colors.white, width: 1.0),
borderRadius: new BorderRadius.circular(30.0),
),
child: new Center(
child: new Text(
text,
style: new TextStyle(color: textColor),
),
),
),
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment