Flutter
The sosialoka_ui package gives a Flutter app the Sosialoka theme of its product, for shadcn_ui widgets and for Material widgets, in light and dark mode.
Install
Section titled “Install”The package installs from the design system repository:
dependencies: shadcn_ui: ^0.59.0 sosialoka_ui: git: url: https://gitlab.com/sosialoka/design-system.git path: flutterSet the theme
Section titled “Set the theme”Pick your product with SosialokaBrand, or SosialokaBrand.neutral for an app that belongs to no product. SosialokaTheme.shad builds the shadcn_ui theme, and SosialokaTheme.material builds a matching Material theme for screens that still use Material widgets.
import 'package:flutter/material.dart';import 'package:shadcn_ui/shadcn_ui.dart';import 'package:sosialoka_ui/sosialoka_ui.dart';
class App extends StatelessWidget { const App({super.key});
@override Widget build(BuildContext context) { const brand = SosialokaBrand.coverclearance; return ShadApp.custom( theme: SosialokaTheme.shad(brand, Brightness.light), darkTheme: SosialokaTheme.shad(brand, Brightness.dark), appBuilder: (context) => MaterialApp( theme: SosialokaTheme.material(brand, Brightness.light), darkTheme: SosialokaTheme.material(brand, Brightness.dark), builder: (context, child) => ShadAppBuilder(child: child!), home: const HomeScreen(), ), ); }}Moving screens over one at a time works: Material screens and shadcn_ui screens share the same colors and radius.
Extra colors
Section titled “Extra colors”shadcn_ui has no field for the status colors, soft tints, tenant accents or brand colors. Read them from the theme with context.sosialoka:
ShadBadge( backgroundColor: context.sosialoka.successSoft, foregroundColor: context.sosialoka.success, child: const Text('Selesai'),);The raw values, radius, spacing and text sizes are also available as constants: SosialokaColors, SosialokaRadius, SosialokaSpace and SosialokaText. The same constants are in one file, /tokens/sosialoka_tokens.dart, for an app without the package.
The themes set Plus Jakarta Sans through the google_fonts package, which downloads the font on first use. An app that must work offline should bundle the font files and declare them in its pubspec.yaml.
Examples
Section titled “Examples”Every component page shows its Flutter code in the Flutter tab. The same code runs in the gallery app in flutter/example of the repository, where flutter analyze and a render test under every brand and mode check it.
