-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(frontend): Separate split container into its own widget
- Loading branch information
Showing
2 changed files
with
66 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
/// Renders a two slot (left, right) container | ||
class TwoSlotContainer extends StatelessWidget { | ||
const TwoSlotContainer({ | ||
Key key, | ||
@required this.leftSlot, | ||
@required this.rightSlot, | ||
this.leftWidth = 275, | ||
}) : super(key: key); | ||
|
||
/// Amount of space taken by left container | ||
final double leftWidth; | ||
|
||
/// Left container takes the [leftWidth] space | ||
/// left container is also rendered with a right border | ||
/// with thickness defined by [dividerTheme] | ||
final Widget leftSlot; | ||
|
||
/// Left container takes available space left by the [leftSlot] | ||
final Widget rightSlot; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final theme = Theme.of(context); | ||
|
||
return Row( | ||
mainAxisSize: MainAxisSize.max, | ||
children: [ | ||
DecoratedBox( | ||
decoration: BoxDecoration( | ||
border: Border( | ||
right: BorderSide( | ||
color: theme.dividerColor, | ||
width: theme.dividerTheme.thickness ?? 1, | ||
), | ||
), | ||
), | ||
child: SizedBox(width: leftWidth, child: leftSlot), | ||
), | ||
Expanded(child: rightSlot) | ||
], | ||
); | ||
} | ||
} |