Skip to content

mkosei/flutter_variants

Repository files navigation

flutter_variants

日本語 | English

A Flutter SDK for safe UI variants.

flutter_variants lets you change approved UI values such as text, labels, and design copy without shipping a new app release. Layout, navigation, callbacks, API calls, payments, authentication, and business logic stay in the Flutter app.

This is not a server-driven UI renderer. It is a small variant slot system.

Minimal example

VariantScope(
  values: {
    'home.title': {
      'type': 'text',
      'value': 'Try the new onboarding',
    },
  },
  child: const VariantText(
    id: 'home.title',
    fallback: 'Welcome',
  ),
)

For server-delivered values, wrap the app with VariantHost:

VariantHost(
  url: Uri.parse(
    'https://your-domain.com/apps/my_app/production/variants.json',
  ),
  child: const App(),
)

Documentation

See DOCUMENT.md for the full developer guide:

  • Philosophy and the slot-based approach
  • API reference (VariantScope, VariantText, VariantImage, VariantColor, VariantSpacing, VariantEdgeInsets, VariantBorderRadius, VariantString, VariantBool, VariantNumber, VariantTextStyle, VariantVisibility)
  • VariantHost configuration (timeout, retry, refresh, cache, callbacks)
  • Self-hosting and the variants.json format

Contributing

Contributions are welcome — see CONTRIBUTING.md for the dev setup, code conventions, and hard rules to respect.

Running the example

cd example
flutter run

Running tests

flutter test
cd example
flutter test

If you use FVM, prefix the commands with fvm:

fvm flutter test
cd example
fvm flutter test

About

Type-safe UI variants for Flutter — update text, colors, images, and design slots from any JSON URL. Self-hosted, fallback-safe, no remote logic, no vendor lock-in.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors