Skip to content

Instantly share code, notes, and snippets.

@NearHuscarl
Forked from jcollins-g/index.html
Last active March 7, 2021 07:58
Show Gist options
  • Save NearHuscarl/6e8c4dff9ebaabf2980ae05fee8ae109 to your computer and use it in GitHub Desktop.
Save NearHuscarl/6e8c4dff9ebaabf2980ae05fee8ae109 to your computer and use it in GitHub Desktop.
58517331/how-to-add-a-button-with-icon-in-flutter-app
// https://gist.github.com/NearHuscarl/6e8c4dff9ebaabf2980ae05fee8ae109
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
final String title;
MyHomePage({Key? key, required this.title}) : super(key: key);
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
ElevatedButton.icon(
icon: Icon(Icons.arrow_forward, size: 16),
label: Text('Icon Button'),
onPressed: () => {},
),
SizedBox(height: 10),
ElevatedButton.icon(
icon: Text('Icon Button'),
label: Icon(Icons.arrow_forward, size: 16),
onPressed: () => {},
),
SizedBox(height: 10),
TextButton.icon(
icon: Icon(Icons.arrow_forward, size: 16),
label: Text('Icon Button'),
onPressed: () => {},
),
SizedBox(height: 10),
TextButton.icon(
icon: Text('Icon Button'),
label: Icon(Icons.arrow_forward, size: 16),
onPressed: () => {},
),
],
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment