Skip to content

Commit

Permalink
refactor: extract learn more button
Browse files Browse the repository at this point in the history
  • Loading branch information
damian-molinski committed Sep 25, 2024
1 parent 9b2e325 commit ecd135e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:catalyst_voices/pages/account/creation/task_picture.dart';
import 'package:catalyst_voices/widgets/buttons/voices_text_button.dart';
import 'package:catalyst_voices/widgets/buttons/voices_buttons.dart';
import 'package:catalyst_voices/widgets/modals/voices_desktop_dialog.dart';
import 'package:catalyst_voices/widgets/modals/voices_dialog.dart';
import 'package:catalyst_voices_assets/catalyst_voices_assets.dart';
Expand Down Expand Up @@ -65,15 +65,8 @@ class _LeftPanel extends StatelessWidget {
const SizedBox(height: 12),
const Expanded(child: Center(child: TaskKeychainPicture())),
const SizedBox(height: 32),
Row(
children: [
VoicesTextButton(
onTap: () {},
trailing: VoicesAssets.icons.externalLink.buildIcon(),
child: Text(context.l10n.learnMore),
),
],
),
// TODO(damian-molinski): External url redirect
LearnMoreButton(onTap: () {}),
],
);
}
Expand Down
20 changes: 20 additions & 0 deletions catalyst_voices/lib/widgets/buttons/voices_buttons.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import 'dart:async';

import 'package:catalyst_voices/widgets/buttons/voices_icon_button.dart';
import 'package:catalyst_voices/widgets/buttons/voices_text_button.dart';
import 'package:catalyst_voices_assets/catalyst_voices_assets.dart';
import 'package:catalyst_voices_localization/catalyst_voices_localization.dart';
import 'package:flutter/material.dart';

class DrawerToggleButton extends StatelessWidget {
Expand Down Expand Up @@ -146,3 +148,21 @@ class MoreOptionsButton extends StatelessWidget {
);
}
}

class LearnMoreButton extends StatelessWidget {
final VoidCallback? onTap;

const LearnMoreButton({
super.key,
this.onTap,
});

@override
Widget build(BuildContext context) {
return VoicesTextButton(
onTap: onTap,
trailing: VoicesAssets.icons.externalLink.buildIcon(),
child: Text(context.l10n.learnMore),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';

/// Manages the user session.
final class SessionBloc extends Bloc<SessionEvent, SessionState> {
SessionBloc()
: super(
const VisitorSessionState(),
// const ActiveUserSessionState(
// user: User(name: 'Account'),
// ),
) {
SessionBloc() : super(const VisitorSessionState()) {
on<SessionEvent>(_handleSessionEvent);
}

Expand Down

0 comments on commit ecd135e

Please sign in to comment.