-
Notifications
You must be signed in to change notification settings - Fork 234
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
SettingsTile trailing widget not appearing on Web #180
Comments
Having the same issue while using settings_ui 2.0.2 Looking at the code for web it looks like it should render normally so not really sure what is going on here. flutter-settings-ui/lib/src/tiles/platforms/web_settings_tile.dart Lines 114 to 144 in a2565cb
Looking further into it, trailing is broken for every tiletype at the moment. |
Alright I figured it out, the commit fixing this is not released yet @M-ixai-L do you see a chance to release #127 as a new version? Right now for 2.0.2 the code looks like thisimport 'package:flutter/material.dart';
import 'package:settings_ui/settings_ui.dart';
import 'package:settings_ui/src/utils/settings_theme.dart';
class WebSettingsTile extends StatelessWidget {
const WebSettingsTile({
required this.tileType,
required this.leading,
required this.title,
required this.description,
required this.onPressed,
required this.onToggle,
required this.value,
required this.initialValue,
required this.activeSwitchColor,
required this.enabled,
required this.trailing,
Key? key,
}) : super(key: key);
final SettingsTileType tileType;
final Widget? leading;
final Widget? title;
final Widget? description;
final Function(BuildContext context)? onPressed;
final Function(bool value)? onToggle;
final Widget? value;
final bool initialValue;
final bool enabled;
final Widget? trailing;
final Color? activeSwitchColor;
@override
Widget build(BuildContext context) {
final theme = SettingsTheme.of(context);
final scaleFactor = MediaQuery.of(context).textScaleFactor;
final cantShowAnimation = tileType == SettingsTileType.switchTile
? onToggle == null && onPressed == null
: onPressed == null;
return IgnorePointer(
ignoring: !enabled,
child: Material(
color: Colors.transparent,
child: InkWell(
onTap: cantShowAnimation
? null
: () {
if (tileType == SettingsTileType.switchTile) {
onToggle?.call(!initialValue);
} else {
onPressed?.call(context);
}
},
highlightColor: theme.themeData.tileHighlightColor,
child: Container(
child: Row(
children: [
if (leading != null)
Padding(
padding: const EdgeInsetsDirectional.only(
start: 24,
),
child: IconTheme(
data: IconTheme.of(context).copyWith(
color: theme.themeData.leadingIconsColor,
),
child: leading!,
),
),
Expanded(
child: Padding(
padding: EdgeInsetsDirectional.only(
start: 24,
end: 24,
bottom: 19 * scaleFactor,
top: 19 * scaleFactor,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
DefaultTextStyle(
style: TextStyle(
color: theme.themeData.settingsTileTextColor,
fontSize: 18,
fontWeight: FontWeight.w400,
),
child: title ?? Container(),
),
if (value != null)
Padding(
padding: EdgeInsets.only(top: 4.0),
child: DefaultTextStyle(
style: TextStyle(
color: theme.themeData.tileDescriptionTextColor,
),
child: value!,
),
)
else if (description != null)
Padding(
padding: EdgeInsets.only(top: 4.0),
child: DefaultTextStyle(
style: TextStyle(
color: theme.themeData.tileDescriptionTextColor,
),
child: description!,
),
),
],
),
),
),
// if (tileType == SettingsTileType.switchTile)
// SizedBox(
// height: 30,
// child: VerticalDivider(),
// ),
if (tileType == SettingsTileType.switchTile)
Padding(
padding:
const EdgeInsetsDirectional.only(start: 16, end: 8),
child: Switch.adaptive(
value: initialValue,
onChanged: onToggle,
),
),
],
),
),
),
),
);
}
} For now @guskuma and others you can use the git import instead of the pub package in your pubspec.yaml like so:
Pegging to the specific commit that fixed trailing, or if you are feeling more adventurous you can reference master like so:
|
Please trigger a new release, because i need this feature and i dont want to use a dev if possible. |
When using SettingsTile on web trailing widget is not shown.
my code:
android screen:
web screen:
The text was updated successfully, but these errors were encountered: