Skip to content

Commit

Permalink
chore: changes after review
Browse files Browse the repository at this point in the history
  • Loading branch information
ice-hades committed Jul 29, 2024
1 parent f5b7563 commit 0a5a3d7
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 20 deletions.
4 changes: 2 additions & 2 deletions lib/app/components/button/button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ class Button extends StatelessWidget {
Color? backgroundColor,
double? leadingIconOffset,
double? trailingIconOffset,
bool? useDefaultBorderRadius,
bool? useDefaultPaddings,
bool useDefaultBorderRadius,
bool useDefaultPaddings,
bool disabled,
bool opened,
}) = _ButtonDropdown;
Expand Down
8 changes: 4 additions & 4 deletions lib/app/components/button/variants/button_dropdown.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ class _ButtonDropdown extends Button {
double? trailingIconOffset,
bool opened = false,
ButtonStyle style = const ButtonStyle(),
bool? useDefaultBorderRadius = false,
bool? useDefaultPaddings = false,
bool useDefaultBorderRadius = false,
bool useDefaultPaddings = false,
}) : super(
type: ButtonType.dropdown,
style: style.merge(
OutlinedButton.styleFrom(
shape: useDefaultBorderRadius == false
shape: useDefaultBorderRadius == true
? null
: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(12.0.s)),
),
minimumSize: Size.square(40.0.s),
padding: useDefaultPaddings == false
padding: useDefaultPaddings == true
? null
: leadingIcon != null
? EdgeInsets.only(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import 'dart:math';

import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:ice/app/components/screen_offset/screen_bottom_offset.dart';
Expand All @@ -19,7 +17,6 @@ class RestoreMenuPage extends HookWidget {

@override
Widget build(BuildContext context) {
final count = useState(Random().nextInt(3) + 1);
final hideKeyboardAndCallOnce = useHideKeyboardAndCallOnce();
return SheetContent(
body: AuthScrollContainer(
Expand All @@ -45,7 +42,7 @@ class RestoreMenuPage extends HookWidget {
description: context.i18n.restore_identity_type_credentials_description,
onPressed: () {
hideKeyboardAndCallOnce(
callback: () => TwoFaOptionsRoute($extra: count.value).push<void>(context),
callback: () => TwoFaOptionsRoute().push<void>(context),
);
},
),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import 'dart:math';

int get2FAOptionsNumber() {
return Random().nextInt(3) + 1;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,22 @@ import 'package:ice/app/extensions/num.dart';
import 'package:ice/app/features/auth/data/models/twofa_type.dart';
import 'package:ice/app/features/auth/views/components/auth_footer/auth_footer.dart';
import 'package:ice/app/features/auth/views/components/auth_scrolled_body/auth_scrolled_body.dart';
import 'package:ice/app/features/auth/views/pages/twofa_options/mock_data/mock.dart';
import 'package:ice/app/features/auth/views/pages/twofa_options/twofa_option_selector.dart';
import 'package:ice/app/router/app_routes.dart';
import 'package:ice/app/router/components/sheet_content/sheet_content.dart';
import 'package:ice/generated/assets.gen.dart';

class TwoFaOptionsPage extends HookWidget {
const TwoFaOptionsPage({required this.optionsNumber, super.key});

final int optionsNumber;
const TwoFaOptionsPage({super.key});

@override
Widget build(BuildContext context) {
final optionsNumber = useState(get2FAOptionsNumber());
final formKey = useRef(GlobalKey<FormState>());
final selectedValues = {for (int i = 0; i < optionsNumber; i++) i: useState<TwoFaType?>(null)};
final selectedValues = {
for (int i = 0; i < optionsNumber.value; i++) i: useState<TwoFaType?>(null)
};
final availableOptions = useState<Set<TwoFaType>>(TwoFaType.values.toSet());

return SheetContent(
Expand All @@ -39,7 +41,7 @@ class TwoFaOptionsPage extends HookWidget {
child: Column(
children: [
SizedBox(height: 16.0.s),
...List.generate(optionsNumber, (i) {
...List.generate(optionsNumber.value, (i) {
return Padding(
padding: EdgeInsets.only(bottom: 16.0.s),
child: TwoFaOptionSelector(
Expand Down
4 changes: 2 additions & 2 deletions lib/app/router/app_routes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import 'package:ice/app/features/auth/views/pages/select_languages/select_langua
import 'package:ice/app/features/auth/views/pages/sign_up_passkey/sign_up_passkey.dart';
import 'package:ice/app/features/auth/views/pages/sign_up_password/sign_up_password.dart';
import 'package:ice/app/features/auth/views/pages/turn_on_notifications/turn_on_notifications.dart';
import 'package:ice/app/features/auth/views/pages/twofa_codes/twofa_codes.dart';
import 'package:ice/app/features/auth/views/pages/twofa_options/twofa_options.dart';
import 'package:ice/app/features/auth/views/pages/twofa_codes/twofa_codes_page.dart';
import 'package:ice/app/features/auth/views/pages/twofa_options/twofa_options_page.dart';
import 'package:ice/app/features/chat/views/pages/chat_main_modal/chat_main_modal_page.dart';
import 'package:ice/app/features/chat/views/pages/chat_page/chat_page.dart';
import 'package:ice/app/features/core/views/pages/error_page.dart';
Expand Down
5 changes: 2 additions & 3 deletions lib/app/router/auth_routes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,11 @@ class TwoFaCodesRoute extends BaseRouteData {
}

class TwoFaOptionsRoute extends BaseRouteData {
TwoFaOptionsRoute({required this.$extra})
TwoFaOptionsRoute()
: super(
child: TwoFaOptionsPage(optionsNumber: $extra),
child: TwoFaOptionsPage(),
type: IceRouteType.bottomSheet,
);
final int $extra;
}

class SelectLanguagesRoute extends BaseRouteData {
Expand Down

0 comments on commit 0a5a3d7

Please sign in to comment.