Last active
December 10, 2019 15:07
-
-
Save akshatapp/6341e41d7c3508cdb36513c60c3fc2ef to your computer and use it in GitHub Desktop.
Flutter Icon Developer Guide
This file contains 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
// To learn more visit - https://blog.akshatapp.com/2019/11/flutter-icon-guide.html | |
import 'package:flutter/material.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
debugShowCheckedModeBanner: false, | |
title: 'Flutter Icons Demo', | |
theme: ThemeData( | |
primarySwatch: Colors.blue, | |
), | |
home: MyHomePage(), | |
); | |
} | |
} | |
// Icon Widget - Demo | |
class MyHomePage extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: Text('Flutter Icons Demo Home Page'), | |
), | |
body: Center( | |
child: Icon( | |
Icons.info, | |
color: Colors.blue, | |
size: 300.0, | |
semanticLabel: 'Info Icon', | |
), | |
), | |
); | |
} | |
} | |
// ImageIcon - Demo | |
/* class MyHomePage extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: Text('Flutter Icons Demo Home Page'), | |
), | |
body: Center(child: ImageIconWidget()), | |
); | |
} | |
} | |
class ImageIconWidget extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return ImageIcon( | |
// Case 1 : | |
//AssetImage('assets/bluetruck.png'), | |
//size: 300.0, | |
//color: Colors.red, | |
// Case 2 : | |
//AssetImage('assets/bluetruck alpha.png'), | |
//size: 300.0, | |
//color: Colors.red, | |
AssetImage('assets/bluetruck alpha.png'), | |
size: 50, | |
color: Colors.green, // change icon color and size | |
); | |
} | |
} */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment