Skip to content

Commit

Permalink
Merge pull request #309 from MaddinMade/termsOfService-animation
Browse files Browse the repository at this point in the history
adds termsOfService animation
  • Loading branch information
juliansteenbakker authored Mar 15, 2022
2 parents 7e2b8d4 + 052baca commit 4210e2c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
27 changes: 13 additions & 14 deletions lib/src/widgets/cards/login_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -618,27 +618,26 @@ class _LoginCardState extends State<_LoginCard> with TickerProviderStateMixin {
alignment: Alignment.topLeft,
color: theme.cardTheme.color,
width: cardWidth,
padding: const EdgeInsets.symmetric(
horizontal: cardPadding,
vertical: 10,
),
padding: const EdgeInsets.symmetric(horizontal: cardPadding),
onExpandCompleted: () => _postSwitchAuthController.forward(),
child: _buildConfirmPasswordField(textFieldWidth, messages, auth),
child: Column(children: [
Padding(
padding: const EdgeInsets.symmetric(vertical: 10.0),
child:
_buildConfirmPasswordField(textFieldWidth, messages, auth),
),
for (var e in auth.termsOfService)
TermCheckbox(
termOfService: e,
validation: auth.isSignup,
),
]),
),
Container(
padding: Paddings.fromRBL(cardPadding),
width: cardWidth,
child: Column(
children: <Widget>[
if (auth.isSignup && auth.termsOfService.isNotEmpty)
...auth.termsOfService
.map((e) => ScaleTransition(
scale: _buttonScaleAnimation,
child: TermCheckbox(
termOfService: e,
),
))
.toList(),
!widget.hideForgotPasswordButton
? _buildForgotPassword(theme, messages)
: SizedBox.fromSize(
Expand Down
12 changes: 9 additions & 3 deletions lib/src/widgets/term_of_service_checkbox.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@ import 'package:url_launcher/url_launcher.dart';

class TermCheckbox extends StatefulWidget {
final TermOfService termOfService;
final bool validation;

const TermCheckbox({Key? key, required this.termOfService}) : super(key: key);
const TermCheckbox({
Key? key,
required this.termOfService,
this.validation = true,
}) : super(key: key);

@override
_TermCheckboxState createState() => _TermCheckboxState();
Expand Down Expand Up @@ -49,8 +54,9 @@ class _TermCheckboxState extends State<TermCheckbox> {
textAlign: TextAlign.left,
),
validator: (bool? value) {
if (widget.termOfService.mandatory == true &&
widget.termOfService.getStatus() != true) {
if (widget.validation &&
widget.termOfService.mandatory &&
!widget.termOfService.getStatus()) {
return widget.termOfService.validationErrorMessage;
}
return null;
Expand Down

0 comments on commit 4210e2c

Please sign in to comment.