Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/phucgaoxam/XliveSwitch
Flutter Xlive Switch
https://github.com/phucgaoxam/XliveSwitch
dart flutter
Last synced: about 2 months ago
JSON representation
Flutter Xlive Switch
- Host: GitHub
- URL: https://github.com/phucgaoxam/XliveSwitch
- Owner: phucgaoxam
- License: other
- Created: 2018-12-14T03:10:00.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2021-05-02T11:25:56.000Z (over 3 years ago)
- Last Synced: 2024-06-24T01:40:41.625Z (3 months ago)
- Topics: dart, flutter
- Language: Dart
- Size: 3.42 MB
- Stars: 14
- Watchers: 1
- Forks: 5
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
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-XLIVThanks Oleg Forlov for this beautiful design.
![Design: ](switcher_xliv.gif)
![Demo: ](demo.gif)
## 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 {
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: [
XlivSwitch(
value: _value,
onChanged: _changeValue,
),
Text('Current value: $_value'),
],
),
),
),
);
}void _changeValue(bool value) {
setState(() {
_value = value;
});
}
}```