Skip to content

Commit 0b5f70d

Browse files
committed
Update read me and yaml desc
1 parent 0007197 commit 0b5f70d

3 files changed

Lines changed: 25 additions & 51 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![pub package](https://img.shields.io/pub/v/flutter_switch.svg)](https://pub.dev/packages/flutter_switch) [![pub points](https://badges.bar/flutter_switch/pub%20points)](https://pub.dev/packages/flutter_switch/score) [![popularity](https://badges.bar/flutter_switch/popularity)](https://pub.dev/packages/flutter_switch/score) [![likes](https://badges.bar/flutter_switch/likes)](https://pub.dev/packages/flutter_switch/score)
44

5-
An easy to implement custom switch created for Flutter. You can have a customized height and width, border radius, colors, toggle size and choice to display an 'On' and 'Off' text.
5+
An easy to implement custom switch created for Flutter. Give it a custom height and width, border for the switch and toggle, border radius, colors, toggle size, a choice to display an 'On' and 'Off' text and able to add an icon inside the toggle.
66

77
[![GitHub followers](https://img.shields.io/github/followers/boringdeveloper.svg?style=social&label=Follow)](https://github.com/boringdeveloper) <a href="https://www.linkedin.com/in/nichole-john-talban-romero/"><img src="https://image.flaticon.com/icons/svg/174/174857.svg" width="20"></a>
88

@@ -17,7 +17,7 @@ Add this to your package's `pubspec.yaml` file:
1717

1818
```yaml
1919
dependencies:
20-
flutter_switch: ^0.1.4
20+
flutter_switch: ^0.1.6-beta.1
2121
```
2222
2323
You can install packages from the command line with Flutter:

example/lib/main.dart

Lines changed: 22 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,12 @@ class MyHomePage extends StatefulWidget {
2222

2323
class _MyHomePageState extends State<MyHomePage> {
2424
bool status1 = false;
25-
bool status2 = false;
25+
bool status2 = true;
2626
bool status3 = false;
2727
bool status4 = false;
2828
bool status5 = false;
2929
bool status6 = false;
30-
bool status7 = true;
31-
bool status8 = false;
30+
bool status7 = false;
3231

3332
@override
3433
Widget build(BuildContext context) {
@@ -64,16 +63,29 @@ class _MyHomePageState extends State<MyHomePage> {
6463
],
6564
),
6665
SizedBox(height: 20.0),
67-
Text("Custom Colors"),
66+
Text("Custom Colors and Borders"),
6867
SizedBox(height: 10.0),
6968
Row(
7069
mainAxisAlignment: MainAxisAlignment.spaceBetween,
7170
children: <Widget>[
7271
FlutterSwitch(
73-
activeColor: Colors.red,
74-
inactiveColor: Colors.red[200],
75-
toggleColor: Colors.blueGrey[700],
72+
width: 100.0,
73+
height: 55.0,
74+
toggleSize: 45.0,
7675
value: status2,
76+
borderRadius: 30.0,
77+
padding: 2.0,
78+
toggleColor: Color.fromRGBO(225, 225, 225, 1),
79+
switchBorder: Border.all(
80+
color: Color.fromRGBO(2, 107, 206, 1),
81+
width: 6.0,
82+
),
83+
toggleBorder: Border.all(
84+
color: Color.fromRGBO(2, 107, 206, 1),
85+
width: 5.0,
86+
),
87+
activeColor: Color.fromRGBO(51, 226, 255, 1),
88+
inactiveColor: Colors.black38,
7789
onToggle: (val) {
7890
setState(() {
7991
status2 = val;
@@ -197,44 +209,6 @@ class _MyHomePageState extends State<MyHomePage> {
197209
],
198210
),
199211
SizedBox(height: 20.0),
200-
Text("Toon-like feel by using Borders"),
201-
SizedBox(height: 10.0),
202-
Row(
203-
mainAxisAlignment: MainAxisAlignment.spaceBetween,
204-
children: <Widget>[
205-
FlutterSwitch(
206-
width: 100.0,
207-
height: 55.0,
208-
toggleSize: 45.0,
209-
value: status7,
210-
borderRadius: 30.0,
211-
padding: 2.0,
212-
toggleColor: Color.fromRGBO(225, 225, 225, 1),
213-
switchBorder: Border.all(
214-
color: Color.fromRGBO(2, 107, 206, 1),
215-
width: 6.0,
216-
),
217-
toggleBorder: Border.all(
218-
color: Color.fromRGBO(2, 107, 206, 1),
219-
width: 5.0,
220-
),
221-
activeColor: Color.fromRGBO(51, 226, 255, 1),
222-
inactiveColor: Colors.black38,
223-
onToggle: (val) {
224-
setState(() {
225-
status7 = val;
226-
});
227-
},
228-
),
229-
Container(
230-
alignment: Alignment.centerRight,
231-
child: Text(
232-
"Value: $status7",
233-
),
234-
),
235-
],
236-
),
237-
SizedBox(height: 20.0),
238212
Text("Icon in toggle"),
239213
Text(
240214
"Inspired by the colors from Github Dark Mode switch",
@@ -252,7 +226,7 @@ class _MyHomePageState extends State<MyHomePage> {
252226
width: 100.0,
253227
height: 55.0,
254228
toggleSize: 45.0,
255-
value: status8,
229+
value: status7,
256230
borderRadius: 30.0,
257231
padding: 2.0,
258232
activeToggleColor: Color(0xFF6E40C9),
@@ -277,14 +251,14 @@ class _MyHomePageState extends State<MyHomePage> {
277251
),
278252
onToggle: (val) {
279253
setState(() {
280-
status8 = val;
254+
status7 = val;
281255
});
282256
},
283257
),
284258
Container(
285259
alignment: Alignment.centerRight,
286260
child: Text(
287-
"Value: $status8",
261+
"Value: $status7",
288262
),
289263
),
290264
],

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: flutter_switch
2-
description: An easy to implement custom switch that can have a customized height and width, border radius, colors, toggle size and choice to display an 'On' and 'Off' text.
2+
description: An easy to implement custom switch that can have a customized height and width, borders for the switch and toggle, border radius of the switch, colors, toggle size, a choice to display an 'On' and 'Off' text and able to add an icon inside the toggle.
33
version: 0.1.6-beta.1
44
homepage: https://github.com/boringdeveloper/FlutterSwitch
55

0 commit comments

Comments
 (0)