Created
December 10, 2019 14:53
-
-
Save akshatapp/f37f6fcb6d874b79132d11e584a8c0e1 to your computer and use it in GitHub Desktop.
Flutter Color 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-color-developer-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 Colors Demo', | |
theme: ThemeData( | |
primarySwatch: Colors.blue, | |
), | |
home: MyHomePage(), | |
); | |
} | |
} | |
class MyHomePage extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: Text('Flutter Colors Demo Home Page'), | |
), | |
body: Center( | |
child: Container( | |
width: 300.0, | |
height: 300.0, | |
// To color your Container Widget - Choose any one method | |
//Method 1 : Colors Class - using color by COLOR NAME | |
color: Colors.orange, | |
//Method 2 : Colors Class - using color by COLOR NAME & COLOR SHADE | |
//color: Colors.orange[900], | |
//Method 3 : Colors Class - using color by COLOR NAME & COLOR SHADE | |
//color: Colors.orange.shade900 | |
//Method 4 : fromARGB Decimal | |
//color: Color.fromARGB(255, 255, 167, 38), | |
//Method 5 : fromARGB Hex | |
//color: Color.fromARGB(0xFF, 0xFF, 0xA7, 0x26), | |
//Method 6 : fromRGBO | |
//color: Color.fromRGBO(255, 167, 38, 1.0), | |
//Method 7 : Color Class | |
//color: Color(0xFFFFA726), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment