Skip to content

Commit

Permalink
Merge pull request #191 from malta895/fix-animation-padding
Browse files Browse the repository at this point in the history
Fix ButtonProvider causing undesired padding and text during login animation
  • Loading branch information
juliansteenbakker authored Jun 28, 2021
2 parents 1889824 + 4cff7ce commit 807b191
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
4 changes: 2 additions & 2 deletions lib/src/widgets/auth_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,9 @@ class AuthCardState extends State<AuthCard> with TickerProviderStateMixin {
final isLogin = Provider.of<Auth>(context, listen: false).isLogin;
final deviceSize = MediaQuery.of(context).size;
final cardSize = getWidgetSize(_cardKey)!;
// add .25 to make sure the scaling will cover the whole screen
// add .35 to make sure the scaling will cover the whole screen
final widthRatio =
deviceSize.width / cardSize.height + (isLogin ? .25 : .65);
deviceSize.width / cardSize.height + (isLogin ? .35 : .65);
final heightRatio = deviceSize.height / cardSize.width + .25;

_cardSize2AnimationX =
Expand Down
27 changes: 16 additions & 11 deletions lib/src/widgets/login_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,19 @@ class _LoginCardState extends State<_LoginCard> with TickerProviderStateMixin {
);
}

Widget _buildProvidersTitle(LoginMessages messages) {
return ScaleTransition(
scale: _buttonScaleAnimation,
child: Row(children: <Widget>[
Expanded(child: Divider()),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(messages.providersTitle),
),
Expanded(child: Divider()),
]));
}

@override
Widget build(BuildContext context) {
final auth = Provider.of<Auth>(context, listen: true);
Expand Down Expand Up @@ -462,17 +475,9 @@ class _LoginCardState extends State<_LoginCard> with TickerProviderStateMixin {
: SizedBox.fromSize(
size: Size.fromHeight(10),
),
// TODO: Fix animation size when ending. See #184
// auth.loginProviders.isNotEmpty && !widget.hideProvidersTitle
// ? Row(children: <Widget>[
// Expanded(child: Divider()),
// Padding(
// padding: const EdgeInsets.all(8.0),
// child: Text(messages.providersTitle),
// ),
// Expanded(child: Divider()),
// ])
// : Container(),
auth.loginProviders.isNotEmpty && !widget.hideProvidersTitle
? _buildProvidersTitle(messages)
: Container(),
_buildProvidersLogInButton(theme, messages, auth, loginTheme),
],
),
Expand Down

0 comments on commit 807b191

Please sign in to comment.