Ejemplo n.º 1
0
        Widget _buildReportButton()
        {
            Widget right = new Container();

            if (this.widget.viewModel.loading)
            {
                right = new CustomActivityIndicator(
                    loadingColor: LoadingColor.white,
                    size: LoadingSize.small
                    );
            }

            return(new Container(
                       padding: EdgeInsets.symmetric(horizontal: 16),
                       margin: EdgeInsets.only(top: 16),
                       child: new CustomButton(
                           onPressed: () => {
                if (this.widget.viewModel.loading)
                {
                    return;
                }

                this.widget.actionModel.startReportItem();
                this.widget.actionModel.reportItem(this._reportItems[this._selectedIndex]);
            },
                           padding: EdgeInsets.zero,
                           child: new Container(
                               height: 40,
                               decoration: new BoxDecoration(this.widget.viewModel.loading
                                ? CColors.ButtonActive
                                : CColors.PrimaryBlue,
                                                             borderRadius: BorderRadius.all(4)
                                                             ),
                               child: new Stack(
                                   children: new List <Widget> {
                new Align(
                    alignment: Alignment.center,
                    child: new Text(
                        "举报",
                        style: CTextStyle.PLargeMediumWhite
                        )
                    ),
                new Positioned(
                    right: 24,
                    height: 40,
                    child: right
                    )
            }
                                   )
                               )
                           )
                       ));
        }
Ejemplo n.º 2
0
        static List <Widget> _CodeBlock(string text)
        {
            List <Widget> codeBlockList = new List <Widget>();

            if (text.isEmpty())
            {
                codeBlockList.Add(new Container());
            }
            else
            {
                var codeStringList = text.Split(Environment.NewLine.ToCharArray());
                codeBlockList.Add(new Container(color: codeBlockBackgroundColor, height: 16));
                for (int i = 0; i < codeStringList.Length; i++)
                {
                    string codeBlockGroup = "";
                    for (int j = 0; j < codeBlockNumber && i < codeStringList.Length; j++)
                    {
                        codeBlockGroup += codeStringList[i];
                        if (i == codeStringList.Length - 1 && codeStringList.Length % codeBlockNumber != 0)
                        {
                            break;
                        }

                        if (j < codeBlockNumber - 1)
                        {
                            codeBlockGroup += Environment.NewLine;
                            i++;
                        }
                    }
                    var codeWidget = new TipMenu(
                        new List <TipMenuItem> {
                        new TipMenuItem(
                            "复制",
                            () => Clipboard.setData(new ClipboardData(text: codeBlockGroup))
                            )
                    },
                        new Container(
                            color: codeBlockBackgroundColor,
                            padding: EdgeInsets.symmetric(horizontal: 16),
                            child: new RichText(
                                text: highlighter.Highlight("C#", input: codeBlockGroup)
                                )
                            )
                        );
                    codeBlockList.Add(item: codeWidget);
                }

                codeBlockList.Add(new Container(color: codeBlockBackgroundColor, height: 16));
                codeBlockList.Add(new Container(color: CColors.White, height: 24));
            }

            return(codeBlockList);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// The initState.
        /// </summary>
        public override void initState()
        {
            base.initState();
            var specifiedChanged = MMMServices.Instance.SpecifiedMmdObjects.ObserveCountChanged(true);
            var folderChanged    = MMMServices.Instance.WatchedFolders.ObserveCountChanged(true);

            observeCountChanged = specifiedChanged.Merge(folderChanged)
                                  .Subscribe(x =>
            {
                using (WindowProvider.of(GameObject.Find("Panel")).getScope())
                {
                    setState(() =>
                    {
                        // Add specified pmx chip
                        var specified = MMMServices.Instance.SpecifiedMmdObjects
                                        .Select(f => new CustomElevation(
                                                    child: new Chip(
                                                        label: new Text(f.FileName),
                                                        deleteIcon: new Icon(Icons.delete),
                                                        onDeleted: () => MMMServices.Instance.SpecifiedMmdObjects.Remove(f),
                                                        backgroundColor: Colors.white,
                                                        deleteIconColor: Colors.red,
                                                        shape: new RoundedRectangleBorder(borderRadius: BorderRadius.circular(17))
                                                        ),
                                                    height: 30,
                                                    padding: EdgeInsets.symmetric(horizontal: 6)
                                                    ))
                                        .ToList();

                        // Add folder chip
                        var folders = MMMServices.Instance.WatchedFolders
                                      .Select(f => new CustomElevation(
                                                  child: new Chip(
                                                      label: new Text(f.Split('\\').Last()),
                                                      deleteIcon: new Icon(Icons.delete),
                                                      onDeleted: () => MMMServices.Instance.WatchedFolders.Remove(f),
                                                      backgroundColor: Colors.white,
                                                      deleteIconColor: Colors.red,
                                                      shape: new RoundedRectangleBorder(borderRadius: BorderRadius.circular(17))
                                                      ),
                                                  height: 30,
                                                  padding: EdgeInsets.symmetric(horizontal: 6)
                                                  ))
                                      .ToList();

                        chips.Clear();
                        chips.AddRange(specified);
                        chips.AddRange(folders);
                    });
                }
            });
        }
Ejemplo n.º 4
0
        Widget _buildNavigationBar()
        {
            var disEnabled = this._favoriteName.isEmpty();

            return(new Container(
                       decoration: new BoxDecoration(
                           color: CColors.White,
                           border: new Border(
                               bottom: new BorderSide(
                                   color: CColors.Separator2
                                   )
                               )
                           ),
                       height: CustomAppBarUtil.appBarHeight,
                       child: new Row(
                           mainAxisAlignment: MainAxisAlignment.spaceBetween,
                           children: new List <Widget> {
                new CustomButton(
                    padding: EdgeInsets.symmetric(8, 16),
                    onPressed: this._onPressBack,
                    child: new Text(
                        "取消",
                        style: CTextStyle.PLargeBody5.merge(new TextStyle(height: 1))
                        )
                    ),
                new Text(
                    this.widget.viewModel.tagId.isNotEmpty() ? "编辑收藏夹" : "新建收藏夹",
                    style: CTextStyle.PXLargeMedium.merge(new TextStyle(height: 1))
                    ),
                new CustomButton(
                    padding: EdgeInsets.symmetric(8, 16),
                    onPressed: () => {
                    if (!disEnabled)
                    {
                        this._onPressSubmit();
                    }
                },
                    child: new Text(
                        "完成",
                        style: disEnabled
                                    ? new TextStyle(
                            fontSize: 16,
                            fontFamily: "Roboto-Medium",
                            color: Color.fromRGBO(33, 150, 243, 0.5f)
                            )
                                    : CTextStyle.PLargeMediumBlue.merge(new TextStyle(height: 1))
                        )
                    )
            }
                           )
                       ));
        }
Ejemplo n.º 5
0
        Widget _buildCategory(Category category, BuildContext context)
        {
            string    categoryString = category.ToString().Replace("Category", "").ToUpper();
            ThemeData theme          = Theme.of(context);

            return(new ScopedModelDescendant <AppStateModel>(
                       builder: (BuildContext context2, Widget child, AppStateModel model) =>
                       new GestureDetector(
                           onTap: () =>
            {
                model.setCategory(category);
                if (onCategoryTap != null)
                {
                    onCategoryTap();
                }
            },
                           child: model.selectedCategory == category
                    ? new Container(
                               child: new Column(
                                   children: new List <Widget>
            {
                new SizedBox(height: 16.0f),
                new Text(
                    categoryString,
                    style: theme.textTheme.bodyText1,
                    textAlign: TextAlign.center
                    ),
                new SizedBox(height: 14.0f),
                new Container(
                    width: 70.0f,
                    height: 2.0f,
                    color: shrineColorsUtils.kShrinePink400
                    ),
            }
                                   )
                               )
                    : new Container(
                               child: new Padding(
                                   padding: EdgeInsets.symmetric(vertical: 16.0f),
                                   child: new Text(
                                       categoryString,
                                       style: theme.textTheme.bodyText1.copyWith(
                                           color: shrineColorsUtils.kShrineBrown900.withAlpha(153)
                                           ),
                                       textAlign: TextAlign.center
                                       )
                                   )
                               )
                           )
                       ));
        }
Ejemplo n.º 6
0
        public override Widget build(BuildContext context)
        {
            ThemeData theme     = Theme.of(context);
            TextTheme textTheme = theme.textTheme;

            return(new Column(
                       children: new List <Widget> {
                new Container(
                    margin: EdgeInsets.only(
                        left: 24.0f,
                        right: 24.0f,
                        bottom: 24.0f
                        ) - margin,
                    child: new Center(
                        child: new DefaultTextStyle(
                            style: textTheme.caption.copyWith(fontSize: 15.0f),
                            child: child
                            )
                        )
                    ),
                new  Divider(height: 1.0f),
                new Container(
                    padding: EdgeInsets.symmetric(vertical: 16.0f),
                    child: new Row(
                        mainAxisAlignment: MainAxisAlignment.end,
                        children: new List <Widget> {
                    new Container(
                        margin: EdgeInsets.only(right: 8.0f),
                        child: new FlatButton(
                            onPressed: onCancel,
                            child: new  Text("CANCEL", style: new TextStyle(
                                                 color: Colors.black54,
                                                 fontSize: 15.0f,
                                                 fontWeight: FontWeight.w500
                                                 ))
                            )
                        ),
                    new Container(
                        margin: EdgeInsets.only(right: 8.0f),
                        child: new FlatButton(
                            onPressed: onSave,
                            textTheme: ButtonTextTheme.accent,
                            child: new  Text("SAVE")
                            )
                        )
                }
                        )
                    )
            }
                       ));
        }
Ejemplo n.º 7
0
 public override Widget build(BuildContext context)
 {
     return(new CupertinoPageScaffold(
                navigationBar: new CupertinoNavigationBar(
                    trailing: CupertinoNavigationDemoUtils.trailingButtons
                    ),
                child: new SafeArea(
                    child: new ListView(
                        children: new List <Widget> {
         new Padding(padding: EdgeInsets.only(top: 32.0f)),
         new GestureDetector(
             onTap: () => {
             Navigator.of(context, rootNavigator: true).push(
                 new CupertinoPageRoute(
                     fullscreenDialog: true,
                     builder: (BuildContext _context) => new Tab3Dialog()
                     )
                 );
         },
             child: new Container(
                 decoration: new BoxDecoration(
                     color: CupertinoTheme.of(context).scaffoldBackgroundColor,
                     border: new Border(
                         top: new BorderSide(color: new Color(0xFFBCBBC1), width: 0.0f),
                         bottom: new BorderSide(color: new Color(0xFFBCBBC1), width: 0.0f)
                         )
                     ),
                 height: 44.0f,
                 child: new Padding(
                     padding: EdgeInsets.symmetric(horizontal: 16.0f, vertical: 8.0f),
                     child: new SafeArea(
                         top: false,
                         bottom: false,
                         child: new Row(
                             children: new List <Widget> {
             new Text(
                 "Sign in",
                 style: new TextStyle(color: CupertinoTheme.of(context)
                                      .primaryColor)
                 ),
         }
                             )
                         )
                     )
                 )
             )
     }
                        )
                    )
                ));
 }
Ejemplo n.º 8
0
        Widget _buildHeadTop(bool isShowShare, IEvent eventObj)
        {
            Widget shareWidget = new Container();

            if (isShowShare)
            {
                shareWidget = new CustomButton(
                    onPressed: () => this._showShareView(eventObj),
                    child: new Container(
                        alignment: Alignment.topRight,
                        width: 64,
                        height: 64,
                        color: CColors.Transparent,
                        child: new Icon(Icons.share, size: 28,
                                        color: this._showNavBarShadow ? CColors.White : CColors.icon3))
                    );
            }

            return(new AnimatedContainer(
                       height: 44,
                       duration: TimeSpan.FromSeconds(0),
                       padding: EdgeInsets.symmetric(horizontal: 8),
                       decoration: new BoxDecoration(
                           CColors.White,
                           gradient: this._showNavBarShadow
                        ? new LinearGradient(
                               colors: new List <Color> {
                new Color(0x80000000),
                new Color(0x0)
            },
                               begin: Alignment.topCenter,
                               end: Alignment.bottomCenter
                               )
                        : null
                           ),
                       child: new Row(
                           mainAxisAlignment: MainAxisAlignment.spaceBetween,
                           children: new List <Widget> {
                new CustomButton(
                    onPressed: () => { this.widget.actionModel.mainRouterPop(); },
                    child: new Icon(
                        Icons.arrow_back,
                        size: 28,
                        color: this._showNavBarShadow ? CColors.White : CColors.icon3
                        )
                    ),
                shareWidget
            }
                           )
                       ));
        }
Ejemplo n.º 9
0
 public override Widget build(BuildContext context)
 {
     return(new Scaffold(
                key: scaffoldKey,
                appBar: new AppBar(
                    title: new Text("Reorderable list"),
                    actions: new List <Widget>
     {
         new MaterialDemoDocumentationButton(ReorderableListDemo.routeName),
         new IconButton(
             icon: new Icon(Icons.sort_by_alpha),
             tooltip: "Sort",
             onPressed: () =>
         {
             setState(() =>
             {
                 _reverseSort = !_reverseSort;
                 _items.Sort((_ListItem a, _ListItem b) =>
                             _reverseSort ? b.value.CompareTo(a.value) : a.value.CompareTo(b.value));
             });
         }
             ),
         new IconButton(
             icon: new Icon(
                 Theme.of(context).platform == RuntimePlatform.IPhonePlayer
                             ? Icons.more_horiz
                             : Icons.more_vert
                 ),
             tooltip: "Show menu",
             onPressed: _bottomSheet == null ? _showConfigurationSheet : (VoidCallback)null
             )
     }
                    ),
                body: new Scrollbar(
                    child: new ReorderableListView(
                        header: _itemType != _ReorderableListType.threeLine
                     ? new Padding(
                            padding: EdgeInsets.all(8.0f),
                            child: new Text("Header of the list", style: Theme.of(context).textTheme.headline5))
                     : null,
                        onReorder: _onReorder,
                        reverse: _reverse,
                        scrollDirection: _itemType == _ReorderableListType.horizontalAvatar
                     ? Axis.horizontal
                     : Axis.vertical,
                        padding: EdgeInsets.symmetric(vertical: 8.0f),
                        children: _items.Select <_ListItem, Widget>(buildListTile).ToList()
                        )
                    )
                ));
 }
Ejemplo n.º 10
0
 Widget _buildContent()
 {
     return(new Container(
                padding: EdgeInsets.symmetric(8, 16),
                decoration: new BoxDecoration(
                    color: CColors.PrimaryBlue,
                    borderRadius: BorderRadius.all(4)
                    ),
                child: new Text(
                    data: this.widget.title,
                    style: CTextStyle.PMediumWhite.copyWith(height: 1.46f)
                    )
                ));
 }
Ejemplo n.º 11
0
 public override Widget build(BuildContext context) =>
 new ListView(
     shrinkWrap: true,
     children: new List <Widget> {
     new Form(
         key: _stateKey,
         child: new Column(
             mainAxisSize: MainAxisSize.max,
             children: new List <Widget> {
         new ImageFileFormField(
             title: "Thumbnail",
             lead: "Select thumbnail picture",
             initialValue: _data.Sample,
             onSaved: file => _data.Sample = file
             ),
         new FileFormFiled(
             "Data",
             "Select data file",
             "xml",
             initialValue: _data.ModelData,
             onSaved: file => _data.ModelData = file
             ),
         new ImageFileFormSetField(
             title: "Pictures",
             lead: "Select associated picture",
             initialValue: _data.Pictures,
             onSaved: files => _data.Pictures = files
             )
     }
             )
         ),
     new Container(
         width: float.MaxValue,
         height: Theme.of(context).buttonTheme.height,
         margin: EdgeInsets.symmetric(vertical: 16f),
         child: new RaisedButton(
             onPressed: () => {
         if (!_stateKey.currentState.validate())
         {
             return;
         }
         _stateKey.currentState.save();
         _data.DataType = DataType.File;
         Navigator.of(context).pop();
     },
             child: new Text("Submit")
             )
         )
 }
     );
Ejemplo n.º 12
0
        static Widget _buildShareItem(IconData icon, string title, Color color, Color background,
                                      GestureTapCallback onTap, bool isBorder = false)
        {
            var border = isBorder
                ? Border.all(
                Color.fromRGBO(216, 216, 216, 1)
                )
                : null;

            return(new GestureDetector(
                       onTap: () => {
                if (Router.navigator.canPop())
                {
                    Router.navigator.pop();
                }

                onTap();
            },
                       child: new Container(
                           padding: EdgeInsets.symmetric(horizontal: 16),
                           decoration: new BoxDecoration(
                               CColors.White
                               ),
                           child: new Column(children: new List <Widget> {
                new Container(
                    width: 48,
                    height: 48,
                    decoration: new BoxDecoration(
                        background,
                        borderRadius: BorderRadius.all(24),
                        border: border
                        ),
                    child: new Icon(
                        icon,
                        size: 30,
                        color: color
                        )
                    ),
                new Container(
                    margin: EdgeInsets.only(top: 8),
                    height: 20,
                    child: new Text(
                        title,
                        style: CTextStyle.PSmallBody4
                        )
                    )
            })
                           )
                       ));
        }
Ejemplo n.º 13
0
        public override Widget build(BuildContext context)
        {
            if (this.user == null)
            {
                return(new Container());
            }

            return(new GestureDetector(
                       onTap: this.onTap,
                       child: new Container(
                           padding: EdgeInsets.symmetric(horizontal: 16),
                           color: CColors.White,
                           height: 72,
                           child: new Row(
                               children: new List <Widget> {
                new Expanded(
                    child: new Row(
                        children: new List <Widget> {
                    Avatar.User(user: this.user, 48),
                    new Expanded(
                        child: new Container(
                            margin: EdgeInsets.only(12),
                            child: new Column(
                                mainAxisAlignment: MainAxisAlignment.center,
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: new List <Widget> {
                        new Text(
                            data: this.user.fullName,
                            style: CTextStyle.PMediumBody,
                            maxLines: 1,
                            overflow: TextOverflow.ellipsis
                            ),
                        this._buildUserTitle()
                    }
                                )
                            )
                        )
                }
                        )
                    ),
                new SizedBox(width: 8),
                new FollowButton(
                    userType: this.userType,
                    onFollow: this.onFollow
                    )
            }
                               )
                           )
                       ));
        }
Ejemplo n.º 14
0
        Widget _buildContentHead()
        {
            var user = this.eventObj.user ?? new User();

            return(new Container(
                       padding: EdgeInsets.symmetric(horizontal: 16),
                       margin: EdgeInsets.only(top: 16, bottom: 20),
                       child: new Column(
                           crossAxisAlignment: CrossAxisAlignment.start,
                           children: new List <Widget> {
                new Text(
                    this.eventObj.title ?? "",
                    this.titleKey,
                    style: CTextStyle.H4
                    ),
                new Container(
                    margin: EdgeInsets.only(top: 20),
                    child: new Row(
                        children: new List <Widget> {
                    new Container(
                        margin: EdgeInsets.only(right: 8),
                        child: new GestureDetector(
                            onTap: () => this.pushToUserDetail(user.id),
                            child: Avatar.User(user, 32)
                            )
                        ),
                    new Column(
                        mainAxisAlignment: MainAxisAlignment.center,
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: new List <Widget> {
                        new GestureDetector(
                            onTap: () => this.pushToUserDetail(user.id),
                            child: new Text(
                                user.fullName ?? "",
                                style: CTextStyle.PMediumBody
                                )
                            ),
                        new Text(
                            $"{DateConvert.DateStringFromNow(this.eventObj.createdTime ?? DateTime.Now)}发布",
                            style: CTextStyle.PSmallBody3
                            )
                    }
                        )
                }
                        )
                    )
            }
                           )
                       ));
        }
Ejemplo n.º 15
0
 static Widget _buildFutureCard()
 {
     return(new Container(
                padding: EdgeInsets.symmetric(horizontal: 8, vertical: 2),
                decoration: new BoxDecoration(
                    CColors.Black,
                    borderRadius: BorderRadius.all(4)
                    ),
                child: new Text(
                    "未开始",
                    style: CTextStyle.CaptionWhite
                    )
                ));
 }
Ejemplo n.º 16
0
        public override Widget build(BuildContext context)
        {
            if (this.game == null || this.game.attachmentURLs.isNullOrEmpty())
            {
                return(new Container());
            }

            var attachmentURLs = this.game.attachmentURLs;

            return(new Container(
                       child: new Column(
                           crossAxisAlignment: CrossAxisAlignment.start,
                           children: new List <Widget> {
                new Container(
                    height: 1,
                    margin: EdgeInsets.symmetric(horizontal: 16),
                    color: CColors.Separator
                    ),
                new Padding(
                    padding: EdgeInsets.all(16),
                    child: new Text(
                        "预览",
                        style: CTextStyle.H5
                        )
                    ),
                new Container(
                    height: MediaQuery.of(context: context).size.width * 0.4f,
                    child: ListView.builder(
                        scrollDirection: Axis.horizontal,
                        itemCount: attachmentURLs.Count,
                        itemBuilder: (cxt, index) => new Container(
                            margin: EdgeInsets.only(index == 0 ? 16 : 8,
                                                    right: index == attachmentURLs.Count - 1 ? 16 : 0),
                            child: new AspectRatio(
                                aspectRatio: 16 / 9f,
                                child: new PlaceholderImage(
                                    attachmentURLs[index: index],
                                    borderRadius: 8,
                                    fit: BoxFit.cover,
                                    useCachedNetworkImage: true
                                    )
                                )
                            )
                        )
                    )
            }
                           )
                       ));
        }
Ejemplo n.º 17
0
        public static Widget SettingValueUpDown(string title, string value, VoidCallback upPressed = null, VoidCallback downPressed = null)
        {
            return(new Container(
                       padding: EdgeInsets.symmetric(horizontal: 6f),
                       child: new Row(
                           children: new List <Widget>
            {
                new Container(
                    child: new Text(title)
                    ),
                new Expanded(
                    child: new Row(
                        mainAxisAlignment: Unity.UIWidgets.rendering.MainAxisAlignment.end,
                        children:    new List <Widget>
                {
                    new Container(
                        padding: EdgeInsets.symmetric(horizontal: 16f),
                        child: new Text(value.ToString())
                        ),
                    new Column(

                        children: new List <Widget> {
                        new Container(
                            decoration: new BoxDecoration(
                                border: new Border(bottom: new BorderSide(width: 0.1f, color: Colors.black26))
                                ),
                            child: new InkWell(
                                child: new Icon(Icons.arrow_drop_up, size: 18),
                                onTap: () => { upPressed?.Invoke(); }
                                )             //InkWell
                            ),                //Container
                        new Container(
                            decoration: new BoxDecoration(
                                border: new Border(bottom: new BorderSide(width: 0.5f, color: Colors.white))
                                ),
                            child: new InkWell(
                                child: new Icon(Icons.arrow_drop_down, size: 18),
                                onTap: () => { downPressed?.Invoke(); }
                                ) //InkWell
                            )     //Container
                    }
                        ),        //column
                }                 //end children
                        )         //row
                    )             //expanded
            }                     //list
                           )      //row
                       ));
        }
Ejemplo n.º 18
0
 public CustomListTile(
     Widget leading           = null,
     string title             = null,
     Widget trailing          = null,
     EdgeInsets padding       = null,
     GestureTapCallback onTap = null,
     Key key = null
     ) : base(key: key)
 {
     this.leading  = leading;
     this.title    = title;
     this.trailing = trailing;
     this.padding  = padding ?? EdgeInsets.symmetric(horizontal: 16);
     this.onTap    = onTap;
 }
Ejemplo n.º 19
0
 Widget _buildNavigationBar(BuildContext context)
 {
     return(new Container(
                width: MediaQuery.of(context: context).size.width,
                height: 94,
                decoration: new BoxDecoration(
                    color: CColors.White,
                    border: new Border(
                        bottom: new BorderSide(color: CColors.Separator2)
                        )
                    ),
                child: new Column(
                    mainAxisAlignment: MainAxisAlignment.end,
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: new List <Widget> {
         new Row(
             mainAxisAlignment: MainAxisAlignment.spaceBetween,
             children: new List <Widget> {
             new CustomButton(
                 padding: EdgeInsets.symmetric(8, 16),
                 onPressed: () => this.widget.actionModel.mainRouterPop(),
                 child: new Icon(
                     icon: Icons.arrow_back,
                     size: 24,
                     color: CColors.Icon
                     )
                 ),
             new CustomButton(
                 padding: EdgeInsets.symmetric(8, 16),
                 onPressed: () => this.widget.actionModel.pushToCreateFavorite(""),
                 child: new Text(
                     "新建",
                     style: CTextStyle.PLargeBlue
                     )
                 )
         }
             ),
         new Container(
             margin: EdgeInsets.only(16, bottom: 8),
             child: new Text(
                 "我的收藏",
                 style: CTextStyle.H2
                 )
             )
     }
                    )
                ));
 }
Ejemplo n.º 20
0
 Widget _buildQrScanWidget(bool isLoggedIn)
 {
     return(new Container(
                height: 44,
                child: new Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: new List <Widget> {
         isLoggedIn
                     ? (Widget) new CustomButton(
             padding: EdgeInsets.symmetric(8, 16),
             onPressed: () => this.widget.actionModel.pushToNotifications(),
             child: new Container(
                 width: 28,
                 height: 28,
                 child: new Stack(
                     children: new List <Widget> {
             new Icon(
                 icon: Icons.outline_notifications,
                 color: CColors.LightBlueGrey,
                 size: 28
                 ),
             Positioned.fill(
                 new Align(
                     alignment: Alignment.topRight,
                     child: new NotificationDot(
                         this.widget.viewModel.hasUnreadNotifications ? "" : null,
                         new BorderSide(color: CColors.White, 2)
                         )
                     )
                 )
         }
                     )
                 )
             )
                     : new Container(),
         new CustomButton(
             padding: EdgeInsets.symmetric(8, 16),
             onPressed: QRScanPlugin.PushToQRScan,
             child: new Icon(
                 icon: Icons.outline_scan,
                 size: 28,
                 color: CColors.LightBlueGrey
                 )
             )
     }
                    )
                ));
 }
Ejemplo n.º 21
0
 public override Widget build(BuildContext context)
 {
     return(new GestureDetector(
                onTap: () => { mOnClick(); },
                child: new Container(
                    width: mHabitWidth,
                    padding: EdgeInsets.only(left: 5, top: 3, bottom: 2, right: 5),
                    margin: EdgeInsets.symmetric(horizontal: Habits.Padding / 2, vertical: Habits.Padding / 2),
                    decoration: new BoxDecoration(
                        color: mHabit.Selected ? Colors.blue : Colors.white10,
                        borderRadius: BorderRadius.all(Radius.circular(4))
                        ),
                    child: new Column(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: new List <Widget>()
     {
         new Container(
             padding: EdgeInsets.all(4),
             child: new Align(
                 alignment: Alignment.topLeft,
                 child: new Text(mHabit.Title,
                                 textAlign: TextAlign.left,
                                 style: new TextStyle(color: Colors.white, fontSize: 16))
                 )
             ),
         new Container(
             height: 19,
             child: new Row(
                 mainAxisAlignment: MainAxisAlignment.spaceBetween,
                 children: new List <Widget>()
         {
             new Text(mHabit.CreateAt.ToString("MM/dd/yyyy"),
                      style: new TextStyle(color: Colors.white70, fontSize: 12)),
             new GestureDetector(
                 child: new Icon(
                     Icons.more_horiz,
                     size: 20,
                     color: Colors.white70
                     ),
                 onTap: () => { mOnEdit(); }),
         }
                 )
             )
     }
                        )
                    )
                ));
 }
Ejemplo n.º 22
0
 public override Widget build(BuildContext context)
 {
     return(new Column(
                children: new List <Widget> {
         new Text("Counter: " + this.counter, style: new TextStyle(color: Colors.white)),
         new GestureDetector(
             onTap: OnTap,
             child: new Container(
                 padding: EdgeInsets.symmetric(20, 20),
                 color: Colors.blue,
                 child: new Text("Click Me")
                 )
             )
     }
                ));
 }
Ejemplo n.º 23
0
 Widget _buildTagsField()
 {
     return(new CupertinoTextField(
                controller: new TextEditingController(text: "colleague, reading club"),
                prefix: new Icon(
                    CupertinoIcons.tags_solid,
                    color: CupertinoColors.lightBackgroundGray,
                    size: 28.0f
                    ),
                enabled: false,
                padding: EdgeInsets.symmetric(horizontal: 6.0f, vertical: 12.0f),
                decoration: new BoxDecoration(
                    border: new Border(bottom: new BorderSide(width: 0.0f, color: CupertinoColors.inactiveGray))
                    )
                ));
 }
Ejemplo n.º 24
0
        public override Widget build(BuildContext context)
        {
            ThemeData theme = Theme.of(context);

            return(new Scrollbar(
                       child: new ListView(
                           key: new PageStorageKey <Category>(this.category),
                           padding: EdgeInsets.symmetric(
                               vertical: 16.0f,
                               horizontal: 64.0f
                               ),
                           children: this.category.assets.Select <string, Widget>((string asset) =>
            {
                return new Column(
                    crossAxisAlignment: CrossAxisAlignment.stretch,
                    children: new List <Widget>
                {
                    new Card(
                        child: new Container(
                            width: 144.0f,
                            alignment: Alignment.center,
                            child: new Column(
                                children: new List <Widget>
                    {
                        Image.file(
                            asset,
                            fit: BoxFit.contain
                            ),
                        new Container(
                            padding: EdgeInsets.only(bottom: 16.0f),
                            alignment: AlignmentDirectional.center,
                            child: new Text(
                                asset,
                                style: theme.textTheme.caption
                                )
                            )
                    }
                                )
                            )
                        ),
                    new SizedBox(height: 24.0f)
                }
                    );
            }).ToList()
                           )
                       ));
        }
Ejemplo n.º 25
0
        static List <Widget> _CodeBlock(string text)
        {
            List <Widget> codeBlockList = new List <Widget>();

            if (string.IsNullOrEmpty(text))
            {
                codeBlockList.Add(new Container());
            }
            else
            {
                var codeStringList = text.Split(Environment.NewLine.ToCharArray());
                codeBlockList.Add(new Container(color: codeBlockBackgroundColor, height: 16));
                for (int i = 0; i < codeStringList.Length; i++)
                {
                    string codeBlockGroup = "";
                    for (int j = 0; j < codeBlockNumber && i < codeStringList.Length; j++)
                    {
                        codeBlockGroup += codeStringList[i];
                        if (i == codeStringList.Length - 1 && codeStringList.Length % codeBlockNumber != 0)
                        {
                            break;
                        }

                        if (j < codeBlockNumber - 1)
                        {
                            codeBlockGroup += Environment.NewLine;
                            i++;
                        }
                    }

                    var codeWidget = new Container(
                        color: codeBlockBackgroundColor,
                        padding: EdgeInsets.symmetric(horizontal: 16),
                        child: new Text(
                            codeBlockGroup,
                            style: CTextStyle.PCodeStyle
                            )
                        );
                    codeBlockList.Add(item: codeWidget);
                }

                codeBlockList.Add(new Container(color: codeBlockBackgroundColor, height: 16));
                codeBlockList.Add(new Container(color: CColors.White, height: 24));
            }

            return(codeBlockList);
        }
Ejemplo n.º 26
0
        public override Widget build(BuildContext context)
        {
            var mediaQuery = MediaQuery.of(context);

            return(new Container(
                       width: mediaQuery.size.width,
                       child: new DecoratedBox(
                           decoration: new BoxDecoration(
                               CColors.White,
                               border: new Border(
                                   new BorderSide(
                                       CColors.Separator
                                       )
                                   )
                               ),
                           child: new Padding(
                               padding: EdgeInsets.only(
                                   16,
                                   13.5f,
                                   8,
                                   13.5f + mediaQuery.padding.bottom
                                   ),
                               child: new Row(
                                   mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                   children: new List <Widget> {
                new Expanded(
                    child: new Text(this.widget.message,
                                    maxLines: 3,
                                    style: CTextStyle.PRegularError.copyWith(this.widget.color)
                                    )
                    ),
                new CustomButton(
                    padding: EdgeInsets.symmetric(horizontal: 8, vertical: 4),
                    onPressed: this.widget.dismiss,
                    child: new Icon(
                        Icons.close,
                        size: 24,
                        color: new Color(0xFFC7CBCF)
                        )
                    )
            }
                                   )
                               )
                           )
                       ));
        }
Ejemplo n.º 27
0
 private Widget buildBody(BuildContext context)
 {
     return(new SafeArea(
                top: false,
                bottom: false,
                child: new ListView(
                    padding: EdgeInsets.all(24.0f),
                    children: new List <Widget>
     {
         new Text(SnackBarDemoUtils._text1),
         new Text(SnackBarDemoUtils._text2),
         new Center(
             child: new RaisedButton(
                 child: new Text("SHOW A SNACKBAR"),
                 onPressed: () =>
         {
             int thisSnackBarIndex = _snackBarIndex++;
             Scaffold.of(context).showSnackBar(new SnackBar(
                                                   content: new Text($"This is snackbar #{thisSnackBarIndex}."),
                                                   action: new SnackBarAction(
                                                       label: "ACTION",
                                                       onPressed: () =>
             {
                 Scaffold.of(context).showSnackBar(new SnackBar(
                                                       content: new Text(
                                                           $"You pressed snackbar {thisSnackBarIndex}'s action.")
                                                       ));
             }
                                                       )
                                                   ));
         }
                 )
             ),
         new Text(SnackBarDemoUtils._text3)
     }
                    .Select <Widget, Widget>((Widget child) =>
     {
         return new Container(
             margin: EdgeInsets.symmetric(vertical: 12.0f),
             child: child
             );
     })
                    .ToList()
                    )
                ));
 }
Ejemplo n.º 28
0
        Widget _buildTextField()
        {
            Widget textFieldWidget = new Container(
                padding: EdgeInsets.symmetric(5, 16),
                decoration: new BoxDecoration(
                    color: CColors.Separator2,
                    borderRadius: BorderRadius.all(16)
                    ),
                child: new InputField(
                    key: this._textFieldKey,
                    controller: this._controller,
                    focusNode: this._focusNode,
                    style: CTextStyle.PLargeBody,
                    hintText: this.widget.hintText,
                    hintStyle: CTextStyle.PLargeBody4.copyWith(height: 1),
                    autofocus: this.widget.autofocus,
                    height: null,
                    maxLines: this.widget.maxLines,
                    minLines: this.widget.minLines,
                    maxLength: this.widget.maxLength ?? 2000,
                    cursorColor: CColors.PrimaryBlue,
                    textInputAction: CCommonUtils.isIPhone ? TextInputAction.send : TextInputAction.newline,
                    onSubmitted: this.widget.onSubmitted
                    )
                );

            if (this.widget.loading)
            {
                return(new Stack(
                           children: new List <Widget> {
                    textFieldWidget,
                    new Positioned(
                        right: 8,
                        top: 0,
                        bottom: 0,
                        child: new Align(
                            alignment: Alignment.center,
                            child: new CustomActivityIndicator(size: LoadingSize.small)
                            )
                        )
                }
                           ));
            }

            return(textFieldWidget);
        }
Ejemplo n.º 29
0
        public override Widget build(BuildContext context)
        {
            var headers = this.widget.headers ?? new Dictionary <string, string> {
                { HttpManager.COOKIE, HttpManager.getCookie() },
                { "ConnectAppVersion", Config.versionNumber },
                { "X-Requested-With", "XmlHttpRequest" }
            };
            var pageView = new PageView(
                controller: this.widget.controller,
                onPageChanged: index => { this.setState(() => { this.currentIndex = index; }); },
                children: this.widget.urls.Select <string, Widget>(url => {
                return(this.widget.useCachedNetworkImage
                        ? CachedNetworkImageProvider.cachedNetworkImage(
                           url,
                           fit: BoxFit.contain,
                           headers: headers)
                        : Image.network(url,
                                        fit: BoxFit.contain,
                                        headers: headers));
            }).ToList());

            return(new GestureDetector(
                       onTap: () => { StoreProvider.store.dispatcher.dispatch(new MainNavigatorPopAction()); },
                       onLongPress: this._pickImage,
                       child: new Container(
                           color: CColors.Black,
                           child: new Stack(
                               alignment: Alignment.center,
                               children: new List <Widget> {
                pageView,
                new Positioned(
                    bottom: 30,
                    child: new Container(
                        height: 40,
                        padding: EdgeInsets.symmetric(0, 24),
                        alignment: Alignment.center,
                        decoration: new BoxDecoration(
                            color: Color.fromRGBO(0, 0, 0, 0.5f),
                            borderRadius: BorderRadius.all(20)
                            ),
                        child: new Text($"{this.currentIndex + 1}/{this.widget.urls.Count}",
                                        style: CTextStyle.PLargeWhite.copyWith(height: 1))
                        )
                    )
            }))));
        }
Ejemplo n.º 30
0
        public override Widget build(BuildContext context) => new Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: new List <Widget>
        {
            new BlurredAppBar(child: new Row(
                                  children: new List <Widget>
            {
                new SizedBox(width: 8),
                new RoundedIconButton(icon: Icons.arrow_back, onPressed: ToolEditorUIStatus <ToolEditorUI> .ToolEditorUIKey.currentState.GoHome),
                new Container(child: new Text(widget.Title, style: Theme.of(context).textTheme.title),
                              margin: EdgeInsets.all(8)),
            }
                                  )),
            new Expanded(
                child: new Padding(
                    padding: EdgeInsets.symmetric(horizontal: 8),
                    child: new SingleChildScrollView(
                        child: new Column(
                            crossAxisAlignment: CrossAxisAlignment.stretch,
                            children: new List <Widget>
            {
                #region MMD4Mecanim Model
                new Text("MMD4Mecanim Model", style: Theme.of(context).textTheme.headline),
                new Text("FBX converted from MMD4Mecanim", style: Theme.of(context).textTheme.subhead),

                new DragableBox(hint: "Drag your pmx here"),
                new DragableBox(hint: "Drag your prefab here"),
                #endregion

                #region Blender FBX
                new Text("Blender FBX", style: Theme.of(context).textTheme.headline),
                new Text("FBX exported from blender with CATS or MMDTools", style: Theme.of(context).textTheme.subhead),

                new DragableBox(hint: "Drag your pmx here"),
                new DragableBox(hint: "Drag your prefab here"),
                #endregion

                new Text("MMD Bridge Alembic", style: Theme.of(context).textTheme.headline),
                new Text("Alembic exported MMD Bridge", style: Theme.of(context).textTheme.subhead),
            }
                            )
                        )
                    )
                ),
        }
            );