ssr 0.0.7 copy "ssr: ^0.0.7" to clipboard
ssr: ^0.0.7 copied to clipboard

Generate Flutter Widgets from server generated json code without any dependency.

example/main.dart

import 'package:flutter/material.dart';
import 'package:ssr/ssr.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(),
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return ServerSideRendering.build({
      'Scaffold': {
        'appBar': {
          'AppBar': {
            'title': {
              'Text': ['Hi'],
            },
            'centerTitle': false,
          },
        },
        'body': {
          'Container': {
            'color': {
              'Color': [0xFFFFFFFF],
            },
            'alignment': 'Alignment.center',
            'child': {
              'Row': {
                'children': [
                  {
                    'Column': {
                      'children': [
                        {
                          'Text':
                              "Text #1.", // optional bracket for single positional argument
                        },
                        {
                          'Text': ["Text #2."],
                        }
                      ],
                    },
                  },
                  {
                    'Text': [
                      "Text #3",
                      {
                        'maxLines': 3,
                        'overflow': 'TextOverflow.ellipsis',
                        'style': {
                          'TextStyle': {
                            'color': {
                              'Color': [0xFF000000],
                            },
                            'fontSize': 20,
                          }
                        }
                      }
                    ]
                  }
                ]
              }
            }
          }
        }
      }
    });
  }
}
21
likes
140
points
33
downloads

Publisher

verified publisherensorta.com

Weekly Downloads

Generate Flutter Widgets from server generated json code without any dependency.

Homepage
Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on ssr