beagle 0.9.4-alpha copy "beagle: ^0.9.4-alpha" to clipboard
beagle: ^0.9.4-alpha copied to clipboard

discontinued
outdated

Beagle is an open source framework for multiplatform development using the concept of Server-Driven UI.

example/lib/main.dart

/*
 * Copyright 2020 ZUP IT SERVICOS EM TECNOLOGIA E INOVACAO SA
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import 'dart:io';

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

final Map<String, ComponentBuilder> myComponents = {
  'custom:loading': (element, _, __) {
    return Center(
      key: element.getKey(),
      child: const Text('My custom loading.'),
    );
  }
};

void main() {
  final localhost = Platform.isAndroid ? '10.0.2.2' : 'localhost';

  BeagleSdk.init(
    baseUrl: 'http://$localhost:8080',
    components: myComponents,
  );
  runApp(BeagleExample());
}

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Beagle example'),
        ),
        body: ElevatedButton(
          onPressed: () => BeagleSdk.openScreen(route: RemoteView('components'), context: context),
          child: Text("Start Beagle flow"),
        ),
      ),
    );
  }
}
4
likes
0
pub points
0%
popularity

Publisher

unverified uploader

Beagle is an open source framework for multiplatform development using the concept of Server-Driven UI.

Homepage
Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, flutter_js, get_it, http, url_launcher, yoga_engine

More

Packages that depend on beagle