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

radio_group_v2 표지
패키지 상세v3.3.2

radio_group_v2

사용자가 앱 내에서 선택할 때 쾌적한 경험을 제공하기 위해 라디오 버튼을 그룹화하는 위젯입니다.

30일 다운로드
883
좋아요
32
Pub 점수
160

패키지 설치

flutter pub add radio_group_v2

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

radio_group_v2는 Flutter 위젯으로, 그룹화된 라디오 버튼을 쉽게 만들 수 있도록 하며, 상호 배타성과 일관된 사용자 경험을 보장합니다. 사용자가 집합에서 하나의 옵션만 선택할 수 있도록 하며, 커스터마이징, 상태 관리 및 부드러운 인터랙션을 내장 지원합니다. 단일 선택이 필요한 폼이나 설정에 적합하며, 직관적인 디자인과 플랫폼 간 일관된 동작을 통해 사용성을 향상시킵니다.

사용 사례

  • 단일 선택을 포함한 폼 입력
  • 사용자 선호 설정
  • 설문조사 또는 퀴즈 인터페이스
  • 온보딩 흐름
  • 동적 옵션 그룹

주요 기능

  • 서로 배타적인 선택
  • 사용자 정의 가능한 외관
  • 내장 상태 관리
  • 기존 위젯과의 간편한 통합
  • 반응형 디자인 지원

적합한 대상

  • 양식을 개발하는 개발자
  • 일관성을 추구하는 UI 디자이너
  • 단일 선택 입력이 필요한 앱
  • Flutter 초보자가 상태 처리를 배우고 있습니다
  • 경량 라디오 그룹 솔루션을 필요로 하는 프로젝트

고려 사항

  • 단일 선택만 가능
  • 내장된 검증 없음
  • 선택 콜백을 수동으로 처리해야 합니다
  • 다중 선택 시나리오에 적합하지 않습니다
  • 부모 위젯의 레이아웃 제약 조건에 의존

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

Radio Group

A widget that groups radio buttons so they can work together to give the user a pleasant experience when making selections within the app.

A gif demonstrating the radio group in action.

Installation

In the pubspec.yaml of your flutter project, add the following dependency:

dependencies:
  radio_group_v2: ^3.3.1

Import it to each file you use it in:

import 'package:radio_group_v2/radio_group_v2.dart';

Usage

Example 1

This example is a very basic, vertical radio group.

RadioGroupController myController = RadioGroupController();

RadioGroup(
  controller: myController,
  values: ["Choice1", "Choice2", "Choice3"],
)
Example 2

This example is a horizontal radio group with some decoration, and it starts with the first button selected.

RadioGroupController myController = RadioGroupController();

RadioGroup(
  controller: myController,
  values: ["Choice1", "Choice2", "Choice3"],
  indexOfDefault: 0,
  orientation: RadioGroupOrientation.Horizontal,
  decoration: RadioGroupDecoration(
    spacing: 10.0,
    labelStyle: TextStyle(
      color: Colors.blue,
    ),
    activeColor: Colors.amber,
  ),
)
Example 3

This example shows how to programmatically select an item using two different methods.

RadioGroupController myController = RadioGroupController();

List<String> items = ["Choice1", "Choice2", "Choice3"];

RadioGroup(
  controller: myController,
  values: items,
)

// Method 1 - Selects a specific item from the list.
myController.value = items[1]; // Selects Choice2

// Method 2 - Selects whatever item is at the given
//            index in the list.
myController.selectAt(2); // Selects Choice3
Example 4

This example shows how to programmatically select an item using two different silent methods. This means, when the new value in is selected in the list, the onChanged method will not be called.

RadioGroupController myController = RadioGroupController();

List<String> items = ["Choice1", "Choice2", "Choice3"];

RadioGroup(
  controller: myController,
  values: items,
)

// Method 1 - Selects a specific item from the list.
myController.setValueSilently(items[1]); // Selects Choice2

// Method 2 - Selects whatever item is at the given
//            index in the list.
myController.selectSilentlyAt(2); // Selects Choice3
Example 5

This example shows how to retrieve the selected value.

RadioGroupController myController = RadioGroupController();

RadioGroup(
  controller: myController,
  values: ["Choice1", "Choice2", "Choice3"],
)

String selected = myController.value.toString();

If you found this helpful, please consider donating. Thanks!

buy me a coffee      paypal      venmo



카테고리

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.