fluffychat/lib/widgets/layouts/two_column_layout.dart

44 lines
1.0 KiB
Dart
Raw Permalink Normal View History

2021-05-23 13:11:55 +02:00
import 'package:flutter/material.dart';
2021-10-26 18:50:34 +02:00
import 'package:fluffychat/config/themes.dart';
2021-05-23 13:11:55 +02:00
class TwoColumnLayout extends StatelessWidget {
final Widget mainView;
final Widget sideView;
2021-11-19 20:28:17 +01:00
const TwoColumnLayout({
Key? key,
required this.mainView,
required this.sideView,
}) : super(key: key);
2021-05-23 13:11:55 +02:00
@override
Widget build(BuildContext context) {
2021-05-23 20:13:10 +02:00
if (MediaQuery.of(context).size.width <= FluffyThemes.columnWidth * 2) {
2021-05-23 13:11:55 +02:00
return mainView;
}
2021-05-24 11:10:38 +02:00
return ScaffoldMessenger(
child: Scaffold(
body: Row(
2021-05-23 13:11:55 +02:00
children: [
Container(
clipBehavior: Clip.antiAlias,
2021-10-14 18:09:30 +02:00
decoration: const BoxDecoration(),
2021-05-23 13:11:55 +02:00
width: 360.0,
child: mainView,
),
Container(
width: 1.0,
color: Theme.of(context).dividerColor,
),
Expanded(
child: ClipRRect(
child: sideView,
),
),
],
),
),
);
}
}