mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-24 13:09:24 +01:00
65 lines
2.0 KiB
Dart
65 lines
2.0 KiB
Dart
|
import 'package:flutter/material.dart';
|
||
|
|
||
|
import 'package:cached_network_image/cached_network_image.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(
|
||
|
padding: const EdgeInsets.symmetric(horizontal: 12.0, vertical: 8.0),
|
||
|
child: Column(
|
||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||
|
mainAxisSize: MainAxisSize.min,
|
||
|
children: [
|
||
|
Material(
|
||
|
color: Colors.white,
|
||
|
borderRadius: BorderRadius.circular(7),
|
||
|
clipBehavior: Clip.hardEdge,
|
||
|
child: Padding(
|
||
|
padding: const EdgeInsets.all(2.0),
|
||
|
child: identityProvider.icon == null
|
||
|
? const Icon(Icons.web_outlined)
|
||
|
: CachedNetworkImage(
|
||
|
imageUrl: Uri.parse(identityProvider.icon!)
|
||
|
.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,
|
||
|
color: Colors.white,
|
||
|
),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
}
|