theta 0.1.7 copy "theta: ^0.1.7" to clipboard
theta: ^0.1.7 copied to clipboard

Build remote, dynamic and responsive user interfaces with the Theta Flutter library.

Theta #

Theta Flutter library.

What is Theta? #

Theta is a platform designed for rendering dynamic user interfaces seamlessly within your Flutter applications.

  • Effortless dynamic UI rendering: Display no-code UIs by eliminating the need to deploy or rebuild the app for each change.
  • Custom code directly from within your app, mixing no-code and code.
  • Test the user interface against various conditions and user properties in real time to help you find the best user experience.
  • Lightweight and secure.

How it works? #

  • Design interfaces on Theta (Figma import and AI generative generation support are planned in the future).
  • Add the user interface elements within the app.
  • Update the UI without rebuilding the app.

Getting started #

Initialize Theta #

Initialize Theta by calling Theta.initialize with your anonymous key. Be sure to call this method at the root of your app.

import 'package:theta/theta.dart';

Future<void> main() async {
    await Theta.initialize(anonKey: 'thetaKey');

    // ...
}

Wrap your app with ThetaProvider #

Wrap your app with ThetaProvider to enable any UIBox to receive the theme and project styles.

ThetaProvider(
    theme: ThemeMode.light,
    child: MaterialApp(
        home: // ...
    ),
)

Render remote UI #

Everything you need to do is to add a UIBox widget to your app and pass the component name as a parameter.

return Scaffold(
    body: Center(
        child: UIBox('Component name'),
    ),
);

Loading placeholder and error handling #

You can display a placeholder widget during loading and an error widget.

UIBox(
    'Homepage',
    placeholder: CircularProgressIndicator(),
    errorWidget: (error) => Text(error),
)

Add custom code for actions #

Want a dynamic UI with gesture support (onTap, doubleTap, etc.)? You can add functions, called 'workflows', based on gesture triggers.

  • Select a single UI element based on its id or name.
  • Choose the trigger for which the action will start.
  • Add a method.
UIBox(
    'AppBar',
    workflows: [
        Workflow('Container s4l3s', Trigger.onTap, () {
            // Do something
        }),
    ],
)

Component fit modes #

Absolute #

Using the absolute fit mode, the component will be rendered with the exact coordinates of the component in the Theta Studio.

UIBox(
    'Component name',
    fit: ComponentFit.absolute,
)

Auto Layout #

Using the autoLayout fit mode, the component will be rendered with the coordinates of the component in the Theta Studio, but the size will be calculated automatically.

UIBox(
    'Component name',
    fit: ComponentFit.autoLayout,
)

Overrides #

You can override each UI block with a Flutter widget by mixing no-code with Flutter.

UIBox(
    'Social card',
    overrides: [
        Override('Post title')
            ..setText('My beautiful cat')
            ..setColor(Colors.white, 0.5),
        Override('Cover')
            ..setImage('https://...'),
    ],
),

Child override #

If in the no-code component the element to which you want to overwrite the child already has one, it will be removed and replaced with the one entered by the user via code.

You can also use the UIBox within other UIBoxes. This provides a very high degree of customization.

UIBox(
    'Component name',
    overrides: [
        Override('Element id')
            ..setChild(UIBox('Other component')),
    ],
),

Children override #

You can also overwrite the children of an element.

UIBox(
    'Component name',
    overrides: [
        Override('Element name')
            ..setChildren([
                Text('Child 1'), 
                Text('Child 2')
            ]),
    ],
),

Status #

  • ✅ Alpha: experimental. Expect breaking changes.
  • ✅ Closed Beta: ready for conscientious use. Expect some bugs and missing features.

Compatibility #

  • ✅ Web
  • ✅ Android
  • ✅ iOS
  • ✅ macOS
  • ✅ Windows

Read more about configuration in the documentation.

Contributing #

See CONTRIBUTING.md for details.

License #

Build with Theta packages are licensed under the Apache License 2.0. See LICENSE for details.

Resources #