fluffychat/lib/pages/connect/sso_button.dart

63 lines
1.9 KiB
Dart
Raw Normal View History

2022-04-15 11:42:59 +02:00
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:matrix/matrix.dart';
import 'package:fluffychat/pages/connect/connect_page.dart';
import 'package:fluffychat/widgets/matrix.dart';
class SsoButton extends StatelessWidget {
final IdentityProvider identityProvider;
final void Function()? onPressed;
const SsoButton({
Key? key,
required this.identityProvider,
this.onPressed,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return InkWell(
onTap: onPressed,
borderRadius: BorderRadius.circular(7),
child: Padding(
2022-07-07 18:50:13 +02:00
padding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 6.0),
2022-04-15 11:42:59 +02:00
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
Material(
color: Colors.white,
2022-07-07 18:50:13 +02:00
borderRadius: BorderRadius.circular(8),
2022-04-15 11:42:59 +02:00
clipBehavior: Clip.hardEdge,
child: Padding(
2022-07-07 18:50:13 +02:00
padding: const EdgeInsets.all(4.0),
2022-04-15 11:42:59 +02:00
child: identityProvider.icon == null
? const Icon(Icons.web_outlined)
: Image.network(
Uri.parse(identityProvider.icon!)
2022-04-15 11:42:59 +02:00
.getDownloadLink(
Matrix.of(context).getLoginClient())
.toString(),
width: 32,
height: 32,
),
),
),
const SizedBox(height: 8),
Text(
identityProvider.name ??
identityProvider.brand ??
L10n.of(context)!.singlesignon,
style: const TextStyle(
fontSize: 12,
fontWeight: FontWeight.bold,
),
),
],
),
),
);
}
}