Пример #1
0
 void OnEnable()
 {
     this.windowAdapter = new EditorWindowAdapter(this);
     this.windowAdapter.OnEnable();
     this.root = new Container(
         width: 200,
         height: 200,
         margin: EdgeInsets.all(30.0),
         padding: EdgeInsets.all(15.0),
         color: Color.fromARGB(255, 244, 190, 85),
         child: new EditableText(
             maxLines: 100,
             selectionControls: MaterialUtils.materialTextSelectionControls,
             controller: new TextEditingController(this.txt),
             focusNode: new FocusNode(),
             style: new TextStyle(),
             selectionColor: Color.fromARGB(255, 255, 0, 0),
             cursorColor: Color.fromARGB(255, 0, 0, 0)
             )
         );
     this.windowAdapter.attachRootWidget(new WidgetsApp(window: this.windowAdapter, home: this.root,
                                                        pageRouteBuilder: (RouteSettings settings, WidgetBuilder builder) =>
                                                        new PageRouteBuilder(
                                                            settings: settings,
                                                            pageBuilder: (BuildContext context, Unity.UIWidgets.animation.Animation <double> animation,
                                                                          Unity.UIWidgets.animation.Animation <double> secondaryAnimation) => builder(context)
                                                            )));
     this.titleContent = new GUIContent("EditableTextWidget");
 }
Пример #2
0
 public override Widget build(BuildContext context)
 {
     return(new Listener(child:
                         new Container(
                             forgroundDecoration: this.hover
                 ? new BoxDecoration(color: Color.fromARGB(80, 255, 255, 255))
                 : null,
                             child: this.widget.child
                             ),
                         onPointerEnter: (evt) => {
         if (this.mounted)
         {
             Debug.Log(this.widget.name + " pointer enter");
             this.setState(() => { this.hover = true; });
         }
     },
                         onPointerExit: (evt) => {
         if (this.mounted)
         {
             Debug.Log(this.widget.name + " pointer exit");
             this.setState(() => { this.hover = false; });
         }
     }
                         ));
 }
Пример #3
0
 public override Widget build(BuildContext context)
 {
     return
         (new Center(
              child: new AnimatedContainer(
                  duration: TimeSpan.FromSeconds(1),
                  padding: EdgeInsets.all(50),
                  width: animateWidth,
                  height: 300,
                  decoration: new BoxDecoration(
                      color: new Color(0xFFFFFFFF),
                      border: Border.all(color: Color.fromARGB(255, 0xDF, 0x30, 0x70), width: 5),
                      borderRadius: BorderRadius.all(20)
                      ),
                  child: new Center(
                      child: new GestureDetector(
                          onTap: () => { this.setState(() => { animateWidth = animateWidth + 50; }); },
                          child: new Container(
                              padding: EdgeInsets.symmetric(20, 20),
                              color:  Color.fromARGB(255, 0xDF, 0x30, 0x70),
                              child: new Text("Click Me")
                              )
                          )
                      )
                  )
              ));
 }
 public static Widget listView()
 {
     return(ListView.builder(
                itemExtent: 20.0f,
                itemBuilder: (context, index) => {
         return new Container(
             color: Color.fromARGB(255, (index * 10) % 256, (index * 10) % 256, (index * 10) % 256)
             );
     }
                ));
 }
Пример #5
0
 public override Widget build(BuildContext context)
 {
     //1 131231
     return(new Container(
                alignment: Alignment.center, color: Color.fromARGB(255, 0, 255, 0),
                child: new Column(
                    mainAxisAlignment: MainAxisAlignment.spaceAround,
                    children: new List <Widget> {
         createRow(),
         createRow(false),
         createRow(),
         createRow(true, true),
     })));
 }
Пример #6
0
        public static Widget createRow(bool canHover = true, bool nest = false)
        {
            Widget result = new Container(width: 200, height: 60, color: Color.fromARGB(255, 255, 0, 255));

            if (canHover)
            {
                result = new HoverTrackWidget(null,
                                              result, "inner");
            }

            if (nest)
            {
                result = new Container(child: result, padding: EdgeInsets.all(40),
                                       color: Color.fromARGB(255, 255, 0, 0));
                result = new HoverTrackWidget(null,
                                              result, "outer");
            }

            return(result);
        }
Пример #7
0
 Widget _buildNickNameInputer()
 {
     return(new Row(
                children: new List <Widget>
     {
         new Flexible(child: new Container(
                          color: new Color(0xffffffff),
                          padding: EdgeInsets.fromLTRB(20, 0, 20, 0),
                          child: new EditableText(maxLines: 1,
                                                  controller: TitleController,
                                                  selectionControls: MaterialUtils.materialTextSelectionControls,
                                                  autofocus: true,
                                                  focusNode: new FocusNode(),
                                                  style: new TextStyle(
                                                      fontSize: 18,
                                                      height: 2.5f,
                                                      color: new Color(0xff000000)
                                                      ),
                                                  selectionColor: Color.fromARGB(255, 255, 0, 0),
                                                  cursorColor: Color.fromARGB(255, 0, 0, 0))
                          )),
     }
                ));
 }
Пример #8
0
        public static Widget createRow(bool canHover = true, bool nest = false)
        {
            Widget result = new Container(width: 200, height: 60, color: Color.fromARGB(255, 255, 0, 255));

            if (canHover)
            {
                result = new HoverTrackWidget(null,
                                              result, "inner");
            }

            //WARNING: nested MouseTracker is not supported by the current implementation that ported from flutter
            //refer to this issue https://github.com/flutter/flutter/issues/28407 and wait Google guys fixing it

            /*
             * if (nest) {
             *  result = new Container(child: result, padding: EdgeInsets.all(40),
             *      color: Color.fromARGB(255, 255, 0, 0));
             *  result = new HoverTrackWidget(null,
             *      result, "outer");
             * }
             */

            return(result);
        }