Skip to content

Instantly share code, notes, and snippets.

@Gazer
Created June 5, 2020 14:13
Show Gist options
  • Save Gazer/91fbef447cf816bdaf53b8d8b530f879 to your computer and use it in GitHub Desktop.
Save Gazer/91fbef447cf816bdaf53b8d8b530f879 to your computer and use it in GitHub Desktop.
Widget that expand to use full height and if needed can scroll
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