@@ -2,75 +2,113 @@ import 'package:flutter/material.dart';
22import 'package:ui_kit/colors/gf_color.dart' ;
33
44class 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}
0 commit comments