11import 'package:flutter/material.dart' ;
22import 'package:ui_kit/colors/gf_color.dart' ;
3+ import 'package:ui_kit/types/gf_heading_type.dart' ;
34
45class GFHeader extends StatelessWidget {
56 const GFHeader (
67 {Key key,
8+ this .type,
79 this .child,
810 this .text,
911 this .icon,
@@ -18,6 +20,8 @@ class GFHeader extends StatelessWidget {
1820 : super (key: key);
1921
2022
23+
24+
2125 /// child of type [Widget] is alternative to text key. text will get priority over child
2226 final Widget child;
2327
@@ -51,8 +55,29 @@ class GFHeader extends StatelessWidget {
5155 ///backgroundImagecolorFilter of type [ColorFilter] to set the background color of [GFHeader] only when backgroundImage is available
5256 final ColorFilter backgroundImagecolorFilter;
5357
58+
59+ /// header type of [GFHeaderType] i.e, typo1, typo2, typo3, typo4, typo5, typo6
60+ final GFHeadingType type;
61+
5462 @override
5563 Widget build (BuildContext context) {
64+
65+ double fontSize;
66+
67+ if (type == GFHeadingType .typo1){
68+ fontSize = 25.0 ;
69+ }else if (type == GFHeadingType .typo2){
70+ fontSize = 22.0 ;
71+ }else if (type == GFHeadingType .typo3){
72+ fontSize = 19.0 ;
73+ }else if (type == GFHeadingType .typo4){
74+ fontSize = 17.0 ;
75+ }else if (type == GFHeadingType .typo5){
76+ fontSize = 15.0 ;
77+ }else if (type == GFHeadingType .typo6){
78+ fontSize = 13.0 ;
79+ }
80+
5681 return Container (
5782 padding: EdgeInsets .all (backgroundImage != null ? 10 : 0 ),
5883 decoration: BoxDecoration (
@@ -75,28 +100,28 @@ class GFHeader extends StatelessWidget {
75100 ? Padding (padding: EdgeInsets .only (left: 10 ))
76101 : Container (),
77102 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- )
103+ ? Expanded (child : Text (
104+ text,
105+ style: TextStyle (
106+ color: textColor != null
107+ ? getGFColor (textColor)
108+ : backgroundImage != null
109+ ? Colors .white
110+ : Colors .black,
111+ fontSize: fontSize ,
112+ letterSpacing: 0.3 ,
113+ fontWeight: FontWeight .w500),
114+ ) )
90115 : child
91116 ],
92117 ),
93118 showDivider
94119 ? Container (
95- margin: EdgeInsets .only (top: 5 , bottom: 5 ),
120+ margin: EdgeInsets .only (top: 3 , bottom: 3 ),
96121 alignment: dividerAlignment,
97122 child: Container (
98123 width: dividerWidth != null ? dividerWidth : 70 ,
99- height: 4 ,
124+ height: fontSize / 5 ,
100125 decoration: BoxDecoration (
101126 color: dividerColor != null
102127 ? getGFColor (dividerColor)
0 commit comments