Last active
June 26, 2022 02:59
-
-
Save JaveedIshaq/3e07013ad14aa92ba994cd9d1f542171 to your computer and use it in GitHub Desktop.
How to Create Elevated Button with Icon and Text in Flutter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'Elevated Button', | |
home: FlutterExample(), | |
); | |
} | |
} | |
class FlutterExample extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar(title: const Text('Elevated Button with Icon and Text')), | |
body: Center( | |
child: ElevatedButton.icon( | |
icon: const Icon( | |
Icons.home, | |
color: Colors.amber, | |
size: 30.0, | |
), | |
label: const Text('Elevated Button'), | |
onPressed: () { | |
print('Button Pressed'); | |
}, | |
style: ElevatedButton.styleFrom( | |
shape: RoundedRectangleBorder( | |
borderRadius: BorderRadius.circular(20.0), | |
), | |
), | |
))); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment