cssstylewidget 0.0.1 cssstylewidget: ^0.0.1 copied to clipboard
A new Flutter plugin.
import 'package:flutter/material.dart';
import 'dart:async';
import 'dart:convert';
import 'package:flutter/services.dart';
import 'package:cssstylewidget/cssstylewidget/StyledWidget.dart';
import 'package:cssstylewidget/cssstylewidget/CssStyle.dart';
import 'package:cssstylewidget/cssstylewidget/CssUnit.dart';
import 'package:cssstylewidget/cssstylewidget/ParsingUtils.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
String _platformVersion = 'Unknown';
@override
Widget build(BuildContext context) {
String jsonString=Style(
width: Length(100),
height: Length(100),
backgroundDecoration: BoxDecoration(color: Colors.amber),
//marginLeft: Length(100),
).toJson();
String styleString=json.encode({
"1000": Style.fromJson(jsonString),
"all": Style(
width: Length(200),
height: Length(100),
backgroundDecoration: BoxDecoration(color: Colors.blue),
//marginLeft: Length(100),
)});
return Scaffold(
appBar: AppBar(
// Here we take the value from the MyHomePage object that was created by
// the App.build method, and use it to set our appbar title.
title: Text("Hello"),
),
body: Center(
// Center is a layout widget. It takes a single child and positions it
// in the middle of the parent.
child: StyledWidget(
style: parse(styleString, func: parseStyle),
visible: {
"900.0": true,
"all": false},
childCounts: parse(json.encode({
"900.0": [1,2,3],
"all": [2,2,3]}),func: parseList),
child: Container(),
),
),
// This trailing comma makes auto-formatting nicer for build methods.
);
}
}