Skip to content
HexColor extend Color class to take hex coded value
Ruby Kotlin Dart Swift Objective-C
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.idea
android
example
ios
lib
.gitignore
.metadata
CHANGELOG.md
LICENSE
README.md
flutter_hex_color.iml
logo.png
pubspec.lock
pubspec.yaml
screenshot1.png

README.md

flutter_hex_color

HexColor extend Color class to take hex coded value.

Screenshots

screenshot

How To Use

  1. add flutter_hex_color: <latest> as dependencies in pubspec.yaml
  2. run flutter pub get into app folder
  3. use like HexColor('000000');

Example

import 'package:flutter/material.dart';
import 'package:flutter_hex_color/flutter_hex_color.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  var color = HexColor('FFFFFF');
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Center(
            child: Text(
              'HexColor',
              style: TextStyle(color: color),
            ),
          ),
        ),
        body: Center(
          child: Column(
            children: <Widget>[
              RaisedButton(
                color: HexColor('000000'),
                onPressed: () {
                  color = HexColor('000000');
                  setState(() {});
                },
              ),
              RaisedButton(
                color: HexColor('FFFFFF'),
                onPressed: () {
                  color = HexColor('FFFFFF');
                  setState(() {});
                },
              ),
              RaisedButton(
                color: HexColor('ffae42'),
                onPressed: () {
                  color = HexColor('ffae42');
                  setState(() {});
                },
              ),
              RaisedButton(
                color: HexColor('00FF00'),
                onPressed: () {
                  color = HexColor('00FF00');
                  setState(() {});
                },
              ),
            ],
          ),
        ),
      ),
    );
  }
}

Complete Example

Author

Mohamed Sayed

  • Fork   Star   Watches
  • Plugin   Example

My Plugins

You can’t perform that action at this time.