Skip to content

Commit

Permalink
Merge pull request #30 from elbeicktalat/restore_text_style_in_button…
Browse files Browse the repository at this point in the history
…_style

Restore text style in button style
  • Loading branch information
elbeicktalat committed Nov 4, 2021
2 parents 3f9d953 + 37fb6ca commit b8448f4
Show file tree
Hide file tree
Showing 16 changed files with 117 additions and 112 deletions.
28 changes: 14 additions & 14 deletions lib/src/buttons/apple_auth_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class AppleAuthButton extends AuthButton {
required VoidCallback onPressed,
VoidCallback? onLongPress,
String text = 'Sign in with Apple',
TextStyle? textStyle,
bool darkMode = false,
bool rtl = false,
bool isLoading = false,
Expand All @@ -27,7 +26,6 @@ class AppleAuthButton extends AuthButton {
onPressed: onPressed,
onLongPress: onLongPress,
text: text,
textStyle: textStyle,
darkMode: darkMode,
rtl: rtl,
isLoading: isLoading,
Expand Down Expand Up @@ -86,17 +84,19 @@ class AppleAuthButton extends AuthButton {
@override
TextStyle getTextStyle() {
if (style!.buttonType == AuthButtonType.secondary)
return GoogleFonts.sourceSansPro(
color: Colors.white,
fontSize: 18,
fontWeight: FontWeight.w600,
letterSpacing: 0.50,
);
return GoogleFonts.sourceSansPro(
color: Colors.black.smartColor(darkMode),
fontSize: 18,
fontWeight: FontWeight.w600,
letterSpacing: 0.50,
);
return style!.textStyle ??
GoogleFonts.sourceSansPro(
color: Colors.white,
fontSize: 18,
fontWeight: FontWeight.w600,
letterSpacing: 0.50,
);
return style!.textStyle ??
GoogleFonts.sourceSansPro(
color: Colors.black.smartColor(darkMode),
fontSize: 18,
fontWeight: FontWeight.w600,
letterSpacing: 0.50,
);
}
}
2 changes: 0 additions & 2 deletions lib/src/buttons/custom_auth_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class CustomAuthButton extends AuthButton {
required VoidCallback onPressed,
VoidCallback? onLongPress,
required String text,
TextStyle? textStyle,
required this.icon,
bool darkMode = false,
bool rtl = false,
Expand All @@ -23,7 +22,6 @@ class CustomAuthButton extends AuthButton {
onPressed: onPressed,
onLongPress: onLongPress,
text: text,
textStyle: textStyle,
darkMode: darkMode,
rtl: rtl,
isLoading: isLoading,
Expand Down
28 changes: 14 additions & 14 deletions lib/src/buttons/email_auth_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class EmailAuthButton extends AuthButton {
required VoidCallback onPressed,
VoidCallback? onLongPress,
String text = 'Sign in with Email',
TextStyle? textStyle,
bool darkMode = false,
bool rtl = false,
bool isLoading = false,
Expand All @@ -25,7 +24,6 @@ class EmailAuthButton extends AuthButton {
onPressed: onPressed,
onLongPress: onLongPress,
text: text,
textStyle: textStyle,
darkMode: darkMode,
rtl: rtl,
isLoading: isLoading,
Expand Down Expand Up @@ -63,18 +61,20 @@ class EmailAuthButton extends AuthButton {
TextStyle getTextStyle() {
if (style!.iconType == AuthIconType.secondary &&
style!.buttonType != AuthButtonType.secondary)
return TextStyle(
color: darkMode ? Colors.white : Colors.teal[900],
fontSize: 18,
fontWeight: FontWeight.bold,
letterSpacing: 0.50,
);
return const TextStyle(
color: Colors.white,
fontSize: 18,
fontWeight: FontWeight.bold,
letterSpacing: 0.50,
);
return style!.textStyle ??
TextStyle(
color: darkMode ? Colors.white : Colors.teal[900],
fontSize: 18,
fontWeight: FontWeight.bold,
letterSpacing: 0.50,
);
return style!.textStyle ??
const TextStyle(
color: Colors.white,
fontSize: 18,
fontWeight: FontWeight.bold,
letterSpacing: 0.50,
);
}

@override
Expand Down
6 changes: 2 additions & 4 deletions lib/src/buttons/facebook_auth_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class FacebookAuthButton extends AuthButton {
required VoidCallback onPressed,
VoidCallback? onLongPress,
String text = 'Sign in with Facebook',
TextStyle? textStyle,
bool darkMode = false,
bool rtl = false,
bool isLoading = false,
Expand All @@ -25,7 +24,6 @@ class FacebookAuthButton extends AuthButton {
onPressed: onPressed,
onLongPress: onLongPress,
text: text,
textStyle: textStyle,
darkMode: darkMode,
rtl: rtl,
isLoading: isLoading,
Expand Down Expand Up @@ -65,14 +63,14 @@ class FacebookAuthButton extends AuthButton {
TextStyle getTextStyle() {
if (style!.iconType == AuthIconType.secondary &&
style!.buttonType != AuthButtonType.secondary)
return textStyle ??
return style!.textStyle ??
TextStyle(
color: darkMode ? Colors.white : Colors.blue[800],
fontSize: 18,
fontWeight: FontWeight.bold,
letterSpacing: 0.50,
);
return textStyle ??
return style!.textStyle ??
const TextStyle(
color: Colors.white,
fontSize: 18,
Expand Down
15 changes: 7 additions & 8 deletions lib/src/buttons/github_auth_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class GithubAuthButton extends AuthButton {
required VoidCallback onPressed,
VoidCallback? onLongPress,
String text = 'Sign in with Github',
TextStyle? textStyle,
bool darkMode = false,
bool rtl = false,
bool isLoading = false,
Expand All @@ -25,7 +24,6 @@ class GithubAuthButton extends AuthButton {
onPressed: onPressed,
onLongPress: onLongPress,
text: text,
textStyle: textStyle,
darkMode: darkMode,
rtl: rtl,
isLoading: isLoading,
Expand Down Expand Up @@ -61,12 +59,13 @@ class GithubAuthButton extends AuthButton {

@override
TextStyle getTextStyle() {
return const TextStyle(
color: Colors.white,
fontSize: 18,
fontWeight: FontWeight.bold,
letterSpacing: 0.50,
);
return style!.textStyle ??
const TextStyle(
color: Colors.white,
fontSize: 18,
fontWeight: FontWeight.bold,
letterSpacing: 0.50,
);
}

@override
Expand Down
6 changes: 2 additions & 4 deletions lib/src/buttons/google_auth_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class GoogleAuthButton extends AuthButton {
required VoidCallback onPressed,
VoidCallback? onLongPress,
String text = 'Sign in with Google',
TextStyle? textStyle,
bool darkMode = false,
bool rtl = false,
bool isLoading = false,
Expand All @@ -27,7 +26,6 @@ class GoogleAuthButton extends AuthButton {
onPressed: onPressed,
onLongPress: onLongPress,
text: text,
textStyle: textStyle,
darkMode: darkMode,
rtl: rtl,
isLoading: isLoading,
Expand Down Expand Up @@ -80,14 +78,14 @@ class GoogleAuthButton extends AuthButton {
@override
TextStyle getTextStyle() {
if (style!.buttonType == AuthButtonType.secondary)
return textStyle ??
return style!.textStyle ??
GoogleFonts.roboto(
color: Colors.white,
fontSize: 18,
fontWeight: FontWeight.w500,
letterSpacing: 0.50,
);
return textStyle ??
return style!.textStyle ??
GoogleFonts.roboto(
color: Colors.black.smartColor(darkMode),
fontSize: 18,
Expand Down
4 changes: 1 addition & 3 deletions lib/src/buttons/huawei_auth_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class HuaweiAuthButton extends AuthButton {
required VoidCallback onPressed,
VoidCallback? onLongPress,
String text = 'Sign in with Huawei',
TextStyle? textStyle,
bool darkMode = false,
bool rtl = false,
bool isLoading = false,
Expand All @@ -25,7 +24,6 @@ class HuaweiAuthButton extends AuthButton {
onPressed: onPressed,
onLongPress: onLongPress,
text: text,
textStyle: textStyle,
darkMode: darkMode,
rtl: rtl,
isLoading: isLoading,
Expand Down Expand Up @@ -70,7 +68,7 @@ class HuaweiAuthButton extends AuthButton {
fontWeight: FontWeight.bold,
letterSpacing: 0.50,
);
return textStyle ??
return style!.textStyle ??
const TextStyle(
color: Colors.white,
fontSize: 18,
Expand Down
13 changes: 6 additions & 7 deletions lib/src/buttons/microsoft_auth_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ class MicrosoftAuthButton extends AuthButton {
required VoidCallback onPressed,
VoidCallback? onLongPress,
String text = 'Sign in with Microsoft',
TextStyle? textStyle,
bool darkMode = false,
bool rtl = false,
bool isLoading = false,
Expand All @@ -26,7 +25,6 @@ class MicrosoftAuthButton extends AuthButton {
onPressed: onPressed,
onLongPress: onLongPress,
text: text,
textStyle: textStyle,
darkMode: darkMode,
rtl: rtl,
isLoading: isLoading,
Expand Down Expand Up @@ -88,10 +86,11 @@ class MicrosoftAuthButton extends AuthButton {
TextStyle getTextStyle() {
//Note: Microsoft uses the Segoe UI fonts,
// but is not available in google fonts for the moment (26/10/2021).
return GoogleFonts.lato(
color: darkMode ? Colors.white : Color(0xff5e5e5e),
fontSize: 16.0,
fontWeight: FontWeight.w600,
);
return style!.textStyle ??
GoogleFonts.lato(
color: darkMode ? Colors.white : Color(0xff5e5e5e),
fontSize: 16.0,
fontWeight: FontWeight.w600,
);
}
}
4 changes: 1 addition & 3 deletions lib/src/buttons/twitter_auth_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class TwitterAuthButton extends AuthButton {
required VoidCallback onPressed,
VoidCallback? onLongPress,
String text = 'Sign in with Twitter',
TextStyle? textStyle,
bool darkMode = false,
bool rtl = false,
bool isLoading = false,
Expand All @@ -25,7 +24,6 @@ class TwitterAuthButton extends AuthButton {
onPressed: onPressed,
onLongPress: onLongPress,
text: text,
textStyle: textStyle,
darkMode: darkMode,
rtl: rtl,
isLoading: isLoading,
Expand Down Expand Up @@ -71,7 +69,7 @@ class TwitterAuthButton extends AuthButton {

@override
TextStyle getTextStyle() {
return textStyle ??
return style!.textStyle ??
const TextStyle(
color: Colors.white,
fontSize: 18,
Expand Down
6 changes: 2 additions & 4 deletions lib/src/shared/base/contracts/base_auth_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,12 @@ abstract class BaseAuthButton extends AuthButtonStyleButton {
bool darkMode = false,
bool isLoading = false,
bool rtl = false,
TextStyle? textStyle,
}) : super(
key: key,
onPressed: onPressed,
onLongPress: onLongPress,
style: style ?? const AuthButtonStyle(),
text: text,
textStyle: textStyle,
darkMode: darkMode,
isLoading: isLoading,
rtl: rtl,
Expand All @@ -46,14 +44,14 @@ abstract class BaseAuthButton extends AuthButtonStyleButton {
@override
TextStyle getTextStyle() {
if (style!.buttonType == AuthButtonType.secondary)
return textStyle ??
return style!.textStyle ??
const TextStyle(
color: Colors.white,
fontSize: 18,
fontWeight: FontWeight.bold,
letterSpacing: 0.50,
);
return textStyle ??
return style!.textStyle ??
TextStyle(
color: darkMode ? Colors.white : Colors.black,
fontSize: 18,
Expand Down
22 changes: 11 additions & 11 deletions lib/src/shared/base/widgets/auth_button_secondary.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ class AuthButtonSecondary extends AuthTypeButton {
required this.textStyle,
required this.iconBackground,
}) : super(
onPressed: onPressed,
onLongPress: onLongPress,
style: style,
darkMode: darkMode,
isLoading: isLoading,
rtl: rtl,
iconUrl: iconUrl,
buttonColor: buttonColor,
progressIndicatorValueColor: progressIndicatorValueColor,
);
onPressed: onPressed,
onLongPress: onLongPress,
style: style,
darkMode: darkMode,
isLoading: isLoading,
rtl: rtl,
iconUrl: iconUrl,
buttonColor: buttonColor,
progressIndicatorValueColor: progressIndicatorValueColor,
);

final String text;
final TextStyle textStyle;
Expand Down Expand Up @@ -63,8 +63,8 @@ class AuthButtonSecondary extends AuthTypeButton {
darkMode: darkMode,
rtl: rtl,
isLoading: isLoading,
textStyle: getTextStyle(),
style: AuthButtonStyle(
textStyle: getTextStyle(),
iconSize: style!.iconSize,
separator: style!.separator,
borderRadius: style!.borderRadius,
Expand Down
2 changes: 1 addition & 1 deletion lib/src/shared/base/widgets/auth_default_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ class AuthDefaultButton extends AuthTypeButton {
darkMode: darkMode,
rtl: rtl,
isLoading: isLoading,
textStyle: getTextStyle(),
style: AuthButtonStyle(
textStyle: getTextStyle(),
iconSize: style!.iconSize,
separator: style!.separator,
progressIndicatorColor: style!.progressIndicatorColor,
Expand Down
Loading

0 comments on commit b8448f4

Please sign in to comment.