chromotome 1.0.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 50

Chromotome Color Palette for Dart based on Kjetil Golid work. #

2020-04-19_15-26-04 (3)

1.0.2 #

  • Updated Readme with Image

1.0.1 #

  • Complete Flutter Example

1.0.0 #

  • Palette conversion

example/lib/main.dart

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

void main() {
  runApp(SafeArea(child: ChromotomeApp()));
}

class ChromotomeApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) => MaterialApp(
        debugShowCheckedModeBanner: false,
        title: 'Chromotome',
        theme: ThemeData(
          primarySwatch: Colors.blue,
          visualDensity: VisualDensity.adaptivePlatformDensity,
        ),
        home: Scaffold(body: ChromotomePage()),
      );
}

class ChromotomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) => PageView(
      children: Chromotomes.entries
          .map((style) => Column(
                children: <Widget>[
                  Container(
                    margin: EdgeInsets.symmetric(vertical: 30),
                    child: Text(style.key,
                        style: TextStyle(
                            fontWeight: FontWeight.bold, fontSize: 50)),
                  ),
                  Expanded(child: ChromotomeList(style: style.key)),
                ],
              ))
          .toList());

  const ChromotomePage();
}

class ChromotomeList extends StatelessWidget {
  final String style;

  ChromotomeList({Key key, this.style}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final chromes = chromotomes(style);

    return ListView.builder(
        itemCount: chromes.length,
        itemBuilder: (ctx, idx) {
          final palette = chromes.entries.toList()[idx].value;
          return PaletteDetails(palette: palette);
        });
  }
}

String capitalize(String s) {
  return "${s[0].toUpperCase()}${s.substring(1)}";
}

class PaletteDetails extends StatelessWidget {
  const PaletteDetails({
    Key key,
    @required this.palette,
  }) : super(key: key);

  final Palette palette;

  @override
  Widget build(BuildContext context) {
    final title = palette.name.split('_').map((e) => capitalize(e)).join(' ');

    return Container(
      margin: EdgeInsets.only(left: 8, right: 8, bottom: 24),
      decoration: BoxDecoration(
          color: palette.background,
          border: Border.all(width: 16, color: palette.stroke)),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: <Widget>[
          Padding(
            padding: const EdgeInsets.all(16),
            child: Text(
              title,
              style: TextStyle(
                  fontSize: 35,
                  fontWeight: FontWeight.bold,
                  color: palette.stroke),
            ),
          ),
          Container(
            height: 100,
            child: Row(
              children: palette.colors
                  .map((e) => Expanded(flex: 1, child: Container(color: e)))
                  .toList(),
            ),
          )
        ],
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  chromotome: ^1.0.2

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:chromotome/chromotome.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
50
Learn more about scoring.

We analyzed this package on Jul 3, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.13
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

because of import path [chromotome] that is in a package requiring null.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8
Dev dependencies
pedantic ^1.9.0