Skip to content

Instantly share code, notes, and snippets.

@harsh-2024
Created January 18, 2022 16:01
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 harsh-2024/8b38b3d56b895c99528356e7daef6dac to your computer and use it in GitHub Desktop.
Save harsh-2024/8b38b3d56b895c99528356e7daef6dac to your computer and use it in GitHub Desktop.
RoundedButton(Colors.cyan,
() => Navigator.pushNamed(context, LoginScreen.id), 'Login'),
RoundedButton(
Colors.blueAccent,
() => Navigator.pushNamed(context, RegistrationScreen.id),
'Register')
],
),
),
);
}
}
class RoundedButton extends StatelessWidget {
RoundedButton(this.colour, @required this.onPressed, this.text);
final Color colour;
final String text;
final Function onPressed;
@override
Widget build(BuildContext context) {
return Padding(
padding: EdgeInsets.symmetric(vertical: 16.0),
child: Material(
elevation: 5.0,
color: colour,
borderRadius: BorderRadius.circular(30.0),
child: MaterialButton(
onPressed: () {
//Go to login screen.
// Navigator.pushNamed(context, LoginScreen.id);
onPressed();
},
minWidth: 200.0,
height: 42.0,
child: Text(text)),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment