mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2024-11-18 14:49:15 +00:00
71 lines
2.1 KiB
Dart
71 lines
2.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:selfprivacy/utils/breakpoints.dart';
|
|
|
|
class ResponsiveLayoutWithInfobox extends StatelessWidget {
|
|
const ResponsiveLayoutWithInfobox({
|
|
required this.primaryColumn,
|
|
this.topChild,
|
|
this.secondaryColumn,
|
|
super.key,
|
|
});
|
|
|
|
final Widget? topChild;
|
|
final Widget primaryColumn;
|
|
final Widget? secondaryColumn;
|
|
|
|
@override
|
|
Widget build(final BuildContext context) {
|
|
final hasSecondaryColumn = secondaryColumn != null;
|
|
final hasTopChild = topChild != null;
|
|
|
|
if (Breakpoints.large.isActive(context)) {
|
|
return LayoutBuilder(
|
|
builder: (final context, final constraints) => Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
if (hasTopChild)
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
SizedBox(
|
|
width: constraints.maxWidth * 0.9,
|
|
child: topChild,
|
|
),
|
|
],
|
|
),
|
|
if (hasTopChild) const SizedBox(height: 16),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
SizedBox(
|
|
width: hasSecondaryColumn
|
|
? constraints.maxWidth * 0.7
|
|
: constraints.maxWidth * 0.9,
|
|
child: primaryColumn,
|
|
),
|
|
if (hasSecondaryColumn) const SizedBox(width: 16),
|
|
if (hasSecondaryColumn)
|
|
SizedBox(
|
|
width: constraints.maxWidth * 0.2,
|
|
child: secondaryColumn,
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
if (hasTopChild) topChild!,
|
|
const SizedBox(height: 16),
|
|
primaryColumn,
|
|
const SizedBox(height: 32),
|
|
if (hasSecondaryColumn) secondaryColumn!,
|
|
],
|
|
);
|
|
}
|
|
}
|