Skip to content

Commit 051e500

Browse files
committed
GFCheckbox , GFCheckboxListTile, GFListTile changes done
1 parent d4ebd32 commit 051e500

File tree

6 files changed

+136
-140
lines changed

6 files changed

+136
-140
lines changed

example/lib/main_temp.dart

Lines changed: 39 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ void main() => runApp(MyApp());
1919
class MyApp extends StatelessWidget {
2020
@override
2121
Widget build(BuildContext context) => MaterialApp(
22-
title: 'GetWidget Example',
23-
theme: ThemeData(
24-
primarySwatch: Colors.blue,
25-
),
26-
debugShowCheckedModeBanner: false,
27-
home: const MyHomePage(title: 'GetWidget Example'),
28-
);
22+
title: 'GetWidget Example',
23+
theme: ThemeData(
24+
primarySwatch: Colors.blue,
25+
),
26+
debugShowCheckedModeBanner: false,
27+
home: const MyHomePage(title: 'GetWidget Example'),
28+
);
2929
}
3030

3131
class MyHomePage extends StatefulWidget {
@@ -74,8 +74,7 @@ class _MyHomePageState extends State<MyHomePage>
7474
];
7575

7676
@override
77-
Widget build(BuildContext context) =>
78-
Scaffold(
77+
Widget build(BuildContext context) => Scaffold(
7978
appBar: GFAppBar(
8079
backgroundColor: Colors.blueGrey,
8180
title: const Text('UI Kit'),
@@ -149,8 +148,7 @@ class _MyHomePageState extends State<MyHomePage>
149148
// ],
150149
// ),
151150

152-
153-
SingleChildScrollView(
151+
SingleChildScrollView(
154152
child: Column(
155153
mainAxisAlignment: MainAxisAlignment.start,
156154
crossAxisAlignment: CrossAxisAlignment.center,
@@ -255,19 +253,17 @@ class _MyHomePageState extends State<MyHomePage>
255253
title: Text('title'),
256254
subTitle: Text('subtitle'),
257255
color: check ? GFColors.LIGHT : GFColors.DARK,
258-
onTap: (){
256+
onTap: () {
259257
setState(() {
260258
check = !check;
261259
});
262260
},
263261
),
264262

265-
266263
GFCheckbox(
267264
size: GFSize.SMALL,
268265
activebgColor: GFColors.DANGER,
269-
onChanged:
270-
(val) {
266+
onChanged: (val) {
271267
setState(() {
272268
check = val;
273269
});
@@ -286,9 +282,9 @@ class _MyHomePageState extends State<MyHomePage>
286282
value: check,
287283
type: GFCheckboxType.circle,
288284
checkColor: GFColors.DANGER,
289-
activebgColor: Colors.green,
290-
inactivebgColor: Colors.white54,
291-
activeBorderColor: Colors.red,
285+
activebgColor: Colors.green,
286+
inactivebgColor: Colors.white54,
287+
activeBorderColor: Colors.red,
292288
inactiveBorderColor: Colors.black12,
293289
inactiveIcon: Icon(Icons.check_box_outline_blank),
294290
activeIcon: Icon(Icons.check_box),
@@ -484,33 +480,35 @@ class _MyHomePageState extends State<MyHomePage>
484480
GFImageOverlay(
485481
height: 200.0,
486482
width: 200.0,
487-
image: NetworkImage("https://cdn.pixabay.com/photo/2017/12/03/18/04/christmas-balls-2995437_960_720.jpg"),
483+
image: NetworkImage(
484+
"https://cdn.pixabay.com/photo/2017/12/03/18/04/christmas-balls-2995437_960_720.jpg"),
488485
boxFit: BoxFit.cover,
489486
colorFilter: new ColorFilter.mode(
490-
Colors.black.withOpacity(0.5), BlendMode.darken,
487+
Colors.black.withOpacity(0.5),
488+
BlendMode.darken,
491489
),
492490
shape: BoxShape.circle,
493491
),
494492

495493
GFCard(
496-
content:
497-
GFImageOverlay(
498-
height: 200.0,
499-
width: 304.0,
500-
image: NetworkImage("https://cdn.pixabay.com/photo/2017/12/03/18/04/christmas-balls-2995437_960_720.jpg"),
501-
boxFit: BoxFit.cover,
502-
colorFilter: new ColorFilter.mode(
503-
Colors.black.withOpacity(0.5), BlendMode.darken,
504-
),
505-
)
506-
),
494+
content: GFImageOverlay(
495+
height: 200.0,
496+
width: 304.0,
497+
image: NetworkImage(
498+
"https://cdn.pixabay.com/photo/2017/12/03/18/04/christmas-balls-2995437_960_720.jpg"),
499+
boxFit: BoxFit.cover,
500+
colorFilter: new ColorFilter.mode(
501+
Colors.black.withOpacity(0.5),
502+
BlendMode.darken,
503+
),
504+
)),
507505

508506
RaisedButton(
509-
onPressed: (){},
507+
onPressed: () {},
510508
child: Text('hbjh'),
511509
),
512510
GFButton(
513-
onPressed: (){},
511+
onPressed: () {},
514512
child: Text('hbjh'),
515513
),
516514
GFButtonBar(
@@ -527,8 +525,7 @@ class _MyHomePageState extends State<MyHomePage>
527525
child: Text("dszndc"),
528526
icon: Icon(Icons.arrow_drop_down),
529527
),
530-
]
531-
),
528+
]),
532529

533530
GFButtonBadge(
534531
onPressed: null,
@@ -620,7 +617,9 @@ class _MyHomePageState extends State<MyHomePage>
620617
//
621618
GFIconButton(
622619
onPressed: null,
623-
icon: Icon(Icons.ac_unit,),
620+
icon: Icon(
621+
Icons.ac_unit,
622+
),
624623
// iconSize: 12.0,
625624
type: GFButtonType.solid,
626625
// shape: GFButtonShape.pills,
@@ -639,7 +638,7 @@ class _MyHomePageState extends State<MyHomePage>
639638

640639
RaisedButton(
641640
child: Text('goodiesMaterialButton button '),
642-
onPressed: (){},
641+
onPressed: () {},
643642
// color: Colors.blueGrey,
644643
// hoverColor: Colors.blueGrey,
645644
// focusColor: Colors.teal,
@@ -662,7 +661,7 @@ class _MyHomePageState extends State<MyHomePage>
662661
),
663662
GFButton(
664663
color: Colors.teal,
665-
onPressed: (){},
664+
onPressed: () {},
666665
child: Text("share"),
667666
icon: Icon(Icons.share),
668667
type: GFButtonType.outline,
@@ -680,7 +679,6 @@ class _MyHomePageState extends State<MyHomePage>
680679
),
681680
),
682681

683-
684682
GFIconButton(
685683
onPressed: () {},
686684
icon: Icon(Icons.ac_unit),
@@ -700,23 +698,17 @@ class _MyHomePageState extends State<MyHomePage>
700698
// borderShape: RoundedRectangleBorder(side: BorderSide(color: Colors.pink, width: 2.0, style: BorderStyle.solid), borderRadius: BorderRadius.zero),
701699
),
702700

703-
704701
RaisedButton(
705-
onPressed: (){
706-
707-
},
702+
onPressed: () {},
708703
child: Text('fvb'),
709704
),
710705

711706
GFButton(
712-
onPressed: (){
713-
714-
},
707+
onPressed: () {},
715708
fullWidthButton: true,
716709
child: Text('fvb'),
717710
),
718711

719-
720712
GFButton(
721713
type: GFButtonType.outline,
722714
shape: GFButtonShape.pills,

lib/components/checkbox/gf_checkbox.dart

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
11
import 'package:flutter/material.dart';
22
import 'package:getwidget/getwidget.dart';
33

4-
54
class GFCheckbox extends StatefulWidget {
6-
const GFCheckbox({
7-
Key key,
8-
this.size = GFSize.MEDIUM,
9-
this.type = GFCheckboxType.basic,
10-
this.checkColor = GFColors.WHITE,
11-
this.activebgColor = GFColors.PRIMARY,
12-
this.inactivebgColor = GFColors.WHITE,
13-
this.activeBorderColor = GFColors.WHITE,
14-
this.inactiveBorderColor = GFColors.DARK,
15-
this.onChanged,
16-
this.value,
17-
this.activeIcon = const Icon(
18-
Icons.check,
19-
size: 20,
20-
color: GFColors.WHITE,
21-
),
22-
this.inactiveIcon = const Icon(Icons.close),
23-
this.custombgColor = GFColors.SUCCESS,
24-
this.autofocus = false,
25-
this.focusNode
26-
}) : assert(autofocus != null),
5+
const GFCheckbox(
6+
{Key key,
7+
this.size = GFSize.MEDIUM,
8+
this.type = GFCheckboxType.basic,
9+
this.checkColor = GFColors.WHITE,
10+
this.activebgColor = GFColors.PRIMARY,
11+
this.inactivebgColor = GFColors.WHITE,
12+
this.activeBorderColor = GFColors.WHITE,
13+
this.inactiveBorderColor = GFColors.DARK,
14+
this.onChanged,
15+
this.value,
16+
this.activeIcon = const Icon(
17+
Icons.check,
18+
size: 20,
19+
color: GFColors.WHITE,
20+
),
21+
this.inactiveIcon = const Icon(Icons.close),
22+
this.custombgColor = GFColors.SUCCESS,
23+
this.autofocus = false,
24+
this.focusNode})
25+
: assert(autofocus != null),
2726
super(key: key);
2827

2928
/// type of [GFCheckboxType] which is of four type is basic, sqaure, circular and custom
@@ -82,12 +81,16 @@ class _GFCheckboxState extends State<GFCheckbox> {
8281

8382
@override
8483
Widget build(BuildContext context) => FocusableActionDetector(
85-
focusNode: widget.focusNode,
84+
focusNode: widget.focusNode,
8685
autofocus: widget.autofocus,
8786
enabled: enabled,
8887
child: InkWell(
8988
canRequestFocus: enabled,
90-
onTap: widget.onChanged != null ? () {widget.onChanged(!widget.value);} : null,
89+
onTap: widget.onChanged != null
90+
? () {
91+
widget.onChanged(!widget.value);
92+
}
93+
: null,
9194
child: Container(
9295
height: widget.size,
9396
width: widget.size,

lib/components/checkbox_list_tile/gf_checkbox_list_tile.dart

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class GFCheckboxListTile extends StatelessWidget {
3131
this.custombgColor = GFColors.SUCCESS,
3232
this.selected = false,
3333
this.autofocus = false,
34-
}) : assert(value != null),
34+
}) : assert(value != null),
3535
assert(selected != null),
3636
assert(autofocus != null),
3737
super(key: key);
@@ -99,12 +99,7 @@ class GFCheckboxListTile extends StatelessWidget {
9999
/// type of [Color] used to change the background color of the custom active checkbox only
100100
final Color custombgColor;
101101

102-
/// Whether to render icons and text in the [activeColor].
103-
///
104-
/// No effort is made to automatically coordinate the [selected] state and the
105-
/// [value] state. To have the list tile appear selected when the checkbox is
106-
/// checked, pass the same value to both.
107-
///
102+
/// To have the list tile appear selected when the checkbox is checked, pass the same value to both.
108103
/// Normally, this property is left to its default value, false.
109104
final bool selected;
110105

@@ -113,10 +108,14 @@ class GFCheckboxListTile extends StatelessWidget {
113108

114109
@override
115110
Widget build(BuildContext context) => MergeSemantics(
116-
child: GFListTile(
111+
child: GFListTile(
117112
autofocus: autofocus,
118113
enabled: onChanged != null,
119-
onTap: onChanged != null ? () { onChanged(!value); } : null,
114+
onTap: onChanged != null
115+
? () {
116+
onChanged(!value);
117+
}
118+
: null,
120119
selected: selected,
121120
avatar: avatar,
122121
titleText: titleText,
@@ -143,5 +142,5 @@ class GFCheckboxListTile extends StatelessWidget {
143142
type: type,
144143
),
145144
),
146-
);
145+
);
147146
}

lib/components/list_tile/gf_list_tile.dart

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class GFListTile extends StatelessWidget {
2424
this.hoverColor,
2525
this.focusNode,
2626
this.autofocus = false,
27-
}) : assert(enabled != null),
27+
}) : assert(enabled != null),
2828
assert(selected != null),
2929
assert(autofocus != null),
3030
super(key: key);
@@ -96,17 +96,17 @@ class GFListTile extends StatelessWidget {
9696

9797
@override
9898
Widget build(BuildContext context) => InkWell(
99-
onTap: enabled ? onTap : null,
100-
onLongPress: enabled ? onLongPress : null,
101-
canRequestFocus: enabled,
102-
focusNode: focusNode,
103-
focusColor: focusColor,
104-
hoverColor: hoverColor,
105-
autofocus: autofocus,
106-
child: Semantics(
107-
selected: selected,
108-
enabled: enabled,
109-
child: Container(
99+
onTap: enabled ? onTap : null,
100+
onLongPress: enabled ? onLongPress : null,
101+
canRequestFocus: enabled,
102+
focusNode: focusNode,
103+
focusColor: focusColor,
104+
hoverColor: hoverColor,
105+
autofocus: autofocus,
106+
child: Semantics(
107+
selected: selected,
108+
enabled: enabled,
109+
child: Container(
110110
// constraints: const BoxConstraints(minHeight: 50),
111111
padding: padding,
112112
margin: margin,
@@ -151,6 +151,6 @@ class GFListTile extends StatelessWidget {
151151
],
152152
),
153153
),
154-
),
155-
);
154+
),
155+
);
156156
}

0 commit comments

Comments
 (0)