Skip to content

Commit

Permalink
fix: fix long IOSSettingsTile value text
Browse files Browse the repository at this point in the history
  • Loading branch information
yadaniyil committed Dec 4, 2023
1 parent e93eee8 commit 2189cc4
Showing 1 changed file with 50 additions and 42 deletions.
92 changes: 50 additions & 42 deletions lib/src/tiles/platforms/ios_settings_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ class IOSSettingsTile extends StatefulWidget {
this.titlePadding,
this.leadingPadding,
this.titleDescriptionPadding,
Key? key,
}) : super(key: key);
super.key,
});

final SettingsTileType tileType;
final Widget? leading;
Expand Down Expand Up @@ -131,52 +131,60 @@ class IOSSettingsTileState extends State<IOSSettingsTile> {
}) {
final scaleFactor = MediaQuery.of(context).textScaleFactor;

return Row(
children: [
if (widget.trailing != null)
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: IconTheme(
data: IconTheme.of(context).copyWith(
color: widget.enabled
? theme.themeData.leadingIconsColor
: theme.themeData.inactiveTitleColor,
final isShowValue = widget.tileType == SettingsTileType.navigationTile &&
widget.value != null;

return Flexible(
flex: isShowValue ? 1 : 0,
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
if (widget.trailing != null)
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: IconTheme(
data: IconTheme.of(context).copyWith(
color: widget.enabled
? theme.themeData.leadingIconsColor
: theme.themeData.inactiveTitleColor,
),
child: widget.trailing!,
),
child: widget.trailing!,
),
),
if (widget.tileType == SettingsTileType.switchTile)
CupertinoSwitch(
value: widget.initialValue ?? true,
onChanged: widget.onToggle,
activeColor: widget.enabled
? widget.activeSwitchColor
: theme.themeData.inactiveTitleColor,
),
if (widget.tileType == SettingsTileType.navigationTile &&
widget.value != null)
DefaultTextStyle(
style: TextStyle(
color: widget.enabled
? theme.themeData.trailingTextColor
if (widget.tileType == SettingsTileType.switchTile)
CupertinoSwitch(
value: widget.initialValue ?? true,
onChanged: widget.onToggle,
activeColor: widget.enabled
? widget.activeSwitchColor
: theme.themeData.inactiveTitleColor,
fontSize: 17,
),
child: widget.value!,
),
if (widget.tileType == SettingsTileType.navigationTile)
Padding(
padding: const EdgeInsetsDirectional.only(start: 6, end: 2),
child: IconTheme(
data: IconTheme.of(context)
.copyWith(color: theme.themeData.leadingIconsColor),
child: Icon(
CupertinoIcons.chevron_forward,
size: 18 * scaleFactor,
if (isShowValue)
Expanded(
child: DefaultTextStyle(
style: TextStyle(
color: widget.enabled
? theme.themeData.trailingTextColor
: theme.themeData.inactiveTitleColor,
fontSize: 17,
),
child: widget.value!,
),
),
),
],
if (widget.tileType == SettingsTileType.navigationTile)
Padding(
padding: const EdgeInsetsDirectional.only(start: 6, end: 2),
child: IconTheme(
data: IconTheme.of(context)
.copyWith(color: theme.themeData.leadingIconsColor),
child: Icon(
CupertinoIcons.chevron_forward,
size: 18 * scaleFactor,
),
),
),
],
),
);
}

Expand Down

0 comments on commit 2189cc4

Please sign in to comment.