Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(firebase_ui_auth): preserve UI form state when device rotates #9993

Merged
merged 1 commit into from
Dec 1, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ class ResponsivePage extends StatefulWidget {
class _ResponsivePageState extends State<ResponsivePage> {
final ctrl = ScrollController();
final paddingListenable = ValueNotifier<double>(0);
final key = GlobalKey();

void _onKeyboardPositionChanged(double position) {
if (!ctrl.hasClients) {
Expand All @@ -138,6 +139,11 @@ class _ResponsivePageState extends State<ResponsivePage> {
Widget build(BuildContext context) {
final breakpoint = widget.breakpoint;

final content = KeyedSubtree(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't knew about this one

key: key,
child: widget.child,
);

return LayoutBuilder(
builder: (context, constraints) {
if (constraints.biggest.width > breakpoint) {
Expand Down Expand Up @@ -166,9 +172,7 @@ class _ResponsivePageState extends State<ResponsivePage> {
Center(
child: ConstrainedBox(
constraints: BoxConstraints(maxWidth: breakpoint),
child: IntrinsicHeight(
child: widget.child,
),
child: IntrinsicHeight(child: content),
),
),
],
Expand Down Expand Up @@ -198,7 +202,7 @@ class _ResponsivePageState extends State<ResponsivePage> {
SliverList(
delegate: SliverChildListDelegate.fixed(
[
widget.child,
content,
ValueListenableBuilder<double>(
valueListenable: paddingListenable,
builder: (context, value, _) {
Expand All @@ -217,7 +221,7 @@ class _ResponsivePageState extends State<ResponsivePage> {
child: ListView(
shrinkWrap: true,
children: [
widget.child,
content,
],
),
);
Expand Down