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

Updating #506

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ packages:
path: ".."
relative: true
source: path
version: "5.0.0"
version: "4.2.0"
flutter_test:
dependency: "direct dev"
description: flutter
Expand Down
98 changes: 53 additions & 45 deletions lib/flutter_login.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import 'package:flutter_login/src/utils/constants.dart';
import 'package:flutter_login/src/utils/dart_helper.dart';
import 'package:flutter_login/src/widgets/cards/auth_card_builder.dart';
import 'package:flutter_login/src/widgets/fade_in.dart';
import 'package:flutter_login/src/widgets/gradient_box.dart';
import 'package:flutter_login/src/widgets/hero_text.dart';
import 'package:flutter_login/theme.dart';
import 'package:provider/provider.dart';
Expand Down Expand Up @@ -209,11 +208,11 @@ class __HeaderState extends State<_Header> {

var logo = displayLogo
? Image(
image: widget.logo!,
filterQuality: FilterQuality.high,
height: logoHeight,
width: widget.logoWidth * cardWidth,
)
image: widget.logo!,
filterQuality: FilterQuality.high,
height: logoHeight,
width: widget.logoWidth * cardWidth,
)
: const SizedBox.shrink();

if (widget.logoTag != null) {
Expand Down Expand Up @@ -499,15 +498,15 @@ class _FlutterLoginState extends State<FlutterLogin>
vsync: this,
duration: loadingDuration,
)..addStatusListener((status) {
if (status == AnimationStatus.forward) {
_logoController.forward();
_titleController.forward();
}
if (status == AnimationStatus.reverse) {
_logoController.reverse();
_titleController.reverse();
}
});
if (status == AnimationStatus.forward) {
_logoController.forward();
_titleController.forward();
}
if (status == AnimationStatus.reverse) {
_logoController.reverse();
_titleController.reverse();
}
});
_logoController = AnimationController(
vsync: this,
duration: loadingDuration,
Expand All @@ -516,8 +515,8 @@ class _FlutterLoginState extends State<FlutterLogin>
vsync: this,
duration: loadingDuration,
);

Future.delayed(const Duration(seconds: 1), () {
/// Future.delayed(const Duration(milliseconds: 1), () {
Future.delayed(const Duration(milliseconds: 50), () {
if (mounted) {
_loadingController.forward();
}
Expand Down Expand Up @@ -621,7 +620,7 @@ class _FlutterLoginState extends State<FlutterLogin>
required LoginTheme loginTheme,
}) {
final blackOrWhite =
theme.brightness == Brightness.light ? Colors.black54 : Colors.white;
theme.brightness == Brightness.light ? Colors.black54 : Colors.white;
final primaryOrWhite = theme.brightness == Brightness.light
? theme.primaryColor
: Colors.white;
Expand All @@ -640,21 +639,21 @@ class _FlutterLoginState extends State<FlutterLogin>
Typography.blackMountainView.displaySmall!.color;
final titleStyle = theme.textTheme.displaySmall!
.copyWith(
color: loginTheme.accentColor ??
(isDefaultBlackText
? Colors.white
: theme.textTheme.displaySmall!.color),
fontSize: loginTheme.beforeHeroFontSize,
fontWeight: FontWeight.w300,
)
color: loginTheme.accentColor ??
(isDefaultBlackText
? Colors.white
: theme.textTheme.displaySmall!.color),
fontSize: loginTheme.beforeHeroFontSize,
fontWeight: FontWeight.w300,
)
.merge(loginTheme.titleStyle);
final footerStyle = theme.textTheme.bodyLarge!
.copyWith(
color: loginTheme.accentColor ??
(isDefaultBlackText
? Colors.white
: theme.textTheme.displaySmall!.color),
)
color: loginTheme.accentColor ??
(isDefaultBlackText
? Colors.white
: theme.textTheme.displaySmall!.color),
)
.merge(loginTheme.footerTextStyle);
final textStyle = theme.textTheme.bodyMedium!
.copyWith(color: blackOrWhite)
Expand Down Expand Up @@ -743,7 +742,7 @@ class _FlutterLoginState extends State<FlutterLogin>
),
// put it here because floatingActionButtonTheme doesnt have highlightColor property
highlightColor:
loginTheme.buttonTheme.highlightColor ?? theme.highlightColor,
loginTheme.buttonTheme.highlightColor ?? theme.highlightColor,
textTheme: theme.textTheme.copyWith(
displaySmall: titleStyle,
bodyMedium: textStyle,
Expand Down Expand Up @@ -814,6 +813,8 @@ class _FlutterLoginState extends State<FlutterLogin>
),
],
child: Scaffold(
///Added this
resizeToAvoidBottomInset: false,
backgroundColor: Colors.transparent,
body: Stack(
children: <Widget>[
Expand All @@ -835,7 +836,8 @@ class _FlutterLoginState extends State<FlutterLogin>
key: authCardKey,
userType: widget.userType,
keyboardDismissBehavior: widget.keyboardDismissBehavior,
padding: EdgeInsets.only(top: cardTopPosition),
///padding: EdgeInsets.only(top: cardTopPosition),
padding: const EdgeInsets.only(top: 28),
loadingController: _loadingController,
userValidator: userValidator,
validateUserImmediately: validateUserImmediately,
Expand All @@ -859,21 +861,27 @@ class _FlutterLoginState extends State<FlutterLogin>
introWidget: widget.headerWidget,
initialIsoCode: widget.initialIsoCode,
),
),
Positioned(
top: cardTopPosition - headerHeight - headerMargin,
child: _buildHeader(headerHeight, loginTheme),
),
Positioned.fill(
child: Align(
alignment: Alignment.bottomCenter,
child: footerWidget,
Positioned(
top: cardTopPosition - headerHeight - headerMargin,
child: _buildHeader(headerHeight, loginTheme),
),
Positioned.fill(
child: Align(
alignment: Alignment.bottomCenter,
child: footerWidget,
),
///Added The Positioned.fill around ?widget.children
Positioned.fill(
child: Align(
alignment: Alignment.topCenter,
child: widget.children!.first,
),
),
),
...?widget.children,
],
// ...?widget.children,
],
),
),
),
],
),
if (!kReleaseMode && widget.showDebugButtons)
_buildDebugAnimationButtons(),
Expand Down
75 changes: 38 additions & 37 deletions lib/src/widgets/cards/auth_card_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -151,33 +151,33 @@ class AuthCardState extends State<AuthCard> with TickerProviderStateMixin {

_cardSizeAnimation =
Tween<double>(begin: 1.0, end: cardSizeScaleEnd).animate(
CurvedAnimation(
parent: _routeTransitionController,
curve: const Interval(
0,
.27272727 /* ~300ms */,
curve: Curves.easeInOutCirc,
),
),
);
CurvedAnimation(
parent: _routeTransitionController,
curve: const Interval(
0,
.27272727 /* ~300ms */,
curve: Curves.easeInOutCirc,
),
),
);

// replace 0 with minPositive to pass the test
// https://github.com/flutter/flutter/issues/42527#issuecomment-575131275
_cardOverlayHeightFactorAnimation =
Tween<double>(begin: double.minPositive, end: 1.0).animate(
CurvedAnimation(
parent: _routeTransitionController,
curve: const Interval(.27272727, .5),
),
);
CurvedAnimation(
parent: _routeTransitionController,
curve: const Interval(.27272727, .5),
),
);

_cardOverlaySizeAndOpacityAnimation =
Tween<double>(begin: 1.0, end: 0).animate(
CurvedAnimation(
parent: _routeTransitionController,
curve: const Interval(.5, .72727272),
),
);
CurvedAnimation(
parent: _routeTransitionController,
curve: const Interval(.5, .72727272),
),
);

_cardSize2AnimationX =
Tween<double>(begin: 1, end: 1).animate(_routeTransitionController);
Expand Down Expand Up @@ -244,18 +244,18 @@ class AuthCardState extends State<AuthCard> with TickerProviderStateMixin {

_cardSize2AnimationX =
Tween<double>(begin: 1.0, end: heightRatio / cardSizeScaleEnd).animate(
CurvedAnimation(
parent: _routeTransitionController,
curve: const Interval(.72727272, 1, curve: Curves.easeInOutCubic),
),
);
CurvedAnimation(
parent: _routeTransitionController,
curve: const Interval(.72727272, 1, curve: Curves.easeInOutCubic),
),
);
_cardSize2AnimationY =
Tween<double>(begin: 1.0, end: widthRatio / cardSizeScaleEnd).animate(
CurvedAnimation(
parent: _routeTransitionController,
curve: const Interval(.72727272, 1, curve: Curves.easeInOutCubic),
),
);
CurvedAnimation(
parent: _routeTransitionController,
curve: const Interval(.72727272, 1, curve: Curves.easeInOutCubic),
),
);

widget.onSubmit?.call();

Expand Down Expand Up @@ -343,11 +343,11 @@ class AuthCardState extends State<AuthCard> with TickerProviderStateMixin {
// if (!_isLoadingFirstTime) formController = _formLoadingController..value = 1.0;
Future<bool> requireSignUpConfirmation() async {
final confirmSignupRequired = await auth.confirmSignupRequired?.call(
LoginData(
name: auth.email,
password: auth.password,
),
) ??
LoginData(
name: auth.email,
password: auth.password,
),
) ??
true;
return auth.onConfirmSignup != null && confirmSignupRequired;
}
Expand All @@ -364,7 +364,7 @@ class AuthCardState extends State<AuthCard> with TickerProviderStateMixin {
validateUserImmediately: widget.validateUserImmediately,
passwordValidator: widget.passwordValidator,
requireAdditionalSignUpFields:
widget.additionalSignUpFields != null,
widget.additionalSignUpFields != null,
onSwitchRecoveryPassword: () => _changeCard(_recoveryIndex),
onSwitchSignUpAdditionalData: () =>
_changeCard(_additionalSignUpIndex),
Expand Down Expand Up @@ -416,7 +416,7 @@ class AuthCardState extends State<AuthCard> with TickerProviderStateMixin {
loginTheme: widget.loginTheme,
onSubmitCompleted: () async {
final requireSignupConfirmation =
await requireSignUpConfirmation();
await requireSignUpConfirmation();
if (requireSignupConfirmation) {
_changeCard(_confirmSignup);
} else if (widget.loginAfterSignUp) {
Expand Down Expand Up @@ -473,7 +473,8 @@ class AuthCardState extends State<AuthCard> with TickerProviderStateMixin {
final deviceSize = MediaQuery.of(context).size;

final Widget current = Container(
height: deviceSize.height,
/// height: deviceSize.height,
height: 350,
width: deviceSize.width,
padding: widget.padding,
child: TransformerPageView(
Expand Down
37 changes: 26 additions & 11 deletions lib/src/widgets/cards/login_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -509,17 +509,32 @@ class _LoginCardState extends State<_LoginCard> with TickerProviderStateMixin {
offset: .5,
curve: _textButtonLoadingAnimationInterval,
fadeDirection: FadeDirection.topToBottom,
child: MaterialButton(
disabledTextColor: theme.primaryColor,
onPressed: buttonEnabled ? _switchAuthMode : null,
padding: loginTheme.authButtonPadding ??
const EdgeInsets.symmetric(horizontal: 30.0, vertical: 8.0),
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
textColor: loginTheme.switchAuthTextColor ?? calculatedTextColor,
child: AnimatedText(
text: auth.isSignup ? messages.loginButton : messages.signupButton,
textRotation: AnimatedTextRotation.down,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
width: 40,
child: (auth.isSignup) ? const Icon(Icons.undo) : const SizedBox(width: 40,),
),
MaterialButton(
disabledTextColor: theme.primaryColor,
onPressed: buttonEnabled ? _switchAuthMode : null,
padding: loginTheme.authButtonPadding ??
const EdgeInsets.symmetric(horizontal: 30.0, vertical: 8.0),
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
textColor: loginTheme.switchAuthTextColor ?? calculatedTextColor,
child: AnimatedText(
text: auth.isSignup ? messages.loginButton : messages.signupButton,
textRotation: AnimatedTextRotation.down,
style: const TextStyle(fontSize: 18,decoration: TextDecoration.underline),
),
),
SizedBox(
width: 40,
child: (!auth.isSignup) ? const Icon(Icons.forward) : const SizedBox(),
),

],
),
);
}
Expand Down