Skip to content
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

NeumorphicSwitch implementation #37

Closed
wants to merge 4 commits into from
Closed

NeumorphicSwitch implementation #37

wants to merge 4 commits into from

Conversation

almighty972
Copy link
Collaborator

@almighty972 almighty972 commented Feb 26, 2020

The first usable version of the NeumorphicSwitch widget is implemented.
The track and the thumb are built from a Neumorphic widget.

NeumorphicSwitch can take a NeumorphicSwitchStyle as input.
You can provide these values to the NeumorphicSwitch through the NeumorphicSwitchStyle:

  • depth
  • concaveShape
  • activeTrackColor
  • inactiveTrackColor
  • activeThumbColor
  • inactiveThumbColor

If no NeumorphicSwitchStyle is provided, the switch will use the default theme values.

To use NeumorphicSwitch (emboss mode):

    NeumorphicSwitch(
          value: _switchEnable,
          style: NeumorphicSwitchStyle(
              depth: -3, 
              concaveShape: false,
          onChanged: (value) {
            setState(() {
              _switchEnable = value;
            });
          },
    )

neumorphic_switch_off

neumorphic_switch_on

To use NeumorphicSwitch (concave mode):

    NeumorphicSwitch(
          value: _switchEnable,
          style: NeumorphicSwitchStyle(
              concaveShape: true,
          onChanged: (value) {
            setState(() {
              _switchEnable = value;
            });
          },
    )

neumorphic_switch_concave_off
neumorphic_switch_concave_on

@almighty972 almighty972 self-assigned this Feb 26, 2020
@florent37 florent37 linked an issue Feb 26, 2020 that may be closed by this pull request
@almighty972 almighty972 added this to In progress in Widgets Feb 26, 2020
@almighty972 almighty972 changed the title Neumorphic Switch implementation NeumorphicSwitch implementation Feb 26, 2020
lib/widget/switch.dart Outdated Show resolved Hide resolved
lib/widget/switch.dart Outdated Show resolved Hide resolved
lib/widget/switch.dart Outdated Show resolved Hide resolved
child: Neumorphic(
shape: NeumorphicBoxShape.circle(),
style: NeumorphicStyle(
shape: NeumorphicShape.emboss,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the Thumb might be concave / convex
as tried

Capture d’écran 2020-02-26 à 18 24 31

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only the "background" is embossed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or the thumb is flat with more elevation than the background

lib/widget/switch.dart Outdated Show resolved Hide resolved
lib/widget/switch.dart Outdated Show resolved Hide resolved
@florent37 florent37 moved this from In progress to Review in Widgets Feb 27, 2020
@florent37
Copy link
Member

looks like yours :)

Capture d’écran 2020-02-27 à 23 13 39

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Widgets
  
Done
Development

Successfully merging this pull request may close these issues.

Switch
2 participants