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

[Sheet] Expands over screen size on keyboard open #370

Open
LorenzoMioso opened this issue Sep 4, 2023 · 1 comment
Open

[Sheet] Expands over screen size on keyboard open #370

LorenzoMioso opened this issue Sep 4, 2023 · 1 comment

Comments

@LorenzoMioso
Copy link

In not able to figure out why in my project the sheet behaves in this way:

issue.mp4

I wrote the following code :

import 'package:flutter/cupertino.dart';
import 'package:sheet/sheet.dart';

class SheetTest extends StatelessWidget {
  const SheetTest({super.key});

  @override
  Widget build(BuildContext context) {
    return CupertinoPageScaffold(
        child: SheetMediaQuery(
      child: SafeArea(
          child: Padding(
        padding:
            EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),
        child: const Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              CupertinoTextField(
                placeholder: 'Enter your name',
              ),
            ]),
      )),
    ));
  }
}
import 'package:flutter/cupertino.dart';
import 'package:sheet/route.dart';

import 'sheet_test.dart';

class TestPage extends StatelessWidget {
  const TestPage({super.key});

  @override
  Widget build(BuildContext context) {
    return CupertinoPageScaffold(
        child: SafeArea(
            child: Column(children: <Widget>[
      const SizedBox(height: 40),
      CupertinoListTile(
        title: const Text('Test Sheet'),
        onTap: () => Navigator.of(context).push(
          CupertinoSheetRoute<void>(
            builder: (_) => const SheetTest(),
          ),
        ),
      ),
    ])));
  }
}

I tried to put a text field in example project and it works correctly.
There are no significant differences between the example and my project, other then that i'm using auto_route (but i doubt its the problem).
Any help will be appreciated.

@mfrischbutter
Copy link

Thanks for the issue, in my case this was exactly what i wanted :D
If i understand correctly you don't want to move when the keyboard shows up?
Just remove the padding.

import 'package:flutter/cupertino.dart';
import 'package:sheet/sheet.dart';

class SheetTest extends StatelessWidget {
  const SheetTest({super.key});

  @override
  Widget build(BuildContext context) {
    return CupertinoPageScaffold(
        child: SheetMediaQuery(
      child: SafeArea(
          child: Padding(
        padding:
            // just remove this line, should be working then.
            // EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),
        child: const Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              CupertinoTextField(
                placeholder: 'Enter your name',
              ),
            ]),
      )),
    ));
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants