File tree 3 files changed +61
-20
lines changed
section_4/login_example_sequence_animation/lib/widgets
3 files changed +61
-20
lines changed Original file line number Diff line number Diff line change
1
+ import 'package:flutter/material.dart' ;
2
+
3
+ class DetermineVisibility extends StatelessWidget {
4
+ const DetermineVisibility ({
5
+ Key ? key,
6
+ required this .child,
7
+ }) : super (key: key);
8
+
9
+ final Widget child;
10
+ @override
11
+ Widget build (BuildContext context) {
12
+ return LayoutBuilder (
13
+ builder: (context, constraints) {
14
+ return Visibility (
15
+ visible: constraints.maxWidth > 200 && constraints.maxHeight > 50 ,
16
+ child: child,
17
+ );
18
+ },
19
+ );
20
+ }
21
+ }
Original file line number Diff line number Diff line change 1
1
import 'package:flutter/material.dart' ;
2
+ import 'package:login/widgets/determine_visibility.dart' ;
2
3
3
4
import '../../styles/colors.dart' ;
4
5
import 'call_to_action_button.dart' ;
@@ -43,16 +44,25 @@ class LoginForm extends StatelessWidget {
43
44
text: 'Login' ,
44
45
color: headerLoginColor,
45
46
),
46
- Row (
47
- mainAxisAlignment: MainAxisAlignment .center,
48
- children: < Widget > [
49
- const CallToActionText ("Don't have an account?" ),
50
- CallToActionButton (
51
- onPressed: onSignUpPressed,
52
- text: 'Sign Up' ,
53
- color: headerSignUpColor,
54
- ),
55
- ],
47
+ DetermineVisibility (
48
+ child: Row (
49
+ mainAxisAlignment: MainAxisAlignment .center,
50
+ children: < Widget > [
51
+ const Expanded (
52
+ flex: 3 ,
53
+ child: Center (
54
+ child: CallToActionText ("Don't have an account?" )),
55
+ ),
56
+ Expanded (
57
+ flex: 1 ,
58
+ child: CallToActionButton (
59
+ onPressed: onSignUpPressed,
60
+ text: 'Sign Up' ,
61
+ color: headerSignUpColor,
62
+ ),
63
+ ),
64
+ ],
65
+ ),
56
66
),
57
67
],
58
68
),
Original file line number Diff line number Diff line change 1
1
import 'package:flutter/material.dart' ;
2
2
3
3
import '../../styles/colors.dart' ;
4
+ import '../determine_visibility.dart' ;
4
5
import 'call_to_action_button.dart' ;
5
6
import 'call_to_action_text.dart' ;
6
7
import 'text_input_box.dart' ;
@@ -47,16 +48,25 @@ class SignUpForm extends StatelessWidget {
47
48
onPressed: onSignUpPressed,
48
49
text: 'Sign Up' ,
49
50
color: headerSignUpColor),
50
- Row (
51
- mainAxisAlignment: MainAxisAlignment .center,
52
- children: < Widget > [
53
- const CallToActionText ('Already have an account?' ),
54
- CallToActionButton (
55
- text: 'Sign in' ,
56
- onPressed: onLoginPressed,
57
- color: headerLoginColor,
58
- )
59
- ],
51
+ DetermineVisibility (
52
+ child: Row (
53
+ mainAxisAlignment: MainAxisAlignment .center,
54
+ children: < Widget > [
55
+ const Expanded (
56
+ flex: 3 ,
57
+ child: Center (
58
+ child: CallToActionText ('Already have an account?' )),
59
+ ),
60
+ Expanded (
61
+ flex: 1 ,
62
+ child: CallToActionButton (
63
+ text: 'Sign in' ,
64
+ onPressed: onLoginPressed,
65
+ color: headerLoginColor,
66
+ ),
67
+ )
68
+ ],
69
+ ),
60
70
),
61
71
],
62
72
),
You can’t perform that action at this time.
0 commit comments