FlatSpark is an open source project created to bring skins based on FlatUI to Flex. Apache Flex 4.14 marks the first release that has FlatSpark as an official part of Apache Flex.
Please note that FlatSpark is designed to be as close to FlatUI as possible, but it does not have skins for all the components yet. That is why you still can't use it as a theme.
FlatSpark is automatically installed when using Flex 4.14 SDK, you just need to accept the "Adobe Embedded Font Libraries and Utilites" license, otherwise you will get an error when trying to use it.
If you get errors like these:
exception during transcoding: teste line 26 Flex Problem
exception during transcoding: teste line 33 Flex Problem
unable to build font 'FontAwesome' teste line 26 Flex Problem
unable to build font 'Lato' teste line 33 Flex Problem
Please make sure you accepted the "Adobe Embedded Font Libraries and Utilites" license. This is required for FlatSpark to work.
Right now there are two ways to use FlatSpark as the skin for your components.
Changing the default skin of all components
If you want to change the skin of all your components, you can just set the skin via CSS.
For example, if you want to change all RadioButton components to use FlatSpark skin, add this CSS code:
Changing the skin of a single component
If you want to change the skin of a single component, you can just use the skinClass attribute, like this:
The naming scheme of the skins is following the convention "componentSkin". That means you can expect FlatSpark to provide
TextInputSkin and so on.
List of components available:
- Alert (experimental)
- ProgressBar (experimental)
* Custom components only available using FlatSpark
Changing FlatSpark's components appearance
FlatSpark has different goals than usual skins, it is meant to work as the FlatUI and Bootstrap CSS frameworks. This means that FlatSpark usually gives default sizes and colors for components and is intended to be used with them, letting you define properties that don't break the original design. Trying to define custom designs on top of FlatSpark may be hard sometimes as that is not the intended nature of the skin.
Defining component size
As mentioned at the start of this page, FlatSpark is designed to be as close to FlatUI as possible. This means that, by default, FlatSpark defines fontSize based on the height attribute.
FlatUI is based on Bootstrap, which has 4 different sizes, FlatSpark keeps that rule. So FlatSpark will look better if you use the provided ButtonSizeEnum and TextInputSizeEnum to set the height of your components. That way your components will render exactly as intended. Examples:
If you don't define any height, it will always assume the Normal height.
Defining component color
FlatSpark also defines an easy way to change the button color according to FlatUI "states". There are 7 default colors for buttons, as follows: Primary, Success, Warning, Inverse, Default, Info and Danger. Defining a button as "Warning", for example, changes more than just its base color. That's why we provide an easy way for you to define the button "state". This "state" is called a brand. If you define the brand of a button, FlatSpark will change all the colors according to FlatUI colors.
Unfortunately, you can only define the brand attribute if you use the ButtonIcon component, as that is not part of the original Button component.
You can define a ButtonIcon's brand property like this:
The BrandColorEnum class defines all 7 available brands described before.
FlatSpark is using FontAwesome 4.2.0
FontAwesome is included in FlatSpark skin, it can be used on ButtonIcon and TextInputIcon skins.
You can also use any of the icons with the Label component, like this:
If you find that an icon is missing from AwesomeUtils you can use the code provided in FontAwesome cheatsheet, like this: