Giter Club home page Giter Club logo

flutter_settings_ui's Introduction

Settings UI for Flutter

Pub Version

This project was archived, however since the original package seems unmaintained yet, I reactivated this package together with some improvements and changes. Please checkout the changelog for all changes.

Installing:

In your pubspec.yaml

dependencies:
  flutter_settings_ui: ^3.0.0
import 'package:flutter_settings_ui/flutter_settings_ui.dart';

Basic Usage:

      SettingsList(
        sections: [
          SettingsSection(
            title: const Text('Section'),
            tiles: [
              SettingsTile(
                title: const Text('Language'),
                description: const Text('English'),
                leading: const Icon(Icons.language),
                onPressed: (BuildContext context) {},
                ),
              SettingsTile.switchTile(
                initialValue: false,
                title: const Text('Use fingerprint'),
                leading: const Icon(Icons.fingerprint),
                onToggle: (bool value) {},
              ),
            ],
          ),
        ],
      )


Settings UI supports dark mode:


Contributing

Contributions are welcome! If you're new to the project's tech stack or need a refresher, here are some resources to get started:

Feel free to explore these resources to gain familiarity with the project's tech stack and contribute effectively.

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details

flutter_settings_ui's People

Contributors

daniel-naegele avatar dependabot[bot] avatar elirehema avatar henryingraham avatar juliansteenbakker avatar mohit-joshi-dev avatar noordawod 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

Watchers

 avatar  avatar  avatar  avatar  avatar

flutter_settings_ui's Issues

SettingsTile title gets truncated

The title field on iOS is getting truncated to about 50% of the width of the tile, even though the subtitle is short and does not need that space. Version 0.6.0 of settings_ui worked fine, then this bug was introduced somewhere leading up to version 1.0.0. The issue exists on that project's GitHub page, see yako-dev/flutter-settings-ui#78. It was closed so I assume there was a fix that did not make it into this fork?

In this image, the top tile is good but the bottom tile has the title truncated:
Screen Shot 2021-12-09 at 5 08 39 PM

Idea: Get native widgets depending on platform

I think it would be great if we had the possibility to have settings with the aspect of each platform. For example, I am now working with Windows and FluentUI (https://pub.dev/packages/fluent_ui), so having a native out-of-the-box look would be great. And there are other similar packages for Linux or MacOS like https://pub.dev/packages/yaru or https://pub.dev/packages/macos_ui

In other projects I think that what is usually done is to have child subprojects that implement the UI depending on the platform.

What do you think?

Readme is not updated

The project Readme is not updated with the code changes.
Example:

SettingsTile(
              title: 'Language', // This title property doesn't take String as suggested in the readme it takes a Widget
              subTitle:  // This is changed to description but in the docs its still mentioned as subTitle
)

onPressed not working in iOS

I've implemented this package and on android everything seems good. However on iOS, it does not seem that the onPressed method is working or getting called and same with the onToggle method. Has anyone else experienced this or confirm that it is working for them on iOS? I am using version 2.0.1, flutter version 2.5.3, and iOS 15

this is my implementation:

SettingsList(
      contentPadding: EdgeInsets.all(0),
      sections: [
        SettingsSection(
          title: 'Security',
          titleTextStyle: titleTextStyle,
          tiles: [
            SettingsTile(
              title: 'ID Method',
              subtitle: bio! ? 'Biometric' : 'Pin',
              leading: Icon(Icons.perm_identity_sharp),
              trailing: Icon(Icons.arrow_right),
              onPressed: (BuildContext context) {
                Navigator.push(
                  context,
                  MaterialPageRoute(
                    builder: (context) => ChangeIdPage(),
                  ),
                );
              },
            ),
...

[Bug] Cannot run the package with v3.x

When I run the flutter project with flutter_settings_ui: ^3.0.0 in pubspec.yaml, get the following issue. Earlier I was using settings_ui: ^2.0.2 without an issue and because it's no longer maintained and it had no way to set the background color, switched to this package.

My specs,

  • Flutter Channel stable, 3.10.0, on macOS 14.4
  • sdk: '>=3.0.0 <3.3.0'
../../../../../../.pub-cache/hosted/pub.dev/flutter_settings_ui-3.0.1/lib/src/tiles/platforms/web_settings_tile.dart:36:36: Error: Member not found: 'MediaQuery.textScalerOf'.
    final scaleFactor = MediaQuery.textScalerOf(context).scale(1);
                                   ^^^^^^^^^^^^
../../../../../../.pub-cache/hosted/pub.dev/flutter_settings_ui-3.0.1/lib/src/tiles/platforms/web_settings_tile.dart:76:32: Error: The argument type 'num' can't be assigned to the parameter type 'double'.
                    bottom: 19 * scaleFactor,
                               ^
../../../../../../.pub-cache/hosted/pub.dev/flutter_settings_ui-3.0.1/lib/src/tiles/platforms/web_settings_tile.dart:77:29: Error: The argument type 'num' can't be assigned to the parameter type 'double'.
                    top: 19 * scaleFactor,
                            ^
../../../../../../.pub-cache/hosted/pub.dev/flutter_settings_ui-3.0.1/lib/src/tiles/platforms/ios_settings_tile.dart:102:36: Error: Member not found: 'MediaQuery.textScalerOf'.
    final scaleFactor = MediaQuery.textScalerOf(context).scale(1);
                                   ^^^^^^^^^^^^
../../../../../../.pub-cache/hosted/pub.dev/flutter_settings_ui-3.0.1/lib/src/tiles/platforms/ios_settings_tile.dart:109:16: Error: The argument type 'num' can't be assigned to the parameter type 'double'.
        top: 8 * scaleFactor,
               ^
../../../../../../.pub-cache/hosted/pub.dev/flutter_settings_ui-3.0.1/lib/src/tiles/platforms/ios_settings_tile.dart:110:50: Error: The argument type 'num' can't be assigned to the parameter type 'double'.
        bottom: additionalInfo.needToShowDivider ? 24 : 8 * scaleFactor,
                                                 ^
../../../../../../.pub-cache/hosted/pub.dev/flutter_settings_ui-3.0.1/lib/src/tiles/platforms/ios_settings_tile.dart:130:36: Error: Member not found: 'MediaQuery.textScalerOf'.
    final scaleFactor = MediaQuery.textScalerOf(context).scale(1);
                                   ^^^^^^^^^^^^
../../../../../../.pub-cache/hosted/pub.dev/flutter_settings_ui-3.0.1/lib/src/tiles/platforms/ios_settings_tile.dart:162:26: Error: The argument type 'num' can't be assigned to the parameter type 'double?'.
                size: 18 * scaleFactor,
                         ^
../../../../../../.pub-cache/hosted/pub.dev/flutter_settings_ui-3.0.1/lib/src/tiles/platforms/ios_settings_tile.dart:184:36: Error: Member not found: 'MediaQuery.textScalerOf'.
    final scaleFactor = MediaQuery.textScalerOf(context).scale(1);
                                   ^^^^^^^^^^^^
../../../../../../.pub-cache/hosted/pub.dev/flutter_settings_ui-3.0.1/lib/src/tiles/platforms/android_settings_tile.dart:38:36: Error: Member not found: 'MediaQuery.textScalerOf'.
    final scaleFactor = MediaQuery.textScalerOf(context).scale(1);
                                   ^^^^^^^^^^^^
../../../../../../.pub-cache/hosted/pub.dev/flutter_settings_ui-3.0.1/lib/src/tiles/platforms/android_settings_tile.dart:77:32: Error: The argument type 'num' can't be assigned to the parameter type 'double'.
                    bottom: 19 * scaleFactor,
                               ^
../../../../../../.pub-cache/hosted/pub.dev/flutter_settings_ui-3.0.1/lib/src/tiles/platforms/android_settings_tile.dart:78:29: Error: The argument type 'num' can't be assigned to the parameter type 'double'.
                    top: 19 * scaleFactor,
                            ^
../../../../../../.pub-cache/hosted/pub.dev/flutter_settings_ui-3.0.1/lib/src/sections/platforms/web_settings_section.dart:24:36: Error: Member not found: 'MediaQuery.textScalerOf'.
    final scaleFactor = MediaQuery.textScalerOf(context).scale(1);
                                   ^^^^^^^^^^^^
../../../../../../.pub-cache/hosted/pub.dev/flutter_settings_ui-3.0.1/lib/src/sections/platforms/web_settings_section.dart:35:27: Error: The argument type 'num' can't be assigned to the parameter type 'double'.
                bottom: 5 * scaleFactor,
                          ^
../../../../../../.pub-cache/hosted/pub.dev/flutter_settings_ui-3.0.1/lib/src/sections/platforms/web_settings_section.dart:37:25: Error: The argument type 'num' can't be assigned to the parameter type 'double'.
                top: 40 * scaleFactor,
                        ^
../../../../../../.pub-cache/hosted/pub.dev/flutter_settings_ui-3.0.1/lib/src/sections/platforms/web_settings_section.dart:33:26: Error: The argument type 'num' can't be assigned to the parameter type 'double?'.
              height: 65 * scaleFactor,
                         ^
../../../../../../.pub-cache/hosted/pub.dev/flutter_settings_ui-3.0.1/lib/src/sections/platforms/ios_settings_section.dart:22:36: Error: Member not found: 'MediaQuery.textScalerOf'.
    final scaleFactor = MediaQuery.textScalerOf(context).scale(1);
                                   ^^^^^^^^^^^^
../../../../../../.pub-cache/hosted/pub.dev/flutter_settings_ui-3.0.1/lib/src/sections/platforms/ios_settings_section.dart:28:42: Error: The argument type 'num' can't be assigned to the parameter type 'double'.
            bottom: isLastNonDescriptive ? 27 * scaleFactor : 10 * scaleFactor,
                                         ^
../../../../../../.pub-cache/hosted/pub.dev/flutter_settings_ui-3.0.1/lib/src/sections/platforms/ios_settings_section.dart:39:27: Error: The argument type 'num' can't be assigned to the parameter type 'double'.
                bottom: 5 * scaleFactor,
                          ^
../../../../../../.pub-cache/hosted/pub.dev/flutter_settings_ui-3.0.1/lib/src/sections/platforms/android_settings_section.dart:24:36: Error: Member not found: 'MediaQuery.textScalerOf'.
    final scaleFactor = MediaQuery.textScalerOf(context).scale(1);
                                   ^^^^^^^^^^^^
../../../../../../.pub-cache/hosted/pub.dev/flutter_settings_ui-3.0.1/lib/src/sections/platforms/android_settings_section.dart:38:21: Error: The argument type 'num' can't be assigned to the parameter type 'double'.
            top: 24 * scaleFactor,
                    ^
../../../../../../.pub-cache/hosted/pub.dev/flutter_settings_ui-3.0.1/lib/src/sections/platforms/android_settings_section.dart:39:24: Error: The argument type 'num' can't be assigned to the parameter type 'double'.
            bottom: 10 * scaleFactor,
                       ^
Target kernel_snapshot failed: Exception


FAILURE: Build failed with an exception.

SettingsTile.switchTile | Error "Null check operator used on a null value"

════════ Exception caught by widgets library ═══════════════════════════════════
The following _TypeError was thrown building SettingsTile(dirty):
Null check operator used on a null value

When the exception was thrown, this was the stack:
#0      SettingsTheme.of (package:flutter_settings_ui/src/utils/settings_theme.dart:21:18)
settings_theme.dart:21
#1      SettingsTile.build (package:flutter_settings_ui/src/tiles/settings_tile.dart:94:33)
settings_tile.dart

I ran into issue above after migration to new version (3.0.0). Even the snippet below that I got from the example, gives me the error.

SettingsTile.switchTile(
                initialValue: false,
                onToggle: (_) {},
                title: Text('Allow notification snoozing'),
              ),

Basic usage example outdated?

I am new to flutter, so please be understanding if I am confusing things: I am getting errors implementing the basic usage example. It seems, the title for instance requires a Text() widget. Maybe, the flutter_settings_ui package has been updated to require different input without updating the basic usage example?

SettingsSection(
            title: 'Section',
            tiles: [
              SettingsTile(
                **title: 'Language',**
                subtitle: 'English',
                leading: Icon(Icons.language),
                onPressed: (BuildContext context) {},
              ),
              SettingsTile.switchTile(
                title: 'Use fingerprint',
                leading: Icon(Icons.fingerprint),
                switchValue: value,
                onToggle: (bool value) {},
              ),
            ],
          ),

Update design to iOS 15

The current design is based on iOS 14 it would be nice if it could be updated to the iOS 15 design.
Rounded corners, margin left and right.

image

Or even better take into account which version to display.

SettingsTile(
    ...
    this.iosVersion = 15 // default to 15 in the constructor
    ...
)

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.