Skip to content

Instantly share code, notes, and snippets.

@viraj-lakshitha
Last active June 6, 2021 07:10
Show Gist options
  • Save viraj-lakshitha/37bf7595113f062f52747c8e0c7ac139 to your computer and use it in GitHub Desktop.
Save viraj-lakshitha/37bf7595113f062f52747c8e0c7ac139 to your computer and use it in GitHub Desktop.
How add rounded border and gradient color to the flutter button
import 'package:flutter/material.dart';
class WelcomeScreen extends StatefulWidget {
@override
_WelcomeScreenState createState() => _WelcomeScreenState();
}
class _WelcomeScreenState extends State<WelcomeScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
// ignore: deprecated_member_use
SizedBox(
width: 200,
// ignore: deprecated_member_use
child: RaisedButton(
padding: EdgeInsets.zero,
onPressed: () {print('Button Work !');},
shape: StadiumBorder(),
child: Container(
padding: EdgeInsets.symmetric(vertical: 10.0, horizontal: 53.0),
decoration: ShapeDecoration(
gradient: LinearGradient(colors: [Colors.lightBlue, Colors.deepPurpleAccent]),
shape: StadiumBorder()
),
child: Text(
'Get Started',
style: TextStyle(
fontSize: 18.0, fontWeight: FontWeight.w400
),
),
),
),
)
],
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment