swiftui 0.1.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 50

swiftui #

A research implementation of SwiftUI view transformations on Flutter Widgets using Dart extensions.

dependencies:
  flutter:
    sdk: flutter
  swiftui:
    git: https://github.com/lukepighetti/flutter_swiftui
class Example extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Column(
      mainAxisAlignment: MainAxisAlignment.center,
      children: <Widget>[
        Text("padded").padded(8),
        Text("offsetX").offsetX(100),
        Text("offsetY").offsetY(-200),
        Text("offsetDegrees").offsetDegrees(180, 100),
        Text("foo").border(Border.all()),
        Text("More padded").padded(40),
      ],
    );
  }
}

Contributing #

Since this API is intended for research, I'm totally happy with people submitting breaking changes and altering the direction of this project. My starting point was to try to implement the most-common View transformations you see in SwiftUI, but I make no claims that the architecture I've chosen makes the most sense. I'd much rather someone break the API with something novel than try to fight with implementing the SwiftUI api extactly.

In other words, SwiftUI is merely an inspiration, and not a specification.

0.1.0 - October 10, 2019 #

  • Super alpha alpha preview release

example/lib/main.dart

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

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: Material(
        child: _Home(),
      ),
    );
  }
}

class _Home extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Column(
      mainAxisAlignment: MainAxisAlignment.center,
      children: <Widget>[
        Text("padded").padded(8),
        Text("offsetX").offsetX(100),
        Text("offsetY").offsetY(-200),
        Text("offsetDegrees").offsetDegrees(180, 100),
        Text("foo").border(Border.all()),
        Text("More padded").padded(40),
      ],
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  swiftui: ^0.1.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:swiftui/swiftui.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
50
Learn more about scoring.

We analyzed this package on Mar 31, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.6.0-dev <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test