Giter VIP home page Giter VIP logo

fluid-for-sketch's Introduction

⚠️ This project is no longer actively maintained.

While some functionality of this plugin may continue to work for the forseeable future, there is no guarantee that it will survive any breaking changes made by the Sketch team. If you're looking for potential alternatives to Fluid plugin, look here.


💧 Fluid for Sketch 1.7.6

A collaborative project brought to you by Matt Curtis & Cat Noone

Fluid is a Sketch plugin that provides a means to create more constraint-based, responsive designs. It is based on Auto Layout constraints.

📦 Download Plugin (.zip) Changelog ⬇️ Download the Demo Sketch Document

Installation

Using Sketchpacks

Install Fluid for Sketch with Sketchpacks

Using Sketch Runner

With Sketch Runner, just go to the install command and search for Fluid. Runner allows you to manage plugins and do much more to speed up your workflow in Sketch. Download Runner here.

Install with Sketch Runner

Using Sketch Plugin Manager

Installation via Sketch Plugin Manager:

  1. In the 'Catalog' tab, click in the 'Search' field and type 'Fluid', to filter the list
  2. You will see the 'Fluid for Sketch' plugin listed. Click the 'Install' button.

Using Sketch Toolbox

⚠️ Sketch Toolbox is no longer officially supported due to a lack of updates and several bugs. If you usually use Sketch Toolbox, please install manually or through another plugin manager.

Manually

  1. Download the .zip above and extract it.
  2. Double-click Fluid.sketchplugin.
  3. ???
  4. Profit!!!

Updating

  1. After updating Fluid (whether manually or via other manager) restart Sketch to receive goodness.

Features

  • Pin, Offset, Center, and Size relative to Parent Group, Parent Artboard, or Previous Sibling Layer
  • Utilize simple mathematic expressions as values, such as 50% - 10
  • Quickly resize artboards and update their layout
  • Preview, export and copy artboards at different sizes in Preview Mode
  • Constraints are stored directly on a layer, so no worries with layer names

Usage

First and foremost, we recommend downloading the example Sketch document included in this repo (linked to it above). There are several examples included there. Examining the constraints used and playing around with the different options (i.e. Changing constraints, re-sizing artboards and pressing Update Layout) makes things clearer.

There are 5 primary actions: Show/Hide Toolbar, Update Layout, Edit Constraints, Preview, and Toggle Size. All of the features the plugin provides are available via Plugins > Fluid.

Show/Hide Toolbar (⌃ + ⇧ + T)

For convenience, the plugin provides a toolbar that floats above the current document, giving you quick access to all of the above actions.

Toolbar

Edit Constraints (⌃ + ⇧ + C)

Constraint Inspector

This option shows the Constraint Inspector. Here you can edit all of the constraints for the currently selected layer.

Next to each section (Align, Fixed Size and Pinning) is a dropdown button. Pressing it opens a menu where you can set relativity:

Constraint Inspector Relativity

Update Layout (⌃ + ⇧ + L)

Adjusts the layers in the currently selected artboards to reflect your constraints.

Pressing L while the Constraint Inspector is focused will also Update Layout.

Preview (⌃ + ⇧ + P)

Preview Mode

Opens a window allowing you to preview the selected artboard at a range of preset device and icon sizes. You can also copy the preview artboard to paste into Sketch (Didn't have a mobile design? Now you do!), or export an image of the preview artboard at different scales (@1x, @2x, @3x, and so on).

Toggle Sizes (⌃ + ⇧ + S)

Toggle Sizes

Opens a popup where you can toggle the size of the current artboard between different presets, or flip its orientation.

Additional Notes

Fade UI

You can have Fluid fade its floating UI (Inspector & Toolbar) when they are not focused. See Plugins > Fluid > Settings.

Width & Height

If you have Fixed Width or Fixed Height checked, and leave the value blank, the plugin will lock the width or height to whatever the current height or width is in Sketch. This is useful in some cases where you want to ensure the height and width do not change, but don't want to enter the existing height/width manually.

Groups

Since the width and height of Groups in Sketch are dependent on their sub-layers, Fluid does not actually resize the height or width of a group, as that causes Sketch to distort the layers within it. Rather, it simulates that sizing when calculating the geometry of sub-layers.

Symbols

It's worth noting that while constraints you set on a Symbol itself will not propagate to other instances of that Symbol, any constraints you set on its sub-layers will.

Text

If you set the width of a text layer but not its height, the plugin will set the height of the text layer to the height of the text after reflow.

This feature was available in former versions of Fluid, but has been removed in 1.7.4. See this issue for more info. Restored in Fluid 1.7.5! 🎉

Mathematic Values

All of the values in Fluid support mathematic expressions, such as 20 * 2 or (50 / 2) + 10 and so on. This becomes even more useful when you add percentages to the mix.

Percentages are relative to the dimension of the axis they're on. Here's how that shakes out:

  • Using 100% as your fixed width equals 100% of the relative layer's width
  • Using 100% as your fixed height equals 100% of the relative layer's height
  • Using 100% in the top or bottom pinnings equals 100% of the relative layer's height
  • Using 100% in the right or left pinnings equals 100% of the relative layer's width

One neat application of this is that it enables padding between sibling layers, e.g:

  • Parent Group or Artboard
    • Layer B (top pinning = 100% + 20, relativity = Previous Sibling (Layer A))
    • Layer A

Text Field Tricks n' Tips

  • Numbers in the Constraint Inspector text fields can be incremented or deincrement by 1 by pressing the up and down keys. Holding down Shift (⇧) and Up or Down will increment by 10.
  • Pressing space while a text field is focused will toggle that constraint's checkbox.

Preset Sizes

You can search through the section names of the preset sizes list (in both Preview Mode and when toggling sizes) by prefixing your searches with s:, i.e.: s:iOS or s:Material. Normally Fluid only searches among the preset names themselves.

Contact

If you have any questions, comments, become attacked by technical bugs, or have ideas to improve the plugin, ping us on twitter: @matt_sven and @imcatnoone.

fluid-for-sketch's People

Contributors

imcatnoone avatar matt-curtis avatar radarhere avatar zeveisenberg 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  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

fluid-for-sketch's Issues

Automatically Set/Guess Constraints

artboard

Wouldn't it be great, if, with one click, you could auto-populate the constraint settings?
Of course some manual tweaks would be needed, but this might save a lot of time.

Looking at Constraints Demo.sketch, and thinking about typical 'Mobile design' use case, some ideas:

  • IF object center is closer to centre of axis then edge, then set alignment to center on this axis/' with pinning to maintain current position (negative values)
  • IF object center is closer to an edge than canvas center, then set pinning to edge with appropriate values to maintain current position
  • IF object spans > 90% of either artboard dimension then pin to 2 or 4 edges with current padding, non-fixed size along that/those dimensions
  • Text siblings can probably have a 100% + absolute pixel padding set, per the 'Flowing text test' in Constraint Demos.sketch

Suggestion: Pin objects to each other

Ideally, I would like to be able to pin an object to maintain certain margin to another object in the artboard. A potential use case would be pinning a button to a certain position within a modal dialog that is dynamic in height and/or width.

Add "Next Sibling" relativity

It'd help to handle cases with buttons like this

Or may be you can give an advice. How can I create a button where a bg wraps out a text with some paddings?

Add CONTRIBUTING.md

Hi! Thanks so much for making this plugin. It's solving big problem I've had with all drag-n-drop UI tools, not just Sketch.

I really want to make suggestions work help make this better, but I don't know how to start without stepping on toes. I guess the first thing I can help with is establishing contribution guidelines?

See: https://github.com/blog/1184-contributing-guidelines

Support editing (or at least pasting) constraints to multiple selected layers

It would be very nice if we could apply constraints to the set of selected layers, or at least "paste" previously copied constraints to the selected layers.

Right now it's a little tedious to set up constraints for a series of "table rows", for example, because you have to select and set the constraints for each layer individually. Fluid doesn't complain if you select multiple layers and then try to set their constraints as one operation, but it also doesn't work.

Variables

This will be a bit of a tough one to implement right and store properly... current thoughts:

  • Cascades down and can be overriden at different levels (Document, Page, Artboard, Group, Layer)
  • Variables are essentially mathematic expressions assigned to something like $a, etc.
  • Can build off previous value of a variables, so $padding = $padding + 100%

Possible applications:

  • Change padding between layers quickly and easily
  • Toggle the values of variables to test different configurations quickly
  • Cuts down on common, repetitive constraints

Possible an extraneous feature. There's downsides to this being (mis)/applied as well. Feedback welcome.

Whats wrong

i am not sure, but does it works with sketch 3.4?
The plugin doesn't work for me with any of my files or with the sample sketch (demo)

Improving Preview Mode

Needs to expand to include:

  1. User-defined sizes
  2. More common device presets
  3. Zooming (?)
  4. Export?

Add direct control over pinning

Microsoft Blend has awesome control over margin constrains. See this chain-icon on screenshot? It allows to fix margin to a specific value. You can edit margin values by clicking directly on text.

I think that this kind of behaviour along with json-data is essential for interface-design.

cc295203-1 cd8d0751-ffa0-4f04-bc2f-09584ecd873d en-us expression 10

Text field enhancements

Propositions

  • Proper tabbing order
  • Up/Down to increment current number block (live update?)
  • Enter to expand text field

Feedback welcome

What is the correct behaviour when used with dynamic text symbols?

Hi!

I have a symbol that contains dynamic text sub-layers. Fluid would be really useful here as I can set up the margin logic between each sibling and then text wrapping is handled automatically for me when I change the text of any of the sub-layers for each instance of the symbol.

This doesn't seem to work as expected, as Sketch wants to set the position of each sub-layer everywhere, and you can see the elements jumping around as it runs through each instance of that symbol. Is it possible for each Symbol instance to share the Fluid constraints but not share the positioning calculated by Fluid?

Installs via Sketch Toolbox do not work

I guess having a same name with other plugin wasn't the problem, still it doesn't work when I install the plugin with Sketch Toolbox. It gives these errors on console when I try to toggle toolbox:

screen shot 2015-11-04 at 12 00 25 pm

I tried to restart the Sketch but didn't work. It works when I install it by downloading it from here and double clicking.

Global Constraints (Classes/Preset Constraints)

It would be nice if the constraints could behave pretty much like CSS .class (or constraint styles) so that when I create a complex layout and want to change one of the constraints, I can just edit the constraint style. This will make everything out of this world, as now I have to copy-paste constraints for hours :(

For example - this list is populated via Content Generator, the tags are manually added; but I just click and type, then when done, I update the layout. Chasing the position of the title would take me forever, as I'll have to copy-paste the same constraints over and over again, or re-generate the list. Slow.

screen shot 2015-12-04 at 5 01 22 pm

Thanks so much for building this plugin, I can't say how much I benefited from it the last week, building a super complex prototype with tons and tons of data, and I use it now almost all the time!

Fluid's definition of "Previous sibling (layer)" seems backwards

When you have a set of layers that looks like this in Sketch's layer panel:

  • Group 1
    • Layer B
    • Layer A

Fluid seems to think that "Layer B" is the previous sibling of "Layer A", but that's backwards. Sketch renders from bottom up, so first comes Layer A, then comes Layer B, which means that Layer A is the previous sibling of Layer B. It looks a little counterintuitive, but that's the real rendering order.

This matters quite a bit when the layers overlap. You can't simply change the order of layers in the layer tree to match Fluid's definition without affecting how they actually render (and probably occluding layers you wanted to be able to see).

Input field steals focus in background

Hi Matt,

V. 1.7 is great, thanks for the huge improvement! There's one issue that I've encountered with moving objects though. Here's a way to replicate it:

  1. Edit a constraint by changing a value in the input field.
  2. Click somewhere on the canvas to make the constraint window disappear.
  3. Click an object and try to move it up and down by using the arrow keys ↑ ↓ (doesn't work, also +10px increment by holding shift does not work)

It seems the constraint input field remains focused in the background. With a little luck you can get the keyboard shortcut to work again by changing the relativity a couple sometimes.

Best regards,
Andre

Adding constraints like in Xcode?

if this would be possible this plugin would be dope.
What I mean by that exactly:

In XCode you can select a layer, hold ctrl, drag from your layer to the next layer above it for example and set the constraint to be the top spacing to the other layer.

I know this is very advanced, and I'm not sure if this is possible with the sketch plugin api or if they would have to do that on their own, but that would sick.

Thanks already for the current state of the plugin.

And a minor suggestion: could you check the box of a constraint automatically as soon as you enter a manual value?

Fluid work / doesn't work.

Hi,

Both: Fluid 1.6.1 and Sketch 3.4.2
Yosemite works, Mavericks doesn't work.

I tried to install manually, but also doesn't work.

Anybody have the same issue? Or what should I do / check to fix it.

Update multiple layers at the same time

Some method of updating multiple layers at the same time. Or maybe some sort of constraint "style" that can be applied throughout a document.

Useful when you're working with rows of information

Toolbar Movement

Current Flow Moving the Toolbar:

  1. User moves the toolbar to a different part of the art board
  2. User edits constraints
  3. Preferences pop up
  4. User sets preferences
  5. User clicks another layer and the toolbar returns to the bottom of the art board.

Ideal Flow Moving the Toolbar:

  1. User moves the toolbar to a different part of the art board
  2. User can also move the constrain preference pane independently of the toolbar constraints
  3. Both elements stay fixed where the user moves them to

Improve how aspect ratio sizing is handled

Currently does not work as well with layers that need aspect ratio sizing (ie. images).

This is currently possible by using Sketch's aspect ratio sizing:

However, when aspect ratio locking is enabled in Sketch, this plugin is only able to change the layer's height. Sketch seems to ignore changes to width.

Access Data

Hi great plugin, but I was wondering is there a way to access the constraint data so that I can export it via JSON.

Size Classes

Are there any plans to include iOS size classes? Or am I missing something. At the moment it seems like constraints are globally applied. To clarify: It would be really useful to have differing layouts depending on size class.

retain aspect ratio when resizing and updating layout.

Problem story:

If I have an element that needs to remain 100% of my viewports width but yet also retain its original aspect ratio before being resized - how would one go about achieving that?
image

Proposed solution:

If you lock layerA's width and height and you set a constraint saying layerA = 100% width of canvas it should resize but retain its aspect ratio.
image

Currently if you lock a layers dimensions it doesn't resize at all when you update layout.
image

Not sure if my proposed solution conflicts with anything but if it doesn't this would be a really rad addition.

Non the less thanks for making this plugin, its one of my favorites :)

Fluid installed but does not respond (Sketch 3.4)

Hi,

I installed plugin via Sketch Toolbox while Sketch was not running. Plugin appears in correct folder and in Sketch menu but does not respond when selecting "Edit constraints" or "Show toolbar".

Sketch version 3.4 (15575)

Cheers,
Martin

Dynamic sections

I would really like to be able to create "sections" to my designs which can be placed after each other (from top to bottom). Today in Sketch, if a design change is made it often results in that you have to select all other elements and "push them down" on the page.

Functionality:

  • A section consists of a unlimited number of other elements (just like a group)
  • A section is dynamic in height, so if the height of the section is changed, it pushes the sections below down.
  • Each section can be dragged and dropped over/under other sections to sort them from page top to bottom.

Toolbar obscures 'message' dialog

we're using a plugin that displays colors used for a selected element as a message (see screenshot) which is in conflict with Fluid's toolbar: the messages are being placed below the toolbar. This is true for any message I guess, which are being used for alerts etc. in numerous plugins.

I have no idea what's possible, but maybe the "paint order" could be changed, making the toolbar always the lowest layer (since messages usually have more priority)? or making the toolbar position movable?

image

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.