2022-02-03 10:06:44 -06:00
|
|
|
import 'package:auto_route/auto_route.dart';
|
2022-07-07 20:40:54 +02:00
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
2022-02-03 10:06:44 -06:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
2022-04-24 21:33:10 -05:00
|
|
|
import 'package:hive/hive.dart';
|
2022-02-03 10:06:44 -06:00
|
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
2022-04-24 21:33:10 -05:00
|
|
|
import 'package:immich_mobile/constants/hive_box.dart';
|
|
|
|
import 'package:immich_mobile/modules/login/models/hive_saved_login_info.model.dart';
|
2022-11-20 11:43:10 -06:00
|
|
|
import 'package:immich_mobile/modules/login/providers/oauth.provider.dart';
|
2022-06-27 15:13:07 -05:00
|
|
|
import 'package:immich_mobile/routing/router.dart';
|
2022-11-20 11:43:10 -06:00
|
|
|
import 'package:immich_mobile/shared/providers/api.provider.dart';
|
2022-04-23 21:08:45 -05:00
|
|
|
import 'package:immich_mobile/shared/providers/asset.provider.dart';
|
2022-02-03 10:06:44 -06:00
|
|
|
import 'package:immich_mobile/modules/login/providers/authentication.provider.dart';
|
2022-05-06 07:22:23 -05:00
|
|
|
import 'package:immich_mobile/modules/backup/providers/backup.provider.dart';
|
2022-02-04 17:20:23 -06:00
|
|
|
import 'package:immich_mobile/shared/ui/immich_toast.dart';
|
2022-11-20 11:43:10 -06:00
|
|
|
import 'package:openapi/api.dart';
|
2022-02-03 10:06:44 -06:00
|
|
|
|
|
|
|
class LoginForm extends HookConsumerWidget {
|
|
|
|
const LoginForm({Key? key}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
2022-06-25 15:12:47 -05:00
|
|
|
final usernameController =
|
|
|
|
useTextEditingController.fromValue(TextEditingValue.empty);
|
|
|
|
final passwordController =
|
|
|
|
useTextEditingController.fromValue(TextEditingValue.empty);
|
|
|
|
final serverEndpointController =
|
2022-07-13 07:23:48 -05:00
|
|
|
useTextEditingController(text: 'login_form_endpoint_hint'.tr());
|
2022-11-20 11:43:10 -06:00
|
|
|
final apiService = ref.watch(apiServiceProvider);
|
|
|
|
final serverEndpointFocusNode = useFocusNode();
|
2022-04-24 21:33:10 -05:00
|
|
|
final isSaveLoginInfo = useState<bool>(false);
|
2022-11-20 11:43:10 -06:00
|
|
|
final isLoading = useState<bool>(false);
|
|
|
|
final isOauthEnable = useState<bool>(false);
|
|
|
|
final oAuthButtonLabel = useState<String>('OAuth');
|
|
|
|
|
|
|
|
getServeLoginConfig() async {
|
|
|
|
if (!serverEndpointFocusNode.hasFocus) {
|
|
|
|
var urlText = serverEndpointController.text.trim();
|
|
|
|
|
|
|
|
try {
|
|
|
|
var endpointUrl = Uri.tryParse(urlText);
|
|
|
|
|
|
|
|
if (endpointUrl != null) {
|
|
|
|
isLoading.value = true;
|
|
|
|
apiService.setEndpoint(endpointUrl.toString());
|
|
|
|
var loginConfig = await apiService.oAuthApi.generateConfig(
|
|
|
|
OAuthConfigDto(redirectUri: endpointUrl.toString()),
|
|
|
|
);
|
|
|
|
|
|
|
|
if (loginConfig != null) {
|
|
|
|
isOauthEnable.value = loginConfig.enabled;
|
|
|
|
oAuthButtonLabel.value = loginConfig.buttonText ?? 'OAuth';
|
|
|
|
} else {
|
|
|
|
isOauthEnable.value = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
isLoading.value = false;
|
|
|
|
}
|
|
|
|
} catch (_) {
|
|
|
|
isLoading.value = false;
|
|
|
|
isOauthEnable.value = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-04-24 21:33:10 -05:00
|
|
|
|
2022-07-13 07:23:48 -05:00
|
|
|
useEffect(
|
|
|
|
() {
|
2022-11-20 11:43:10 -06:00
|
|
|
serverEndpointFocusNode.addListener(getServeLoginConfig);
|
|
|
|
|
2022-07-13 07:23:48 -05:00
|
|
|
var loginInfo = Hive.box<HiveSavedLoginInfo>(hiveLoginInfoBox)
|
|
|
|
.get(savedLoginInfoKey);
|
|
|
|
|
|
|
|
if (loginInfo != null) {
|
|
|
|
usernameController.text = loginInfo.email;
|
|
|
|
passwordController.text = loginInfo.password;
|
|
|
|
serverEndpointController.text = loginInfo.serverUrl;
|
|
|
|
isSaveLoginInfo.value = loginInfo.isSaveLogin;
|
|
|
|
}
|
|
|
|
|
2022-11-20 11:43:10 -06:00
|
|
|
getServeLoginConfig();
|
2022-07-13 07:23:48 -05:00
|
|
|
return null;
|
|
|
|
},
|
|
|
|
[],
|
|
|
|
);
|
2022-02-03 10:06:44 -06:00
|
|
|
|
2022-11-30 10:58:07 -06:00
|
|
|
populateTestLoginInfo() {
|
|
|
|
usernameController.text = 'testuser@email.com';
|
|
|
|
passwordController.text = 'password';
|
|
|
|
serverEndpointController.text = 'http://10.1.15.216:2283/api';
|
|
|
|
isSaveLoginInfo.value = true;
|
|
|
|
}
|
|
|
|
|
2022-02-03 10:06:44 -06:00
|
|
|
return Center(
|
|
|
|
child: ConstrainedBox(
|
|
|
|
constraints: const BoxConstraints(maxWidth: 300),
|
2022-02-13 15:10:42 -06:00
|
|
|
child: SingleChildScrollView(
|
2022-12-22 14:29:48 -06:00
|
|
|
child: AutofillGroup(
|
2022-12-20 16:10:31 +01:00
|
|
|
child: Wrap(
|
|
|
|
spacing: 16,
|
|
|
|
runSpacing: 16,
|
|
|
|
alignment: WrapAlignment.center,
|
|
|
|
children: [
|
|
|
|
GestureDetector(
|
|
|
|
onDoubleTap: () => populateTestLoginInfo(),
|
|
|
|
child: const Image(
|
|
|
|
image: AssetImage('assets/immich-logo-no-outline.png'),
|
|
|
|
width: 100,
|
|
|
|
filterQuality: FilterQuality.high,
|
|
|
|
),
|
2022-07-13 07:23:48 -05:00
|
|
|
),
|
2022-12-20 16:10:31 +01:00
|
|
|
Text(
|
|
|
|
'IMMICH',
|
2022-06-25 15:12:47 -05:00
|
|
|
style: TextStyle(
|
2022-12-20 16:10:31 +01:00
|
|
|
fontFamily: 'SnowburstOne',
|
2022-07-13 07:23:48 -05:00
|
|
|
fontWeight: FontWeight.bold,
|
2022-12-20 16:10:31 +01:00
|
|
|
fontSize: 48,
|
|
|
|
color: Theme.of(context).primaryColor,
|
2022-07-13 07:23:48 -05:00
|
|
|
),
|
2022-12-20 16:10:31 +01:00
|
|
|
),
|
|
|
|
EmailInput(controller: usernameController),
|
|
|
|
PasswordInput(controller: passwordController),
|
|
|
|
ServerEndpointInput(
|
|
|
|
controller: serverEndpointController,
|
|
|
|
focusNode: serverEndpointFocusNode,
|
|
|
|
),
|
|
|
|
CheckboxListTile(
|
|
|
|
activeColor: Theme.of(context).primaryColor,
|
|
|
|
contentPadding: const EdgeInsets.symmetric(horizontal: 8),
|
|
|
|
dense: true,
|
|
|
|
side: const BorderSide(color: Colors.grey, width: 1.5),
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
borderRadius: BorderRadius.circular(5),
|
2022-11-20 11:43:10 -06:00
|
|
|
),
|
2022-12-20 16:10:31 +01:00
|
|
|
enableFeedback: true,
|
|
|
|
title: const Text(
|
|
|
|
"login_form_save_login",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 16,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
color: Colors.grey,
|
|
|
|
),
|
|
|
|
).tr(),
|
|
|
|
value: isSaveLoginInfo.value,
|
|
|
|
onChanged: (switchValue) {
|
|
|
|
if (switchValue != null) {
|
|
|
|
isSaveLoginInfo.value = switchValue;
|
|
|
|
}
|
|
|
|
},
|
2022-11-20 11:43:10 -06:00
|
|
|
),
|
2022-12-20 16:10:31 +01:00
|
|
|
if (isLoading.value)
|
|
|
|
const SizedBox(
|
|
|
|
width: 24,
|
|
|
|
height: 24,
|
|
|
|
child: CircularProgressIndicator(
|
|
|
|
strokeWidth: 2,
|
2022-11-20 11:43:10 -06:00
|
|
|
),
|
2022-12-20 16:10:31 +01:00
|
|
|
),
|
|
|
|
if (!isLoading.value)
|
|
|
|
Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
LoginButton(
|
|
|
|
emailController: usernameController,
|
|
|
|
passwordController: passwordController,
|
2022-11-20 11:43:10 -06:00
|
|
|
serverEndpointController: serverEndpointController,
|
|
|
|
isSavedLoginInfo: isSaveLoginInfo.value,
|
|
|
|
),
|
2022-12-20 16:10:31 +01:00
|
|
|
if (isOauthEnable.value) ...[
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.symmetric(
|
|
|
|
horizontal: 16.0,
|
|
|
|
),
|
|
|
|
child: Divider(
|
2022-12-22 14:29:48 -06:00
|
|
|
color:
|
|
|
|
Brightness.dark == Theme.of(context).brightness
|
|
|
|
? Colors.white
|
|
|
|
: Colors.black,
|
2022-12-20 16:10:31 +01:00
|
|
|
),
|
|
|
|
),
|
|
|
|
OAuthLoginButton(
|
|
|
|
serverEndpointController: serverEndpointController,
|
|
|
|
isSavedLoginInfo: isSaveLoginInfo.value,
|
|
|
|
buttonLabel: oAuthButtonLabel.value,
|
|
|
|
isLoading: isLoading,
|
|
|
|
onLoginSuccess: () {
|
|
|
|
isLoading.value = false;
|
|
|
|
ref.watch(backupProvider.notifier).resumeBackup();
|
|
|
|
AutoRouter.of(context).replace(
|
|
|
|
const TabControllerRoute(),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
],
|
2022-11-20 11:43:10 -06:00
|
|
|
],
|
2022-12-20 16:10:31 +01:00
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
2022-02-13 15:10:42 -06:00
|
|
|
),
|
2022-02-03 10:06:44 -06:00
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class ServerEndpointInput extends StatelessWidget {
|
|
|
|
final TextEditingController controller;
|
2022-11-20 11:43:10 -06:00
|
|
|
final FocusNode focusNode;
|
|
|
|
const ServerEndpointInput({
|
|
|
|
Key? key,
|
|
|
|
required this.controller,
|
|
|
|
required this.focusNode,
|
|
|
|
}) : super(key: key);
|
2022-02-03 10:06:44 -06:00
|
|
|
|
2022-06-12 05:12:20 +02:00
|
|
|
String? _validateInput(String? url) {
|
2022-07-01 10:08:49 +09:00
|
|
|
if (url?.startsWith(RegExp(r'https?://')) == true) {
|
2022-06-27 15:13:07 -05:00
|
|
|
return null;
|
2022-07-01 10:08:49 +09:00
|
|
|
} else {
|
2022-07-07 20:40:54 +02:00
|
|
|
return 'login_form_err_http'.tr();
|
2022-06-27 15:13:07 -05:00
|
|
|
}
|
2022-06-12 05:12:20 +02:00
|
|
|
}
|
|
|
|
|
2022-02-03 10:06:44 -06:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return TextFormField(
|
|
|
|
controller: controller,
|
2022-07-07 20:40:54 +02:00
|
|
|
decoration: InputDecoration(
|
|
|
|
labelText: 'login_form_endpoint_url'.tr(),
|
2022-07-13 07:23:48 -05:00
|
|
|
border: const OutlineInputBorder(),
|
2022-07-07 20:40:54 +02:00
|
|
|
hintText: 'login_form_endpoint_hint'.tr(),
|
2022-06-27 15:13:07 -05:00
|
|
|
),
|
2022-06-12 05:12:20 +02:00
|
|
|
validator: _validateInput,
|
|
|
|
autovalidateMode: AutovalidateMode.always,
|
2022-11-20 11:43:10 -06:00
|
|
|
focusNode: focusNode,
|
2022-12-20 16:10:31 +01:00
|
|
|
autofillHints: const [AutofillHints.url],
|
|
|
|
keyboardType: TextInputType.url,
|
2022-12-22 14:29:48 -06:00
|
|
|
autocorrect: false,
|
2022-02-03 10:06:44 -06:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class EmailInput extends StatelessWidget {
|
|
|
|
final TextEditingController controller;
|
|
|
|
|
|
|
|
const EmailInput({Key? key, required this.controller}) : super(key: key);
|
|
|
|
|
2022-06-12 05:12:20 +02:00
|
|
|
String? _validateInput(String? email) {
|
|
|
|
if (email == null || email == '') return null;
|
2022-07-07 20:40:54 +02:00
|
|
|
if (email.endsWith(' ')) return 'login_form_err_trailing_whitespace'.tr();
|
|
|
|
if (email.startsWith(' ')) return 'login_form_err_leading_whitespace'.tr();
|
2022-07-13 07:23:48 -05:00
|
|
|
if (email.contains(' ') || !email.contains('@')) {
|
2022-07-07 20:40:54 +02:00
|
|
|
return 'login_form_err_invalid_email'.tr();
|
2022-07-13 07:23:48 -05:00
|
|
|
}
|
2022-06-12 05:12:20 +02:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2022-02-03 10:06:44 -06:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return TextFormField(
|
|
|
|
controller: controller,
|
2022-07-07 20:40:54 +02:00
|
|
|
decoration: InputDecoration(
|
|
|
|
labelText: 'login_form_label_email'.tr(),
|
2022-07-13 07:23:48 -05:00
|
|
|
border: const OutlineInputBorder(),
|
2022-07-07 20:40:54 +02:00
|
|
|
hintText: 'login_form_email_hint'.tr(),
|
2022-06-27 15:13:07 -05:00
|
|
|
),
|
2022-06-12 05:12:20 +02:00
|
|
|
validator: _validateInput,
|
|
|
|
autovalidateMode: AutovalidateMode.always,
|
2022-12-20 16:10:31 +01:00
|
|
|
autofillHints: const [AutofillHints.email],
|
|
|
|
keyboardType: TextInputType.emailAddress,
|
2022-02-03 10:06:44 -06:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class PasswordInput extends StatelessWidget {
|
|
|
|
final TextEditingController controller;
|
|
|
|
|
|
|
|
const PasswordInput({Key? key, required this.controller}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return TextFormField(
|
|
|
|
obscureText: true,
|
|
|
|
controller: controller,
|
2022-07-07 20:40:54 +02:00
|
|
|
decoration: InputDecoration(
|
2022-07-13 07:23:48 -05:00
|
|
|
labelText: 'login_form_label_password'.tr(),
|
|
|
|
border: const OutlineInputBorder(),
|
|
|
|
hintText: 'login_form_password_hint'.tr(),
|
|
|
|
),
|
2022-12-20 16:10:31 +01:00
|
|
|
autofillHints: const [AutofillHints.password],
|
|
|
|
keyboardType: TextInputType.text,
|
2022-02-03 10:06:44 -06:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class LoginButton extends ConsumerWidget {
|
|
|
|
final TextEditingController emailController;
|
|
|
|
final TextEditingController passwordController;
|
|
|
|
final TextEditingController serverEndpointController;
|
2022-04-24 21:33:10 -05:00
|
|
|
final bool isSavedLoginInfo;
|
2022-02-03 10:06:44 -06:00
|
|
|
|
2022-04-24 21:33:10 -05:00
|
|
|
const LoginButton({
|
|
|
|
Key? key,
|
|
|
|
required this.emailController,
|
|
|
|
required this.passwordController,
|
|
|
|
required this.serverEndpointController,
|
|
|
|
required this.isSavedLoginInfo,
|
|
|
|
}) : super(key: key);
|
2022-02-03 10:06:44 -06:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
2022-11-20 11:43:10 -06:00
|
|
|
return ElevatedButton.icon(
|
2022-07-13 07:23:48 -05:00
|
|
|
style: ElevatedButton.styleFrom(
|
2022-11-20 11:43:10 -06:00
|
|
|
padding: const EdgeInsets.symmetric(vertical: 12),
|
2022-07-13 07:23:48 -05:00
|
|
|
),
|
|
|
|
onPressed: () async {
|
|
|
|
// This will remove current cache asset state of previous user login.
|
|
|
|
ref.watch(assetProvider.notifier).clearAllAsset();
|
|
|
|
|
|
|
|
var isAuthenticated =
|
|
|
|
await ref.watch(authenticationProvider.notifier).login(
|
|
|
|
emailController.text,
|
|
|
|
passwordController.text,
|
|
|
|
serverEndpointController.text,
|
|
|
|
isSavedLoginInfo,
|
|
|
|
);
|
|
|
|
|
|
|
|
if (isAuthenticated) {
|
|
|
|
// Resume backup (if enable) then navigate
|
|
|
|
|
|
|
|
if (ref.watch(authenticationProvider).shouldChangePassword &&
|
|
|
|
!ref.watch(authenticationProvider).isAdmin) {
|
|
|
|
AutoRouter.of(context).push(const ChangePasswordRoute());
|
2022-02-03 10:06:44 -06:00
|
|
|
} else {
|
2022-07-13 07:23:48 -05:00
|
|
|
ref.watch(backupProvider.notifier).resumeBackup();
|
2022-10-17 13:04:17 -05:00
|
|
|
AutoRouter.of(context).replace(const TabControllerRoute());
|
2022-02-03 10:06:44 -06:00
|
|
|
}
|
2022-07-13 07:23:48 -05:00
|
|
|
} else {
|
|
|
|
ImmichToast.show(
|
|
|
|
context: context,
|
|
|
|
msg: "login_form_failed_login".tr(),
|
|
|
|
toastType: ToastType.error,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
},
|
2022-11-20 11:43:10 -06:00
|
|
|
icon: const Icon(Icons.login_rounded),
|
|
|
|
label: const Text(
|
2022-07-13 07:23:48 -05:00
|
|
|
"login_form_button_text",
|
|
|
|
style: TextStyle(fontSize: 14, fontWeight: FontWeight.bold),
|
|
|
|
).tr(),
|
|
|
|
);
|
2022-02-03 10:06:44 -06:00
|
|
|
}
|
|
|
|
}
|
2022-11-20 11:43:10 -06:00
|
|
|
|
|
|
|
class OAuthLoginButton extends ConsumerWidget {
|
|
|
|
final TextEditingController serverEndpointController;
|
|
|
|
final bool isSavedLoginInfo;
|
|
|
|
final ValueNotifier<bool> isLoading;
|
|
|
|
final VoidCallback onLoginSuccess;
|
|
|
|
final String buttonLabel;
|
|
|
|
|
|
|
|
const OAuthLoginButton({
|
|
|
|
Key? key,
|
|
|
|
required this.serverEndpointController,
|
|
|
|
required this.isSavedLoginInfo,
|
|
|
|
required this.isLoading,
|
|
|
|
required this.onLoginSuccess,
|
|
|
|
required this.buttonLabel,
|
|
|
|
}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
2022-11-21 06:13:14 -06:00
|
|
|
var oAuthService = ref.watch(oAuthServiceProvider);
|
2022-11-20 11:43:10 -06:00
|
|
|
|
|
|
|
void performOAuthLogin() async {
|
|
|
|
ref.watch(assetProvider.notifier).clearAllAsset();
|
|
|
|
OAuthConfigResponseDto? oAuthServerConfig;
|
|
|
|
|
|
|
|
try {
|
|
|
|
oAuthServerConfig = await oAuthService
|
|
|
|
.getOAuthServerConfig(serverEndpointController.text);
|
|
|
|
|
|
|
|
isLoading.value = true;
|
|
|
|
} catch (e) {
|
|
|
|
ImmichToast.show(
|
|
|
|
context: context,
|
|
|
|
msg: "login_form_failed_get_oauth_server_config".tr(),
|
|
|
|
toastType: ToastType.error,
|
|
|
|
);
|
|
|
|
isLoading.value = false;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (oAuthServerConfig != null && oAuthServerConfig.enabled) {
|
|
|
|
var loginResponseDto =
|
|
|
|
await oAuthService.oAuthLogin(oAuthServerConfig.url!);
|
|
|
|
|
|
|
|
if (loginResponseDto != null) {
|
|
|
|
var isSuccess = await ref
|
|
|
|
.watch(authenticationProvider.notifier)
|
|
|
|
.setSuccessLoginInfo(
|
|
|
|
accessToken: loginResponseDto.accessToken,
|
|
|
|
isSavedLoginInfo: isSavedLoginInfo,
|
2022-11-21 05:29:43 -06:00
|
|
|
serverUrl: serverEndpointController.text,
|
2022-11-20 11:43:10 -06:00
|
|
|
);
|
|
|
|
|
|
|
|
if (isSuccess) {
|
|
|
|
isLoading.value = false;
|
|
|
|
onLoginSuccess();
|
|
|
|
} else {
|
|
|
|
ImmichToast.show(
|
|
|
|
context: context,
|
|
|
|
msg: "login_form_failed_login".tr(),
|
|
|
|
toastType: ToastType.error,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
isLoading.value = false;
|
|
|
|
} else {
|
|
|
|
ImmichToast.show(
|
|
|
|
context: context,
|
|
|
|
msg: "login_form_failed_get_oauth_server_disable".tr(),
|
|
|
|
toastType: ToastType.info,
|
|
|
|
);
|
|
|
|
isLoading.value = false;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return ElevatedButton.icon(
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
backgroundColor: Theme.of(context).primaryColor.withAlpha(230),
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 12),
|
|
|
|
),
|
|
|
|
onPressed: performOAuthLogin,
|
|
|
|
icon: const Icon(Icons.pin_rounded),
|
|
|
|
label: Text(
|
|
|
|
buttonLabel,
|
|
|
|
style: const TextStyle(fontSize: 14, fontWeight: FontWeight.bold),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|