Skip to content

Conversation

@justinmc
Copy link
Contributor

@justinmc justinmc commented Jun 27, 2023

It looks like the wrong padding was being used in the layout logic in RTL mode when using a prefixIcon. This fixes it.

This bug seems to have been in the codebase for 5 years. However, it doesn't manifest itself unless 1. RTL 2. prefixIcon and 3. asymmetric left/right contentPadding, so that's probably why it wasn't reported until now.

Before Screenshot from 2023-06-27 13-10-48
After Screenshot from 2023-06-27 13-11-11

Fixes #129591

Code to reproduce
import 'package:flutter/material.dart';

/// Flutter code sample for [InputDecoration].

void main() => runApp(const InputDecorationExampleApp());

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('InputDecoration Sample')),
        body: const Padding(
          padding: EdgeInsets.all(8),
          child: Column(
            children: [
              InputDecorationExample(),
              SizedBox(height: 8),
              Directionality(
                textDirection: TextDirection.rtl,
                child: InputDecorationExample(),
              ),
            ],
          ),
        ),
      ),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return const TextField(
      decoration: InputDecoration(
        contentPadding: EdgeInsetsDirectional.only(end: 24),
        prefixIcon: Icon(Icons.search),
      ),
    );
  }
}

@justinmc justinmc self-assigned this Jun 27, 2023
@justinmc justinmc marked this pull request as ready for review June 27, 2023 20:38
@justinmc justinmc merged commit c751166 into flutter:master Jun 28, 2023
@justinmc justinmc deleted the rtl-content-padding branch June 28, 2023 23:31
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 29, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 29, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 29, 2023
camsim99 added a commit to flutter/packages that referenced this pull request Jun 30, 2023
flutter/flutter@51bef1b...ff838bc

2023-06-29 [email protected] Add locale-specific
DateTime formatting syntax (flutter/flutter#129573)
2023-06-29 [email protected] Update `RadioListTile` tests to M3
(flutter/flutter#129718)
2023-06-29 [email protected] Roll Flutter Engine from
7fd0e9522ea1 to eabb22900b44 (1 revision) (flutter/flutter#129754)
2023-06-29 [email protected] Roll Flutter Engine from
d5c25ead07e9 to 7fd0e9522ea1 (2 revisions) (flutter/flutter#129752)
2023-06-29 [email protected] Fix typos in ListTile examples.
(flutter/flutter#129606)
2023-06-29 [email protected] Roll Flutter Engine from
4e49b9deb72d to d5c25ead07e9 (7 revisions) (flutter/flutter#129750)
2023-06-29 [email protected] Roll Flutter Engine from
241ca5c1d6be to 4e49b9deb72d (1 revision) (flutter/flutter#129730)
2023-06-29 [email protected] Skwasm benchmarks.
(flutter/flutter#129681)
2023-06-28 [email protected] RTL InputDecoration fix
(flutter/flutter#129661)
2023-06-28 [email protected] mark autoroller flaky
(flutter/flutter#129745)
2023-06-28 [email protected] Roll pub packages
(flutter/flutter#129380)
2023-06-28 [email protected] Removes
deprecated APIs from AnimationBuilder (flutter/flutter#129657)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC
[email protected],[email protected],[email protected] on
the revert to ensure that a human
is aware of the problem.

To file a bug in Packages:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md

---------

Co-authored-by: Camille Simon <[email protected]>
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 16, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 17, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 17, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 17, 2023
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

Successfully merging this pull request may close these issues.

Material InputDecoration contentPadding is broken in RTL

2 participants