OidcButton function

Widget OidcButton({
  1. required BuildContext context,
  2. required OidcProvider oidcProvider,
})

Implementation

Widget OidcButton({
  required BuildContext context,
  required OidcProvider oidcProvider,
}) {
  return Padding(
    padding: const EdgeInsets.only(bottom: 5),
    child: SizedBox(
      height: Theme.of(context).buttonTheme.height - 5,
      child: ElevatedButton(
        style: Theme.of(context).elevatedButtonTheme.style?.copyWith(
              backgroundColor: MaterialStateProperty.all<Color>(
                  Theme.of(context).dividerColor),
            ),
        onPressed: () => {
          Hera.loginWithOidc(
                  type: oidcProvider.type, authorizationUrl: oidcProvider.url)
        },
        child: Row(
          crossAxisAlignment: CrossAxisAlignment.center,
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            SvgPicture.network(
              oidcProvider.logo,
              width: 25,
              placeholderBuilder: (context) {
                return Image(
                  image: NetworkImage(oidcProvider.logo),
                  height: 25,
                );
              },
            ),
            SizedBox(
              width: 5,
            ),
            Text(
              oidcProvider.name,
              textAlign: TextAlign.center,
              style: Theme.of(context).textTheme.bodyLarge?.copyWith(
                    color: Theme.of(context).disabledColor,
                    fontWeight: FontWeight.w500,
                    fontSize: 14,
                  ),
            ),
          ],
        ),
      ),
    ),
  );
}