Skip to content

Conversation

@luckysmg
Copy link
Contributor

@luckysmg luckysmg commented Jun 24, 2022

The MediaQuery.padding will change during keyboard toggling, I think we should use MediaQuery.viewPadding instead of padding.

And I modifed some old tests because they use the padding property.(It should be viewPadding)

Here is preview video, and pay attention to red bottom bar.

Before:

Before.mp4

After

After.mp4

List which issues are fixed by this PR. You must list at least one issue.

Demo code
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

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

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const TestPage1(),
    );
  }
}

class TestPage1 extends StatefulWidget {
  const TestPage1({Key? key}) : super(key: key);

  @override
  State<TestPage1> createState() => _TestPage1State();
}

class _TestPage1State extends State<TestPage1> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      bottomNavigationBar: BottomNavigationBar(
        backgroundColor: Colors.red,
        items: const [
          BottomNavigationBarItem(icon: Text('1'), label: "1"),
          BottomNavigationBarItem(icon: Text('2'), label: "2"),
          BottomNavigationBarItem(icon: Text('3'), label: "3"),
        ],
      ),
      body: const Center(
        child: CupertinoTextField(
          padding: EdgeInsets.all(20),
          placeholder: "Tap me!",
          decoration: BoxDecoration(color: Colors.green),
        ),
      ),
    );
  }
}

class TestPage2 extends StatefulWidget {
  const TestPage2({Key? key}) : super(key: key);

  @override
  State<TestPage2> createState() => _TestPage2State();
}

class _TestPage2State extends State<TestPage2> {
  @override
  Widget build(BuildContext context) {
    return CupertinoTabScaffold(
      tabBar: CupertinoTabBar(
        items: const [
        BottomNavigationBarItem(icon: Text('1'), label: "1"),
        BottomNavigationBarItem(icon: Text('2'), label: "2"),
        BottomNavigationBarItem(icon: Text('3'), label: "3"),
      ],backgroundColor: Colors.orange,),
      tabBuilder: (BuildContext context, int index) {
        return const Center(
          child: CupertinoTextField(
            padding: EdgeInsets.all(20),
            placeholder: "Tap me!",
            decoration: BoxDecoration(color: Colors.green),
          ),
        );
      },
    );
  }
}

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard flutter-dashboard bot added f: cupertino flutter/packages/flutter/cupertino repository f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. labels Jun 24, 2022
@luckysmg
Copy link
Contributor Author

luckysmg commented Jul 3, 2022

Emm although the linux customer testing failed...I think the bottom bar height should not change......
Is that expected ?

@luckysmg
Copy link
Contributor Author

cc @Piinks is the linux customer test fail is expected? I think the bar height should not change.....

@flutter-dashboard
Copy link

This pull request executed golden file tests, but it has not been updated in a while (20+ days). Test results from Gold expire after as many days, so this pull request will need to be updated with a fresh commit in order to get results from Gold.

For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@Hixie
Copy link
Contributor

Hixie commented Sep 28, 2022

Thanks for your contribution! Could you try rebasing your PR against the tip of tree and force pushing? That will cause us to run the tests with the latest version which may shake out the problem you're seeing.

@luckysmg
Copy link
Contributor Author

Yeah . Tests passed. Would you mind give this PR a review?😄
@Hixie

@MitchellGoodwin MitchellGoodwin self-requested a review October 13, 2022 17:20
Copy link
Contributor

@MitchellGoodwin MitchellGoodwin left a comment

Choose a reason for hiding this comment

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

LGTM

@MitchellGoodwin
Copy link
Contributor

Thank you for the fix! Sorry it took so long to review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App f: cupertino flutter/packages/flutter/cupertino repository f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants