yako-dev / flutter-settings-ui Goto Github PK
View Code? Open in Web Editor NEWCreate native settings for Flutter app in a minutes.
Home Page: https://pub.dev/packages/settings_ui
License: Apache License 2.0
Create native settings for Flutter app in a minutes.
Home Page: https://pub.dev/packages/settings_ui
License: Apache License 2.0
I got the following errror when I ran on web platform. Is it supporting web?
Unsupported operation: Platform._operatingSystem
Hi all!
For any reason, my settings in iOS in release mode is not showing it up.
settings_ui: ^0.3.0
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.17.3, on Linux, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] Android Studio (version 4.0)
[✓] Android Studio (version 3.6)
[✓] Connected device (1 available)
• No issues found!
https://github.com/yako-dev/flutter-settings-ui/blob/master/lib/src/colors.dart#L9
Here for example, the iosTileDarkColor
is hardcoded but then the background color of the SettingsList
is not, so they end up not matching.
Am I missing something or am I correct in saying that these colors can not be set?
I think more customization would be awesome.. Maybe not showing the dividers for example, as well?
I can't find an option to activate dark mode manually, can this be correct? Also, don't get it done with a provider because the plugin doesn't support that in the settings.
Anyone have an idea for this?
the settingsTile widget still shows '...' after long text even when maxLine was set to 2 but this works on Android
Hi, I'm just starting with Flutter so I'm not sure if it's related to the library or not.
I'm using Flutter 2.0.2, Dart 2.12.1 and the Prerelease: 1.0.0-nullsafety.2 version (I guess I have to use that version because of null safety).
The library is working perfectly in the android device, but not in the web device (chrome) and it's throwing this error Expected a value of type 'List<Widget>', but got one of type 'List<Widget?>'
:
My code is basically like the example code:
If you need more info just me know. Thanks in advance.
I can do this by placing a Container with a TextField inside a SettingTile but I don't think that this is the right approach.
Any advice who has more experience than me on this?
In iOS SettingsTile [CupertinoSettingsItem] when you set trailing but not iosChevron, you will see duplicated trailing.
When trailing is set, not show iOS Chevron.
Double trailing
if (widget.iosChevron != null && widget.trailing!= null) {
...
}
SettingsTile(
title: 'Blabla',
leading: Icon(Icons.food_bank_outlined),
),
trailing: Icon(Icons.keyboard_arrow_right),
onPressed: (value) {
},
),
iOS device
When I have an CupertinoApp and I use the SettingsList widget, it still only uses the Material Theme class, which has the light brightness as default.
However, using the CupertinoApp widget, and having dark mode enabled, sets only the CupertinoTheme class to dark and not the Theme class.
This gives back a weird result, where the NavBar is dark, but the SettingsList is still light.
In the v0.5.0
, the onTap
which was a VoidCallback
has been deprecated in favor of onPressed
which has dynamic Function(BuildContext)
signature.
With the SettingsTile
behaving more or less like a ListTile
, it feels inconsistent to have a BuildContext
on the onPressed
callback.
Why do we need that context
parameter?
Running flutter pub get only returns version 0.6.0, and manually changing the pubspec.yaml
to settings_ui: ^0.7.0
results in this error:
Because[your app] depends on settings_ui ^0.7.0 which doesn't match any versions, version solving failed.
Tried to fix this by fixing the flutter cache with flutter pub cache repair
, to no avail.
Is there some pub.dev setting that has to be made to get this version registered with flutter pub?
Could you add enabled attribute for SettingsTile? Thank you!
Would expect the ripple effect to be there, at least when onTap != null
Thanks for the great plugin.
I would like to display the version of the application in the settings screen.
Is there any way to hide the arrow on the far right?
I am trying to combine it with CustomScrollView as I want to add some Widgets above the setting elements
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: CustomScrollView(
physics: BouncingScrollPhysics(),
slivers: <Widget>[
SliverList(
delegate: SliverChildListDelegate([
SizedBox(height: 20),
Text("Edit Settings" ),
Expanded(
child: SettingsList(
sections: [...],
),
)
])),
],
));
}
Hey,
Thanks for this package. I've seen really interesting PR with backgroundColor fix and more customization which is to me, very important, to make you UI consistent.
Do you plan in making a release for this package? Otherwise, give rights to new contributors to make this package still alive...
Thanks!
Looking to implement this package in my project and it looks promising. Good work!
For some reason though the SettingsTile.switchTile
switch only works if I swipe it, just tapping it does not toggle the switch.
This is on iOS, have not tried Android behavior.
Great lib! But have you thought of bigger screens support?
Of course everyone can fork and do it on their own but that is a nice to have feature.
Cheers
I found an error with your example, relevant with contentPadding
.
════════ Exception caught by rendering library ═════════════════════════════════
The following assertion was thrown during performLayout():
Leading widget consumes entire tile width. Please use a sized widget, or consider replacing ListTile with a custom widget (see https://api.flutter.dev/flutter/material/ListTile-class.html#material.ListTile.4)
'package:flutter/src/material/list_tile.dart':
Failed assertion: line 1547 pos 7: 'tileWidth != leadingSize.width'
example code (example/lib/screens/settings_screen.dart):
Widget buildSettingsList() {
return SettingsList(
contentPadding: EdgeInsets.symmetric(horizontal: 180), // this line raises error
sections: [
SettingsSection(
title: 'Common',
I think using EdgeInsets.symmetric(vertical: 20)
would be correct instead of EdgeInsets.symmetric(horizontal: 180)
.
here is the screenshot.
It would be great if you consider correcting the example code.
Thanks.
hey there nice work, is there an option to change the SettingsSection and SettingsTile background color?
Currently tiles parameter needs a List<SettingsTile>
, this become a problem if we need to wrap SettingsTile
with something else (for example: Bloc or other custom wrapper) since the type will become widget and isn't compatible with SettingsTile
How can I change switch active color , and need to description under setting tiles
Are there plans to add null safety support, and if so: when do you think this might happen?
In the GestureDetector method of CupertinoSettingsItem, the onTap handler has the following code to toggle the switch, however this code does not checked if widget.enabled is true. This has the effect of allowing toggle switches to have their onToggle callback called when they are disabled, which shouldn't happen IMO. My workaround is to check the disabled condition again in my callback, but ideally this should be fixed in the lib.
if (widget.type == SettingsItemType.toggle) {
setState(() {
_checked = !_checked;
widget.onToggle(_checked);
});
}
I think the fix is just to change the first line as follows:
if (widget.type == SettingsItemType.toggle && widget.enabled) {
Is there the possibility to modify a text field such as email, username etc.?
I have not seen examples of this
Either the settings tile should grow automatically or the text should shrink to fit. If not possible already would you accept a PR to get this done?
The background of the settings is nearly black while the AppBar is more dark grey. I think this is a Android thing only because iOS has this black darkmode. Is there any way to change this? I would really like to use it in my app but this currently holds me back.
Weird behavior im encountering. the onToggle gets called when it's either one of the toggled values.
but not both.
the switchValue is a boolean variable where the default value is set via an await function where i get the value saved in storage.
Currently, in iOS cupertino style click on settings section row, there were no same press effect as iOS native does.
Does it possible to enchance it?
Awesome project- a real time saver and nice, clean code.
It'd be great to add an option to some settings tiles (e.g. switch tiles) that would provide options to automatically save the value to shared preferences. I'd suggest starting with switch tiles, using the settings label as the default preferences key when saving, and providing a configuration option to set a non-default key. Settings for other tile types would require some more discussion.
Is this something anyone else would find valuable? If there's enough interest and a willingness to accept the feature request, I can put together a pull request.
Why?
Because I want to change the values in runtime
Hi,
the switchTile subtitle no work on IOS, I'm testing with Example provided in package, did i forget something ?
SettingsTile.switchTile(
title: 'Lock app in background',
subtitle: 'subtitle test',
leading: Icon(Icons.phonelink_lock),
switchValue: lockInBackground,
onToggle: (bool value) {
setState(() {
lockInBackground = value;
notificationsEnabled = value;
});
},
),
attached screenshot for ISO / Android
From commit 99faae32 the package has been updated to v0.4.0 but it's still v0.3.0 on pub.dev.
@yadaniyil Can this be clarified?
Once user taps on the setting, a modal dialog will show with a list of options to choose from.
An exception occurs here.
settings_list.dart:38
futureOne = sections[index + 1];
Why does indexing start at 1? It's out of range all the time.
Hi there,
I really like the UI, awesome work!!
my code snippet is as below,
SettingsTile(
title: 'Sign Out',
leading: Icon(Icons.exit_to_app),
// switchValue: true,
// onToggle: (bool value) {},
onTap: ()=>context.read<Userl>().isLoggedIn=false,
),
onTap wil trigger a page switch (setting page is gone and show login page instead)
when it get executed, i get following warning...
[VERBOSE-2:ui_dart_state.cc(166)] Unhandled Exception: setState() called after dispose(): CupertinoSettingsItemState#d5178(lifecycle state: defunct, not mounted)
This error happens if you call setState() on a State object for a widget that no longer appears in the widget tree (e.g., whose parent widget no longer includes the widget in its build). This error can occur when code calls setState() from a timer or an animation callback.
The preferred solution is to cancel the timer or stop listening to the animation in the dispose() callback. Another solution is to check the "mounted" property of this object before calling setState() to ensure the object is still in the tree.
This error might indicate a memory leak if setState() is being called because another object is retaining a reference to this State object after it has been removed from the tree. To avoid memory leaks, consider breaking the reference to this object during dispose().
#0 State.setState.<anonymous closure> (package:flutter/src/wid<…>
it is very descriptive , can you please help to fix it
thanks in advance
When using CupertinoApp instead of MaterialApp, switching between light and dark mode has no effect. The active color specified in the cupertinoTheme property of CupertinoApp is also not applied to switch tiles.
When I use lambda syntax for SettingsTile callback onTap: () => print('test')
vs anonymous function syntax onTap: () { print('test'); }
I get an exception thrown type '() => void' is not a subtype of type '() => Future<void>'
. I believe this is because SettingsTile onTap is defined as a VoidCallback or void Function() and it is being assigned to CupertinoSettingsItem.onPress which is a PressOperationCallback or Future<void>.
Full example tile that will cause crash:
SettingsTile( title: 'testing', onTap: () => print('testing'), )
Is there any way to manually set ui dark mode, i have tried this but not work:
return CupertinoTheme(
data: gThemeData,
child: DefaultTextStyle(
style: gThemeData.textTheme.textStyle,
child: new CupertinoPageScaffold(
navigationBar: new CupertinoNavigationBar(
border: Border(),
padding: EdgeInsetsDirectional.only(start: 2),
leading: CupertinoButton(
padding: EdgeInsets.all(0),
child: Row(
children: <Widget>[
new Icon(
MyFlutterApp.left_open,
color: globalMainChatColor,
size: 25,
),
Text("设置",
textAlign: TextAlign.center,
style: TextStyle(
fontFamily: gDefaultFontName,
color: globalMainChatColor))
],
),
onPressed: () {
Navigator.pop(context);
},
),
),
child: SettingsList(
sections: [
SettingsSection(
I need this for my app.
Thank you 👍
Container(
padding: EdgeInsets.all(10.0),
child: Column(
children: [
//other Widget,
SettingsList(
sections: [
SettingsSection(
tiles: [
SettingsTile(
title: 'Document Backup',
leading: Icon(Icons.backup),
onTap: () {
print('backup');
},
),
],
),
],
);
When i add another my custom UI above SettingsTile,
The settings_ui doesnt' appear at all, can i add my other Custom UI before i put the custom_ui ?
How can I add a custom widget to the page that has a setting UI template?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.