Пример #1
0
 public override Widget build(BuildContext context)
 {
     return(new GestureDetector(
                onTap: this.onPressed,
                child: new Container(
                    color: Color.fromARGB(255, 0, 0, 255),
                    padding: EdgeInsets.all(10),
                    child: new Text("Select", style: new TextStyle(color: Color.fromARGB(255, 255, 255, 255)))
                    )
                ));
 }
Пример #2
0
        internal static Color _colorFromHue(
            float alpha,
            float hue,
            float chroma,
            float secondary,
            float match
            )
        {
            float red;
            float green;
            float blue;

            if (hue < 60.0f)
            {
                red   = chroma;
                green = secondary;
                blue  = 0.0f;
            }
            else if (hue < 120.0f)
            {
                red   = secondary;
                green = chroma;
                blue  = 0.0f;
            }
            else if (hue < 180.0f)
            {
                red   = 0.0f;
                green = chroma;
                blue  = secondary;
            }
            else if (hue < 240.0f)
            {
                red   = 0.0f;
                green = secondary;
                blue  = chroma;
            }
            else if (hue < 300.0f)
            {
                red   = secondary;
                green = 0.0f;
                blue  = chroma;
            }
            else
            {
                red   = chroma;
                green = 0.0f;
                blue  = secondary;
            }

            return(Color.fromARGB((alpha * 0xFF).round(), ((red + match) * 0xFF).round(),
                                  ((green + match) * 0xFF).round(), ((blue + match) * 0xFF).round()));
        }
Пример #3
0
        Widget containerSimple()
        {
            var container = new Container(
                alignment: Alignment.centerRight,
                color: Color.fromARGB(255, 244, 190, 85),
                child: new Container(
                    width: 120,
                    height: 120,
                    color: Color.fromARGB(255, 255, 0, 85)
                    )
                );

            return(container);
        }
Пример #4
0
 public override Widget build(BuildContext context)
 {
     return(new MaterialApp(
                home: new Scaffold(
                    appBar: new AppBar(
                        title: new Text("课表"),
                        backgroundColor: Color.fromARGB(255, 119, 136, 213), //设置appbar背景颜色
                        centerTitle: true                                    //设置标题是否局中
                        ),
                    body: new Center(
                        child: new Text("课表")
                        )
                    )
                ));
 }
Пример #5
0
        public override void initState()
        {
            base.initState();

            this.relatedColors = new List <Color>();
            for (int i = 0; i < 10; i++)
            {
                this.relatedColors.Add(Color.fromARGB(
                                           255,
                                           (this.widget.color.red + Random.Range(-50, 50)).clamp(0, 255),
                                           (this.widget.color.green + Random.Range(-50, 50)).clamp(0, 255),
                                           (this.widget.color.blue + Random.Range(-50, 50)).clamp(0, 255)
                                           ));
            }
        }
Пример #6
0
 RenderBox flexItemBox(RenderParagraph p, int width = 200, int height = 150)
 {
     return(new RenderConstrainedBox(
                additionalConstraints: new BoxConstraints(minWidth: width, maxWidth: width, minHeight: height,
                                                          maxHeight: height),
                child: new RenderDecoratedBox(
                    decoration: new BoxDecoration(
                        color: new Color(0xFFFFFFFF),
                        borderRadius: BorderRadius.all(3),
                        border: Border.all(Color.fromARGB(255, 255, 0, 0), 1)
                        ),
                    child: new RenderPadding(EdgeInsets.all(10), p
                                             )
                    )));
 }
Пример #7
0
 RenderBox text()
 {
     return(this.box(
                new RenderParagraph(new TextSpan("", children:
                                                 new List <TextSpan>()
     {
         new TextSpan("Real-time 3D revolutioni淡粉色的方式地方zes the animation pipeline ", null),
         new TextSpan(style: new TextStyle(color: Color.fromARGB(255, 255, 0, 0)),
                      text: "for Disney Television Animation's “Baymax Dreams"),
         new TextSpan(" Unity Widgets"),
         new TextSpan(" Text"),
         new TextSpan("Real-time 3D revolutionizes the animation pipeline "),
         new TextSpan(style: new TextStyle(color: Color.fromARGB(125, 255, 0, 0)),
                      text: "Transparent Red Text\n\n"),
         new TextSpan(style: new TextStyle(fontWeight: FontWeight.w700),
                      text: "Bold Text Test Bold Textfs Test: FontWeight.w70\n\n"),
         new TextSpan(style: new TextStyle(fontStyle: FontStyle.italic),
                      text: "This is FontStyle.italic Text This is FontStyle.italic Text\n\n"),
         new TextSpan(
             style: new TextStyle(fontStyle: FontStyle.italic, fontWeight: FontWeight.w700),
             text:
             "This is FontStyle.italic And 发撒放豆腐sad 发生的 Bold Text This is FontStyle.italic  And Bold  Text\n\n"),
         new TextSpan(style: new TextStyle(fontSize: 18),
                      text: "FontSize 18: Get a named matrix value from the shader.\n\n"),
         new TextSpan(style: new TextStyle(fontSize: 24),
                      text: "Emoji \ud83d\ude0a\ud83d\ude0b\ud83d\ude0d\ud83d\ude0e\ud83d\ude00"),
         new TextSpan(style: new TextStyle(fontSize: 14),
                      text: "Emoji \ud83d\ude0a\ud83d\ude0b\ud83d\ude0d\ud83d\ude0e\ud83d\ude00 Emoji"),
         new TextSpan(style: new TextStyle(fontSize: 18),
                      text: "Emoji \ud83d\ude01\ud83d\ude02\ud83d\ude03\ud83d\ude04\ud83d\ude05"),
         new TextSpan(style: new TextStyle(fontSize: 18),
                      text: "\ud83d\ude01\ud83d\ude02\ud83d\ude03\ud83d\ude04\ud83d\ude05"),
         new TextSpan(style: new TextStyle(fontSize: 18),
                      text: "\ud83d\ude01\ud83d\ude02\ud83d\ude03\ud83d\ude04\ud83d\ude05"),
         new TextSpan(style: new TextStyle(fontSize: 18),
                      text: "\ud83d\ude01\ud83d\ude02\ud83d\ude03\ud83d\ude04\ud83d\ude05"),
         new TextSpan(style: new TextStyle(fontSize: 18),
                      text: "\ud83d\ude01\ud83d\ude02\ud83d\ude03\ud83d\ude04\ud83d\ude05"),
         new TextSpan(style: new TextStyle(fontSize: 24),
                      text: "Emoji \ud83d\ude06\ud83d\ude1C\ud83d\ude18\ud83d\ude2D\ud83d\ude0C\ud83d\ude1E\n\n"),
         new TextSpan(style: new TextStyle(fontSize: 14),
                      text: "FontSize 14"),
     }))));
 }
Пример #8
0
            public override Widget build(BuildContext context)
            {
                var container = new Container(
                    padding: EdgeInsets.all(10),
                    decoration: new BoxDecoration(color: new Color(0x7F000000),
                                                  border: Border.all(color: Color.fromARGB(255, 255, 0, 0), width: 5),
                                                  borderRadius: BorderRadius.all(2)),
                    child: new Column(
                        crossAxisAlignment: CrossAxisAlignment.stretch,
                        children: new List <Widget> {
                    this.title(),
                    this.titleInput(),
                    this.descInput(),
                }
                        )
                    );

                return(container);
            }
Пример #9
0
            Widget textInput()
            {
                return(new Container(
                           child: new Row(
                               mainAxisAlignment: MainAxisAlignment.spaceBetween,
                               children: new List <Widget>(
                                   )
                {
                    new Container(
                        width: 300,
                        decoration: new BoxDecoration(border: Border.all(new Color(0xFF000000), 1)),
                        padding: EdgeInsets.fromLTRB(8, 0, 8, 0),
                        child: new EditableText(maxLines: 1,
                                                controller: this.controller,
                                                onSubmitted: (text) =>
                    {
                        this.controller.clear();
                        this._addItem(text);
                    },
                                                selectionControls: MaterialUtils.materialTextSelectionControls,
                                                backgroundCursorColor: Colors.red,
                                                autofocus: true,
                                                focusNode: new FocusNode(),
                                                style: new TextStyle(
                                                    fontSize: 18,
                                                    height: 1.5f,
                                                    color: new Color(0xFF1389FD)
                                                    ),
                                                selectionColor: Color.fromARGB(255, 255, 0, 0),
                                                cursorColor: Color.fromARGB(255, 0, 0, 0))
                        ),

                    new CustomButton(backgroundColor: Color.fromARGB(255, 0, 204, 204),
                                     padding: EdgeInsets.all(10),
                                     child: new Text("Add", style: new TextStyle(
                                                         fontSize: 20, color: Color.fromARGB(255, 255, 255, 255), fontWeight: FontWeight.w700
                                                         )), onPressed: () => { this._addItem(); })
                }
                               )
                           ));
            }
Пример #10
0
        public override Widget build(BuildContext context)
        {
            Debug.Log("build ObjectFinderAppWidget");

            return(new Container(
                       padding: EdgeInsets.all(10),
                       decoration: new BoxDecoration(color: new Color(0x4FFFFFFF),
                                                     border: Border.all(color: Color.fromARGB(255, 255, 0, 0), width: 5),
                                                     borderRadius: BorderRadius.all(2)),
                       child: new Column(
                           crossAxisAlignment: CrossAxisAlignment.stretch,
                           children: new List <Widget>()
            {
                this._buildTitle(),
                this._buildSearchInput(),
                this._buildResultCount(),
                this._buildResults(),
            }
                           )
                       ));
        }
Пример #11
0
 private Widget createWidget()
 {
     return(new Container(
                padding: EdgeInsets.all(15),
                decoration: new BoxDecoration(
                    color: new Color(0xFF7F7F7F),
                    border: Border.all(color: Color.fromARGB(255, 255, 0, 0), width: 5),
                    borderRadius: BorderRadius.all(2)),
                child: new Column(
                    mainAxisAlignment: MainAxisAlignment.spaceAround,
                    children: new List <Widget>()
     {
         new StoreConnector <CounterState, string>(
             converter: (state, dispatch) => $"Count:{state.count}",
             builder: (context, countText) =>
             new Center(
                 child: new Text(countText, style: new TextStyle(
                                     fontSize: 20, fontWeight: FontWeight.w700
                                     )))
             ),
         new StoreConnector <CounterState, Action>(
             converter: (state, dispatch) => () => { dispatch(new CounterIncAction()
             {
                 amount = 1
             }); },
             builder: (context, onPress) => new CustomButton(
                 backgroundColor: Color.fromARGB(255, 0, 204, 204),
                 padding: EdgeInsets.all(10),
                 child: new Text("Add", style: new TextStyle(
                                     fontSize: 16, color: Color.fromARGB(255, 255, 255, 255)
                                     )), onPressed: () => { onPress(); })
             ),
     }
                    )
                ));
 }
Пример #12
0
        public static Unity.UIWidgets.ui.Color ToUIColor(this UnityEngine.Color color)
        {
            var uiColor = Color.fromARGB((int)(color.a * 255), (int)(color.r * 255), (int)(color.g * 255), (int)(color.b * 255));

            return(uiColor);
        }
Пример #13
0
 public override Widget build(BuildContext context)
 {
     return(new Container(
                height: 200,
                padding: EdgeInsets.all(10),
                decoration: new BoxDecoration(
                    color: new Color(0xFFEF1F7F),
                    border: Border.all(color: Color.fromARGB(255, 0xDF, 0x10, 0x70), width: 5),
                    borderRadius: BorderRadius.all(20)
                    ),
                child: new Center(
                    child: new Column(
                        children: new List <Widget>()
     {
         new Text(title),
         new Divider(),
         new Text(subtitle),
         new Divider(),
         new Container(
             width: 500,
             decoration: new BoxDecoration(border: Border.all(new Color(0xFF00FF00), 1)),
             child: new EditableText(
                 controller: controller,
                 focusNode: new FocusNode(),
                 style: new TextStyle(
                     fontSize: 18,
                     height: 1.5f,
                     color: new Color(0xFFFF89FD)),
                 cursorColor: Color.fromARGB(255, 0, 0, 0)
                 )
             ),
         new Divider(),
         new ButtonBar(
             children: new List <Widget> {
             new FlatButton(
                 onPressed: () => {
                 setState(() => {
                     title = controller.text;
                 });
             },
                 padding: EdgeInsets.all(5.0),
                 child: new Center(
                     child: new Text("Set Title")
                     )
                 ),
             new RaisedButton(
                 onPressed: () => {
                 setState(() => {
                     subtitle = controller.text;
                 });
             },
                 padding: EdgeInsets.all(5.0),
                 child: new Center(
                     child: new Text("Set Subtitle")
                     )
                 )
         }
             )
     }
                        )
                    )
                ));
 }
Пример #14
0
 public static void computeTonalColors(Color inAmbientColor, Color inSpotColor,
                                       ref Color outAmbientColor, ref Color outSpotColor)
 {
     outAmbientColor = Color.fromARGB(inAmbientColor.alpha, 0, 0, 0);
     outSpotColor    = inSpotColor;
 }
Пример #15
0
        Widget _buildHeader(BuildContext context)
        {
            var container = new Container(
                padding: EdgeInsets.only(left: 16.0f, right: 8.0f),
                height: headerHeight,
                color: CLColors.header,
                child: new Row(
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: new List <Widget> {
                new Container(
                    child: new Text(
                        "All Assets",
                        style: new TextStyle(
                            fontSize: 16,
                            color: Color.fromARGB(100, 255, 255, 0)
                            )
                        )
                    ),
                new CustomButton(
                    padding: EdgeInsets.only(0.0f, 0.0f, 16.0f, 0.0f),
                    child: new Icon(
                        Icons.keyboard_arrow_down,
                        size: 18.0f,
                        color: CLColors.icon2
                        )
                    ),
                new Container(
                    decoration: new BoxDecoration(
                        color: CLColors.white,
                        borderRadius: BorderRadius.all(3)
                        ),
                    width: 320,
                    height: 36,
                    padding: EdgeInsets.all(10.0f),
                    margin: EdgeInsets.only(right: 4),
                    child: new EditableText(
                        maxLines: 1,
                        selectionControls: MaterialUtils.materialTextSelectionControls,
                        controller: new TextEditingController("Type here to search assets"),
                        focusNode: new FocusNode(),
                        style: new TextStyle(
                            fontSize: 16
                            ),
                        selectionColor: Color.fromARGB(255, 255, 0, 0),
                        cursorColor: Color.fromARGB(255, 0, 0, 0)
                        )
                    ),
                new Container(
                    decoration: new BoxDecoration(
                        color: CLColors.background4,
                        borderRadius: BorderRadius.all(2)
                        ),
                    width: 36,
                    height: 36,
                    child: new Row(
                        mainAxisAlignment: MainAxisAlignment.center,
                        crossAxisAlignment: CrossAxisAlignment.center,
                        children: new List <Widget> {
                    new CustomButton(
                        padding: EdgeInsets.only(8.0f, 0.0f, 8.0f, 0.0f),
                        child: new Icon(
                            Icons.search,
                            size: 18.0f,
                            color: CLColors.white
                            )
                        )
                }
                        )
                    ),
                new Container(
                    margin: EdgeInsets.only(left: 16, right: 16),
                    child: new Text(
                        "Learn Game Development",
                        style: new TextStyle(
                            fontSize: 12,
                            color: CLColors.white
                            )
                        )
                    ),
                new Container(
                    decoration: new BoxDecoration(
                        border: Border.all(
                            color: CLColors.white
                            )
                        ),
                    margin: EdgeInsets.only(right: 16),
                    padding: EdgeInsets.all(4),
                    child: new Row(
                        mainAxisAlignment: MainAxisAlignment.center,
                        crossAxisAlignment: CrossAxisAlignment.center,
                        children: new List <Widget> {
                    new Text(
                        "Plus/Pro",
                        style: new TextStyle(
                            fontSize: 11,
                            color: CLColors.white
                            )
                        )
                }
                        )
                    ),
                new Container(
                    margin: EdgeInsets.only(right: 16),
                    child: new Text(
                        "Impressive New Assets",
                        style: new TextStyle(
                            fontSize: 12,
                            color: CLColors.white
                            )
                        )
                    ),
                new Container(
                    child: new Text(
                        "Shop On Old Store",
                        style: new TextStyle(
                            fontSize: 12,
                            color: CLColors.white
                            )
                        )
                    ),
            }
                    )
                );

            return(container);
        }
Пример #16
0
        RenderBox textEditable()
        {
            var span = new TextSpan("", children:
                                    new List <TextSpan> {
                new TextSpan(
                    "Word Wrap:The ascent of the font is the distance from the baseline to the top line of the font, as defined in the font's original data file.",
                    null),
            }, style: new TextStyle(height: 1.0));

            var flexbox = new RenderFlex(
                direction: Axis.vertical,
                mainAxisAlignment: MainAxisAlignment.spaceAround,
                crossAxisAlignment: CrossAxisAlignment.center);

            flexbox.add(this.flexItemBox(
                            new Unity.UIWidgets.rendering.RenderEditable(span, TextDirection.ltr,
                                                                         new _FixedViewportOffset(0.0), new ValueNotifier <bool>(true),
                                                                         onSelectionChanged: this.selectionChanged, cursorColor: Color.fromARGB(255, 0, 0, 0),
                                                                         maxLines: 100,
                                                                         selectionColor: Color.fromARGB(255, 255, 0, 0))
                            ));

            span = new TextSpan("", children:
                                new List <TextSpan> {
                new TextSpan(
                    "Hard Break:The ascent of the font is the distance\nfrom the baseline to the top \nline of the font,\nas defined in",
                    null),
            }, style: new TextStyle(height: 1.0));
            flexbox.add(this.flexItemBox(
                            new Unity.UIWidgets.rendering.RenderEditable(span, TextDirection.ltr,
                                                                         new _FixedViewportOffset(0.0), new ValueNotifier <bool>(true),
                                                                         onSelectionChanged: this.selectionChanged, cursorColor: Color.fromARGB(255, 0, 0, 0),
                                                                         maxLines: 100,
                                                                         selectionColor: Color.fromARGB(255, 255, 0, 0))
                            ));

            span = new TextSpan("", children:
                                new List <TextSpan> {
                new TextSpan("Single Line:How to create mixin", null),
            }, style: new TextStyle(height: 1.0));
            flexbox.add(this.flexItemBox(
                            new Unity.UIWidgets.rendering.RenderEditable(span, TextDirection.ltr,
                                                                         new _FixedViewportOffset(0.0), new ValueNotifier <bool>(true),
                                                                         onSelectionChanged: this.selectionChanged, cursorColor: Color.fromARGB(255, 0, 0, 0),
                                                                         selectionColor: Color.fromARGB(255, 255, 0, 0))
                            , width: 300));
            return(flexbox);
        }
Пример #17
0
        public override Widget build(BuildContext context)
        {
            if (this.model == null)
            {
                return(new Container());
            }

            const float imageWidth   = 114;
            const float imageHeight  = 76;
            const float borderRadius = 4;

            var time       = Convert.ToDateTime(value: this.model.begin.startTime);
            var hour       = $"{time.Hour.ToString().PadLeft(2, '0')}";
            var minute     = $"{time.Minute.ToString().PadLeft(2, '0')}";
            var hourMinute = $"{hour}:{minute}";
            var address    = this.place ?? "";
            var imageUrl   = this.model.avatar ?? this.model.background;
            var card       = new Container(
                height: 108,
                padding: EdgeInsets.all(16),
                color: CColors.White,
                child: new Row(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: new List <Widget> {
                new Container(
                    width: 32,
                    margin: EdgeInsets.only(right: 10),
                    child: new Column(
                        crossAxisAlignment: CrossAxisAlignment.center,
                        children: new List <Widget> {
                    new Text(
                        time.Day.ToString(),
                        style: new TextStyle(
                            height: 1.33f,
                            fontSize: 24,
                            fontFamily: "Roboto-Bold",
                            color: CColors.Error
                            )
                        ),
                    new Text(
                        $"{time.Month.ToString()}月",
                        style: CTextStyle.CaptionBody
                        )
                }
                        )
                    ),
                new Expanded(
                    child: new Container(
                        margin: EdgeInsets.only(right: 8),
                        child: new Column(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: new List <Widget> {
                    new Container(
                        margin: EdgeInsets.only(bottom: 8),
                        child: new Text(this.model.title,
                                        style: CTextStyle.PLargeMedium,
                                        maxLines: 2,
                                        overflow: TextOverflow.ellipsis
                                        )
                        ),
                    new Text(this.model.mode == "online"
                                                ? $"{hourMinute} · {this.model.participantsCount}人已预订"
                                                : $"{hourMinute}  · {address}",
                             style: CTextStyle.PSmallBody3
                             )
                }
                            )
                        )
                    ),
                new Container(
                    child: new Stack(
                        children: new List <Widget> {
                    new PlaceholderImage(
                        imageUrl.EndsWith(".gif")
                                            ? imageUrl
                                            : CImageUtils.SuitableSizeImageUrl(imageWidth, imageUrl),
                        imageWidth,
                        imageHeight,
                        borderRadius,
                        BoxFit.cover,
                        color: CColorUtils.GetSpecificDarkColorFromId(id: this.model.id)
                        ),
                    new Positioned(
                        bottom: 0,
                        right: 0,
                        child: new ClipRRect(
                            borderRadius: BorderRadius.only(4, bottomRight: 4),
                            child: new Container(
                                width: 41,
                                height: 24,
                                decoration: new BoxDecoration(
                                    gradient: new LinearGradient(
                                        begin: Alignment.centerLeft,
                                        end: Alignment.centerRight,
                                        this.model.mode == "online"
                                                            ? new List <Color> {
                        Color.fromARGB(255, 250, 120, 102),
                        CColors.SecondaryPink
                    }
                                                            : new List <Color> {
                        Color.fromARGB(255, 69, 199, 250),
                        CColors.PrimaryBlue
                    }
                                        )
                                    ),
                                alignment: Alignment.center,
                                child: new Text(
                                    this.model.mode == "online" ? "线上" : "线下",
                                    style: CTextStyle.CaptionWhite,
                                    textAlign: TextAlign.center
                                    )
                                )
                            )
                        )
                }
                        )
                    )
            }
                    )
                );

            return(new GestureDetector(
                       child: card,
                       onTap: this.onTap
                       ));
        }