Created
August 3, 2024 07:09
-
-
Save sixtusagbo/3c623c06887a59bf607d1ca3672e3c37 to your computer and use it in GitHub Desktop.
Using extension types to implement 4-point grid system in flutter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This code was borrowed from here: https://x.com/mkobuolys/status/1819377685639950585 | |
const _multiplier = 4.0; | |
extension type DesignSystemSpace._(double spacing) implements double { | |
DesignSystemSpace(double token) : spacing = token * _multiplier; | |
} | |
final space = DesignSystemSpace(4); // 16 | |
final padding = EdgeInsets.all(DesignSystemSpace(4)); // EdgeInsets.all(16.0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment