You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ExpansionTile : expandedAlignment not accepts AlignmentDirectional to support rtl language #180813
the expandedAlignment defined as Alignment , not as AlignmentGeometry even if _buildBody returns Align widget which accepts alignment property as AlignmentGeometry
@victorsanni we can do that with one trade-off , The .resolve() method is not context-aware on its own. so this shifts the burden of finding the text direction from the Framework to the developer , so the developer forced to perform a lookup first to find out if the app is currently LTR or RTL.
by using the Automatic Lookup (i.e expandedAlignment: AlignmentDirectional. ) , we writing clean and simple without creating a boilerplate or doing manual look up .
find examples below
manual look up
voidmain() {
runApp(constMyApp());
}
classMyAppextendsStatelessWidget {
constMyApp({super.key});
@overrideWidgetbuild(BuildContext context) {
returnMaterialApp(
title:'Flutter ExpansionTile Test',
localizationsDelegates:const [
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
locale:Locale('ar'),
supportedLocales:const [Locale('en', 'US'), Locale('ar', 'IQ')],
theme:ThemeData(
colorScheme:ColorScheme.fromSeed(seedColor:Colors.deepPurple),
),
home:constMyHomePage(),
);
}
}
classMyHomePageextendsStatelessWidget {
constMyHomePage({super.key});
@overrideWidgetbuild(BuildContext context) {
// 1- we need lookup the framework and get the current TextDirection firstfinalTextDirection currentDirection =Directionality.of(context);
// 2- pass the TextDirection to the resolve methodfinalAlignment resolvedAlignment =AlignmentDirectional.centerStart
.resolve(currentDirection);
returnScaffold(
body:Center(
child:ExpansionTile(
title:Text('data'),
expandedAlignment: resolvedAlignment,
children: [Text('data')],
),
),
);
}
}
We are not introducing a new property. Instead, we are generalizing the existing expandedAlignment property by changing its type from Alignment to AlignmentGeometry.
Since AlignmentGeometry is the base class for both, this change is non-breaking:
Backward Compatible: Alignment inherits from AlignmentGeometry, so existing code remains valid.
New Feature: AlignmentDirectional also inherits from AlignmentGeometry, allowing us to support RTL layouts naturally.
Activity
Fixing ExpansionTile expandedAlignment not Accepts AlignmentGeometry f…
Fixing ExpansionTile expandedAlignment not Accepts AlignmentGeometry f…
victorsanni commentedon Jan 12, 2026
What about using AlignmentGeometry.resolve with rtl to get the alignment and pass it into expandedAlignment?
devnoaman commentedon Jan 13, 2026
@victorsanni we can do that with one trade-off , The .resolve() method is not context-aware on its own. so this shifts the burden of finding the text direction from the Framework to the developer , so the developer forced to perform a lookup first to find out if the app is currently LTR or RTL.
by using the Automatic Lookup (i.e expandedAlignment: AlignmentDirectional. ) , we writing clean and simple without creating a boilerplate or doing manual look up .
find examples below
manual look up
automatic look up
dkwingsmt commentedon Jan 14, 2026
To confirm, are you suggesting a new property that takes into account text direction? Should it replace the current one? (from triage)
devnoaman commentedon Jan 15, 2026
@dkwingsmt thanks for your review
We are not introducing a new property. Instead, we are generalizing the existing
expandedAlignmentproperty by changing its type fromAlignmenttoAlignmentGeometry.Since
AlignmentGeometryis the base class for both, this change isnon-breaking:Backward Compatible:
Alignmentinherits fromAlignmentGeometry, so existing code remains valid.New Feature:
AlignmentDirectionalalso inherits fromAlignmentGeometry, allowing us to support RTL layouts naturally.Fixing ExpansionTile expandedAlignment not Accepts AlignmentGeometry f…
Fixing ExpansionTile expandedAlignment not Accepts AlignmentGeometry … (
Fixing ExpansionTile expandedAlignment not Accepts AlignmentGeometry … (
Fixing ExpansionTile expandedAlignment not Accepts AlignmentGeometry … (
Fixing ExpansionTile expandedAlignment not Accepts AlignmentGeometry … (