feat(auth): Issue-691

This commit is contained in:
mso7nueh
2025-09-24 23:47:11 +03:00
parent 052c4fedca
commit fc09fa36b8
4 changed files with 194 additions and 57 deletions

View File

@@ -169,51 +169,51 @@ class _AuthScreenState extends State<AuthScreen> {
],
),
// const SizedBox(height: 16),
// Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// _SocialButton(
// onTap: _onVkPressed,
// backgroundColor: const Color(0xFF2787F5),
// tooltip: 'VK ID',
// child: SvgPicture.asset(
// 'assets/icons/vk.svg',
// height: 24,
// width: 24,
// colorFilter: const ColorFilter.mode(Colors.white, BlendMode.srcIn),
// ),
// ),
// _SocialButton(
// onTap: _onOkPressed,
// backgroundColor: const Color(0xFFF58220),
// tooltip: 'Одноклассники',
// child: SvgPicture.asset(
// 'assets/icons/ok.svg',
// height: 24,
// width: 24,
// colorFilter: const ColorFilter.mode(Colors.white, BlendMode.srcIn),
// ),
// ),
// const _SocialButton(
// onTap: _onMailRuPressed,
// backgroundColor: Color(0xFF005FF9),
// tooltip: 'Mail.ru',
// child: Text(
// 'Mail',
// style: TextStyle(color: Colors.white, fontWeight: FontWeight.w700),
// ),
// ),
// const _SocialButton(
// onTap: _onYandexPressed,
// backgroundColor: Color(0xFFFFCC00),
// tooltip: 'Яндекс ID',
// child: Text(
// 'Yandex',
// style: TextStyle(color: Colors.black, fontWeight: FontWeight.w700),
// ),
// ),
// ],
// ),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
_SocialButton(
onTap: () => _onVkPressed(context),
backgroundColor: const Color(0xFF2787F5),
tooltip: 'VK ID',
child: SvgPicture.asset(
'assets/icons/vk.svg',
height: 24,
width: 24,
colorFilter: const ColorFilter.mode(Colors.white, BlendMode.srcIn),
),
),
_SocialButton(
onTap: _onOkPressed,
backgroundColor: const Color(0xFFF58220),
tooltip: 'Одноклассники',
child: SvgPicture.asset(
'assets/icons/ok.svg',
height: 24,
width: 24,
colorFilter: const ColorFilter.mode(Colors.white, BlendMode.srcIn),
),
),
const _SocialButton(
onTap: _onMailRuPressed,
backgroundColor: Color(0xFF005FF9),
tooltip: 'Mail.ru',
child: Text(
'Mail',
style: TextStyle(color: Colors.white, fontWeight: FontWeight.w700),
),
),
const _SocialButton(
onTap: _onYandexPressed,
backgroundColor: Color(0xFFFFCC00),
tooltip: 'Яндекс ID',
child: Text(
'Yandex',
style: TextStyle(color: Colors.black, fontWeight: FontWeight.w700),
),
),
],
),
const Spacer(),
Center(
child: RichText(
@@ -395,8 +395,8 @@ class _SocialButton extends StatelessWidget {
}
// ignore: unused_element
void _onVkPressed() async {
final accessToken = await SocialAuthFacade.signInWithVk();
void _onVkPressed(BuildContext context) async {
final accessToken = await SocialAuthFacade.signInWithVk(context: context);
if (accessToken == null) return;
final isAuthenticated = await sl<AuthCubit>().getTokenBySocial(provider: 'vk', accessToken: accessToken);
if (isAuthenticated) {