Пример #1
0
 void _incrementExit(PointerEvent details)
 {
     setState(() => {
         textColor = Colors.blue;
         _exitCounter++;
     });
 }
Пример #2
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");
 }
Пример #3
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; });
         }
     }
                         ));
 }
Пример #4
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")
                              )
                          )
                      )
                  )
              ));
 }
Пример #5
0
        Widget _buildAvatar(User user)
        {
            var httpsUrl = user.avatar;

            // fix Android 9 http request error
            if (httpsUrl.Contains("http://"))
            {
                httpsUrl = httpsUrl.Replace("http://", "https://");
            }

            var image = this._pickedImage.isEmpty()
                ? Image.network(src: httpsUrl)
                : Image.memory(Convert.FromBase64String(s: this._pickedImage));
            var child = user.avatar.isEmpty() && this._pickedImage.isEmpty()
                ? new Container(
                child: new _Placeholder(
                    user.id ?? "",
                    user.fullName ?? "",
                    120
                    )
                )
                : new Container(
                width: 120,
                height: 120,
                color: CColors.AvatarLoading,
                child: image
                );

            return(new Container(
                       width: 120,
                       height: 120,
                       decoration: new BoxDecoration(
                           borderRadius: BorderRadius.circular(60),
                           border: Border.all(
                               color: CColors.White,
                               2
                               )
                           ),
                       child: new ClipRRect(
                           borderRadius: BorderRadius.circular(60),
                           child: new Stack(
                               children: new List <Widget> {
                child,
                new Positioned(
                    bottom: 0,
                    left: 0,
                    right: 0,
                    child: new Container(
                        height: 32,
                        color: Color.fromRGBO(0, 0, 0, 0.3f),
                        child: new Container(
                            color: CColors.Transparent,
                            child: new Icon(icon: Icons.camera_alt, size: 20, color: CColors.White))
                        )
                    )
            })
                           )
                       ));
        }
Пример #6
0
 void _updateLocation(PointerEvent details)
 {
     setState(() => {
         textColor = Colors.red;
         x         = details.position.dx;
         y         = details.position.dy;
     });
 }
Пример #7
0
        Widget _buildRoleItem()
        {
            var jobRoleName = this.widget.viewModel.jobRole.name ?? "";
            var name        = this._jobRole.ContainsKey(key: jobRoleName)
                ? this._jobRole[key : jobRoleName]
                              : jobRoleName;

            return(new Container(
                       color: CColors.White,
                       height: 60,
                       padding: EdgeInsets.symmetric(horizontal: 16),
                       child: new Row(
                           children: new List <Widget> {
                new Expanded(
                    flex: 1,
                    child: new Text("身份", style: CTextStyle.PLargeBody4)
                    ),
                new Expanded(
                    flex: 3,
                    child: new GestureDetector(
                        onTap: () => this.widget.actionModel.pushToJobRole(),
                        child: new Container(
                            color: CColors.Transparent,
                            child: new Stack(
                                fit: StackFit.expand,
                                children: new List <Widget> {
                    name.isEmpty()
                                                ? new Container(
                        alignment: Alignment.centerLeft,
                        child: new Text("请选择对应的身份", style: CTextStyle.PLargeBody4)
                        )
                                                : new Container(
                        alignment: Alignment.centerLeft,
                        child: new Text(data: name, style: CTextStyle.PLargeBody)
                        ),
                    new Positioned(
                        top: 0,
                        right: 0,
                        bottom: 0,
                        child: new Icon(
                            icon: Icons.chevron_right,
                            size: 24,
                            color: Color.fromRGBO(199, 203, 207, 1)
                            )
                        )
                }
                                )
                            )
                        )
                    )
            }
                           )
                       ));
        }
 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)
             );
     }
                ));
 }
Пример #9
0
        public static Color applyOverlay(BuildContext context, Color color, float elevation)
        {
            ThemeData theme = Theme.of(context);

            if (elevation > 0.0f &&
                theme.applyElevationOverlayColor &&
                color == theme.colorScheme.surface)
            {
                return(Color.alphaBlend(overlayColor(context, elevation), color));
            }

            return(color);
        }
Пример #10
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),
     })));
 }
 public DropDownOverlay(
     Key key                = null,
     float?left             = null,
     float?top              = null,
     float?right            = null,
     float?bottom           = null,
     float?width            = null,
     List <Widget> children = null,
     Color color            = null,
     Border border          = null) : base(key)
 {
     _left     = left;
     _top      = top;
     _right    = right;
     _bottom   = bottom;
     _width    = width;
     _children = children;
     _color    = color;
     _border   = border;
 }
Пример #12
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);
        }
Пример #13
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))
                          )),
     }
                ));
 }
Пример #14
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);
        }
Пример #15
0
 public BackButton(
     Key key     = null,
     Color color = null) : base(key: key)
 {
     this.color = color;
 }