Skip to content

Commit 6189813

Browse files
Sandip KakadiyaSandip Kakadiya
authored andcommitted
GFColor changes in typography, toast, tabs
1 parent 01560c5 commit 6189813

5 files changed

Lines changed: 35 additions & 51 deletions

File tree

lib/components/tabs/gf_segment_tabs.dart

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@ class _GFSegmentTabsState extends State<GFSegmentTabs> {
173173
height: widget.height ?? 28,
174174
width: widget.width ?? 240,
175175
decoration: BoxDecoration(
176-
border: widget.border ??
177-
Border.all(color: GFColors.getGFColor(GFColor.primary), width: 1),
176+
border:
177+
widget.border ?? Border.all(color: GFColors.PRIMARY, width: 1),
178178
borderRadius: widget.borderRadius ?? BorderRadius.circular(2),
179179
),
180180
child: DefaultTabController(
@@ -186,32 +186,24 @@ class _GFSegmentTabsState extends State<GFSegmentTabs> {
186186
color: widget.tabBarColor ?? Colors.transparent,
187187
child: TabBar(
188188
controller: widget.tabController,
189-
labelColor:
190-
widget.labelColor ?? GFColors.getGFColor(GFColor.white),
191-
unselectedLabelColor: widget.unselectedLabelColor ??
192-
GFColors.getGFColor(GFColor.primary),
189+
labelColor: widget.labelColor ?? GFColors.WHITE,
190+
unselectedLabelColor:
191+
widget.unselectedLabelColor ?? GFColors.PRIMARY,
193192
labelStyle: widget.labelStyle ?? const TextStyle(fontSize: 12),
194193
unselectedLabelStyle:
195194
widget.unselectedLabelStyle ?? const TextStyle(fontSize: 12),
196-
indicatorColor: widget.indicatorColor == null
197-
? GFColors.getGFColor(GFColor.primary)
198-
: widget.indicatorColor,
195+
indicatorColor: widget.indicatorColor ?? GFColors.PRIMARY,
199196
indicatorSize: widget.indicatorSize,
200-
indicator: widget.indicator == null
201-
? BoxDecoration(
202-
color: widget.indicatorColor == null
203-
? GFColors.getGFColor(GFColor.primary)
204-
: widget.indicatorColor,
205-
border: Border.all(
206-
color: widget.indicatorColor == null
207-
? Colors.transparent
208-
: widget.indicatorColor,
209-
width: 2),
210-
borderRadius: widget.borderRadius == null
211-
? BorderRadius.circular(0)
212-
: widget.borderRadius,
213-
)
214-
: widget.indicator,
197+
indicator: widget.indicator ??
198+
BoxDecoration(
199+
color: widget.indicatorColor ?? GFColors.PRIMARY,
200+
border: Border.all(
201+
color: widget.indicatorColor ?? Colors.transparent,
202+
width: 2),
203+
borderRadius: widget.borderRadius == null
204+
? BorderRadius.circular(0)
205+
: widget.borderRadius,
206+
),
215207
indicatorPadding: widget.indicatorPadding,
216208
indicatorWeight: widget.indicatorWeight,
217209
tabs: widget.tabs,

lib/components/tabs/gf_tabbar.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ class _GFTabBarState extends State<GFTabBar> {
171171
child: Material(
172172
shape: widget.shape,
173173
type: MaterialType.button,
174-
color: widget.tabBarColor ?? GFColors.getGFColor(GFColor.primary),
174+
color: widget.tabBarColor ?? GFColors.PRIMARY,
175175
child: TabBar(
176176
controller: widget.controller,
177177
labelColor: widget.labelColor,

lib/components/tabs/gf_tabs.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,7 @@ class _GFTabsState extends State<GFTabs> {
186186
length: widget.length,
187187
initialIndex: widget.initialIndex,
188188
tabBarHeight: widget.tabBarHeight,
189-
tabBarColor: widget.tabBarColor ??
190-
GFColors.getGFColor(GFColor.primary),
189+
tabBarColor: widget.tabBarColor ?? GFColors.PRIMARY,
191190
controller: widget.controller,
192191
labelColor: widget.labelColor,
193192
unselectedLabelColor: widget.unselectedLabelColor,

lib/components/toast/gf_toast.dart

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ class GFToast extends StatefulWidget {
2727
/// button of type [Widget],or you can use [GFButton] for easy implementation with [GFToast]
2828
final Widget button;
2929

30-
///pass color of type [Color] or [GFColor] for background of [GFToast]
31-
final dynamic backgroundColor;
30+
///pass color of type [Color] or [GFColors] for background of [GFToast]
31+
final Color backgroundColor;
3232

3333
/// text of type [String] is alternative to child. text will get priority over child
3434
final String text;
@@ -130,9 +130,7 @@ class _GFToastState extends State<GFToast> with TickerProviderStateMixin {
130130
: widget.type == GFToastType.rounded
131131
? BorderRadius.circular(10)
132132
: BorderRadius.zero,
133-
color: widget.backgroundColor != null
134-
? GFColors.getGFColor(widget.backgroundColor)
135-
: const Color(0xff323232),
133+
color: widget.backgroundColor ?? const Color(0xff323232),
136134
boxShadow: [
137135
BoxShadow(
138136
color: Colors.black.withOpacity(0.40),

lib/components/typography/gf_typography.dart

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ class GFTypography extends StatelessWidget {
2929
///icon of type [Widget] used to pass icon or image
3030
final Widget icon;
3131

32-
/// Pass [GFColor] or [Color] for dividerColor
33-
final dynamic dividerColor;
32+
/// Pass [GFColors] or [Color] for dividerColor
33+
final Color dividerColor;
3434

35-
/// Pass [GFColor] or [Color] for textColor
36-
final dynamic textColor;
35+
/// Pass [GFColors] or [Color] for textColor
36+
final Color textColor;
3737

3838
/// dividerBorderRadius of type [BorderRadius] to alter the radius of the divider
3939
final BorderRadius dividerBorderRadius;
@@ -101,11 +101,9 @@ class GFTypography extends StatelessWidget {
101101
child: Text(
102102
text,
103103
style: TextStyle(
104-
color: textColor != null
105-
? GFColors.getGFColor(textColor)
106-
: backgroundImage != null
107-
? Colors.white
108-
: Colors.black,
104+
color: textColor ?? backgroundImage != null
105+
? Colors.white
106+
: Colors.black,
109107
fontSize: fontSize,
110108
letterSpacing: 0.3,
111109
fontWeight: FontWeight.w500),
@@ -121,16 +119,13 @@ class GFTypography extends StatelessWidget {
121119
width: dividerWidth != null ? dividerWidth : 70,
122120
height: fontSize / 5,
123121
decoration: BoxDecoration(
124-
color: dividerColor != null
125-
? GFColors.getGFColor(dividerColor)
126-
: backgroundImage != null
127-
? Colors.white
128-
: Colors.black,
129-
borderRadius: dividerBorderRadius != null
130-
? dividerBorderRadius
131-
: const BorderRadius.all(
132-
Radius.circular(5),
133-
),
122+
color: dividerColor ?? backgroundImage != null
123+
? Colors.white
124+
: Colors.black,
125+
borderRadius: dividerBorderRadius ??
126+
const BorderRadius.all(
127+
Radius.circular(5),
128+
),
134129
),
135130
),
136131
)

0 commit comments

Comments
 (0)