Skip to content

Commit b36eab5

Browse files
committed
better documentation
1 parent 1198819 commit b36eab5

3 files changed

Lines changed: 23 additions & 141 deletions

File tree

README.md

Lines changed: 21 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
A Custom Switch package created for Flutter.
44

5-
## Give the repo some :heart: and :star: to support the project
6-
75
[![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> <a href="https://www.facebook.com/nickrgamer04/"><img src="https://image.flaticon.com/icons/svg/174/174848.svg" width="20"></a>
86

97
## Demo
@@ -16,7 +14,8 @@ A Custom Switch package created for Flutter.
1614
In the `dependencies:` section of your `pubspec.yaml`, add the following line:
1715

1816
```yaml
19-
flutter_switch: <latest_version>
17+
dependencies:
18+
flutter_switch: ^0.0.3
2019
```
2120
2221
Import in your project:
@@ -33,161 +32,44 @@ class MyHomePage extends StatefulWidget {
3332
3433
class _MyHomePageState extends State<MyHomePage> {
3534
bool status = false;
36-
bool status2 = false;
37-
bool status3 = false;
38-
bool status4 = false;
39-
bool status5 = false;
4035
4136
@override
4237
Widget build(BuildContext context) {
4338
return Scaffold(
4439
appBar: AppBar(
4540
title: Text("FlutterSwitch Demo"),
4641
),
47-
body: Container(
48-
padding: EdgeInsets.all(10.0),
49-
child: Column(
50-
crossAxisAlignment: CrossAxisAlignment.start,
51-
children: <Widget>[
52-
Text("Default"),
53-
SizedBox(height: 10.0),
54-
Row(
55-
mainAxisAlignment: MainAxisAlignment.spaceBetween,
56-
children: <Widget>[
57-
FlutterSwitch(
58-
value: status1,
59-
onToggle: (val) {
60-
setState(() {
61-
status1 = val;
62-
});
63-
},
64-
),
65-
Container(
66-
alignment: Alignment.centerRight,
67-
child: Text(
68-
"Value: $status1",
69-
),
70-
),
71-
],
72-
),
73-
SizedBox(height: 20.0),
74-
Text("Custom Colors"),
75-
SizedBox(height: 10.0),
76-
Row(
77-
mainAxisAlignment: MainAxisAlignment.spaceBetween,
78-
children: <Widget>[
79-
FlutterSwitch(
80-
activeColor: Colors.red,
81-
inactiveColor: Colors.red[200],
82-
value: status2,
83-
onToggle: (val) {
84-
setState(() {
85-
status2 = val;
86-
});
87-
},
88-
),
89-
Container(
90-
alignment: Alignment.centerRight,
91-
child: Text(
92-
"Value: $status2",
93-
),
94-
),
95-
],
96-
),
97-
SizedBox(height: 20.0),
98-
Text("With 'On' and 'Off' text and custom text colors"),
99-
SizedBox(height: 10.0),
100-
Row(
101-
mainAxisAlignment: MainAxisAlignment.spaceBetween,
102-
children: <Widget>[
103-
FlutterSwitch(
104-
showOnOff: true,
105-
activeTextColor: Colors.black,
106-
inactiveTextColor: Colors.blue[50],
107-
value: status3,
108-
onToggle: (val) {
109-
setState(() {
110-
status3 = val;
111-
});
112-
},
113-
),
114-
Container(
115-
alignment: Alignment.centerRight,
116-
child: Text(
117-
"Value: $status3",
118-
),
119-
),
120-
],
121-
),
122-
SizedBox(height: 20.0),
123-
Text("Custom size"),
124-
SizedBox(height: 10.0),
125-
Row(
126-
mainAxisAlignment: MainAxisAlignment.spaceBetween,
127-
children: <Widget>[
128-
FlutterSwitch(
129-
width: 55.0,
130-
height: 25.0,
131-
valueFontSize: 12.0,
132-
toggleSize: 18.0,
133-
value: status4,
134-
onToggle: (val) {
135-
setState(() {
136-
status4 = val;
137-
});
138-
},
139-
),
140-
Container(
141-
alignment: Alignment.centerRight,
142-
child: Text(
143-
"Value: $status4",
144-
),
145-
),
146-
],
147-
),
148-
SizedBox(height: 20.0),
149-
Text("Custom border radius and padding"),
150-
SizedBox(height: 10.0),
151-
Row(
152-
mainAxisAlignment: MainAxisAlignment.spaceBetween,
153-
children: <Widget>[
154-
FlutterSwitch(
155-
width: 125.0,
156-
height: 55.0,
157-
valueFontSize: 25.0,
158-
toggleSize: 45.0,
159-
value: status5,
160-
borderRadius: 30.0,
161-
padding: 8.0,
162-
showOnOff: true,
163-
onToggle: (val) {
164-
setState(() {
165-
status5 = val;
166-
});
167-
},
168-
),
169-
Container(
170-
alignment: Alignment.centerRight,
171-
child: Text(
172-
"Value: $status5",
173-
),
174-
),
175-
],
176-
),
177-
],
42+
body: Center(
43+
child: Container(
44+
child: FlutterSwitch(
45+
width: 125.0,
46+
height: 55.0,
47+
valueFontSize: 25.0,
48+
toggleSize: 45.0,
49+
value: status5,
50+
borderRadius: 30.0,
51+
padding: 8.0,
52+
showOnOff: true,
53+
onToggle: (val) {
54+
setState(() {
55+
status5 = val;
56+
});
57+
},
58+
),
17859
),
17960
),
18061
);
18162
}
18263
}
18364
```
18465

185-
18666
## Want to Contribute?
18767

18868
Contributions to this project is very much welcome. Let's work together to maintain and improve the project
18969
Simply Fork the repository, Commit and Push your changes and create a new Pull Request.
19070

71+
If you have some suggestions, you can reach me at romero.nicholejohn@gmail.com
72+
19173
# License
19274

19375
BSD 3-Clause License

example/pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ packages:
7575
path: ".."
7676
relative: true
7777
source: path
78-
version: "0.0.2"
78+
version: "0.0.3"
7979
flutter_test:
8080
dependency: "direct dev"
8181
description: flutter

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: flutter_switch
22
description: A Custom Switch package created for Flutter.
3-
version: 0.0.2
3+
version: 0.0.3
44
homepage: https://github.com/boringdeveloper/FlutterSwitch
55

66
environment:

0 commit comments

Comments
 (0)