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

refactor: common button #170

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 31,10 @@ class CheckSeedPhrasePage extends StatelessWidget {
child: Scaffold(
appBar: DefaultAppBar(
actions: [
CommonButton.ghost(
padding: EdgeInsets.zero,
SimpleButton(
buttonType: EverButtonType.ghost,
height: DimensSize.d44,
style: StyleRes.smallButton,
text: LocaleKeys.skipWord.tr(),
onPressed: () => _navigateToPassword(context),
),
Expand Down
6 changes: 4 additions & 2 deletions lib/feature/browser/bottom_menu/browser_bottom_menu_tabs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 27,8 @@ class BrowserBottomMenuTabs extends StatelessWidget {
children: [
Expanded(
child: Center(
child: SmallButton.ghost(
child: CommonButton.ghost(
size: CommonButtonSize.small,
text: LocaleKeys.browserCloseAll.tr(),
onPressed: onCloseAllPressed,
),
Expand All @@ -44,7 45,8 @@ class BrowserBottomMenuTabs extends StatelessWidget {
),
Expanded(
child: Center(
child: SmallButton.ghost(
child: CommonButton.ghost(
size: CommonButtonSize.small,
text: LocaleKeys.browserDone.tr(),
onPressed: onDonePressed,
),
Expand Down
3 changes: 2 additions & 1 deletion lib/feature/onboarding/view/change_language_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 11,8 @@ class ChangeLanguageButton extends StatelessWidget {
Widget build(BuildContext context) {
return BlocBuilder<LocalizationBloc, LocalizationState>(
builder: (context, state) {
return SmallButton.secondary(
return CommonButton.secondary(
size: CommonButtonSize.medium,
leading: CommonButtonIconWidget.svg(
svg: state.localeCode.iconPath,
useDefaultColor: false,
Expand Down
1 change: 0 additions & 1 deletion lib/feature/profile/view/profile_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 126,6 @@ class ProfileView extends StatelessWidget {
),
const SizedBox(height: DimensSize.d40),
CommonButton(
padding: const EdgeInsets.symmetric(horizontal: DimensSize.d24),
buttonType: EverButtonType.ghost,
contentColor: colors.alert,
onPressed: () =>
Expand Down
293 changes: 152 additions & 141 deletions packages/ui_components_lib/example/lib/stories/buttons.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,105 24,160 @@ class _ButtonsStoryState extends State<ButtonsStory> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
/// Primary
CommonButton.primary(
leading: CommonButtonIconWidget.icon(icon: Icons.add),
trailing: CommonButtonIconWidget.icon(icon: Icons.alarm),
text: 'PrimaryButton',
// ignore: no-empty-block
onPressed: () {},
),
const SizedBox(height: 10),
CommonButton.primary(
leading: CommonButtonIconWidget.icon(icon: Icons.add),
trailing: CommonButtonIconWidget.icon(icon: Icons.alarm),
text: 'PrimaryButton Disabled',
),
const SizedBox(height: 10),
CommonButton.primary(
leading: CommonButtonIconWidget.icon(icon: Icons.add),
trailing: CommonButtonIconWidget.icon(icon: Icons.alarm),
text: 'PrimaryButton fillWidth',
fillWidth: true,
// ignore: no-empty-block
onPressed: () {},
),
const SizedBox(height: 10),
CommonButton.primary(
leading: CommonButtonIconWidget.icon(icon: Icons.add),
trailing: CommonButtonIconWidget.icon(icon: Icons.alarm),
text: 'PrimaryButton',
// ignore: no-empty-block
onPressed: () {},
isLoading: true,
),
const SizedBox(height: 20),

/// Secondary
CommonButton.secondary(
leading: CommonButtonIconWidget.icon(icon: Icons.add),
trailing: CommonButtonIconWidget.icon(icon: Icons.alarm),
text: 'SecondaryButton',
// ignore: no-empty-block
onPressed: () {},
),
const SizedBox(height: 10),
CommonButton.secondary(
leading: CommonButtonIconWidget.icon(icon: Icons.add),
trailing: CommonButtonIconWidget.icon(icon: Icons.alarm),
text: 'SecondaryButton Disabled',
),
const SizedBox(height: 10),
CommonButton.secondary(
leading: CommonButtonIconWidget.icon(icon: Icons.add),
trailing: CommonButtonIconWidget.icon(icon: Icons.alarm),
text: 'SecondaryButton fillWidth',
fillWidth: true,
// ignore: no-empty-block
onPressed: () {},
),
const SizedBox(height: 10),
CommonButton.secondary(
leading: CommonButtonIconWidget.icon(icon: Icons.add),
trailing: CommonButtonIconWidget.icon(icon: Icons.alarm),
text: 'SecondaryButton',
// ignore: no-empty-block
onPressed: () {},
isLoading: true,
),

/// Ghost
const SizedBox(height: 20),
CommonButton.ghost(
leading: CommonButtonIconWidget.icon(icon: Icons.add),
trailing: CommonButtonIconWidget.icon(icon: Icons.alarm),
text: 'GhostButton',
// ignore: no-empty-block
onPressed: () {},
),
const SizedBox(height: 10),
CommonButton.ghost(
leading: CommonButtonIconWidget.icon(icon: Icons.add),
trailing: CommonButtonIconWidget.icon(icon: Icons.alarm),
text: 'GhostButton Disabled',
SeparatedColumn(
children: CommonButtonSize.values
.map(
(size) => SeparatedRow(
children: [
/// Primary
CommonButton.primary(
leading:
CommonButtonIconWidget.icon(icon: Icons.add),
trailing:
CommonButtonIconWidget.icon(icon: Icons.alarm),
text: 'PrimaryButton',
// ignore: no-empty-block
onPressed: () {},
size: size,
),
CommonButton.primary(
leading:
CommonButtonIconWidget.icon(icon: Icons.add),
trailing:
CommonButtonIconWidget.icon(icon: Icons.alarm),
text: 'PrimaryButton Disabled',
size: size,
),
CommonButton.primary(
leading:
CommonButtonIconWidget.icon(icon: Icons.add),
trailing:
CommonButtonIconWidget.icon(icon: Icons.alarm),
text: 'PrimaryButton fillWidth',
fillWidth: true,
// ignore: no-empty-block
onPressed: () {},
size: size,
),
CommonButton.primary(
leading:
CommonButtonIconWidget.icon(icon: Icons.add),
trailing:
CommonButtonIconWidget.icon(icon: Icons.alarm),
text: 'PrimaryButton',
// ignore: no-empty-block
onPressed: () {},
isLoading: true,
size: size,
),
],
),
)
.toList(),
),
const SizedBox(height: 10),
CommonButton.ghost(
leading: CommonButtonIconWidget.icon(icon: Icons.add),
trailing: CommonButtonIconWidget.icon(icon: Icons.alarm),
text: 'GhostButton fillWidth',
fillWidth: true,
// ignore: no-empty-block
onPressed: () {},
const SizedBox(height: 16),
SeparatedColumn(
children: CommonButtonSize.values
.map(
(size) => SeparatedRow(
children: [
/// Secondary
CommonButton.secondary(
leading:
CommonButtonIconWidget.icon(icon: Icons.add),
trailing:
CommonButtonIconWidget.icon(icon: Icons.alarm),
text: 'SecondaryButton',
// ignore: no-empty-block
onPressed: () {},
size: size,
),
CommonButton.secondary(
leading:
CommonButtonIconWidget.icon(icon: Icons.add),
trailing:
CommonButtonIconWidget.icon(icon: Icons.alarm),
text: 'SecondaryButton Disabled',
size: size,
),
CommonButton.secondary(
leading:
CommonButtonIconWidget.icon(icon: Icons.add),
trailing:
CommonButtonIconWidget.icon(icon: Icons.alarm),
text: 'SecondaryButton fillWidth',
fillWidth: true,
// ignore: no-empty-block
onPressed: () {},
size: size,
),
CommonButton.secondary(
leading:
CommonButtonIconWidget.icon(icon: Icons.add),
trailing:
CommonButtonIconWidget.icon(icon: Icons.alarm),
text: 'SecondaryButton',
// ignore: no-empty-block
onPressed: () {},
isLoading: true,
size: size,
),
],
),
)
.toList(),
),
const SizedBox(height: 10),
CommonButton.ghost(
leading: CommonButtonIconWidget.icon(icon: Icons.add),
trailing: CommonButtonIconWidget.icon(icon: Icons.alarm),
text: 'GhostButton',
// ignore: no-empty-block
onPressed: () {},
isLoading: true,
const SizedBox(height: 16),
SeparatedColumn(
children: CommonButtonSize.values
.map(
(size) => SeparatedRow(
children: [
/// Ghost
CommonButton.ghost(
leading:
CommonButtonIconWidget.icon(icon: Icons.add),
trailing:
CommonButtonIconWidget.icon(icon: Icons.alarm),
text: 'GhostButton',
// ignore: no-empty-block
onPressed: () {},
size: size,
),
CommonButton.ghost(
leading:
CommonButtonIconWidget.icon(icon: Icons.add),
trailing:
CommonButtonIconWidget.icon(icon: Icons.alarm),
text: 'GhostButton Disabled',
size: size,
),
CommonButton.ghost(
leading:
CommonButtonIconWidget.icon(icon: Icons.add),
trailing:
CommonButtonIconWidget.icon(icon: Icons.alarm),
text: 'GhostButton fillWidth',
fillWidth: true,
// ignore: no-empty-block
onPressed: () {},
size: size,
),
CommonButton.ghost(
leading:
CommonButtonIconWidget.icon(icon: Icons.add),
trailing:
CommonButtonIconWidget.icon(icon: Icons.alarm),
text: 'GhostButton',
// ignore: no-empty-block
onPressed: () {},
isLoading: true,
size: size,
),
],
),
)
.toList(),
),

/// TabBar
Expand Down Expand Up @@ -208,50 263,6 @@ class _ButtonsStoryState extends State<ButtonsStory> {
)
.toList(),
),

/// Small button
const SizedBox(height: 30),
SmallButton.primary(
leading: CommonButtonIconWidget.icon(icon: Icons.add),
trailing: CommonButtonIconWidget.icon(icon: Icons.alarm),
text: 'SmallPrimary',
// ignore: no-empty-block
onPressed: () {},
),
const SizedBox(height: 10),
SmallButton.primary(
leading: CommonButtonIconWidget.icon(icon: Icons.add),
trailing: CommonButtonIconWidget.icon(icon: Icons.alarm),
text: 'SmallPrimary Disabled',
),
const SizedBox(height: 20),
SmallButton.secondary(
leading: CommonButtonIconWidget.icon(icon: Icons.add),
trailing: CommonButtonIconWidget.icon(icon: Icons.alarm),
text: 'SmallSecondary',
// ignore: no-empty-block
onPressed: () {},
),
const SizedBox(height: 10),
SmallButton.secondary(
leading: CommonButtonIconWidget.icon(icon: Icons.add),
trailing: CommonButtonIconWidget.icon(icon: Icons.alarm),
text: 'SmallSecondary Disabled',
),
const SizedBox(height: 20),
SmallButton.ghost(
leading: CommonButtonIconWidget.icon(icon: Icons.add),
trailing: CommonButtonIconWidget.icon(icon: Icons.alarm),
text: 'SmallGhost',
// ignore: no-empty-block
onPressed: () {},
),
const SizedBox(height: 10),
SmallButton.ghost(
leading: CommonButtonIconWidget.icon(icon: Icons.add),
trailing: CommonButtonIconWidget.icon(icon: Icons.alarm),
text: 'SmallGhost Disabled',
),
],
),
),
Expand Down
13 changes: 2 additions & 11 deletions packages/ui_components_lib/example/lib/stories/common.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 59,7 @@ class _CommonStoryState extends State<CommonStory> {
subtitleBottomText: 'BottomSubtitle',
actions: [
CommonButton(
height: appBarButtonSize,
size: CommonButtonSize.medium,
fillWidth: false,
buttonType: EverButtonType.ghost,
text: 'Action',
Expand All @@ -80,18 80,9 @@ class _CommonStoryState extends State<CommonStory> {
centerTitle: false,
titleText: 'Not centered title',
subtitleTopText: 'TopSubtitle',
subtitleBottomWidget: CommonButton(
height: DimensSize.d20,
padding: EdgeInsets.zero,
buttonType: EverButtonType.ghost,
fillWidth: false,
text: 'SubtitleBottom button',
// ignore: no-empty-block
onPressed: () {},
),
actions: [
CommonButton(
height: appBarButtonSize,
size: CommonButtonSize.medium,
fillWidth: false,
buttonType: EverButtonType.ghost,
text: 'Action',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 5,5 @@ export 'common_button_icon.dart';
export 'common_icon_button.dart';
export 'press_ink_widget.dart';
export 'press_scale_widget.dart';
export 'small_button.dart';
export 'simple_button.dart';
export 'tab_bar.dart';
Loading