Skip to content

Instantly share code, notes, and snippets.

@JaveedIshaq
Last active June 26, 2022 02:59
Show Gist options
  • Save JaveedIshaq/3e07013ad14aa92ba994cd9d1f542171 to your computer and use it in GitHub Desktop.
Save JaveedIshaq/3e07013ad14aa92ba994cd9d1f542171 to your computer and use it in GitHub Desktop.
How to Create Elevated Button with Icon and Text in Flutter
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