From 93d064a9b0eb58ab94db88ff727a877ef773c0d8 Mon Sep 17 00:00:00 2001 From: fufesou Date: Wed, 17 Jun 2026 14:36:53 +0800 Subject: [PATCH] refact(oidc): icon azure to microsoft (#15278) * refact(oidc): icon azure to microsoft Signed-off-by: fufesou * Simple refactor Signed-off-by: fufesou * refact: oidc, remove unused auth-azure.svg Signed-off-by: fufesou --------- Signed-off-by: fufesou --- flutter/assets/auth-azure.svg | 1 - flutter/lib/common/widgets/login.dart | 41 +++++++++++++++++++++------ 2 files changed, 33 insertions(+), 9 deletions(-) delete mode 100644 flutter/assets/auth-azure.svg diff --git a/flutter/assets/auth-azure.svg b/flutter/assets/auth-azure.svg deleted file mode 100644 index b7435604d..000000000 --- a/flutter/assets/auth-azure.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/flutter/lib/common/widgets/login.dart b/flutter/lib/common/widgets/login.dart index ee376de68..319171895 100644 --- a/flutter/lib/common/widgets/login.dart +++ b/flutter/lib/common/widgets/login.dart @@ -24,6 +24,35 @@ const kOpSvgList = [ 'microsoft' ]; +class _OidcProviderBranding { + final String label; + final String iconKey; + + const _OidcProviderBranding({ + required this.label, + required this.iconKey, + }); +} + +_OidcProviderBranding _oidcProviderBranding(String op) { + switch (op.toLowerCase()) { + case 'azure': + return _OidcProviderBranding( + label: 'Microsoft', + iconKey: 'microsoft', + ); + default: + return _OidcProviderBranding( + label: { + 'github': 'GitHub', + 'gitlab': 'GitLab', + }[op.toLowerCase()] ?? + toCapitalized(op), + iconKey: op.toLowerCase(), + ); + } +} + class _IconOP extends StatelessWidget { final String op; final String? icon; @@ -74,11 +103,8 @@ class ButtonOP extends StatelessWidget { @override Widget build(BuildContext context) { - final opLabel = { - 'github': 'GitHub', - 'gitlab': 'GitLab' - }[op.toLowerCase()] ?? - toCapitalized(op); + final branding = _oidcProviderBranding(op); + final buttonLabel = translate("Continue with {${branding.label}}"); return Row(children: [ Container( height: height, @@ -95,7 +121,7 @@ class ButtonOP extends StatelessWidget { SizedBox( width: 30, child: _IconOP( - op: op, + op: branding.iconKey, icon: icon, margin: EdgeInsets.only(right: 5), ), @@ -103,8 +129,7 @@ class ButtonOP extends StatelessWidget { Expanded( child: FittedBox( fit: BoxFit.scaleDown, - child: Center( - child: Text(translate("Continue with {$opLabel}"))), + child: Center(child: Text(buttonLabel)), ), ), ],