Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redesign Auth page #29

Merged
merged 28 commits into from
Jul 29, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,14 @@ jobs:

- run: sudo apt-get update -y
if: ${{ matrix.platform == 'linux' }}
- run: sudo apt-get install -y
- run: sudo apt-get install -y --allow-downgrades
ninja-build
libunwind-dev
libgtk-3-dev
libgstreamer1.0-dev
libgstreamer-plugins-base1.0-dev
libpulse-dev
libudev1=249.11-0ubuntu3
if: ${{ matrix.platform == 'linux' }}

- run: flutter config --enable-${{ matrix.platform }}-desktop
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,17 @@ All user visible changes to this project will be documented in this file. This p
- UI:
- Chat page:
- Missing avatars in group creation popup ([#15], [#2]).

### Changed
andrigel marked this conversation as resolved.
Show resolved Hide resolved

- UI:
- Auth page:
- New auth page design ([#29])

[#2]: /../../issues/2
[#14]: /../../pull/14
[#15]: /../../pull/15
[#29]: /../../pull/29



Expand Down
Binary file added assets/images/logo/logo.riv
Binary file not shown.
2 changes: 1 addition & 1 deletion lib/l10n/en_us.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ final Map<String, String> enUS = {
'btn_resend_code': 'Resend confirmation code',
'btn_saved_messages': 'Saved messages',
'btn_settings': 'Settings',
'btn_start_chatting': 'Start chatting',
'btn_start': 'Start',
'btn_submit': 'Submit',
'btn_video_call': 'Video call',
'btn_write_message': 'Write a message',
Expand Down
2 changes: 1 addition & 1 deletion lib/l10n/ru_ru.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ final Map<String, String> ruRU = {
'btn_resend_code': 'Отправить код ещё раз',
'btn_saved_messages': 'Сохранённые сообщения',
'btn_settings': 'Настройки',
'btn_start_chatting': 'Начать общение',
'btn_start': 'Начать',
'btn_submit': 'Применить',
'btn_your_profile': 'Ваш профиль',
'btn_write_message': 'Написать сообщение',
Expand Down
41 changes: 41 additions & 0 deletions lib/ui/page/auth/controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@

import 'dart:async';

import 'package:flutter/widgets.dart' show GlobalKey;
import 'package:get/get.dart';
import 'package:rive/rive.dart';

import '/domain/service/auth.dart';
import '/l10n/_l10n.dart';
import '/routes.dart';
import '/util/message_popup.dart';

Expand All @@ -34,12 +37,48 @@ class AuthController extends GetxController {
/// Current logo's animation frame.
RxInt logoFrame = RxInt(0);

/// Index number of selected language.
late final RxInt selectedLanguage;

/// Prevents instant language change after the user has set
/// [selectedLanguage].
late final Worker _languageDebounce;

/// A trigger of blink logo animation.
SMITrigger? blink;

/// [GlobalKey] of an animated button used to share it between overlays.
final GlobalKey languageKey = GlobalKey();

/// Timer that periodically increases [logoFrame].
Timer? _animationTimer;

/// Returns user authentication status.
Rx<RxStatus> get authStatus => _auth.status;

@override
void onInit() {
selectedLanguage = RxInt(L10n.languages.keys.toList().indexOf(L10n.chosen));
_languageDebounce = debounce(
selectedLanguage,
(int i) {
L10n.chosen = L10n.languages.keys.elementAt(i);
Get.updateLocale(L10n.locales[L10n.chosen]!);
},
time: 500.milliseconds,
);

super.onInit();
}

@override
void onClose() {
_animationTimer?.cancel();
blink?.controller.dispose();
andrigel marked this conversation as resolved.
Show resolved Hide resolved
_languageDebounce.dispose();
super.onClose();
}

@override
void onReady() => Future.delayed(const Duration(milliseconds: 500), animate);

Expand All @@ -56,6 +95,8 @@ class AuthController extends GetxController {

/// Resets the [logoFrame] and starts the animation.
void animate() {
blink?.fire();

logoFrame.value = 1;
_animationTimer?.cancel();
_animationTimer = Timer.periodic(const Duration(milliseconds: 45), (t) {
Expand Down
Loading