Giter Site home page Giter Site logo

yako-dev / flutter-settings-ui Goto Github PK

View Code? Open in Web Editor NEW
884.0 15.0 234.0 17.31 MB

Create native settings for Flutter app in a minutes.

Home Page: https://pub.dev/packages/settings_ui

License: Apache License 2.0

Kotlin 0.11% Swift 0.37% Objective-C 0.03% Dart 74.48% HTML 0.17% Ruby 1.25% CMake 7.34% C++ 15.55% C 0.68%
flutter dart mobile android ios ui widget ui-components settings adaptive

flutter-settings-ui's People

Contributors

akora-ingdkb avatar arthurdenner avatar asakahara avatar cpdunphy avatar ejprok avatar ekurkel avatar he0119 avatar juliansteenbakker avatar m-ixai-l avatar mrkajetanp avatar mrquentin avatar noordawod avatar preetjdp avatar yadaniyil avatar zeusbaba avatar zigapovhe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flutter-settings-ui's Issues

Settings not showing up in iOS

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!

photo_2020-06-09_18-01-30

Can not change Dark mode manually?

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?

Expected a value of type 'List<Widget> error in web device

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?>':

error

My code is basically like the example code:

code

If you need more info just me know. Thanks in advance.

Double trailing when trailing is setted in iOS

In iOS SettingsTile [CupertinoSettingsItem] when you set trailing but not iosChevron, you will see duplicated trailing.

Expected Behavior

When trailing is set, not show iOS Chevron.

Current Behavior

Double trailing

Possible Solution

if (widget.iosChevron != null && widget.trailing!= null) {
...
}

Steps to Reproduce

SettingsTile(
              title: 'Blabla',
              leading: Icon(Icons.food_bank_outlined),
              ),
              trailing: Icon(Icons.keyboard_arrow_right),
              onPressed: (value) {
              },
            ),

Context (Environment)

iOS device

Dark Theme in CupertinoApp

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.

Why does onPressed have a BuildContext parameter?

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?

Possibility to add images

Been using thsi fantastic lib but had an enhancement request. Something similar to the screenshot fromt he app Tripsy. The gear icon is what I was hoping to be rendered.
IMG_46CCD5729C52-1

flutter pub get only returns ^0.6.0

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?

Not working with CustomScrollView

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: [...],
                ),
              )
            ])),
          ],
        ));
  }

Is this package still updated?

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!

SettingsTile.switchTile only works for swipe

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.

Updated Web UI

When should we expect web support? You could take some inspirations from chrome settings.

google-chrome-settings-page.png

Tablet/iPad support

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

contentPadding value seems incorrect

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.

Before

image

After

image


It would be great if you consider correcting the example code.

Thanks.

Null Safety

Are there plans to add null safety support, and if so: when do you think this might happen?

BUG: CupertinoSettingsItem allows toggle when disabled

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) {

Example edit text

Is there the possibility to modify a text field such as email, username etc.?

I have not seen examples of this

Too dark background on Android

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.

SwitchTile onToggle doesnt fire all the time

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.

Option to save/load settings in shared preferences

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.

switchTile subtitle not work on IOS

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

Screenshot 2020-12-25 at 18 53 51

use mounted for setState

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

Not completely compatible with CupertinoApp

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.

Crash when using lambda for onTap: callback on iOS

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'), )

Margin broken when upgrading to v0.6

Hello 👋
Thank you for this great project, it makes the creation of simple settings UI very easy! But I upgraded my app to v0.6 and got this problem. Can you take a look at it? Thank you

v0.4:

v0.6:

Anyway to manually set UI dark mode?

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(

can't input other Widget above SettingsList

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 ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.