Skip to content

Commit 2ab8368

Browse files
committed
comments added to gftoggle
1 parent 7e70518 commit 2ab8368

2 files changed

Lines changed: 122 additions & 1321 deletions

File tree

example/lib/main.dart

Lines changed: 31 additions & 294 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class MyApp extends StatelessWidget {
5454
),
5555

5656
// home: MyHomePage(title: 'UI_KIT_EXAMPLE'),
57-
home: Home(),
57+
home: MyHomePage(title: 'UI KIT',),
5858

5959
);
6060

@@ -64,199 +64,6 @@ class MyApp extends StatelessWidget {
6464

6565

6666

67-
class Home extends StatefulWidget {
68-
@override
69-
State<StatefulWidget> createState() => HomeState();
70-
}
71-
72-
class HomeState extends State<Home> with SingleTickerProviderStateMixin {
73-
AnimationController controller;
74-
Animation<Offset> offset;
75-
76-
bool isOn = false;
77-
78-
@override
79-
void initState() {
80-
super.initState();
81-
82-
controller =
83-
AnimationController(vsync: this, duration: Duration(milliseconds: 500));
84-
85-
offset = Tween<Offset>(begin: Offset.zero, end: Offset(1.0, 0.0))
86-
.animate(controller);
87-
// offset = Tween<Offset>(begin: Offset(1.0, 0.0), end: Offset.zero).animate(controller);
88-
}
89-
90-
@override
91-
Widget build(BuildContext context) {
92-
return Scaffold(
93-
body:
94-
95-
Column(
96-
children: <Widget>[
97-
// LabeledToggle(
98-
// thumbSize: 20,
99-
// ),
100-
101-
Container(
102-
// height: 100,
103-
// height: 200,
104-
width: 200,
105-
color: Colors.red,
106-
margin: EdgeInsets.only(bottom:40, top: 40),
107-
child: GFToast(
108-
bgColor: GFColor.primary,
109-
// button: GFButton(onPressed: null, type: GFType.outline,
110-
// text: 'Accept',),
111-
// text: 'Marked as Favorite.',
112-
113-
// child: Column(
114-
// children: <Widget>[
115-
// Text('hygu', style: TextStyle(color:Colors.black87),),
116-
// Text('hygu', style: TextStyle(color:Colors.black87),),
117-
//
118-
// Text('hygu', style: TextStyle(color:Colors.black87),),
119-
// Text('hygu', style: TextStyle(color:Colors.black87),),
120-
//
121-
// Text('hygu', style: TextStyle(color:Colors.black87),),
122-
// Text('hygu', style: TextStyle(color:Colors.black87),),
123-
//
124-
//
125-
// ],
126-
// )
127-
),
128-
),
129-
130-
GFToggle(onChanged: (val){
131-
print(val);
132-
}, value: null, type: GFToggleType.square
133-
),
134-
135-
GFToggle(onChanged: null, value: null, type: GFToggleType.android,
136-
),
137-
GFToggle(onChanged: null, value: null, type: GFToggleType.android,
138-
),
139-
GFToggle(onChanged: null, value: null, type: GFToggleType.custom,
140-
),
141-
GFToggle(onChanged: null, value: null, type: GFToggleType.custom,
142-
),
143-
GFToggle(onChanged: null, value: null, type: GFToggleType.ios,
144-
145-
),
146-
GFToggle(onChanged: null, value: null, type: GFToggleType.ios,
147-
148-
),
149-
150-
GFToast(
151-
bgColor: GFColor.transparent,
152-
// button: GFButton(onPressed: null, type: GFType.outline,
153-
// text: 'Accept',),
154-
// text: 'Marked as Favorite.',
155-
156-
child: Text('jh', style: TextStyle(color:Colors.black87),),
157-
),
158-
// Card(
159-
// child: Column(
160-
// children: <Widget>[
161-
// Text('fghj'),
162-
// Container(
163-
// height: 200,
164-
// width: 200,
165-
// color: Colors.red,
166-
// margin: EdgeInsets.only(bottom:40),
167-
// ),
168-
// GestureDetector(
169-
// onTap: (){
170-
// setState(() {
171-
// isOn = !isOn;
172-
// });
173-
// print(controller.status);
174-
// switch (controller.status) {
175-
// case AnimationStatus.dismissed:
176-
// controller.forward();
177-
// break;
178-
// case AnimationStatus.completed:
179-
// controller.reverse();
180-
// break;
181-
// default:
182-
// }
183-
//
184-
// },
185-
// child: Stack(
186-
// children: <Widget>[
187-
// Container(
188-
// height: 25,
189-
// width:40,
190-
//// color:Colors.blue
191-
// ),
192-
// Positioned(
193-
// top:5,
194-
// child: Container(
195-
// width: 36,
196-
// height: 15,
197-
// decoration: BoxDecoration(
198-
// color: isOn ? Colors.green: Colors.grey,
199-
// borderRadius: BorderRadius.all(Radius.circular(20))
200-
//
201-
// ),
202-
// child:
203-
// Padding(padding: EdgeInsets.only(left: 3, right: 3, top: 3.4), child:
204-
// isOn?
205-
//
206-
// Text('ON', style: TextStyle(color: Colors.white, fontSize: 8),):
207-
// Text('OFF', textAlign: TextAlign.end, style: TextStyle(color: Colors.white, fontSize: 8),))
208-
//
209-
// ),
210-
// ),
211-
// Positioned(
212-
// top: 3,
213-
// child: GestureDetector(
214-
// onTap: (){
215-
// setState(() {
216-
// isOn = !isOn;
217-
// });
218-
// switch (controller.status) {
219-
// case AnimationStatus.dismissed:
220-
// controller.forward();
221-
// break;
222-
// case AnimationStatus.completed:
223-
// controller.reverse();
224-
// break;
225-
// default:
226-
// }
227-
// },
228-
// child: SlideTransition(
229-
// position: offset,
230-
// child: Container(
231-
// height: 20,
232-
// width: 20,
233-
// decoration: BoxDecoration(
234-
// shape: BoxShape.circle,
235-
// color: Colors.white,
236-
// boxShadow: [
237-
// new BoxShadow(
238-
// color: Colors.black.withOpacity(0.16),
239-
// blurRadius: 6.0,
240-
// spreadRadius: 0.0),
241-
// ]
242-
// ),
243-
// ),
244-
// )
245-
// )
246-
// ),
247-
//
248-
// ],
249-
// ),
250-
// )
251-
// ],
252-
// ),
253-
// ),
254-
255-
],
256-
)
257-
);
258-
}
259-
}
26067

26168
class MyHomePage extends StatefulWidget {
26269

@@ -297,6 +104,36 @@ class _MyHomePageState extends State<MyHomePage> {
297104

298105
children: <Widget>[
299106

107+
GFToast(
108+
bgColor: GFColor.warning,
109+
button: GFButton(onPressed: null, type: GFType.outline,
110+
text: 'Accept',),
111+
text: 'Marked as Favorite.',
112+
113+
114+
),
115+
116+
GFToggle(onChanged: (val){
117+
print(val);
118+
}, value: null, type: GFToggleType.square,
119+
duration: Duration(milliseconds: 400),
120+
),
121+
122+
GFToggle(onChanged: null, value: null, type: GFToggleType.android,
123+
duration: Duration(milliseconds: 400),
124+
),
125+
GFToggle(onChanged: null, value: null, type: GFToggleType.android,
126+
duration: Duration(milliseconds: 400),
127+
),
128+
GFToggle(onChanged: null, value: null, type: GFToggleType.custom,
129+
duration: Duration(milliseconds: 400),
130+
),
131+
132+
GFToggle(onChanged: null, value: null, type: GFToggleType.ios,
133+
duration: Duration(milliseconds: 400),
134+
135+
),
136+
300137
Card(
301138

302139
child: Column(
@@ -413,106 +250,6 @@ class _MyHomePageState extends State<MyHomePage> {
413250
// borderRadius: BorderRadius.circular(20.0),
414251

415252
),
416-
Switch(
417-
onChanged: (v){},
418-
value: true,
419-
// activeColor: Colors.red,
420-
activeColor: Colors.white,
421-
activeTrackColor: Colors.green,
422-
inactiveTrackColor: Colors.grey,
423-
inactiveThumbColor: Colors.black,
424-
// activeThumbImage: NetworkImage("https://cdn.pixabay.com/photo/2016/11/10/17/00/forest-1814723_960_720.jpg",),
425-
426-
),
427-
428-
CupertinoSwitch(
429-
onChanged: (v){},
430-
value: true,
431-
432-
),
433-
434-
435-
// GFToggle(
436-
// type: GFToggleType.iosSwitch,
437-
// activeColor: Colors.red,
438-
// activeThumbColor: Colors.blue,
439-
//
440-
// onChanged: (val){
441-
// },
442-
// value: true,
443-
// minWidth: false,
444-
// ),
445-
446-
LabeledToggle(
447-
rounded: true,
448-
enabledText: 'OFF',
449-
disabledText: 'ON',
450-
),
451-
//
452-
// LabeledToggle(
453-
// transitionType: TextTransitionTypes.FADE,
454-
// rounded: true,
455-
//// borderSize: 2.0,
456-
//// duration: Duration(milliseconds: 500),
457-
// forceWidth: true,
458-
// value: switchValue,
459-
// onChanged: (v) {
460-
// setState(() {
461-
// switchValue = v;
462-
// });
463-
// },
464-
// offBkColor: Colors.grey,
465-
// onBkColor: Colors.lightGreen,
466-
// offText: "FALSE",
467-
// onText: "TRUE",
468-
// offThumbColor: Colors.black,
469-
// onThumbColor: Colors.white,
470-
// thumbSize: 60.0,
471-
// ),
472-
473-
474-
Stack(
475-
children: <Widget>[
476-
Container(
477-
height: 30,
478-
width:60,
479-
// color:Colors.blue
480-
),
481-
482-
Positioned(
483-
top:2,
484-
child: Container(
485-
width: 36,
486-
height: 15,
487-
decoration: BoxDecoration(
488-
color: Colors.red,
489-
borderRadius: BorderRadius.all(Radius.circular(20))
490-
491-
),
492-
493-
),
494-
),
495-
Positioned(
496-
// right:20,
497-
498-
child: Container(
499-
height: 20,
500-
width: 20,
501-
decoration: BoxDecoration(
502-
shape: BoxShape.circle,
503-
color: Colors.white,
504-
boxShadow: [
505-
new BoxShadow(
506-
color: Colors.black.withOpacity(0.16),
507-
blurRadius: 6.0,
508-
spreadRadius: 0.0),
509-
]
510-
),
511-
)),
512-
513-
514-
],
515-
),
516253

517254

518255
GFIconBadges(

0 commit comments

Comments
 (0)