buildSigninBtn static method

Widget buildSigninBtn({
  1. required BuildContext context,
  2. required Widget icon,
  3. required String text,
  4. required dynamic onClick(),
  5. required Color containerColor,
  6. required Color textColor,
  7. Color borderColor = LoginColors.lightGreyColor,
})

Implementation

static Widget buildSigninBtn({
  required BuildContext context,
  required Widget icon,
  required String text,
  required Function() onClick,
  required Color containerColor,
  required Color textColor,
  Color borderColor = LoginColors.lightGreyColor,
  }) {

  LoginThemeData? loginThemeData = LoginTheme.of(context);
  LoginButtonThemeData loginButtonThemeData =
      loginThemeData?.loginButtonThemeData ??
          LoginButtonThemeData.roundedRectangle(borderColor: borderColor);

  return ElevatedButton(
    style: ElevatedButton.styleFrom(
      backgroundColor: containerColor,
      padding: const EdgeInsets.symmetric(horizontal: 16),
      shape: const RoundedRectangleBorder(
        borderRadius: BorderRadius.all(Radius.circular(25)),
      ),
    ).merge(
      ButtonStyle(elevation: MaterialStateProperty.resolveWith<double>((Set<MaterialState> states) {
        if (states.contains(MaterialState.pressed)) return loginButtonThemeData.elevation ?? 0;
        return 0;
      })),
    ),
    onPressed: () {
      onClick.call();
    },
    child: _buildButtonContent(icon, text, textColor),
  );
}