How to add Icon to a Button in flutter?

This Article is posted by seven.srikanth at 1/10/2023 6:07:46 AM



Here is an example of how to add icon to a button in flutter.
Here is the output for this example.
Here is the code from main.dart file. 

import 'package:flutter/material.dart';
void main() {
  runApp(const MyApp());
}
class MyApp extends StatelessWidget {
  const MyApp({super.key});
  @ override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: ElevatedButton.icon(
              onPressed: () {},
              icon: const Icon(Icons.settings),
              label: const Text('Click here')),
        ),
      ),
    );
  }
}
Thanks,
Srikanth

Tags: ElevatedButton; Icon; with label;








0 Comments
Login to comment.
Recent Comments

Be the first to Comment. You can ask a Query or Share your toughts or Just say thanks.


© 2018 - Fluttercentral | Email to me - seven.srikanth@gmail.com