I need to place 2 widgets at Row, and second of them – be "out" of screen’s perimeter at be cut by it. Something like at this scheme:
I tried to override Row’s clipBehavior
property, but that doesn’t work.
class ClippedRow extends Row {
ClippedRow({
super.key,
super.mainAxisAlignment,
super.mainAxisSize,
super.crossAxisAlignment,
super.textDirection,
super.verticalDirection,
super.textBaseline, // NO DEFAULT: we don't know what the text's baseline should be
super.children,
});
@override
Clip get clipBehavior => Clip.hardEdge;
}
class CardWidget {
const CardWidget({super.key});
@override
Widget buildWidget(BuildContext context) => ClippedRow(
children: [
Widget1(),
Widget2(), //this one is big and should be "out" of screen
],
);
}
4
Answers
thx for all your answers, but what I wanted seems to be achieved by using Transform.translate widget:
Width parameter must be defined for widget1 and widget2.
You can wrap the row with a SingleChildScrollView.
By doing this, you can swipe left to see the more of Widget2().
You can use
MediaQuery.of(context).size.width
to find the width of your screen, you can use this width to your widget.You can try this code if you want a static non-sliding out of the screen implementation with a
Row
:And this code if you want it to be dynamic(replicatable on every device):
There are a few ways of getting there, as you can see from the other other answers, but I would use a ListView: