패키지, 저장소 및 앱 카테고리 검색

GitHub 저장소Pyozer/flutter_material_color_picker

flutter_material_color_picker

마테리얼 색상 선택기, 사용자가 색상을 맞춤 설정할 수 있습니다. 두 단계로 선택: 먼저 메인 컬러, 그 다음 음영.

flutter_material_color_picker 프로젝트 이미지
스타
74
포크
38
최근 푸시(UTC)
2023. 5. 31.
프로젝트 상태
활성

원본 README

아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.

Flutter Material Color Picker pub package

Material Color picker is a Flutter widget, that can be customizable.

By default, it's Material Colors, but you can define your own colors.

You can also use CircleColor widget to display color in your app. Example, you can set the color picker in a dialog and display the selected color in a ListTile, for settings.

How to use it

These examples use a static color for 'selectedColor', but you can use a variable (state)

Add to your Flutter project

You just need to add flutter_material_color_picker as a dependency in your pubspec.yaml file.

flutter_material_color_picker: ^1.2.0
Import
import 'package:flutter_material_color_picker/flutter_material_color_picker.dart';
Basic
MaterialColorPicker(
    onColorChange: (Color color) {
        // Handle color changes
    },
    selectedColor: Colors.red
)
Listen main color changes
MaterialColorPicker(
    onColorChange: (Color color) {
        // Handle color changes
    },
    onMainColorChange: (ColorSwatch color) {
        // Handle main color changes
    },
    selectedColor: Colors.red
)
Disallow Shades
MaterialColorPicker(
    allowShades: false, // default true
    onMainColorChange: (ColorSwatch color) {
        // Handle main color changes
    },
    selectedColor: Colors.red
)

If allowShades is set to false then only main colors will be shown and allowed to be selected. onColorChange will not be called, use onMainColorChange instead.

Custom colors

In this example, custom colors are a list of Material Colors (class who extend of ColorSwatch). But you can create your own list of ColorSwatch.

MaterialColorPicker(
    onColorChange: (Color color) {
        // Handle color changes
    },
    selectedColor: Colors.red,
    colors: [
        Colors.red,
        Colors.deepOrange,
        Colors.yellow,
        Colors.lightGreen
    ],
)

Screenshot

Color selection

There is two step, first choose the main color, and when you press it, you have to choose a shade of the main color. By default it's all Material Colors, but you can define custom colors, a list of ColorSwatch.

Main color selection Shade color selection
Example of usages

You can insert the color picker into a Dialog

Example main color in a dialog Example shade color in a dialog
Display color

You can use CircleColor widget, to display the selected color into your settings for example.

Example of circlecolor widget in ListTile
Jean-Charles Moussé GitHub avatar
GitHub 작성자

Jean-Charles Moussé ↗

Mobile (Android, iOS, Flutter) and Web (React, JS, PHP) developer.

AffluencesSarthe, France공식 웹사이트 ↗
언어DartRubyHTMLSwiftKotlinObjective-C

분류

이 저장소가 배포한 패키지

사용 중인 의존성

의존성 목록 2 개

프로젝트에 맞는 저장소를 선택하려면?

사용 목적에 따라 검색하고 개발 활동을 비교한 뒤 원본 저장소에서 요구 사항을 확인하세요.

  1. 이름, 작성자 또는 설명으로 검색하고 기술 주제로 범위를 좁힙니다.
  2. 스타, 포크, 최근 푸시를 함께 비교하세요. 스타는 관심의 지표이며 품질을 보장하지 않습니다.
  3. 사용하기 전에 GitHub에서 README, 라이선스, Issues를 확인하세요.

출처 및 관리

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗