Created
June 22, 2022 09:22
-
-
Save ltvu93/bf6eb5b1d7779c38393fe318dd04238a to your computer and use it in GitHub Desktop.
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 AvoidKeyboardOverflow extends StatelessWidget { | |
final Widget child; | |
const AvoidKeyboardOverflow({super.key, required this.child}); | |
@override | |
Widget build(BuildContext context) { | |
return LayoutBuilder( | |
builder: (_, constraints) { | |
return SingleChildScrollView( | |
child: ConstrainedBox( | |
constraints: BoxConstraints(minHeight: constraints.maxHeight), | |
child: IntrinsicHeight( | |
child: child, | |
), | |
), | |
); | |
}, | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment