Created
June 5, 2020 14:13
-
-
Save Gazer/91fbef447cf816bdaf53b8d8b530f879 to your computer and use it in GitHub Desktop.
Widget that expand to use full height and if needed can scroll
This file contains hidden or 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
import 'package:flutter/material.dart'; | |
class ScrollExpandContainer extends StatelessWidget { | |
final List<Widget> children; | |
const ScrollExpandContainer({Key key, this.children}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return LayoutBuilder( | |
builder: (context, constraint) { | |
return SingleChildScrollView( | |
child: ConstrainedBox( | |
constraints: BoxConstraints( | |
minHeight: constraint.maxHeight, | |
), | |
child: IntrinsicHeight( | |
child: Column( | |
children: children, | |
), | |
), | |
), | |
); | |
}, | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment