Skip to main content
This page covers the common patterns for using flutter_skin in your Flutter app.

Basic Usage

The minimal setup — init once, apply once:
void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await FlutterSkin.init(apiKey: 'fsk_your_api_key_here');
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: FlutterSkin.toThemeData(),
      home: const HomePage(),
    );
  }
}
FlutterSkin.toThemeData() converts your active skin into a Flutter ThemeData object. Every widget in your app that reads from the theme will automatically use the remote skin colors.

Offline Fallback

Provide a fallback skin for the first launch, before any skin has been fetched from the server:
@override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: FlutterSkin.toThemeData(
        fallbackTheme: ThemeData(
          colorScheme: ColorScheme(
            primary: Color(0xFF6C63FF),
            secondary: Color(0xFFFF6584),
            surface: Color(0xFFF9F9FB),
            error: Color(0xFFEF4444),
            onPrimary: Color(0xFFFFFFFF),
            onSecondary: Color(0xFF000000),
            onSurface: Color(0xFF1C1B1F),
            onError: Color(0xFFFFFFFF),
            brightness: Brightness.light,
          ),
        ),
      ),
      home: const MyHomePage(title: 'Movie Browser'),
    );
  }
After the first successful fetch, the skin is cached locally. On subsequent launches — even without a network connection — the cached skin is used automatically. The fallback only applies when no cache exists yet.

Color Tokens Reference

All color tokens available from the active skin:
TokenFlutter equivalentDescription
colors.primaryColorScheme.primaryMain brand color
colors.secondaryColorScheme.secondaryAccent color
colors.backgroundColorScheme.backgroundPage background
colors.surfaceColorScheme.surfaceCard background
colors.errorColorScheme.errorError states
colors.onPrimaryColorScheme.onPrimaryText on primary
colors.onSecondaryColorScheme.onSecondaryText on secondary
colors.onBackgroundColorScheme.onBackgroundText on background
colors.onSurfaceColorScheme.onSurfaceText on surface
colors.onErrorColorScheme.onErrorText on error
colors.brightnessThemeData.brightnesslight or dark

Upcoming

The following features are in development:
  • Live push updates (SSE) — skin changes broadcast instantly to open app instances without restart
  • Typography tokens — font family, sizes, and weights
  • Spacing and radius tokens — layout and component shape control