Skip to content

Commit b7991b3

Browse files
authored
Merge pull request #29 from ionicfirebaseapp/master
master pull
2 parents e474c99 + 1ab254c commit b7991b3

29 files changed

+356
-392
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ getflutter-app-kit
3333
getflutter-web-kit
3434
getflutter_app
3535
test/.test_coverage.dart
36-
example
3736

3837
# Android related
3938
**/android/**/gradle-wrapper.jar

analysis_options.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ linter:
1414
# - always_put_required_named_parameters_first
1515
- always_require_non_null_named_parameters
1616
# - annotate_overrides
17-
# required to Allow both GFColors and Colors
18-
# - avoid_annotating_with_dynamic
17+
- avoid_annotating_with_dynamic
1918
- avoid_as
2019
- avoid_bool_literals_in_conditional_expressions
2120
- avoid_catches_without_on_clauses

example/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@
3434
lib/generated_plugin_registrant.dart
3535

3636
# Exceptions to above rules.
37-
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
37+
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages

example/lib/main.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class MyApp extends StatelessWidget {
1414
);
1515
}
1616

17+
//
1718
class MyHomePage extends StatefulWidget {
1819
@override
1920
_MyHomePageState createState() => _MyHomePageState();
@@ -66,7 +67,7 @@ class _MyHomePageState extends State<MyHomePage> {
6667
),
6768
),
6869
GFButton(
69-
size: GFSize.large,
70+
size: GFSize.LARGE,
7071
text: 'View on Github',
7172
textStyle: const TextStyle(
7273
fontSize: 16,
@@ -99,7 +100,7 @@ class _MyHomePageState extends State<MyHomePage> {
99100
),
100101
),
101102
GFButton(
102-
size: GFSize.large,
103+
size: GFSize.LARGE,
103104
text: 'View on Playstore',
104105
textStyle:
105106
const TextStyle(fontSize: 16, color: GFColors.WHITE),

lib/colors/gf_color.dart

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,5 @@
11
import 'package:flutter/material.dart';
22

3-
enum GFColor {
4-
primary,
5-
secondary,
6-
success,
7-
info,
8-
warning,
9-
danger,
10-
focus,
11-
alt,
12-
light,
13-
dark,
14-
white,
15-
transparent
16-
}
17-
183
class GFColors {
194
static const Color PRIMARY = Color(0xff3880FF);
205
static const Color SECONDARY = Color(0xffAA66CC);
@@ -28,53 +13,4 @@ class GFColors {
2813
static const Color FOCUS = Color(0xff434054);
2914
static const Color ALT = Color(0xff794c8a);
3015
static const Color TRANSPARENT = Colors.transparent;
31-
32-
/// Pass [GFColor] or [Color]
33-
static Color getGFColor(dynamic color) {
34-
if (color is Color) {
35-
return color;
36-
} else {
37-
switch (color) {
38-
case GFColor.primary:
39-
return PRIMARY;
40-
break;
41-
case GFColor.secondary:
42-
return SECONDARY;
43-
break;
44-
case GFColor.success:
45-
return SUCCESS;
46-
break;
47-
case GFColor.warning:
48-
return WARNING;
49-
break;
50-
case GFColor.info:
51-
return INFO;
52-
break;
53-
case GFColor.danger:
54-
return DANGER;
55-
break;
56-
case GFColor.focus:
57-
return FOCUS;
58-
break;
59-
case GFColor.alt:
60-
return ALT;
61-
break;
62-
case GFColor.light:
63-
return LIGHT;
64-
break;
65-
case GFColor.dark:
66-
return DARK;
67-
break;
68-
case GFColor.white:
69-
return WHITE;
70-
break;
71-
case GFColor.transparent:
72-
return TRANSPARENT;
73-
break;
74-
default:
75-
return null;
76-
break;
77-
}
78-
}
79-
}
8016
}

lib/components/accordian/gf_accordian.dart

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import 'package:flutter/material.dart';
2-
import 'package:getflutter/colors/gf_color.dart';
2+
import 'package:getflutter/getflutter.dart';
33

44
class GFAccordion extends StatefulWidget {
55
const GFAccordion(
66
{Key key,
77
this.child,
88
this.content,
9-
this.collapsedTitlebackgroundColor = Colors.white,
9+
this.collapsedTitlebackgroundColor = GFColors.WHITE,
1010
this.expandedTitlebackgroundColor = const Color(0xFFE0E0E0),
1111
this.collapsedIcon = const Icon(Icons.keyboard_arrow_down),
1212
this.expandedIcon = const Icon(Icons.keyboard_arrow_up),
@@ -16,8 +16,8 @@ class GFAccordion extends StatefulWidget {
1616
this.contentbackgroundColor,
1717
this.contentPadding = const EdgeInsets.all(10),
1818
this.contentChild,
19-
this.titleborderColor = const Border(),
20-
this.contentBorderColor = const Border(),
19+
this.titleborder = const Border(),
20+
this.contentBorder = const Border(),
2121
this.margin})
2222
: super(key: key);
2323

@@ -30,11 +30,11 @@ class GFAccordion extends StatefulWidget {
3030
/// contentChild of type [Widget]is alternative to content key. content will get priority over contentChild
3131
final Widget contentChild;
3232

33-
/// type of [Color] or [GFColor] which is used to change the background color of the [GFAccordion] title when it is collapsed
34-
final dynamic collapsedTitlebackgroundColor;
33+
/// type of [Color] or [GFColors] which is used to change the background color of the [GFAccordion] title when it is collapsed
34+
final Color collapsedTitlebackgroundColor;
3535

36-
/// type of [Color] or [GFColor] which is used to change the background color of the [GFAccordion] title when it is expanded
37-
final dynamic expandedTitlebackgroundColor;
36+
/// type of [Color] or [GFColors] which is used to change the background color of the [GFAccordion] title when it is expanded
37+
final Color expandedTitlebackgroundColor;
3838

3939
///collapsedIcon of type [Widget] which is used to show when the [GFAccordion] is collapsed
4040
final Widget collapsedIcon;
@@ -54,17 +54,17 @@ class GFAccordion extends StatefulWidget {
5454
///descriptionPadding of type [EdgeInsets] which is used to set the padding of the [GFAccordion] description
5555
final EdgeInsets contentPadding;
5656

57-
/// type of [Color] or [GFColor] which is used to change the background color of the [GFAccordion] description
58-
final dynamic contentbackgroundColor;
57+
/// type of [Color] or [GFColors] which is used to change the background color of the [GFAccordion] description
58+
final Color contentbackgroundColor;
5959

6060
///margin of type [EdgeInsets] which is used to set the margin of the [GFAccordion]
6161
final EdgeInsets margin;
6262

63-
///titleborderColor of type [Color] or [GFColor] which is used to change the border color of title
64-
final dynamic titleborderColor;
63+
///titleborderColor of type [Color] or [GFColors] which is used to change the border color of title
64+
final Border titleborder;
6565

66-
///contentBorderColor of type [Color] or [GFColor] which is used to change the border color of content
67-
final dynamic contentBorderColor;
66+
///contentBorderColor of type [Color] or [GFColors] which is used to change the border color of content
67+
final Border contentBorder;
6868

6969
@override
7070
_GFAccordionState createState() => _GFAccordionState();
@@ -128,7 +128,7 @@ class _GFAccordionState extends State<GFAccordion>
128128
},
129129
child: Container(
130130
decoration: BoxDecoration(
131-
border: widget.titleborderColor,
131+
border: widget.titleborder,
132132
color: showAccordion
133133
? widget.expandedTitlebackgroundColor
134134
: widget.collapsedTitlebackgroundColor,
@@ -150,7 +150,7 @@ class _GFAccordionState extends State<GFAccordion>
150150
showAccordion
151151
? Container(
152152
decoration: BoxDecoration(
153-
border: widget.contentBorderColor,
153+
border: widget.contentBorder,
154154
color: widget.contentbackgroundColor ?? Colors.white70,
155155
),
156156
width: MediaQuery.of(context).size.width,

lib/components/alert/gf_alert.dart

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import 'package:flutter/material.dart';
22
import 'package:flutter/widgets.dart';
33
import 'package:getflutter/getflutter.dart';
4-
import 'package:getflutter/types/gf_alert_type.dart';
54

65
class GFAlert extends StatefulWidget {
76
/// Alert has to be wrap inside the body like [GFFloatingWidget]. See [GFFloatingWidget]
@@ -39,8 +38,8 @@ class GFAlert extends StatefulWidget {
3938
///type of [TextStyle] to change the style of the title not for the child
4039
final TextStyle titleTextStyle;
4140

42-
///pass color of type [Color] or [GFColor] for background of [GFAlert]
43-
final dynamic backgroundColor;
41+
///pass color of type [Color] or [GFColors] for background of [GFAlert]
42+
final Color backgroundColor;
4443

4544
///type of [TextStyle] to change the style of the content not for the contentchild
4645
final TextStyle contentTextStyle;
@@ -93,7 +92,7 @@ class _GFAlertState extends State<GFAlert> with TickerProviderStateMixin {
9392
Container(
9493
width: widget.type == GFAlertType.fullWidth
9594
? MediaQuery.of(context).size.width
96-
: widget.width,
95+
: widget.width ?? MediaQuery.of(context).size.width * 0.885,
9796
constraints: const BoxConstraints(minHeight: 50),
9897
margin: widget.type == GFAlertType.fullWidth
9998
? const EdgeInsets.only(left: 0, right: 0)
@@ -106,8 +105,8 @@ class _GFAlertState extends State<GFAlert> with TickerProviderStateMixin {
106105
? BorderRadius.circular(10)
107106
: BorderRadius.zero,
108107
color: widget.backgroundColor != null
109-
? GFColors.getGFColor(widget.backgroundColor)
110-
: GFColors.getGFColor(GFColor.white),
108+
? widget.backgroundColor
109+
: GFColors.WHITE,
111110
boxShadow: [
112111
BoxShadow(
113112
color: Colors.black.withOpacity(0.40), blurRadius: 3)

lib/components/appbar/gf_appbar.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -321,12 +321,12 @@ class _GFAppBarState extends State<GFAppBar> {
321321
IconThemeData actionsIconTheme = widget.actionsIconTheme ??
322322
appBarTheme.actionsIconTheme ??
323323
overallIconTheme;
324-
TextStyle centerStyle = widget.textTheme?.title ??
325-
appBarTheme.textTheme?.title ??
326-
theme.primaryTextTheme.title;
327-
TextStyle sideStyle = widget.textTheme?.body1 ??
328-
appBarTheme.textTheme?.body1 ??
329-
theme.primaryTextTheme.body1;
324+
TextStyle centerStyle = widget.textTheme?.headline6 ??
325+
appBarTheme.textTheme?.headline6 ??
326+
theme.primaryTextTheme.headline6;
327+
TextStyle sideStyle = widget.textTheme?.bodyText2 ??
328+
appBarTheme.textTheme?.bodyText2 ??
329+
theme.primaryTextTheme.bodyText2;
330330

331331
if (widget.toolbarOpacity != 1.0) {
332332
final double opacity = const Interval(

lib/components/avatar/gf_avatar.dart

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@ class GFAvatar extends StatelessWidget {
1515
this.maxRadius,
1616
this.borderRadius,
1717
this.shape = GFAvatarShape.circle,
18-
this.size = GFSize.medium})
18+
this.size = GFSize.MEDIUM})
1919
: assert(radius == null || (minRadius == null && maxRadius == null)),
2020
super(key: key);
2121

2222
/// Typically a [Text] widget. If the [CircleAvatar] is to have an image, use [backgroundImage] instead.
2323
final Widget child;
2424

25-
/// use [Color] or [GFColor]. The color with which to fill the circle.
26-
final dynamic backgroundColor;
25+
/// use [Color] or [GFColors]. The color with which to fill the circle.
26+
final Color backgroundColor;
2727

28-
/// use [Color] or [GFColor]. The default text color for text in the circle.
29-
final dynamic foregroundColor;
28+
/// use [Color] or [GFColors]. The default text color for text in the circle.
29+
final Color foregroundColor;
3030

3131
/// The background image of the circle.
3232
final ImageProvider backgroundImage;
@@ -41,7 +41,7 @@ class GFAvatar extends StatelessWidget {
4141
final double maxRadius;
4242

4343
/// size of avatar. use [GFSize] or [double] i.e, 1.2, small, medium, large etc.
44-
final dynamic size;
44+
final double size;
4545

4646
/// shape of avatar [GFAvatarShape] i.e, standard, circle, square
4747
final GFAvatarShape shape;
@@ -55,15 +55,15 @@ class GFAvatar extends StatelessWidget {
5555

5656
double get _minDiameter {
5757
if (radius == null && minRadius == null && maxRadius == null) {
58-
return 1.5 * GFSizesClass.getGFSize(size);
58+
return 1.5 * size;
5959
} else {
6060
return 2.0 * (radius ?? minRadius ?? 0);
6161
}
6262
}
6363

6464
double get _maxDiameter {
6565
if (radius == null && minRadius == null && maxRadius == null) {
66-
return 1.5 * GFSizesClass.getGFSize(size);
66+
return 1.5 * size;
6767
} else {
6868
return 2.0 * (radius ?? maxRadius ?? 0);
6969
}
@@ -83,11 +83,11 @@ class GFAvatar extends StatelessWidget {
8383

8484
@override
8585
Widget build(BuildContext context) {
86-
final Color backgroundColor = GFColors.getGFColor(this.backgroundColor);
87-
final Color foregroundColor = GFColors.getGFColor(this.foregroundColor);
86+
final Color backgroundColor = this.backgroundColor;
87+
final Color foregroundColor = this.foregroundColor;
8888
assert(debugCheckHasMediaQuery(context));
8989
final ThemeData theme = Theme.of(context);
90-
TextStyle textStyle = theme.primaryTextTheme.subhead.copyWith(
90+
TextStyle textStyle = theme.primaryTextTheme.subtitle1.copyWith(
9191
color: foregroundColor,
9292
);
9393
Color effectiveBackgroundColor = backgroundColor;

0 commit comments

Comments
 (0)