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

Fix/auth page constraints #668

Draft
wants to merge 3 commits into
base: dev
Choose a base branch
from
Draft
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
36 changes: 12 additions & 24 deletions designer_v2/lib/common_views/layout_two_column.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class TwoColumnLayout extends StatefulWidget {
this.paddingRight = defaultContentPadding,
this.backgroundColorLeft,
this.backgroundColorRight,
this.stretchHeight = false,
super.key,
});

Expand Down Expand Up @@ -55,8 +54,6 @@ class TwoColumnLayout extends StatefulWidget {
final Color? backgroundColorLeft;
final Color? backgroundColorRight;

final bool stretchHeight;

@override
State<TwoColumnLayout> createState() => _TwoColumnLayoutState();

Expand Down Expand Up @@ -123,17 +120,6 @@ class _TwoColumnLayoutState extends State<TwoColumnLayout> {

return LayoutBuilder(
builder: (context, constraints) {
if (widget.stretchHeight) {
leftWidget = SizedBox(
height: constraints.maxHeight,
child: leftWidget,
);
rightWidget = SizedBox(
height: constraints.maxHeight,
child: rightWidget,
);
}

if (widget.scrollLeft) {
leftWidget = Scrollbar(
thumbVisibility: true,
Expand All @@ -155,31 +141,31 @@ class _TwoColumnLayoutState extends State<TwoColumnLayout> {
);
}

if (!(widget.constraintsLeft != null && widget.flexLeft != null)) {
// Apply constraints or flex to leftWidget if only one is provided
if (widget.constraintsLeft != null || widget.flexLeft != null) {
if (widget.constraintsLeft != null) {
leftWidget = Container(
constraints: widget.constraintsLeft,
child: leftWidget,
);
}
if (widget.flexLeft != null) {
} else if (widget.flexLeft != null) {
leftWidget = Flexible(flex: widget.flexLeft!, child: leftWidget);
}
}

if (!(widget.constraintsRight != null && widget.flexRight != null)) {
// Apply constraints or flex to rightWidget if only one is provided
if (widget.constraintsRight != null || widget.flexRight != null) {
if (widget.constraintsRight != null) {
rightWidget = Container(
constraints: widget.constraintsRight,
child: rightWidget,
);
}
if (widget.flexRight != null) {
} else if (widget.flexRight != null && rightWidget is! Flexible) {
// THIS IS RIGHT WIDGET
rightWidget = Flexible(flex: widget.flexRight!, child: rightWidget);
}
}

// Apply ConstrainedWidthFlexible to leftWidget if both
// constraintsLeft and flexLeft are provided
if (widget.constraintsLeft != null && widget.flexLeft != null) {
// THIS IS LEFT WIDGET
leftWidget = ConstrainedWidthFlexible(
minWidth: widget.constraintsLeft?.minWidth ?? double.infinity,
maxWidth: widget.constraintsLeft?.maxWidth ?? double.infinity,
Expand All @@ -190,6 +176,8 @@ class _TwoColumnLayoutState extends State<TwoColumnLayout> {
);
}

// Apply ConstrainedWidthFlexible to rightWidget if both
// constraintsRight and flexRight are provided
if (widget.constraintsRight != null && widget.flexRight != null) {
rightWidget = ConstrainedWidthFlexible(
minWidth: widget.constraintsRight?.minWidth ?? double.infinity,
Expand Down
21 changes: 8 additions & 13 deletions designer_v2/lib/features/auth/auth_scaffold.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class AuthScaffold extends ConsumerStatefulWidget {
required this.body,
required this.formKey,
this.leftContentMinWidth = 424.0,
this.leftPanelMinWidth = 500.0,
this.leftPanelMinWidth = 550.0,
this.leftPanelPadding = const EdgeInsets.fromLTRB(88.0, 54.0, 88.0, 40.0),
super.key,
});
Expand Down Expand Up @@ -108,7 +108,7 @@ class _AuthScaffoldState extends ConsumerState<AuthScaffold> {
padding: const EdgeInsets.only(left: 12.0),
child: Container(
constraints: BoxConstraints(
maxWidth: widget.leftPanelMinWidth - 12 * 2,
maxWidth: widget.leftPanelMinWidth - 24,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
Expand Down Expand Up @@ -142,23 +142,18 @@ class _AuthScaffoldState extends ConsumerState<AuthScaffold> {
),
),
),
rightWidget: const Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Center(
child: StudyUJobsToBeDone(),
),
),
],
rightWidget: const Center(
child: Wrap(
children: [
StudyUJobsToBeDone(),
],
),
),
backgroundColorLeft: ThemeConfig.bodyBackgroundColor(theme),
backgroundColorRight: theme.colorScheme.primary,
constraintsLeft: BoxConstraints(minWidth: widget.leftPanelMinWidth),
scrollLeft: false,
scrollRight: false,
stretchHeight: true,
paddingLeft: widget.leftPanelPadding,
),
);
Expand Down
Loading