Skip to content

Commit

Permalink
fix(btbutton): limitação de tamanhos disponíveis para os botões
Browse files Browse the repository at this point in the history
  • Loading branch information
vitoramaral10 committed Apr 14, 2023
1 parent 8c6b0c7 commit de9f7a5
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/components/bt_alert.dart
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class BTAlert extends StatelessWidget {
),
if (dismissPressed != null)
InkWell(
onTap : dismissPressed,
onTap: dismissPressed,
child: Icon(
Icons.close,
color: _getTextColor(),
Expand Down
12 changes: 10 additions & 2 deletions lib/components/buttons/bt_button.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
part of get_bootstrap;

class BTButton extends StatelessWidget {
static bool checkSizes(Size? size) {
if (size != null && ![Size.sm, Size.lg, Size.md].contains(size)) {
throw 'O parâmetro "size" somente pode ser utilizado com os tamanhos: sm, md, lg';
}

return true;
}

final Widget child;
final Size? size;
final bool square;
Expand Down Expand Up @@ -28,14 +36,14 @@ class BTButton extends StatelessWidget {
}
}

const BTButton({
BTButton({
super.key,
required this.child,
this.size,
this.square = false,
this.onPressed,
this.backgroundColor,
});
}) : assert(BTButton.checkSizes(size));

@override
Widget build(BuildContext context) {
Expand Down
12 changes: 10 additions & 2 deletions lib/components/buttons/bt_button_outline.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
part of get_bootstrap;

class BTButtonOutline extends StatelessWidget {
static bool checkSizes(Size? size) {
if (size != null && ![Size.sm, Size.lg, Size.md].contains(size)) {
throw 'O parâmetro "size" somente pode ser utilizado com os tamanhos: sm, md, lg';
}

return true;
}

final Widget child;
final Size? size;
final bool square;
Expand Down Expand Up @@ -28,14 +36,14 @@ class BTButtonOutline extends StatelessWidget {
}
}

const BTButtonOutline({
BTButtonOutline({
super.key,
required this.child,
this.size,
this.square = false,
this.onPressed,
this.backgroundColor,
});
}) : assert(BTButton.checkSizes(size));

@override
Widget build(BuildContext context) {
Expand Down

0 comments on commit de9f7a5

Please sign in to comment.