colours 0.0.1+1 copy "colours: ^0.0.1+1" to clipboard
colours: ^0.0.1+1 copied to clipboard

outdated

An extended version of Flutter Colors with more swatches and more flexibility to generate your own custom swatch.

example/lib/main.dart

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

MaterialColor gojekSwatch = Colours.swatch('00aa13');

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Colours Demo',
      theme: ThemeData(
        // This is the theme of your application.
        // Apply colors from gojekSwatch
        primarySwatch: gojekSwatch,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(title: 'Colours.swatch Demo'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text(
              'You have pushed the button this many times:',
              style: TextStyle(
                color: gojekSwatch[700], // use color from gojekSwatch
              ),
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headline4,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        backgroundColor: gojekSwatch[900], // use color from gojekSwatch
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: Icon(Icons.add),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}
23
likes
40
pub points
77%
popularity

Publisher

unverified uploader

An extended version of Flutter Colors with more swatches and more flexibility to generate your own custom swatch.

Repository (GitHub)
View/report issues

License

BSD-2-Clause (license)

Dependencies

colour, flutter, pigment, tinycolor

More

Packages that depend on colours