Skip to content

Instantly share code, notes, and snippets.

@ltvu93
Created June 22, 2022 09:22
Show Gist options
  • Save ltvu93/bf6eb5b1d7779c38393fe318dd04238a to your computer and use it in GitHub Desktop.
Save ltvu93/bf6eb5b1d7779c38393fe318dd04238a to your computer and use it in GitHub Desktop.
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