-
-
Notifications
You must be signed in to change notification settings - Fork 102
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
feat: Serialize FCS #238
Comments
The next step after this is to serialize the deltas that a ThemeData.copyWith(...) does. In other words, we would love if the entire theme was customizable. This presents somewhat of a quandry, which do we serialize? ThemeData, with all of it's 1000 properties, or FCS, which has limited customization. The solution is to FlexColorScheme, and a special class that takes a const theme = FlexColorScheme(...);
class MyTheme extends ThemeCopyWiths {
final FlexColorScheme scheme;
FlexColorSchemeCustomizer({
this.cardColor = Value.absent;
});
@override
Value<Color> cardColor;
} The This would allow us to crate a Playground with seemingly unlimited customization. I'm excited for the day when entire designs could be a .json file, which could generate an entire theme. return BigButtonVariant(
child: ElevatedButton(
child Text("Big Button")
)
); I'm prob just rambling at this point. There are still lots of parts to think about. |
In preparation for a future version of FCS where schemas can be shared, it would be nice if an entire schema could be serialized.
I've done the work on this using dart_mappable, however there are a couple of classes which can't be serialized.
Some can't be serialized because the internal data is private:
ColorFilter
TextDecoration
MaskFilter
Others are abstract:
ThemeExtension
Shader
ImageFilter
InteractiveInkFeatureFactory
EdgeInsetsDirectional
And others are hopelessly complex:
MaterialStateProperty
PageTransitionsTheme
I'm hoping that there is a solution for private data.
Abstract classes which aren't sealed can't reliably be parsed, however, we can try to parse the ones that Flutter provides (
EdgeInsetsDirectional
->EdgeInsets | EdgeInsetsDirectional
)The ones which are too complex will be ignored, we can explore ways for users to write PageTransitionsTheme & MaterialStateProperty in a way that can be serialized.
I've forked this here:
https://github.com/dickermoshe/flex_color_scheme
The text was updated successfully, but these errors were encountered: