FluoSignInStyle.native constructor
FluoSignInStyle.native({
- ThemeData? appTheme,
- Color? backgroundColor,
- EdgeInsets? padding,
- Color? backButtonColor,
- TextStyle? titleTextStyle,
- TextStyle? inputTextStyle,
- InputDecorationTheme? inputDecorationTheme,
- TextAlignVertical? inputTextAlignVertical,
- TextStyle? inputErrorTextStyle,
- PinTheme? codeInputThemeDefault,
- PinTheme? codeInputThemeFocused,
- PinTheme? codeInputThemeSubmitted,
- PinTheme? codeInputThemeFollowing,
- PinTheme? codeInputThemeDisabled,
- PinTheme? codeInputThemeError,
- ButtonStyle? continueButtonStyle,
- Size? continueButtonProgressIndicatorSize,
- Color? continueButtonProgressIndicatorColor,
- double? continueButtonProgressIndicatorStrokeWidth,
- EdgeInsets? countryItemPadding,
- Color? countryItemHighlightColor,
- TextStyle? countryTextStyle,
Creates a FluoSignInStyle with native mobile defaults.
Implementation
factory FluoSignInStyle.native({
ThemeData? appTheme,
Color? backgroundColor,
EdgeInsets? padding,
Color? backButtonColor,
TextStyle? titleTextStyle,
TextStyle? inputTextStyle,
InputDecorationTheme? inputDecorationTheme,
TextAlignVertical? inputTextAlignVertical,
TextStyle? inputErrorTextStyle,
PinTheme? codeInputThemeDefault,
PinTheme? codeInputThemeFocused,
PinTheme? codeInputThemeSubmitted,
PinTheme? codeInputThemeFollowing,
PinTheme? codeInputThemeDisabled,
PinTheme? codeInputThemeError,
ButtonStyle? continueButtonStyle,
Size? continueButtonProgressIndicatorSize,
Color? continueButtonProgressIndicatorColor,
double? continueButtonProgressIndicatorStrokeWidth,
EdgeInsets? countryItemPadding,
Color? countryItemHighlightColor,
TextStyle? countryTextStyle,
}) {
final primaryColor = appTheme?.colorScheme.primary ?? Colors.black;
final inversePrimaryColor =
appTheme?.colorScheme.inversePrimary ?? Colors.white;
backgroundColor ??= appTheme?.scaffoldBackgroundColor ?? Colors.white;
padding ??= const EdgeInsets.all(20.0);
backButtonColor ??= primaryColor;
titleTextStyle ??= appTheme?.textTheme.headlineSmall ??
TextStyle(
fontSize: 20,
fontWeight: FontWeight.w600,
color: primaryColor,
);
inputTextStyle ??= appTheme?.textTheme.titleLarge ??
const TextStyle(
fontSize: 17,
fontWeight: FontWeight.w600,
);
inputDecorationTheme ??= (appTheme?.inputDecorationTheme.copyWith(
hintStyle: appTheme.inputDecorationTheme.hintStyle ??
inputTextStyle.copyWith(
color: primaryColor.withAlpha(255 ~/ 3),
),
suffixIconConstraints:
appTheme.inputDecorationTheme.suffixIconConstraints ??
const BoxConstraints(
maxHeight: 32,
maxWidth: 32 + 10 + 15,
),
) as InputDecorationTheme?) ??
InputDecorationTheme(
fillColor: inversePrimaryColor.withAlpha(255 ~/ 2),
filled: true,
isDense: true,
contentPadding: const EdgeInsets.symmetric(
vertical: 15.0,
horizontal: 20.0,
),
hintStyle: inputTextStyle.copyWith(
color: primaryColor.withAlpha(255 ~/ 3),
),
border: const OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(8)),
),
suffixIconConstraints: const BoxConstraints(
maxHeight: 32,
maxWidth: 32 + 10 + 15,
),
);
inputTextAlignVertical ??= TextAlignVertical.center;
inputErrorTextStyle ??= appTheme?.inputDecorationTheme.errorStyle ??
TextStyle(
fontSize: 15,
color: Colors.red.shade500,
);
codeInputThemeDefault ??= PinTheme(
width: 54.0,
height: 64.0,
textStyle: const TextStyle(
fontSize: 30.0,
fontWeight: FontWeight.w600,
),
decoration: BoxDecoration(
border: Border.all(
width: 1.5,
color: primaryColor,
),
borderRadius: BorderRadius.circular(10.0),
),
);
codeInputThemeFocused ??= codeInputThemeDefault.copyDecorationWith(
border: Border.all(
width: 2,
color: primaryColor,
),
);
codeInputThemeFollowing ??= codeInputThemeDefault.copyDecorationWith(
border: Border.all(
width: 1.5,
color: primaryColor,
),
);
continueButtonStyle ??= appTheme?.filledButtonTheme.style ??
ButtonStyle(
splashFactory: NoSplash.splashFactory,
backgroundColor: WidgetStateProperty.resolveWith((states) {
return states.contains(WidgetState.pressed)
? Colors.grey.shade300
: Colors.grey.shade200;
}),
foregroundColor: WidgetStateProperty.resolveWith((states) {
return states.contains(WidgetState.disabled)
? primaryColor.withAlpha(255 ~/ 4)
: primaryColor;
}),
textStyle: WidgetStateProperty.all(
const TextStyle(
fontSize: 17,
fontWeight: FontWeight.w600,
),
),
minimumSize: WidgetStateProperty.all(const Size.fromHeight(54)),
mouseCursor: WidgetStateProperty.all(SystemMouseCursors.click),
shape: WidgetStateProperty.all(RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
side: BorderSide.none,
)),
);
final focusedState = <WidgetState>{WidgetState.focused};
final textStyle = continueButtonStyle.textStyle?.resolve(focusedState);
final fontSize = textStyle?.fontSize ?? 17;
continueButtonProgressIndicatorSize ??= Size(fontSize, fontSize);
final textColor =
continueButtonStyle.foregroundColor?.resolve(focusedState);
continueButtonProgressIndicatorColor ??= textColor ?? Colors.black;
continueButtonProgressIndicatorStrokeWidth ??= 2.0;
countryItemPadding ??= const EdgeInsets.symmetric(
horizontal: 20.0,
vertical: 15.0,
);
countryItemHighlightColor ??= primaryColor.withAlpha(255 ~/ 16);
countryTextStyle ??= const TextStyle(
fontSize: 17,
fontWeight: FontWeight.w600,
);
return FluoSignInStyle(
backgroundColor: backgroundColor,
padding: padding,
backButtonColor: backButtonColor,
titleTextStyle: titleTextStyle,
inputTextStyle: inputTextStyle,
inputDecorationTheme: inputDecorationTheme,
inputTextAlignVertical: inputTextAlignVertical,
inputErrorTextStyle: inputErrorTextStyle,
codeInputThemeDefault: codeInputThemeDefault,
codeInputThemeFocused: codeInputThemeFocused,
codeInputThemeSubmitted: codeInputThemeSubmitted,
codeInputThemeFollowing: codeInputThemeFollowing,
codeInputThemeDisabled: codeInputThemeDisabled,
codeInputThemeError: codeInputThemeError,
continueButtonStyle: continueButtonStyle,
continueButtonProgressIndicatorSize: continueButtonProgressIndicatorSize,
continueButtonProgressIndicatorColor: continueButtonProgressIndicatorColor,
continueButtonProgressIndicatorStrokeWidth:
continueButtonProgressIndicatorStrokeWidth,
countryItemPadding: countryItemPadding,
countryItemHighlightColor: countryItemHighlightColor,
countryTextStyle: countryTextStyle,
);
}