FLUTTER ECOSYSTEM

phucgaoxam/XliveSwitch

Flutter Xlive Switch

XliveSwitch 프로젝트 이미지
Stars
14
Forks
4
최근 푸시(UTC)
2021. 5. 2.
프로젝트 상태
활성
Châu Minh Phúc GitHub avatar
GITHUB User

Châu Minh Phúc ↗

I'm an Android and Flutter developer, currently working for Manabie Vietnam.

ManabieHo Chi Minh City, Vietnam
언어DartRubySwiftKotlinObjective-C

기술 주제

이 저장소가 배포한 패키지

사용 중인 의존성

의존성 목록 1 개
  • flutter{"sdk":"flutter"}

원본 README

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

README 펼치기 / 접기

xlive_switch

A Xlive Switcher plugin for Flutter

Getting Started

This plugin is based on Oleg Frolov's animation design which I found on Dribbble: https://dribbble.com/shots/5429846-Switcher-XLIV

Thanks Oleg Forlov for this beautiful design.

Design:

Demo:

Usage

To use plugin, just import package import 'package:xlive_switch/xlive_switch.dart';

You can change the color of the switch follow by these attributes:

  • activeColor: background color when value is true
  • unActiveColor: background color when value is false
  • thumbColor: your thumb color

Example

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

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

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

class _MyAppState extends State<MyApp> {
  bool _value = true;

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              XlivSwitch(
                value: _value,
                onChanged: _changeValue,
              ),
              Text('Current value: $_value'),
            ],
          ),
        ),
      ),
    );
  }

  void _changeValue(bool value) {
    setState(() {
      _value = value;
    });
  }
}