Skip to content

Commit d4df87e

Browse files
committed
comments added for GFHeader
1 parent 61fbcb9 commit d4df87e

3 files changed

Lines changed: 109 additions & 66 deletions

File tree

example/lib/main.dart

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,20 @@ class _MyHomePageState extends State<MyHomePage> {
8484

8585
body: Column(
8686
children: <Widget>[
87-
GFToast(
88-
bgColor: GFColor.warning,
89-
button: GFButton(
90-
onPressed: null,
91-
type: GFType.outline,
92-
text: 'Accept',
93-
),
87+
Container(
88+
margin: EdgeInsets.only(top:10),
89+
child: GFToast(
90+
//
91+
//
92+
//
93+
// button: GFButton(
94+
// onPressed: null,
95+
// type: GFType.outline,
96+
// text: 'Accept',
97+
// ),
9498
text: 'Marked as Favorite.',
9599
),
100+
),
96101
Container(
97102
margin: EdgeInsets.only(left: 10, right: 10, top: 10, bottom: 10),
98103
child: Row(

lib/components/header/gf_header.dart

Lines changed: 93 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -2,75 +2,113 @@ import 'package:flutter/material.dart';
22
import 'package:ui_kit/colors/gf_color.dart';
33

44
class GFHeader extends StatelessWidget {
5-
6-
7-
const GFHeader({Key key,
8-
this.child,
9-
this.text,
10-
this.icon,
11-
this.dividerBorderRadius,
12-
this.textColor,
13-
this.dividerAlignment,
14-
this.dividerColor,
15-
this.showDivider = true,
16-
this.dividerWidth,
17-
this.backgroundImage,
18-
this.backgroundImagecolorFilter
19-
}) : super (key:key);
20-
5+
const GFHeader(
6+
{Key key,
7+
this.child,
8+
this.text,
9+
this.icon,
10+
this.dividerBorderRadius,
11+
this.textColor,
12+
this.dividerAlignment,
13+
this.dividerColor,
14+
this.showDivider = true,
15+
this.dividerWidth,
16+
this.backgroundImage,
17+
this.backgroundImagecolorFilter})
18+
: super(key: key);
2119

2220

21+
/// child of type [Widget] is alternative to text key. text will get priority over child
2322
final Widget child;
23+
24+
/// text of type [String] is alternative to child. text will get priority over child
2425
final String text;
25-
final Widget icon;
26+
27+
///icon of type [Widget] used to pass icon or image
28+
final Widget icon;
29+
30+
/// Pass [GFColor] or [Color] for dividerColor
2631
final dynamic dividerColor;
32+
33+
/// Pass [GFColor] or [Color] for textColor
2734
final dynamic textColor;
35+
36+
/// dividerBorderRadius of type [BorderRadius] to alter the radius of the divider
2837
final BorderRadius dividerBorderRadius;
38+
39+
///dividerAlignment of type [Alignment] used for aligning the divider to required alignment
2940
final Alignment dividerAlignment;
41+
42+
///Pass [bool] value to show or hide the divider
3043
final bool showDivider;
44+
45+
///pass [double] type to increase or decrease the width of the divider
3146
final double dividerWidth;
47+
48+
///backgroundImage of type [ImageProvider] to set the background of [GFHeader]
3249
final ImageProvider backgroundImage;
50+
51+
///backgroundImagecolorFilter of type [ColorFilter] to set the background color of [GFHeader] only when backgroundImage is available
3352
final ColorFilter backgroundImagecolorFilter;
34-
35-
36-
53+
3754
@override
3855
Widget build(BuildContext context) {
3956
return Container(
40-
padding:EdgeInsets.all( backgroundImage != null ? 10:0) ,
41-
decoration: BoxDecoration(
42-
image:backgroundImage != null ? DecorationImage(image: backgroundImage , fit: BoxFit.cover,
43-
colorFilter: backgroundImagecolorFilter?? ColorFilter.mode(Colors.black54, BlendMode.darken),):null,
44-
),
45-
child: Column(
46-
crossAxisAlignment: CrossAxisAlignment.start,
47-
children: <Widget>[
48-
Row(
49-
children: <Widget>[
50-
51-
icon != null ? icon: Container(),
52-
icon != null ? Padding(padding: EdgeInsets.only(left: 10)): Container(),
53-
text!=null?Text(text, style:
54-
TextStyle(
55-
color: textColor != null ? getGFColor(textColor): backgroundImage !=null ? Colors.white: Colors.black,
56-
fontSize: 16, letterSpacing: 0.3, fontWeight: FontWeight.w500),)
57-
:child
58-
],
59-
),
60-
showDivider ? Container(
61-
margin: EdgeInsets.only(top:5),
62-
alignment: dividerAlignment,
63-
child: Container(
64-
width: dividerWidth != null ? dividerWidth : 70,
65-
height: 4,
66-
decoration: BoxDecoration(
67-
color: dividerColor != null ? getGFColor(dividerColor): backgroundImage !=null ? Colors.white: Colors.black,
68-
borderRadius: dividerBorderRadius != null ?dividerBorderRadius:BorderRadius.all(Radius.circular(5))
69-
),
70-
)
71-
): Container()
72-
],
73-
)
74-
);
57+
padding: EdgeInsets.all(backgroundImage != null ? 10 : 0),
58+
decoration: BoxDecoration(
59+
image: backgroundImage != null
60+
? DecorationImage(
61+
image: backgroundImage,
62+
fit: BoxFit.cover,
63+
colorFilter: backgroundImagecolorFilter ??
64+
ColorFilter.mode(Colors.black54, BlendMode.darken),
65+
)
66+
: null,
67+
),
68+
child: Column(
69+
crossAxisAlignment: CrossAxisAlignment.start,
70+
children: <Widget>[
71+
Row(
72+
children: <Widget>[
73+
icon != null ? icon : Container(),
74+
icon != null
75+
? Padding(padding: EdgeInsets.only(left: 10))
76+
: Container(),
77+
text != null
78+
? Text(
79+
text,
80+
style: TextStyle(
81+
color: textColor != null
82+
? getGFColor(textColor)
83+
: backgroundImage != null
84+
? Colors.white
85+
: Colors.black,
86+
fontSize: 16,
87+
letterSpacing: 0.3,
88+
fontWeight: FontWeight.w500),
89+
)
90+
: child
91+
],
92+
),
93+
showDivider
94+
? Container(
95+
margin: EdgeInsets.only(top: 5),
96+
alignment: dividerAlignment,
97+
child: Container(
98+
width: dividerWidth != null ? dividerWidth : 70,
99+
height: 4,
100+
decoration: BoxDecoration(
101+
color: dividerColor != null
102+
? getGFColor(dividerColor)
103+
: backgroundImage != null
104+
? Colors.white
105+
: Colors.black,
106+
borderRadius: dividerBorderRadius != null
107+
? dividerBorderRadius
108+
: BorderRadius.all(Radius.circular(5))),
109+
))
110+
: Container()
111+
],
112+
));
75113
}
76114
}

lib/components/toast/gf_toast.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ class GFToast extends StatelessWidget {
77
GFToast({Key key,
88
this.child,
99
this.button,
10-
this.bgColor,
10+
this.backgroundColor,
1111
this.text,
12-
this.textStyle = const TextStyle(color: Colors.white70, height: 1.5),
12+
this.textStyle = const TextStyle(color: Colors.white70),
1313
}) :super(key: key);
1414

1515
/// child of type [Widget]is alternative to text key. text will get priority over child
@@ -19,7 +19,7 @@ class GFToast extends StatelessWidget {
1919
final Widget button;
2020

2121
///pass color of type [Color] or [GFColor] for background of [GFToast]
22-
final dynamic bgColor;
22+
final dynamic backgroundColor;
2323

2424
/// text of type [String] is alternative to child. text will get priority over child
2525
final String text;
@@ -36,7 +36,7 @@ class GFToast extends StatelessWidget {
3636
padding: EdgeInsets.all(10),
3737
decoration: BoxDecoration(
3838
borderRadius: BorderRadius.all(Radius.circular(3)),
39-
color: bgColor!=null ?getGFColor(bgColor):Color(0xff323232),
39+
color: backgroundColor!=null ?getGFColor(backgroundColor):Color(0xff323232),
4040
),
4141
child: Row(
4242
children: <Widget>[

0 commit comments

Comments
 (0)